mirror of
https://github.com/mpv-player/mpv
synced 2024-12-22 14:52:43 +00:00
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.
This commit is contained in:
parent
c78b8b2c0c
commit
5cbfdac2a8
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user