mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-07-02 04:35:55 +00:00
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:
parent
819307ab28
commit
e9606ada93
13
ChangeLog
13
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>
|
2005-11-22 Jan Schmidt <thaytan@mad.scientist.com>
|
||||||
|
|
||||||
* check/gst/gstevent.c: (test_event), (GST_START_TEST):
|
* check/gst/gstevent.c: (test_event), (GST_START_TEST):
|
||||||
|
|
|
@ -558,6 +558,7 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
|
||||||
{
|
{
|
||||||
gint length;
|
gint length;
|
||||||
gboolean have_event;
|
gboolean have_event;
|
||||||
|
GstFlowReturn ret;
|
||||||
|
|
||||||
GST_PAD_PREROLL_LOCK (pad);
|
GST_PAD_PREROLL_LOCK (pad);
|
||||||
/* push object on the queue */
|
/* 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 it's a buffer, we need to call the preroll method */
|
||||||
if (GST_IS_BUFFER (obj)) {
|
if (GST_IS_BUFFER (obj)) {
|
||||||
GstBaseSinkClass *bclass;
|
GstBaseSinkClass *bclass;
|
||||||
GstFlowReturn pres;
|
|
||||||
GstBuffer *buf = GST_BUFFER (obj);
|
GstBuffer *buf = GST_BUFFER (obj);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (basesink, "preroll buffer %" GST_TIME_FORMAT,
|
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);
|
bclass = GST_BASE_SINK_GET_CLASS (basesink);
|
||||||
if (bclass->preroll)
|
if (bclass->preroll)
|
||||||
if ((pres = bclass->preroll (basesink, buf)) != GST_FLOW_OK)
|
if ((ret = bclass->preroll (basesink, buf)) != GST_FLOW_OK)
|
||||||
goto preroll_failed;
|
goto preroll_failed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -721,8 +721,6 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
|
||||||
|
|
||||||
no_preroll:
|
no_preroll:
|
||||||
{
|
{
|
||||||
GstFlowReturn ret;
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (basesink, "no preroll needed");
|
GST_DEBUG_OBJECT (basesink, "no preroll needed");
|
||||||
/* maybe it was another sink that blocked in preroll, need to check for
|
/* maybe it was another sink that blocked in preroll, need to check for
|
||||||
buffers to drain */
|
buffers to drain */
|
||||||
|
@ -767,7 +765,7 @@ preroll_failed:
|
||||||
GST_DEBUG_OBJECT (basesink, "abort state");
|
GST_DEBUG_OBJECT (basesink, "abort state");
|
||||||
gst_element_abort_state (GST_ELEMENT (basesink));
|
gst_element_abort_state (GST_ELEMENT (basesink));
|
||||||
|
|
||||||
return GST_FLOW_ERROR;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
58
gst/gstbus.c
58
gst/gstbus.c
|
@ -903,6 +903,45 @@ gst_bus_sync_signal_handler (GstBus * bus, GstMessage * message, gpointer data)
|
||||||
return GST_BUS_PASS;
|
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:
|
* gst_bus_add_signal_watch:
|
||||||
* @bus: a #GstBus on which you want to recieve the "message" signal
|
* @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
|
void
|
||||||
gst_bus_add_signal_watch (GstBus * bus)
|
gst_bus_add_signal_watch (GstBus * bus)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GST_IS_BUS (bus));
|
gst_bus_add_signal_watch_full (bus, G_PRIORITY_DEFAULT);
|
||||||
|
|
||||||
/* 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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 */
|
/* 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 (GstBus * bus);
|
||||||
|
void gst_bus_add_signal_watch_full (GstBus * bus, gint priority);
|
||||||
void gst_bus_remove_signal_watch (GstBus * bus);
|
void gst_bus_remove_signal_watch (GstBus * bus);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
|
@ -467,11 +467,14 @@ gst_plugin_load_file (const gchar * filename, GError ** error)
|
||||||
|
|
||||||
g_static_mutex_unlock (&gst_plugin_loading_mutex);
|
g_static_mutex_unlock (&gst_plugin_loading_mutex);
|
||||||
return plugin;
|
return plugin;
|
||||||
|
|
||||||
return_error:
|
return_error:
|
||||||
if (plugin)
|
{
|
||||||
gst_object_unref (plugin);
|
if (plugin)
|
||||||
g_static_mutex_unlock (&gst_plugin_loading_mutex);
|
gst_object_unref (plugin);
|
||||||
return NULL;
|
g_static_mutex_unlock (&gst_plugin_loading_mutex);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -558,6 +558,7 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
|
||||||
{
|
{
|
||||||
gint length;
|
gint length;
|
||||||
gboolean have_event;
|
gboolean have_event;
|
||||||
|
GstFlowReturn ret;
|
||||||
|
|
||||||
GST_PAD_PREROLL_LOCK (pad);
|
GST_PAD_PREROLL_LOCK (pad);
|
||||||
/* push object on the queue */
|
/* 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 it's a buffer, we need to call the preroll method */
|
||||||
if (GST_IS_BUFFER (obj)) {
|
if (GST_IS_BUFFER (obj)) {
|
||||||
GstBaseSinkClass *bclass;
|
GstBaseSinkClass *bclass;
|
||||||
GstFlowReturn pres;
|
|
||||||
GstBuffer *buf = GST_BUFFER (obj);
|
GstBuffer *buf = GST_BUFFER (obj);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (basesink, "preroll buffer %" GST_TIME_FORMAT,
|
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);
|
bclass = GST_BASE_SINK_GET_CLASS (basesink);
|
||||||
if (bclass->preroll)
|
if (bclass->preroll)
|
||||||
if ((pres = bclass->preroll (basesink, buf)) != GST_FLOW_OK)
|
if ((ret = bclass->preroll (basesink, buf)) != GST_FLOW_OK)
|
||||||
goto preroll_failed;
|
goto preroll_failed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -721,8 +721,6 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
|
||||||
|
|
||||||
no_preroll:
|
no_preroll:
|
||||||
{
|
{
|
||||||
GstFlowReturn ret;
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (basesink, "no preroll needed");
|
GST_DEBUG_OBJECT (basesink, "no preroll needed");
|
||||||
/* maybe it was another sink that blocked in preroll, need to check for
|
/* maybe it was another sink that blocked in preroll, need to check for
|
||||||
buffers to drain */
|
buffers to drain */
|
||||||
|
@ -767,7 +765,7 @@ preroll_failed:
|
||||||
GST_DEBUG_OBJECT (basesink, "abort state");
|
GST_DEBUG_OBJECT (basesink, "abort state");
|
||||||
gst_element_abort_state (GST_ELEMENT (basesink));
|
gst_element_abort_state (GST_ELEMENT (basesink));
|
||||||
|
|
||||||
return GST_FLOW_ERROR;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue