[Mplayer-cvslog] CVS: main/libmpcodecs vd_ffmpeg.c,1.18,1.19

Alex Beregszaszi alex at mplayerhq.hu
Thu May 2 14:25:04 CEST 2002


Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv19541

Modified Files:
	vd_ffmpeg.c 
Log Message:
avid mjpeg support (external huffman table)

Index: vd_ffmpeg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vd_ffmpeg.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- vd_ffmpeg.c	27 Apr 2002 23:45:00 -0000	1.18
+++ vd_ffmpeg.c	2 May 2002 12:24:53 -0000	1.19
@@ -100,6 +100,32 @@
     mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"libavcodec.size: %d x %d\n",avctx->width,avctx->height);
     if (sh->format == mmioFOURCC('R', 'V', '1', '3'))
 	avctx->sub_id = 3;
+#if LIBAVCODEC_BUILD >= 4605
+    /* AVRn stores huffman table in AVI header */
+    /* Pegasus MJPEG stores it also in AVI header, but it uses the common
+       MJPG fourcc :( */
+    if ((sh->bih->biSize != sizeof(BITMAPINFOHEADER)) &&
+	(sh->format == mmioFOURCC('A','V','R','n') ||
+	sh->format == mmioFOURCC('M','J','P','G')))
+    {
+	avctx->flags |= CODEC_FLAG_EXTERN_HUFF;
+	avctx->extradata_size = sh->bih->biSize-sizeof(BITMAPINFOHEADER);
+	avctx->extradata = malloc(avctx->extradata_size);
+	memcpy(avctx->extradata, sh->bih+sizeof(BITMAPINFOHEADER),
+	    avctx->extradata_size);
+
+#if 0
+	{
+	    int x;
+	    uint8_t *p = avctx->extradata;
+	    
+	    for (x=0; x<avctx->extradata_size; x++)
+		printf("[%x] ", p[x]);
+	    printf("\n");
+	}
+#endif
+    }
+#endif
     /* open it */
     if (avcodec_open(avctx, lavc_codec) < 0) {
         mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantOpenCodec);
@@ -117,6 +143,12 @@
 
     if (avcodec_close(avctx) < 0)
     	    mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantCloseCodec);
+
+#if LIBAVCODEC_BUILD >= 4605
+    if (avctx->extradata_size)
+	free(avctx->extradata);
+#endif
+
     if (avctx)
 	free(avctx);
     if (ctx)




More information about the MPlayer-cvslog mailing list