gst/base/gstbasesink.c: Make sure the GstFlowReturn is returned.

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.
This commit is contained in:
Wim Taymans 2005-11-22 11:25:01 +00:00
parent 819307ab28
commit e9606ada93
6 changed files with 67 additions and 32 deletions

View file

@ -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):

View 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;
}
}

View file

@ -903,6 +903,45 @@ gst_bus_sync_signal_handler (GstBus * bus, GstMessage * message, gpointer data)
return GST_BUS_PASS;
}
/**
* 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 given 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_full (GstBus * bus, gint priority)
{
g_return_if_fail (GST_IS_BUS (bus));
/* I know the callees don't take this lock, so go ahead and abuse it */
GST_OBJECT_LOCK (bus);
if (bus->num_signal_watchers > 0)
goto done;
g_assert (bus->signal_watch_id == 0);
bus->signal_watch_id =
gst_bus_add_watch_full (bus, priority, gst_bus_async_signal_func, NULL,
NULL);
done:
bus->num_signal_watchers++;
GST_OBJECT_UNLOCK (bus);
}
/**
* gst_bus_add_signal_watch:
* @bus: a #GstBus on which you want to recieve the "message" signal
@ -920,24 +959,7 @@ gst_bus_sync_signal_handler (GstBus * bus, GstMessage * message, gpointer data)
void
gst_bus_add_signal_watch (GstBus * bus)
{
g_return_if_fail (GST_IS_BUS (bus));
/* I know the callees don't take this lock, so go ahead and abuse it */
GST_OBJECT_LOCK (bus);
if (bus->num_signal_watchers > 0)
goto done;
g_assert (bus->signal_watch_id == 0);
bus->signal_watch_id =
gst_bus_add_watch (bus, gst_bus_async_signal_func, NULL);
done:
bus->num_signal_watchers++;
GST_OBJECT_UNLOCK (bus);
gst_bus_add_signal_watch_full (bus, G_PRIORITY_DEFAULT);
}
/**

View 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

View 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

View 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;
}
}