summaryrefslogtreecommitdiffstats
path: root/sub
diff options
context:
space:
mode:
authorAman Gupta <aman@tmm1.net>2016-01-18 12:13:42 -0800
committerAman Gupta <aman@tmm1.net>2016-01-18 12:13:42 -0800
commited3e5330ec1f201895c90f73a0c099a75241b404 (patch)
tree698999aa643aa4dd9259859bb597a8047e9234fd /sub
parent1781bf26f101442be06d72243e8cbeffcaa47658 (diff)
downloadmpv-ed3e5330ec1f201895c90f73a0c099a75241b404.tar.bz2
mpv-ed3e5330ec1f201895c90f73a0c099a75241b404.tar.xz
lavc_conv: pass real_time=1 option to ffmpeg for eia_608 decoder
Diffstat (limited to 'sub')
-rw-r--r--sub/lavc_conv.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sub/lavc_conv.c b/sub/lavc_conv.c
index f6c9b5abe2..b822f52bf3 100644
--- a/sub/lavc_conv.c
+++ b/sub/lavc_conv.c
@@ -21,6 +21,7 @@
#include <libavcodec/avcodec.h>
#include <libavutil/intreadwrite.h>
#include <libavutil/common.h>
+#include <libavutil/opt.h>
#include "config.h"
@@ -70,6 +71,7 @@ struct lavc_conv *lavc_conv_create(struct mp_log *log, const char *codec_name,
priv->cur_list = talloc_array(priv, char*, 0);
priv->codec = talloc_strdup(priv, codec_name);
AVCodecContext *avctx = NULL;
+ AVDictionary *opts = NULL;
const char *fmt = get_lavc_format(priv->codec);
AVCodec *codec = avcodec_find_decoder(mp_codec_to_av_codec_id(fmt));
if (!codec)
@@ -82,8 +84,11 @@ struct lavc_conv *lavc_conv_create(struct mp_log *log, const char *codec_name,
if (!avctx->extradata)
goto error;
memcpy(avctx->extradata, extradata, extradata_len);
- if (avcodec_open2(avctx, codec, NULL) < 0)
+ if (strcmp(codec_name, "eia_608") == 0)
+ av_dict_set(&opts, "real_time", "1", 0);
+ if (avcodec_open2(avctx, codec, &opts) < 0)
goto error;
+ av_dict_free(&opts);
// Documented as "set by libavcodec", but there is no other way
avctx->time_base = (AVRational) {1, 1000};
priv->avctx = avctx;
@@ -94,6 +99,7 @@ struct lavc_conv *lavc_conv_create(struct mp_log *log, const char *codec_name,
error:
MP_FATAL(priv, "Could not open libavcodec subtitle converter\n");
+ av_dict_free(&opts);
av_free(avctx);
talloc_free(priv);
return NULL;