summaryrefslogtreecommitdiffstats
path: root/sub/dec_sub.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-06-01 19:54:31 +0200
committerwm4 <wm4@nowhere>2013-06-03 22:40:06 +0200
commitb11bd1fe5e82fb7cd9aa912c2b1c98de8704bb87 (patch)
treebf29ab506fe835b33da2464a0053e0d461e5cb2e /sub/dec_sub.c
parente19ffa02aa370cbc3b559f85b286ea09b06ab29b (diff)
downloadmpv-b11bd1fe5e82fb7cd9aa912c2b1c98de8704bb87.tar.bz2
mpv-b11bd1fe5e82fb7cd9aa912c2b1c98de8704bb87.tar.xz
sub: make use of libavcodec subtitle converters
This allows using some formats that were not supported until now, like WebVTT. We still prefer the internal subtitle reader (subreader.c), because 1. Libav, and 2. random things which we probably want to keep, such as control over formatting, codepage stuff, or various mysterious postprecessing done in that code.
Diffstat (limited to 'sub/dec_sub.c')
-rw-r--r--sub/dec_sub.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sub/dec_sub.c b/sub/dec_sub.c
index 49ecd5c009..ec9af94abb 100644
--- a/sub/dec_sub.c
+++ b/sub/dec_sub.c
@@ -35,6 +35,7 @@ extern const struct sd_functions sd_spu;
extern const struct sd_functions sd_movtext;
extern const struct sd_functions sd_srt;
extern const struct sd_functions sd_microdvd;
+extern const struct sd_functions sd_lavc_conv;
static const struct sd_functions *sd_list[] = {
#ifdef CONFIG_ASS
@@ -45,6 +46,7 @@ static const struct sd_functions *sd_list[] = {
&sd_movtext,
&sd_srt,
&sd_microdvd,
+ &sd_lavc_conv,
NULL
};
@@ -159,6 +161,14 @@ static void read_sub_data(struct dec_sub *sub, struct sub_data *subdata)
sub_decode(sub, &pkt);
}
+ struct sd *sd = sub_get_last_sd(sub);
+ // Hack for broken FFmpeg packet format: make sd_ass keep the subtitle
+ // events on reset(), even though broken FFmpeg ASS packets were received
+ // (from sd_lavc_conv.c). Normally, these events are removed on seek/reset,
+ // but this is obviously unwanted in this case.
+ if (sd && sd->driver->fix_events)
+ sd->driver->fix_events(sd);
+
talloc_free(temp);
}