[vlc-devel] commit: Set the DCCP service code properly. ( Rémi Denis-Courmont )

git version control git at videolan.org
Mon Mar 3 01:08:09 CET 2008


vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Sun Mar  2 21:01:43 2008 +0200| [34e5415cca2b4e90c215e79fcbf2b066fa15f294]

Set the DCCP service code properly.

Assume RTP converys video (which is fine for MPEG-TS), as we cannot
know if it's only audio anyway.

Signed-off-by: Rémi Denis-Courmont <rem at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=34e5415cca2b4e90c215e79fcbf2b066fa15f294
---

 modules/access/udp.c |    2 ++
 src/network/io.c     |   16 ++++++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/modules/access/udp.c b/modules/access/udp.c
index c99176c..790ab79 100644
--- a/modules/access/udp.c
+++ b/modules/access/udp.c
@@ -232,6 +232,8 @@ static int Open( vlc_object_t *p_this )
 
         case IPPROTO_DCCP:
 #ifdef SOCK_DCCP
+            var_Create( p_access, "dccp-service", VLC_VAR_STRING );
+            var_SetString( p_access, "dccp-service", "RTPV" );
             p_sys->fd = net_Connect( p_access, psz_server_addr, i_server_port,
                                      SOCK_DCCP, IPPROTO_DCCP );
 #else
diff --git a/src/network/io.c b/src/network/io.c
index fee2d9f..905f605 100644
--- a/src/network/io.c
+++ b/src/network/io.c
@@ -68,6 +68,12 @@
 # define EAFNOSUPPORT WSAEAFNOSUPPORT
 #endif
 
+#ifdef HAVE_LINUX_DCCP_H
+/* TODO: use glibc instead of linux-kernel headers */
+# include <linux/dccp.h>
+# define SOL_DCCP 269
+#endif
+
 extern int rootwrap_bind (int family, int socktype, int protocol,
                           const struct sockaddr *addr, size_t alen);
 
@@ -118,6 +124,16 @@ int net_Socket (vlc_object_t *p_this, int family, int socktype,
                     &(int){ PROTECTION_LEVEL_UNRESTRICTED }, sizeof (int));
 #endif
 
+#ifdef DCCP_SOCKOPT_SERVICE
+    char *dccps = var_CreateGetNonEmptyString (p_this, "dccp-service");
+    if (dccps != NULL)
+    {
+        setsockopt (fd, SOL_DCCP, DCCP_SOCKOPT_SERVICE, dccps,
+                    (strlen (dccps) + 3) & ~3);
+        free (dccps);
+    }
+#endif
+
     return fd;
 }
 




More information about the vlc-devel mailing list