[vlc-commits] [Git][videolan/vlc][master] 2 commits: vpx: add choice list for option

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Thu Mar 10 15:11:04 UTC 2022



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
40973305 by Lyndon Brown at 2022-03-10T13:17:46+00:00
vpx: add choice list for option

- - - - -
19d23dbb by Lyndon Brown at 2022-03-10T13:17:46+00:00
vpx: switch mapping of option values to match vpx defines

This fixes the bad option default for this value. The default being
`VPX_DL_GOOD_QUALITY`, which is defined as `1000000` not `0` as seemed to be
the author's assumption, did not map to the specified range of 0-2 and thus
was getting clamped to 2, corresponding to 'best' quality rather than 'good'
quality.

It was requested in review to map the option values to match the vpx defines
rather than simply change the default value to `0`. This necessitates
removal of the range.

- - - - -


1 changed file:

- modules/codec/vpx.c


Changes:

=====================================
modules/codec/vpx.c
=====================================
@@ -52,10 +52,14 @@ static void CloseEncoder(encoder_t *);
 static block_t *Encode(encoder_t *p_enc, picture_t *p_pict);
 
 #define QUALITY_MODE_TEXT N_("Quality mode")
-#define QUALITY_MODE_LONGTEXT N_("Quality setting which will determine max encoding time\n" \
-        " - 0: Good quality\n"\
-        " - 1: Realtime\n"\
-        " - 2: Best quality")
+#define QUALITY_MODE_LONGTEXT N_("Quality setting which will determine max encoding time.")
+
+static const int quality_values[] = {
+    VPX_DL_GOOD_QUALITY, VPX_DL_REALTIME, VPX_DL_BEST_QUALITY
+};
+static const char* const quality_desc[] = {
+    N_("Good"), N_("Realtime"), N_("Best"),
+};
 #endif
 
 /*****************************************************************************
@@ -77,7 +81,7 @@ vlc_module_begin ()
 #   define ENC_CFG_PREFIX "sout-vpx-"
     add_integer( ENC_CFG_PREFIX "quality-mode", VPX_DL_GOOD_QUALITY, QUALITY_MODE_TEXT,
                  QUALITY_MODE_LONGTEXT )
-        change_integer_range( 0, 2 )
+        change_integer_list( quality_values, quality_desc );
 #endif
 vlc_module_end ()
 
@@ -439,10 +443,10 @@ static int OpenEncoder(vlc_object_t *p_this)
 
     /* Deadline (in ms) to spend in encoder */
     switch (var_GetInteger(p_enc, ENC_CFG_PREFIX "quality-mode")) {
-        case 1:
+        case VPX_DL_REALTIME:
             p_sys->quality = VPX_DL_REALTIME;
             break;
-        case 2:
+        case VPX_DL_BEST_QUALITY:
             p_sys->quality = VPX_DL_BEST_QUALITY;
             break;
         default:



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d9997a4fcc152bdfacb1ae0e5570b0d7e6b37941...19d23dbb6749f0c19f740d9d532d68b83e3235d1

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d9997a4fcc152bdfacb1ae0e5570b0d7e6b37941...19d23dbb6749f0c19f740d9d532d68b83e3235d1
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list