gst/base/gstbasesink.c: Make sure the GstFlowReturn is returned.
authorWim Taymans <wim.taymans@gmail.com>
Tue, 22 Nov 2005 11:25:01 +0000 (11:25 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Tue, 22 Nov 2005 11:25:01 +0000 (11:25 +0000)
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_handle_object):
Make sure the GstFlowReturn is returned.

* gst/gstbus.c: (gst_bus_add_signal_watch_full),
(gst_bus_add_signal_watch):
* gst/gstbus.h:
add gst_bus_add_signal_watch_full.

* gst/gstplugin.c: (gst_plugin_load_file):
Small style cleanup.

ChangeLog
gst/base/gstbasesink.c
gst/gstbus.c
gst/gstbus.h
gst/gstplugin.c
libs/gst/base/gstbasesink.c

index f70ebcd..c9ce511 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2005-11-22  Wim Taymans  <wim@fluendo.com>
+
+       * gst/base/gstbasesink.c: (gst_base_sink_handle_object):
+       Make sure the GstFlowReturn is returned.
+
+       * gst/gstbus.c: (gst_bus_add_signal_watch_full),
+       (gst_bus_add_signal_watch):
+       * gst/gstbus.h:
+       add gst_bus_add_signal_watch_full.
+
+       * gst/gstplugin.c: (gst_plugin_load_file):
+       Small style cleanup.
+
 2005-11-22  Jan Schmidt  <thaytan@mad.scientist.com>
 
        * check/gst/gstevent.c: (test_event), (GST_START_TEST):
index 1d35d4d..646b72f 100644 (file)
@@ -558,6 +558,7 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
 {
   gint length;
   gboolean have_event;
+  GstFlowReturn ret;
 
   GST_PAD_PREROLL_LOCK (pad);
   /* push object on the queue */
@@ -658,7 +659,6 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
     /* if it's a buffer, we need to call the preroll method */
     if (GST_IS_BUFFER (obj)) {
       GstBaseSinkClass *bclass;
-      GstFlowReturn pres;
       GstBuffer *buf = GST_BUFFER (obj);
 
       GST_DEBUG_OBJECT (basesink, "preroll buffer %" GST_TIME_FORMAT,
@@ -666,7 +666,7 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
 
       bclass = GST_BASE_SINK_GET_CLASS (basesink);
       if (bclass->preroll)
-        if ((pres = bclass->preroll (basesink, buf)) != GST_FLOW_OK)
+        if ((ret = bclass->preroll (basesink, buf)) != GST_FLOW_OK)
           goto preroll_failed;
     }
   }
@@ -721,8 +721,6 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
 
 no_preroll:
   {
-    GstFlowReturn ret;
-
     GST_DEBUG_OBJECT (basesink, "no preroll needed");
     /* maybe it was another sink that blocked in preroll, need to check for
        buffers to drain */
@@ -767,7 +765,7 @@ preroll_failed:
     GST_DEBUG_OBJECT (basesink, "abort state");
     gst_element_abort_state (GST_ELEMENT (basesink));
 
-    return GST_FLOW_ERROR;
+    return ret;
   }
 }
 
index c0e4de0..e0376d0 100644 (file)
@@ -904,10 +904,11 @@ gst_bus_sync_signal_handler (GstBus * bus, GstMessage * message, gpointer data)
 }
 
 /**
- * gst_bus_add_signal_watch:
+ * gst_bus_add_signal_watch_full:
  * @bus: a #GstBus on which you want to recieve the "message" signal
+ * @priority: The priority of the watch.
  *
- * Adds a bus signal watch to the default main context with the default priority.
+ * Adds a bus signal watch to the default main context with the given priority.
  * After calling this statement, the bus will emit the message signal for each
  * message posted on the bus.
  *
@@ -918,7 +919,7 @@ gst_bus_sync_signal_handler (GstBus * bus, GstMessage * message, gpointer data)
  * MT safe.
  */
 void
