gst/base/gstbasetransform.c: Added more debug info in the negotiate process.
authorWim Taymans <wim.taymans@gmail.com>
Tue, 12 Jul 2005 17:17:34 +0000 (17:17 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Tue, 12 Jul 2005 17:17:34 +0000 (17:17 +0000)
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_setcaps):
Added more debug info in the negotiate process.

* gst/gstmessage.h:
Prepare for segment playback.

* gst/gstpad.c: (gst_pad_accept_caps), (gst_pad_set_caps):
Better debugging.

* gst/gstutils.c:
Some more docs.

* tools/gst-launch.c: (main):
NULL pipeline on errors.

ChangeLog
gst/base/gstbasetransform.c
gst/gstmessage.h
gst/gstpad.c
gst/gstutils.c
libs/gst/base/gstbasetransform.c
tools/gst-launch.c

index 0af1005..e1eed0c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2005-07-12  Wim Taymans  <wim@fluendo.com>
+
+       * gst/base/gstbasetransform.c: (gst_base_transform_setcaps):
+       Added more debug info in the negotiate process.
+
+       * gst/gstmessage.h:
+       Prepare for segment playback.
+
+       * gst/gstpad.c: (gst_pad_accept_caps), (gst_pad_set_caps):
+       Better debugging.
+
+       * gst/gstutils.c:
+       Some more docs.
+
+       * tools/gst-launch.c: (main):
+       NULL pipeline on errors.
+
 2005-07-12  Andy Wingo  <wingo@pobox.com>
 
        * gst/gstbuffer.c (_gst_buffer_copy): Copy the buffer whether or
index ed658a8..df64054 100644 (file)
@@ -252,7 +252,8 @@ gst_base_transform_setcaps (GstPad * pad, GstCaps * caps)
   /* see how we can transform the input caps */
   othercaps = gst_base_transform_transform_caps (trans, pad, caps);
 
