summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hervey <bilboed@bilboed.com>2010-03-25 18:47:37 +0100
committerEdward Hervey <bilboed@bilboed.com>2010-03-25 18:47:37 +0100
commit47ee2e51fc35b8d975dfcdf1374e85a4e95f9dd1 (patch)
tree3160c573f127168f9991f2fc4cf8584627c6a530
parenta8d70cdd006b5e938dd0bd34b31c568c59279084 (diff)
GnlComposition: Set the composition caps on the contained elements
This is only done if the caps of the composition are no GST_CAPS_ANY. This is a step in allowing easy decode-less support for editing.
-rw-r--r--gnl/gnlcomposition.c38
1 files changed, 34 insertions, 4 deletions
diff --git a/gnl/gnlcomposition.c b/gnl/gnlcomposition.c
index b471179..37e524e 100644
--- a/gnl/gnlcomposition.c
+++ b/gnl/gnlcomposition.c
@@ -1476,6 +1476,15 @@ get_src_pad (GstElement * element)
*
*/
+static gboolean
+set_child_caps (GstElement * child, GValue * ret G_GNUC_UNUSED,
+ GnlObject * comp)
+{
+ gnl_object_set_caps ((GnlObject *) child, comp->caps);
+ return TRUE;
+}
+
+
static GstStateChangeReturn
gnl_composition_change_state (GstElement * element, GstStateChange transition)
{
@@ -1483,34 +1492,51 @@ gnl_composition_change_state (GstElement * element, GstStateChange transition)
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
switch (transition) {
- case GST_STATE_CHANGE_READY_TO_PAUSED:{
+ case GST_STATE_CHANGE_READY_TO_PAUSED:
+ {
GstIterator *childs;
gnl_composition_reset (comp);
+
/* state-lock all elements */
GST_DEBUG_OBJECT (comp,
"Setting all childs to READY and locking their state");
childs = gst_bin_iterate_elements (GST_BIN (comp));
- retry:
+ retry_lock:
if (G_UNLIKELY (gst_iterator_fold (childs,
(GstIteratorFoldFunction) lock_child_state, NULL,
NULL) == GST_ITERATOR_RESYNC)) {
gst_iterator_resync (childs);
- goto retry;
+ goto retry_lock;
}
gst_iterator_free (childs);
- }
+
+ /* Set caps on all objects */
+ if (G_UNLIKELY (!gst_caps_is_any (GNL_OBJECT (comp)->caps))) {
+ childs = gst_bin_iterate_elements (GST_BIN (comp));
+ retry_caps:
+ if (G_UNLIKELY (gst_iterator_fold (childs,
+ (GstIteratorFoldFunction) set_child_caps, NULL,
+ comp) == GST_ITERATOR_RESYNC)) {
+ gst_iterator_resync (childs);
+ goto retry_caps;
+ }
+ gst_iterator_free (childs);
+ }
/* set ghostpad target */
if (!(update_pipeline (comp, COMP_REAL_START (comp), TRUE, FALSE, TRUE))) {
ret = GST_STATE_CHANGE_FAILURE;
goto beach;
}
+ }
break;
+
case GST_STATE_CHANGE_PAUSED_TO_READY:
case GST_STATE_CHANGE_READY_TO_NULL:
gnl_composition_reset (comp);
break;
+
default:
break;
}
@@ -2489,6 +2515,10 @@ gnl_composition_add_object (GstBin * bin, GstElement * element)
/* ...and add it to the hash table */
g_hash_table_insert (comp->priv->objects_hash, element, entry);
+ /* Set the caps of the composition */
+ if (G_UNLIKELY (!gst_caps_is_any (((GnlObject *) comp)->caps)))
+ gnl_object_set_caps ((GnlObject *) element, ((GnlObject *) comp)->caps);
+
/* Special case for default source. */
if ((((GnlObject *) element)->priority == G_MAXUINT32) ||
GNL_OBJECT_IS_EXPANDABLE (element)) {