From 709389ce653d5ab11abf8de067cfb5932e642898 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 24 Jun 2013 02:06:55 +0200 Subject: sub: add hack for Libav SRT demuxer Before this commit, SRT demuxing and display actually happened to work on Libav. But it was using the libavcodec srt converter (which is essentially unmaintained in Libav), and timing postprocessing didn't work. For some background explanations see sd_lavf_srt.c. --- sub/dec_sub.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sub/dec_sub.c') diff --git a/sub/dec_sub.c b/sub/dec_sub.c index 01ba109ad0..56ed2a3d6f 100644 --- a/sub/dec_sub.c +++ b/sub/dec_sub.c @@ -36,6 +36,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_lavf_srt; extern const struct sd_functions sd_lavc_conv; static const struct sd_functions *sd_list[] = { @@ -47,6 +48,7 @@ static const struct sd_functions *sd_list[] = { &sd_movtext, &sd_srt, &sd_microdvd, + &sd_lavf_srt, &sd_lavc_conv, NULL }; @@ -134,7 +136,7 @@ static void print_chain(struct dec_sub *sub) mp_msg(MSGT_OSD, MSGL_V, "Subtitle filter chain: "); for (int n = 0; n < sub->num_sd; n++) { struct sd *sd = sub->sd[n]; - mp_msg(MSGT_OSD, MSGL_V, "%s%s (%s)", n > 0 ? " -> " : "", + mp_msg(MSGT_OSD, MSGL_V, "%s%s (%s)", n > 0 ? " -> " : "", sd->driver->name, sd->codec); } mp_msg(MSGT_OSD, MSGL_V, "\n"); @@ -371,6 +373,10 @@ bool sub_read_all_packets(struct dec_sub *sub, struct sh_sub *sh) if (sub->sd[0]->driver == &sd_movtext) preprocess = 1; + // Broken Libav libavformat srt packet format (fix timestamps first). + if (sub->sd[0]->driver == &sd_lavf_srt) + preprocess = 1; + for (;;) { ds_get_next_pts(sh->ds); struct demux_packet *pkt = ds_get_packet_sub(sh->ds); -- cgit v1.2.3