mirror of
https://github.com/mpv-player/mpv
synced 2024-12-23 07:12:39 +00:00
lavc_conv: fix Libav srt subtitles
Use the mp_lavc_set_extradata() function instead of setting up the extradata manually. This takes care of the corner case when extradata_len is 0. This apparently fixes #2888.
This commit is contained in:
parent
1f436f65f2
commit
041c9f1782
@ -79,11 +79,8 @@ struct lavc_conv *lavc_conv_create(struct mp_log *log, const char *codec_name,
|
|||||||
avctx = avcodec_alloc_context3(codec);
|
avctx = avcodec_alloc_context3(codec);
|
||||||
if (!avctx)
|
if (!avctx)
|
||||||
goto error;
|
goto error;
|
||||||
avctx->extradata_size = extradata_len;
|
if (mp_lavc_set_extradata(avctx, extradata, extradata_len) < 0)
|
||||||
avctx->extradata = av_malloc(extradata_len);
|
|
||||||
if (!avctx->extradata)
|
|
||||||
goto error;
|
goto error;
|
||||||
memcpy(avctx->extradata, extradata, extradata_len);
|
|
||||||
if (strcmp(codec_name, "eia_608") == 0)
|
if (strcmp(codec_name, "eia_608") == 0)
|
||||||
av_dict_set(&opts, "real_time", "1", 0);
|
av_dict_set(&opts, "real_time", "1", 0);
|
||||||
if (avcodec_open2(avctx, codec, &opts) < 0)
|
if (avcodec_open2(avctx, codec, &opts) < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user