mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-23 23:58:17 +00:00
video: fix chroma-site enums
This commit is contained in:
parent
14ad322e8b
commit
e78b66f5a3
3 changed files with 44 additions and 50 deletions
|
@ -958,7 +958,7 @@ theora_handle_type_packet (GstTheoraDec * dec, ogg_packet * packet)
|
|||
|
||||
/* these values are for all versions of the colorspace specified in the
|
||||
* theora info */
|
||||
dec->vinfo.chroma_site = GST_VIDEO_CHROMA_JPEG;
|
||||
dec->vinfo.chroma_site = GST_VIDEO_CHROMA_SITE_JPEG;
|
||||
dec->vinfo.colorimetry.range = GST_VIDEO_COLOR_RANGE_16_235;
|
||||
dec->vinfo.colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_BT601;
|
||||
dec->vinfo.colorimetry.transfer = GST_VIDEO_TRANSFER_BT709;
|
||||
|
|
|
@ -608,43 +608,38 @@ gst_video_info_set_format (GstVideoInfo * info, GstVideoFormat format,
|
|||
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
|
||||
|
@ -661,7 +656,6 @@ static const ColorimetryInfo colorimetry[] = {
|
|||
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 *
|
||||
|
@ -669,7 +663,7 @@ gst_video_get_colorimetry (const gchar * s)
|
|||
{
|
||||
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];
|
||||
}
|
||||
|
@ -715,7 +709,7 @@ gst_video_caps_set_colorimetry (GstCaps * caps, GstVideoColorimetry * cinfo)
|
|||
{
|
||||
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);
|
||||
|
@ -887,7 +881,7 @@ gst_video_info_to_caps (GstVideoInfo * info)
|
|||
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);
|
||||
|
||||
|
|
|
@ -325,29 +325,29 @@ typedef enum {
|
|||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue