mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
fakevideosink,fakeaudiosink: Proxy handoff and preroll-handoff signals
Proxy signals for application to be able to consume them Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1585>
This commit is contained in:
parent
454e8f58a8
commit
1bd5b7356d
5 changed files with 198 additions and 4 deletions
|
@ -9794,7 +9794,37 @@
|
|||
"writable": true
|
||||
}
|
||||
},
|
||||
"rank": "none"
|
||||
"rank": "none",
|
||||
"signals": {
|
||||
"handoff": {
|
||||
"args": [
|
||||
{
|
||||
"name": "arg0",
|
||||
"type": "GstBuffer"
|
||||
},
|
||||
{
|
||||
"name": "arg1",
|
||||
"type": "GstPad"
|
||||
}
|
||||
],
|
||||
"return-type": "void",
|
||||
"when": "last"
|
||||
},
|
||||
"preroll-handoff": {
|
||||
"args": [
|
||||
{
|
||||
"name": "arg0",
|
||||
"type": "GstBuffer"
|
||||
},
|
||||
{
|
||||
"name": "arg1",
|
||||
"type": "GstPad"
|
||||
}
|
||||
],
|
||||
"return-type": "void",
|
||||
"when": "last"
|
||||
}
|
||||
}
|
||||
},
|
||||
"fakevideosink": {
|
||||
"author": "Nicolas Dufresne <nicolas.dufresne@collabora.com>",
|
||||
|
@ -10112,7 +10142,37 @@
|
|||
"writable": true
|
||||
}
|
||||
},
|
||||
"rank": "none"
|
||||
"rank": "none",
|
||||
"signals": {
|
||||
"handoff": {
|
||||
"args": [
|
||||
{
|
||||
"name": "arg0",
|
||||
"type": "GstBuffer"
|
||||
},
|
||||
{
|
||||
"name": "arg1",
|
||||
"type": "GstPad"
|
||||
}
|
||||
],
|
||||
"return-type": "void",
|
||||
"when": "last"
|
||||
},
|
||||
"preroll-handoff": {
|
||||
"args": [
|
||||
{
|
||||
"name": "arg0",
|
||||
"type": "GstBuffer"
|
||||
},
|
||||
{
|
||||
"name": "arg1",
|
||||
"type": "GstPad"
|
||||
}
|
||||
],
|
||||
"return-type": "void",
|
||||
"when": "last"
|
||||
}
|
||||
}
|
||||
},
|
||||
"fpsdisplaysink": {
|
||||
"author": "Zeeshan Ali <zeeshan.ali@nokia.com>, Stefan Kost <stefan.kost@nokia.com>",
|
||||
|
|
|
@ -51,6 +51,14 @@ enum
|
|||
PROP_LAST
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
SIGNAL_HANDOFF,
|
||||
SIGNAL_PREROLL_HANDOFF,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint gst_fake_audio_sink_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
|
@ -74,6 +82,22 @@ gst_fake_audio_sink_proxy_properties (GstFakeAudioSink * self,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_fake_audio_sink_proxy_handoff (GstElement * element, GstBuffer * buffer,
|
||||
GstPad * pad, GstFakeAudioSink * self)
|
||||
{
|
||||
g_signal_emit (self, gst_fake_audio_sink_signals[SIGNAL_HANDOFF], 0,
|
||||
buffer, self->sinkpad);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_fake_audio_sink_proxy_preroll_handoff (GstElement * element,
|
||||
GstBuffer * buffer, GstPad * pad, GstFakeAudioSink * self)
|
||||
{
|
||||
g_signal_emit (self, gst_fake_audio_sink_signals[SIGNAL_PREROLL_HANDOFF], 0,
|
||||
buffer, self->sinkpad);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_fake_audio_sink_init (GstFakeAudioSink * self)
|
||||
{
|
||||
|
@ -94,7 +118,8 @@ gst_fake_audio_sink_init (GstFakeAudioSink * self)
|
|||
|
||||
gst_bin_add (GST_BIN_CAST (self), child);
|
||||
|
||||
ghost_pad = gst_ghost_pad_new_from_template ("sink", sink_pad, template);
|
||||
self->sinkpad = ghost_pad =
|
||||
gst_ghost_pad_new_from_template ("sink", sink_pad, template);
|
||||
gst_object_unref (template);
|
||||
gst_element_add_pad (GST_ELEMENT_CAST (self), ghost_pad);
|
||||
gst_object_unref (sink_pad);
|
||||
|
@ -102,6 +127,10 @@ gst_fake_audio_sink_init (GstFakeAudioSink * self)
|
|||
self->child = child;
|
||||
|
||||
gst_fake_audio_sink_proxy_properties (self, child);
|
||||
g_signal_connect (child, "handoff",
|
||||
G_CALLBACK (gst_fake_audio_sink_proxy_handoff), self);
|
||||
g_signal_connect (child, "preroll-handoff",
|
||||
G_CALLBACK (gst_fake_audio_sink_proxy_preroll_handoff), self);
|
||||
} else {
|
||||
g_warning ("Check your GStreamer installation, "
|
||||
"core element 'fakesink' is missing.");
|
||||
|
@ -180,6 +209,38 @@ gst_fake_audio_sink_class_init (GstFakeAudioSinkClass * klass)
|
|||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
|
||||
/**
|
||||
* GstFakeAudioSink::handoff:
|
||||
* @fakeaudiosink: the fakeaudiosink instance
|
||||
* @buffer: the buffer that just has been received
|
||||
* @pad: the pad that received it
|
||||
*
|
||||
* This signal gets emitted before unreffing the buffer.
|
||||
*
|
||||
* Since: 1.22
|
||||
*/
|
||||
gst_fake_audio_sink_signals[SIGNAL_HANDOFF] =
|
||||
g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GstFakeAudioSinkClass, handoff), NULL, NULL,
|
||||
NULL, G_TYPE_NONE, 2, GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE,
|
||||
GST_TYPE_PAD);
|
||||
|
||||
/**
|
||||
* GstFakeAudioSink::preroll-handoff:
|
||||
* @fakeaudiosink: the fakeaudiosink instance
|
||||
* @buffer: the buffer that just has been received
|
||||
* @pad: the pad that received it
|
||||
*
|
||||
* This signal gets emitted before unreffing the buffer.
|
||||
*
|
||||
* Since: 1.22
|
||||
*/
|
||||
gst_fake_audio_sink_signals[SIGNAL_PREROLL_HANDOFF] =
|
||||
g_signal_new ("preroll-handoff", G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstFakeAudioSinkClass,
|
||||
preroll_handoff), NULL, NULL, NULL, G_TYPE_NONE, 2,
|
||||
GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE, GST_TYPE_PAD);
|
||||
|
||||
gst_element_class_add_static_pad_template (element_class, &sink_factory);
|
||||
gst_element_class_set_static_metadata (element_class, "Fake Audio Sink",
|
||||
"Audio/Sink", "Fake audio renderer",
|
||||
|
|
|
@ -47,6 +47,7 @@ struct _GstFakeAudioSink
|
|||
{
|
||||
GstBin parent;
|
||||
GstElement *child;
|
||||
GstPad *sinkpad;
|
||||
gdouble volume;
|
||||
gboolean mute;
|
||||
};
|
||||
|
@ -54,6 +55,10 @@ struct _GstFakeAudioSink
|
|||
struct _GstFakeAudioSinkClass
|
||||
{
|
||||
GstBinClass parent;
|
||||
|
||||
/* signals */
|
||||
void (*handoff) (GstElement *element, GstBuffer *buf, GstPad *pad);
|
||||
void (*preroll_handoff) (GstElement *element, GstBuffer *buf, GstPad *pad);
|
||||
};
|
||||
|
||||
GType gst_fake_audio_sink_get_type (void);
|
||||
|
|
|
@ -77,6 +77,15 @@ enum
|
|||
PROP_LAST
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
SIGNAL_HANDOFF,
|
||||
SIGNAL_PREROLL_HANDOFF,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint gst_fake_video_sink_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
#define ALLOCATION_META_DEFAULT_FLAGS GST_ALLOCATION_FLAG_CROP_META | GST_ALLOCATION_FLAG_OVERLAY_COMPOSITION_META
|
||||
|
||||
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
|
@ -139,6 +148,22 @@ gst_fake_video_sink_proxy_properties (GstFakeVideoSink * self,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_fake_video_sink_proxy_handoff (GstElement * element, GstBuffer * buffer,
|
||||
GstPad * pad, GstFakeVideoSink * self)
|
||||
{
|
||||
g_signal_emit (self, gst_fake_video_sink_signals[SIGNAL_HANDOFF], 0,
|
||||
buffer, self->sinkpad);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_fake_video_sink_proxy_preroll_handoff (GstElement * element,
|
||||
GstBuffer * buffer, GstPad * pad, GstFakeVideoSink * self)
|
||||
{
|
||||
g_signal_emit (self, gst_fake_video_sink_signals[SIGNAL_PREROLL_HANDOFF], 0,
|
||||
buffer, self->sinkpad);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_fake_video_sink_init (GstFakeVideoSink * self)
|
||||
{
|
||||
|
@ -160,7 +185,8 @@ gst_fake_video_sink_init (GstFakeVideoSink * self)
|
|||
|
||||
gst_bin_add (GST_BIN (self), child);
|
||||
|
||||
ghost_pad = gst_ghost_pad_new_from_template ("sink", sink_pad, template);
|
||||
self->sinkpad = ghost_pad =
|
||||
gst_ghost_pad_new_from_template ("sink", sink_pad, template);
|
||||
gst_object_unref (template);
|
||||
gst_element_add_pad (GST_ELEMENT (self), ghost_pad);
|
||||
gst_object_unref (sink_pad);
|
||||
|
@ -170,6 +196,10 @@ gst_fake_video_sink_init (GstFakeVideoSink * self)
|
|||
self->child = child;
|
||||
|
||||
gst_fake_video_sink_proxy_properties (self, child);
|
||||
g_signal_connect (child, "handoff",
|
||||
G_CALLBACK (gst_fake_video_sink_proxy_handoff), self);
|
||||
g_signal_connect (child, "preroll-handoff",
|
||||
G_CALLBACK (gst_fake_video_sink_proxy_preroll_handoff), self);
|
||||
} else {
|
||||
g_warning ("Check your GStreamer installation, "
|
||||
"core element 'fakesink' is missing.");
|
||||
|
@ -240,6 +270,39 @@ gst_fake_video_sink_class_init (GstFakeVideoSinkClass * klass)
|
|||
ALLOCATION_META_DEFAULT_FLAGS,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
|
||||
/**
|
||||
* GstFakeVideoSink::handoff:
|
||||
* @fakevideosink: the fakevideosink instance
|
||||
* @buffer: the buffer that just has been received
|
||||
* @pad: the pad that received it
|
||||
*
|
||||
* This signal gets emitted before unreffing the buffer.
|
||||
*
|
||||
* Since: 1.22
|
||||
*/
|
||||
gst_fake_video_sink_signals[SIGNAL_HANDOFF] =
|
||||
g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GstFakeVideoSinkClass, handoff), NULL, NULL,
|
||||
NULL, G_TYPE_NONE, 2, GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE,
|
||||
GST_TYPE_PAD);
|
||||
|
||||
/**
|
||||
* GstFakeVideoSink::preroll-handoff:
|
||||
* @fakevideosink: the fakevideosink instance
|
||||
* @buffer: the buffer that just has been received
|
||||
* @pad: the pad that received it
|
||||
*
|
||||
* This signal gets emitted before unreffing the buffer.
|
||||
*
|
||||
* Since: 1.22
|
||||
*/
|
||||
gst_fake_video_sink_signals[SIGNAL_PREROLL_HANDOFF] =
|
||||
g_signal_new ("preroll-handoff", G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstFakeVideoSinkClass,
|
||||
preroll_handoff), NULL, NULL, NULL, G_TYPE_NONE, 2,
|
||||
GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE, GST_TYPE_PAD);
|
||||
|
||||
gst_type_mark_as_plugin_api (GST_TYPE_FAKE_VIDEO_SINK_ALLOCATION_META_FLAGS,
|
||||
0);
|
||||
}
|
||||
|
|
|
@ -65,11 +65,16 @@ struct _GstFakeVideoSink
|
|||
GstBin parent;
|
||||
GstElement *child;
|
||||
GstFakeVideoSinkAllocationMetaFlags allocation_meta_flags;
|
||||
GstPad *sinkpad;
|
||||
};
|
||||
|
||||
struct _GstFakeVideoSinkClass
|
||||
{
|
||||
GstBinClass parent;
|
||||
|
||||
/* signals */
|
||||
void (*handoff) (GstElement *element, GstBuffer *buf, GstPad *pad);
|
||||
void (*preroll_handoff) (GstElement *element, GstBuffer *buf, GstPad *pad);
|
||||
};
|
||||
|
||||
GType gst_fake_video_sink_get_type (void);
|
||||
|
|
Loading…
Reference in a new issue