gstmselogging: Added helper function to get nicknames of enum values

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8512>
This commit is contained in:
Jordan Yelloz 2025-02-18 13:08:37 -07:00 committed by GStreamer Marge Bot
parent 2cf19176dc
commit 4e958fa45a
2 changed files with 13 additions and 0 deletions

View File

@ -31,3 +31,6 @@ GST_DEBUG_CATEGORY_EXTERN (gst_mse_debug);
G_GNUC_INTERNAL
void gst_mse_init_logging (void);
G_GNUC_INTERNAL
const gchar * gst_mse_enum_value_nick (GType enum_type, gint mse_enum_value);

View File

@ -33,3 +33,13 @@ gst_mse_init_logging (void)
{
GST_DEBUG_CATEGORY_INIT (gst_mse_debug, "gst-mse", 0, "GstMse");
}
const gchar *
gst_mse_enum_value_nick (GType enum_type, gint mse_enum_value)
{
GEnumClass *enum_class = (GEnumClass *) g_type_class_ref (enum_type);
GEnumValue *enum_value = g_enum_get_value (enum_class, mse_enum_value);
const gchar *nick = enum_value->value_nick;
g_type_class_unref (enum_class);
return nick;
}