1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-03 13:32:16 +00:00

sd_lavc: use mp_lavc_set_extradata()

This includes the magical input padding required by libavcodec, which we
possibly didn't do before this commit.
This commit is contained in:
wm4 2014-01-11 01:28:18 +01:00
parent 4b4926bbb3
commit 14bd02a034

View File

@ -102,8 +102,7 @@ static int init(struct sd *sd)
ctx = avcodec_alloc_context3(sub_codec); ctx = avcodec_alloc_context3(sub_codec);
if (!ctx) if (!ctx)
goto error; goto error;
ctx->extradata_size = sd->extradata_len; mp_lavc_set_extradata(ctx, sd->extradata, sd->extradata_len);
ctx->extradata = sd->extradata;
if (avcodec_open2(ctx, sub_codec, NULL) < 0) if (avcodec_open2(ctx, sub_codec, NULL) < 0)
goto error; goto error;
priv->avctx = ctx; priv->avctx = ctx;
@ -259,6 +258,7 @@ static void uninit(struct sd *sd)
clear(priv); clear(priv);
avcodec_close(priv->avctx); avcodec_close(priv->avctx);
av_free(priv->avctx->extradata);
av_free(priv->avctx); av_free(priv->avctx);
talloc_free(priv); talloc_free(priv);
} }