From: Nicolas Dufresne Date: Tue, 9 Feb 2021 19:44:02 +0000 (-0500) Subject: v4l2: Subscribe source_change for the current input X-Git-Tag: 1.19.3~509^2~279 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1b21c1b15b834fbbbd478b914095e6f90d19b211;p=platform%2Fupstream%2Fgstreamer.git v4l2: Subscribe source_change for the current input When we subscribe for source-change event, we need to specify for which input. Make sure we subscribe for the current input. Part-of: --- diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c index 8d24819..164346e 100644 --- a/sys/v4l2/gstv4l2bufferpool.c +++ b/sys/v4l2/gstv4l2bufferpool.c @@ -2201,8 +2201,13 @@ gst_v4l2_buffer_pool_flush (GstBufferPool * bpool) void gst_v4l2_buffer_pool_enable_resolution_change (GstV4l2BufferPool * pool) { + guint32 input_id = 0; + g_return_if_fail (!gst_buffer_pool_is_active (GST_BUFFER_POOL (pool))); - if (gst_v4l2_subscribe_event (pool->obj, V4L2_EVENT_SOURCE_CHANGE)) + /* Make sure we subscribe for the current input */ + gst_v4l2_get_input (pool->obj, &input_id); + + if (gst_v4l2_subscribe_event (pool->obj, V4L2_EVENT_SOURCE_CHANGE, input_id)) gst_poll_fd_ctl_pri (pool->poll, &pool->pollfd, TRUE); } diff --git a/sys/v4l2/gstv4l2object.h b/sys/v4l2/gstv4l2object.h index aab2fb2..ee62ab8 100644 --- a/sys/v4l2/gstv4l2object.h +++ b/sys/v4l2/gstv4l2object.h @@ -343,7 +343,7 @@ gboolean gst_v4l2_set_string_attribute (GstV4l2Object * v4l2object, int attr gboolean gst_v4l2_set_controls (GstV4l2Object * v4l2object, GstStructure * controls); /* events */ -gboolean gst_v4l2_subscribe_event (GstV4l2Object * v4l2object, guint32 event); +gboolean gst_v4l2_subscribe_event (GstV4l2Object * v4l2object, guint32 event, guint32 id); gboolean gst_v4l2_dequeue_event (GstV4l2Object * v4l2object, struct v4l2_event *event); G_END_DECLS diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c index 1ade2d0..dce8e33 100644 --- a/sys/v4l2/v4l2_calls.c +++ b/sys/v4l2/v4l2_calls.c @@ -1237,9 +1237,9 @@ gst_v4l2_event_to_string (guint32 event) } gboolean -gst_v4l2_subscribe_event (GstV4l2Object * v4l2object, guint32 event) +gst_v4l2_subscribe_event (GstV4l2Object * v4l2object, guint32 event, guint32 id) { - struct v4l2_event_subscription sub = {.type = event, }; + struct v4l2_event_subscription sub = {.type = event,.id = id, }; gint ret; GST_DEBUG_OBJECT (v4l2object->dbg_obj, "Subscribing to '%s' event",