File: 0014-UPnP-remove-SAT-IP-channel-list-fallback.patch

package info (click to toggle)
vlc 3.0.21-10
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 212,728 kB
  • sloc: ansic: 441,379; cpp: 110,628; objc: 36,394; sh: 6,947; makefile: 6,592; javascript: 4,902; xml: 1,611; asm: 1,355; yacc: 640; python: 555; lex: 88; perl: 77; sed: 16
file content (194 lines) | stat: -rw-r--r-- 8,263 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
From: =?utf-8?q?Felix_Paul_K=C3=BChne?= <fkuehne@videolan.org>
Date: Thu, 4 Jul 2024 06:29:28 +0200
Subject: UPnP: remove SAT>IP channel list fallback

When introducing SAT>IP support, we added a fallback mechanism on
officially published channel lists in case the user neither specified
a custom list nor the used set-top box provided one.

With the end of the SAT>IP Alliance that was dissolved 3 years ago, the
fallback server is no longer available and there will be no replacement
so this feature was removed.

Fixes #28684

(cherry picked from commit 3df7b6e1187030591febd8e1bdd2712c0d6af132)
---
 modules/services_discovery/upnp.cpp | 125 +++++++++---------------------------
 1 file changed, 31 insertions(+), 94 deletions(-)

diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
index 428aeff..8b021af 100644
--- a/modules/services_discovery/upnp.cpp
+++ b/modules/services_discovery/upnp.cpp
@@ -73,14 +73,7 @@ const char* MEDIA_SERVER_DEVICE_TYPE = "urn:schemas-upnp-org:device:MediaServer:
 const char* CONTENT_DIRECTORY_SERVICE_TYPE = "urn:schemas-upnp-org:service:ContentDirectory:1";
 const char* SATIP_SERVER_DEVICE_TYPE = "urn:ses-com:device:SatIPServer:1";
 
-#define SATIP_CHANNEL_LIST N_("SAT>IP channel list")
 #define SATIP_CHANNEL_LIST_URL N_("Custom SAT>IP channel list URL")
-static const char *const ppsz_satip_channel_lists[] = {
-    "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_("Master List"), N_("Server List"), N_("Custom List")
-};
 
 /*
  * VLC handle
@@ -128,9 +121,7 @@ vlc_module_begin()
     set_capability( "services_discovery", 0 );
     set_callbacks( SD::Open, SD::Close );
 
-    add_string( "satip-channelist", "auto", SATIP_CHANNEL_LIST,
-                SATIP_CHANNEL_LIST, false )
-    change_string_list( ppsz_satip_channel_lists, ppsz_readible_satip_channel_lists )
+    add_obsolete_string( "satip-channelist" ) /* since 3.0.22 */
     add_string( "satip-channellist-url", NULL, SATIP_CHANNEL_LIST_URL,
                 SATIP_CHANNEL_LIST_URL, false )
 