-  if (!othercaps) {
+  if (!othercaps || gst_caps_is_empty (othercaps)) {
+    GST_DEBUG ("transform returned useless  %" GST_PTR_FORMAT, othercaps);
     ret = FALSE;
     goto done;
   }
@@ -260,13 +261,22 @@ gst_base_transform_setcaps (GstPad * pad, GstCaps * caps)
   if (!gst_caps_is_fixed (othercaps)) {
     GstCaps *temp;
 
+    GST_DEBUG ("transform returned non fixed  %" GST_PTR_FORMAT, othercaps);
+
     temp = gst_caps_intersect (othercaps, caps);
+    GST_DEBUG ("intersect returned %" GST_PTR_FORMAT, temp);
     if (temp) {
-      /* try passthrough. we know it's fixed, because caps is fixed */
-      if (gst_pad_accept_caps (otherpeer, caps)) {
-        gst_caps_unref (othercaps);
-        othercaps = gst_caps_ref (caps);
-        /* will fall though. calls accept_caps again, should fix that. */
+      if (!gst_caps_is_empty (temp)) {
+        GST_DEBUG ("try passthrough with %" GST_PTR_FORMAT, caps);
+        /* try passthrough. we know it's fixed, because caps is fixed */
+        if (gst_pad_accept_caps (otherpeer, caps)) {
+          GST_DEBUG ("peer accepted %" GST_PTR_FORMAT, caps);
+          gst_caps_unref (othercaps);
+          othercaps = gst_caps_ref (caps);
+          /* will fall though. calls accept_caps again, should fix that. */
+        } else {
+          GST_DEBUG ("peer did not accept %" GST_PTR_FORMAT, caps);
+        }
       }
       gst_caps_unref (temp);
     }
@@ -274,28 +284,32 @@ gst_base_transform_setcaps (GstPad * pad, GstCaps * caps)
 
   if (!gst_caps_is_fixed (othercaps) && otherpeer) {
     /* intersect against what the peer can do */
-    if (otherpeer) {
-      GstCaps *peercaps;
-      GstCaps *intersect;
+    GstCaps *peercaps;
+    GstCaps *intersect;
 
-      peercaps = gst_pad_get_caps (otherpeer);
-      intersect = gst_caps_intersect (peercaps, othercaps);
-      gst_caps_unref (peercaps);
-      gst_caps_unref (othercaps);
-      othercaps = intersect;
+    GST_DEBUG ("othercaps now %" GST_PTR_FORMAT, othercaps);
 
-      GST_DEBUG ("filtering against peer yields %" GST_PTR_FORMAT, othercaps);
-    }
+    peercaps = gst_pad_get_caps (otherpeer);
+    intersect = gst_caps_intersect (peercaps, othercaps);
+    gst_caps_unref (peercaps);
+    gst_caps_unref (othercaps);
+    othercaps = intersect;
+
+    GST_DEBUG ("filtering against peer yields %" GST_PTR_FORMAT, othercaps);
   }
 
   if (!gst_caps_is_fixed (othercaps)) {
     GstCaps *temp;
 
+    GST_DEBUG ("othercaps now, trying to fixate %" GST_PTR_FORMAT, othercaps);
+
     /* take first possibility and fixate if necessary */
     temp = gst_caps_copy_nth (othercaps, 0);
     gst_caps_unref (othercaps);
     othercaps = temp;
     gst_pad_fixate_caps (otherpad, othercaps);
+
+    GST_DEBUG ("after fixating %" GST_PTR_FORMAT, othercaps);
   }
 
   g_return_val_if_fail (gst_caps_is_fixed (othercaps), FALSE);
@@ -307,6 +321,8 @@ gst_base_transform_setcaps (GstPad * pad, GstCaps * caps)
     goto done;
   }
 
+  GST_DEBUG ("got final caps %" GST_PTR_FORMAT, othercaps);
+
   /* we know this will work, we implement the setcaps */
   gst_pad_set_caps (otherpad, othercaps);
 
index f527a3c..e1b11db 100644 (file)
@@ -47,6 +47,8 @@ G_BEGIN_DECLS
  *                             stops, errors, etc..
  * @GST_MESSAGE_APPLICATION: message posted by the application, possibly
  *                           via an application-specific element.
+ * @GST_MESSAGE_SEGMENT_START: pipeline started playback of a segment.
+ * @GST_MESSAGE_SEGMENT_DONE: pipeline completed playback of a segment.
  * @GST_MESSAGE_ANY: mask for all of the above messages.
  */
 typedef enum
@@ -64,6 +66,8 @@ typedef enum
   GST_MESSAGE_STRUCTURE_CHANGE  = (1 << 9),
   GST_MESSAGE_STREAM_STATUS     = (1 << 10),
   GST_MESSAGE_APPLICATION       = (1 << 11),
+  GST_MESSAGE_SEGMENT_START     = (1 << 12),
+  GST_MESSAGE_SEGMENT_DONE      = (1 << 13),
   GST_MESSAGE_ANY               = 0xffffffff
 } GstMessageType;
 
index 811e906..cc0a656 100644 (file)
@@ -1930,9 +1930,11 @@ could_not_set:
   {
     GST_LOCK (pad);
     GST_FLAG_UNSET (pad, GST_PAD_IN_SETCAPS);
+    GST_CAT_DEBUG (GST_CAT_CAPS,
+        "pad %s:%s, caps %" GST_PTR_FORMAT " could not be set",
+        GST_DEBUG_PAD_NAME (pad), caps);
     GST_UNLOCK (pad);
-    GST_CAT_DEBUG (GST_CAT_CAPS, "caps %" GST_PTR_FORMAT " could not be set",
-        caps);
+
     return FALSE;
   }
 }
index f3179fe..2657da0 100644 (file)
@@ -1525,6 +1525,9 @@ gst_pad_can_link (GstPad * srcpad, GstPad * sinkpad)
  * @gst_pad_get_fixed_caps_func as the gstcaps function for the
  * pad. This way the function will always return the negotiated caps
  * or in case the pad is not negotiated, the padtemplate caps.
+ *
+ * Use this function on a pad that, once _set_caps() has been called
+ * on it, it cannot be renegotiated to something else.
  */
 void
 gst_pad_use_fixed_caps (GstPad * pad)
index ed658a8..df64054 100644 (file)
@@ -252,7 +252,8 @@ gst_base_transform_setcaps (GstPad * pad, GstCaps * caps)
   /* see how we can transform the input caps */
   othercaps = gst_base_transform_transform_caps (trans, pad, caps);
 
