From: Paul B Mahol <onemda@gmail.com> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] avformat/wvdec: parse last chunk that may store MD5 checksum Date: Sun, 20 Feb 2022 23:02:42 +0100 Message-ID: <20220220220242.401901-2-onemda@gmail.com> (raw) In-Reply-To: <20220220220242.401901-1-onemda@gmail.com> Signed-off-by: Paul B Mahol <onemda@gmail.com> --- libavformat/wvdec.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/libavformat/wvdec.c b/libavformat/wvdec.c index 0d5a86953d..ffefda1cce 100644 --- a/libavformat/wvdec.c +++ b/libavformat/wvdec.c @@ -108,7 +108,7 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb) /* Blocks with zero samples don't contain actual audio information * and should be ignored */ if (!wc->header.samples) - return 0; + wc->block_parsed = 0; // parse flags flags = wc->header.flags; rate_x = (flags & WV_DSD) ? 4 : 1; @@ -121,7 +121,7 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb) chan = wc->chan; chmask = wc->chmask; } - if ((rate == -1 || !chan || flags & WV_DSD) && !wc->block_parsed) { + if ((rate == -1 || !chan || flags & WV_DSD || !wc->header.samples) && !wc->block_parsed) { int64_t block_end = avio_tell(pb) + wc->header.blocksize; if (!(pb->seekable & AVIO_SEEKABLE_NORMAL)) { av_log(ctx, AV_LOG_ERROR, @@ -187,6 +187,17 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb) case 0x27: rate = avio_rl24(pb); break; + case 0x26: + if (size == 16) { + uint8_t md5[16]; + char md5_hex[2 * sizeof(md5) + 1]; + + if (avio_read(pb, md5, 16) == 16) { + ff_data_to_hex(md5_hex, md5, sizeof(md5), 1); + av_log(ctx, AV_LOG_VERBOSE, "MD5=%s\n", md5_hex); + } + break; + } default: avio_skip(pb, size); } @@ -200,6 +211,8 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb) } avio_seek(pb, block_end - wc->header.blocksize, SEEK_SET); } + if (!wc->header.samples) + return 0; if (!wc->bpp) wc->bpp = bpp; if (!wc->chan) -- 2.33.0 _______________________________________________ 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".
next prev parent reply other threads:[~2022-02-20 22:01 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-02-20 22:02 [FFmpeg-devel] [PATCH] avfilter/framepool: fix alignment requirements for audio and video filters Paul B Mahol 2022-02-20 22:02 ` Paul B Mahol [this message] 2022-02-21 1:53 ` James Almer 2022-02-21 11:33 ` Paul B Mahol 2022-02-21 12:08 ` James Almer
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=20220220220242.401901-2-onemda@gmail.com \ --to=onemda@gmail.com \ --cc=ffmpeg-devel@ffmpeg.org \ /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