mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
sys/v4l2/: Renamed some properties to match the tuner interface naming.
Original commit message from CVS: * 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.
This commit is contained in:
parent
a9bc7aedaa
commit
d8769c7d84
6 changed files with 64 additions and 64 deletions
|
@ -38,8 +38,8 @@
|
|||
#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
|
||||
|
@ -244,12 +244,12 @@ gst_v4l2_object_install_properties_helper (GObjectClass * gobject_class)
|
|||
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",
|
||||
|
@ -279,8 +279,8 @@ gst_v4l2_object_new (GstElement * element,
|
|||
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;
|
||||
|
@ -311,7 +311,7 @@ gst_v4l2_object_set_property_helper (GstV4l2Object * v4l2object,
|
|||
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,
|
||||
|
@ -323,11 +323,11 @@ gst_v4l2_object_set_property_helper (GstV4l2Object * v4l2object,
|
|||
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,
|
||||
|
@ -339,8 +339,8 @@ gst_v4l2_object_set_property_helper (GstV4l2Object * v4l2object,
|
|||
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:
|
||||
|
@ -404,11 +404,11 @@ gst_v4l2_object_get_property_helper (GstV4l2Object * v4l2object,
|
|||
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);
|
||||
|
@ -427,33 +427,33 @@ gst_v4l2_set_defaults (GstV4l2Object * v4l2object)
|
|||
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)) {
|
||||
|
|
|
@ -82,12 +82,12 @@ struct _GstV4l2Object {
|
|||
|
||||
/* lists... */
|
||||
GList *colors;
|
||||
GList *stds;
|
||||
GList *inputs;
|
||||
GList *norms;
|
||||
GList *channels;
|
||||
|
||||
/* properties */
|
||||
gchar *std;
|
||||
gchar *input;
|
||||
gchar *norm;
|
||||
gchar *channel;
|
||||
gulong frequency;
|
||||
|
||||
/* X-overlay */
|
||||
|
@ -111,8 +111,8 @@ GType gst_v4l2_object_get_type(void);
|
|||
PROP_DEVICE, \
|
||||
PROP_DEVICE_NAME, \
|
||||
PROP_FLAGS, \
|
||||
PROP_STD, \
|
||||
PROP_INPUT, \
|
||||
PROP_NORM, \
|
||||
PROP_CHANNEL, \
|
||||
PROP_FREQUENCY
|
||||
|
||||
|
||||
|
|
|
@ -283,11 +283,10 @@ gst_v4l2src_class_init (GstV4l2SrcClass * klass)
|
|||
|
||||
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));
|
||||
|
||||
|
@ -1018,7 +1017,7 @@ gst_v4l2src_create (GstPushSrc * src, GstBuffer ** buf)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ gst_v4l2_tuner_contains_channel (GstV4l2Object * v4l2object,
|
|||
{
|
||||
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;
|
||||
|
||||
|
@ -138,7 +138,7 @@ gst_v4l2_tuner_contains_channel (GstV4l2Object * v4l2object,
|
|||
const GList *
|
||||
gst_v4l2_tuner_list_channels (GstV4l2Object * v4l2object)
|
||||
{
|
||||
return v4l2object->inputs;
|
||||
return v4l2object->channels;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -146,7 +146,7 @@ gst_v4l2_tuner_set_channel_and_notify (GstV4l2Object * v4l2object,
|
|||
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");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ gst_v4l2_tuner_get_channel (GstV4l2Object * v4l2object)
|
|||
|
||||
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;
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ gst_v4l2_tuner_contains_norm (GstV4l2Object * v4l2object,
|
|||
{
|
||||
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;
|
||||
|
||||
|
@ -206,7 +206,7 @@ gst_v4l2_tuner_contains_norm (GstV4l2Object * v4l2object,
|
|||
const GList *
|
||||
gst_v4l2_tuner_list_norms (GstV4l2Object * v4l2object)
|
||||
{
|
||||
return v4l2object->stds;
|
||||
return v4l2object->norms;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -214,7 +214,7 @@ gst_v4l2_tuner_set_norm_and_notify (GstV4l2Object * v4l2object,
|
|||
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");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -249,7 +249,7 @@ gst_v4l2_tuner_get_norm (GstV4l2Object * v4l2object)
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -86,8 +86,8 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object)
|
|||
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;
|
||||
|
@ -99,7 +99,7 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object)
|
|||
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;
|
||||
}
|
||||
|
@ -139,7 +139,8 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object)
|
|||
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");
|
||||
|
@ -168,7 +169,7 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object)
|
|||
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");
|
||||
|
@ -312,13 +313,13 @@ gst_v4l2_empty_lists (GstV4l2Object * v4l2object)
|
|||
{
|
||||
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);
|
||||
|
|
|
@ -773,7 +773,7 @@ gboolean
|
|||
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;
|
||||
|
@ -806,14 +806,14 @@ gst_v4l2src_get_fps (GstV4l2Src * v4l2src, guint * fps_n, guint * fps_d)
|
|||
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue