mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 16:08:51 +00:00
appsink: add GstFlowReturn from signal handler
Expect a GstFlowReturn from the signal handler, just like from the callback. Also use the return value.
This commit is contained in:
parent
acb3aeebd4
commit
e46b45b0b8
2 changed files with 25 additions and 17 deletions
|
@ -241,7 +241,8 @@ gst_app_sink_class_init (GstAppSinkClass * klass)
|
||||||
gst_app_sink_signals[SIGNAL_NEW_PREROLL] =
|
gst_app_sink_signals[SIGNAL_NEW_PREROLL] =
|
||||||
g_signal_new ("new-preroll", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
g_signal_new ("new-preroll", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GstAppSinkClass, new_preroll),
|
G_STRUCT_OFFSET (GstAppSinkClass, new_preroll),
|
||||||
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
|
NULL, NULL, __gst_app_marshal_ENUM__VOID, GST_TYPE_FLOW_RETURN, 0,
|
||||||
|
G_TYPE_NONE);
|
||||||
/**
|
/**
|
||||||
* GstAppSink::new-sample:
|
* GstAppSink::new-sample:
|
||||||
* @appsink: the appsink element that emited the signal
|
* @appsink: the appsink element that emited the signal
|
||||||
|
@ -261,7 +262,8 @@ gst_app_sink_class_init (GstAppSinkClass * klass)
|
||||||
gst_app_sink_signals[SIGNAL_NEW_SAMPLE] =
|
gst_app_sink_signals[SIGNAL_NEW_SAMPLE] =
|
||||||
g_signal_new ("new-sample", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
g_signal_new ("new-sample", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GstAppSinkClass, new_sample),
|
G_STRUCT_OFFSET (GstAppSinkClass, new_sample),
|
||||||
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
|
NULL, NULL, __gst_app_marshal_ENUM__VOID, GST_TYPE_FLOW_RETURN, 0,
|
||||||
|
G_TYPE_NONE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstAppSink::pull-preroll:
|
* GstAppSink::pull-preroll:
|
||||||
|
@ -605,7 +607,7 @@ gst_app_sink_event (GstBaseSink * sink, GstEvent * event)
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_app_sink_preroll (GstBaseSink * psink, GstBuffer * buffer)
|
gst_app_sink_preroll (GstBaseSink * psink, GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
GstFlowReturn res = GST_FLOW_OK;
|
GstFlowReturn res;
|
||||||
GstAppSink *appsink = GST_APP_SINK_CAST (psink);
|
GstAppSink *appsink = GST_APP_SINK_CAST (psink);
|
||||||
GstAppSinkPrivate *priv = appsink->priv;
|
GstAppSinkPrivate *priv = appsink->priv;
|
||||||
gboolean emit;
|
gboolean emit;
|
||||||
|
@ -621,10 +623,14 @@ gst_app_sink_preroll (GstBaseSink * psink, GstBuffer * buffer)
|
||||||
emit = priv->emit_signals;
|
emit = priv->emit_signals;
|
||||||
g_mutex_unlock (&priv->mutex);
|
g_mutex_unlock (&priv->mutex);
|
||||||
|
|
||||||
if (priv->callbacks.new_preroll)
|
if (priv->callbacks.new_preroll) {
|
||||||
res = priv->callbacks.new_preroll (appsink, priv->user_data);
|
res = priv->callbacks.new_preroll (appsink, priv->user_data);
|
||||||
else if (emit)
|
} else {
|
||||||
g_signal_emit (appsink, gst_app_sink_signals[SIGNAL_NEW_PREROLL], 0);
|
res = GST_FLOW_OK;
|
||||||
|
if (emit)
|
||||||
|
g_signal_emit (appsink, gst_app_sink_signals[SIGNAL_NEW_PREROLL], 0,
|
||||||
|
&res);
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
@ -741,12 +747,14 @@ restart:
|
||||||
emit = priv->emit_signals;
|
emit = priv->emit_signals;
|
||||||
g_mutex_unlock (&priv->mutex);
|
g_mutex_unlock (&priv->mutex);
|
||||||
|
|
||||||
if (priv->callbacks.new_sample)
|
if (priv->callbacks.new_sample) {
|
||||||
priv->callbacks.new_sample (appsink, priv->user_data);
|
ret = priv->callbacks.new_sample (appsink, priv->user_data);
|
||||||
else if (emit)
|
} else {
|
||||||
g_signal_emit (appsink, gst_app_sink_signals[SIGNAL_NEW_SAMPLE], 0);
|
ret = GST_FLOW_OK;
|
||||||
|
if (emit)
|
||||||
return GST_FLOW_OK;
|
g_signal_emit (appsink, gst_app_sink_signals[SIGNAL_NEW_SAMPLE], 0, &ret);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
|
||||||
flushing:
|
flushing:
|
||||||
{
|
{
|
||||||
|
|
|
@ -85,13 +85,13 @@ struct _GstAppSinkClass
|
||||||
GstBaseSinkClass basesink_class;
|
GstBaseSinkClass basesink_class;
|
||||||
|
|
||||||
/* signals */
|
/* signals */
|
||||||
void (*eos) (GstAppSink *appsink);
|
void (*eos) (GstAppSink *appsink);
|
||||||
void (*new_preroll) (GstAppSink *appsink);
|
GstFlowReturn (*new_preroll) (GstAppSink *appsink);
|
||||||
void (*new_sample) (GstAppSink *appsink);
|
GstFlowReturn (*new_sample) (GstAppSink *appsink);
|
||||||
|
|
||||||
/* actions */
|
/* actions */
|
||||||
GstSample * (*pull_preroll) (GstAppSink *appsink);
|
GstSample * (*pull_preroll) (GstAppSink *appsink);
|
||||||
GstSample * (*pull_sample) (GstAppSink *appsink);
|
GstSample * (*pull_sample) (GstAppSink *appsink);
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
gpointer _gst_reserved[GST_PADDING];
|
gpointer _gst_reserved[GST_PADDING];
|
||||||
|
|
Loading…
Reference in a new issue