From: wangyaqiang via ffmpeg-devel <ffmpeg-devel@ffmpeg.org> To: ffmpeg-devel@ffmpeg.org Cc: 1035567130@qq.com, 汪亚强 <wangyaqiang03@kuaishou.com> Subject: [FFmpeg-devel] [PATCH] avformat/demux: Fixed the incorrect id3 tag checking logic, Date: Fri, 21 Feb 2025 12:17:11 +0800 Message-ID: <tencent_DB2BAB583C363ED518ADBB82F12D0F9D250A@qq.com> (raw) From: 汪亚强 <wangyaqiang03@kuaishou.com> detect only audio formats where the tag might exist. For example, if an rgb rawvideo data starts with ID3, it will cause the packet data to be missing by 10 bytes, causing a transcoding error. Signed-off-by: 汪亚强 <wangyaqiang03@kuaishou.com> --- libavformat/demux.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/demux.c b/libavformat/demux.c index 0e39346f62..d9c9766d51 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -299,9 +299,10 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, goto fail; } } - + int id3v2_check = (!strcmp(s->iformat->name, "mp3") || !strcmp(s->iformat->name, "aac") || + !strcmp(s->iformat->name, "tta") || !strcmp(s->iformat->name, "wav")); /* e.g. AVFMT_NOFILE formats will not have an AVIOContext */ - if (s->pb) + if (s->pb && id3v2_check) ff_id3v2_read_dict(s->pb, &si->id3v2_meta, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta); if (ffifmt(s->iformat)->read_header) @@ -320,8 +321,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, } if (id3v2_extra_meta) { - if (!strcmp(s->iformat->name, "mp3") || !strcmp(s->iformat->name, "aac") || - !strcmp(s->iformat->name, "tta") || !strcmp(s->iformat->name, "wav")) { + if (id3v2_check) { if ((ret = ff_id3v2_parse_apic(s, id3v2_extra_meta)) < 0) goto close; if ((ret = ff_id3v2_parse_chapters(s, id3v2_extra_meta)) < 0) -- 2.39.3 (Apple Git-146) _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
reply other threads:[~2025-02-21 4:17 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=tencent_DB2BAB583C363ED518ADBB82F12D0F9D250A@qq.com \ --to=ffmpeg-devel@ffmpeg.org \ --cc=1035567130@qq.com \ --cc=wangyaqiang03@kuaishou.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git