From: Vivia Nikolaidou Date: Tue, 31 Aug 2021 13:35:06 +0000 (+0300) Subject: mpegtsbase: Search SCTE-35 DRF_ID_CUEI in multiple registration descriptors X-Git-Tag: 1.19.3~165 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=273e2a1db6b38e4986d231b8fecf931191539e40;p=platform%2Fupstream%2Fgstreamer.git mpegtsbase: Search SCTE-35 DRF_ID_CUEI in multiple registration descriptors There are streams in the wild that have to add a SCTE-35 trigger in another e.g. GA94 stream. Most encoders would replace the GA94 descriptor ID with the CUEI one temporarily, but there are some that will add two registration ID descriptors, one with GA94 and one with CUEI. Failing to parse the CUEI registration ID in that case would return FALSE in _stream_is_private_section , therefore setting it as known PES and pushing packets downstream instead of calling handle_psi. Part-of: --- diff --git a/subprojects/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c b/subprojects/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c index e5f1415..0658f0e 100644 --- a/subprojects/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c +++ b/subprojects/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c @@ -575,6 +575,28 @@ get_registration_from_descriptors (GPtrArray * descriptors) return 0; } +static gboolean +find_registration_in_descriptors (GPtrArray * descriptors, + guint32 registration_id) +{ + + guint i, nb_desc; + + if (!descriptors) + return FALSE; + + nb_desc = descriptors->len; + for (i = 0; i < nb_desc; i++) { + GstMpegtsDescriptor *desc = g_ptr_array_index (descriptors, i); + if (desc->tag == GST_MTS_DESC_REGISTRATION) { + guint32 reg_desc = GST_READ_UINT32_BE (desc->data + 2); + if (reg_desc == registration_id) + return TRUE; + } + } + return FALSE; +} + static MpegTSBaseStream * mpegts_base_program_add_stream (MpegTSBase * base, MpegTSBaseProgram * program, guint16 pid, guint8 stream_type, @@ -763,10 +785,8 @@ _stream_is_private_section (const GstMpegtsPMT * pmt, return TRUE; case GST_MPEGTS_STREAM_TYPE_SCTE_SIT: { - guint32 registration_id = - get_registration_from_descriptors (pmt->descriptors); /* Not a private section stream */ - if (registration_id != DRF_ID_CUEI) + if (!find_registration_in_descriptors (pmt->descriptors, DRF_ID_CUEI)) return FALSE; return TRUE; }