From 58d19cb7ca9cb73e2ccce2f33e6f689f73ab0b44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sun, 15 Feb 2015 19:03:38 +0000 Subject: [PATCH] pbutils: descriptions: add MPEG-4 video profile to description if available https://bugzilla.gnome.org/show_bug.cgi?id=673976 --- gst-libs/gst/pbutils/descriptions.c | 48 ++++++++++++++++++++++++++++- tests/check/libs/pbutils.c | 2 ++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/pbutils/descriptions.c b/gst-libs/gst/pbutils/descriptions.c index 765ba9d9d9..b44127b139 100644 --- a/gst-libs/gst/pbutils/descriptions.c +++ b/gst-libs/gst/pbutils/descriptions.c @@ -329,6 +329,44 @@ static const FormatInfo formats[] = { {"video/x-tscc", NULL, FLAG_VIDEO, ""} }; +static const gchar * +pbutils_desc_get_mpeg4v_profile_name_from_nick (const gchar * nick) +{ + const gchar map[] = "simple\000Simple\000" + "simple-scalable\000Simple Scalable\000" + "core\000Core\000" + "main\000Main\000" + "n-bit\000N-bit\000" + "scalable\000Scalable\000" + "hybrid\000Hybrid\000" + "advanced-real-time-simple\000Advanced Real-Time Simple\000" + "core-scalable\000Core-Scalable\000" + "advanced-coding-efficiency\000Advanced Coding Efficiency\000" + "advanced-core\000Advanced Core\000" + "advanced-scalable-texture\000Advanced Scalable Texture\000" + "simple-face\000Simple Face Animation\000" + "simple-fba\000Simple FBA\000" + "simple-studio\000Simple Studio\000" + "core-studio\000Core Studio\000" + "advanced-simple\000Advanced Simple\000" + "fine-granularity-scalable\000Fine Granularity Scalable\000" + "basic-animated-texture\000Basic Animated Texture\000" + "baseline\000Baseline Profile\000"; + const gchar *end = map + sizeof (map); + const gchar *p; + + p = map; + while (*p != '\0' && p < end) { + guint len = strlen (p); + + if (strcmp (p, nick) == 0) + return p + len + 1; + p += len + 1; + p += strlen (p) + 1; + } + return NULL; +} + static const gchar * pbutils_desc_get_h264_profile_name_from_nick (const gchar * nick) { @@ -730,7 +768,15 @@ format_info_get_desc (const FormatInfo * info, const GstCaps * caps) if (sysstream) { return g_strdup_printf ("MPEG-%d System Stream", ver); } else { - return g_strdup_printf ("MPEG-%d Video", ver); + const gchar *profile = gst_structure_get_string (s, "profile"); + if (profile != NULL) { + if (ver == 4) + profile = pbutils_desc_get_mpeg4v_profile_name_from_nick (profile); + } + if (profile != NULL) + return g_strdup_printf ("MPEG-%d Video (%s Profile)", ver, profile); + else + return g_strdup_printf ("MPEG-%d Video", ver); } } GST_WARNING ("Missing mpegversion field in mpeg video caps " diff --git a/tests/check/libs/pbutils.c b/tests/check/libs/pbutils.c index aa8a11fe21..daafc2a375 100644 --- a/tests/check/libs/pbutils.c +++ b/tests/check/libs/pbutils.c @@ -310,6 +310,8 @@ static const gchar *caps_strings[] = { "video/mpeg, mpegversion=(int)4, systemstream=(boolean)FALSE", "video/mpeg, mpegversion=(int)99, systemstream=(boolean)TRUE", "video/mpeg, mpegversion=(int)99, systemstream=(boolean)FALSE", + "video/mpeg, mpegversion=(int)4, systemstream=(boolean)FALSE, profile=main", + "video/mpeg, mpegversion=(int)4, systemstream=(boolean)FALSE, profile=adsfad", "video/mpeg", "video/x-indeo, indeoversion=(int)3", "video/x-indeo, indeoversion=(int)5",