mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
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.
This commit is contained in:
parent
bfa054a733
commit
c05a9424be
3 changed files with 27 additions and 1 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in a new issue