mpegtsmux: Add support for SMPTE 302M (audio/x-smpte-302m)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6530>
This commit is contained in:
Mart Raudsepp 2024-03-16 00:38:58 +02:00 committed by GStreamer Marge Bot
parent 20e3454c26
commit 790b12cf13
5 changed files with 17 additions and 1 deletions

View file

@ -223194,7 +223194,7 @@
"long-name": "MPEG Transport Stream Muxer", "long-name": "MPEG Transport Stream Muxer",
"pad-templates": { "pad-templates": {
"sink_%%d": { "sink_%%d": {
"caps": "video/mpeg:\n parsed: true\n mpegversion: { (int)1, (int)2, (int)4 }\n systemstream: false\nvideo/x-dirac:\nimage/x-jpc:\n alignment: frame\nvideo/x-h264:\n stream-format: byte-stream\n alignment: { (string)au, (string)nal }\nvideo/x-h265:\n stream-format: byte-stream\n alignment: { (string)au, (string)nal }\naudio/mpeg:\n parsed: true\n mpegversion: 1\naudio/mpeg:\n framed: true\n mpegversion: { (int)2, (int)4 }\n stream-format: { (string)adts, (string)raw }\naudio/x-lpcm:\n width: { (int)16, (int)20, (int)24 }\n rate: { (int)48000, (int)96000 }\n channels: [ 1, 8 ]\n dynamic_range: [ 0, 255 ]\n emphasis: { (boolean)false, (boolean)true }\n mute: { (boolean)false, (boolean)true }\naudio/x-ac3:\n framed: true\naudio/x-dts:\n framed: true\naudio/x-opus:\n channels: [ 1, 255 ]\nsubpicture/x-dvb:\napplication/x-teletext:\nmeta/x-klv:\n parsed: true\nmeta/x-id3:\n parsed: true\nmeta/x-st-2038:\n alignment: line\nimage/x-jpc:\n alignment: frame\n profile: [ 0, 49151 ]\nimage/x-jxsc:\n alignment: frame\n sampling: { (string)YCbCr-4:2:2, (string)YCbCr-4:4:4 }\n", "caps": "video/mpeg:\n parsed: true\n mpegversion: { (int)1, (int)2, (int)4 }\n systemstream: false\nvideo/x-dirac:\nimage/x-jpc:\n alignment: frame\nvideo/x-h264:\n stream-format: byte-stream\n alignment: { (string)au, (string)nal }\nvideo/x-h265:\n stream-format: byte-stream\n alignment: { (string)au, (string)nal }\naudio/mpeg:\n parsed: true\n mpegversion: 1\naudio/mpeg:\n framed: true\n mpegversion: { (int)2, (int)4 }\n stream-format: { (string)adts, (string)raw }\naudio/x-lpcm:\n width: { (int)16, (int)20, (int)24 }\n rate: { (int)48000, (int)96000 }\n channels: [ 1, 8 ]\n dynamic_range: [ 0, 255 ]\n emphasis: { (boolean)false, (boolean)true }\n mute: { (boolean)false, (boolean)true }\naudio/x-ac3:\n framed: true\naudio/x-dts:\n framed: true\naudio/x-opus:\n channels: [ 1, 255 ]\naudio/x-smpte-302m:\nsubpicture/x-dvb:\napplication/x-teletext:\nmeta/x-klv:\n parsed: true\nmeta/x-id3:\n parsed: true\nmeta/x-st-2038:\n alignment: line\nimage/x-jpc:\n alignment: frame\n profile: [ 0, 49151 ]\nimage/x-jxsc:\n alignment: frame\n sampling: { (string)YCbCr-4:2:2, (string)YCbCr-4:4:4 }\n",
"direction": "sink", "direction": "sink",
"presence": "request", "presence": "request",
"type": "GstBaseTsMuxPad" "type": "GstBaseTsMuxPad"

View file

@ -830,6 +830,8 @@ gst_base_ts_mux_create_or_update_stream (GstBaseTsMux * mux,
ts_pad->prepare_func = gst_base_ts_mux_prepare_jpegxs; ts_pad->prepare_func = gst_base_ts_mux_prepare_jpegxs;
ts_pad->prepare_data = jpegxs_descriptor; ts_pad->prepare_data = jpegxs_descriptor;
ts_pad->free_func = gst_base_ts_mux_free_jpegxs; ts_pad->free_func = gst_base_ts_mux_free_jpegxs;
} else if (strcmp (mt, "audio/x-smpte-302m") == 0) {
st = TSMUX_ST_PS_S302M;
} else if (strcmp (mt, "image/x-jpc") == 0) { } else if (strcmp (mt, "image/x-jpc") == 0) {
/* /*
* See this document for more details on standard: * See this document for more details on standard:

View file

@ -124,6 +124,7 @@ static GstStaticPadTemplate gst_mpeg_ts_mux_sink_factory =
"audio/x-dts, framed = (boolean) TRUE;" "audio/x-dts, framed = (boolean) TRUE;"
"audio/x-opus, " "audio/x-opus, "
"channels = (int) [1, 255];" "channels = (int) [1, 255];"
"audio/x-smpte-302m;"
"subpicture/x-dvb; application/x-teletext; meta/x-klv, parsed=true;" "subpicture/x-dvb; application/x-teletext; meta/x-klv, parsed=true;"
"meta/x-id3, parsed=true;" "meta/x-id3, parsed=true;"
"meta/x-st-2038, alignment = (string) line;" "meta/x-st-2038, alignment = (string) line;"

View file

@ -245,6 +245,13 @@ tsmux_stream_new (guint16 pid, guint stream_type, guint stream_number)
stream->stream_type = TSMUX_ST_PRIVATE_DATA; stream->stream_type = TSMUX_ST_PRIVATE_DATA;
stream->pi.flags |= TSMUX_PACKET_FLAG_PES_FULL_HEADER; stream->pi.flags |= TSMUX_PACKET_FLAG_PES_FULL_HEADER;
break; break;
case TSMUX_ST_PS_S302M:
/* FIXME: assign sequential extended IDs? */
stream->id = 0xBD;
stream->gst_stream_type = GST_STREAM_TYPE_AUDIO;
stream->stream_type = TSMUX_ST_PRIVATE_DATA;
stream->pi.flags |= TSMUX_PACKET_FLAG_PES_FULL_HEADER;
break;
default: default:
/* Might be a custom stream type implemented by a subclass */ /* Might be a custom stream type implemented by a subclass */
break; break;
@ -1022,6 +1029,11 @@ tsmux_stream_default_get_es_descrs (TsMuxStream * stream,
descriptor = gst_mpegts_descriptor_from_custom (0xc4, NULL, 0); descriptor = gst_mpegts_descriptor_from_custom (0xc4, NULL, 0);
g_ptr_array_add (pmt_stream->descriptors, descriptor); g_ptr_array_add (pmt_stream->descriptors, descriptor);
} }
if (stream->internal_stream_type == TSMUX_ST_PS_S302M) {
descriptor = gst_mpegts_descriptor_from_registration ("BSSD", NULL, 0);
GST_DEBUG ("adding SMPTE 302M registration descriptor");
g_ptr_array_add (pmt_stream->descriptors, descriptor);
}
default: default:
break; break;
} }

View file

@ -134,6 +134,7 @@ enum TsMuxStreamType {
TSMUX_ST_PS_OPUS = 0x8f, /* only used internally */ TSMUX_ST_PS_OPUS = 0x8f, /* only used internally */
TSMUX_ST_PS_ID3 = 0x90, /* only used internally */ TSMUX_ST_PS_ID3 = 0x90, /* only used internally */
TSMUX_ST_PS_ST_2038 = 0x91, /* only used internally */ TSMUX_ST_PS_ST_2038 = 0x91, /* only used internally */
TSMUX_ST_PS_S302M = 0x92, /* only used internally */
TSMUX_ST_PS_DVD_SUBPICTURE = 0xff, TSMUX_ST_PS_DVD_SUBPICTURE = 0xff,
/* Non-standard definitions */ /* Non-standard definitions */