Browse code

Remove IPv4-only codepath. Patch by Martin Storsjö <$first $first st>.

Originally committed as revision 21365 to svn://svn.ffmpeg.org/ffmpeg/trunk

Martin Storsjö authored on 2010/01/22 00:42:05
Showing 2 changed files
... ...
@@ -92,7 +92,6 @@ Configuration options:
92 92
   --enable-w32threads      use Win32 threads [no]
93 93
   --enable-x11grab         enable X11 grabbing [no]
94 94
   --disable-network        disable network support [no]
95
-  --disable-ipv6           disable IPv6 support [no]
96 95
   --disable-mpegaudio-hp   faster (but less accurate) MPEG audio decoding [no]
97 96
   --enable-gray            enable full grayscale support (slower color)
98 97
   --disable-swscale-alpha  disable alpha channel support in swscale
... ...
@@ -877,7 +876,6 @@ CONFIG_LIST="
877 877
     gprof
878 878
     gray
879 879
     hardcoded_tables
880
-    ipv6
881 880
     libdc1394
882 881
     libdirac
883 882
     libfaac
... ...
@@ -1034,6 +1032,8 @@ HAVE_LIST="
1034 1034
     soundcard_h
1035 1035
     poll_h
1036 1036
     struct_addrinfo
1037
+    struct_ipv6_mreq
1038
+    struct_sockaddr_in6
1037 1039
     struct_sockaddr_sa_len
1038 1040
     struct_sockaddr_storage
1039 1041
     sys_mman_h
... ...
@@ -1396,7 +1396,6 @@ enable fastdiv
1396 1396
 enable ffmpeg
1397 1397
 enable ffplay
1398 1398
 enable ffserver
1399
-enable ipv6
1400 1399
 enable mpegaudio_hp
1401 1400
 enable network
1402 1401
 enable optimizations
... ...
@@ -2511,6 +2510,8 @@ texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
2511 2511
 if enabled network; then
2512 2512
     check_type "sys/types.h sys/socket.h" socklen_t
2513 2513
     check_type netdb.h "struct addrinfo"
2514
+    check_type netinet/in.h "struct ipv6_mreq"
2515
+    check_type netinet/in.h "struct sockaddr_in6"
2514 2516
     check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
2515 2517
     check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
2516 2518
     # Prefer arpa/inet.h over winsock2
... ...
@@ -2523,6 +2524,8 @@ if enabled network; then
2523 2523
             network_extralibs="-lws2_32"; }
2524 2524
         check_type ws2tcpip.h socklen_t
2525 2525
         check_type ws2tcpip.h "struct addrinfo"
2526
+        check_type ws2tcpip.h "struct ipv6_mreq"
2527
+        check_type ws2tcpip.h "struct sockaddr_in6"
2526 2528
         check_type ws2tcpip.h "struct sockaddr_storage"
2527 2529
         check_struct winsock2.h "struct sockaddr" sa_len
2528 2530
     else
... ...
@@ -2530,20 +2533,6 @@ if enabled network; then
2530 2530
     fi
2531 2531
 fi
2532 2532
 
2533
-enabled_all network ipv6 && check_ld <<EOF || disable ipv6
2534
-#include <sys/types.h>
2535
-#include <sys/socket.h>
2536
-#include <netinet/in.h>
2537
-#include <netdb.h>
2538
-int main(void) {
2539
-    struct sockaddr_storage saddr;
2540
-    struct ipv6_mreq mreq6;
2541
-    getaddrinfo(0,0,0,0);
2542
-    getnameinfo(0,0,0,0,0,0,0);
2543
-    IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
2544
-}
2545
-EOF
2546
-
2547 2533
 check_header linux/videodev.h
2548 2534
 check_header linux/videodev2.h
2549 2535
 check_header sys/videoio.h
... ...
@@ -2752,9 +2741,6 @@ echo "postprocessing support    ${postproc-no}"
2752 2752
 echo "new filter support        ${avfilter-no}"
2753 2753
 echo "filters using lavformat   ${avfilter_lavf-no}"
2754 2754
 echo "network support           ${network-no}"
2755
-if enabled network; then
2756
-    echo "IPv6 support              ${ipv6-no}"
2757
-fi
2758 2755
 echo "threading support         ${thread_type-no}"
2759 2756
 echo "SDL support               ${sdl-no}"
2760 2757
 echo "Sun medialib support      ${mlib-no}"
... ...
@@ -52,11 +52,7 @@ typedef struct {
52 52
     int is_multicast;
53 53
     int local_port;
54 54
     int reuse_socket;
55
-#if !CONFIG_IPV6
56
-    struct sockaddr_in dest_addr;
57
-#else
58 55
     struct sockaddr_storage dest_addr;
59
-#endif
60 56
     int dest_addr_len;
61 57
 } UDPContext;