-gst_bus_add_signal_watch (GstBus * bus)
+gst_bus_add_signal_watch_full (GstBus * bus, gint priority)
 {
   g_return_if_fail (GST_IS_BUS (bus));
 
@@ -931,7 +932,8 @@ gst_bus_add_signal_watch (GstBus * bus)
   g_assert (bus->signal_watch_id == 0);
 
   bus->signal_watch_id =
-      gst_bus_add_watch (bus, gst_bus_async_signal_func, NULL);
+      gst_bus_add_watch_full (bus, priority, gst_bus_async_signal_func, NULL,
+      NULL);
 
 done:
 
@@ -941,6 +943,26 @@ done:
 }
 
 /**
+ * gst_bus_add_signal_watch:
+ * @bus: a #GstBus on which you want to recieve the "message" signal
+ *
+ * Adds a bus signal watch to the default main context with the default priority.
+ * After calling this statement, the bus will emit the message signal for each
+ * message posted on the bus.
+ *
+ * This function may be called multiple times. To clean up, the caller is
+ * responsible for calling gst_bus_remove_signal_watch() as many times as this
+ * function is called.
+ *
+ * MT safe.
+ */
+void
+gst_bus_add_signal_watch (GstBus * bus)
+{
+  gst_bus_add_signal_watch_full (bus, G_PRIORITY_DEFAULT);
+}
+
+/**
  * gst_bus_remove_signal_watch:
  * @bus: a #GstBus you previously added a signal watch to
  *
index 5493013..8dcd1db 100644 (file)
@@ -168,6 +168,7 @@ GstBusSyncReply             gst_bus_sync_signal_handler     (GstBus *bus, GstMessage *message,
 
 /* convenience api to add/remove a gsource that emits the async signals */
 void                   gst_bus_add_signal_watch        (GstBus * bus);
+void                   gst_bus_add_signal_watch_full   (GstBus * bus, gint priority);
 void                   gst_bus_remove_signal_watch     (GstBus * bus);
 
 G_END_DECLS
index 7003a07..d6d90b4 100644 (file)
@@ -467,11 +467,14 @@ gst_plugin_load_file (const gchar * filename, GError ** error)
 
   g_static_mutex_unlock (&gst_plugin_loading_mutex);
   return plugin;
+
 return_error:
-  if (plugin)
-    gst_object_unref (plugin);
-  g_static_mutex_unlock (&gst_plugin_loading_mutex);
-  return NULL;
+  {
+    if (plugin)
+      gst_object_unref (plugin);
+    g_static_mutex_unlock (&gst_plugin_loading_mutex);
+    return NULL;
+  }
 }
 
 static void
index 1d35d4d..646b72f 100644 (file)
@@ -558,6 +558,7 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
 {
   gint length;
   gboolean have_event;
+  GstFlowReturn ret;
 
   GST_PAD_PREROLL_LOCK (pad);
   /* push object on the queue */
@@ -658,7 +659,6 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
     /* if it's a buffer, we need to call the preroll method */
     if (GST_IS_BUFFER (obj)) {
       GstBaseSinkClass *bclass;
-      GstFlowReturn pres;
       GstBuffer *buf = GST_BUFFER (obj);
 
       GST_DEBUG_OBJECT (basesink, "preroll buffer %" GST_TIME_FORMAT,
@@ -666,7 +666,7 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
 
       bclass = GST_BASE_SINK_GET_CLASS (basesink);
       if (bclass->preroll)
-        if ((pres = bclass->preroll (basesink, buf)) != GST_FLOW_OK)
+        if ((ret = bclass->preroll (basesink, buf)) != GST_FLOW_OK)
           goto preroll_failed;
     }
   }
@@ -721,8 +721,6 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
 
 no_preroll:
   {
-    GstFlowReturn ret;
-
     GST_DEBUG_OBJECT (basesink, "no preroll needed");
     /* maybe it was another sink that blocked in preroll, need to check for
        buffers to drain */
@@ -767,7 +765,7 @@ preroll_failed:
     GST_DEBUG_OBJECT (basesink, "abort state");
     gst_element_abort_state (GST_ELEMENT (basesink));
 
-    return GST_FLOW_ERROR;
+    return ret;
   }
 }