Merge branch 'gst-plugins-good-fix-alternate-interlacing' into 'main'

WIP: v4l2: Fix alternate interlacing caps and field values

See merge request gstreamer/gstreamer!961
This commit is contained in:
Nicolas Dufresne 2024-05-04 00:09:23 +00:00
commit dc01034611
2 changed files with 14 additions and 7 deletions

View file

@ -1173,6 +1173,15 @@ gst_v4l2_buffer_pool_qbuf (GstV4l2BufferPool * pool, GstBuffer * buf,
else
field = obj->format.fmt.pix.field;
/* If interlaced alternate, specify if buffer is top or bottom */
if (field == V4L2_FIELD_ALTERNATE) {
if ((GST_BUFFER_FLAGS (buf) & GST_VIDEO_BUFFER_FLAG_TOP_FIELD) ==
GST_VIDEO_BUFFER_FLAG_TOP_FIELD)
field = V4L2_FIELD_TOP;
else
field = V4L2_FIELD_BOTTOM;
}
group->buffer.field = field;
}

View file

@ -2886,6 +2886,7 @@ static void
check_alternate_and_append_struct (GstCaps * caps, GstStructure * s)
{
const GValue *mode;
GstCapsFeatures *features = NULL;
mode = gst_structure_get_value (s, "interlace-mode");
if (!mode)
@ -2894,12 +2895,9 @@ check_alternate_and_append_struct (GstCaps * caps, GstStructure * s)
if (G_VALUE_HOLDS_STRING (mode)) {
/* Add the INTERLACED feature if the mode is alternate */
if (!g_strcmp0 (gst_structure_get_string (s, "interlace-mode"),
"alternate")) {
GstCapsFeatures *feat;
feat = gst_caps_features_new (GST_CAPS_FEATURE_FORMAT_INTERLACED, NULL);
gst_caps_set_features (caps, gst_caps_get_size (caps) - 1, feat);
}
"alternate"))
features =
gst_caps_features_new (GST_CAPS_FEATURE_FORMAT_INTERLACED, NULL);
} else if (GST_VALUE_HOLDS_LIST (mode)) {
/* If the mode is a list containing alternate, remove it from the list and add a
* variant with interlace-mode=alternate and the INTERLACED feature. */
@ -2927,7 +2925,7 @@ check_alternate_and_append_struct (GstCaps * caps, GstStructure * s)
}
done:
gst_caps_append_structure (caps, s);
gst_caps_append_structure_full (caps, s, features);
}
static void