From: Stéphane Cerveau Date: Fri, 8 May 2020 09:06:42 +0000 (+0200) Subject: video-hdr: add hdr formats X-Git-Tag: 1.19.3~511^2~319 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=631489de230d5e1c43f8ded596e220561824ca1e;p=platform%2Fupstream%2Fgstreamer.git video-hdr: add hdr formats Provide enum and helper method to set the hdr format name in caps by example. Part-of: --- diff --git a/gst-libs/gst/video/video-hdr.c b/gst-libs/gst/video/video-hdr.c index 5f924cd..3486c77 100644 --- a/gst-libs/gst/video/video-hdr.c +++ b/gst-libs/gst/video/video-hdr.c @@ -46,6 +46,48 @@ (m)->min_display_mastering_luminance /** + * gst_video_hdr_format_to_string: + * @format: a #GstVideoHDRFormat + * + * Returns: (nullable): a string containing a descriptive name for + * the #GstVideoHDRFormat if there is one, or %NULL otherwise. + * + * Since: 1.20 + */ +const gchar * +gst_video_hdr_format_to_string (GstVideoHDRFormat format) +{ + switch (format) { + case GST_VIDEO_HDR_FORMAT_HDR10: + return "hdr10"; + case GST_VIDEO_HDR_FORMAT_HDR10_PLUS: + return "hdr10+"; + default: + return NULL; + } +} + +/** + * gst_video_hdr_format_from_string: + * @format: (nullable): a #GstVideoHDRFormat + * + * Returns: the #GstVideoHDRFormat for @format or GST_VIDEO_HDR_FORMAT_NONE when the + * string is not a known format. + * + * Since: 1.20 + */ +GstVideoHDRFormat +gst_video_hdr_format_from_string (const gchar * format) +{ + if (!g_strcmp0 (format, "hdr10")) + return GST_VIDEO_HDR_FORMAT_HDR10; + else if (!g_strcmp0 (format, "hdr10+")) + return GST_VIDEO_HDR_FORMAT_HDR10_PLUS; + + return GST_VIDEO_HDR_FORMAT_NONE; +} + +/** * gst_video_mastering_display_info_init: * @minfo: a #GstVideoMasteringDisplayInfo * diff --git a/gst-libs/gst/video/video-hdr.h b/gst-libs/gst/video/video-hdr.h index 54d6e3a..57c038d 100644 --- a/gst-libs/gst/video/video-hdr.h +++ b/gst-libs/gst/video/video-hdr.h @@ -56,6 +56,12 @@ typedef struct _GstVideoContentLightLevel GstVideoContentLightLevel; typedef struct _GstVideoHDR10Plus GstVideoHDR10Plus; typedef struct _GstVideoColorVolumeTransformation GstVideoColorVolumeTransformation; +GST_VIDEO_API +const gchar* gst_video_hdr_format_to_string (GstVideoHDRFormat format) G_GNUC_CONST; + +GST_VIDEO_API +GstVideoHDRFormat gst_video_hdr_format_from_string (const gchar* format) G_GNUC_CONST; + /** * GstVideoHDRMeta: * @meta: parent #GstMeta