v4l2: cleanup get/set input/output
output devices should use get/set output, and in either case we should not print a warning message if the ioctl fails but the device does not claim to support the tuner interface
This commit is contained in:
parent
bf88547489
commit
bb07a39c67
@ -286,7 +286,7 @@ gst_v4l2sink_init (GstV4l2Sink * v4l2sink, GstV4l2SinkClass * klass)
|
|||||||
{
|
{
|
||||||
v4l2sink->v4l2object = gst_v4l2_object_new (GST_ELEMENT (v4l2sink),
|
v4l2sink->v4l2object = gst_v4l2_object_new (GST_ELEMENT (v4l2sink),
|
||||||
V4L2_BUF_TYPE_VIDEO_OUTPUT, DEFAULT_PROP_DEVICE,
|
V4L2_BUF_TYPE_VIDEO_OUTPUT, DEFAULT_PROP_DEVICE,
|
||||||
gst_v4l2_get_input, gst_v4l2_set_input, NULL);
|
gst_v4l2_get_output, gst_v4l2_set_output, NULL);
|
||||||
|
|
||||||
/* same default value for video output device as is used for
|
/* same default value for video output device as is used for
|
||||||
* v4l2src/capture is no good.. so lets set a saner default
|
* v4l2src/capture is no good.. so lets set a saner default
|
||||||
|
@ -824,11 +824,14 @@ gst_v4l2_get_input (GstV4l2Object * v4l2object, gint * input)
|
|||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
input_failed:
|
input_failed:
|
||||||
{
|
if (v4l2object->vcap.capabilities & V4L2_CAP_TUNER) {
|
||||||
|
/* only give a warning message if driver actually claims to have tuner
|
||||||
|
* support
|
||||||
|
*/
|
||||||
GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
|
GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
|
||||||
(_("Failed to get current input on device '%s'. May be it is a radio device"), v4l2object->videodev), GST_ERROR_SYSTEM);
|
(_("Failed to get current input on device '%s'. May be it is a radio device"), v4l2object->videodev), GST_ERROR_SYSTEM);
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@ -846,10 +849,70 @@ gst_v4l2_set_input (GstV4l2Object * v4l2object, gint input)
|
|||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
input_failed:
|
input_failed:
|
||||||
{
|
if (v4l2object->vcap.capabilities & V4L2_CAP_TUNER) {
|
||||||
|
/* only give a warning message if driver actually claims to have tuner
|
||||||
|
* support
|
||||||
|
*/
|
||||||
GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
|
GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
|
||||||
(_("Failed to set input %d on device %s."),
|
(_("Failed to set input %d on device %s."),
|
||||||
input, v4l2object->videodev), GST_ERROR_SYSTEM);
|
input, v4l2object->videodev), GST_ERROR_SYSTEM);
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gst_v4l2_get_output (GstV4l2Object * v4l2object, gint * output)
|
||||||
|
{
|
||||||
|
gint n;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (v4l2object->element, "trying to get output");
|
||||||
|
|
||||||
|
if (!GST_V4L2_IS_OPEN (v4l2object))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_OUTPUT, &n) < 0)
|
||||||
|
goto output_failed;
|
||||||
|
|
||||||
|
*output = n;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (v4l2object->element, "output: %d", n);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
/* ERRORS */
|
||||||
|
output_failed:
|
||||||
|
if (v4l2object->vcap.capabilities & V4L2_CAP_TUNER) {
|
||||||
|
/* only give a warning message if driver actually claims to have tuner
|
||||||
|
* support
|
||||||
|
*/
|
||||||
|
GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
|
||||||
|
(_("Failed to get current output on device '%s'. May be it is a radio device"), v4l2object->videodev), GST_ERROR_SYSTEM);
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gst_v4l2_set_output (GstV4l2Object * v4l2object, gint output)
|
||||||
|
{
|
||||||
|
GST_DEBUG_OBJECT (v4l2object->element, "trying to set output to %d", output);
|
||||||
|
|
||||||
|
if (!GST_V4L2_IS_OPEN (v4l2object))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_S_OUTPUT, &output) < 0)
|
||||||
|
goto output_failed;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
/* ERRORS */
|
||||||
|
output_failed:
|
||||||
|
if (v4l2object->vcap.capabilities & V4L2_CAP_TUNER) {
|
||||||
|
/* only give a warning message if driver actually claims to have tuner
|
||||||
|
* support
|
||||||
|
*/
|
||||||
|
GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
|
||||||
|
(_("Failed to set output %d on device %s."),
|
||||||
|
output, v4l2object->videodev), GST_ERROR_SYSTEM);
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -111,12 +111,10 @@ gboolean gst_v4l2_get_input (GstV4l2Object * v4l2object,
|
|||||||
gint * input);
|
gint * input);
|
||||||
gboolean gst_v4l2_set_input (GstV4l2Object * v4l2object,
|
gboolean gst_v4l2_set_input (GstV4l2Object * v4l2object,
|
||||||
gint input);
|
gint input);
|
||||||
#if 0 /* output not handled by now */
|
|
||||||
gboolean gst_v4l2_get_output (GstV4l2Object *v4l2object,
|
gboolean gst_v4l2_get_output (GstV4l2Object *v4l2object,
|
||||||
gint *output);
|
gint *output);
|
||||||
gboolean gst_v4l2_set_output (GstV4l2Object *v4l2object,
|
gboolean gst_v4l2_set_output (GstV4l2Object *v4l2object,
|
||||||
gint output);
|
gint output);
|
||||||
#endif /* #if 0 - output not handled by now */
|
|
||||||
|
|
||||||
/* frequency control */
|
/* frequency control */
|
||||||
gboolean gst_v4l2_get_frequency (GstV4l2Object *v4l2object,
|
gboolean gst_v4l2_get_frequency (GstV4l2Object *v4l2object,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user