comparison libmpcodecs/vd_ffmpeg.c @ 19278:c41d4672c675

Fix SVQ3 extradata handling so it works correctly with demux_lavf
author pacman
date Mon, 31 Jul 2006 22:26:25 +0000
parents 3f910f7b0e53
children b3ef93332896
comparison
equal deleted inserted replaced
19277:3f910f7b0e53 19278:c41d4672c675
262 avctx->skip_loop_filter = str2AVDiscard(lavc_param_skip_loop_filter_str); 262 avctx->skip_loop_filter = str2AVDiscard(lavc_param_skip_loop_filter_str);
263 avctx->skip_idct = str2AVDiscard(lavc_param_skip_idct_str); 263 avctx->skip_idct = str2AVDiscard(lavc_param_skip_idct_str);
264 avctx->skip_frame = str2AVDiscard(lavc_param_skip_frame_str); 264 avctx->skip_frame = str2AVDiscard(lavc_param_skip_frame_str);
265 mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"libavcodec.size: %d x %d\n",avctx->width,avctx->height); 265 mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"libavcodec.size: %d x %d\n",avctx->width,avctx->height);
266 switch (sh->format) { 266 switch (sh->format) {
267 case mmioFOURCC('S','V','Q','3'):
268 /* SVQ3 extradata can show up as sh->ImageDesc if demux_mov is used, or
269 in the phony AVI header if demux_lavf is used. The first case is
270 handled here; the second case falls through to the next section. */
271 if (sh->ImageDesc) {
272 avctx->extradata_size = (*(int*)sh->ImageDesc) - sizeof(int);
273 avctx->extradata = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
274 memcpy(avctx->extradata, ((int*)sh->ImageDesc)+1, avctx->extradata_size);
275 break;
276 }
277 /* fallthrough */
278
267 case mmioFOURCC('A','V','R','n'): 279 case mmioFOURCC('A','V','R','n'):
268 case mmioFOURCC('M','J','P','G'): 280 case mmioFOURCC('M','J','P','G'):
269 /* AVRn stores huffman table in AVI header */ 281 /* AVRn stores huffman table in AVI header */
270 /* Pegasus MJPEG stores it also in AVI header, but it uses the common 282 /* Pegasus MJPEG stores it also in AVI header, but it uses the common
271 MJPG fourcc :( */ 283 MJPG fourcc :( */
309 ((uint32_t*)avctx->extradata)[1] = be2me_32(extrahdr[1]); 321 ((uint32_t*)avctx->extradata)[1] = be2me_32(extrahdr[1]);
310 } 322 }
311 323
312 // printf("%X %X %d %d\n", extrahdr[0], extrahdr[1]); 324 // printf("%X %X %d %d\n", extrahdr[0], extrahdr[1]);
313 break; 325 break;
314
315 case mmioFOURCC('S','V','Q','3'):
316 if (!sh->ImageDesc)
317 break;
318 avctx->extradata_size = (*(int*)sh->ImageDesc) - sizeof(int);
319 avctx->extradata = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
320 memcpy(avctx->extradata, ((int*)sh->ImageDesc)+1, avctx->extradata_size);
321 break;
322 326
323 default: 327 default:
324 if (!sh->bih || sh->bih->biSize <= sizeof(BITMAPINFOHEADER)) 328 if (!sh->bih || sh->bih->biSize <= sizeof(BITMAPINFOHEADER))
325 break; 329 break;
326 avctx->extradata_size = sh->bih->biSize-sizeof(BITMAPINFOHEADER); 330 avctx->extradata_size = sh->bih->biSize-sizeof(BITMAPINFOHEADER);