scte-section: add support for packetizing time_signal splices

time_signal splices are trivial, they only contain a splice_time()
and all the relevant information is carried in descriptors.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/913>
This commit is contained in:
Mathieu Duponchelle 2021-04-06 17:37:28 +02:00 committed by GStreamer Marge Bot
parent be4d0fff23
commit a9787d0c85

View file

@ -500,7 +500,6 @@ _packetize_sit (GstMpegtsSection * section)
switch (sit->splice_command_type) {
case GST_MTS_SCTE_SPLICE_COMMAND_SCHEDULE:
case GST_MTS_SCTE_SPLICE_COMMAND_TIME:
case GST_MTS_SCTE_SPLICE_COMMAND_PRIVATE:
GST_WARNING ("SCTE command not supported");
return FALSE;
@ -538,6 +537,14 @@ _packetize_sit (GstMpegtsSection * section)
command_length += 5;
}
}
if (sit->splice_command_type == GST_MTS_SCTE_SPLICE_COMMAND_TIME) {
if (sit->splice_time_specified)
command_length += 5;
else
command_length += 1;
}
length += command_length;
/* Calculate size of descriptors */
@ -573,6 +580,16 @@ _packetize_sit (GstMpegtsSection * section)
GST_WRITE_UINT32_BE (data, tmp32);
data += 4;
if (sit->splice_command_type == GST_MTS_SCTE_SPLICE_COMMAND_TIME) {
if (!sit->splice_time_specified) {
*data++ = 0x7f;
} else {
*data++ = 0xf2 | ((sit->splice_time >> 32) & 0x1);
GST_WRITE_UINT32_BE (data, sit->splice_time & 0xffffffff);
data += 4;
}
}
/* Write the events */
for (i = 0; i < sit->splices->len; i++) {
GstMpegtsSCTESpliceEvent *event = g_ptr_array_index (sit->splices, i);