From: Martin Samuelsson Date: Thu, 9 Apr 2009 21:46:17 +0000 (+0200) Subject: appsink: make callbacks return GstFlowReturn X-Git-Tag: 1.19.3~511^2~9778 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ee03bf5379d88dd33a7de0d68ea1cbe47011e312;p=platform%2Fupstream%2Fgstreamer.git appsink: make callbacks return GstFlowReturn Make the new_buffer and new_preroll callbacks return a GstFlowReturn so that errors can be reported properly. Fixes #577827. --- diff --git a/gst-libs/gst/app/gstappsink.c b/gst-libs/gst/app/gstappsink.c index 96cd0d8..07b2082 100644 --- a/gst-libs/gst/app/gstappsink.c +++ b/gst-libs/gst/app/gstappsink.c @@ -624,6 +624,7 @@ gst_app_sink_event (GstBaseSink * sink, GstEvent * event) static GstFlowReturn gst_app_sink_preroll (GstBaseSink * psink, GstBuffer * buffer) { + GstFlowReturn res = GST_FLOW_OK; GstAppSink *appsink = GST_APP_SINK (psink); gboolean emit; @@ -633,16 +634,19 @@ gst_app_sink_preroll (GstBaseSink * psink, GstBuffer * buffer) GST_DEBUG_OBJECT (appsink, "setting preroll buffer %p", buffer); gst_buffer_replace (&appsink->priv->preroll, buffer); + g_cond_signal (appsink->priv->cond); emit = appsink->priv->emit_signals; g_mutex_unlock (appsink->priv->mutex); if (appsink->priv->callbacks.new_preroll) - appsink->priv->callbacks.new_preroll (appsink, appsink->priv->user_data); + res = + appsink->priv->callbacks.new_preroll (appsink, + appsink->priv->user_data); else if (emit) g_signal_emit (appsink, gst_app_sink_signals[SIGNAL_NEW_PREROLL], 0); - return GST_FLOW_OK; + return res; flushing: { @@ -655,6 +659,7 @@ flushing: static GstFlowReturn gst_app_sink_render (GstBaseSink * psink, GstBuffer * buffer) { + GstFlowReturn res = GST_FLOW_OK; GstAppSink *appsink = GST_APP_SINK (psink); gboolean emit; @@ -685,16 +690,18 @@ gst_app_sink_render (GstBaseSink * psink, GstBuffer * buffer) } /* we need to ref the buffer when pushing it in the queue */ g_queue_push_tail (appsink->priv->queue, gst_buffer_ref (buffer)); + g_cond_signal (appsink->priv->cond); emit = appsink->priv->emit_signals; g_mutex_unlock (appsink->priv->mutex); if (appsink->priv->callbacks.new_buffer) - appsink->priv->callbacks.new_buffer (appsink, appsink->priv->user_data); + res = + appsink->priv->callbacks.new_buffer (appsink, appsink->priv->user_data); else if (emit) g_signal_emit (appsink, gst_app_sink_signals[SIGNAL_NEW_BUFFER], 0); - return GST_FLOW_OK; + return res; flushing: { diff --git a/gst-libs/gst/app/gstappsink.h b/gst-libs/gst/app/gstappsink.h index e35edcd..a2395ac 100644 --- a/gst-libs/gst/app/gstappsink.h +++ b/gst-libs/gst/app/gstappsink.h @@ -42,15 +42,15 @@ typedef struct _GstAppSinkPrivate GstAppSinkPrivate; /** * GstAppSinkCallbacks: - * @eos: Signal that the end-of-stream has been reached. This signal is - * emited from the steaming thread. - * @new_preroll: Signal that a new preroll buffer is available. - * This signal is emited from the steaming thread. + * @eos: Called when the end-of-stream has been reached. This callback + * is called from the steaming thread. + * @new_preroll: Called when a new preroll buffer is available. + * This callback is called from the steaming thread. * The new preroll buffer can be retrieved with * gst_app_sink_pull_preroll() either from this callback * or from any other thread. - * @new_buffer: Signal that a new buffer is available. - * This signal is emited from the steaming thread. + * @new_buffer: Called when a new buffer is available. + * This callback is called from the steaming thread. * The new buffer can be retrieved with * gst_app_sink_pull_buffer() either from this callback * or from any other thread. @@ -61,9 +61,9 @@ typedef struct _GstAppSinkPrivate GstAppSinkPrivate; * Since: 0.10.23 */ typedef struct { - void (*eos) (GstAppSink *sink, gpointer user_data); - void (*new_preroll) (GstAppSink *sink, gpointer user_data); - void (*new_buffer) (GstAppSink *sink, gpointer user_data); + void (*eos) (GstAppSink *sink, gpointer user_data); + GstFlowReturn (*new_preroll) (GstAppSink *sink, gpointer user_data); + GstFlowReturn (*new_buffer) (GstAppSink *sink, gpointer user_data); /*< private >*/ gpointer _gst_reserved[GST_PADDING];