diff options
author | Thiago Santos <ts.santos@sisa.samsung.com> | 2014-04-24 01:25:32 -0300 |
---|---|---|
committer | Thiago Santos <ts.santos@sisa.samsung.com> | 2014-05-13 17:15:39 -0300 |
commit | 3ac7bc867090db314186c487e1f0808c16fdb924 (patch) | |
tree | df24795096060e93a4b4a4b4fdf7c12de6b6b428 | |
parent | cff050884cf08e016d6504f16797a6b8802ff79e (diff) |
qtdemux: expose CAE-608 streams as subtitlesclosedcaptions
Parse the clcp trak entries and expose CAE-608 streams
-rw-r--r-- | gst/isomp4/fourcc.h | 1 | ||||
-rw-r--r-- | gst/isomp4/qtdemux.c | 49 |
2 files changed, 49 insertions, 1 deletions
diff --git a/gst/isomp4/fourcc.h b/gst/isomp4/fourcc.h index 64322a7a7..52a547536 100644 --- a/gst/isomp4/fourcc.h +++ b/gst/isomp4/fourcc.h @@ -91,6 +91,7 @@ G_BEGIN_DECLS #define FOURCC_avc1 GST_MAKE_FOURCC('a','v','c','1') #define FOURCC_avc3 GST_MAKE_FOURCC('a','v','c','3') #define FOURCC_avcC GST_MAKE_FOURCC('a','v','c','C') +#define FOURCC_clcp GST_MAKE_FOURCC('c','l','c','p') #define FOURCC_clip GST_MAKE_FOURCC('c','l','i','p') #define FOURCC_cmov GST_MAKE_FOURCC('c','m','o','v') #define FOURCC_cmvd GST_MAKE_FOURCC('c','m','v','d') diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index 53847c002..259f102d7 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -458,6 +458,9 @@ static GstCaps *qtdemux_audio_caps (GstQTDemux * qtdemux, static GstCaps *qtdemux_sub_caps (GstQTDemux * qtdemux, QtDemuxStream * stream, guint32 fourcc, const guint8 * data, gchar ** codec_name); +static GstCaps *qtdemux_closed_caption_caps (GstQTDemux * qtdemux, + QtDemuxStream * stream, guint32 fourcc, const guint8 * data, + gchar ** codec_name); static GstCaps *qtdemux_generic_caps (GstQTDemux * qtdemux, QtDemuxStream * stream, guint32 fourcc, const guint8 * stsd_data, gchar ** codec_name); @@ -5995,7 +5998,7 @@ gst_qtdemux_add_stream (GstQTDemux * qtdemux, } else if (stream->subtype == FOURCC_strm) { GST_DEBUG_OBJECT (qtdemux, "stream type, not creating pad"); } else if (stream->subtype == FOURCC_subp || stream->subtype == FOURCC_text - || stream->subtype == FOURCC_sbtl) { + || stream->subtype == FOURCC_sbtl || stream->subtype == FOURCC_clcp) { gchar *name = g_strdup_printf ("subtitle_%u", qtdemux->n_sub_streams); stream->pad = @@ -8521,6 +8524,22 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak) GST_INFO_OBJECT (qtdemux, "type %" GST_FOURCC_FORMAT " caps %" GST_PTR_FORMAT, GST_FOURCC_ARGS (fourcc), stream->caps); + } else if (stream->subtype == FOURCC_clcp) { + stream->sampled = TRUE; + stream->sparse = TRUE; + + offset = 16; + + stream->caps = + qtdemux_closed_caption_caps (qtdemux, stream, fourcc, stsd_data, + &codec); + if (codec) { + list = gst_tag_list_new_empty (); + gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, + GST_TAG_SUBTITLE_CODEC, codec, NULL); + g_free (codec); + codec = NULL; + } } else { /* everything in 1 sample */ stream->sampled = TRUE; @@ -11168,6 +11187,34 @@ qtdemux_sub_caps (GstQTDemux * qtdemux, QtDemuxStream * stream, } static GstCaps * +qtdemux_closed_caption_caps (GstQTDemux * qtdemux, QtDemuxStream * stream, + guint32 fourcc, const guint8 * stsd_data, gchar ** codec_name) +{ + GstCaps *caps; + + GST_DEBUG_OBJECT (qtdemux, "resolve fourcc %08x", fourcc); + + switch (fourcc) { + case GST_MAKE_FOURCC ('c', '6', '0', '8'): + _codec ("Closed caption"); + caps = gst_caps_new_empty_simple ("text/x-cea608-raw"); + stream->need_process = TRUE; + break; + default: + { + char *s, fourstr[5]; + + g_snprintf (fourstr, 5, "%" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc)); + s = g_strdup_printf ("text/x-gst-fourcc-%s", g_strstrip (fourstr)); + caps = gst_caps_new_empty_simple (s); + break; + } + } + return caps; +} + + +static GstCaps * qtdemux_generic_caps (GstQTDemux * qtdemux, QtDemuxStream * stream, guint32 fourcc, const guint8 * stsd_data, gchar ** codec_name) { |