62 58
 
... ...
@@ -72,7 +68,7 @@ static int udp_set_multicast_ttl(int sockfd, int mcastTTL, struct sockaddr *addr
72 72
         }
73 73
     }
74 74
 #endif
75
-#if CONFIG_IPV6
75
+#if defined(IPPROTO_IPV6) && defined(IPV6_MULTICAST_HOPS)
76 76
     if (addr->sa_family == AF_INET6) {
77 77
         if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &mcastTTL, sizeof(mcastTTL)) < 0) {
78 78
             av_log(NULL, AV_LOG_ERROR, "setsockopt(IPV6_MULTICAST_HOPS): %s\n", strerror(errno));
... ...
@@ -96,7 +92,7 @@ static int udp_join_multicast_group(int sockfd, struct sockaddr *addr) {
96 96
         }
97 97
     }
98 98
 #endif
99
-#if CONFIG_IPV6
99
+#if HAVE_STRUCT_IPV6_MREQ
100 100
     if (addr->sa_family == AF_INET6) {
101 101
         struct ipv6_mreq mreq6;
102 102
 
... ...
@@ -124,7 +120,7 @@ static int udp_leave_multicast_group(int sockfd, struct sockaddr *addr) {
124 124
         }
125 125
     }
126 126
 #endif
127
-#if CONFIG_IPV6
127
+#if HAVE_STRUCT_IPV6_MREQ
128 128
     if (addr->sa_family == AF_INET6) {
129 129
         struct ipv6_mreq mreq6;
130 130
 
... ...
@@ -139,7 +135,6 @@ static int udp_leave_multicast_group(int sockfd, struct sockaddr *addr) {
139 139
     return 0;
140 140
 }
141 141
 
142
-#if CONFIG_IPV6
143 142
 static struct addrinfo* udp_ipv6_resolve_host(const char *hostname, int port, int type, int family, int flags) {
144 143
     struct addrinfo hints, *res = 0;
145 144
     int error;
... ...
@@ -182,9 +177,11 @@ static int is_multicast_address(struct sockaddr_storage *addr)
182 182
     if (addr->ss_family == AF_INET) {
183 183
         return IN_MULTICAST(ntohl(((struct sockaddr_in *)addr)->sin_addr.s_addr));
184 184
     }
185
+#if HAVE_STRUCT_SOCKADDR_IN6
185 186
     if (addr->ss_family == AF_INET6) {
186 187
         return IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6 *)addr)->sin6_addr);
187 188
     }
189
+#endif
188 190
 
189 191
     return 0;
190 192
 }
... ...
@@ -236,46 +233,6 @@ static int udp_port(struct sockaddr_storage *addr, int addr_len)
236 236
     return strtol(sbuf, NULL, 10);
237 237
 }
238 238
 
239
-#else
240
-
241
-static int udp_set_url(struct sockaddr_in *addr, const char *hostname, int port)
242
-{
243
-    /* set the destination address */
244
-    if (resolve_host(&addr->sin_addr, hostname) < 0)
245
-        return AVERROR(EIO);
246
-    addr->sin_family = AF_INET;
247
-    addr->sin_port = htons(port);
248
-
249
-    return sizeof(struct sockaddr_in);
250
-}
251
-
252
-static int is_multicast_address(struct sockaddr_in *addr)
253
-{
254
-    return IN_MULTICAST(ntohl(addr->sin_addr.s_addr));
255
-}
256
-
257
-static int udp_socket_create(UDPContext *s, struct sockaddr_in *addr, int *addr_len)
258
-{
259
-    int fd;
260
-
261
-    fd = socket(AF_INET, SOCK_DGRAM, 0);
262
-    if (fd < 0)
263
-        return -1;
264
-
265
-    addr->sin_family = AF_INET;
266
-    addr->sin_addr.s_addr = htonl (INADDR_ANY);
267
-    addr->sin_port = htons(s->local_port);
268
-    *addr_len = sizeof(struct sockaddr_in);
269
-
270
-    return fd;
271
-}
272
-
273
-static int udp_port(struct sockaddr_in *addr, int len)
274
-{
275
-    return ntohs(addr->sin_port);
276
-}
277
-#endif /* CONFIG_IPV6 */
278
-
279 239
 
280 240
 /**
281 241
  * If no filename is given to av_open_input_file because you want to
... ...
@@ -345,11 +302,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
345 345
     int is_output;
346 346
     const char *p;
347 347
     char buf[256];
348
-#if !CONFIG_IPV6
349
-    struct sockaddr_in my_addr;
350
-#else
351 348
     struct sockaddr_storage my_addr;
352
-#endif
353 349
     int len;
354 350
 
355 351
     h->is_streamed = 1;