v4l2: don't add the same interlace mode twice

Some drivers modify the interlace mode to progressive, no matter what
input you give them, make sure that we don't add the same interlace mode
twice.
This commit is contained in:
Wim Taymans 2015-04-22 18:05:24 +02:00
parent c884a3b3a5
commit 8c116cfcd8

View file

@ -1753,7 +1753,7 @@ gst_v4l2_object_add_interlace_mode (GstV4l2Object * v4l2object,
{
struct v4l2_format fmt;
GValue interlace_formats = { 0, };
GstVideoInterlaceMode interlace_mode;
GstVideoInterlaceMode interlace_mode, prev = -1;
const gchar *mode_strings[] = { "progressive",
"interleaved",
@ -1784,6 +1784,7 @@ gst_v4l2_object_add_interlace_mode (GstV4l2Object * v4l2object,
g_value_init (&interlace_enum, G_TYPE_STRING);
g_value_set_string (&interlace_enum, mode_strings[interlace_mode]);
gst_value_list_append_and_take_value (&interlace_formats, &interlace_enum);
prev = interlace_mode;
}
memset (&fmt, 0, sizeof (fmt));
@ -1794,7 +1795,8 @@ gst_v4l2_object_add_interlace_mode (GstV4l2Object * v4l2object,
fmt.fmt.pix.field = V4L2_FIELD_INTERLACED;
if (gst_v4l2_object_try_fmt (v4l2object, &fmt) == 0 &&
gst_v4l2_object_get_interlace_mode (fmt.fmt.pix.field, &interlace_mode)) {
gst_v4l2_object_get_interlace_mode (fmt.fmt.pix.field, &interlace_mode) &&
prev != interlace_mode) {
GValue interlace_enum = { 0, };
g_value_init (&interlace_enum, G_TYPE_STRING);
g_value_set_string (&interlace_enum, mode_strings[interlace_mode]);