[vlc-commits] [Git][videolan/vlc][master] 7 commits: dtv: fix bad option default

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Mon Nov 1 02:55:06 UTC 2021



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
7e3cba83 by Lyndon Brown at 2021-11-01T02:40:19+00:00
dtv: fix bad option default

0 was not in the choice list.

it looks like 0 was interpreted by the code as the same as -1 via
`dvb_parse_transmit_mode()`, so not a big problem.

- - - - -
93211094 by Lyndon Brown at 2021-11-01T02:40:19+00:00
mono: fix bad option default

-1 was not in the choice list.

this adds the missing choice list entry corresponding to the default.
i've made a guess at the right label and explanation to use based upon
what seems to be happening with a -1 value in `stereo_to_mono()` and
from bits of git history relating to it.

- - - - -
0a68d39d by Lyndon Brown at 2021-11-01T02:40:19+00:00
rtp: fix bad option default

NULL does not map to an entry in the choice list.

also, mark the choice labels for translation.

- - - - -
31f283ad by Lyndon Brown at 2021-11-01T02:40:19+00:00
upnp: improve auto mode handling code

(no functional change)

 - better prepare for the next commit where we need to support both "Auto"
   and "auto".
 - avoid multiple `strdup()`.
 - avoid avoidable string comparisons.

- - - - -
230068f3 by Lyndon Brown at 2021-11-01T02:40:19+00:00
upnp: fix bad option default

the lowercase "auto" default option value did not match the uppercase
"Auto" in the choice list.

option values should typically be lowercase. this fixes the mistake with
the case of the choice value, whilst maintaining backwards compatibility
with existing CLI usage and from saved settings files. this was the
clear preference for fixing this resulting from the MR discussion.

- - - - -
fb842279 by Lyndon Brown at 2021-11-01T02:40:19+00:00
visual: fix bad option default

"flat" is not in the choice list and is meaningless to the module, not
matching any of its known presets. it is thus equivalent to a default of
"none". (see `window_get_param()` in `modules/visualization/visual/window.c`
which describes this as falling back to "using rectangular window (i.e. no
window)").

it is a reasonable assumption that the author meant the default to be the
`"flattop"` choice, and just made a mistake here, however this is not
certain and the preference expressed in review was to preserve the existing
behaviour by switching to "none".

- - - - -
94fb7feb by Lyndon Brown at 2021-11-01T02:40:19+00:00
svg: fix default outside of valid range

caused options to always be adjusted to value of 1 when saving prefs.

- - - - -


6 changed files:

- modules/access/dtv/access.c
- modules/access/rtp/rtp.c
- modules/audio_filter/channel_mixer/mono.c
- modules/codec/svg.c
- modules/services_discovery/upnp.cpp
- modules/visualization/visual/visual.c


Changes:

=====================================
modules/access/dtv/access.c
=====================================
@@ -283,7 +283,7 @@ vlc_module_begin ()
     add_integer ("dvb-bandwidth", 0, BANDWIDTH_TEXT, NULL)
         change_integer_list (bandwidth_vlc, bandwidth_user)
         change_safe ()
-    add_integer ("dvb-transmission", 0,
+    add_integer ("dvb-transmission", -1,
                  TRANSMISSION_TEXT, NULL)
         change_integer_list (transmission_vlc, transmission_user)
         change_safe ()


=====================================
modules/access/rtp/rtp.c
=====================================
@@ -539,8 +539,8 @@ error:
     "(between 96 and 127) if it can't be determined otherwise with " \
     "out-of-band mappings (SDP)" )
 
-static const char *const dynamic_pt_list[] = { "theora" };
-static const char *const dynamic_pt_list_text[] = { "Theora Encoded Video" };
+static const char *const dynamic_pt_list[] = { "", "theora" };
+static const char *const dynamic_pt_list_text[] = { N_( "Unset" ), N_( "Theora Encoded Video" ) };
 
 /*
  * Module descriptor
@@ -580,7 +580,7 @@ vlc_module_begin()
     add_integer("rtp-max-misorder", 100, RTP_MAX_MISORDER_TEXT,
                 RTP_MAX_MISORDER_LONGTEXT)
         change_integer_range (0, 32767)
-    add_string("rtp-dynamic-pt", NULL, RTP_DYNAMIC_PT_TEXT,
+    add_string("rtp-dynamic-pt", "", RTP_DYNAMIC_PT_TEXT,
                RTP_DYNAMIC_PT_LONGTEXT)
         change_string_list(dynamic_pt_list, dynamic_pt_list_text)
 


=====================================
modules/audio_filter/channel_mixer/mono.c
=====================================
@@ -82,9 +82,10 @@ typedef struct
 #define MONO_CHANNEL_LONGTEXT N_("This option silences all other channels " \
     "except the selected channel.")
 
-static const int pi_pos_values[] = { 0, 1, 4, 5, 7, 8, 2, 3, 6 };
+static const int pi_pos_values[] = { -1, 0, 1, 4, 5, 7, 8, 2, 3, 6 };
 static const char *const ppsz_pos_descriptions[] =
-{ N_("Left"), N_("Right"),
+{ N_("Stereo mix"),
+  N_("Left"), N_("Right"),
   N_("Rear left"), N_("Rear right"),
   N_("Center"), N_("Low-frequency effects"),
   N_("Side left"), N_("Side right"), N_("Rear center") };


=====================================
modules/codec/svg.c
=====================================
@@ -66,10 +66,10 @@ vlc_module_begin ()
     add_shortcut( "svg" )
 
     /* svg options */
