[FFmpeg-devel] [PATCH] add md5 muxer

Baptiste Coudurier baptiste.coudurier
Mon May 24 01:34:29 CEST 2010


On 5/23/10 4:31 PM, Reimar D?ffinger wrote:
> On Sun, May 23, 2010 at 03:30:10PM -0700, Baptiste Coudurier wrote:
>>> +static void md5_finish(struct AVFormatContext *s, char *buf)
>>> +{
>>> +    uint8_t md5[16];
>>> +    int i, offset = strlen(buf);
>>> +    av_md5_final(s->priv_data, md5);
>>> +    for (i = 0; i<   sizeof(md5); i++) {
>>> +        snprintf(buf + offset, 3, "%02"PRIx8, md5[i]);
>>> +        offset += 2;
>>> +    }
>>> +    buf[offset] = '\n';
>>> +    buf[offset+1] = 0;
>>
>> Nitpick, but you can put_buffer(s->pb, "\n", 1);
>
> Haven't checked if it makes a difference within the framework,
> but I'd prefer it if the whole data was done with a single write,
> can give nicer output if it is written to stdout in a multithreaded
> environment.

All right.

>> [...]
>>
>> Btw, I'm having hard time getting same results for:
>> mplayer test.y4m -vo md5sum:outfile=/dev/stdout
>> and ffmpeg -i test.y4m -f framemd5 -
>
> MPlayer interleaves the U and V lines when calculating the MD5.
> No idea if that is intentional...
> I suspect this should make them match:
> Index: libvo/vo_md5sum.c
> ===================================================================
> --- libvo/vo_md5sum.c	(revision 31204)
> +++ libvo/vo_md5sum.c	(working copy)
> @@ -219,6 +219,8 @@
>               h = h / 2;
>               for (i=0; i<h; i++) {
>                   av_md5_update(md5_context, planeU + i * strideU, w);
> +            }
> +            for (i=0; i<h; i++) {
>                   av_md5_update(md5_context, planeV + i * strideV, w);
>               }
>               av_md5_final(md5_context, md5sum);

Indeed it works. This is weird, thanks.

-- 
Baptiste COUDURIER
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org



More information about the ffmpeg-devel mailing list