gst/gstcaps.c: Remove debug info.
authorWim Taymans <wim.taymans@gmail.com>
Thu, 14 Jul 2005 18:10:04 +0000 (18:10 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Thu, 14 Jul 2005 18:10:04 +0000 (18:10 +0000)
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_do_simplify):
Remove debug info.

* gst/gsterror.h:
Define error for stream stopped.

* gst/gstghostpad.c: (gst_proxy_pad_do_bufferalloc),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange):
Do proper return values.

* gst/gstpad.c: (gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_chain), (gst_pad_push),
(gst_pad_get_range):
Better return values.

* gst/gstpad.h:
Reorganise return values, add macro to check for fatal errors.

* gst/gstqueue.c: (gst_queue_chain):
Return proper GstFlowReturn values,

ChangeLog
gst/gstcaps.c
gst/gsterror.h
gst/gstghostpad.c
gst/gstpad.c
gst/gstpad.h
gst/gstqueue.c
plugins/elements/gstqueue.c

index e3655df..1b9d383 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2005-07-14  Wim Taymans  <wim@fluendo.com>
+
+       * gst/gstcaps.c: (gst_caps_do_simplify):
+       Remove debug info.
+
+       * gst/gsterror.h:
+       Define error for stream stopped.
+
+       * gst/gstghostpad.c: (gst_proxy_pad_do_bufferalloc),
+       (gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange):
+       Do proper return values.
+
+       * gst/gstpad.c: (gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
+       (gst_pad_set_caps), (gst_pad_chain), (gst_pad_push),
+       (gst_pad_get_range):
+       Better return values.
+
+       * gst/gstpad.h:
+       Reorganise return values, add macro to check for fatal errors.
+
+       * gst/gstqueue.c: (gst_queue_chain):
+       Return proper GstFlowReturn values,
+
 2005-07-14  Thomas Vander Stichele  <thomas at apestaart dot org>
 
        * docs/gst/gstreamer-sections.txt:
index 3188930..0afa857 100644 (file)
@@ -1401,12 +1401,6 @@ gst_caps_do_simplify (GstCaps * caps)
         break;
       }
       if (gst_caps_structure_simplify (&result, simplify, compare)) {
-#if 0
-        g_print ("%s  -  %s  =  %s\n",
-            gst_structure_to_string (simplify),
-            gst_structure_to_string (compare),
-            result ? gst_structure_to_string (result) : "---");
-#endif
         if (result) {
           gst_caps_switch_structures (caps, simplify, result, i);
         } else {
index 897dc92..53f39fc 100644 (file)
@@ -163,6 +163,7 @@ typedef enum
  * @GST_STREAM_ERROR_MUX: used when muxing fails.
  * @GST_STREAM_ERROR_FORMAT: used when the stream is of the wrong format
  * (for example, wrong caps).
+ * @GST_STREAM_ERROR_STOPPED: Streaming stopped.
  * @GST_STREAM_ERROR_NUM_ERRORS: the number of library error types.
  *
  * Stream errors are for anything related to the stream being processed:
@@ -182,6 +183,7 @@ typedef enum
   GST_STREAM_ERROR_DEMUX,
   GST_STREAM_ERROR_MUX,
   GST_STREAM_ERROR_FORMAT,
+  GST_STREAM_ERROR_STOPPED,
   GST_STREAM_ERROR_NUM_ERRORS
 } GstStreamError;
 
index 7dbb12c..81a35cc 100644 (file)
@@ -156,7 +156,7 @@ gst_proxy_pad_do_bufferalloc (GstPad * pad, guint64 offset, guint size,
   GstPad *target = GST_PROXY_PAD_TARGET (pad);
   GstPad *peer;
 
-  g_return_val_if_fail (target != NULL, GST_FLOW_UNEXPECTED);
+  g_return_val_if_fail (target != NULL, GST_FLOW_NOT_LINKED);
 
   peer = gst_pad_get_peer (target);
   if (peer) {
@@ -225,7 +225,7 @@ gst_proxy_pad_do_chain (GstPad * pad, GstBuffer * buffer)
 {
   GstPad *target = GST_PROXY_PAD_TARGET (pad);
 
-  g_return_val_if_fail (target != NULL, GST_FLOW_UNEXPECTED);
+  g_return_val_if_fail (target != NULL, GST_FLOW_NOT_LINKED);
 
   return gst_pad_chain (target, buffer);
 }
@@ -236,7 +236,7 @@ gst_proxy_pad_do_getrange (GstPad * pad, guint64 offset, guint size,
 {
   GstPad *target = GST_PROXY_PAD_TARGET (pad);
 
-  g_return_val_if_fail (target != NULL, GST_FLOW_UNEXPECTED);
+  g_return_val_if_fail (target != NULL, GST_FLOW_NOT_LINKED);
 
   return gst_pad_get_range (target, offset, size, buffer);
 }
index cc0a656..58523f1 100644 (file)
@@ -1600,6 +1600,9 @@ gst_pad_get_caps_unlocked (GstPad * pad)
       g_critical ("pad %s:%s returned NULL caps from getcaps function",
           GST_DEBUG_PAD_NAME (pad));
     } else {
+      GST_CAT_DEBUG (GST_CAT_CAPS,
+          "pad getcaps %s:%s returned %" GST_PTR_FORMAT,
+          GST_DEBUG_PAD_NAME (pad), result);
 #ifndef G_DISABLE_ASSERT
       /* check that the returned caps are a real subset of the template caps */
       if (GST_PAD_PAD_TEMPLATE (pad)) {
@@ -2823,15 +2826,14 @@ flushing:
         "pushing, but pad was flushing");
     GST_UNLOCK (pad);
     GST_STREAM_UNLOCK (pad);
-    return GST_FLOW_UNEXPECTED;
+    return GST_FLOW_WRONG_STATE;
   }
 dropping:
   {
     gst_buffer_unref (buffer);
     GST_DEBUG ("Dropping buffer due to FALSE probe return");
     GST_STREAM_UNLOCK (pad);
-    /* FIXME, failure? */
-    return GST_FLOW_UNEXPECTED;
+    return GST_FLOW_OK;
   }
 not_negotiated:
   {
@@ -2916,8 +2918,7 @@ dropping:
     gst_buffer_unref (buffer);
     gst_object_unref (peer);
     GST_DEBUG ("Dropping buffer due to FALSE probe return");
-    /* FIXME, failure? */
-    return GST_FLOW_UNEXPECTED;
+    return GST_FLOW_OK;
   }
 }
 
@@ -3049,7 +3050,7 @@ flushing:
         "pulling range, but pad was flushing");
     GST_UNLOCK (pad);
     GST_STREAM_UNLOCK (pad);
-    return GST_FLOW_UNEXPECTED;
+    return GST_FLOW_WRONG_STATE;
   }
 no_function:
   {
index 9e827d2..9876af9 100644 (file)
@@ -71,16 +71,20 @@ typedef enum {
 #define GST_PAD_LINK_SUCCESSFUL(ret) ((ret) >= GST_PAD_LINK_OK)
 
 typedef enum {
-  GST_FLOW_OK            =  0,         /* data passing was ok */
   GST_FLOW_RESEND        =  1,         /* resend buffer, possibly with new caps */
-  GST_FLOW_ERROR         = -1,         /* some (fatal) error occured */
-  GST_FLOW_NOT_LINKED     = -2,                /* pad is not linked */
-  GST_FLOW_NOT_NEGOTIATED = -3,                /* pad is not negotiated */
-  GST_FLOW_WRONG_STATE    = -4,                /* pad is in wrong state */
-  GST_FLOW_UNEXPECTED     = -5,                /* did not expect anything, this is not fatal */
+  GST_FLOW_OK            =  0,         /* data passing was ok */
+  /* expected failures */
+  GST_FLOW_NOT_LINKED     = -1,                /* pad is not linked */
+  GST_FLOW_WRONG_STATE    = -2,                /* pad is in wrong state */
+  /* error cases */
+  GST_FLOW_UNEXPECTED     = -3,                /* did not expect anything, like after EOS */
+  GST_FLOW_NOT_NEGOTIATED = -4,                /* pad is not negotiated */
+  GST_FLOW_ERROR         = -5,         /* some (fatal) error occured */
   GST_FLOW_NOT_SUPPORTED  = -6         /* function not supported */
 } GstFlowReturn;
 
+#define GST_FLOW_IS_FATAL(ret) ((ret) <= GST_FLOW_UNEXPECTED)
+
 typedef enum {
   GST_ACTIVATE_NONE,
   GST_ACTIVATE_PUSH,
index 17e4399..e251f2e 100644 (file)
@@ -655,20 +655,23 @@ gst_queue_chain (GstPad * pad, GstBuffer * buffer)
   return GST_FLOW_OK;
 
 out_unref:
-  GST_QUEUE_MUTEX_UNLOCK;
+  {
+    GST_QUEUE_MUTEX_UNLOCK;
 
-  gst_buffer_unref (buffer);
-
-  return GST_FLOW_OK;
+    gst_buffer_unref (buffer);
 
+    return GST_FLOW_OK;
+  }
 out_flushing:
-  GST_CAT_LOG_OBJECT (queue_dataflow, queue, "exit because of flush");
-  GST_QUEUE_MUTEX_UNLOCK;
-  gst_pad_pause_task (queue->srcpad);
+  {
+    GST_CAT_LOG_OBJECT (queue_dataflow, queue, "exit because of flush");
+    GST_QUEUE_MUTEX_UNLOCK;
+    gst_pad_pause_task (queue->srcpad);
 
-  gst_buffer_unref (buffer);
+    gst_buffer_unref (buffer);
 
-  return GST_FLOW_UNEXPECTED;
+    return GST_FLOW_WRONG_STATE;
+  }
 }
 
 static void
index 17e4399..e251f2e 100644 (file)
@@ -655,20 +655,23 @@ gst_queue_chain (GstPad * pad, GstBuffer * buffer)
   return GST_FLOW_OK;
 
 out_unref:
-  GST_QUEUE_MUTEX_UNLOCK;
+  {
+    GST_QUEUE_MUTEX_UNLOCK;
 
-  gst_buffer_unref (buffer);
-
-  return GST_FLOW_OK;
+    gst_buffer_unref (buffer);
 
+    return GST_FLOW_OK;
+  }
 out_flushing:
-  GST_CAT_LOG_OBJECT (queue_dataflow, queue, "exit because of flush");
-  GST_QUEUE_MUTEX_UNLOCK;
-  gst_pad_pause_task (queue->srcpad);
+  {
+    GST_CAT_LOG_OBJECT (queue_dataflow, queue, "exit because of flush");
+    GST_QUEUE_MUTEX_UNLOCK;
+    gst_pad_pause_task (queue->srcpad);
 
-  gst_buffer_unref (buffer);
+    gst_buffer_unref (buffer);
 
-  return GST_FLOW_UNEXPECTED;
+    return GST_FLOW_WRONG_STATE;
+  }
 }
 
 static void