3 * Copyright (C) 2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
4 * 2006 Edgard Lima <edgard.lima@indt.org.br>
6 * v4l2_calls.c - generic V4L2 calls handling
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
28 #include <sys/types.h>
31 #include <sys/ioctl.h>
37 /* Needed on older Solaris Nevada builds (72 at least) */
39 #include <sys/ioccom.h>
41 #include "v4l2_calls.h"
42 #include "gstv4l2tuner.h"
44 #include "gstv4l2xoverlay.h"
46 #include "gstv4l2colorbalance.h"
48 #include "gstv4l2src.h"
50 /* Those are ioctl calls */
51 #ifndef V4L2_CID_HCENTER
52 #define V4L2_CID_HCENTER V4L2_CID_HCENTER_DEPRECATED
54 #ifndef V4L2_CID_VCENTER
55 #define V4L2_CID_VCENTER V4L2_CID_VCENTER_DEPRECATED
58 GST_DEBUG_CATEGORY_EXTERN (v4l2_debug);
59 #define GST_CAT_DEFAULT v4l2_debug
61 /******************************************************
62 * gst_v4l2_get_capabilities():
63 * get the device's capturing capabilities
64 * return value: TRUE on success, FALSE on error
65 ******************************************************/
67 gst_v4l2_get_capabilities (GstV4l2Object * v4l2object)
71 e = v4l2object->element;
73 GST_DEBUG_OBJECT (e, "getting capabilities");
75 if (!GST_V4L2_IS_OPEN (v4l2object))
78 if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_QUERYCAP, &v4l2object->vcap) < 0)
81 GST_LOG_OBJECT (e, "driver: '%s'", v4l2object->vcap.driver);
82 GST_LOG_OBJECT (e, "card: '%s'", v4l2object->vcap.card);
83 GST_LOG_OBJECT (e, "bus_info: '%s'", v4l2object->vcap.bus_info);
84 GST_LOG_OBJECT (e, "version: %08x", v4l2object->vcap.version);
85 GST_LOG_OBJECT (e, "capabilites: %08x", v4l2object->vcap.capabilities);
92 GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS,
93 (_("Error getting capabilities for device '%s': "
94 "It isn't a v4l2 driver. Check if it is a v4l1 driver."),
95 v4l2object->videodev), GST_ERROR_SYSTEM);
101 /******************************************************
102 * gst_v4l2_empty_lists() and gst_v4l2_fill_lists():
103 * fill/empty the lists of enumerations
104 * return value: TRUE on success, FALSE on error
105 ******************************************************/
107 gst_v4l2_fill_lists (GstV4l2Object * v4l2object)
113 e = v4l2object->element;
115 GST_DEBUG_OBJECT (e, "getting enumerations");
116 GST_V4L2_CHECK_OPEN (v4l2object);
118 GST_DEBUG_OBJECT (e, " channels");
119 /* and now, the channels */
121 struct v4l2_input input;
122 GstV4l2TunerChannel *v4l2channel;
123 GstTunerChannel *channel;
125 memset (&input, 0, sizeof (input));
128 if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_ENUMINPUT, &input) < 0) {
130 break; /* end of enumeration */
132 GST_ELEMENT_ERROR (e, RESOURCE, SETTINGS,
133 (_("Failed to query attributes of input %d in device %s"),
134 n, v4l2object->videodev),
135 ("Failed to get %d in input enumeration for %s. (%d - %s)",
136 n, v4l2object->videodev, errno, strerror (errno)));
141 GST_LOG_OBJECT (e, " index: %d", input.index);
142 GST_LOG_OBJECT (e, " name: '%s'", input.name);
143 GST_LOG_OBJECT (e, " type: %08x", input.type);
144 GST_LOG_OBJECT (e, " audioset: %08x", input.audioset);
145 GST_LOG_OBJECT (e, " std: %016x", (guint) input.std);
146 GST_LOG_OBJECT (e, " status: %08x", input.status);
148 v4l2channel = g_object_new (GST_TYPE_V4L2_TUNER_CHANNEL, NULL);
149 channel = GST_TUNER_CHANNEL (v4l2channel);
150 channel->label = g_strdup ((const gchar *) input.name);
151 channel->flags = GST_TUNER_CHANNEL_INPUT;
152 v4l2channel->index = n;
154 if (input.type == V4L2_INPUT_TYPE_TUNER) {
155 struct v4l2_tuner vtun;
157 v4l2channel->tuner = input.tuner;
158 channel->flags |= GST_TUNER_CHANNEL_FREQUENCY;
160 vtun.index = input.tuner;
161 if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_TUNER, &vtun) < 0) {
162 GST_ELEMENT_ERROR (e, RESOURCE, SETTINGS,
163 (_("Failed to get setting of tuner %d on device '%s'."),
164 input.tuner, v4l2object->videodev), GST_ERROR_SYSTEM);
165 g_object_unref (G_OBJECT (channel));
169 channel->freq_multiplicator =
170 62.5 * ((vtun.capability & V4L2_TUNER_CAP_LOW) ? 1 : 1000);
171 channel->min_frequency = vtun.rangelow * channel->freq_multiplicator;
172 channel->max_frequency = vtun.rangehigh * channel->freq_multiplicator;
173 channel->min_signal = 0;
174 channel->max_signal = 0xffff;
176 if (input.audioset) {
177 /* we take the first. We don't care for
178 * the others for now */
179 while (!(input.audioset & (1 << v4l2channel->audio)))
180 v4l2channel->audio++;
181 channel->flags |= GST_TUNER_CHANNEL_AUDIO;
184 v4l2object->channels =
185 g_list_prepend (v4l2object->channels, (gpointer) channel);
187 v4l2object->channels = g_list_reverse (v4l2object->channels);
189 GST_DEBUG_OBJECT (e, " norms");
192 struct v4l2_standard standard = { 0, };
193 GstV4l2TunerNorm *v4l2norm;
197 /* fill in defaults */
198 standard.frameperiod.numerator = 1;
199 standard.frameperiod.denominator = 0;
202 if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_ENUMSTD, &standard) < 0) {
203 if (errno == EINVAL || errno == ENOTTY)
204 break; /* end of enumeration */
206 GST_ELEMENT_ERROR (e, RESOURCE, SETTINGS,
207 (_("Failed to query norm on device '%s'."),
208 v4l2object->videodev),
209 ("Failed to get attributes for norm %d on devide '%s'. (%d - %s)",
210 n, v4l2object->videodev, errno, strerror (errno)));
215 GST_DEBUG_OBJECT (e, " '%s', fps: %d / %d",
216 standard.name, standard.frameperiod.denominator,
217 standard.frameperiod.numerator);
219 v4l2norm = g_object_new (GST_TYPE_V4L2_TUNER_NORM, NULL);
220 norm = GST_TUNER_NORM (v4l2norm);
221 norm->label = g_strdup ((const gchar *) standard.name);
222 gst_value_set_fraction (&norm->framerate,
223 standard.frameperiod.denominator, standard.frameperiod.numerator);
224 v4l2norm->index = standard.id;
226 v4l2object->norms = g_list_prepend (v4l2object->norms, (gpointer) norm);
228 v4l2object->norms = g_list_reverse (v4l2object->norms);
230 GST_DEBUG_OBJECT (e, " controls+menus");
231 /* and lastly, controls+menus (if appropriate) */
232 for (n = V4L2_CID_BASE;; n++) {
233 struct v4l2_queryctrl control = { 0, };
234 GstV4l2ColorBalanceChannel *v4l2channel;
236 GstColorBalanceChannel *channel;
238 /* when we reached the last official CID, continue with private CIDs */
239 if (n == V4L2_CID_LASTP1) {
240 GST_DEBUG_OBJECT (e, "checking private CIDs");
241 n = V4L2_CID_PRIVATE_BASE;
242 /* FIXME: We are still not handling private controls. We need a new GstInterface
243 to export those controls */
248 if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_QUERYCTRL, &control) < 0) {
249 if (errno == EINVAL) {
250 if (n < V4L2_CID_PRIVATE_BASE)
251 /* continue so that we also check private controls */
256 GST_ELEMENT_ERROR (e, RESOURCE, SETTINGS,
257 (_("Failed getting controls attributes on device '%s'."),
258 v4l2object->videodev),
259 ("Failed querying control %d on device '%s'. (%d - %s)",
260 n, v4l2object->videodev, errno, strerror (errno)));
264 if (control.flags & V4L2_CTRL_FLAG_DISABLED)
268 case V4L2_CID_BRIGHTNESS:
269 case V4L2_CID_CONTRAST:
270 case V4L2_CID_SATURATION:
272 case V4L2_CID_BLACK_LEVEL:
273 case V4L2_CID_AUTO_WHITE_BALANCE:
274 case V4L2_CID_DO_WHITE_BALANCE:
275 case V4L2_CID_RED_BALANCE:
276 case V4L2_CID_BLUE_BALANCE:
278 case V4L2_CID_EXPOSURE:
279 case V4L2_CID_AUTOGAIN:
281 /* we only handle these for now (why?) */
285 case V4L2_CID_HCENTER:
286 case V4L2_CID_VCENTER:
287 #ifdef V4L2_CID_PAN_RESET
288 case V4L2_CID_PAN_RESET:
290 #ifdef V4L2_CID_TILT_RESET
291 case V4L2_CID_TILT_RESET:
293 /* not handled here, handled by VideoOrientation interface */
296 case V4L2_CID_AUDIO_VOLUME:
297 case V4L2_CID_AUDIO_BALANCE:
298 case V4L2_CID_AUDIO_BASS:
299 case V4L2_CID_AUDIO_TREBLE:
300 case V4L2_CID_AUDIO_MUTE:
301 case V4L2_CID_AUDIO_LOUDNESS:
302 /* FIXME: We should implement GstMixer interface */
306 "ControlID %s (%x) unhandled, FIXME", control.name, n);
313 GST_DEBUG_OBJECT (e, "Adding ControlID %s (%x)", control.name, n);
314 v4l2channel = g_object_new (GST_TYPE_V4L2_COLOR_BALANCE_CHANNEL, NULL);
315 channel = GST_COLOR_BALANCE_CHANNEL (v4l2channel);
316 channel->label = g_strdup ((const gchar *) control.name);
320 /* FIXME: it will be need just when handling private controls
321 *(currently none of base controls are of this type) */
322 if (control.type == V4L2_CTRL_TYPE_MENU) {
323 struct v4l2_querymenu menu, *mptr;
330 if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_QUERYMENU, &menu) < 0) {
332 break; /* end of enumeration */
334 GST_ELEMENT_ERROR (e, RESOURCE, SETTINGS,
335 (_("Failed getting controls attributes on device '%s'."),
336 v4l2object->videodev),
337 ("Failed to get %d in menu enumeration for %s. (%d - %s)",
338 n, v4l2object->videodev, errno, strerror (errno)));
342 mptr = g_malloc (sizeof (menu));
343 memcpy (mptr, &menu, sizeof (menu));
344 menus = g_list_append (menus, mptr);
347 v4l2object->menus = g_list_append (v4l2object->menus, menus);
350 switch (control.type) {
351 case V4L2_CTRL_TYPE_INTEGER:
352 channel->min_value = control.minimum;
353 channel->max_value = control.maximum;
355 case V4L2_CTRL_TYPE_BOOLEAN:
356 channel->min_value = FALSE;
357 channel->max_value = TRUE;
360 /* FIXME we should find out how to handle V4L2_CTRL_TYPE_BUTTON.
361 BUTTON controls like V4L2_CID_DO_WHITE_BALANCE can just be set (1) or
362 unset (0), but can't be queried */
364 "Control with non supported type %s (%x), type=%d",
365 control.name, n, control.type);
366 channel->min_value = channel->max_value = 0;
371 g_list_prepend (v4l2object->colors, (gpointer) channel);
373 v4l2object->colors = g_list_reverse (v4l2object->colors);
375 GST_DEBUG_OBJECT (e, "done");
381 gst_v4l2_empty_lists (GstV4l2Object * v4l2object)
383 GST_DEBUG_OBJECT (v4l2object->element, "deleting enumerations");
385 g_list_foreach (v4l2object->channels, (GFunc) g_object_unref, NULL);
386 g_list_free (v4l2object->channels);
387 v4l2object->channels = NULL;
389 g_list_foreach (v4l2object->norms, (GFunc) g_object_unref, NULL);
390 g_list_free (v4l2object->norms);
391 v4l2object->norms = NULL;
393 g_list_foreach (v4l2object->colors, (GFunc) g_object_unref, NULL);
394 g_list_free (v4l2object->colors);
395 v4l2object->colors = NULL;
398 /******************************************************
400 * open the video device (v4l2object->videodev)
401 * return value: TRUE on success, FALSE on error
402 ******************************************************/
404 gst_v4l2_open (GstV4l2Object * v4l2object)
408 GstPollFD pollfd = GST_POLL_FD_INIT;
410 GST_DEBUG_OBJECT (v4l2object->element, "Trying to open device %s",
411 v4l2object->videodev);
413 GST_V4L2_CHECK_NOT_OPEN (v4l2object);
414 GST_V4L2_CHECK_NOT_ACTIVE (v4l2object);
416 /* be sure we have a device */
417 if (!v4l2object->videodev)
418 v4l2object->videodev = g_strdup ("/dev/video");
420 /* check if it is a device */
421 if (stat (v4l2object->videodev, &st) == -1)
424 if (!S_ISCHR (st.st_mode))
427 /* open the device */
428 v4l2object->video_fd =
429 open (v4l2object->videodev, O_RDWR /* | O_NONBLOCK */ );
431 if (!GST_V4L2_IS_OPEN (v4l2object))
434 libv4l2_fd = v4l2_fd_open (v4l2object->video_fd,
435 V4L2_ENABLE_ENUM_FMT_EMULATION);
436 /* Note the v4l2_xxx functions are designed so that if they get passed an
437 unknown fd, the will behave exactly as their regular xxx counterparts, so
438 if v4l2_fd_open fails, we continue as normal (missing the libv4l2 custom
439 cam format to normal formats conversion). Chances are big we will still
440 fail then though, as normally v4l2_fd_open only fails if the device is not
442 if (libv4l2_fd != -1)
443 v4l2object->video_fd = libv4l2_fd;
445 /* get capabilities, error will be posted */
446 if (!gst_v4l2_get_capabilities (v4l2object))
449 /* do we need to be a capture device? */
450 if (GST_IS_V4L2SRC (v4l2object) &&
451 !(v4l2object->vcap.capabilities & V4L2_CAP_VIDEO_CAPTURE))
454 /* create enumerations, posts errors. */
455 if (!gst_v4l2_fill_lists (v4l2object))
458 GST_INFO_OBJECT (v4l2object->element,
459 "Opened device '%s' (%s) successfully",
460 v4l2object->vcap.card, v4l2object->videodev);
462 pollfd.fd = v4l2object->video_fd;
463 gst_poll_add_fd (v4l2object->poll, &pollfd);
464 gst_poll_fd_ctl_read (v4l2object->poll, &pollfd, TRUE);
471 GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, NOT_FOUND,
472 (_("Cannot identify device '%s'."), v4l2object->videodev),
478 GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, NOT_FOUND,
479 (_("This isn't a device '%s'."), v4l2object->videodev),
485 GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, OPEN_READ_WRITE,
486 (_("Could not open device '%s' for reading and writing."),
487 v4l2object->videodev), GST_ERROR_SYSTEM);
492 GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, NOT_FOUND,
493 (_("Device '%s' is not a capture device."),
494 v4l2object->videodev),
495 ("Capabilities: 0x%x", v4l2object->vcap.capabilities));
500 if (GST_V4L2_IS_OPEN (v4l2object)) {
502 v4l2_close (v4l2object->video_fd);
503 v4l2object->video_fd = -1;
506 gst_v4l2_empty_lists (v4l2object);
513 /******************************************************
515 * close the video device (v4l2object->video_fd)
516 * return value: TRUE on success, FALSE on error
517 ******************************************************/
519 gst_v4l2_close (GstV4l2Object * v4l2object)
521 GstPollFD pollfd = GST_POLL_FD_INIT;
522 GST_DEBUG_OBJECT (v4l2object->element, "Trying to close %s",
523 v4l2object->videodev);
525 GST_V4L2_CHECK_OPEN (v4l2object);
526 GST_V4L2_CHECK_NOT_ACTIVE (v4l2object);
529 v4l2_close (v4l2object->video_fd);
530 pollfd.fd = v4l2object->video_fd;
531 gst_poll_remove_fd (v4l2object->poll, &pollfd);
532 v4l2object->video_fd = -1;
535 gst_v4l2_empty_lists (v4l2object);
541 /******************************************************
542 * gst_v4l2_get_norm()
543 * Get the norm of the current device
544 * return value: TRUE on success, FALSE on error
545 ******************************************************/
547 gst_v4l2_get_norm (GstV4l2Object * v4l2object, v4l2_std_id * norm)
549 GST_DEBUG_OBJECT (v4l2object->element, "getting norm");
551 if (!GST_V4L2_IS_OPEN (v4l2object))
554 if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_STD, norm) < 0)
562 GST_DEBUG ("Failed to get the current norm for device %s",
563 v4l2object->videodev);
569 /******************************************************
570 * gst_v4l2_set_norm()
571 * Set the norm of the current device
572 * return value: TRUE on success, FALSE on error
573 ******************************************************/
575 gst_v4l2_set_norm (GstV4l2Object * v4l2object, v4l2_std_id norm)
577 GST_DEBUG_OBJECT (v4l2object->element, "trying to set norm to %llx", norm);
579 if (!GST_V4L2_IS_OPEN (v4l2object))
582 if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_S_STD, &norm) < 0)
590 GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
591 (_("Failed to set norm for device '%s'."),
592 v4l2object->videodev), GST_ERROR_SYSTEM);
597 /******************************************************
598 * gst_v4l2_get_frequency():
599 * get the current frequency
600 * return value: TRUE on success, FALSE on error
601 ******************************************************/
603 gst_v4l2_get_frequency (GstV4l2Object * v4l2object,
604 gint tunernum, gulong * frequency)
606 struct v4l2_frequency freq = { 0, };
608 GstTunerChannel *channel;
610 GST_DEBUG_OBJECT (v4l2object->element, "getting current tuner frequency");
612 if (!GST_V4L2_IS_OPEN (v4l2object))
615 channel = gst_tuner_get_channel (GST_TUNER (v4l2object->element));
617 freq.tuner = tunernum;
618 if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_FREQUENCY, &freq) < 0)
621 *frequency = freq.frequency * channel->freq_multiplicator;
628 GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
629 (_("Failed to get current tuner frequency for device '%s'."),
630 v4l2object->videodev), GST_ERROR_SYSTEM);
636 /******************************************************
637 * gst_v4l2_set_frequency():
639 * return value: TRUE on success, FALSE on error
640 ******************************************************/
642 gst_v4l2_set_frequency (GstV4l2Object * v4l2object,
643 gint tunernum, gulong frequency)
645 struct v4l2_frequency freq = { 0, };
647 GstTunerChannel *channel;
649 GST_DEBUG_OBJECT (v4l2object->element,
650 "setting current tuner frequency to %lu", frequency);
652 if (!GST_V4L2_IS_OPEN (v4l2object))
655 channel = gst_tuner_get_channel (GST_TUNER (v4l2object->element));
657 freq.tuner = tunernum;
658 /* fill in type - ignore error */
659 v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_FREQUENCY, &freq);
660 freq.frequency = frequency / channel->freq_multiplicator;
662 if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_S_FREQUENCY, &freq) < 0)
670 GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
671 (_("Failed to set current tuner frequency for device '%s' to %lu Hz."),
672 v4l2object->videodev, frequency), GST_ERROR_SYSTEM);
677 /******************************************************
678 * gst_v4l2_signal_strength():
679 * get the strength of the signal on the current input
680 * return value: TRUE on success, FALSE on error
681 ******************************************************/
683 gst_v4l2_signal_strength (GstV4l2Object * v4l2object,
684 gint tunernum, gulong * signal_strength)
686 struct v4l2_tuner tuner = { 0, };
688 GST_DEBUG_OBJECT (v4l2object->element, "trying to get signal strength");
690 if (!GST_V4L2_IS_OPEN (v4l2object))
693 tuner.index = tunernum;
694 if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_TUNER, &tuner) < 0)
697 *signal_strength = tuner.signal;
704 GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
705 (_("Failed to get signal strength for device '%s'."),
706 v4l2object->videodev), GST_ERROR_SYSTEM);
711 /******************************************************
712 * gst_v4l2_get_attribute():
713 * try to get the value of one specific attribute
714 * return value: TRUE on success, FALSE on error
715 ******************************************************/
717 gst_v4l2_get_attribute (GstV4l2Object * v4l2object,
718 int attribute_num, int *value)
720 struct v4l2_control control = { 0, };
722 GST_DEBUG_OBJECT (v4l2object->element, "getting value of attribute %d",
725 if (!GST_V4L2_IS_OPEN (v4l2object))
728 control.id = attribute_num;
730 if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_CTRL, &control) < 0)
733 *value = control.value;
740 GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
741 (_("Failed to get value for control %d on device '%s'."),
742 attribute_num, v4l2object->videodev), GST_ERROR_SYSTEM);
748 /******************************************************
749 * gst_v4l2_set_attribute():
750 * try to set the value of one specific attribute
751 * return value: TRUE on success, FALSE on error
752 ******************************************************/
754 gst_v4l2_set_attribute (GstV4l2Object * v4l2object,
755 int attribute_num, const int value)
757 struct v4l2_control control = { 0, };
759 GST_DEBUG_OBJECT (v4l2object->element, "setting value of attribute %d to %d",
760 attribute_num, value);
762 if (!GST_V4L2_IS_OPEN (v4l2object))
765 control.id = attribute_num;
766 control.value = value;
767 if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_S_CTRL, &control) < 0)
775 GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
776 (_("Failed to set value %d for control %d on device '%s'."),
777 value, attribute_num, v4l2object->videodev), GST_ERROR_SYSTEM);
783 gst_v4l2_get_input (GstV4l2Object * v4l2object, gint * input)
787 GST_DEBUG_OBJECT (v4l2object->element, "trying to get input");
789 if (!GST_V4L2_IS_OPEN (v4l2object))
792 if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_INPUT, &n) < 0)
797 GST_DEBUG_OBJECT (v4l2object->element, "input: %d", n);
804 GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
805 (_("Failed to get current input on device '%s'. May be it is a radio device"), v4l2object->videodev), GST_ERROR_SYSTEM);
811 gst_v4l2_set_input (GstV4l2Object * v4l2object, gint input)
813 GST_DEBUG_OBJECT (v4l2object->element, "trying to set input to %d", input);
815 if (!GST_V4L2_IS_OPEN (v4l2object))
818 if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_S_INPUT, &input) < 0)
826 GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
827 (_("Failed to set input %d on device %s."),
828 input, v4l2object->videodev), GST_ERROR_SYSTEM);