From e069ddf2b135c4c422a959a6c59e78d15a5e091a Mon Sep 17 00:00:00 2001 From: Sreerenj Balachandran Date: Mon, 25 May 2015 10:58:52 +0300 Subject: [PATCH] gstvaapiutils_h265: Add H265 Tier specific utility functions -- New API: gst_vaapi_utils_h265_get_tier_from_string() -- New API: gst_vaapi_utils_h265_get_tier_string() https://bugzilla.gnome.org/show_bug.cgi?id=748874 Signed-off-by: Sreerenj Balachandran --- gst-libs/gst/vaapi/gstvaapiutils_h265.c | 28 +++++++++++++++++++++++++ gst-libs/gst/vaapi/gstvaapiutils_h265.h | 22 +++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/gst-libs/gst/vaapi/gstvaapiutils_h265.c b/gst-libs/gst/vaapi/gstvaapiutils_h265.c index 279400e0ca..0a80d3db7d 100644 --- a/gst-libs/gst/vaapi/gstvaapiutils_h265.c +++ b/gst-libs/gst/vaapi/gstvaapiutils_h265.c @@ -40,6 +40,15 @@ static const struct map gst_vaapi_h265_profile_map[] = { /* *INDENT-ON* */ }; +/* Tier string map */ +static const struct map gst_vaapi_h265_tier_map[] = { +/* *INDENT-OFF* */ + { GST_VAAPI_TIER_H265_MAIN, "main" }, + { GST_VAAPI_TIER_H265_HIGH, "high"}, + { GST_VAAPI_TIER_H265_UNKNOWN, "unknown"} +/* *INDENT-ON* */ +}; + /* Level string map */ static const struct map gst_vaapi_h265_level_map[] = { /* *INDENT-OFF* */ @@ -323,3 +332,22 @@ gst_vaapi_utils_h265_get_chroma_format_idc (GstVaapiChromaType chroma_type) } return chroma_format_idc; } + +/** Returns GstVaapiTierH265 from a string representation */ +GstVaapiTierH265 +gst_vaapi_utils_h265_get_tier_from_string (const gchar * str) +{ + const struct map *const m = map_lookup_name (gst_vaapi_h265_tier_map, str); + + return m ? (GstVaapiTierH265) m->value : GST_VAAPI_TIER_H265_UNKNOWN; +} + +/** Returns a string representation for the supplied H.265 tier */ +const gchar * +gst_vaapi_utils_h265_get_tier_string (GstVaapiTierH265 tier) +{ + const struct map *const m = + map_lookup_value (gst_vaapi_h265_tier_map, tier); + + return m ? m->name : NULL; +} diff --git a/gst-libs/gst/vaapi/gstvaapiutils_h265.h b/gst-libs/gst/vaapi/gstvaapiutils_h265.h index fff6e6416b..71011b99cd 100644 --- a/gst-libs/gst/vaapi/gstvaapiutils_h265.h +++ b/gst-libs/gst/vaapi/gstvaapiutils_h265.h @@ -63,6 +63,20 @@ typedef enum { GST_VAAPI_LEVEL_H265_L6_2, } GstVaapiLevelH265; +/** + * GstVaapiTierH265: + * GST_VAAPI_TIER_H265_MAIN: H265 Tier 0 + * GST_VAAPI_TIER_H265_HIGH: H265 Tier 1 + * GST_VAAPI_TIER_H265_UNKNOWN: Unknown Tier + * + * The set of all Tier for #GstVaapiTierH265. + */ +typedef enum { + GST_VAAPI_TIER_H265_MAIN, + GST_VAAPI_TIER_H265_HIGH, + GST_VAAPI_TIER_H265_UNKNOWN = -1 +} GstVaapiTierH265; + /* Returns a relative score for the supplied GstVaapiProfile */ guint gst_vaapi_utils_h265_get_profile_score (GstVaapiProfile profile); @@ -83,6 +97,14 @@ gst_vaapi_utils_h265_get_level_from_string (const gchar * str); const gchar * gst_vaapi_utils_h265_get_level_string (GstVaapiLevelH265 level); +/* Returns GstVaapiTierH265 from a string representation */ +GstVaapiTierH265 +gst_vaapi_utils_h265_get_tier_from_string (const gchar * str); + +/* Returns a string representation for the supplied H.265 Tier */ +const gchar * +gst_vaapi_utils_h265_get_tier_string (GstVaapiTierH265 tier); + G_END_DECLS #endif /* GST_VAAPI_UTILS_H265_H */