void gst_v4l2_color_balance_set_value (GstV4l2Object * v4l2object, GstColorBalanceChannel * channel, gint value) { GstV4l2ColorBalanceChannel *v4l2channel = GST_V4L2_COLOR_BALANCE_CHANNEL (channel); /* assert that we're opened and that we're using a known item */ g_return_if_fail (GST_V4L2_IS_OPEN (v4l2object)); g_return_if_fail (gst_v4l2_color_balance_contains_channel (v4l2object, v4l2channel)); gst_v4l2_set_attribute (v4l2object, v4l2channel->id, value); }
static gboolean set_control (GQuark field_id, const GValue * value, gpointer user_data) { GstV4l2Object *v4l2object = user_data; GQuark normalised_field_id; gpointer *d; /* 32 bytes is the maximum size for a control name according to v4l2 */ gchar name[32]; /* Backwards compatibility: in the past GStreamer would normalise strings in a subtly different way to v4l2-ctl. e.g. the kernel's "Focus (absolute)" would become "focus__absolute_" whereas now it becomes "focus_absolute". Please remove the following in GStreamer 1.5 for 1.6 */ strncpy (name, g_quark_to_string (field_id), sizeof (name)); name[31] = '\0'; gst_v4l2_normalise_control_name (name); normalised_field_id = g_quark_from_string (name); if (normalised_field_id != field_id) g_warning ("In GStreamer 1.4 the way V4L2 control names were normalised " "changed. Instead of setting \"%s\" please use \"%s\". The former is " "deprecated and will be removed in a future version of GStreamer", g_quark_to_string (field_id), name); field_id = normalised_field_id; d = g_datalist_id_get_data (&v4l2object->controls, field_id); if (!d) { GST_WARNING_OBJECT (v4l2object, "Control '%s' does not exist or has an unsupported type.", g_quark_to_string (field_id)); return TRUE; } if (!G_VALUE_HOLDS (value, G_TYPE_INT)) { GST_WARNING_OBJECT (v4l2object, "'int' value expected for control '%s'.", g_quark_to_string (field_id)); return TRUE; } gst_v4l2_set_attribute (v4l2object, GPOINTER_TO_INT (d), g_value_get_int (value)); return TRUE; }