aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2010-01-21 15:42:05 +0000
committerRonald S. Bultje <rsbultje@gmail.com>2010-01-21 15:42:05 +0000
commitb4d68544c8d684ec80864705f7b1e2abfc319575 (patch)
tree940c9880f1de7a78a665d892763455ed067a94d2
parente9e949cf74391a00751ddec83197bb019b203bd2 (diff)
downloadffmpeg-b4d68544c8d684ec80864705f7b1e2abfc319575.tar.gz
Remove IPv4-only codepath. Patch by Martin Storsjö <$first $first st>.
Originally committed as revision 21365 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rwxr-xr-xconfigure26
-rw-r--r--libavformat/udp.c57
2 files changed, 11 insertions, 72 deletions
diff --git a/configure b/configure
index 7dfc6db8dc..55402902e8 100755
--- a/configure
+++ b/configure
@@ -92,7 +92,6 @@ Configuration options:
--enable-w32threads use Win32 threads [no]
--enable-x11grab enable X11 grabbing [no]
--disable-network disable network support [no]
- --disable-ipv6 disable IPv6 support [no]
--disable-mpegaudio-hp faster (but less accurate) MPEG audio decoding [no]
--enable-gray enable full grayscale support (slower color)
--disable-swscale-alpha disable alpha channel support in swscale
@@ -877,7 +876,6 @@ CONFIG_LIST="
gprof
gray
hardcoded_tables
- ipv6
libdc1394
libdirac
libfaac
@@ -1034,6 +1032,8 @@ HAVE_LIST="
soundcard_h
poll_h
struct_addrinfo
+ struct_ipv6_mreq
+ struct_sockaddr_in6
struct_sockaddr_sa_len
struct_sockaddr_storage
sys_mman_h
@@ -1396,7 +1396,6 @@ enable fastdiv
enable ffmpeg
enable ffplay
enable ffserver
-enable ipv6
enable mpegaudio_hp
enable network
enable optimizations
@@ -2511,6 +2510,8 @@ texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
if enabled network; then
check_type "sys/types.h sys/socket.h" socklen_t
check_type netdb.h "struct addrinfo"
+ check_type netinet/in.h "struct ipv6_mreq"
+ check_type netinet/in.h "struct sockaddr_in6"
check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
# Prefer arpa/inet.h over winsock2
@@ -2523,6 +2524,8 @@ if enabled network; then
network_extralibs="-lws2_32"; }
check_type ws2tcpip.h socklen_t
check_type ws2tcpip.h "struct addrinfo"
+ check_type ws2tcpip.h "struct ipv6_mreq"
+ check_type ws2tcpip.h "struct sockaddr_in6"
check_type ws2tcpip.h "struct sockaddr_storage"
check_struct winsock2.h "struct sockaddr" sa_len
else
@@ -2530,20 +2533,6 @@ if enabled network; then
fi
fi
-enabled_all network ipv6 && check_ld <<EOF || disable ipv6
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-int main(void) {
- struct sockaddr_storage saddr;
- struct ipv6_mreq mreq6;
- getaddrinfo(0,0,0,0);
- getnameinfo(0,0,0,0,0,0,0);
- IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
-}
-EOF
-
check_header linux/videodev.h
check_header linux/videodev2.h
check_header sys/videoio.h
@@ -2752,9 +2741,6 @@ echo "postprocessing support ${postproc-no}"
echo "new filter support ${avfilter-no}"
echo "filters using lavformat ${avfilter_lavf-no}"
echo "network support ${network-no}"
-if enabled network; then
- echo "IPv6 support ${ipv6-no}"
-fi
echo "threading support ${thread_type-no}"
echo "SDL support ${sdl-no}"
echo "Sun medialib support ${mlib-no}"
diff --git a/libavformat/udp.c b/libavformat/udp.c
index a89de0080a..c9560564e8 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -52,11 +52,7 @@ typedef struct {
int is_multicast;
int local_port;
int reuse_socket;
-#if !CONFIG_IPV6
- struct sockaddr_in dest_addr;
-#else
struct sockaddr_storage dest_addr;
-#endif
int dest_addr_len;
} UDPContext;
@@ -72,7 +68,7 @@ static int udp_set_multicast_ttl(int sockfd, int mcastTTL, struct sockaddr *addr
}
}
#endif
-#if CONFIG_IPV6
+#if defined(IPPROTO_IPV6) && defined(IPV6_MULTICAST_HOPS)
if (addr->sa_family == AF_INET6) {
if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &mcastTTL, sizeof(mcastTTL)) < 0) {
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) {
}
}
#endif
-#if CONFIG_IPV6
+#if HAVE_STRUCT_IPV6_MREQ
if (addr->sa_family == AF_INET6) {
struct ipv6_mreq mreq6;
@@ -124,7 +120,7 @@ static int udp_leave_multicast_group(int sockfd, struct sockaddr *addr) {
}
}
#endif
-#if CONFIG_IPV6
+#if HAVE_STRUCT_IPV6_MREQ
if (addr->sa_family == AF_INET6) {
struct ipv6_mreq mreq6;
@@ -139,7 +135,6 @@ static int udp_leave_multicast_group(int sockfd, struct sockaddr *addr) {
return 0;
}
-#if CONFIG_IPV6
static struct addrinfo* udp_ipv6_resolve_host(const char *hostname, int port, int type, int family, int flags) {
struct addrinfo hints, *res = 0;
int error;
@@ -182,9 +177,11 @@ static int is_multicast_address(struct sockaddr_storage *addr)
if (addr->ss_family == AF_INET) {
return IN_MULTICAST(ntohl(((struct sockaddr_in *)addr)->sin_addr.s_addr));
}
+#if HAVE_STRUCT_SOCKADDR_IN6
if (addr->ss_family == AF_INET6) {
return IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6 *)addr)->sin6_addr);
}
+#endif
return 0;
}
@@ -236,46 +233,6 @@ static int udp_port(struct sockaddr_storage *addr, int addr_len)
return strtol(sbuf, NULL, 10);
}
-#else
-
-static int udp_set_url(struct sockaddr_in *addr, const char *hostname, int port)
-{
- /* set the destination address */
- if (resolve_host(&addr->sin_addr, hostname) < 0)
- return AVERROR(EIO);
- addr->sin_family = AF_INET;
- addr->sin_port = htons(port);
-
- return sizeof(struct sockaddr_in);
-}
-
-static int is_multicast_address(struct sockaddr_in *addr)
-{
- return IN_MULTICAST(ntohl(addr->sin_addr.s_addr));
-}
-
-static int udp_socket_create(UDPContext *s, struct sockaddr_in *addr, int *addr_len)
-{
- int fd;
-
- fd = socket(AF_INET, SOCK_DGRAM, 0);
- if (fd < 0)
- return -1;
-
- addr->sin_family = AF_INET;
- addr->sin_addr.s_addr = htonl (INADDR_ANY);
- addr->sin_port = htons(s->local_port);
- *addr_len = sizeof(struct sockaddr_in);
-
- return fd;
-}
-
-static int udp_port(struct sockaddr_in *addr, int len)
-{
- return ntohs(addr->sin_port);
-}
-#endif /* CONFIG_IPV6 */
-
/**
* 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)
int is_output;
const char *p;
char buf[256];
-#if !CONFIG_IPV6
- struct sockaddr_in my_addr;
-#else
struct sockaddr_storage my_addr;
-#endif
int len;
h->is_streamed = 1;