whitespace, doc and debug fixing/additions
authorThomas Vander Stichele <thomas@apestaart.org>
Fri, 26 Aug 2005 11:19:22 +0000 (11:19 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Fri, 26 Aug 2005 11:19:22 +0000 (11:19 +0000)
Original commit message from CVS:
whitespace, doc and debug fixing/additions

common
gst/base/gstbasetransform.c
gst/gstbuffer.h
gst/gstpad.c
libs/gst/base/gstbasetransform.c

diff --git a/common b/common
index aa2a757..7c93670 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit aa2a757c587d91069a230d8e656481c3c364ccc6
+Subproject commit 7c93670c50de2b6e9d8edd31737c636192fbd831
index 3deb354..e962696 100644 (file)
@@ -258,7 +258,6 @@ gst_base_transform_transform_caps (GstBaseTransform * trans,
   return ret;
 }
 
-/* by default, this keeps the number of samples in the buffer the same */
 static gboolean
 gst_base_transform_transform_size (GstBaseTransform * trans,
     GstPadDirection direction, GstCaps * caps,
@@ -270,8 +269,9 @@ gst_base_transform_transform_size (GstBaseTransform * trans,
 
   klass = GST_BASE_TRANSFORM_GET_CLASS (trans);
 
-  GST_DEBUG_OBJECT (trans, "asked to transform size %d in direction %s",
-      size, direction == GST_PAD_SRC ? "SRC" : "SINK");
+  GST_DEBUG_OBJECT (trans, "asked to transform size %d for caps %"
+      GST_PTR_FORMAT " to size for caps %" GST_PTR_FORMAT " in direction %s",
+      size, caps, othercaps, direction == GST_PAD_SRC ? "SRC" : "SINK");
 
   /* if there is a custom transform function, use this */
   if (klass->transform_size) {
@@ -280,6 +280,8 @@ gst_base_transform_transform_size (GstBaseTransform * trans,
   } else {
     g_return_val_if_fail (gst_base_transform_get_unit_size (trans, caps,
             &inunitsize), FALSE);
+    GST_DEBUG_OBJECT (trans, "input size %d, input unit size %d", size,
+        inunitsize);
     g_return_val_if_fail (size % inunitsize == 0, FALSE);
 
     units = size / inunitsize;
@@ -603,8 +605,8 @@ gst_base_transform_get_unit_size (GstBaseTransform * trans, GstCaps * caps,
   bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
   if (bclass->get_unit_size) {
     res = bclass->get_unit_size (trans, caps, size);
-    GST_DEBUG_OBJECT (trans, "get size(%" GST_PTR_FORMAT
-        ") set size %d, returned %d", caps, *size, res);
+    GST_DEBUG_OBJECT (trans, "caps %" GST_PTR_FORMAT
+        ") has unit size %d, result %s", caps, *size, res ? "TRUE" : "FALSE");
 
     if (res) {
       if (trans->cache_caps1 == NULL) {
@@ -639,8 +641,11 @@ gst_base_transform_buffer_alloc (GstPad * pad, guint64 offset, guint size,
 
   *buf = NULL;
 
-  GST_DEBUG_OBJECT (trans, "allocating a buffer of size %d at offset %"
-      G_GUINT64_FORMAT, size, offset);
+  GST_DEBUG_OBJECT (trans, "allocating a buffer of size %d ...", size, offset);
+  if (offset == GST_BUFFER_OFFSET_NONE)
+    GST_DEBUG_OBJECT (trans, "... and offset NONE");
+  else
+    GST_DEBUG_OBJECT (trans, "... and offset %" G_GUINT64_FORMAT, offset);
   /* before any buffers are pushed, in_place is TRUE; allocating can trigger
    * a renegotiation and change that to FALSE */
   if (trans->in_place) {
@@ -776,16 +781,25 @@ gst_base_transform_handle_buffer (GstBaseTransform * trans, GstBuffer * inbuf,
 
   bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
 
+  GST_LOG_OBJECT (trans, "handling buffer %p of size %d ...", inbuf,
+      GST_BUFFER_SIZE (inbuf));
+  if (GST_BUFFER_OFFSET_IS_VALID (inbuf))
+    GST_LOG_OBJECT (trans, "... and offset %" G_GUINT64_FORMAT,
+        GST_BUFFER_OFFSET (inbuf));
+  else
+    GST_LOG_OBJECT (trans, "... and offset NONE");
+
   if (trans->in_place) {
     /* check if we can do inplace and the buffer is writable */
     if (bclass->transform_ip && gst_buffer_is_writable (inbuf)) {
+      /* in place transform and subclass supports method */
+      GST_LOG_OBJECT (trans, "doing inplace transform");
       gst_buffer_ref (inbuf);
 
-      /* in place transform and subclass supports method */
       ret = bclass->transform_ip (trans, inbuf);
-
       *outbuf = inbuf;
     } else {
+      GST_LOG_OBJECT (trans, "doing fake inplace transform");
       /* in place transform and subclass does not support method or
        * buffer is not writable. */
       if (bclass->transform) {
@@ -800,6 +814,7 @@ gst_base_transform_handle_buffer (GstBaseTransform * trans, GstBuffer * inbuf,
       }
     }
   } else {
+    GST_LOG_OBJECT (trans, "doing non-inplace transform");
     /* not inplace, figure out the output size */
     if (!gst_base_transform_transform_size (trans,
             GST_PAD_DIRECTION (trans->sinkpad), GST_PAD_CAPS (trans->sinkpad),
@@ -872,7 +887,7 @@ configure_failed:
 }
 
 /* FIXME, getrange is broken, need to pull range from the other
- * end based on the transform_size result. 
+ * end based on the transform_size result.
  */
 static GstFlowReturn
 gst_base_transform_getrange (GstPad * pad, guint64 offset,
index ee31b28..43d0a7a 100644 (file)
@@ -118,7 +118,7 @@ typedef struct _GstBufferClass GstBufferClass;
  * Gets the duration in nanoseconds of the data in the buffer.
  * Value will be %GST_CLOCK_TIME_NONE if the duration is unknown.
  *
- * Returns: the duration of the buffer 
+ * Returns: the duration of the buffer
  */
 #define GST_BUFFER_DURATION(buf)               (GST_BUFFER_CAST(buf)->duration)
 /**
@@ -159,7 +159,7 @@ typedef struct _GstBufferClass GstBufferClass;
 
 /**
  * GST_BUFFER_OFFSET_NONE:
- * 
+ *
  * Constant for no-offset return results.
  */
 #define GST_BUFFER_OFFSET_NONE ((guint64)-1)
@@ -176,7 +176,7 @@ typedef struct _GstBufferClass GstBufferClass;
 /**
  * GST_BUFFER_TIMESTAMP_IS_VALID:
  * @buffer: the #GstBuffer to check for the timestamp
- * 
+ *
  * Tests if the timestamp is known.
  *
  * Returns: %TRUE for success
@@ -185,7 +185,7 @@ typedef struct _GstBufferClass GstBufferClass;
 /**
  * GST_BUFFER_OFFSET_IS_VALID:
  * @buffer: the #GstBuffer to check for the start offset
- * 
+ *
  * Tests if the start offset is known.
  *
  * Returns: %TRUE for success
index c71e4ff..20a654d 100644 (file)
@@ -2341,6 +2341,8 @@ gst_pad_alloc_buffer (GstPad * pad, guint64 offset, gint size, GstCaps * caps,
   GstPadBufferAllocFunction bufferallocfunc;
   gboolean caps_changed;
 
+  GST_DEBUG_OBJECT (pad, "offset %" G_GUINT64_FORMAT, offset);
+
   g_return_val_if_fail (GST_IS_PAD (pad), GST_FLOW_ERROR);
   g_return_val_if_fail (GST_PAD_IS_SRC (pad), GST_FLOW_ERROR);
   g_return_val_if_fail (buf != NULL, GST_FLOW_ERROR);
@@ -2361,9 +2363,13 @@ gst_pad_alloc_buffer (GstPad * pad, guint64 offset, gint size, GstCaps * caps,
     goto flushing;
 
   GST_CAT_DEBUG (GST_CAT_PADS,
-      "calling bufferallocfunc &%s (@%p) of peer pad %s:%s for size %d",
+      "calling bufferallocfunc &%s (@%p) of peer pad %s:%s for size %d ...",
       GST_DEBUG_FUNCPTR_NAME (bufferallocfunc),
       &bufferallocfunc, GST_DEBUG_PAD_NAME (peer), size);
+  if (offset == GST_BUFFER_OFFSET_NONE)
+    GST_CAT_DEBUG (GST_CAT_PADS, "... and offset NONE");
+  else
+    GST_CAT_DEBUG (GST_CAT_PADS, "... and offset %" G_GUINT64_FORMAT, offset);
   GST_UNLOCK (peer);
 
   ret = bufferallocfunc (peer, offset, size, caps, buf);
index 3deb354..e962696 100644 (file)
@@ -258,7 +258,6 @@ gst_base_transform_transform_caps (GstBaseTransform * trans,
   return ret;
 }
 
-/* by default, this keeps the number of samples in the buffer the same */
 static gboolean
 gst_base_transform_transform_size (GstBaseTransform * trans,
     GstPadDirection direction, GstCaps * caps,
@@ -270,8 +269,9 @@ gst_base_transform_transform_size (GstBaseTransform * trans,
 
   klass = GST_BASE_TRANSFORM_GET_CLASS (trans);
 
-  GST_DEBUG_OBJECT (trans, "asked to transform size %d in direction %s",
-      size, direction == GST_PAD_SRC ? "SRC" : "SINK");
+  GST_DEBUG_OBJECT (trans, "asked to transform size %d for caps %"
+      GST_PTR_FORMAT " to size for caps %" GST_PTR_FORMAT " in direction %s",
+      size, caps, othercaps, direction == GST_PAD_SRC ? "SRC" : "SINK");
 
   /* if there is a custom transform function, use this */
   if (klass->transform_size) {
@@ -280,6 +280,8 @@ gst_base_transform_transform_size (GstBaseTransform * trans,
   } else {
     g_return_val_if_fail (gst_base_transform_get_unit_size (trans, caps,
             &inunitsize), FALSE);
+    GST_DEBUG_OBJECT (trans, "input size %d, input unit size %d", size,
+        inunitsize);
     g_return_val_if_fail (size % inunitsize == 0, FALSE);
 
     units = size / inunitsize;
@@ -603,8 +605,8 @@ gst_base_transform_get_unit_size (GstBaseTransform * trans, GstCaps * caps,
   bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
   if (bclass->get_unit_size) {
     res = bclass->get_unit_size (trans, caps, size);
-    GST_DEBUG_OBJECT (trans, "get size(%" GST_PTR_FORMAT
-        ") set size %d, returned %d", caps, *size, res);
+    GST_DEBUG_OBJECT (trans, "caps %" GST_PTR_FORMAT
+        ") has unit size %d, result %s", caps, *size, res ? "TRUE" : "FALSE");
 
     if (res) {
       if (trans->cache_caps1 == NULL) {
@@ -639,8 +641,11 @@ gst_base_transform_buffer_alloc (GstPad * pad, guint64 offset, guint size,
 
   *buf = NULL;
 
-  GST_DEBUG_OBJECT (trans, "allocating a buffer of size %d at offset %"
-      G_GUINT64_FORMAT, size, offset);
+  GST_DEBUG_OBJECT (trans, "allocating a buffer of size %d ...", size, offset);
+  if (offset == GST_BUFFER_OFFSET_NONE)
+    GST_DEBUG_OBJECT (trans, "... and offset NONE");
+  else
+    GST_DEBUG_OBJECT (trans, "... and offset %" G_GUINT64_FORMAT, offset);
   /* before any buffers are pushed, in_place is TRUE; allocating can trigger
    * a renegotiation and change that to FALSE */
   if (trans->in_place) {
@@ -776,16 +781,25 @@ gst_base_transform_handle_buffer (GstBaseTransform * trans, GstBuffer * inbuf,
 
   bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
 
+  GST_LOG_OBJECT (trans, "handling buffer %p of size %d ...", inbuf,
+      GST_BUFFER_SIZE (inbuf));
+  if (GST_BUFFER_OFFSET_IS_VALID (inbuf))
+    GST_LOG_OBJECT (trans, "... and offset %" G_GUINT64_FORMAT,
+        GST_BUFFER_OFFSET (inbuf));
+  else
+    GST_LOG_OBJECT (trans, "... and offset NONE");
+
   if (trans->in_place) {
     /* check if we can do inplace and the buffer is writable */
     if (bclass->transform_ip && gst_buffer_is_writable (inbuf)) {
+      /* in place transform and subclass supports method */
+      GST_LOG_OBJECT (trans, "doing inplace transform");
       gst_buffer_ref (inbuf);
 
-      /* in place transform and subclass supports method */
       ret = bclass->transform_ip (trans, inbuf);
-
       *outbuf = inbuf;
     } else {
+      GST_LOG_OBJECT (trans, "doing fake inplace transform");
       /* in place transform and subclass does not support method or
        * buffer is not writable. */
       if (bclass->transform) {
@@ -800,6 +814,7 @@ gst_base_transform_handle_buffer (GstBaseTransform * trans, GstBuffer * inbuf,
       }
     }
   } else {
+    GST_LOG_OBJECT (trans, "doing non-inplace transform");
     /* not inplace, figure out the output size */
     if (!gst_base_transform_transform_size (trans,
             GST_PAD_DIRECTION (trans->sinkpad), GST_PAD_CAPS (trans->sinkpad),
@@ -872,7 +887,7 @@ configure_failed:
 }
 
 /* FIXME, getrange is broken, need to pull range from the other
- * end based on the transform_size result. 
+ * end based on the transform_size result.
  */
 static GstFlowReturn
 gst_base_transform_getrange (GstPad * pad, guint64 offset,