@@ -606,114 +597,60 @@ MediaServerList::parseSatipServer( IXML_Element* p_device_element, const char *p
 {
     SD::MediaServerDesc* p_server = NULL;
 
-    char *psz_satip_channellist = var_InheritString( m_sd, "satip-channelist");
-
-    /* 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 );
 
     /* Part 1: a user may have provided a custom playlist url */
-    if (strcmp(psz_satip_channellist, "CustomList") == 0) {
-        char *psz_satip_playlist_url = var_InheritString( m_sd, "satip-channellist-url" );
-        if ( psz_satip_playlist_url ) {
-            p_server = new(std::nothrow) SD::MediaServerDesc( psz_udn, psz_friendly_name, psz_satip_playlist_url, iconUrl );
-
-            if( likely( p_server ) ) {
-                p_server->satIpHost = url.psz_host;
-                p_server->isSatIp = true;
-                if( !addServer( p_server ) ) {
-                    delete p_server;
-                }
-            }
+    char *psz_satip_playlist_url = var_InheritString( m_sd, "satip-channellist-url" );
+    if ( psz_satip_playlist_url ) {
+        p_server = new(std::nothrow) SD::MediaServerDesc( psz_udn, psz_friendly_name, psz_satip_playlist_url, iconUrl );
 
-            /* to comply with the SAT>IP specification, we don't fall back on another channel list if this path failed */
-            free( psz_satip_channellist );
-            free( psz_satip_playlist_url );
-            vlc_UrlClean( &url );
-            return;
+        if ( likely( p_server ) ) {
+            p_server->satIpHost = url.psz_host;
+            p_server->isSatIp = true;
+            if( !addServer( p_server ) ) {
+                delete p_server;
+            }
         }
+
+        /* to comply with the SAT>IP specification, we don't fall back on another channel list if this path failed */
+        free( psz_satip_playlist_url );
+        vlc_UrlClean( &url );
+        return;
     }
 
     /* Part 2: device playlist
      * In Automatic mode, or if requested by the user, check for a SAT>IP m3u list on the device */
-    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) )
-            {
-                char* psz_url = NULL;
-                if ( UpnpResolveURL2( psz_base_url, psz_m3u_url, &psz_url ) == UPNP_E_SUCCESS )
-                {
-                    p_server = new(std::nothrow) SD::MediaServerDesc( psz_udn, psz_friendly_name, psz_url, iconUrl );
-                    free(psz_url);
-                }
-            } else {
-                p_server = new(std::nothrow) SD::MediaServerDesc( psz_udn, psz_friendly_name, psz_m3u_url, iconUrl );
-            }
-
-            if ( unlikely( !p_server ) )
+    const char* psz_m3u_url = xml_getChildElementValue( p_device_element, "satip:X_SATIPM3U" );
+    if ( psz_m3u_url ) {
+        if ( strncmp( "http", psz_m3u_url, 4) )
+        {
+            char* psz_url = NULL;
+            if ( UpnpResolveURL2( psz_base_url, psz_m3u_url, &psz_url ) == UPNP_E_SUCCESS )
             {
-                free( psz_satip_channellist );
-                vlc_UrlClean( &url );
-                return;
+                p_server = new(std::nothrow) SD::MediaServerDesc( psz_udn, psz_friendly_name, psz_url, iconUrl );
+                free(psz_url);
             }
-
-            p_server->satIpHost = url.psz_host;
-            p_server->isSatIp = true;
-            if ( !addServer( p_server ) )
-                delete p_server;
         } else {
-            msg_Dbg( m_sd, "SAT>IP server '%s' did not provide a playlist", url.psz_host);
+            p_server = new(std::nothrow) SD::MediaServerDesc( psz_udn, psz_friendly_name, psz_m3u_url, iconUrl );
         }
 
-        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);
+        if ( unlikely( !p_server ) ) {
             vlc_UrlClean( &url );
             return;
         }
-    }
-
-    /* Part 3: satip.info playlist
-     * In the normal case, fetch a playlist from the satip website,
-     * which will be processed by a lua script a bit later, to make it work sanely
-     * MasterList is a list of usual Satellites */
-
-    char *psz_url;
-    if (asprintf( &psz_url, "http://www.satip.info/Playlists/%s.m3u",
-                psz_satip_channellist ) < 0 ) {
-        vlc_UrlClean( &url );
-        free( psz_satip_channellist );
-        return;
-    }
-
-    p_server = new(std::nothrow) SD::MediaServerDesc( psz_udn,
-            psz_friendly_name, psz_url, iconUrl );
 
-    if( likely( p_server ) ) {
         p_server->satIpHost = url.psz_host;
         p_server->isSatIp = true;
-        if( !addServer( p_server ) ) {
+        if ( !addServer( p_server ) ) {
             delete p_server;
+        } else {
+            msg_Err( m_sd, "SAT>IP server '%s' did not provide a playlist", url.psz_host);
         }
+
+        /* to comply with the SAT>IP specifications, we don't fallback on another channel list if this path failed */
+        vlc_UrlClean( &url );
     }
-    free( psz_url );
-    free( psz_satip_channellist );
-    vlc_UrlClean( &url );
 }
 
 void MediaServerList::removeServer( const std::string& udn )