# HG changeset patch # User reimar # Date 1234888850 0 # Node ID 88bb92d3c5b48d8b938048469af2936245eee0c9 # Parent 7361c76fa6853a654e434b9242c650a3702518da Set avctx->opaque already at init instead of decode so it can be used in get_format and get_buffer would not crash if called during avcodec_open. Patch by Gwenole Beauchesne [gbeauchesne splitted-desktop com] diff -r 7361c76fa685 -r 88bb92d3c5b4 libmpcodecs/vd_ffmpeg.c --- a/libmpcodecs/vd_ffmpeg.c Tue Feb 17 15:00:57 2009 +0000 +++ b/libmpcodecs/vd_ffmpeg.c Tue Feb 17 16:40:50 2009 +0000 @@ -240,6 +240,7 @@ ctx->pic = avcodec_alloc_frame(); ctx->avctx = avcodec_alloc_context(); avctx = ctx->avctx; + avctx->opaque = sh; #if CONFIG_VDPAU if(lavc_codec->capabilities & CODEC_CAP_HWACCEL_VDPAU){ @@ -744,7 +745,6 @@ //ffmpeg interlace (mpeg2) bug have been fixed. no need of -noslices if (!dr1) avctx->draw_horiz_band=NULL; - avctx->opaque=sh; if(ctx->vo_initialized && !(flags&3) && !dr1){ mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE | (ctx->do_slices?MP_IMGFLAG_DRAW_CALLBACK:0),