v4l2: Fix input/output index sign
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Mon, 8 Feb 2021 22:22:37 +0000 (17:22 -0500)
committerNicolas Dufresne <nicolas.dufresne@collabora.com>
Fri, 19 Feb 2021 21:02:02 +0000 (16:02 -0500)
This is an unsigned integer in the kernel API.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>

sys/v4l2/gstv4l2object.h
sys/v4l2/gstv4l2radio.c
sys/v4l2/gstv4l2tuner.c
sys/v4l2/v4l2_calls.c

index a6604bd..e29783c 100644 (file)
@@ -68,8 +68,8 @@ typedef enum {
   GST_V4L2_IO_DMABUF_IMPORT = 5
 } GstV4l2IOMode;
 
-typedef gboolean  (*GstV4l2GetInOutFunction)  (GstV4l2Object * v4l2object, gint * input);
-typedef gboolean  (*GstV4l2SetInOutFunction)  (GstV4l2Object * v4l2object, gint input);
+typedef gboolean  (*GstV4l2GetInOutFunction)  (GstV4l2Object * v4l2object, guint32 * input);
+typedef gboolean  (*GstV4l2SetInOutFunction)  (GstV4l2Object * v4l2object, guint32 input);
 typedef gboolean  (*GstV4l2UpdateFpsFunction) (GstV4l2Object * v4l2object);
 
 /* On Android NDK r18b the ioctl() signature uses 'unsigned' instead of
@@ -325,10 +325,10 @@ gboolean     gst_v4l2_close          (GstV4l2Object * v4l2object);
 /* norm/input/output */
 gboolean     gst_v4l2_get_norm       (GstV4l2Object * v4l2object, v4l2_std_id * norm);
 gboolean     gst_v4l2_set_norm       (GstV4l2Object * v4l2object, v4l2_std_id norm);
-gboolean     gst_v4l2_get_input      (GstV4l2Object * v4l2object, gint * input);
-gboolean     gst_v4l2_set_input      (GstV4l2Object * v4l2object, gint input);
-gboolean     gst_v4l2_get_output     (GstV4l2Object * v4l2object, gint * output);
-gboolean     gst_v4l2_set_output     (GstV4l2Object * v4l2object, gint output);
+gboolean     gst_v4l2_get_input      (GstV4l2Object * v4l2object, guint32 * input);
+gboolean     gst_v4l2_set_input      (GstV4l2Object * v4l2object, guint32 input);
+gboolean     gst_v4l2_get_output     (GstV4l2Object * v4l2object, guint32 * output);
+gboolean     gst_v4l2_set_output     (GstV4l2Object * v4l2object, guint32 output);
 
 /* frequency control */
 gboolean     gst_v4l2_get_frequency   (GstV4l2Object * v4l2object, gint tunernum, gulong * frequency);
index ab7c76d..5cbc18c 100644 (file)
@@ -161,7 +161,7 @@ not_a_tuner:
 }
 
 static gboolean
-gst_v4l2radio_get_input (GstV4l2Object * v4l2object, gint * input)
+gst_v4l2radio_get_input (GstV4l2Object * v4l2object, guint32 * input)
 {
   GST_DEBUG_OBJECT (v4l2object->element, "trying to get radio input");
 
@@ -188,7 +188,7 @@ input_failed:
 }
 
 static gboolean
