mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
Revert "video-color: Allow converting incomplete colorimetry to a string"
This reverts commit 158eae7e7e
.
It already *always* allowed to convert incomplete colorimetry to a
string.
This commit is contained in:
parent
d84879db28
commit
9041db4680
3 changed files with 15 additions and 42 deletions
|
@ -145,44 +145,19 @@ gst_video_colorimetry_from_string (GstVideoColorimetry * cinfo,
|
|||
*/
|
||||
gchar *
|
||||
gst_video_colorimetry_to_string (const GstVideoColorimetry * cinfo)
|
||||
{
|
||||
return gst_video_colorimetry_to_string_full (cinfo, FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_video_colorimetry_to_string_full:
|
||||
* @cinfo: a #GstVideoColorimetry
|
||||
* @allow_unknown: Allow unknown fields
|
||||
*
|
||||
* Make a string representation of @cinfo. If @allow_unknown is TRUE,
|
||||
* colorimetry is even returned if some but not all fields of @cinfo are
|
||||
* UNKNOWN.
|
||||
*
|
||||
* Returns: a string representation of @cinfo.
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
gchar *
|
||||
gst_video_colorimetry_to_string_full (const GstVideoColorimetry * cinfo,
|
||||
gboolean allow_unknown)
|
||||
{
|
||||
gint i;
|
||||
|
||||
if (IS_UNKNOWN (cinfo))
|
||||
return NULL;
|
||||
|
||||
for (i = 0; colorimetry[i].name; i++) {
|
||||
if (IS_EQUAL (&colorimetry[i], cinfo)) {
|
||||
return g_strdup (colorimetry[i].name);
|
||||
}
|
||||
}
|
||||
|
||||
if (!allow_unknown && (!cinfo->range || !cinfo->matrix || !cinfo->transfer
|
||||
|| !cinfo->primaries))
|
||||
return NULL;
|
||||
|
||||
return g_strdup_printf ("%d:%d:%d:%d", cinfo->range, cinfo->matrix,
|
||||
cinfo->transfer, cinfo->primaries);
|
||||
if (!IS_UNKNOWN (cinfo)) {
|
||||
return g_strdup_printf ("%d:%d:%d:%d", cinfo->range, cinfo->matrix,
|
||||
cinfo->transfer, cinfo->primaries);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -193,17 +193,16 @@ typedef struct {
|
|||
#define GST_VIDEO_COLORIMETRY_SRGB "sRGB"
|
||||
#define GST_VIDEO_COLORIMETRY_BT2020 "bt2020"
|
||||
|
||||
gboolean gst_video_colorimetry_matches (const GstVideoColorimetry *cinfo, const gchar *color);
|
||||
gboolean gst_video_colorimetry_from_string (GstVideoColorimetry *cinfo, const gchar *color);
|
||||
gchar * gst_video_colorimetry_to_string (const GstVideoColorimetry *cinfo);
|
||||
gchar * gst_video_colorimetry_to_string_full (const GstVideoColorimetry *cinfo, gboolean allow_unknown);
|
||||
gboolean gst_video_colorimetry_is_equal (const GstVideoColorimetry *cinfo, const GstVideoColorimetry *other);
|
||||
gboolean gst_video_colorimetry_matches (const GstVideoColorimetry *cinfo, const gchar *color);
|
||||
gboolean gst_video_colorimetry_from_string (GstVideoColorimetry *cinfo, const gchar *color);
|
||||
gchar * gst_video_colorimetry_to_string (const GstVideoColorimetry *cinfo);
|
||||
gboolean gst_video_colorimetry_is_equal (const GstVideoColorimetry *cinfo, const GstVideoColorimetry *other);
|
||||
|
||||
/* compute offset and scale */
|
||||
void gst_video_color_range_offsets (GstVideoColorRange range,
|
||||
const GstVideoFormatInfo *info,
|
||||
gint offset[GST_VIDEO_MAX_COMPONENTS],
|
||||
gint scale[GST_VIDEO_MAX_COMPONENTS]);
|
||||
void gst_video_color_range_offsets (GstVideoColorRange range,
|
||||
const GstVideoFormatInfo *info,
|
||||
gint offset[GST_VIDEO_MAX_COMPONENTS],
|
||||
gint scale[GST_VIDEO_MAX_COMPONENTS]);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -178,7 +178,7 @@ set_default_colorimetry (GstVideoInfo * info)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
validate_colorimetry (const GstVideoInfo * info)
|
||||
validate_colorimetry (GstVideoInfo * info)
|
||||
{
|
||||
const GstVideoFormatInfo *finfo = info->finfo;
|
||||
|
||||
|
@ -571,7 +571,6 @@ gst_video_info_to_caps (GstVideoInfo * info)
|
|||
g_return_val_if_fail (info != NULL, NULL);
|
||||
g_return_val_if_fail (info->finfo != NULL, NULL);
|
||||
g_return_val_if_fail (info->finfo->format != GST_VIDEO_FORMAT_UNKNOWN, NULL);
|
||||
g_return_val_if_fail (info->finfo->format != GST_VIDEO_FORMAT_ENCODED, NULL);
|
||||
|
||||
format = gst_video_format_to_string (info->finfo->format);
|
||||
g_return_val_if_fail (format != NULL, NULL);
|
||||
|
@ -645,7 +644,7 @@ gst_video_info_to_caps (GstVideoInfo * info)
|
|||
colorimetry.matrix);
|
||||
colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_RGB;
|
||||
}
|
||||
if ((color = gst_video_colorimetry_to_string_full (&colorimetry, FALSE))) {
|
||||
if ((color = gst_video_colorimetry_to_string (&colorimetry))) {
|
||||
gst_caps_set_simple (caps, "colorimetry", G_TYPE_STRING, color, NULL);
|
||||
g_free (color);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue