video: (de)serialize colorimetry on caps
This commit is contained in:
parent
93c3a74755
commit
24f0ac588f
@ -24,6 +24,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "gstvideometa.h"
|
#include "gstvideometa.h"
|
||||||
@ -2034,11 +2035,14 @@ gst_video_colorimetry_from_string (GstVideoColorimetry * cinfo,
|
|||||||
if ((ci = gst_video_get_colorimetry (color))) {
|
if ((ci = gst_video_get_colorimetry (color))) {
|
||||||
*cinfo = ci->color;
|
*cinfo = ci->color;
|
||||||
} else {
|
} else {
|
||||||
/* FIXME, split and parse */
|
gint r, m, t, p;
|
||||||
cinfo->range = GST_VIDEO_COLOR_RANGE_16_235;
|
|
||||||
cinfo->matrix = GST_VIDEO_COLOR_MATRIX_BT601;
|
if (sscanf (color, "%d:%d:%d:%d", &r, &m, &t, &p) == 4) {
|
||||||
cinfo->transfer = GST_VIDEO_TRANSFER_BT709;
|
cinfo->range = r;
|
||||||
cinfo->primaries = GST_VIDEO_COLOR_PRIMARIES_BT709;
|
cinfo->matrix = m;
|
||||||
|
cinfo->transfer = t;
|
||||||
|
cinfo->primaries = p;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -2047,6 +2051,7 @@ static void
|
|||||||
gst_video_caps_set_colorimetry (GstCaps * caps, GstVideoColorimetry * cinfo)
|
gst_video_caps_set_colorimetry (GstCaps * caps, GstVideoColorimetry * cinfo)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
|
gchar *str;
|
||||||
|
|
||||||
for (i = 0; colorimetry[i].name; i++) {
|
for (i = 0; colorimetry[i].name; i++) {
|
||||||
if (IS_EQUAL (&colorimetry[i], cinfo)) {
|
if (IS_EQUAL (&colorimetry[i], cinfo)) {
|
||||||
@ -2055,7 +2060,11 @@ gst_video_caps_set_colorimetry (GstCaps * caps, GstVideoColorimetry * cinfo)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* FIXME, construct colorimetry */
|
str =
|
||||||
|
g_strdup_printf ("%d:%d:%d:%d", cinfo->range, cinfo->matrix,
|
||||||
|
cinfo->transfer, cinfo->primaries);
|
||||||
|
gst_caps_set_simple (caps, "colorimetry", G_TYPE_STRING, str, NULL);
|
||||||
|
g_free (str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user