2006-09-27 Wim Taymans <wim@fluendo.com>
+ * sys/v4l2/gstv4l2object.c:
+ (gst_v4l2_object_install_properties_helper), (gst_v4l2_object_new),
+ (gst_v4l2_object_set_property_helper),
+ (gst_v4l2_object_get_property_helper), (gst_v4l2_set_defaults):
+ * sys/v4l2/gstv4l2object.h:
+ * sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
+ (gst_v4l2src_create):
+ * sys/v4l2/gstv4l2tuner.c: (gst_v4l2_tuner_contains_channel),
+ (gst_v4l2_tuner_list_channels),
+ (gst_v4l2_tuner_set_channel_and_notify),
+ (gst_v4l2_tuner_get_channel), (gst_v4l2_tuner_contains_norm),
+ (gst_v4l2_tuner_list_norms), (gst_v4l2_tuner_set_norm_and_notify),
+ (gst_v4l2_tuner_get_norm):
+ * sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities),
+ (gst_v4l2_fill_lists), (gst_v4l2_empty_lists):
+ * sys/v4l2/v4l2src_calls.c: (gst_v4l2src_get_fps):
+ Renamed some properties to match the tuner interface naming.
+
+2006-09-27 Wim Taymans <wim@fluendo.com>
+
* sys/v4l2/gstv4l2object.c: (gst_v4l2_object_set_property_helper),
(gst_v4l2_set_defaults):
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_get_read),
#define DEFAULT_PROP_DEVICE "/dev/video0"
#define DEFAULT_PROP_DEVICE_NAME NULL
#define DEFAULT_PROP_FLAGS 0
-#define DEFAULT_PROP_STD NULL
-#define DEFAULT_PROP_INPUT NULL
+#define DEFAULT_PROP_NORM NULL
+#define DEFAULT_PROP_CHANNEL NULL
#define DEFAULT_PROP_FREQUENCY 0
enum
g_object_class_install_property (gobject_class, PROP_FLAGS,
g_param_spec_flags ("flags", "Flags", "Device type flags",
GST_TYPE_V4L2_DEVICE_FLAGS, DEFAULT_PROP_FLAGS, G_PARAM_READABLE));
- g_object_class_install_property (gobject_class, PROP_STD,
- g_param_spec_string ("std", "Std", "Standard (norm) to use",
- DEFAULT_PROP_STD, G_PARAM_READWRITE));
- g_object_class_install_property (gobject_class, PROP_INPUT,
- g_param_spec_string ("input", "Input",
- "Input/output (channel) to switch to", DEFAULT_PROP_INPUT,
+ g_object_class_install_property (gobject_class, PROP_NORM,
+ g_param_spec_string ("norm", "Norm", "Standard norm to use",
+ DEFAULT_PROP_NORM, G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class, PROP_CHANNEL,
+ g_param_spec_string ("channel", "Channel",
+ "Input/output channel to switch to", DEFAULT_PROP_CHANNEL,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, PROP_FREQUENCY,
g_param_spec_ulong ("frequency", "Frequency",
v4l2object->buffer = NULL;
v4l2object->videodev = g_strdup (DEFAULT_PROP_DEVICE);
- v4l2object->stds = NULL;
- v4l2object->inputs = NULL;
+ v4l2object->norms = NULL;
+ v4l2object->channels = NULL;
v4l2object->colors = NULL;
v4l2object->xwindow_id = 0;
g_free (v4l2object->videodev);
v4l2object->videodev = g_value_dup_string (value);
break;
- case PROP_STD:
+ case PROP_NORM:
if (GST_V4L2_IS_OPEN (v4l2object)) {
GstTuner *tuner = GST_TUNER (v4l2object->element);
GstTunerNorm *norm = gst_tuner_find_norm_by_name (tuner,
gst_v4l2_tuner_set_norm (v4l2object, norm);
}
} else {
- g_free (v4l2object->std);
- v4l2object->std = g_value_dup_string (value);
+ g_free (v4l2object->norm);
+ v4l2object->norm = g_value_dup_string (value);
}
break;
- case PROP_INPUT:
+ case PROP_CHANNEL:
if (GST_V4L2_IS_OPEN (v4l2object)) {
GstTuner *tuner = GST_TUNER (v4l2object->element);
GstTunerChannel *channel = gst_tuner_find_channel_by_name (tuner,
gst_v4l2_tuner_set_channel (v4l2object, channel);
}
} else {
- g_free (v4l2object->input);
- v4l2object->input = g_value_dup_string (value);
+ g_free (v4l2object->channel);
+ v4l2object->channel = g_value_dup_string (value);
}
break;
case PROP_FREQUENCY:
g_value_set_flags (value, flags);
break;
}
- case PROP_STD:
- g_value_set_string (value, v4l2object->std);
+ case PROP_NORM:
+ g_value_set_string (value, v4l2object->norm);
break;
- case PROP_INPUT:
- g_value_set_string (value, v4l2object->input);
+ case PROP_CHANNEL:
+ g_value_set_string (value, v4l2object->channel);
break;
case PROP_FREQUENCY:
g_value_set_ulong (value, v4l2object->frequency);
GstTunerChannel *channel = NULL;
GstTuner *tuner = GST_TUNER (v4l2object->element);
- if (v4l2object->std)
- norm = gst_tuner_find_norm_by_name (tuner, v4l2object->std);
+ if (v4l2object->norm)
+ norm = gst_tuner_find_norm_by_name (tuner, v4l2object->norm);
if (norm) {
gst_tuner_set_norm (tuner, norm);
} else {
norm =
GST_TUNER_NORM (gst_tuner_get_norm (GST_TUNER (v4l2object->element)));
if (norm) {
- g_free (v4l2object->std);
- v4l2object->std = g_strdup (norm->label);
+ g_free (v4l2object->norm);
+ v4l2object->norm = g_strdup (norm->label);
gst_tuner_norm_changed (tuner, norm);
- g_object_notify (G_OBJECT (v4l2object->element), "std");
+ g_object_notify (G_OBJECT (v4l2object->element), "norm");
}
}
- if (v4l2object->input)
- channel = gst_tuner_find_channel_by_name (tuner, v4l2object->input);
+ if (v4l2object->channel)
+ channel = gst_tuner_find_channel_by_name (tuner, v4l2object->channel);
if (channel) {
gst_tuner_set_channel (tuner, channel);
} else {
channel =
GST_TUNER_CHANNEL (gst_tuner_get_channel (GST_TUNER (v4l2object->
element)));
- g_free (v4l2object->input);
- v4l2object->input = g_strdup (channel->label);
+ g_free (v4l2object->channel);
+ v4l2object->channel = g_strdup (channel->label);
gst_tuner_channel_changed (tuner, channel);
- g_object_notify (G_OBJECT (v4l2object->element), "input");
+ g_object_notify (G_OBJECT (v4l2object->element), "channel");
}
if (GST_TUNER_CHANNEL_HAS_FLAG (channel, GST_TUNER_CHANNEL_FREQUENCY)) {
/* lists... */
GList *colors;
- GList *stds;
- GList *inputs;
+ GList *norms;
+ GList *channels;
/* properties */
- gchar *std;
- gchar *input;
+ gchar *norm;
+ gchar *channel;
gulong frequency;
/* X-overlay */
PROP_DEVICE, \
PROP_DEVICE_NAME, \
PROP_FLAGS, \
- PROP_STD, \
- PROP_INPUT, \
+ PROP_NORM, \
+ PROP_CHANNEL, \
PROP_FREQUENCY
gst_v4l2_object_install_properties_helper (gobject_class);
- g_object_class_install_property
- (gobject_class, PROP_USE_UNDEF_FPS,
+ g_object_class_install_property (gobject_class, PROP_USE_UNDEF_FPS,
g_param_spec_boolean ("use-undef-fps", "Use undefined FPS",
- "For some devices that can't properly report its fps "
- "set this property to TRUE. The 'caps' will have its "
+ "Set this property to TRUE for devices that cannot properly "
+ "determine a framerate. The 'caps' will have their "
"'framerate' set to '0/1'.",
DEFAULT_PROP_USE_UNDEF_FPS, G_PARAM_READWRITE));
no_framerate:
{
GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS,
- (_("Could not get frame rate for %s, try to set use-undef-fps "
+ (_("Could not get frame rate for %s, try to set the use-undef-fps "
"property to true."), v4l2src->v4l2object->videodev), (NULL));
return GST_FLOW_ERROR;
}
{
const GList *item;
- for (item = v4l2object->inputs; item != NULL; item = item->next)
+ for (item = v4l2object->channels; item != NULL; item = item->next)
if (item->data == v4l2channel)
return TRUE;
const GList *
gst_v4l2_tuner_list_channels (GstV4l2Object * v4l2object)
{
- return v4l2object->inputs;
+ return v4l2object->channels;
}
void
GstTunerChannel * channel)
{
if (gst_v4l2_tuner_set_channel (v4l2object, channel)) {
- g_object_notify (G_OBJECT (v4l2object->element), "input");
+ g_object_notify (G_OBJECT (v4l2object->element), "channel");
}
}
v4l2object->get_in_out_func (v4l2object, &channel);
- for (item = v4l2object->inputs; item != NULL; item = item->next) {
+ for (item = v4l2object->channels; item != NULL; item = item->next) {
if (channel == GST_V4L2_TUNER_CHANNEL (item->data)->index)
return (GstTunerChannel *) item->data;
}
{
const GList *item;
- for (item = v4l2object->stds; item != NULL; item = item->next)
+ for (item = v4l2object->norms; item != NULL; item = item->next)
if (item->data == v4l2norm)
return TRUE;
const GList *
gst_v4l2_tuner_list_norms (GstV4l2Object * v4l2object)
{
- return v4l2object->stds;
+ return v4l2object->norms;
}
void
GstTunerNorm * norm)
{
if (gst_v4l2_tuner_set_norm (v4l2object, norm)) {
- g_object_notify (G_OBJECT (v4l2object->element), "std");
+ g_object_notify (G_OBJECT (v4l2object->element), "norm");
}
}
gst_v4l2_get_norm (v4l2object, &norm);
- for (item = v4l2object->stds; item != NULL; item = item->next) {
+ for (item = v4l2object->norms; item != NULL; item = item->next) {
if (norm == GST_V4L2_TUNER_NORM (item->data)->index)
return (GstTunerNorm *) item->data;
}
GST_DEBUG_OBJECT (v4l2object->element, "getting enumerations");
GST_V4L2_CHECK_OPEN (v4l2object);
- GST_DEBUG_OBJECT (v4l2object->element, " inputs");
- /* and now, the inputs */
+ GST_DEBUG_OBJECT (v4l2object->element, " channels");
+ /* and now, the channels */
for (n = 0;; n++) {
struct v4l2_input input;
GstV4l2TunerChannel *v4l2channel;
break; /* end of enumeration */
else {
GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS,
- (_("Failed to get %d in input enumeration for %s."),
+ (_("Failed to get %d in channel enumeration for %s."),
n, v4l2object->videodev), GST_ERROR_SYSTEM);
return FALSE;
}
channel->flags |= GST_TUNER_CHANNEL_AUDIO;
}
- v4l2object->inputs = g_list_append (v4l2object->inputs, (gpointer) channel);
+ v4l2object->channels =
+ g_list_append (v4l2object->channels, (gpointer) channel);
}
GST_DEBUG_OBJECT (v4l2object->element, " norms");
standard.frameperiod.denominator, standard.frameperiod.numerator);
v4l2norm->index = standard.id;
- v4l2object->stds = g_list_append (v4l2object->stds, (gpointer) norm);
+ v4l2object->norms = g_list_append (v4l2object->norms, (gpointer) norm);
}
GST_DEBUG_OBJECT (v4l2object->element, " controls+menus");
{
GST_DEBUG_OBJECT (v4l2object->element, "deleting enumerations");
- g_list_foreach (v4l2object->inputs, (GFunc) g_object_unref, NULL);
- g_list_free (v4l2object->inputs);
- v4l2object->inputs = NULL;
+ g_list_foreach (v4l2object->channels, (GFunc) g_object_unref, NULL);
+ g_list_free (v4l2object->channels);
+ v4l2object->channels = NULL;
- g_list_foreach (v4l2object->stds, (GFunc) g_object_unref, NULL);
- g_list_free (v4l2object->stds);
- v4l2object->stds = NULL;
+ g_list_foreach (v4l2object->norms, (GFunc) g_object_unref, NULL);
+ g_list_free (v4l2object->norms);
+ v4l2object->norms = NULL;
g_list_foreach (v4l2object->colors, (GFunc) g_object_unref, NULL);
g_list_free (v4l2object->colors);
gst_v4l2src_get_fps (GstV4l2Src * v4l2src, guint * fps_n, guint * fps_d)
{
GstV4l2Object *v4l2object = v4l2src->v4l2object;
- v4l2_std_id std;
+ v4l2_std_id norm;
struct v4l2_streamparm stream;
const GList *item;
gboolean found;
try_stds:
/* If G_PARM failed, try to get the same information from the video standard */
- if (!gst_v4l2_get_norm (v4l2object, &std))
+ if (!gst_v4l2_get_norm (v4l2object, &norm))
return FALSE;
found = FALSE;
- for (item = v4l2object->stds; item != NULL; item = item->next) {
+ for (item = v4l2object->norms; item != NULL; item = item->next) {
GstV4l2TunerNorm *v4l2norm = item->data;
- if (v4l2norm->index == std) {
+ if (v4l2norm->index == norm) {
GValue *framerate = &GST_TUNER_NORM (v4l2norm)->framerate;
*fps_n = gst_value_get_fraction_numerator (framerate);