]> git.sesse.net Git - vlc/blobdiff - modules/access_output/udp.c
Fix rtmp access_output building
[vlc] / modules / access_output / udp.c
index 0ef2828532e445ca30ba832328e841c021b328a9..d9348ed07f98a3ba5be20db844ee133b6f504095 100644 (file)
@@ -30,6 +30,7 @@
 #endif
 
 #include <vlc/vlc.h>
+#include <vlc_plugin.h>
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -74,12 +75,9 @@ static void Close( vlc_object_t * );
                           "of packets that will be sent at a time. It " \
                           "helps reducing the scheduling load on " \
                           "heavily-loaded systems." )
-#define AUTO_MCAST_TEXT N_("Automatic multicast streaming")
-#define AUTO_MCAST_LONGTEXT N_("Allocates an outbound multicast address " \
-                               "automatically.")
 
 vlc_module_begin();
-    set_description( _("UDP stream output") );
+    set_description( N_("UDP stream output") );
     set_shortname( "UDP" );
     set_category( CAT_SOUT );
     set_subcategory( SUBCAT_SOUT_ACO );
@@ -88,8 +86,6 @@ vlc_module_begin();
                                  true );
     add_obsolete_integer( SOUT_CFG_PREFIX "late" );
     add_obsolete_bool( SOUT_CFG_PREFIX "raw" );
-    add_bool( SOUT_CFG_PREFIX "auto-mcast", false, NULL, AUTO_MCAST_TEXT,
-              AUTO_MCAST_LONGTEXT, true );
 
     set_capability( "sout access", 100 );
     add_shortcut( "udp" );
@@ -101,7 +97,6 @@ vlc_module_end();
  *****************************************************************************/
 
 static const char *const ppsz_sout_options[] = {
-    "auto-mcast",
     "caching",
     "group",
     NULL
@@ -186,25 +181,16 @@ static int Open( vlc_object_t *p_this )
     p_access->p_sys = p_sys;
 
     i_dst_port = DEFAULT_PORT;
-    if (var_GetBool (p_access, SOUT_CFG_PREFIX"auto-mcast"))
-    {
-        char buf[INET6_ADDRSTRLEN];
-        if (MakeRandMulticast (AF_INET, buf, sizeof (buf)) != NULL)
-            psz_dst_addr = strdup (buf);
-    }
-    else
-    {
-        char *psz_parser = psz_dst_addr = strdup( p_access->psz_path );
+    char *psz_parser = psz_dst_addr = strdup( p_access->psz_path );
 
-        if (psz_parser[0] == '[')
-            psz_parser = strchr (psz_parser, ']');
+    if (psz_parser[0] == '[')
+        psz_parser = strchr (psz_parser, ']');
 
-        psz_parser = strchr (psz_parser ?: psz_dst_addr, ':');
-        if (psz_parser != NULL)
-        {
-            *psz_parser++ = '\0';
-            i_dst_port = atoi (psz_parser);
-        }
+    psz_parser = strchr (psz_parser ?: psz_dst_addr, ':');
+    if (psz_parser != NULL)
+    {
+        *psz_parser++ = '\0';
+        i_dst_port = atoi (psz_parser);
     }
 
     p_sys->p_thread =
@@ -221,8 +207,8 @@ static int Open( vlc_object_t *p_this )
     p_sys->p_thread->p_sout = p_access->p_sout;
     p_sys->p_thread->b_die  = 0;
     p_sys->p_thread->b_error= 0;
-    p_sys->p_thread->p_fifo = block_FifoNew( p_access );
-    p_sys->p_thread->p_empty_blocks = block_FifoNew( p_access );
+    p_sys->p_thread->p_fifo = block_FifoNew();
+    p_sys->p_thread->p_empty_blocks = block_FifoNew();
 
     i_handle = net_ConnectDgram( p_this, psz_dst_addr, i_dst_port, -1,
                                  IPPROTO_UDP );
@@ -534,36 +520,3 @@ static void ThreadWrite( vlc_object_t *p_this )
         i_date_last = i_date;
     }
 }
-
-
-static const char *MakeRandMulticast (int family, char *buf, size_t buflen)
-{
-    uint32_t rand = (getpid() & 0xffff)
-                  | (uint32_t)(((mdate () >> 10) & 0xffff) << 16);
-
-    switch (family)
-    {
-#ifdef AF_INET6
-        case AF_INET6:
-        {
-            struct in6_addr addr;
-            memcpy (&addr, "\xff\x38\x00\x00" "\x00\x00\x00\x00"
-                           "\x00\x00\x00\x00", 12);
-            rand |= 0x80000000;
-            memcpy (addr.s6_addr + 12, &(uint32_t){ htonl (rand) }, 4);
-            return inet_ntop (family, &addr, buf, buflen);
-        }
-#endif
-
-        case AF_INET:
-        {
-            struct in_addr addr;
-            addr.s_addr = htonl ((rand & 0xffffff) | 0xe8000000);
-            return inet_ntop (family, &addr, buf, buflen);
-        }
-    }
-#ifdef EAFNOSUPPORT
-    errno = EAFNOSUPPORT;
-#endif
-    return NULL;
-}