From f9cefbfec4d7bfec44991d4372aad4fc1b3167a5 Mon Sep 17 00:00:00 2001 From: Aman Gupta Date: Mon, 21 Dec 2015 17:35:15 -0800 Subject: vd_lavc: feed A53_CC side data packets into the demuxer for eia_608 decoding --- demux/demux.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'demux/demux.c') diff --git a/demux/demux.c b/demux/demux.c index e286bf0e32..af0a93c03d 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -160,6 +160,10 @@ struct demux_stream { int64_t last_pos; struct demux_packet *head; struct demux_packet *tail; + + // for closed captions (demuxer_feed_caption) + struct sh_stream *cc; + }; // Return "a", or if that is NOPTS, return "def". @@ -361,6 +365,27 @@ const char *stream_type_name(enum stream_type type) } } +void demuxer_feed_caption(struct sh_stream *stream, demux_packet_t *dp) +{ + struct demuxer *demuxer = stream->ds->in->d_thread; + struct sh_stream *sh = stream->ds->cc; + + if (!sh) { + sh = demux_alloc_sh_stream(STREAM_SUB); + if (!sh) + return; + sh->codec->codec = "eia_608"; + stream->ds->cc = sh; + demux_add_sh_stream(demuxer, sh); + } + + if (demux_stream_is_selected(sh)) { + dp->pts = MP_ADD_PTS(dp->pts, -stream->ds->in->ts_offset); + dp->dts = MP_ADD_PTS(dp->dts, -stream->ds->in->ts_offset); + demux_add_packet(sh, dp); + } +} + void demux_add_packet(struct sh_stream *stream, demux_packet_t *dp) { struct demux_stream *ds = stream ? stream->ds : NULL; -- cgit v1.2.3