gstvaapiutils_h265: Add H265 Tier specific utility functions
authorSreerenj Balachandran <sreerenj.balachandran@intel.com>
Mon, 25 May 2015 07:58:52 +0000 (10:58 +0300)
committerSreerenj Balachandran <sreerenj.balachandran@intel.com>
Mon, 25 May 2015 08:23:16 +0000 (11:23 +0300)
-- 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 <sreerenj.balachandran@intel.com>
gst-libs/gst/vaapi/gstvaapiutils_h265.c
gst-libs/gst/vaapi/gstvaapiutils_h265.h

index 279400e..0a80d3d 100644 (file)
@@ -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;
+}
index fff6e64..71011b9 100644 (file)
@@ -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 */