video-hdr: add hdr formats

Provide enum and helper method to set the hdr format
name in caps by example.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/650>
This commit is contained in:
Stéphane Cerveau 2020-05-08 11:06:42 +02:00 committed by GStreamer Merge Bot
parent a1ed7a8f49
commit 631489de23
2 changed files with 48 additions and 0 deletions

View file

@ -45,6 +45,48 @@
(m)->max_display_mastering_luminance, \
(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

View file

@ -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