-gst_v4l2radio_set_input (GstV4l2Object * v4l2object, gint input)
+gst_v4l2radio_set_input (GstV4l2Object * v4l2object, guint32 input)
 {
   GST_DEBUG_OBJECT (v4l2object->element, "trying to set input to %d", input);
 
index 66cc2c1..c08b2ca 100644 (file)
@@ -105,7 +105,7 @@ GstTunerChannel *
 gst_v4l2_tuner_get_channel (GstV4l2Object * v4l2object)
 {
   GList *item;
-  gint channel;
+  guint32 channel;
 
   /* assert that we're opened and that we're using a known item */
   g_return_val_if_fail (GST_V4L2_IS_OPEN (v4l2object), NULL);
@@ -229,7 +229,7 @@ gst_v4l2_tuner_set_frequency (GstV4l2Object * v4l2object,
     GstTunerChannel * channel, gulong frequency)
 {
   GstV4l2TunerChannel *v4l2channel = GST_V4L2_TUNER_CHANNEL (channel);
-  gint chan;
+  guint32 chan;
 
   /* assert that we're opened and that we're using a known item */
   g_return_val_if_fail (GST_V4L2_IS_OPEN (v4l2object), FALSE);
@@ -257,7 +257,7 @@ gst_v4l2_tuner_get_frequency (GstV4l2Object * v4l2object,
     GstTunerChannel * channel)
 {
   GstV4l2TunerChannel *v4l2channel = GST_V4L2_TUNER_CHANNEL (channel);
-  gint chan;
+  guint32 chan;
   gulong frequency = 0;
 
   /* assert that we're opened and that we're using a known item */
@@ -282,7 +282,7 @@ gst_v4l2_tuner_signal_strength (GstV4l2Object * v4l2object,
     GstTunerChannel * channel)
 {
   GstV4l2TunerChannel *v4l2channel = GST_V4L2_TUNER_CHANNEL (channel);
-  gint chan;
+  guint32 chan;
   gulong signal = 0;
 
   /* assert that we're opened and that we're using a known item */
index bbe1819..54cdd0b 100644 (file)
@@ -1083,9 +1083,9 @@ gst_v4l2_set_controls (GstV4l2Object * v4l2object, GstStructure * controls)
 }
 
 gboolean
-gst_v4l2_get_input (GstV4l2Object * v4l2object, gint * input)
+gst_v4l2_get_input (GstV4l2Object * v4l2object, guint32 * input)
 {
-  gint n;
+  guint32 n;
 
   GST_DEBUG_OBJECT (v4l2object->dbg_obj, "trying to get input");
 
@@ -1097,7 +1097,7 @@ gst_v4l2_get_input (GstV4l2Object * v4l2object, gint * input)
 
   *input = n;
 
-  GST_DEBUG_OBJECT (v4l2object->dbg_obj, "input: %d", n);
+  GST_DEBUG_OBJECT (v4l2object->dbg_obj, "input: %u", n);
 
   return TRUE;
 
@@ -1114,9 +1114,9 @@ input_failed:
 }
 
 gboolean
-gst_v4l2_set_input (GstV4l2Object * v4l2object, gint input)
+gst_v4l2_set_input (GstV4l2Object * v4l2object, guint32 input)
 {
-  GST_DEBUG_OBJECT (v4l2object->dbg_obj, "trying to set input to %d", input);
+  GST_DEBUG_OBJECT (v4l2object->dbg_obj, "trying to set input to %u", input);
 
   if (!GST_V4L2_IS_OPEN (v4l2object))
     return FALSE;
@@ -1133,16 +1133,16 @@ input_failed:
      * support
      */
     GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
-        (_("Failed to set input %d on device %s."),
+        (_("Failed to set input %u on device %s."),
             input, v4l2object->videodev), GST_ERROR_SYSTEM);
   }
   return FALSE;
 }
 
 gboolean
-gst_v4l2_get_output (GstV4l2Object * v4l2object, gint * output)
+gst_v4l2_get_output (GstV4l2Object * v4l2object, guint32 * output)
 {
-  gint n;
+  guint32 n;
 
   GST_DEBUG_OBJECT (v4l2object->dbg_obj, "trying to get output");
 
@@ -1154,7 +1154,7 @@ gst_v4l2_get_output (GstV4l2Object * v4l2object, gint * output)
 
   *output = n;
 
-  GST_DEBUG_OBJECT (v4l2object->dbg_obj, "output: %d", n);
+  GST_DEBUG_OBJECT (v4l2object->dbg_obj, "output: %u", n);
 
   return TRUE;
 
@@ -1171,9 +1171,9 @@ output_failed:
 }
 
 gboolean
-gst_v4l2_set_output (GstV4l2Object * v4l2object, gint output)
+gst_v4l2_set_output (GstV4l2Object * v4l2object, guint32 output)
 {
-  GST_DEBUG_OBJECT (v4l2object->dbg_obj, "trying to set output to %d", output);
+  GST_DEBUG_OBJECT (v4l2object->dbg_obj, "trying to set output to %u", output);
 
   if (!GST_V4L2_IS_OPEN (v4l2object))
     return FALSE;
@@ -1190,7 +1190,7 @@ output_failed:
      * support
      */
     GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
-        (_("Failed to set output %d on device %s."),
+        (_("Failed to set output %u on device %s."),
             output, v4l2object->videodev), GST_ERROR_SYSTEM);
   }
   return FALSE;