[FFmpeg-devel] [PATCH] add md5 muxer

Reimar Döffinger Reimar.Doeffinger
Mon May 24 01:31:46 CEST 2010


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.

> [...]
> 
> 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);



More information about the ffmpeg-devel mailing list