Remove IPv4-only codepath. Patch by Martin Storsjö <$first $first st>.
Originally committed as revision 21365 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
e9e949cf74
commit
b4d68544c8
26
configure
vendored
26
configure
vendored
@ -92,7 +92,6 @@ Configuration options:
|
|||||||
--enable-w32threads use Win32 threads [no]
|
--enable-w32threads use Win32 threads [no]
|
||||||
--enable-x11grab enable X11 grabbing [no]
|
--enable-x11grab enable X11 grabbing [no]
|
||||||
--disable-network disable network support [no]
|
--disable-network disable network support [no]
|
||||||
--disable-ipv6 disable IPv6 support [no]
|
|
||||||
--disable-mpegaudio-hp faster (but less accurate) MPEG audio decoding [no]
|
--disable-mpegaudio-hp faster (but less accurate) MPEG audio decoding [no]
|
||||||
--enable-gray enable full grayscale support (slower color)
|
--enable-gray enable full grayscale support (slower color)
|
||||||
--disable-swscale-alpha disable alpha channel support in swscale
|
--disable-swscale-alpha disable alpha channel support in swscale
|
||||||
@ -877,7 +876,6 @@ CONFIG_LIST="
|
|||||||
gprof
|
gprof
|
||||||
gray
|
gray
|
||||||
hardcoded_tables
|
hardcoded_tables
|
||||||
ipv6
|
|
||||||
libdc1394
|
libdc1394
|
||||||
libdirac
|
libdirac
|
||||||
libfaac
|
libfaac
|
||||||
@ -1034,6 +1032,8 @@ HAVE_LIST="
|
|||||||
soundcard_h
|
soundcard_h
|
||||||
poll_h
|
poll_h
|
||||||
struct_addrinfo
|
struct_addrinfo
|
||||||
|
struct_ipv6_mreq
|
||||||
|
struct_sockaddr_in6
|
||||||
struct_sockaddr_sa_len
|
struct_sockaddr_sa_len
|
||||||
struct_sockaddr_storage
|
struct_sockaddr_storage
|
||||||
sys_mman_h
|
sys_mman_h
|
||||||
@ -1396,7 +1396,6 @@ enable fastdiv
|
|||||||
enable ffmpeg
|
enable ffmpeg
|
||||||
enable ffplay
|
enable ffplay
|
||||||
enable ffserver
|
enable ffserver
|
||||||
enable ipv6
|
|
||||||
enable mpegaudio_hp
|
enable mpegaudio_hp
|
||||||
enable network
|
enable network
|
||||||
enable optimizations
|
enable optimizations
|
||||||
@ -2511,6 +2510,8 @@ texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
|
|||||||
if enabled network; then
|
if enabled network; then
|
||||||
check_type "sys/types.h sys/socket.h" socklen_t
|
check_type "sys/types.h sys/socket.h" socklen_t
|
||||||
check_type netdb.h "struct addrinfo"
|
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_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
|
||||||
check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
|
check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
|
||||||
# Prefer arpa/inet.h over winsock2
|
# Prefer arpa/inet.h over winsock2
|
||||||
@ -2523,6 +2524,8 @@ if enabled network; then
|
|||||||
network_extralibs="-lws2_32"; }
|
network_extralibs="-lws2_32"; }
|
||||||
check_type ws2tcpip.h socklen_t
|
check_type ws2tcpip.h socklen_t
|
||||||
check_type ws2tcpip.h "struct addrinfo"
|
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_type ws2tcpip.h "struct sockaddr_storage"
|
||||||
check_struct winsock2.h "struct sockaddr" sa_len
|
check_struct winsock2.h "struct sockaddr" sa_len
|
||||||
else
|
else
|
||||||
@ -2530,20 +2533,6 @@ if enabled network; then
|
|||||||
fi
|
fi
|
||||||
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/videodev.h
|
||||||
check_header linux/videodev2.h
|
check_header linux/videodev2.h
|
||||||
check_header sys/videoio.h
|
check_header sys/videoio.h
|
||||||
@ -2752,9 +2741,6 @@ echo "postprocessing support ${postproc-no}"
|
|||||||
echo "new filter support ${avfilter-no}"
|
echo "new filter support ${avfilter-no}"
|
||||||
echo "filters using lavformat ${avfilter_lavf-no}"
|
echo "filters using lavformat ${avfilter_lavf-no}"
|
||||||
echo "network support ${network-no}"
|
echo "network support ${network-no}"
|
||||||
if enabled network; then
|
|
||||||
echo "IPv6 support ${ipv6-no}"
|
|
||||||
fi
|
|
||||||
echo "threading support ${thread_type-no}"
|
echo "threading support ${thread_type-no}"
|
||||||
echo "SDL support ${sdl-no}"
|
echo "SDL support ${sdl-no}"
|
||||||
echo "Sun medialib support ${mlib-no}"
|
echo "Sun medialib support ${mlib-no}"
|
||||||
|
@ -52,11 +52,7 @@ typedef struct {
|
|||||||
int is_multicast;
|
int is_multicast;
|
||||||
int local_port;
|
int local_port;
|
||||||
int reuse_socket;
|
int reuse_socket;
|
||||||
#if !CONFIG_IPV6
|
|
||||||
struct sockaddr_in dest_addr;
|
|
||||||
#else
|
|
||||||
struct sockaddr_storage dest_addr;
|
struct sockaddr_storage dest_addr;
|
||||||
#endif
|
|
||||||
int dest_addr_len;
|
int dest_addr_len;
|
||||||
} UDPContext;
|
} UDPContext;
|
||||||
|
|
||||||
@ -72,7 +68,7 @@ static int udp_set_multicast_ttl(int sockfd, int mcastTTL, struct sockaddr *addr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if CONFIG_IPV6
|
#if defined(IPPROTO_IPV6) && defined(IPV6_MULTICAST_HOPS)
|
||||||
if (addr->sa_family == AF_INET6) {
|
if (addr->sa_family == AF_INET6) {
|
||||||
if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &mcastTTL, sizeof(mcastTTL)) < 0) {
|
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));
|
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
|
#endif
|
||||||
#if CONFIG_IPV6
|
#if HAVE_STRUCT_IPV6_MREQ
|
||||||
if (addr->sa_family == AF_INET6) {
|
if (addr->sa_family == AF_INET6) {
|
||||||
struct ipv6_mreq mreq6;
|
struct ipv6_mreq mreq6;
|
||||||
|
|
||||||
@ -124,7 +120,7 @@ static int udp_leave_multicast_group(int sockfd, struct sockaddr *addr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if CONFIG_IPV6
|
#if HAVE_STRUCT_IPV6_MREQ
|
||||||
if (addr->sa_family == AF_INET6) {
|
if (addr->sa_family == AF_INET6) {
|
||||||
struct ipv6_mreq mreq6;
|
struct ipv6_mreq mreq6;
|
||||||
|
|
||||||
@ -139,7 +135,6 @@ static int udp_leave_multicast_group(int sockfd, struct sockaddr *addr) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_IPV6
|
|
||||||
static struct addrinfo* udp_ipv6_resolve_host(const char *hostname, int port, int type, int family, int flags) {
|
static struct addrinfo* udp_ipv6_resolve_host(const char *hostname, int port, int type, int family, int flags) {
|
||||||
struct addrinfo hints, *res = 0;
|
struct addrinfo hints, *res = 0;
|
||||||
int error;
|
int error;
|
||||||
@ -182,9 +177,11 @@ static int is_multicast_address(struct sockaddr_storage *addr)
|
|||||||
if (addr->ss_family == AF_INET) {
|
if (addr->ss_family == AF_INET) {
|
||||||
return IN_MULTICAST(ntohl(((struct sockaddr_in *)addr)->sin_addr.s_addr));
|
return IN_MULTICAST(ntohl(((struct sockaddr_in *)addr)->sin_addr.s_addr));
|
||||||
}
|
}
|
||||||
|
#if HAVE_STRUCT_SOCKADDR_IN6
|
||||||
if (addr->ss_family == AF_INET6) {
|
if (addr->ss_family == AF_INET6) {
|
||||||
return IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6 *)addr)->sin6_addr);
|
return IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6 *)addr)->sin6_addr);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -236,46 +233,6 @@ static int udp_port(struct sockaddr_storage *addr, int addr_len)
|
|||||||
return strtol(sbuf, NULL, 10);
|
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
|
* 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;
|
int is_output;
|
||||||
const char *p;
|
const char *p;
|
||||||
char buf[256];
|
char buf[256];
|
||||||
#if !CONFIG_IPV6
|
|
||||||
struct sockaddr_in my_addr;
|
|
||||||
#else
|
|
||||||
struct sockaddr_storage my_addr;
|
struct sockaddr_storage my_addr;
|
||||||
#endif
|
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
h->is_streamed = 1;
|
h->is_streamed = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user