av1enc: Update for newly designed AV1 profile signalling
authorSeungha Yang <seungha@centricular.com>
Mon, 20 Dec 2021 16:08:40 +0000 (01:08 +0900)
committerSeungha Yang <seungha@centricular.com>
Tue, 21 Dec 2021 13:20:34 +0000 (22:20 +0900)
Accept named AV1 profiles (i.e., main, high, and professional)
as well

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1456>

subprojects/gst-plugins-bad/ext/aom/gstav1enc.c

index ab676d1..f97b6ca 100644 (file)
@@ -589,10 +589,24 @@ gst_av1_enc_get_downstream_profile (GstAV1Enc * av1enc)
       if (profile_str) {
         gchar *endptr = NULL;
 
-        profile = g_ascii_strtoull (profile_str, &endptr, 10);
-        if (*endptr != '\0' || profile < 0 || profile > 3) {
-          GST_ERROR_OBJECT (av1enc, "Invalid profile '%s'", profile_str);
-          profile = DEFAULT_PROFILE;
+        if (g_strcmp0 (profile_str, "main") == 0) {
+          GST_DEBUG_OBJECT (av1enc, "Downstream profile is \"main\"");
+          profile = 0;
+        } else if (g_strcmp0 (profile_str, "high") == 0) {
+          profile = 1;
+          GST_DEBUG_OBJECT (av1enc, "Downstream profile is \"high\"");
+        } else if (g_strcmp0 (profile_str, "professional") == 0) {
+          profile = 2;
+          GST_DEBUG_OBJECT (av1enc, "Downstream profile is \"professional\"");
+        } else {
+          profile = g_ascii_strtoull (profile_str, &endptr, 10);
+          if (*endptr != '\0' || profile < 0 || profile > 3) {
+            GST_ERROR_OBJECT (av1enc, "Invalid profile '%s'", profile_str);
+            profile = DEFAULT_PROFILE;
+          } else {
+            GST_DEBUG_OBJECT (av1enc,
+                "Downstream profile is \"%s\"", profile_str);
+          }
         }
       }
     }