]> git.sesse.net Git - vlc/blobdiff - modules/services_discovery/sap.c
remove useless xspf.h
[vlc] / modules / services_discovery / sap.c
index 52c3b83ae2e11f5e25f40d80e1d811e12732eaa1..dfcc39c2099ef0b92036b8874a5c554ecc1c452f 100644 (file)
 #define SAP_ADDR_LONGTEXT N_( "The SAP module normally chooses itself the " \
                               "right addresses to listen to. However, you " \
                               "can specify a specific address." )
-#define SAP_IPV4_TEXT N_( "IPv4 SAP" )
-#define SAP_IPV4_LONGTEXT N_( \
-      "Listen to IPv4 announcements on the standard addresses." )
-#define SAP_IPV6_TEXT N_( "IPv6 SAP" )
-#define SAP_IPV6_LONGTEXT N_( \
-      "Listen to IPv6 announcements on the standard addresses." )
-#define SAP_SCOPE_TEXT N_( "IPv6 SAP scope" )
-#define SAP_SCOPE_LONGTEXT N_( \
-       "Scope for IPv6 announcements (default is 8)." )
 #define SAP_TIMEOUT_TEXT N_( "SAP timeout (seconds)" )
 #define SAP_TIMEOUT_LONGTEXT N_( \
        "Delay after which SAP items get deleted if no new announcement " \
 #define SAP_STRICT_LONGTEXT N_( \
        "When this is set, the SAP parser will discard some non-compliant " \
        "announcements." )
-#define SAP_CACHE_TEXT N_("Use SAP cache")
-#define SAP_CACHE_LONGTEXT N_( \
-       "This enables a SAP caching mechanism. " \
-       "This will result in lower SAP startup time, but you could end up " \
-       "with items corresponding to legacy streams." )
 
 /* Callbacks */
     static int  Open ( vlc_object_t * );
@@ -122,22 +108,16 @@ vlc_module_begin ()
     set_category( CAT_PLAYLIST )
     set_subcategory( SUBCAT_PLAYLIST_SD )
 
