# HG changeset patch # User alex # Date 1020342293 0 # Node ID 65ee86f5a45f6ef5a21a55ed75d680a4b9e5f3cd # Parent 8404cfc33bb9c3a13304ee7b47769e9b7cacf313 avid mjpeg support (external huffman table) diff -r 8404cfc33bb9 -r 65ee86f5a45f libmpcodecs/vd_ffmpeg.c --- a/libmpcodecs/vd_ffmpeg.c Thu May 02 11:50:39 2002 +0000 +++ b/libmpcodecs/vd_ffmpeg.c Thu May 02 12:24:53 2002 +0000 @@ -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; xextradata_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)