static GstStateChangeReturn
gnl_composition_change_state (GstElement * element, GstStateChange transition);
-static inline void
-_object_block_and_drop_data (GnlComposition * comp, GnlObject * obj);
static inline void gnl_composition_reset_target_pad (GnlComposition * comp);
static gboolean
static gboolean
gnl_composition_event_handler (GstPad * ghostpad, GstObject * parent,
GstEvent * event);
-static void _relink_single_node (GnlComposition * comp, GNode * node, GstEvent *toplevel_seek);
+static void _relink_single_node (GnlComposition * comp, GNode * node,
+ GstEvent * toplevel_seek);
static gboolean update_pipeline_func (GnlComposition * comp);
static gboolean commit_pipeline_func (GnlComposition * comp);
static gboolean lock_child_state (GValue * item, GValue * ret,
return res;
}
-static GstPadProbeReturn
-pad_blocked (GstPad * pad, GstPadProbeInfo * info, GnlComposition * comp)
-{
- GST_DEBUG_OBJECT (comp, "Pad : %s:%s", GST_DEBUG_PAD_NAME (pad));
-
- return GST_PAD_PROBE_OK;
-}
-
static inline void
gnl_composition_reset_target_pad (GnlComposition * comp)
{
priv->send_stream_start = TRUE;
}
-static GstPadProbeReturn
-drop_data (GstPad * pad, GstPadProbeInfo * info, GnlCompositionEntry * entry)
-{
- /* When updating the pipeline, do not let data flowing */
- if (!GST_IS_EVENT (info->data)) {
- GST_LOG_OBJECT (pad, "Dropping data while updating pipeline");
- return GST_PAD_PROBE_DROP;
- } else {
- GstEvent *event = GST_EVENT (info->data);
-
- if (GST_EVENT_TYPE (event) == GST_EVENT_SEEK) {
- entry->seeked = TRUE;
- GST_DEBUG_OBJECT (pad, "Got SEEK event");
- } else if (entry->seeked == TRUE &&
- GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT) {
- entry->seeked = FALSE;
- entry->dataprobeid = 0;
-
- GST_DEBUG_OBJECT (pad, "Already seeked and got segment,"
- " removing probe");
- return GST_PAD_PROBE_REMOVE;
- }
- }
-
- return GST_PAD_PROBE_OK;
-}
-
-static inline void
-_entry_block_and_drop_data (GnlCompositionEntry * entry)
-{
- if (!entry->probeid) {
- GST_LOG_OBJECT (entry->comp, "block_async(%s:%s, TRUE)",
- GST_DEBUG_PAD_NAME (entry->object->srcpad));
- entry->probeid =
- gst_pad_add_probe (entry->object->srcpad,
- GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM | GST_PAD_PROBE_TYPE_IDLE,
- (GstPadProbeCallback) pad_blocked, entry->comp, NULL);
- }
- if (!entry->dataprobeid) {
- entry->dataprobeid = gst_pad_add_probe (entry->object->srcpad,
- GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_BUFFER_LIST |
- GST_PAD_PROBE_TYPE_EVENT_BOTH, (GstPadProbeCallback) drop_data,
- entry, NULL);
- }
-}
-
-static inline void
-_object_block_and_drop_data (GnlComposition * comp, GnlObject * obj)
-{
- GnlCompositionEntry *entry = COMP_ENTRY (comp, obj);
-
- if (entry == NULL) {
- GST_DEBUG_OBJECT (obj, "No entry associated, (being removed)");
- return;
- }
-
- _entry_block_and_drop_data (entry);
-}
-
/* gnl_composition_ghost_pad_set_target:
* target: The target #GstPad. The refcount will be decremented (given to the ghostpad).
* entry: The GnlCompositionEntry to which the pad belongs
return;
}
- /* Unset previous target */
- if (ptarget) {
- GST_DEBUG_OBJECT (comp, "Previous target was %s:%s",
- GST_DEBUG_PAD_NAME (ptarget));
-
- if (!priv->toplevelentry->probeid) {
- /* If it's not blocked, block it */
- priv->toplevelentry->probeid =
- gst_pad_add_probe (ptarget,
- GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM | GST_PAD_PROBE_TYPE_IDLE,
- (GstPadProbeCallback) pad_blocked, comp, NULL);
- }
-
- if (!priv->toplevelentry->dataprobeid) {
- priv->toplevelentry->dataprobeid = gst_pad_add_probe (ptarget,
- GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_BUFFER_LIST |
- GST_PAD_PROBE_TYPE_EVENT_BOTH, (GstPadProbeCallback) drop_data,
- priv->toplevelentry, NULL);
- }
-
- /* remove event probe */
- if (priv->ghosteventprobe) {
- gst_pad_remove_probe (ptarget, priv->ghosteventprobe);
- priv->ghosteventprobe = 0;
- }
- gst_object_unref (ptarget);
-
- }
-
/* Actually set the target */
gnl_object_ghost_pad_set_target ((GnlObject *) comp,
GNL_OBJECT (comp)->srcpad, target);
static void
_relink_children_recursively (GnlComposition * comp,
- GnlObject * newobj, GNode * node, GstEvent *toplevel_seek)
+ GnlObject * newobj, GNode * node, GstEvent * toplevel_seek)
{
GNode *child;
guint nbchildren = g_node_n_children (node);
* WITH OBJECTS LOCK TAKEN
*/
static void
-_relink_single_node (GnlComposition * comp, GNode * node, GstEvent *toplevel_seek)
+_relink_single_node (GnlComposition * comp, GNode * node,
+ GstEvent * toplevel_seek)
{
GnlObject *newobj;
GnlObject *newparent;
static GList *
compare_relink_stack (GnlComposition * comp, GNode * stack, gboolean modify)
{
+ GstPad *ptarget;
GstEvent *toplevel_seek = get_new_seek_event (comp, TRUE, FALSE);
GList *deactivate = NULL;
gst_element_state_change_return_get_name
(gst_element_set_state (comp->priv->current_bin, GST_STATE_READY)));
+ ptarget =
+ gst_ghost_pad_get_target (GST_GHOST_PAD (GNL_OBJECT (comp)->srcpad));
_empty_bin (GST_BIN_CAST (comp->priv->current_bin));
+ if (comp->priv->ghosteventprobe) {
+ gst_pad_remove_probe (ptarget, comp->priv->ghosteventprobe);
+ comp->priv->ghosteventprobe = 0;
+ }
+
+
_relink_single_node (comp, stack, toplevel_seek);
gst_element_set_locked_state (comp->priv->current_bin, FALSE);
/* ...and add it to the hash table */
g_hash_table_insert (priv->objects_hash, object, entry);
- _entry_block_and_drop_data (entry);
-
/* Set the caps of the composition */
if (G_UNLIKELY (!gst_caps_is_any (((GnlObject *) comp)->caps)))
gnl_object_set_caps ((GnlObject *) object, ((GnlObject *) comp)->caps);