else
info->interlace_mode = GST_VIDEO_INTERLACE_MODE_PROGRESSIVE;
+ /* Interlaced feature is mandatory for raw alternate streams */
+ if (info->interlace_mode == GST_VIDEO_INTERLACE_MODE_ALTERNATE &&
+ format != GST_VIDEO_FORMAT_ENCODED) {
+ GstCapsFeatures *f;
+
+ f = gst_caps_get_features (caps, 0);
+ if (!f
+ || !gst_caps_features_contains (f, GST_CAPS_FEATURE_FORMAT_INTERLACED))
+ goto alternate_no_feature;
+ }
+
if ((info->interlace_mode == GST_VIDEO_INTERLACE_MODE_INTERLEAVED ||
info->interlace_mode == GST_VIDEO_INTERLACE_MODE_ALTERNATE) &&
(s = gst_structure_get_string (structure, "field-order"))) {
GST_ERROR ("no height property given");
return FALSE;
}
+alternate_no_feature:
+ {
+ GST_ERROR
+ ("caps has 'interlace-mode=alternate' but doesn't have the Interlaced feature");
+ return FALSE;
+ }
}
/**
GST_VIDEO_FIELD_ORDER_TOP_FIELD_FIRST);
gst_caps_unref (caps);
+
+ /* gst_video_info_from_caps() fails if an alternate stream doesn't contain
+ * the caps feature. */
+ caps =
+ gst_caps_from_string
+ ("video/x-raw, format=NV12, width=320, height=240, interlace-mode=alternate");
+ fail_unless (caps);
+
+ fail_if (gst_video_info_from_caps (&vinfo, caps));
+ gst_caps_unref (caps);
+
+ /* ... but it's ok for encoded video */
+ caps =
+ gst_caps_from_string
+ ("video/x-h265, width=320, height=240, interlace-mode=alternate");
+ fail_unless (caps);
+
+ fail_unless (gst_video_info_from_caps (&vinfo, caps));
+ gst_caps_unref (caps);
}
GST_END_TEST;