diff options
author | Martin Storsjö <martin@martin.st> | 2010-10-08 21:48:13 +0400 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2010-10-08 21:48:13 +0400 |
commit | fcc7f40449af7f339c1b91f1622b48a88add29b0 (patch) | |
tree | c3463b2929a901442a330b2a1265b2d808730977 /libavformat | |
parent | d03b93e37213010f3f31dd89d69ebe129d182304 (diff) |
sapenc: Mark the muxer as depending on network functions
Hide all code mentioning IPv6 behind HAVE_STRUCT_SOCKADDR_IN6.
Originally committed as revision 25415 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/sapenc.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c index 862f114c92..3b7ff2d793 100644 --- a/libavformat/sapenc.c +++ b/libavformat/sapenc.c @@ -115,11 +115,13 @@ static int sap_write_header(AVFormatContext *s) if (ai->ai_family == AF_INET) { /* Also known as sap.mcast.net */ av_strlcpy(announce_addr, "224.2.127.254", sizeof(announce_addr)); +#if HAVE_STRUCT_SOCKADDR_IN6 } else if (ai->ai_family == AF_INET6) { /* With IPv6, you can use the same destination in many different * multicast subnets, to choose how far you want it routed. * This one is intended to be routed globally. */ av_strlcpy(announce_addr, "ff0e::2:7ffe", sizeof(announce_addr)); +#endif } else { freeaddrinfo(ai); av_log(s, AV_LOG_ERROR, "Host %s resolved to unsupported " @@ -167,7 +169,11 @@ static int sap_write_header(AVFormatContext *s) ret = AVERROR(EIO); goto fail; } - if (localaddr.ss_family != AF_INET && localaddr.ss_family != AF_INET6) { + if (localaddr.ss_family != AF_INET +#if HAVE_STRUCT_SOCKADDR_IN6 + && localaddr.ss_family != AF_INET6 +#endif + ) { av_log(s, AV_LOG_ERROR, "Unsupported protocol family\n"); ret = AVERROR(EIO); goto fail; @@ -178,7 +184,12 @@ static int sap_write_header(AVFormatContext *s) ret = AVERROR(EIO); goto fail; } - sap->ann[pos++] = (1 << 5) | ((localaddr.ss_family == AF_INET6) << 4); + sap->ann[pos] = (1 << 5); +#if HAVE_STRUCT_SOCKADDR_IN6 + if (localaddr.ss_family == AF_INET6) + sap->ann[pos] |= 0x10; +#endif + pos++; sap->ann[pos++] = 0; /* Authentication length */ AV_WB16(&sap->ann[pos], av_get_random_seed()); pos += 2; @@ -186,10 +197,12 @@ static int sap_write_header(AVFormatContext *s) memcpy(&sap->ann[pos], &((struct sockaddr_in*)&localaddr)->sin_addr, sizeof(struct in_addr)); pos += sizeof(struct in_addr); +#if HAVE_STRUCT_SOCKADDR_IN6 } else { memcpy(&sap->ann[pos], &((struct sockaddr_in6*)&localaddr)->sin6_addr, sizeof(struct in6_addr)); pos += sizeof(struct in6_addr); +#endif } av_strlcpy(&sap->ann[pos], "application/sdp", sap->ann_size - pos); |