base->program_size = sizeof (MpegTSBaseProgram);
base->stream_size = sizeof (MpegTSBaseStream);
+ base->push_data = TRUE;
+ base->push_section = TRUE;
+
mpegts_base_reset (base);
}
/* If it's a known PES, push it */
if (MPEGTS_BIT_IS_SET (base->is_pes, packet.pid)) {
/* push the packet downstream */
- res = klass->push (base, &packet, NULL);
+ if (base->push_data)
+ res = klass->push (base, &packet, NULL);
} else if (packet.payload
&& MPEGTS_BIT_IS_SET (base->known_psi, packet.pid)) {
/* base PSI data */
}
/* we need to push section packet downstream */
- res = klass->push (base, &packet, section);
+ if (base->push_section)
+ res = klass->push (base, &packet, section);
} else if (packet.payload && packet.pid != 0x1fff)
GST_LOG ("PID 0x%04x Saw packet on a pid we don't handle", packet.pid);
/* Whether to parse private section or not */
gboolean parse_private_sections;
+
+ /* Whether to push data and/or sections to subclasses */
+ gboolean push_data;
+ gboolean push_section;
};
struct _MpegTSBaseClass {
static void
mpegts_parse_init (MpegTSParse2 * parse)
{
- GST_MPEGTS_BASE (parse)->program_size = sizeof (MpegTSParseProgram);
+ MpegTSBase *base = (MpegTSBase *) parse;
+
+ base->program_size = sizeof (MpegTSParseProgram);
+ /* We will only need to handle data/section if we have request pads */
+ base->push_data = FALSE;
+ base->push_section = FALSE;
parse->srcpad = gst_pad_new_from_static_template (&src_template, "src");
parse->first = TRUE;
mpegts_parse_pad_removed (GstElement * element, GstPad * pad)
{
MpegTSParsePad *tspad;
+ MpegTSBase *base = (MpegTSBase *) element;
MpegTSParse2 *parse = GST_MPEGTS_PARSE (element);
if (gst_pad_get_direction (pad) == GST_PAD_SINK)
parse->srcpads = g_list_remove_all (parse->srcpads, pad);
}
+ if (parse->srcpads == NULL) {
+ base->push_data = FALSE;
+ base->push_section = FALSE;
+ }
if (GST_ELEMENT_CLASS (parent_class)->pad_removed)
GST_ELEMENT_CLASS (parent_class)->pad_removed (element, pad);
mpegts_parse_request_new_pad (GstElement * element, GstPadTemplate * template,
const gchar * padname, const GstCaps * caps)
{
+ MpegTSBase *base = (MpegTSBase *) element;
MpegTSParse2 *parse;
MpegTSParsePad *tspad;
MpegTSParseProgram *parseprogram;
pad = tspad->pad;
parse->srcpads = g_list_append (parse->srcpads, pad);
+ base->push_data = TRUE;
+ base->push_section = TRUE;
gst_pad_set_active (pad, TRUE);
GstFlowReturn ret;
GList *srcpads;
- /* Shortcut: If no request pads exist, just return */
- if (parse->srcpads == NULL)
- return GST_FLOW_OK;
-
GST_OBJECT_LOCK (parse);
srcpads = parse->srcpads;
base->stream_size = sizeof (TSDemuxStream);
base->parse_private_sections = TRUE;
+ /* We are not interested in sections (all handled by mpegtsbase) */
+ base->push_section = FALSE;
+
gst_ts_demux_reset (base);
}
packet->payload_unit_start_indicator, packet->scram_afc_cc & 0x30,
FLAGS_CONTINUITY_COUNTER (packet->scram_afc_cc), packet->payload);
- if (section) {
- GST_LOG ("Got section, returning");
- return res;
- }
-
if (G_UNLIKELY (packet->payload_unit_start_indicator) &&
FLAGS_HAS_PAYLOAD (packet->scram_afc_cc))
/* Flush previous data */