GstStructure *caps_st;
const char *profile_str, *chroma_format_str, *colorimetry_str;
guint bitdepth_luma, bitdepth_chroma;
- guint8 profile = -1, chroma_format = -1, level = -1;
+ guint8 profile = -1, chroma_format = -1, level = -1, color_primaries =
+ -1, color_transfer = -1, color_matrix = -1;
gboolean video_full_range;
GstVideoColorimetry cinfo = { 0, };
GString *codec_string;
goto done;
}
- /* optional but all or nothing */
- g_string_append_printf (codec_string, ".%02u.%02u.%02u.%02u.%02u",
- chroma_format, gst_video_color_primaries_to_iso (cinfo.primaries),
- gst_video_transfer_function_to_iso (cinfo.transfer),
- gst_video_color_matrix_to_iso (cinfo.matrix), video_full_range);
+ /* optional but all or nothing. Include them if any parameter differs from the default value */
+ color_primaries = gst_video_color_primaries_to_iso (cinfo.primaries);
+ color_transfer = gst_video_transfer_function_to_iso (cinfo.transfer);
+ color_matrix = gst_video_color_matrix_to_iso (cinfo.matrix);
+ if (chroma_format != 1 || color_primaries != 1 || color_transfer != 1
+ || color_matrix != 1 || video_full_range) {
+ g_string_append_printf (codec_string, ".%02u.%02u.%02u.%02u.%02u",
+ chroma_format, color_primaries, color_transfer, color_matrix,
+ video_full_range);
+ }
done:
return g_string_free (codec_string, FALSE);
g_free (mime_codec);
gst_caps_unref (caps);
+ /* vp9 with default chroma subsampling, color primaries, color transfer, color
+ * matrix and luma/chroma encoded in the "legal" range*/
+ caps =
+ gst_caps_from_string
+ ("video/x-vp9, width=(int)640, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, colorimetry=(string)bt709, alignment=(string)super-frame, profile=(string)0, codec-alpha=(boolean)false");
+ mime_codec = gst_codec_utils_caps_get_mime_codec (caps);
+ fail_unless_equals_string (mime_codec, "vp09.00.10.08");
+ g_free (mime_codec);
+ gst_caps_unref (caps);
+
+ /* vp9 with non-default chroma subsampling */
+ caps = gst_caps_from_string ("video/x-vp9, width=(int)640, height=(int)480, "
+ "pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, "
+ "chroma-format=(string)4:2:2, bit-depth-luma=(uint)8, "
+ "bit-depth-chroma=(uint)8, colorimetry=(string)bt709, "
+ "alignment=(string)super-frame, profile=(string)0, "
+ "codec-alpha=(boolean)false");
+ mime_codec = gst_codec_utils_caps_get_mime_codec (caps);
+ fail_unless_equals_string (mime_codec, "vp09.00.10.08.02.01.01.01.00");
+ g_free (mime_codec);
+ gst_caps_unref (caps);
+
/* mjpeg */
caps = gst_caps_new_empty_simple ("image/jpeg");
mime_codec = gst_codec_utils_caps_get_mime_codec (caps);