From 4b9666aedba73321889a1850127a41a14633fcab Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 21 Jan 2010 17:32:33 +0100 Subject: oggdemux: keep track of added pads Keep track of the pads we added and removed. Remove some unused fields. Don't add pads for which we don't have caps. --- ext/ogg/gstoggdemux.c | 7 +++++-- ext/ogg/gstoggdemux.h | 3 +-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c index cd4711cbc..2ccead7c2 100644 --- a/ext/ogg/gstoggdemux.c +++ b/ext/ogg/gstoggdemux.c @@ -1527,7 +1527,7 @@ gst_ogg_demux_deactivate_current_chain (GstOggDemux * ogg) GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i); GstEvent *event; - if (pad->map.is_skeleton) + if (!pad->added) continue; event = gst_event_new_eos (); @@ -1540,6 +1540,8 @@ gst_ogg_demux_deactivate_current_chain (GstOggDemux * ogg) gst_pad_set_active (GST_PAD_CAST (pad), FALSE); gst_element_remove_pad (GST_ELEMENT (ogg), GST_PAD_CAST (pad)); + + pad->added = FALSE; } /* if we cannot seek back to the chain, we can destroy the chain * completely */ @@ -1574,7 +1576,7 @@ gst_ogg_demux_activate_chain (GstOggDemux * ogg, GstOggChain * chain, pad = g_array_index (chain->streams, GstOggPad *, i); - if (pad->map.is_skeleton) + if (pad->map.is_skeleton || pad->added || GST_PAD_CAPS (pad) == NULL) continue; GST_DEBUG_OBJECT (ogg, "adding pad %" GST_PTR_FORMAT, pad); @@ -1583,6 +1585,7 @@ gst_ogg_demux_activate_chain (GstOggDemux * ogg, GstOggChain * chain, pad->discont = TRUE; pad->map.last_size = 0; pad->last_ret = GST_FLOW_OK; + pad->added = TRUE; structure = gst_caps_get_structure (GST_PAD_CAPS (pad), 0); pad->is_sparse = diff --git a/ext/ogg/gstoggdemux.h b/ext/ogg/gstoggdemux.h index f9a8a968b..0cd11cb2c 100644 --- a/ext/ogg/gstoggdemux.h +++ b/ext/ogg/gstoggdemux.h @@ -112,8 +112,7 @@ struct _GstOggPad gboolean discont; GstFlowReturn last_ret; /* last return of _pad_push() */ - gboolean dynamic; /* True if the internal element had dynamic pads */ - guint padaddedid; /* The signal id for element::pad-added */ + gboolean added; }; struct _GstOggPadClass -- cgit v1.2.3