diff options
author | Tim-Philipp Müller <tim@centricular.com> | 2014-11-09 19:16:29 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2015-07-13 23:34:31 +0100 |
commit | c05a9424be7511830b1a76cca3b872ae95bac908 (patch) | |
tree | 571aeb81cee1e16701fbe3c8fdc2b9feae77b753 /gst/mpegtsmux | |
parent | bfa054a7337721032dd252c29fbbfc980a0b45a2 (diff) | |
download | gstreamer-plugins-bad-c05a9424be7511830b1a76cca3b872ae95bac908.tar.gz |
mpegtsmux: add basic support for asynchronous KLV metadata streams
This is defined in SMPTE Rp 217. In this case the
metadata PES packets carry no timestamps of their
own and no Metadata Access Unit Wrappers are used.
Diffstat (limited to 'gst/mpegtsmux')
-rw-r--r-- | gst/mpegtsmux/mpegtsmux.c | 11 | ||||
-rw-r--r-- | gst/mpegtsmux/tsmux/tsmuxstream.c | 14 | ||||
-rw-r--r-- | gst/mpegtsmux/tsmux/tsmuxstream.h | 3 |
3 files changed, 27 insertions, 1 deletions
diff --git a/gst/mpegtsmux/mpegtsmux.c b/gst/mpegtsmux/mpegtsmux.c index 71e2cd881..74ea14269 100644 --- a/gst/mpegtsmux/mpegtsmux.c +++ b/gst/mpegtsmux/mpegtsmux.c @@ -140,7 +140,7 @@ static GstStaticPadTemplate mpegtsmux_sink_factory = "mute = (boolean) { FALSE, TRUE }; " "audio/x-ac3, framed = (boolean) TRUE;" "audio/x-dts, framed = (boolean) TRUE;" - "subpicture/x-dvb;" "application/x-teletext")); + "subpicture/x-dvb; application/x-teletext; meta/x-klv, parsed=true")); static GstStaticPadTemplate mpegtsmux_src_factory = GST_STATIC_PAD_TEMPLATE ("src", @@ -675,6 +675,8 @@ mpegtsmux_create_stream (MpegTsMux * mux, MpegTsPadData * ts_data) st = TSMUX_ST_PS_TELETEXT; /* needs a particularly sized layout */ ts_data->prepare_func = mpegtsmux_prepare_teletext; + } else if (strcmp (mt, "meta/x-klv") == 0) { + st = TSMUX_ST_PS_KLV; } if (st != TSMUX_ST_RESERVED) { @@ -1130,6 +1132,7 @@ mpegtsmux_collected_buffer (GstCollectPads * pads, GstCollectData * data, if (G_UNLIKELY (best == NULL)) { /* EOS */ + GST_INFO_OBJECT (mux, "EOS"); /* drain some possibly cached data */ new_packet_m2ts (mux, NULL, -1); mpegtsmux_push_packets (mux, TRUE); @@ -1225,6 +1228,12 @@ mpegtsmux_collected_buffer (GstCollectPads * pads, GstCollectData * data, GST_OBJECT_UNLOCK (mux); #endif } + + if (best->stream->is_meta && gst_buffer_get_size (buf) > (G_MAXUINT16 - 3)) { + GST_WARNING_OBJECT (mux, "KLV meta unit too big, splitting not supported"); + return GST_FLOW_OK; + } + GST_DEBUG_OBJECT (mux, "delta: %d", delta); stream_data = stream_data_new (buf); diff --git a/gst/mpegtsmux/tsmux/tsmuxstream.c b/gst/mpegtsmux/tsmux/tsmuxstream.c index ad58ca70e..1094c3ea9 100644 --- a/gst/mpegtsmux/tsmux/tsmuxstream.c +++ b/gst/mpegtsmux/tsmux/tsmuxstream.c @@ -191,6 +191,15 @@ tsmux_stream_new (guint16 pid, TsMuxStreamType stream_type) TSMUX_PACKET_FLAG_PES_DATA_ALIGNMENT; break; + case TSMUX_ST_PS_KLV: + /* FIXME: assign sequential extended IDs? */ + stream->id = 0xBD; + stream->stream_type = TSMUX_ST_PRIVATE_DATA; + stream->is_meta = TRUE; + stream->pi.flags |= + TSMUX_PACKET_FLAG_PES_FULL_HEADER | + TSMUX_PACKET_FLAG_PES_DATA_ALIGNMENT; + break; default: g_critical ("Stream type 0x%0x not yet implemented", stream_type); break; @@ -901,6 +910,11 @@ tsmux_stream_get_es_descrs (TsMuxStream * stream, g_ptr_array_add (pmt_stream->descriptors, descriptor); break; } + if (stream->is_meta) { + descriptor = gst_mpegts_descriptor_from_registration ("KLVA", NULL, 0); + GST_ERROR ("adding KLVA registration descriptor!"); + g_ptr_array_add (pmt_stream->descriptors, descriptor); + } default: break; } diff --git a/gst/mpegtsmux/tsmux/tsmuxstream.h b/gst/mpegtsmux/tsmux/tsmuxstream.h index 5640df68b..c355ae2fc 100644 --- a/gst/mpegtsmux/tsmux/tsmuxstream.h +++ b/gst/mpegtsmux/tsmux/tsmuxstream.h @@ -140,6 +140,7 @@ enum TsMuxStreamType { TSMUX_ST_PS_AUDIO_LPCM = 0x8b, TSMUX_ST_PS_DVB_SUBPICTURE = 0x8c, TSMUX_ST_PS_TELETEXT = 0x8d, + TSMUX_ST_PS_KLV = 0x8e, /* only used internally */ TSMUX_ST_PS_DVD_SUBPICTURE = 0xff, /* Non-standard definitions */ @@ -206,6 +207,8 @@ struct TsMuxStream { gboolean is_dvb_sub; gchar language[4]; + + gboolean is_meta; }; /* stream management */ |