Mercurial > mplayer.hg
comparison libmpcodecs/vd_ffmpeg.c @ 8340:a17ce1496ca6
cleanup
author | michael |
---|---|
date | Wed, 04 Dec 2002 11:53:47 +0000 |
parents | ff0bddb59e81 |
children | fd670708f87f |
comparison
equal
deleted
inserted
replaced
8339:ff0bddb59e81 | 8340:a17ce1496ca6 |
---|---|
31 #else | 31 #else |
32 #include "libavcodec/avcodec.h" | 32 #include "libavcodec/avcodec.h" |
33 #endif | 33 #endif |
34 | 34 |
35 #if LIBAVCODEC_BUILD < 4641 | 35 #if LIBAVCODEC_BUILD < 4641 |
36 #error your version of libavcodec is too old, get a newer one, and dont send a bugreport, THIS IS NO BUG | 36 #error we dont support libavcodec prior to build 4641, get the latest libavcodec CVS |
37 #endif | 37 #endif |
38 | 38 |
39 int avcodec_inited=0; | 39 int avcodec_inited=0; |
40 | 40 |
41 #if defined(FF_POSTPROCESS) && defined(MBR) | 41 #if defined(FF_POSTPROCESS) && defined(MBR) |
62 #include "cfgparser.h" | 62 #include "cfgparser.h" |
63 | 63 |
64 static int get_buffer(AVCodecContext *avctx, AVVideoFrame *pic); | 64 static int get_buffer(AVCodecContext *avctx, AVVideoFrame *pic); |
65 static void release_buffer(AVCodecContext *avctx, AVVideoFrame *pic); | 65 static void release_buffer(AVCodecContext *avctx, AVVideoFrame *pic); |
66 | 66 |
67 #ifdef FF_BUG_AUTODETECT | |
68 static int lavc_param_workaround_bugs= FF_BUG_AUTODETECT; | 67 static int lavc_param_workaround_bugs= FF_BUG_AUTODETECT; |
69 #else | |
70 static int lavc_param_workaround_bugs= 0; | |
71 #endif | |
72 static int lavc_param_error_resilience=2; | 68 static int lavc_param_error_resilience=2; |
73 static int lavc_param_error_concealment=3; | 69 static int lavc_param_error_concealment=3; |
74 static int lavc_param_gray=0; | 70 static int lavc_param_gray=0; |
75 static int lavc_param_vstats=0; | 71 static int lavc_param_vstats=0; |
76 static int lavc_param_idct_algo=0; | 72 static int lavc_param_idct_algo=0; |
77 | 73 |
78 struct config lavc_decode_opts_conf[]={ | 74 struct config lavc_decode_opts_conf[]={ |
79 #if LIBAVCODEC_BUILD >= 4611 | |
80 {"bug", &lavc_param_workaround_bugs, CONF_TYPE_INT, CONF_RANGE, -1, 99, NULL}, | 75 {"bug", &lavc_param_workaround_bugs, CONF_TYPE_INT, CONF_RANGE, -1, 99, NULL}, |
81 {"er", &lavc_param_error_resilience, CONF_TYPE_INT, CONF_RANGE, 0, 99, NULL}, | 76 {"er", &lavc_param_error_resilience, CONF_TYPE_INT, CONF_RANGE, 0, 99, NULL}, |
82 #endif | |
83 #if LIBAVCODEC_BUILD >= 4614 | |
84 {"gray", &lavc_param_gray, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART, NULL}, | 77 {"gray", &lavc_param_gray, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART, NULL}, |
85 #endif | |
86 #if LIBAVCODEC_BUILD >= 4629 | |
87 {"idct", &lavc_param_idct_algo, CONF_TYPE_INT, CONF_RANGE, 0, 99, NULL}, | 78 {"idct", &lavc_param_idct_algo, CONF_TYPE_INT, CONF_RANGE, 0, 99, NULL}, |
88 #endif | |
89 #if LIBAVCODEC_BUILD >= 4631 | |
90 {"ec", &lavc_param_error_concealment, CONF_TYPE_INT, CONF_RANGE, 0, 99, NULL}, | 79 {"ec", &lavc_param_error_concealment, CONF_TYPE_INT, CONF_RANGE, 0, 99, NULL}, |
91 #endif | |
92 {"vstats", &lavc_param_vstats, CONF_TYPE_FLAG, 0, 0, 1, NULL}, | 80 {"vstats", &lavc_param_vstats, CONF_TYPE_FLAG, 0, 0, 1, NULL}, |
93 {NULL, NULL, 0, 0, 0, 0, NULL} | 81 {NULL, NULL, 0, 0, 0, 0, NULL} |
94 }; | 82 }; |
95 | 83 |
96 // to set/get/query special features/parameters | 84 // to set/get/query special features/parameters |
145 } | 133 } |
146 | 134 |
147 if(vd_use_slices && lavc_codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND) | 135 if(vd_use_slices && lavc_codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND) |
148 ctx->do_slices=1; | 136 ctx->do_slices=1; |
149 | 137 |
150 #if LIBAVCODEC_BUILD > 4615 | |
151 if(lavc_codec->capabilities&CODEC_CAP_DR1) | 138 if(lavc_codec->capabilities&CODEC_CAP_DR1) |
152 ctx->do_dr1=1; | 139 ctx->do_dr1=1; |
153 //XXX:FIXME:HACK:UGLY 422P with direct rendering is buggy cuz of that chroma stride trick ... | 140 //XXX:FIXME:HACK:UGLY 422P with direct rendering is buggy cuz of that chroma stride trick ... |
154 if(sh->format == mmioFOURCC('H','F','Y','U')) | 141 if(sh->format == mmioFOURCC('H','F','Y','U')) |
155 ctx->do_dr1=0; | 142 ctx->do_dr1=0; |
156 #endif | |
157 ctx->b_age= ctx->ip_age[0]= ctx->ip_age[1]= 256*256*256*64; | 143 ctx->b_age= ctx->ip_age[0]= ctx->ip_age[1]= 256*256*256*64; |
158 | 144 |
159 #if LIBAVCODEC_BUILD >= 4641 | |
160 ctx->pic = avcodec_alloc_picture(); | 145 ctx->pic = avcodec_alloc_picture(); |
161 #endif | |
162 #if LIBAVCODEC_BUILD >= 4624 | |
163 ctx->avctx = avcodec_alloc_context(); | 146 ctx->avctx = avcodec_alloc_context(); |
164 #else | |
165 ctx->avctx = malloc(sizeof(AVCodecContext)); | |
166 memset(ctx->avctx, 0, sizeof(AVCodecContext)); | |
167 #endif | |
168 avctx = ctx->avctx; | 147 avctx = ctx->avctx; |
169 | 148 |
170 #if LIBAVCODEC_BUILD > 4615 | |
171 if(ctx->do_dr1){ | 149 if(ctx->do_dr1){ |
172 avctx->flags|= CODEC_FLAG_EMU_EDGE; | 150 avctx->flags|= CODEC_FLAG_EMU_EDGE; |
173 avctx->get_buffer= get_buffer; | 151 avctx->get_buffer= get_buffer; |
174 avctx->release_buffer= release_buffer; | 152 avctx->release_buffer= release_buffer; |
175 } | 153 } |
176 #endif | |
177 | 154 |
178 #ifdef CODEC_FLAG_NOT_TRUNCATED | 155 #ifdef CODEC_FLAG_NOT_TRUNCATED |
179 avctx->flags|= CODEC_FLAG_NOT_TRUNCATED; | 156 avctx->flags|= CODEC_FLAG_NOT_TRUNCATED; |
180 #endif | 157 #endif |
181 | 158 |
182 avctx->width = sh->disp_w; | 159 avctx->width = sh->disp_w; |
183 avctx->height= sh->disp_h; | 160 avctx->height= sh->disp_h; |
184 #if LIBAVCODEC_BUILD >= 4611 | |
185 avctx->workaround_bugs= lavc_param_workaround_bugs; | 161 avctx->workaround_bugs= lavc_param_workaround_bugs; |
186 avctx->error_resilience= lavc_param_error_resilience; | 162 avctx->error_resilience= lavc_param_error_resilience; |
187 #endif | |
188 #if LIBAVCODEC_BUILD >= 4614 | |
189 if(lavc_param_gray) avctx->flags|= CODEC_FLAG_GRAY; | 163 if(lavc_param_gray) avctx->flags|= CODEC_FLAG_GRAY; |
190 #endif | |
191 #if LIBAVCODEC_BUILD >= 4628 | |
192 avctx->fourcc= sh->format; | 164 avctx->fourcc= sh->format; |
193 #endif | |
194 #if LIBAVCODEC_BUILD >= 4629 | |
195 avctx->idct_algo= lavc_param_idct_algo; | 165 avctx->idct_algo= lavc_param_idct_algo; |
196 #endif | |
197 #if LIBAVCODEC_BUILD >= 4631 | |
198 avctx->error_concealment= lavc_param_error_concealment; | 166 avctx->error_concealment= lavc_param_error_concealment; |
199 #endif | |
200 | 167 |
201 mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"libavcodec.size: %d x %d\n",avctx->width,avctx->height); | 168 mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"libavcodec.size: %d x %d\n",avctx->width,avctx->height); |
202 #if LIBAVCODEC_BUILD >= 4605 | |
203 /* AVRn stores huffman table in AVI header */ | 169 /* AVRn stores huffman table in AVI header */ |
204 /* Pegasus MJPEG stores it also in AVI header, but it uses the common | 170 /* Pegasus MJPEG stores it also in AVI header, but it uses the common |
205 MJPG fourcc :( */ | 171 MJPG fourcc :( */ |
206 if (sh->bih && (sh->bih->biSize != sizeof(BITMAPINFOHEADER)) && | 172 if (sh->bih && (sh->bih->biSize != sizeof(BITMAPINFOHEADER)) && |
207 (sh->format == mmioFOURCC('A','V','R','n') || | 173 (sh->format == mmioFOURCC('A','V','R','n') || |
222 printf("[%x] ", p[x]); | 188 printf("[%x] ", p[x]); |
223 printf("\n"); | 189 printf("\n"); |
224 } | 190 } |
225 #endif | 191 #endif |
226 } | 192 } |
227 #endif | |
228 if( sh->format == mmioFOURCC('R', 'V', '1', '0') | 193 if( sh->format == mmioFOURCC('R', 'V', '1', '0') |
229 || sh->format == mmioFOURCC('R', 'V', '1', '3')){ | 194 || sh->format == mmioFOURCC('R', 'V', '1', '3')){ |
230 avctx->extradata_size= 8; | 195 avctx->extradata_size= 8; |
231 avctx->extradata = malloc(avctx->extradata_size); | 196 avctx->extradata = malloc(avctx->extradata_size); |
232 if(sh->bih->biSize!=sizeof(*sh->bih)+8){ | 197 if(sh->bih->biSize!=sizeof(*sh->bih)+8){ |
255 avctx->extradata_size = sh->bih->biSize-sizeof(BITMAPINFOHEADER); | 220 avctx->extradata_size = sh->bih->biSize-sizeof(BITMAPINFOHEADER); |
256 avctx->extradata = malloc(avctx->extradata_size); | 221 avctx->extradata = malloc(avctx->extradata_size); |
257 memcpy(avctx->extradata, sh->bih+1, avctx->extradata_size); | 222 memcpy(avctx->extradata, sh->bih+1, avctx->extradata_size); |
258 } | 223 } |
259 | 224 |
260 #if LIBAVCODEC_BUILD >= 4639 | |
261 if(sh->bih) | 225 if(sh->bih) |
262 avctx->bits_per_sample= sh->bih->biBitCount; | 226 avctx->bits_per_sample= sh->bih->biBitCount; |
263 #endif | |
264 | 227 |
265 /* open it */ | 228 /* open it */ |
266 if (avcodec_open(avctx, lavc_codec) < 0) { | 229 if (avcodec_open(avctx, lavc_codec) < 0) { |
267 mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantOpenCodec); | 230 mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantOpenCodec); |
268 return 0; | 231 return 0; |
278 AVCodecContext *avctx = ctx->avctx; | 241 AVCodecContext *avctx = ctx->avctx; |
279 | 242 |
280 if (avcodec_close(avctx) < 0) | 243 if (avcodec_close(avctx) < 0) |
281 mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantCloseCodec); | 244 mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantCloseCodec); |
282 | 245 |
283 #if LIBAVCODEC_BUILD >= 4605 | |
284 if (avctx->extradata_size) | 246 if (avctx->extradata_size) |
285 free(avctx->extradata); | 247 free(avctx->extradata); |
286 avctx->extradata=NULL; | 248 avctx->extradata=NULL; |
287 #endif | |
288 #if LIBAVCODEC_BUILD >= 4630 | |
289 if(avctx->slice_offset!=NULL) | 249 if(avctx->slice_offset!=NULL) |
290 free(avctx->slice_offset); | 250 free(avctx->slice_offset); |
291 avctx->slice_offset=NULL; | 251 avctx->slice_offset=NULL; |
292 #endif | |
293 | 252 |
294 if (avctx) | 253 if (avctx) |
295 free(avctx); | 254 free(avctx); |
296 if (ctx->pic) | 255 if (ctx->pic) |
297 free(ctx->pic); | 256 free(ctx->pic); |
304 int y, int width, int height){ | 263 int y, int width, int height){ |
305 sh_video_t * sh = s->opaque; | 264 sh_video_t * sh = s->opaque; |
306 int stride[3]; | 265 int stride[3]; |
307 int start=0, i; | 266 int start=0, i; |
308 int skip_stride= (s->width+15)>>4; | 267 int skip_stride= (s->width+15)>>4; |
309 #if LIBAVCODEC_BUILD >= 4641 | |
310 UINT8 *skip= &s->coded_picture->mbskip_table[(y>>4)*skip_stride]; | 268 UINT8 *skip= &s->coded_picture->mbskip_table[(y>>4)*skip_stride]; |
311 int threshold= s->coded_picture->age; | 269 int threshold= s->coded_picture->age; |
312 #endif | |
313 | 270 |
314 stride[0]=linesize; | 271 stride[0]=linesize; |
315 #if LIBAVCODEC_BUILD >= 4641 | |
316 if(s->coded_picture->linesize[1]){ | 272 if(s->coded_picture->linesize[1]){ |
317 stride[1]= s->coded_picture->linesize[1]; | 273 stride[1]= s->coded_picture->linesize[1]; |
318 stride[2]= s->coded_picture->linesize[2]; | 274 stride[2]= s->coded_picture->linesize[2]; |
319 }else | 275 }else |
320 #endif | |
321 stride[1]=stride[2]=stride[0]/2; | 276 stride[1]=stride[2]=stride[0]/2; |
322 #if 0 | 277 #if 0 |
323 if(s->pict_type!=B_TYPE){ | 278 if(s->pict_type!=B_TYPE){ |
324 for(i=0; i*16<width+16; i++){ | 279 for(i=0; i*16<width+16; i++){ |
325 if(i*16>=width || skip[i]>=threshold){ | 280 if(i*16>=width || skip[i]>=threshold){ |
346 if (avctx->aspect_ratio != ctx->last_aspect || | 301 if (avctx->aspect_ratio != ctx->last_aspect || |
347 avctx->width != sh->disp_w || | 302 avctx->width != sh->disp_w || |
348 avctx->height != sh->disp_h || | 303 avctx->height != sh->disp_h || |
349 !ctx->vo_inited) | 304 !ctx->vo_inited) |
350 { | 305 { |
351 #if LIBAVCODEC_BUILD >= 4640 | |
352 mp_dbg(MSGT_DECVIDEO, MSGL_DBG2, "aspect_ratio: %d\n", avctx->aspect_ratio); | 306 mp_dbg(MSGT_DECVIDEO, MSGL_DBG2, "aspect_ratio: %d\n", avctx->aspect_ratio); |
353 sh->aspect = | 307 sh->aspect = |
354 ctx->last_aspect = avctx->aspect_ratio; | 308 ctx->last_aspect = avctx->aspect_ratio; |
355 #endif | |
356 sh->disp_w = avctx->width; | 309 sh->disp_w = avctx->width; |
357 sh->disp_h = avctx->height; | 310 sh->disp_h = avctx->height; |
358 ctx->vo_inited=1; | 311 ctx->vo_inited=1; |
359 switch(avctx->pix_fmt){ | 312 switch(avctx->pix_fmt){ |
360 #if LIBAVCODEC_BUILD >= 4615 | |
361 case PIX_FMT_YUV410P: ctx->best_csp=IMGFMT_YVU9;break; //svq1 | 313 case PIX_FMT_YUV410P: ctx->best_csp=IMGFMT_YVU9;break; //svq1 |
362 #endif | |
363 case PIX_FMT_YUV420P: ctx->best_csp=IMGFMT_YV12;break; //mpegs | 314 case PIX_FMT_YUV420P: ctx->best_csp=IMGFMT_YV12;break; //mpegs |
364 case PIX_FMT_YUV422P: ctx->best_csp=IMGFMT_422P;break; //mjpeg / huffyuv | 315 case PIX_FMT_YUV422P: ctx->best_csp=IMGFMT_422P;break; //mjpeg / huffyuv |
365 case PIX_FMT_YUV444P: ctx->best_csp=IMGFMT_444P;break; //??? | 316 case PIX_FMT_YUV444P: ctx->best_csp=IMGFMT_444P;break; //??? |
366 #if LIBAVCODEC_BUILD >= 4631 | |
367 case PIX_FMT_YUV411P: ctx->best_csp=IMGFMT_411P;break; //dv ntsc | 317 case PIX_FMT_YUV411P: ctx->best_csp=IMGFMT_411P;break; //dv ntsc |
368 #endif | |
369 case PIX_FMT_YUV422: ctx->best_csp=IMGFMT_YUY2;break; //huffyuv perhaps in the future | 318 case PIX_FMT_YUV422: ctx->best_csp=IMGFMT_YUY2;break; //huffyuv perhaps in the future |
370 case PIX_FMT_BGR24 : ctx->best_csp=IMGFMT_BGR24;break; //huffyuv | 319 case PIX_FMT_BGR24 : ctx->best_csp=IMGFMT_BGR24;break; //huffyuv |
371 case PIX_FMT_BGRA32: ctx->best_csp=IMGFMT_BGR32;break; //huffyuv | 320 case PIX_FMT_BGRA32: ctx->best_csp=IMGFMT_BGR32;break; //huffyuv |
372 default: | 321 default: |
373 ctx->best_csp=0; | 322 ctx->best_csp=0; |
378 && ctx->best_csp!=IMGFMT_YUY2); // yuv422p->yuy2 conversion | 327 && ctx->best_csp!=IMGFMT_YUY2); // yuv422p->yuy2 conversion |
379 } | 328 } |
380 return 0; | 329 return 0; |
381 } | 330 } |
382 | 331 |
383 #if LIBAVCODEC_BUILD >= 4641 | |
384 static int get_buffer(AVCodecContext *avctx, AVVideoFrame *pic){ | 332 static int get_buffer(AVCodecContext *avctx, AVVideoFrame *pic){ |
385 sh_video_t * sh = avctx->opaque; | 333 sh_video_t * sh = avctx->opaque; |
386 vd_ffmpeg_ctx *ctx = sh->context; | 334 vd_ffmpeg_ctx *ctx = sh->context; |
387 mp_image_t* mpi=NULL; | 335 mp_image_t* mpi=NULL; |
388 int flags= MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE; | 336 int flags= MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE; |
407 MP_IMGFLAG_DRAW_CALLBACK:0; | 355 MP_IMGFLAG_DRAW_CALLBACK:0; |
408 else | 356 else |
409 flags|= MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE | 357 flags|= MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE |
410 | (ctx->do_slices ? MP_IMGFLAG_DRAW_CALLBACK : 0); | 358 | (ctx->do_slices ? MP_IMGFLAG_DRAW_CALLBACK : 0); |
411 | 359 |
412 #if LIBAVCODEC_BUILD > 4616 | |
413 if(avctx->has_b_frames){ | 360 if(avctx->has_b_frames){ |
414 type= MP_IMGTYPE_IPB; | 361 type= MP_IMGTYPE_IPB; |
415 }else{ | 362 }else{ |
416 type= MP_IMGTYPE_IP; | 363 type= MP_IMGTYPE_IP; |
417 } | 364 } |
418 #endif | |
419 mp_msg(MSGT_DECVIDEO,MSGL_DBG2, type== MP_IMGTYPE_IPB ? "using IPB\n" : "using IP\n"); | 365 mp_msg(MSGT_DECVIDEO,MSGL_DBG2, type== MP_IMGTYPE_IPB ? "using IPB\n" : "using IP\n"); |
420 | 366 |
421 mpi= mpcodecs_get_image(sh,type, flags, | 367 mpi= mpcodecs_get_image(sh,type, flags, |
422 (width+align)&(~align), (height+align)&(~align)); | 368 (width+align)&(~align), (height+align)&(~align)); |
423 | 369 |
487 for(i=0; i<4; i++){ | 433 for(i=0; i<4; i++){ |
488 pic->data[i]= NULL; | 434 pic->data[i]= NULL; |
489 } | 435 } |
490 //printf("R%X %X\n", pic->linesize[0], pic->data[0]); | 436 //printf("R%X %X\n", pic->linesize[0], pic->data[0]); |
491 } | 437 } |
492 #endif | |
493 | 438 |
494 // copypaste from demux_real.c - it should match to get it working! | 439 // copypaste from demux_real.c - it should match to get it working! |
495 //FIXME put into some header | 440 //FIXME put into some header |
496 typedef struct dp_hdr_s { | 441 typedef struct dp_hdr_s { |
497 uint32_t chunks; // number of chunks | 442 uint32_t chunks; // number of chunks |
522 // vd core likes slices! | 467 // vd core likes slices! |
523 avctx->draw_horiz_band=draw_slice; | 468 avctx->draw_horiz_band=draw_slice; |
524 } | 469 } |
525 } | 470 } |
526 | 471 |
527 #if LIBAVCODEC_BUILD > 4603 | |
528 avctx->hurry_up=(flags&3)?((flags&2)?2:1):0; | 472 avctx->hurry_up=(flags&3)?((flags&2)?2:1):0; |
529 #endif | 473 |
530 | |
531 #if LIBAVCODEC_BUILD >= 4630 | |
532 // if(sh->ds->demuxer->type == DEMUXER_TYPE_REAL){ | 474 // if(sh->ds->demuxer->type == DEMUXER_TYPE_REAL){ |
533 if( sh->format == mmioFOURCC('R', 'V', '1', '0') | 475 if( sh->format == mmioFOURCC('R', 'V', '1', '0') |
534 || sh->format == mmioFOURCC('R', 'V', '1', '3')) | 476 || sh->format == mmioFOURCC('R', 'V', '1', '3')) |
535 if(sh->bih->biSize==sizeof(*sh->bih)+8){ | 477 if(sh->bih->biSize==sizeof(*sh->bih)+8){ |
536 int i; | 478 int i; |
545 for(i=0; i<avctx->slice_count; i++) | 487 for(i=0; i<avctx->slice_count; i++) |
546 avctx->slice_offset[i]= ((uint32_t*)(data+hdr->chunktab))[2*i+1]; | 488 avctx->slice_offset[i]= ((uint32_t*)(data+hdr->chunktab))[2*i+1]; |
547 len=hdr->len; | 489 len=hdr->len; |
548 data+= sizeof(dp_hdr_t); | 490 data+= sizeof(dp_hdr_t); |
549 } | 491 } |
550 #endif | |
551 | 492 |
552 ret = avcodec_decode_video(avctx, pic, | 493 ret = avcodec_decode_video(avctx, pic, |
553 &got_picture, data, len); | 494 &got_picture, data, len); |
554 if(ret<0) mp_msg(MSGT_DECVIDEO,MSGL_WARN, "Error while decoding frame!\n"); | 495 if(ret<0) mp_msg(MSGT_DECVIDEO,MSGL_WARN, "Error while decoding frame!\n"); |
555 | 496 |
605 | 546 |
606 if(!got_picture) return NULL; // skipped image | 547 if(!got_picture) return NULL; // skipped image |
607 | 548 |
608 if(init_vo(sh)<0) return NULL; | 549 if(init_vo(sh)<0) return NULL; |
609 | 550 |
610 #if LIBAVCODEC_BUILD > 4615 | |
611 if(dr1 && pic->opaque){ | 551 if(dr1 && pic->opaque){ |
612 mpi= (mp_image_t*)pic->opaque; | 552 mpi= (mp_image_t*)pic->opaque; |
613 } | 553 } |
614 #endif | |
615 | 554 |
616 if(!mpi && ctx->convert){ | 555 if(!mpi && ctx->convert){ |
617 // do yuv422p -> yuy2 conversion: | 556 // do yuv422p -> yuy2 conversion: |
618 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, | 557 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, |
619 avctx->width, avctx->height); | 558 avctx->width, avctx->height); |
646 mpi->stride[1]*=2; | 585 mpi->stride[1]*=2; |
647 mpi->stride[2]*=2; | 586 mpi->stride[2]*=2; |
648 } | 587 } |
649 | 588 |
650 /* to comfirm with newer lavc style */ | 589 /* to comfirm with newer lavc style */ |
651 #if LIBAVCODEC_BUILD >= 4641 | |
652 mpi->qscale =pic->qscale_table; | 590 mpi->qscale =pic->qscale_table; |
653 mpi->qstride=pic->qstride; | 591 mpi->qstride=pic->qstride; |
654 mpi->pict_type=pic->pict_type; | 592 mpi->pict_type=pic->pict_type; |
655 #endif | |
656 | 593 |
657 return mpi; | 594 return mpi; |
658 } | 595 } |
659 | 596 |
660 #endif | 597 #endif |