aboutsummaryrefslogtreecommitdiffhomepage
path: root/libmpcodecs
diff options
context:
space:
mode:
authorGravatar alex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-05-02 12:24:53 +0000
committerGravatar alex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-05-02 12:24:53 +0000
commit4db2e1351dcd7351c59e4f6a8cf02364453fbdec (patch)
treedb6abd8c76709d4996b46752bbcafd512b8950c6 /libmpcodecs
parent178757d88730f55ecd6683a9da2fe53f77a65a55 (diff)
avid mjpeg support (external huffman table)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@5940 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/vd_ffmpeg.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index 6586157805..d0a03e2a1f 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -100,6 +100,32 @@ static int init(sh_video_t *sh){
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 @@ static void uninit(sh_video_t *sh){
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)