shapewipe: Improve debugging and immediately return empty caps from the getcaps functions
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Tue, 21 Sep 2010 17:12:45 +0000 (19:12 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Tue, 21 Sep 2010 17:15:22 +0000 (19:15 +0200)
gst/shapewipe/gstshapewipe.c

index 6b84909..0b7c253 100644 (file)
@@ -385,7 +385,14 @@ gst_shape_wipe_video_sink_getcaps (GstPad * pad)
     ret = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
   }
 
+  GST_LOG_OBJECT (pad, "srcpad accepted caps: %" GST_PTR_FORMAT, ret);
+
+  if (gst_caps_is_empty (ret))
+    goto done;
+
   tmp = gst_pad_peer_get_caps (pad);
+
+  GST_LOG_OBJECT (pad, "peerpad accepted caps: %" GST_PTR_FORMAT, tmp);
   if (tmp) {
     GstCaps *intersection;
 
@@ -395,6 +402,11 @@ gst_shape_wipe_video_sink_getcaps (GstPad * pad)
     ret = intersection;
   }
 
+  GST_LOG_OBJECT (pad, "intersection: %" GST_PTR_FORMAT, tmp);
+
+  if (gst_caps_is_empty (ret))
+    goto done;
+
   if (self->height && self->width) {
     guint i, n;
 
@@ -408,6 +420,8 @@ gst_shape_wipe_video_sink_getcaps (GstPad * pad)
   }
 
   tmp = gst_pad_peer_get_caps (self->mask_sinkpad);
+
+  GST_LOG_OBJECT (pad, "mask accepted caps: %" GST_PTR_FORMAT, tmp);
   if (tmp) {
     GstCaps *intersection, *tmp2;
     guint i, n;
@@ -443,6 +457,7 @@ gst_shape_wipe_video_sink_getcaps (GstPad * pad)
     gst_caps_unref (ret);
     ret = intersection;
   }
+done:
 
   gst_object_unref (self);
 
@@ -509,7 +524,14 @@ gst_shape_wipe_mask_sink_getcaps (GstPad * pad)
     ret = gst_caps_copy (gst_pad_get_pad_template_caps (self->video_sinkpad));
   }
 
+  GST_LOG_OBJECT (pad, "video sink accepted caps: %" GST_PTR_FORMAT, ret);
+
+  if (gst_caps_is_empty (ret))
+    goto done;
+
   tmp = gst_pad_peer_get_caps (self->srcpad);
+  GST_LOG_OBJECT (pad, "srcpad accepted caps: %" GST_PTR_FORMAT, ret);
+
   if (tmp) {
     GstCaps *intersection;
 
@@ -519,6 +541,11 @@ gst_shape_wipe_mask_sink_getcaps (GstPad * pad)
     ret = intersection;
   }
 
+  GST_LOG_OBJECT (pad, "intersection: %" GST_PTR_FORMAT, ret);
+
+  if (gst_caps_is_empty (ret))
+    goto done;
+
   n = gst_caps_get_size (ret);
   tmp = gst_caps_new_empty ();
   for (i = 0; i < n; i++) {
@@ -547,6 +574,8 @@ gst_shape_wipe_mask_sink_getcaps (GstPad * pad)
   gst_caps_append (ret, tmp);
 
   tmp = gst_pad_peer_get_caps (pad);
+  GST_LOG_OBJECT (pad, "peer accepted caps: %" GST_PTR_FORMAT, tmp);
+
   if (tmp) {
     GstCaps *intersection;
 
@@ -556,6 +585,7 @@ gst_shape_wipe_mask_sink_getcaps (GstPad * pad)
     ret = intersection;
   }
 
+done:
   gst_object_unref (self);
 
   GST_LOG_OBJECT (pad, "Returning caps: %" GST_PTR_FORMAT, ret);
@@ -584,7 +614,13 @@ gst_shape_wipe_src_getcaps (GstPad * pad)
     ret = gst_caps_copy (gst_pad_get_pad_template_caps (self->video_sinkpad));
   }
 
+  GST_LOG_OBJECT (pad, "video sink accepted caps: %" GST_PTR_FORMAT, ret);
+
+  if (gst_caps_is_empty (ret))
+    goto done;
+
   tmp = gst_pad_peer_get_caps (pad);
+  GST_LOG_OBJECT (pad, "peer accepted caps: %" GST_PTR_FORMAT, ret);
   if (tmp) {
     GstCaps *intersection;
 
@@ -594,6 +630,11 @@ gst_shape_wipe_src_getcaps (GstPad * pad)
     ret = intersection;
   }
 
+  GST_LOG_OBJECT (pad, "intersection: %" GST_PTR_FORMAT, ret);
+
+  if (gst_caps_is_empty (ret))
+    goto done;
+
   if (self->height && self->width) {
     guint i, n;
 
@@ -607,6 +648,7 @@ gst_shape_wipe_src_getcaps (GstPad * pad)
   }
 
   tmp = gst_pad_peer_get_caps (self->mask_sinkpad);
+  GST_LOG_OBJECT (pad, "mask sink accepted caps: %" GST_PTR_FORMAT, ret);
   if (tmp) {
     GstCaps *intersection, *tmp2;
     guint i, n;
@@ -642,6 +684,8 @@ gst_shape_wipe_src_getcaps (GstPad * pad)
     ret = intersection;
   }
 
+done:
+
   gst_object_unref (self);
 
   GST_LOG_OBJECT (pad, "Returning caps: %" GST_PTR_FORMAT, ret);