[MPlayer-dev-eng] [PATCH] hack to make blender mjpeg files play again

Reimar Doeffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Fri Feb 2 13:50:55 CET 2007


Hello,
attached hack solves http://bugzilla.mplayerhq.hu/show_bug.cgi?id=642.
Is it acceptable or does someone have a better suggestion?

Greetings,
Reimar Doeffinger
-------------- next part --------------
Index: libmpcodecs/vd_ffmpeg.c
===================================================================
--- libmpcodecs/vd_ffmpeg.c	(revision 22100)
+++ libmpcodecs/vd_ffmpeg.c	(working copy)
@@ -221,6 +221,8 @@
 
 // init driver
 static int init(sh_video_t *sh){
+    static const uint8_t broken_huff[] =
+        {0x2c,0,0,0,0x18,0,0,0,0,0,0,0,2,0,0,0,8,0,0,0,2,0,0,0,1,0,0,0};
     AVCodecContext *avctx;
     vd_ffmpeg_ctx *ctx;
     AVCodec *lavc_codec;
@@ -337,6 +339,11 @@
        MJPG fourcc :( */
 	if (!sh->bih || sh->bih->biSize <= sizeof(BITMAPINFOHEADER))
 	    break;
+	// HACK: blender creates broken files with all-back huffman table,
+	// filter that one out
+	if (sh->bih->biSize - sizeof(BITMAPINFOHEADER) == sizeof(broken_huff) &&
+	    memcmp(sh->bih+1, broken_huff, sizeof(broken_huff)) == 0)
+	    break;
 	avctx->flags |= CODEC_FLAG_EXTERN_HUFF;
 	avctx->extradata_size = sh->bih->biSize-sizeof(BITMAPINFOHEADER);
 	avctx->extradata = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);


More information about the MPlayer-dev-eng mailing list