ARG_DISPLAY,
ARG_VIDEOWINDOW,
ARG_DO_OVERLAY,
+ ARG_SIGNAL,
};
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",
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;
+ if (gst_v4l_has_tuner(v4lelement))
+ if (!gst_v4l_set_frequency(v4lelement, v4lelement->frequency))
+ return;
}
break;
case ARG_MUTE:
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))
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;
}
{
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;
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;
}
/* 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);