From 5379fbcd1a1a4a9926528cf35589cb8c0e960252 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Mon, 15 Mar 2010 01:31:20 -0700 Subject: [PATCH] video: add gst_video_parse_caps_chroma_site() --- gst-libs/gst/video/video.c | 40 ++++++++++++++++++++++++++++++++++++++++ gst-libs/gst/video/video.h | 1 + 2 files changed, 41 insertions(+) diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c index bc09b76..3fe76cf 100644 --- a/gst-libs/gst/video/video.c +++ b/gst-libs/gst/video/video.c @@ -286,6 +286,46 @@ gst_video_parse_caps_color_matrix (GstCaps * caps) } /** + * gst_video_parse_caps_chroma_site: + * @caps: the fixed #GstCaps to parse + * + * Extracts the chroma site used by the caps. Possible values are + * "mpeg2" for MPEG-2 style chroma siting (co-sited horizontally, + * halfway-sited vertically), "jpeg" for JPEG and Theora style + * chroma siting (halfway-sited both horizontally and vertically). + * Other chroma site values are possible, but uncommon. + * + * When no chroma site is specified in the caps, it should be assumed + * to be "mpeg2". + * + * Since: 0.10.29 + * + * Returns: a chroma site string, or NULL if no chroma site could be + * determined. + */ +const char * +gst_video_parse_caps_chroma_site (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, "chroma-site"); + if (s) + return s; + + if (gst_structure_has_name (structure, "video/x-raw-yuv")) { + return "mpeg2"; + } + + return NULL; +} + +/** * gst_video_format_parse_caps: * @caps: the #GstCaps to parse * @format: the #GstVideoFormat of the video represented by @caps (output) diff --git a/gst-libs/gst/video/video.h b/gst-libs/gst/video/video.h index f968066..65659a7 100644 --- a/gst-libs/gst/video/video.h +++ b/gst-libs/gst/video/video.h @@ -292,6 +292,7 @@ gboolean gst_video_parse_caps_framerate (GstCaps *caps, 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); +const char *gst_video_parse_caps_chroma_site (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); -- 2.7.4