mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
uvcsink: remove separate function for buffer probe installation
The probe that installs the buffer probe is already on the correct pad. There is no need for a separate function to install the probe. While at it, change the signature of the probe functions to GstPadProbeCallback to avoid the cast when installing the probes. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
This commit is contained in:
parent
eac9f60608
commit
a9eef25717
1 changed files with 12 additions and 19 deletions
|
@ -221,8 +221,6 @@ gst_uvc_sink_get_configured_caps (GstUvcSink * self)
|
||||||
return gst_caps_new_full (s, NULL);
|
return gst_caps_new_full (s, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gst_uvc_sink_create_buffer_peer_probe (GstUvcSink * self);
|
|
||||||
|
|
||||||
static gboolean gst_uvc_sink_to_fakesink (GstUvcSink * self);
|
static gboolean gst_uvc_sink_to_fakesink (GstUvcSink * self);
|
||||||
static gboolean gst_uvc_sink_to_v4l2sink (GstUvcSink * self);
|
static gboolean gst_uvc_sink_to_v4l2sink (GstUvcSink * self);
|
||||||
|
|
||||||
|
@ -393,8 +391,10 @@ gst_uvc_sink_sinkpad_event_peer_probe (GstPad * pad,
|
||||||
|
|
||||||
static GstPadProbeReturn
|
static GstPadProbeReturn
|
||||||
gst_uvc_sink_sinkpad_buffer_peer_probe (GstPad * pad,
|
gst_uvc_sink_sinkpad_buffer_peer_probe (GstPad * pad,
|
||||||
GstPadProbeInfo * info, GstUvcSink * self)
|
GstPadProbeInfo * info, gpointer user_data)
|
||||||
{
|
{
|
||||||
|
GstUvcSink *self = user_data;
|
||||||
|
|
||||||
if (self->streamon || self->streamoff)
|
if (self->streamon || self->streamoff)
|
||||||
return GST_PAD_PROBE_DROP;
|
return GST_PAD_PROBE_DROP;
|
||||||
|
|
||||||
|
@ -405,10 +405,16 @@ gst_uvc_sink_sinkpad_buffer_peer_probe (GstPad * pad,
|
||||||
|
|
||||||
static GstPadProbeReturn
|
static GstPadProbeReturn
|
||||||
gst_uvc_sink_sinkpad_idle_probe (GstPad * pad,
|
gst_uvc_sink_sinkpad_idle_probe (GstPad * pad,
|
||||||
GstPadProbeInfo * info, GstUvcSink * self)
|
GstPadProbeInfo * info, gpointer user_data)
|
||||||
{
|
{
|
||||||
|
GstUvcSink *self = user_data;
|
||||||
|
|
||||||
if (self->streamon || self->streamoff) {
|
if (self->streamon || self->streamoff) {
|
||||||
gst_uvc_sink_create_buffer_peer_probe (self);
|
/* Drop all incoming buffers until the streamoff or streamon is done. */
|
||||||
|
self->buffer_peer_probe_id =
|
||||||
|
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_BUFFER,
|
||||||
|
gst_uvc_sink_sinkpad_buffer_peer_probe, self, NULL);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (self, "Send reconfigure");
|
GST_DEBUG_OBJECT (self, "Send reconfigure");
|
||||||
gst_pad_push_event (self->sinkpad, gst_event_new_reconfigure ());
|
gst_pad_push_event (self->sinkpad, gst_event_new_reconfigure ());
|
||||||
}
|
}
|
||||||
|
@ -419,19 +425,6 @@ gst_uvc_sink_sinkpad_idle_probe (GstPad * pad,
|
||||||
return GST_PAD_PROBE_PASS;
|
return GST_PAD_PROBE_PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gst_uvc_sink_create_buffer_peer_probe (GstUvcSink * self)
|
|
||||||
{
|
|
||||||
GstPad *peerpad = gst_pad_get_peer (self->sinkpad);
|
|
||||||
if (peerpad) {
|
|
||||||
self->buffer_peer_probe_id =
|
|
||||||
gst_pad_add_probe (peerpad, GST_PAD_PROBE_TYPE_BUFFER,
|
|
||||||
(GstPadProbeCallback) gst_uvc_sink_sinkpad_buffer_peer_probe, self,
|
|
||||||
NULL);
|
|
||||||
gst_object_unref (peerpad);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_uvc_sink_remove_buffer_peer_probe (GstUvcSink * self)
|
gst_uvc_sink_remove_buffer_peer_probe (GstUvcSink * self)
|
||||||
{
|
{
|
||||||
|
@ -450,7 +443,7 @@ gst_uvc_sink_create_idle_probe (GstUvcSink * self)
|
||||||
if (peerpad) {
|
if (peerpad) {
|
||||||
self->idle_probe_id =
|
self->idle_probe_id =
|
||||||
gst_pad_add_probe (peerpad, GST_PAD_PROBE_TYPE_IDLE,
|
gst_pad_add_probe (peerpad, GST_PAD_PROBE_TYPE_IDLE,
|
||||||
(GstPadProbeCallback) gst_uvc_sink_sinkpad_idle_probe, self, NULL);
|
gst_uvc_sink_sinkpad_idle_probe, self, NULL);
|
||||||
gst_object_unref (peerpad);
|
gst_object_unref (peerpad);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue