mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-23 14:36:24 +00:00
mpegtsbase: Remove duplicated code
Just have one function to check for private section streams
This commit is contained in:
parent
e8b24f9189
commit
dc703b50b3
1 changed files with 49 additions and 68 deletions
|
@ -518,6 +518,36 @@ mpegts_base_program_remove_stream (MpegTSBase * base,
|
||||||
program->streams[pid] = NULL;
|
program->streams[pid] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
_stream_is_private_section (GstMpegtsPMTStream * stream)
|
||||||
|
{
|
||||||
|
switch (stream->stream_type) {
|
||||||
|
case GST_MPEGTS_STREAM_TYPE_SCTE_DSMCC_DCB:
|
||||||
|
case GST_MPEGTS_STREAM_TYPE_SCTE_SIGNALING:
|
||||||
|
{
|
||||||
|
guint32 registration_id =
|
||||||
|
get_registration_from_descriptors (stream->descriptors);
|
||||||
|
/* Not a private section stream */
|
||||||
|
if (registration_id != DRF_ID_CUEI && registration_id != DRF_ID_ETV1)
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
case GST_MPEGTS_STREAM_TYPE_PRIVATE_SECTIONS:
|
||||||
|
case GST_MPEGTS_STREAM_TYPE_MHEG:
|
||||||
|
case GST_MPEGTS_STREAM_TYPE_DSM_CC:
|
||||||
|
case GST_MPEGTS_STREAM_TYPE_DSMCC_A:
|
||||||
|
case GST_MPEGTS_STREAM_TYPE_DSMCC_B:
|
||||||
|
case GST_MPEGTS_STREAM_TYPE_DSMCC_C:
|
||||||
|
case GST_MPEGTS_STREAM_TYPE_DSMCC_D:
|
||||||
|
case GST_MPEGTS_STREAM_TYPE_SL_FLEXMUX_SECTIONS:
|
||||||
|
case GST_MPEGTS_STREAM_TYPE_METADATA_SECTIONS:
|
||||||
|
/* known PSI streams */
|
||||||
|
return TRUE;
|
||||||
|
default:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Return TRUE if programs are equal */
|
/* Return TRUE if programs are equal */
|
||||||
static gboolean
|
static gboolean
|
||||||
mpegts_base_is_same_program (MpegTSBase * base, MpegTSBaseProgram * oldprogram,
|
mpegts_base_is_same_program (MpegTSBase * base, MpegTSBaseProgram * oldprogram,
|
||||||
|
@ -595,35 +625,11 @@ mpegts_base_deactivate_program (MpegTSBase * base, MpegTSBaseProgram * program)
|
||||||
/* Only unset the is_pes/known_psi bit if the PID isn't used in any other active
|
/* Only unset the is_pes/known_psi bit if the PID isn't used in any other active
|
||||||
* program */
|
* program */
|
||||||
if (!mpegts_pid_in_active_programs (base, stream->pid)) {
|
if (!mpegts_pid_in_active_programs (base, stream->pid)) {
|
||||||
switch (stream->stream_type) {
|
if (_stream_is_private_section (stream)) {
|
||||||
case GST_MPEGTS_STREAM_TYPE_SCTE_DSMCC_DCB:
|
if (base->parse_private_sections)
|
||||||
case GST_MPEGTS_STREAM_TYPE_SCTE_SIGNALING:
|
MPEGTS_BIT_UNSET (base->known_psi, stream->pid);
|
||||||
{
|
} else {
|
||||||
guint32 registration_id =
|
MPEGTS_BIT_UNSET (base->is_pes, stream->pid);
|
||||||
get_registration_from_descriptors (stream->descriptors);
|
|
||||||
|
|
||||||
/* Not a private section stream */
|
|
||||||
if (registration_id != DRF_ID_CUEI
|
|
||||||
&& registration_id != DRF_ID_ETV1)
|
|
||||||
break;
|
|
||||||
/* Fall through on purpose - remove this PID from known_psi */
|
|
||||||
}
|
|
||||||
case GST_MPEGTS_STREAM_TYPE_PRIVATE_SECTIONS:
|
|
||||||
case GST_MPEGTS_STREAM_TYPE_MHEG:
|
|
||||||
case GST_MPEGTS_STREAM_TYPE_DSM_CC:
|
|
||||||
case GST_MPEGTS_STREAM_TYPE_DSMCC_A:
|
|
||||||
case GST_MPEGTS_STREAM_TYPE_DSMCC_B:
|
|
||||||
case GST_MPEGTS_STREAM_TYPE_DSMCC_C:
|
|
||||||
case GST_MPEGTS_STREAM_TYPE_DSMCC_D:
|
|
||||||
case GST_MPEGTS_STREAM_TYPE_SL_FLEXMUX_SECTIONS:
|
|
||||||
case GST_MPEGTS_STREAM_TYPE_METADATA_SECTIONS:
|
|
||||||
/* Set known PSI streams */
|
|
||||||
if (base->parse_private_sections)
|
|
||||||
MPEGTS_BIT_UNSET (base->known_psi, stream->pid);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
MPEGTS_BIT_UNSET (base->is_pes, stream->pid);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -672,49 +678,24 @@ mpegts_base_activate_program (MpegTSBase * base, MpegTSBaseProgram * program,
|
||||||
|
|
||||||
for (i = 0; i < pmt->streams->len; ++i) {
|
for (i = 0; i < pmt->streams->len; ++i) {
|
||||||
GstMpegtsPMTStream *stream = g_ptr_array_index (pmt->streams, i);
|
GstMpegtsPMTStream *stream = g_ptr_array_index (pmt->streams, i);
|
||||||
|
if (_stream_is_private_section (stream)) {
|
||||||
switch (stream->stream_type) {
|
if (base->parse_private_sections)
|
||||||
case GST_MPEGTS_STREAM_TYPE_SCTE_DSMCC_DCB:
|
MPEGTS_BIT_SET (base->known_psi, stream->pid);
|
||||||
case GST_MPEGTS_STREAM_TYPE_SCTE_SIGNALING:
|
} else {
|
||||||
{
|
if (G_UNLIKELY (MPEGTS_BIT_IS_SET (base->is_pes, stream->pid)))
|
||||||
guint32 registration_id =
|
GST_FIXME
|
||||||
get_registration_from_descriptors (stream->descriptors);
|
("Refcounting issue. Setting twice a PID (0x%04x) as known PES",
|
||||||
/* Not a private section stream */
|
stream->pid);
|
||||||
if (registration_id != DRF_ID_CUEI && registration_id != DRF_ID_ETV1)
|
if (G_UNLIKELY (MPEGTS_BIT_IS_SET (base->known_psi, stream->pid))) {
|
||||||
break;
|
GST_FIXME
|
||||||
/* Fall through on purpose - remove this PID from known_psi */
|
("Refcounting issue. Setting a known PSI PID (0x%04x) as known PES",
|
||||||
|
stream->pid);
|
||||||
|
MPEGTS_BIT_UNSET (base->known_psi, stream->pid);
|
||||||
}
|
}
|
||||||
case GST_MPEGTS_STREAM_TYPE_PRIVATE_SECTIONS:
|
MPEGTS_BIT_SET (base->is_pes, stream->pid);
|
||||||
case GST_MPEGTS_STREAM_TYPE_MHEG:
|
|
||||||
case GST_MPEGTS_STREAM_TYPE_DSM_CC:
|
|
||||||
case GST_MPEGTS_STREAM_TYPE_DSMCC_A:
|
|
||||||
case GST_MPEGTS_STREAM_TYPE_DSMCC_B:
|
|
||||||
case GST_MPEGTS_STREAM_TYPE_DSMCC_C:
|
|
||||||
case GST_MPEGTS_STREAM_TYPE_DSMCC_D:
|
|
||||||
case GST_MPEGTS_STREAM_TYPE_SL_FLEXMUX_SECTIONS:
|
|
||||||
case GST_MPEGTS_STREAM_TYPE_METADATA_SECTIONS:
|
|
||||||
/* Set known PSI streams */
|
|
||||||
if (base->parse_private_sections)
|
|
||||||
MPEGTS_BIT_SET (base->known_psi, stream->pid);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (G_UNLIKELY (MPEGTS_BIT_IS_SET (base->is_pes, stream->pid)))
|
|
||||||
GST_FIXME
|
|
||||||
("Refcounting issue. Setting twice a PID (0x%04x) as known PES",
|
|
||||||
stream->pid);
|
|
||||||
if (G_UNLIKELY (MPEGTS_BIT_IS_SET (base->known_psi, stream->pid))) {
|
|
||||||
GST_FIXME
|
|
||||||
("Refcounting issue. Setting a known PSI PID (0x%04x) as known PES",
|
|
||||||
stream->pid);
|
|
||||||
MPEGTS_BIT_UNSET (base->known_psi, stream->pid);
|
|
||||||
}
|
|
||||||
|
|
||||||
MPEGTS_BIT_SET (base->is_pes, stream->pid);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
mpegts_base_program_add_stream (base, program,
|
mpegts_base_program_add_stream (base, program,
|
||||||
stream->pid, stream->stream_type, stream);
|
stream->pid, stream->stream_type, stream);
|
||||||
|
|
||||||
}
|
}
|
||||||
/* We add the PCR pid last. If that PID is already used by one of the media
|
/* We add the PCR pid last. If that PID is already used by one of the media
|
||||||
* streams above, no new stream will be created */
|
* streams above, no new stream will be created */
|
||||||
|
|
Loading…
Reference in a new issue