mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 08:17:01 +00:00
Fix to allow parameters to be set by gst-launch
Original commit message from CVS: Fix to allow parameters to be set by gst-launch
This commit is contained in:
parent
3edbd208c3
commit
74931b8db0
3 changed files with 50 additions and 11 deletions
|
@ -65,6 +65,7 @@ enum {
|
|||
ARG_DISPLAY,
|
||||
ARG_VIDEOWINDOW,
|
||||
ARG_DO_OVERLAY,
|
||||
ARG_SIGNAL,
|
||||
};
|
||||
|
||||
|
||||
|
@ -142,6 +143,9 @@ gst_v4lelement_class_init (GstV4lElementClass *klass)
|
|||
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_FREQUENCY,
|
||||
g_param_spec_ulong("frequency","frequency","frequency",
|
||||
0,G_MAXULONG,0,G_PARAM_READWRITE));
|
||||
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_SIGNAL,
|
||||
g_param_spec_uint("signal","signal","signal",
|
||||
0,65535,0,G_PARAM_READABLE));
|
||||
|
||||
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_HAS_AUDIO,
|
||||
g_param_spec_boolean("has_audio","has_audio","has_audio",
|
||||
|
@ -289,8 +293,6 @@ gst_v4lelement_set_property (GObject *object,
|
|||
break;
|
||||
case ARG_FREQUENCY:
|
||||
v4lelement->frequency = g_value_get_ulong(value);
|
||||
if (GST_V4L_IS_OPEN(v4lelement) && !GST_V4L_IS_ACTIVE(v4lelement))
|
||||
{
|
||||
if (gst_v4l_has_tuner(v4lelement))
|
||||
if (!gst_v4l_set_frequency(v4lelement, v4lelement->frequency))
|
||||
return;
|
||||
|
@ -432,6 +434,12 @@ gst_v4lelement_get_property (GObject *object,
|
|||
gst_v4l_get_frequency(v4lelement, &temp_ul);
|
||||
g_value_set_ulong(value, temp_ul);
|
||||
break;
|
||||
case ARG_SIGNAL:
|
||||
if (GST_V4L_IS_OPEN(v4lelement))
|
||||
if (gst_v4l_has_tuner(v4lelement))
|
||||
gst_v4l_get_signal(v4lelement, &temp_i);
|
||||
g_value_set_uint(value, temp_i);
|
||||
break;
|
||||
case ARG_HAS_AUDIO:
|
||||
g_value_set_boolean(value, FALSE);
|
||||
if (GST_V4L_IS_OPEN(v4lelement))
|
||||
|
|
|
@ -243,8 +243,40 @@ gst_v4l_has_tuner (GstV4lElement *v4lelement)
|
|||
DEBUG("checking whether device has a tuner");
|
||||
GST_V4L_CHECK_OPEN(v4lelement);
|
||||
|
||||
return (v4lelement->vcap.type & VID_TYPE_TUNER &&
|
||||
v4lelement->vchan.flags & VIDEO_VC_TUNER);
|
||||
return v4lelement->vcap.type & VID_TYPE_TUNER;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************
|
||||
* gst_v4l_get_signal():
|
||||
* get the current signal
|
||||
* return value: TRUE on success, FALSE on error
|
||||
******************************************************/
|
||||
|
||||
gboolean
|
||||
gst_v4l_get_signal (GstV4lElement *v4lelement,
|
||||
guint *signal)
|
||||
{
|
||||
struct video_tuner tuner;
|
||||
|
||||
DEBUG("getting tuner signal");
|
||||
GST_V4L_CHECK_OPEN(v4lelement);
|
||||
|
||||
if (!gst_v4l_has_tuner(v4lelement))
|
||||
return FALSE;
|
||||
|
||||
tuner.tuner = 0;
|
||||
if (ioctl(v4lelement->video_fd, VIDIOCGTUNER, &tuner) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lelement),
|
||||
"Error getting tuner signal: %s",
|
||||
sys_errlist[errno]);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*signal = tuner.signal;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -288,7 +320,6 @@ gst_v4l_set_frequency (GstV4lElement *v4lelement,
|
|||
{
|
||||
DEBUG("setting tuner frequency to %lu", frequency);
|
||||
GST_V4L_CHECK_OPEN(v4lelement);
|
||||
GST_V4L_CHECK_NOT_ACTIVE(v4lelement);
|
||||
|
||||
if (!gst_v4l_has_tuner(v4lelement))
|
||||
return FALSE;
|
||||
|
@ -424,8 +455,7 @@ gst_v4l_has_audio (GstV4lElement *v4lelement)
|
|||
DEBUG("checking whether device has audio");
|
||||
GST_V4L_CHECK_OPEN(v4lelement);
|
||||
|
||||
return (v4lelement->vcap.audios > 0 &&
|
||||
v4lelement->vchan.flags & VIDEO_VC_AUDIO);
|
||||
return v4lelement->vcap.audios > 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -116,6 +116,7 @@ GList *gst_v4l_get_chan_names (GstV4lElement *v4lelement);
|
|||
|
||||
/* frequency control */
|
||||
gboolean gst_v4l_has_tuner (GstV4lElement *v4lelement);
|
||||
gboolean gst_v4l_get_signal (GstV4lElement *v4lelement, guint *signal);
|
||||
gboolean gst_v4l_get_frequency (GstV4lElement *v4lelement, gulong *frequency);
|
||||
gboolean gst_v4l_set_frequency (GstV4lElement *v4lelement, gulong frequency);
|
||||
|
||||
|
|
Loading…
Reference in a new issue