fill_planes (info);
}
+typedef struct
+{
+ const gchar *name;
+ GstVideoChromaSite site;
+} ChromaSiteInfo;
+
+static const ChromaSiteInfo chromasite[] = {
+ {"jpeg", GST_VIDEO_CHROMA_SITE_JPEG},
+ {"mpeg2", GST_VIDEO_CHROMA_SITE_MPEG2},
+ {"dv", GST_VIDEO_CHROMA_SITE_DV}
+};
+
static GstVideoChromaSite
gst_video_chroma_from_string (const gchar * s)
{
- GstVideoChromaSite res;
-
- if (g_str_equal (s, "jpeg")) {
- res = GST_VIDEO_CHROMA_JPEG;
- } else if (g_str_equal (s, "mpeg2")) {
- res = GST_VIDEO_CHROMA_MPEG2;
- } else if (g_str_equal (s, "dv")) {
- res = GST_VIDEO_CHROMA_DV;
- } else {
- res = GST_VIDEO_CHROMA_NONE;
+ gint i;
+ for (i = 0; i < G_N_ELEMENTS (chromasite); i++) {
+ if (g_str_equal (chromasite[i].name, s))
+ return chromasite[i].site;
}
- return res;
+ return GST_VIDEO_CHROMA_SITE_UNKNOWN;
}
static const gchar *
gst_video_chroma_to_string (GstVideoChromaSite site)
{
- const gchar *res;
-
- switch (site) {
- case GST_VIDEO_CHROMA_JPEG:
- res = "jpeg";
- break;
- case GST_VIDEO_CHROMA_MPEG2:
- res = "mpeg2";
- break;
- case GST_VIDEO_CHROMA_DV:
- res = "dv";
- break;
- default:
- res = NULL;
- break;
+ gint i;
+ for (i = 0; i < G_N_ELEMENTS (chromasite); i++) {
+ if (chromasite[i].site == site)
+ return chromasite[i].name;
}
- return res;
+ return NULL;
}
typedef struct
MAKE_COLORIMETRY (BT601, _16_235, BT601, BT709, BT470M),
MAKE_COLORIMETRY (BT709, _16_235, BT709, BT709, BT709),
MAKE_COLORIMETRY (SMPTE240M, _16_235, SMPTE240M, SMPTE240M, SMPTE240M),
- {NULL,}
};
static const ColorimetryInfo *
{
gint i;
- for (i = 0; colorimetry[i].name; i++) {
+ for (i = 0; i < G_N_ELEMENTS (colorimetry); i++) {
if (g_str_equal (colorimetry[i].name, s))
return &colorimetry[i];
}
{
gint i;
- for (i = 0; colorimetry[i].name; i++) {
+ for (i = 0; i < G_N_ELEMENTS (colorimetry); i++) {
if (IS_EQUAL (&colorimetry[i], cinfo)) {
gst_caps_set_simple (caps, "colorimetry", G_TYPE_STRING,
colorimetry[i].name, NULL);
if (info->flags & GST_VIDEO_FLAG_INTERLACED)
gst_caps_set_simple (caps, "interlaced", G_TYPE_BOOLEAN, TRUE, NULL);
- if (info->chroma_site != GST_VIDEO_CHROMA_UNKNOWN)
+ if (info->chroma_site != GST_VIDEO_CHROMA_SITE_UNKNOWN)
gst_caps_set_simple (caps, "chroma-site", G_TYPE_STRING,
gst_video_chroma_to_string (info->chroma_site), NULL);
/**
* GstVideoChroma:
- * @GST_VIDEO_CHROMA_UNKNOWN: unknown cositing
- * @GST_VIDEO_CHROMA_NONE: no cositing
- * @GST_VIDEO_CHROMA_H_COSITED: chroma is horizontally cosited
- * @GST_VIDEO_CHROMA_V_COSITED: chroma is vertically cosited
- * @GST_VIDEO_CHROMA_ALT_LINE: choma samples are sited on alternate lines
- * @GST_VIDEO_CHROMA_COSITED: chroma samples cosited with luma samples
- * @GST_VIDEO_CHROMA_JPEG: jpeg style cositing, also for mpeg1 and mjpeg
- * @GST_VIDEO_CHROMA_MPEG2: mpeg2 style cositing
- * @GST_VIDEO_CHROMA_DV: DV style cositing
+ * @GST_VIDEO_CHROMA_SITE_UNKNOWN: unknown cositing
+ * @GST_VIDEO_CHROMA_SITE_NONE: no cositing
+ * @GST_VIDEO_CHROMA_SITE_H_COSITED: chroma is horizontally cosited
+ * @GST_VIDEO_CHROMA_SITE_V_COSITED: chroma is vertically cosited
+ * @GST_VIDEO_CHROMA_SITE_ALT_LINE: choma samples are sited on alternate lines
+ * @GST_VIDEO_CHROMA_SITE_COSITED: chroma samples cosited with luma samples
+ * @GST_VIDEO_CHROMA_SITE_JPEG: jpeg style cositing, also for mpeg1 and mjpeg
+ * @GST_VIDEO_CHROMA_SITE_MPEG2: mpeg2 style cositing
+ * @GST_VIDEO_CHROMA_SITE_DV: DV style cositing
*
* Various Chroma sitings.
*/
typedef enum {
- GST_VIDEO_CHROMA_UNKNOWN = 0,
- GST_VIDEO_CHROMA_NONE = (1 << 0),
- GST_VIDEO_CHROMA_H_COSITED = (1 << 1),
- GST_VIDEO_CHROMA_V_COSITED = (1 << 2),
- GST_VIDEO_CHROMA_ALT_LINE = (1 << 3),
+ GST_VIDEO_CHROMA_SITE_UNKNOWN = 0,
+ GST_VIDEO_CHROMA_SITE_NONE = (1 << 0),
+ GST_VIDEO_CHROMA_SITE_H_COSITED = (1 << 1),
+ GST_VIDEO_CHROMA_SITE_V_COSITED = (1 << 2),
+ GST_VIDEO_CHROMA_SITE_ALT_LINE = (1 << 3),
/* some common chroma cositing */
- GST_VIDEO_CHROMA_COSITED = (GST_VIDEO_CHROMA_H_COSITED | GST_VIDEO_CHROMA_V_COSITED),
- GST_VIDEO_CHROMA_JPEG = (GST_VIDEO_CHROMA_NONE),
- GST_VIDEO_CHROMA_MPEG2 = (GST_VIDEO_CHROMA_H_COSITED),
- GST_VIDEO_CHROMA_DV = (GST_VIDEO_CHROMA_COSITED | GST_VIDEO_CHROMA_ALT_LINE),
+ GST_VIDEO_CHROMA_SITE_COSITED = (GST_VIDEO_CHROMA_SITE_H_COSITED | GST_VIDEO_CHROMA_SITE_V_COSITED),
+ GST_VIDEO_CHROMA_SITE_JPEG = (GST_VIDEO_CHROMA_SITE_NONE),
+ GST_VIDEO_CHROMA_SITE_MPEG2 = (GST_VIDEO_CHROMA_SITE_H_COSITED),
+ GST_VIDEO_CHROMA_SITE_DV = (GST_VIDEO_CHROMA_SITE_COSITED | GST_VIDEO_CHROMA_SITE_ALT_LINE),
} GstVideoChromaSite;
/**