-    add_string( "sap-addr", NULL, NULL,
+    add_string( "sap-addr", NULL,
                 SAP_ADDR_TEXT, SAP_ADDR_LONGTEXT, true )
-    add_bool( "sap-ipv4", true, NULL,
-               SAP_IPV4_TEXT,SAP_IPV4_LONGTEXT, true )
-    add_bool( "sap-ipv6", true, NULL,
-              SAP_IPV6_TEXT, SAP_IPV6_LONGTEXT, true )
-    add_integer( "sap-timeout", 1800, NULL,
+    add_obsolete_bool( "sap-ipv4" ) /* since 1.2.0 */
+    add_obsolete_bool( "sap-ipv6" ) /* since 1.2.0 */
+    add_integer( "sap-timeout", 1800,
                  SAP_TIMEOUT_TEXT, SAP_TIMEOUT_LONGTEXT, true )
-    add_bool( "sap-parse", true, NULL,
+    add_bool( "sap-parse", true,
                SAP_PARSE_TEXT,SAP_PARSE_LONGTEXT, true )
-    add_bool( "sap-strict", false, NULL,
+    add_bool( "sap-strict", false,
                SAP_STRICT_TEXT,SAP_STRICT_LONGTEXT, true )
-#if 0
-    add_bool( "sap-cache", false, NULL,
-               SAP_CACHE_TEXT,SAP_CACHE_LONGTEXT, true )
-#endif
     add_obsolete_bool( "sap-timeshift" ) /* Redumdant since 1.0.0 */
 
     set_capability( "services_discovery", 0 )
@@ -319,15 +299,8 @@ static int Open( vlc_object_t *p_this )
     p_sys->pi_fd = NULL;
     p_sys->i_fd = 0;
 
-    p_sys->b_strict = var_CreateGetInteger( p_sd, "sap-strict");
-    p_sys->b_parse = var_CreateGetInteger( p_sd, "sap-parse" );
-
-#if 0
-    if( var_CreateGetInteger( p_sd, "sap-cache" ) )
-    {
-        CacheLoad( p_sd );
-    }
-#endif
+    p_sys->b_strict = var_CreateGetBool( p_sd, "sap-strict");
+    p_sys->b_parse = var_CreateGetBool( p_sd, "sap-parse" );
 
     p_sys->i_announces = 0;
     p_sys->pp_announces = NULL;
@@ -353,7 +326,7 @@ static int OpenDemux( vlc_object_t *p_this )
     int errval = VLC_EGENERIC;
     size_t i_len;
 
-    if( !var_CreateGetInteger( p_demux, "sap-parse" ) )
+    if( !var_CreateGetBool( p_demux, "sap-parse" ) )
     {
         /* We want livedotcom module to parse this SDP file */
         return VLC_EGENERIC;
@@ -446,13 +419,6 @@ static void Close( vlc_object_t *p_this )
     }
     FREENULL( p_sys->pi_fd );
 
-#if 0
-    if( var_InheritBool( p_sd, "sap-cache" ) )
-    {
-        CacheSave( p_sd );
-    }
-#endif
-
     for( i = p_sys->i_announces  - 1;  i>= 0; i-- )
     {
         RemoveAnnounce( p_sd, p_sys->pp_announces[i] );
@@ -495,29 +461,24 @@ static void *Run( void *data )
      * Winsock 1.1 from Windows 95, if not Windows 3.1.
      * Anyway, to avoid a 30 seconds delay for failed IPv6 socket creation,
      * we have to open sockets in Run() rather than Open(). */
-    if( var_CreateGetInteger( p_sd, "sap-ipv4" ) )
-    {
-        InitSocket( p_sd, SAP_V4_GLOBAL_ADDRESS, SAP_PORT );
-        InitSocket( p_sd, SAP_V4_ORG_ADDRESS, SAP_PORT );
-        InitSocket( p_sd, SAP_V4_LOCAL_ADDRESS, SAP_PORT );
-        InitSocket( p_sd, SAP_V4_LINK_ADDRESS, SAP_PORT );
-    }
-    if( var_CreateGetInteger( p_sd, "sap-ipv6" ) )
-    {
-        char psz_address[NI_MAXNUMERICHOST] = "ff02::2:7ffe%";
+    InitSocket( p_sd, SAP_V4_GLOBAL_ADDRESS, SAP_PORT );
+    InitSocket( p_sd, SAP_V4_ORG_ADDRESS, SAP_PORT );
+    InitSocket( p_sd, SAP_V4_LOCAL_ADDRESS, SAP_PORT );
+    InitSocket( p_sd, SAP_V4_LINK_ADDRESS, SAP_PORT );
 
+    char psz_address[NI_MAXNUMERICHOST] = "ff02::2:7ffe%";
 #ifndef WIN32
-        struct if_nameindex *l = if_nameindex ();
-        if (l != NULL)
+    struct if_nameindex *l = if_nameindex ();
+    if (l != NULL)
+    {
+        char *ptr = strchr (psz_address, '%') + 1;
+        for (unsigned i = 0; l[i].if_index; i++)
         {
-            char *ptr = strchr (psz_address, '%') + 1;
-            for (unsigned i = 0; l[i].if_index; i++)
-            {
-                strcpy (ptr, l[i].if_name);
-                InitSocket (p_sd, psz_address, SAP_PORT);
-            }
-            if_freenameindex (l);
+            strcpy (ptr, l[i].if_name);
+            InitSocket (p_sd, psz_address, SAP_PORT);
         }
+        if_freenameindex (l);
+    }
 #else
         /* this is the Winsock2 equivalant of SIOCGIFCONF on BSD stacks,
            which if_nameindex uses internally anyway */
@@ -527,7 +488,7 @@ static void *Run( void *data )
         if( s != INVALID_SOCKET )
         {
             INTERFACE_INFO ifaces[10]; // Assume there will be no more than 10 IP interfaces
-            size_t len = sizeof(ifaces);
+            DWORD len = sizeof(ifaces);
 
             if( SOCKET_ERROR != WSAIoctl(s, SIO_GET_INTERFACE_LIST, NULL, 0, &ifaces, len, &len, NULL, NULL) )
             {
@@ -542,14 +503,13 @@ static void *Run( void *data )
             closesocket(s);
         }
 #endif
-        *strchr (psz_address, '%') = '\0';
+    *strchr (psz_address, '%') = '\0';
 
-        static const char ipv6_scopes[] = "1456789ABCDE";
-        for (const char *c_scope = ipv6_scopes; *c_scope; c_scope++)
-        {
-            psz_address[3] = *c_scope;
-            InitSocket( p_sd, psz_address, SAP_PORT );
-        }
+    static const char ipv6_scopes[] = "1456789ABCDE";
+    for (const char *c_scope = ipv6_scopes; *c_scope; c_scope++)
+    {
+        psz_address[3] = *c_scope;
+        InitSocket( p_sd, psz_address, SAP_PORT );
     }
 
     psz_addr = var_CreateGetString( p_sd, "sap-addr" );