pbutils: description: fix MPEG-2 video profiles in description
authorTim-Philipp Müller <tim@centricular.com>
Wed, 18 Feb 2015 11:34:15 +0000 (11:34 +0000)
committerTim-Philipp Müller <tim@centricular.com>
Wed, 18 Feb 2015 11:34:15 +0000 (11:34 +0000)
We would accidentally use the profile nick as profile name
in the description for MPEG video that's not version 4.

gst-libs/gst/pbutils/descriptions.c

index 006b57a..dc4b4fc 100644 (file)
@@ -349,6 +349,14 @@ pbutils_desc_get_profile_name_from_nick (const gchar * map, gsize map_len,
 }
 
 static const gchar *
+pbutils_desc_get_mpeg2v_profile_name_from_nick (const gchar * nick)
+{
+  const gchar map[] = "simple\000Simple\000main\000Main\000high\000High\000";
+
+  return pbutils_desc_get_profile_name_from_nick (map, sizeof (map), nick);
+}
+
+static const gchar *
 pbutils_desc_get_mpeg4v_profile_name_from_nick (const gchar * nick)
 {
   const gchar map[] = "simple\000Simple\000"
@@ -792,6 +800,10 @@ format_info_get_desc (const FormatInfo * info, const GstCaps * caps)
         if (profile != NULL) {
           if (ver == 4)
             profile = pbutils_desc_get_mpeg4v_profile_name_from_nick (profile);
+          else if (ver == 2)
+            profile = pbutils_desc_get_mpeg2v_profile_name_from_nick (profile);
+          else
+            profile = NULL;
         }
         if (profile != NULL)
           return g_strdup_printf ("MPEG-%d Video (%s Profile)", ver, profile);