Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/GStreamer/gst-plugins-good.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2021-02-09 22:44:02 +0300
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2021-02-20 00:02:02 +0300
commit1b21c1b15b834fbbbd478b914095e6f90d19b211 (patch)
tree54b99f36f4a5a636706d9fe5dddba69dfeedb10f /sys
parentc386aa43ccf92f7ea81cb61b4a54e5c913816bdb (diff)
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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
Diffstat (limited to 'sys')
-rw-r--r--sys/v4l2/gstv4l2bufferpool.c7
-rw-r--r--sys/v4l2/gstv4l2object.h2
-rw-r--r--sys/v4l2/v4l2_calls.c4
3 files changed, 9 insertions, 4 deletions
diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c
index 8d2481902..164346ef7 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 aab2fb230..ee62ab8eb 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 1ade2d0f6..dce8e33dc 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",