-  if (!othercaps) {
+  if (!othercaps || gst_caps_is_empty (othercaps)) {
+    GST_DEBUG ("transform returned useless  %" GST_PTR_FORMAT, othercaps);
     ret = FALSE;
     goto done;
   }
@@ -260,13 +261,22 @@ gst_base_transform_setcaps (GstPad * pad, GstCaps * caps)
   if (!gst_caps_is_fixed (othercaps)) {
     GstCaps *temp;
 
+    GST_DEBUG ("transform returned non fixed  %" GST_PTR_FORMAT, othercaps);
+
     temp = gst_caps_intersect (othercaps, caps);
+    GST_DEBUG ("intersect returned %" GST_PTR_FORMAT, temp);
     if (temp) {
-      /* try passthrough. we know it's fixed, because caps is fixed */
-      if (gst_pad_accept_caps (otherpeer, caps)) {
-        gst_caps_unref (othercaps);
-        othercaps = gst_caps_ref (caps);
-        /* will fall though. calls accept_caps again, should fix that. */
+      if (!gst_caps_is_empty (temp)) {
+        GST_DEBUG ("try passthrough with %" GST_PTR_FORMAT, caps);
+        /* try passthrough. we know it's fixed, because caps is fixed */
+        if (gst_pad_accept_caps (otherpeer, caps)) {
+          GST_DEBUG ("peer accepted %" GST_PTR_FORMAT, caps);
+          gst_caps_unref (othercaps);
+          othercaps = gst_caps_ref (caps);
+          /* will fall though. calls accept_caps again, should fix that. */
+        } else {
+          GST_DEBUG ("peer did not accept %" GST_PTR_FORMAT, caps);
+        }
       }
       gst_caps_unref (temp);
     }
@@ -274,28 +284,32 @@ gst_base_transform_setcaps (GstPad * pad, GstCaps * caps)
 
   if (!gst_caps_is_fixed (othercaps) && otherpeer) {
     /* intersect against what the peer can do */
-    if (otherpeer) {
-      GstCaps *peercaps;
-      GstCaps *intersect;
+    GstCaps *peercaps;
+    GstCaps *intersect;
 
-      peercaps = gst_pad_get_caps (otherpeer);
-      intersect = gst_caps_intersect (peercaps, othercaps);
-      gst_caps_unref (peercaps);
-      gst_caps_unref (othercaps);
-      othercaps = intersect;
+    GST_DEBUG ("othercaps now %" GST_PTR_FORMAT, othercaps);
 
-      GST_DEBUG ("filtering against peer yields %" GST_PTR_FORMAT, othercaps);
-    }
+    peercaps = gst_pad_get_caps (otherpeer);
+    intersect = gst_caps_intersect (peercaps, othercaps);
+    gst_caps_unref (peercaps);
+    gst_caps_unref (othercaps);
+    othercaps = intersect;
+
+    GST_DEBUG ("filtering against peer yields %" GST_PTR_FORMAT, othercaps);
   }
 
   if (!gst_caps_is_fixed (othercaps)) {
     GstCaps *temp;
 
+    GST_DEBUG ("othercaps now, trying to fixate %" GST_PTR_FORMAT, othercaps);
+
     /* take first possibility and fixate if necessary */
     temp = gst_caps_copy_nth (othercaps, 0);
     gst_caps_unref (othercaps);
     othercaps = temp;
     gst_pad_fixate_caps (otherpad, othercaps);
+
+    GST_DEBUG ("after fixating %" GST_PTR_FORMAT, othercaps);
   }
 
   g_return_val_if_fail (gst_caps_is_fixed (othercaps), FALSE);
@@ -307,6 +321,8 @@ gst_base_transform_setcaps (GstPad * pad, GstCaps * caps)
     goto done;
   }
 
+  GST_DEBUG ("got final caps %" GST_PTR_FORMAT, othercaps);
+
   /* we know this will work, we implement the setcaps */
   gst_pad_set_caps (otherpad, othercaps);
 
index 4e038d7..95951a1 100644 (file)
@@ -632,19 +632,21 @@ main (int argc, char *argv[])
 
       g_print (_("Execution ended after %" G_GUINT64_FORMAT " ns.\n"), diff);
     }
+    while (g_main_context_iteration (NULL, FALSE));
+
     fprintf (stderr, _("PAUSE pipeline ...\n"));
     gst_element_set_state (pipeline, GST_STATE_PAUSED);
     gst_element_get_state (pipeline, &state, &pending, NULL);
     fprintf (stderr, _("READY pipeline ...\n"));
     gst_element_set_state (pipeline, GST_STATE_READY);
     gst_element_get_state (pipeline, &state, &pending, NULL);
+
+  end:
     fprintf (stderr, _("NULL pipeline ...\n"));
     gst_element_set_state (pipeline, GST_STATE_NULL);
     gst_element_get_state (pipeline, &state, &pending, NULL);
   }
 
-end:
-
   fprintf (stderr, _("FREEING pipeline ...\n"));
   gst_object_unref (pipeline);