[dvblast-devel] Add support for build DVBlast for Mac OS X.

Georgi Chorbadzhiyski git at videolan.org
Sat Aug 25 01:08:37 CEST 2012


dvblast | branch: master | Georgi Chorbadzhiyski <gf at unixsol.org> | Thu Aug 23 21:12:11 2012 +0300| [17037df60a214a76c244b17eef3905901df714d2] | committer: Georgi Chorbadzhiyski

Add support for build DVBlast for Mac OS X.

> http://git.videolan.org/gitweb.cgi/dvblast.git/?a=commit;h=17037df60a214a76c244b17eef3905901df714d2
---

 Makefile |    8 ++++++++
 config.h |   10 ++++++++++
 output.c |    4 ++--
 udp.c    |    8 +++++++-
 4 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 2bb0096..336f663 100644
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,7 @@ VERSION_MAJOR = 2
 VERSION_MINOR = 2
 TOPDIR = `basename ${PWD}`
 GIT_VER = $(shell git describe --tags --dirty --always 2>/dev/null)
+uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
 
 CFLAGS += -Wall -Wformat-security -O3 -fomit-frame-pointer
 CFLAGS += -g
@@ -13,7 +14,14 @@ CFLAGS += -DVERSION_EXTRA=\"git-$(GIT_VER)\"
 else
 CFLAGS += -DVERSION_EXTRA=\"release\"
 endif
+
+ifeq ($(uname_S),Linux)
 LDLIBS += -lrt
+endif
+ifeq ($(uname_S),Darwin)
+LDLIBS += -liconv
+endif
+
 LDLIBS_DVBLAST += -lpthread
 
 OBJ_DVBLAST = dvblast.o util.o dvb.o udp.o asi.o demux.o output.o en50221.o comm.o mrtg-cnt.o
diff --git a/config.h b/config.h
index 6ed1e32..8a009af 100644
--- a/config.h
+++ b/config.h
@@ -48,4 +48,14 @@
 #define DEFAULT_FRONTEND_TIMEOUT 30000000 /* 30 s */
 #define EXIT_STATUS_FRONTEND_TIMEOUT 100
 
+// Compatability defines
+#if defined(__APPLE__)
+#define ip_mreqn ip_mreq
+#endif
+
+#ifndef IPV6_ADD_MEMBERSHIP
+#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
+#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
+#endif
+
 #endif
diff --git a/output.c b/output.c
index 0cc5bf7..b0b0ebb 100644
--- a/output.c
+++ b/output.c
@@ -175,7 +175,7 @@ int output_Init( output_t *p_output, const output_config_t *p_config )
     {
         struct sockaddr_in6 *p_addr =
             (struct sockaddr_in6 *)&p_output->config.connect_addr;
-        if ( IN6_IS_ADDR_MULTICAST( p_addr->sin6_addr.s6_addr ) )
+        if ( IN6_IS_ADDR_MULTICAST( &p_addr->sin6_addr ) )
             setsockopt( p_output->i_handle, IPPROTO_IPV6,
                         IPV6_MULTICAST_IF, (void *)&p_config->i_if_index_v6,
                         sizeof(p_config->i_if_index_v6) );
@@ -435,7 +435,7 @@ void output_Change( output_t *p_output, const output_config_t *p_config )
         {
             struct sockaddr_in6 *p_addr =
                 (struct sockaddr_in6 *)&p_output->config.connect_addr;
-            if ( IN6_IS_ADDR_MULTICAST( p_addr->sin6_addr.s6_addr ) )
+            if ( IN6_IS_ADDR_MULTICAST( &p_addr->sin6_addr ) )
                 setsockopt( p_output->i_handle, IPPROTO_IPV6,
                             IPV6_MULTICAST_HOPS, (void *)&p_config->i_ttl,
                             sizeof(p_config->i_ttl) );
diff --git a/udp.c b/udp.c
index 92f69b8..fd5a7e0 100644
--- a/udp.c
+++ b/udp.c
@@ -162,7 +162,7 @@ void udp_Open( void )
     {
         struct sockaddr_in6 *p_addr =
             (struct sockaddr_in6 *)p_bind_ai->ai_addr;
-        if ( IN6_IS_ADDR_MULTICAST( p_addr->sin6_addr.s6_addr ) )
+        if ( IN6_IS_ADDR_MULTICAST( &p_addr->sin6_addr ) )
         {
             struct ipv6_mreq imr;
             imr.ipv6mr_multiaddr = p_addr->sin6_addr;
@@ -184,6 +184,9 @@ void udp_Open( void )
         {
             if ( p_connect_ai != NULL )
             {
+#ifndef IP_ADD_SOURCE_MEMBERSHIP
+                msg_Err( NULL, "IP_ADD_SOURCE_MEMBERSHIP is unsupported." );
+#else
                 /* Source-specific multicast */
                 struct sockaddr_in *p_src =
                     (struct sockaddr_in *)&p_connect_ai->ai_addr;
@@ -198,14 +201,17 @@ void udp_Open( void )
                             (char *)&imr, sizeof(struct ip_mreq_source) ) < 0 )
                     msg_Warn( NULL, "couldn't join multicast group (%s)",
                               strerror(errno) );
+#endif
             }
             else if ( i_if_index )
             {
                 /* Linux-specific interface-bound multicast */
                 struct ip_mreqn imr;
                 imr.imr_multiaddr = p_addr->sin_addr;
+#if defined(__linux__)
                 imr.imr_address.s_addr = i_if_addr;
                 imr.imr_ifindex = i_if_index;
+#endif
 
                 if ( setsockopt( i_handle, IPPROTO_IP, IP_ADD_MEMBERSHIP,
                                  (char *)&imr, sizeof(struct ip_mreqn) ) < 0 )



More information about the dvblast-devel mailing list