From 5cbfdac2a82f4340971d31fcf05b333cdf6d3c12 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sun, 23 Mar 2014 19:20:43 +0100 Subject: vd_lavc: Support hwaccel 1.2 and later Hwaccel 1.2 populates only the third data field and assumes that the AVCodecContext is available to the dealloc function. --- video/decode/vd_lavc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'video') diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 57b391a6a2..1ba579abed 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -395,6 +395,9 @@ static void uninit_avctx(struct dec_video *vd) vd_ffmpeg_ctx *ctx = vd->priv; AVCodecContext *avctx = ctx->avctx; + if (ctx->hwdec && ctx->hwdec->uninit) + ctx->hwdec->uninit(ctx); + if (avctx) { if (avctx->codec && avcodec_close(avctx) < 0) MP_ERR(vd, "Could not close codec.\n"); @@ -405,9 +408,6 @@ static void uninit_avctx(struct dec_video *vd) av_freep(&ctx->avctx); - if (ctx->hwdec && ctx->hwdec->uninit) - ctx->hwdec->uninit(ctx); - av_frame_free(&ctx->pic); } @@ -590,7 +590,7 @@ static int decode(struct dec_video *vd, struct demux_packet *packet, av_frame_unref(ctx->pic); if (!mpi) return 0; - assert(mpi->planes[0]); + assert(mpi->planes[0] || mpi->planes[3]); mp_image_set_params(mpi, ¶ms); if (ctx->hwdec && ctx->hwdec->process_image) -- cgit v1.2.3