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
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 )
{
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 )