Mercurial > mplayer.hg
comparison libmpcodecs/vd_ffmpeg.c @ 5939:65ee86f5a45f
avid mjpeg support (external huffman table)
author | alex |
---|---|
date | Thu, 02 May 2002 12:24:53 +0000 |
parents | bcf5220e98af |
children | dd7b88bb76aa |
comparison
equal
deleted
inserted
replaced
5938:8404cfc33bb9 | 5939:65ee86f5a45f |
---|---|
98 avctx->width = sh->disp_w; | 98 avctx->width = sh->disp_w; |
99 avctx->height= sh->disp_h; | 99 avctx->height= sh->disp_h; |
100 mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"libavcodec.size: %d x %d\n",avctx->width,avctx->height); | 100 mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"libavcodec.size: %d x %d\n",avctx->width,avctx->height); |
101 if (sh->format == mmioFOURCC('R', 'V', '1', '3')) | 101 if (sh->format == mmioFOURCC('R', 'V', '1', '3')) |
102 avctx->sub_id = 3; | 102 avctx->sub_id = 3; |
103 #if LIBAVCODEC_BUILD >= 4605 | |
104 /* AVRn stores huffman table in AVI header */ | |
105 /* Pegasus MJPEG stores it also in AVI header, but it uses the common | |
106 MJPG fourcc :( */ | |
107 if ((sh->bih->biSize != sizeof(BITMAPINFOHEADER)) && | |
108 (sh->format == mmioFOURCC('A','V','R','n') || | |
109 sh->format == mmioFOURCC('M','J','P','G'))) | |
110 { | |
111 avctx->flags |= CODEC_FLAG_EXTERN_HUFF; | |
112 avctx->extradata_size = sh->bih->biSize-sizeof(BITMAPINFOHEADER); | |
113 avctx->extradata = malloc(avctx->extradata_size); | |
114 memcpy(avctx->extradata, sh->bih+sizeof(BITMAPINFOHEADER), | |
115 avctx->extradata_size); | |
116 | |
117 #if 0 | |
118 { | |
119 int x; | |
120 uint8_t *p = avctx->extradata; | |
121 | |
122 for (x=0; x<avctx->extradata_size; x++) | |
123 printf("[%x] ", p[x]); | |
124 printf("\n"); | |
125 } | |
126 #endif | |
127 } | |
128 #endif | |
103 /* open it */ | 129 /* open it */ |
104 if (avcodec_open(avctx, lavc_codec) < 0) { | 130 if (avcodec_open(avctx, lavc_codec) < 0) { |
105 mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantOpenCodec); | 131 mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantOpenCodec); |
106 return 0; | 132 return 0; |
107 } | 133 } |
115 vd_ffmpeg_ctx *ctx = sh->context; | 141 vd_ffmpeg_ctx *ctx = sh->context; |
116 AVCodecContext *avctx = ctx->avctx; | 142 AVCodecContext *avctx = ctx->avctx; |
117 | 143 |
118 if (avcodec_close(avctx) < 0) | 144 if (avcodec_close(avctx) < 0) |
119 mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantCloseCodec); | 145 mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantCloseCodec); |
146 | |
147 #if LIBAVCODEC_BUILD >= 4605 | |
148 if (avctx->extradata_size) | |
149 free(avctx->extradata); | |
150 #endif | |
151 | |
120 if (avctx) | 152 if (avctx) |
121 free(avctx); | 153 free(avctx); |
122 if (ctx) | 154 if (ctx) |
123 free(ctx); | 155 free(ctx); |
124 } | 156 } |