comparison libmpcodecs/vd_ffmpeg.c @ 6265:f49ec39ab0c6

workaround bugs & error resilience ffmpeg decoder options
author michael
date Sun, 02 Jun 2002 12:48:55 +0000
parents dd7b88bb76aa
children e97686ab386b
comparison
equal deleted inserted replaced
6264:db49a8c56da1 6265:f49ec39ab0c6
48 } vd_ffmpeg_ctx; 48 } vd_ffmpeg_ctx;
49 49
50 //#ifdef FF_POSTPROCESS 50 //#ifdef FF_POSTPROCESS
51 //unsigned int lavc_pp=0; 51 //unsigned int lavc_pp=0;
52 //#endif 52 //#endif
53
54 #include "cfgparser.h"
55
56 static int lavc_param_workaround_bugs=0;
57 static int lavc_param_error_resilience=0;
58
59 struct config lavc_decode_opts_conf[]={
60 #if LIBAVCODEC_BUILD >= 4611
61 {"bug", &lavc_param_workaround_bugs, CONF_TYPE_INT, CONF_RANGE, 0, 99, NULL},
62 {"ver", &lavc_param_error_resilience, CONF_TYPE_INT, CONF_RANGE, -1, 99, NULL},
63 #endif
64 {NULL, NULL, 0, 0, 0, 0, NULL}
65 };
53 66
54 // to set/get/query special features/parameters 67 // to set/get/query special features/parameters
55 static int control(sh_video_t *sh,int cmd,void* arg,...){ 68 static int control(sh_video_t *sh,int cmd,void* arg,...){
56 vd_ffmpeg_ctx *ctx = sh->context; 69 vd_ffmpeg_ctx *ctx = sh->context;
57 switch(cmd){ 70 switch(cmd){
95 memset(ctx->avctx, 0, sizeof(AVCodecContext)); 108 memset(ctx->avctx, 0, sizeof(AVCodecContext));
96 avctx = ctx->avctx; 109 avctx = ctx->avctx;
97 110
98 avctx->width = sh->disp_w; 111 avctx->width = sh->disp_w;
99 avctx->height= sh->disp_h; 112 avctx->height= sh->disp_h;
113 #if LIBAVCODEC_BUILD >= 4611
114 avctx->workaround_bugs= lavc_param_workaround_bugs;
115 avctx->error_resilience= lavc_param_error_resilience;
116 #endif
117
100 mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"libavcodec.size: %d x %d\n",avctx->width,avctx->height); 118 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')) 119 if (sh->format == mmioFOURCC('R', 'V', '1', '3'))
102 avctx->sub_id = 3; 120 avctx->sub_id = 3;
103 #if LIBAVCODEC_BUILD >= 4605 121 #if LIBAVCODEC_BUILD >= 4605
104 /* AVRn stores huffman table in AVI header */ 122 /* AVRn stores huffman table in AVI header */
197 avctx->hurry_up=(flags&3)?((flags&2)?2:1):0; 215 avctx->hurry_up=(flags&3)?((flags&2)?2:1):0;
198 #endif 216 #endif
199 217
200 ret = avcodec_decode_video(avctx, &lavc_picture, 218 ret = avcodec_decode_video(avctx, &lavc_picture,
201 &got_picture, data, len); 219 &got_picture, data, len);
202
203 if(ret<0) mp_msg(MSGT_DECVIDEO,MSGL_WARN, "Error while decoding frame!\n"); 220 if(ret<0) mp_msg(MSGT_DECVIDEO,MSGL_WARN, "Error while decoding frame!\n");
204 if(!got_picture) return NULL; // skipped image 221 if(!got_picture) return NULL; // skipped image
205 222
206 if (avctx->aspect_ratio_info != ctx->last_aspect || 223 if (avctx->aspect_ratio_info != ctx->last_aspect ||
207 avctx->width != sh->disp_w || 224 avctx->width != sh->disp_w ||
208 avctx->height != sh->disp_h || 225 avctx->height != sh->disp_h ||
209 !ctx->vo_inited) 226 !ctx->vo_inited)
210 { 227 {