sub/sd_lavc: properly fill avctx with codecpar values at init

Similar reasons as with the previous commit touching lavc_conv,
as well as this being the last location where mp_lavc_set_extradata
being utilized.
This commit is contained in:
Jan Ekström 2023-03-14 23:27:20 +02:00
parent e20b645611
commit 9f5d7d5932
1 changed files with 2 additions and 1 deletions

View File

@ -99,7 +99,8 @@ static int init(struct sd *sd)
priv->avpkt = av_packet_alloc(); priv->avpkt = av_packet_alloc();
if (!priv->avpkt) if (!priv->avpkt)
goto error; goto error;
mp_lavc_set_extradata(ctx, sd->codec->extradata, sd->codec->extradata_size); if (mp_set_avctx_codec_headers(ctx, sd->codec) < 0)
goto error;
priv->pkt_timebase = mp_get_codec_timebase(sd->codec); priv->pkt_timebase = mp_get_codec_timebase(sd->codec);
ctx->pkt_timebase = priv->pkt_timebase; ctx->pkt_timebase = priv->pkt_timebase;
if (avcodec_open2(ctx, sub_codec, NULL) < 0) if (avcodec_open2(ctx, sub_codec, NULL) < 0)