]> git.sesse.net Git - vlc/commitdiff
* ipv4.c, libvlc.h: add a --ttl option to set time-to-live when
authorEric Petit <titer@videolan.org>
Tue, 18 Feb 2003 18:33:44 +0000 (18:33 +0000)
committerEric Petit <titer@videolan.org>
Tue, 18 Feb 2003 18:33:44 +0000 (18:33 +0000)
                     multicasting with the stream output
 * modules/control/: missing cvsignore

modules/control/.cvsignore [new file with mode: 0644]
modules/misc/network/ipv4.c
src/libvlc.h

diff --git a/modules/control/.cvsignore b/modules/control/.cvsignore
new file mode 100644 (file)
index 0000000..84c4d6f
--- /dev/null
@@ -0,0 +1,6 @@
+.deps
+.dirstamp
+*.dll
+*.dylib
+*.sl
+*.so
index 94a5111e172958054c4ce3577456ff936539f089..f344eb5a2339ad1ac754d75a3a858de4260b33f8 100644 (file)
@@ -2,7 +2,7 @@
  * ipv4.c: IPv4 network abstraction layer
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: ipv4.c,v 1.13 2003/01/23 15:53:10 sam Exp $
+ * $Id: ipv4.c,v 1.14 2003/02/18 18:33:44 titer Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Mathias Kretschmer <mathias@research.att.com>
@@ -372,6 +372,35 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket )
 #endif
             return( -1 );
         }
+
+#ifndef WIN32
+        if( IN_MULTICAST( ntohl(sock.sin_addr.s_addr) ) )
+#else
+        if( IN_MULTICAST( ntohl(inet_addr(psz_server_addr) ) ) )
+#endif
+        {
+            /* set the time-to-live */
+            int ttl = config_GetInt( p_this, "ttl" );
+            if( ttl < 1 )
+                ttl = 1;
+
+            if( setsockopt( i_handle, IPPROTO_IP, IP_MULTICAST_TTL,
+                            &ttl, sizeof( ttl ) ) < 0 )
+            {
+#ifdef HAVE_ERRNO_H
+                msg_Warn( p_this, "failed to set ttl (%s)",
+                          strerror(errno) );
+#else
+                msg_Warn( p_this, "failed to set ttl" );
+#endif
+#if defined( WIN32 ) || defined( UNDER_CE )
+                closesocket( i_handle );
+#else
+                close( i_handle );
+#endif
+                return( -1 );
+            }
+        }
     }
 
     p_socket->i_handle = i_handle;
index 2bf3552b44bcb0f8073b8824f2de54470f21df85..a8367e977ac7305710793d2d1f4c06e19927c6fd 100644 (file)
@@ -2,7 +2,7 @@
  * libvlc.h: main libvlc header
  *****************************************************************************
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: libvlc.h,v 1.42 2003/02/09 01:13:43 massiot Exp $
+ * $Id: libvlc.h,v 1.43 2003/02/18 18:33:44 titer Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -224,6 +224,11 @@ static char *ppsz_sout_vcodec[] = { "", "mpeg1", "mpeg2", "mpeg4", NULL };
     "multicast solution, you will probably have to indicate the IP address " \
     "of your multicasting interface here.")
 
+#define TTL_TEXT N_("time to live")
+#define TTL_LONGTEXT N_( \
+    "Indicate here the Time To Live of the multicast packets sent by " \
+    "the stream output.")
+
 #define INPUT_PROGRAM_TEXT N_("choose program (SID)")
 #define INPUT_PROGRAM_LONGTEXT N_( \
     "Choose the program to select by giving its Service ID.")
@@ -491,6 +496,7 @@ vlc_module_begin();
     add_string( "iface", "eth0", NULL, IFACE_TEXT, IFACE_LONGTEXT );
 #endif
     add_string( "iface-addr", "", NULL, IFACE_ADDR_TEXT, IFACE_ADDR_LONGTEXT );
+    add_integer( "ttl", 1, NULL, TTL_TEXT, TTL_LONGTEXT );
 
     add_integer( "program", 0, NULL,
                  INPUT_PROGRAM_TEXT, INPUT_PROGRAM_LONGTEXT );