{
GstVideoAggregatorPad *vpad = GST_VIDEO_AGGREGATOR_PAD (pad);
gchar *colorimetry, *best_colorimetry;
- const gchar *chroma, *best_chroma;
+ gchar *chroma, *best_chroma;
g_return_if_fail (GST_IS_VIDEO_AGGREGATOR_CONVERT_PAD (pad));
g_return_if_fail (convert_info != NULL);
}
colorimetry = gst_video_colorimetry_to_string (&vpad->info.colorimetry);
- chroma = gst_video_chroma_to_string (vpad->info.chroma_site);
+ chroma = gst_video_chroma_site_to_string (vpad->info.chroma_site);
best_colorimetry = gst_video_colorimetry_to_string (&agg->info.colorimetry);
- best_chroma = gst_video_chroma_to_string (agg->info.chroma_site);
+ best_chroma = gst_video_chroma_site_to_string (agg->info.chroma_site);
if (GST_VIDEO_INFO_FORMAT (&agg->info) != GST_VIDEO_INFO_FORMAT (&vpad->info)
|| g_strcmp0 (colorimetry, best_colorimetry)
g_free (colorimetry);
g_free (best_colorimetry);
+ g_free (chroma);
+ g_free (best_chroma);
}
static void
GstVideoFormat best_format;
GstVideoInfo best_info;
gchar *color_name;
+ gchar *chroma_site;
best_format = GST_VIDEO_FORMAT_UNKNOWN;
gst_video_info_init (&best_info);
}
color_name = gst_video_colorimetry_to_string (&best_info.colorimetry);
+ chroma_site = gst_video_chroma_site_to_string (best_info.chroma_site);
GST_DEBUG_OBJECT (vagg,
"The output format will now be : %s with chroma : %s and colorimetry %s",
gst_video_format_to_string (best_format),
- GST_STR_NULL (gst_video_chroma_to_string (best_info.chroma_site)),
- GST_STR_NULL (color_name));
+ GST_STR_NULL (chroma_site), GST_STR_NULL (color_name));
best_format_caps = gst_caps_copy (caps);
gst_caps_set_simple (best_format_caps, "format", G_TYPE_STRING,
gst_video_format_to_string (best_format), NULL);
- if (best_info.chroma_site != GST_VIDEO_CHROMA_SITE_UNKNOWN)
+ if (chroma_site != NULL)
gst_caps_set_simple (best_format_caps, "chroma-site", G_TYPE_STRING,
- gst_video_chroma_to_string (best_info.chroma_site), NULL);
+ chroma_site, NULL);
if (color_name != NULL)
gst_caps_set_simple (best_format_caps, "colorimetry", G_TYPE_STRING,
color_name, NULL);
g_free (color_name);
+ g_free (chroma_site);
ret = gst_caps_merge (best_format_caps, gst_caps_ref (caps));
return ret;
colorimetry, NULL);
g_free (colorimetry);
- if (info->chroma_site != GST_VIDEO_CHROMA_SITE_UNKNOWN)
- gst_caps_set_simple (state->caps, "chroma-site", G_TYPE_STRING,
- gst_video_chroma_to_string (info->chroma_site), NULL);
+ if (info->chroma_site != GST_VIDEO_CHROMA_SITE_UNKNOWN) {
+ gchar *chroma_site = gst_video_chroma_site_to_string (info->chroma_site);
+
+ if (!chroma_site) {
+ GST_WARNING ("Couldn't convert chroma-site 0x%x to string",
+ info->chroma_site);
+ } else {
+ gst_caps_set_simple (state->caps,
+ "chroma-site", G_TYPE_STRING, chroma_site, NULL);
+ g_free (chroma_site);
+ }
+ }
if (GST_VIDEO_INFO_MULTIVIEW_MODE (info) != GST_VIDEO_MULTIVIEW_MODE_NONE) {
const gchar *caps_mview_mode =
}
if ((s = gst_structure_get_string (structure, "chroma-site")))
- info->chroma_site = gst_video_chroma_from_string (s);
+ info->chroma_site = gst_video_chroma_site_from_string (s);
else
info->chroma_site = GST_VIDEO_CHROMA_SITE_UNKNOWN;
gst_caps_set_simple (caps, "pixel-aspect-ratio",
GST_TYPE_FRACTION, par_n, par_d, NULL);
- 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);
+ if (info->chroma_site != GST_VIDEO_CHROMA_SITE_UNKNOWN) {
+ gchar *chroma_site = gst_video_chroma_site_to_string (info->chroma_site);
+
+ if (!chroma_site) {
+ GST_WARNING ("Couldn't convert chroma-site 0x%x to string",
+ info->chroma_site);
+ } else {
+ gst_caps_set_simple (caps,
+ "chroma-site", G_TYPE_STRING, chroma_site, NULL);
+ g_free (chroma_site);
+ }
+ }
/* make sure we set the RGB matrix for RGB formats */
colorimetry = info->colorimetry;