video: add gst_video_parse_caps_chroma_site()

This commit is contained in:
David Schleef 2010-03-15 01:31:20 -07:00
parent 085d7e20bd
commit 5379fbcd1a
2 changed files with 41 additions and 0 deletions

View file

@ -285,6 +285,46 @@ gst_video_parse_caps_color_matrix (GstCaps * caps)
return NULL;
}
/**
* 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

View file

@ -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);