-    add_integer_with_range( "svg-width", -1, 1, 65535,
+    add_integer_with_range( "svg-width", -1, -1, 65535,
                             TEXT_WIDTH, LONG_TEXT_WIDTH )
         change_safe()
-    add_integer_with_range( "svg-height", -1, 1, 65535,
+    add_integer_with_range( "svg-height", -1, -1, 65535,
                             TEXT_HEIGHT, LONG_TEXT_HEIGHT )
         change_safe()
 


=====================================
modules/services_discovery/upnp.cpp
=====================================
@@ -72,7 +72,7 @@ const char* SATIP_SERVER_DEVICE_TYPE = "urn:ses-com:device:SatIPServer:1";
 #define URL_LONGTEXT N_("The Url used to get the xml descriptor of the UPnP Renderer")
 
 static const char *const ppsz_satip_channel_lists[] = {
-    "Auto", "ASTRA_19_2E", "ASTRA_28_2E", "ASTRA_23_5E", "MasterList", "ServerList", "CustomList"
+    "auto", "ASTRA_19_2E", "ASTRA_28_2E", "ASTRA_23_5E", "MasterList", "ServerList", "CustomList"
 };
 static const char *const ppsz_readible_satip_channel_lists[] = {
     N_("Auto"), "Astra 19.2°E", "Astra 28.2°E", "Astra 23.5°E", N_("SAT>IP Main List"), N_("Device List"), N_("Custom List")
@@ -647,12 +647,20 @@ MediaServerList::parseSatipServer( IXML_Element* p_device_element, const char *p
     SD::MediaServerDesc* p_server = NULL;
 
     char *psz_satip_channellist = config_GetPsz("satip-channelist");
-    if( !psz_satip_channellist ) {
-        psz_satip_channellist = strdup("Auto");
-    }
 
-    if( unlikely( !psz_satip_channellist ) )
-        return;
+    /* In Auto mode, default to MasterList list from satip.info */
+    bool automode = false;
+    if( !psz_satip_channellist || /* On lookup failure or empty string, use auto mode */
+        strcmp(psz_satip_channellist, "auto") == 0 ||
+        strcmp(psz_satip_channellist, "Auto") == 0 ) /* for backwards compatibility */
+    {
+        automode = true;
+        if( psz_satip_channellist )
+            free(psz_satip_channellist);
+        psz_satip_channellist = strdup( "MasterList" );
+        if( unlikely( !psz_satip_channellist ) )
+            return;
+    }
 
     vlc_url_t url;
     vlc_UrlParse( &url, psz_base_url );
@@ -681,8 +689,7 @@ MediaServerList::parseSatipServer( IXML_Element* p_device_element, const char *p
 
     /* Part 2: device playlist
      * In Automatic mode, or if requested by the user, check for a SAT>IP m3u list on the device */
-    if (strcmp(psz_satip_channellist, "ServerList") == 0 ||
-        strcmp(psz_satip_channellist, "Auto") == 0 ) {
+    if (automode || strcmp(psz_satip_channellist, "ServerList") == 0) {
         const char* psz_m3u_url = xml_getChildElementValue( p_device_element, "satip:X_SATIPM3U" );
         if ( psz_m3u_url ) {
             if ( strncmp( "http", psz_m3u_url, 4) )
@@ -712,7 +719,7 @@ MediaServerList::parseSatipServer( IXML_Element* p_device_element, const char *p
             msg_Dbg( m_sd, "SAT>IP server '%s' did not provide a playlist", url.psz_host);
         }
 
-        if(strcmp(psz_satip_channellist, "ServerList") == 0) {
+        if (!automode) {
             /* to comply with the SAT>IP specifications, we don't fallback on another channel list if this path failed,
              * but in Automatic mode, we continue */
             free(psz_satip_channellist);
@@ -726,12 +733,6 @@ MediaServerList::parseSatipServer( IXML_Element* p_device_element, const char *p
      * which will be processed by a lua script a bit later, to make it work sanely
      * MasterList is a list of usual Satellites */
 
-    /* In Auto mode, default to MasterList list from satip.info */
-    if( strcmp(psz_satip_channellist, "Auto") == 0 ) {
-        free(psz_satip_channellist);
-        psz_satip_channellist = strdup( "MasterList" );
-    }
-
     char *psz_url;
     if (asprintf( &psz_url, "http://www.satip.info/Playlists/%s.m3u",
                 psz_satip_channellist ) < 0 ) {


=====================================
modules/visualization/visual/visual.c
=====================================
@@ -126,7 +126,7 @@ vlc_module_begin ()
              WIDTH_TEXT, WIDTH_LONGTEXT )
     add_integer("effect-height" , VOUT_HEIGHT ,
              HEIGHT_TEXT, HEIGHT_LONGTEXT )
-    add_string("effect-fft-window", "flat",
+    add_string("effect-fft-window", "none",
             FFT_WINDOW_TEXT, FFT_WINDOW_LONGTEXT )
         change_string_list( window_list, window_list_text )
     add_float("effect-kaiser-param", 3.0f,



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/84b2364575db5970e78489452f609118aeef8ada...94fb7feb01ff8e604c26b456137ccd34220e6df4

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/84b2364575db5970e78489452f609118aeef8ada...94fb7feb01ff8e604c26b456137ccd34220e6df4
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list