diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c index f4dc70bd7b..bf7b454924 100644 --- a/gst-libs/gst/video/video.c +++ b/gst-libs/gst/video/video.c @@ -249,6 +249,41 @@ gst_video_format_parse_caps_interlaced (GstCaps * caps, gboolean * interlaced) return TRUE; } +/** + * gst_video_parse_caps_color_matrix: + * @caps: the fixed #GstCaps to parse + * + * Extracts the color matrix used by the caps. Possible values are + * "sdtv" for the standard definition color matrix (as specified in + * Rec. ITU-R BT.470-6) or "hdtv" for the high definition color + * matrix (as specified in Rec. ITU-R BT.709) + * + * Since: 0.10.29 + * + * Returns: TRUE if @caps was parsed correctly. + */ +const char * +gst_video_parse_caps_color_matrix (GstCaps * caps) +{ + GstStructure *structure; + const char *s; + + if (!gst_caps_is_fixed (caps)) + return NULL; + + structure = gst_caps_get_structure (caps, 0); + + s = gst_structure_get_string (structure, "color-matrix"); + if (s) + return s; + + if (gst_structure_has_name (structure, "video/x-raw-yuv")) { + return "sdtv"; + } + + return NULL; +} + /** * gst_video_format_parse_caps: * @caps: the #GstCaps to parse diff --git a/gst-libs/gst/video/video.h b/gst-libs/gst/video/video.h index 20946dc60f..f968066154 100644 --- a/gst-libs/gst/video/video.h +++ b/gst-libs/gst/video/video.h @@ -291,6 +291,7 @@ gboolean gst_video_parse_caps_framerate (GstCaps *caps, int *fps_n, int *fps_d); gboolean gst_video_parse_caps_pixel_aspect_ratio (GstCaps *caps, int *par_n, int *par_d); +const char *gst_video_parse_caps_color_matrix (GstCaps * caps); GstCaps * gst_video_format_new_caps (GstVideoFormat format, int width, int height, int framerate_n, int framerate_d, int par_n, int par_d);