diff --git a/configure b/configure index 29b07f37fa..f690b3fe34 100755 --- a/configure +++ b/configure @@ -1363,6 +1363,7 @@ ogg_demuxer_select="golomb" psp_muxer_select="mov_muxer" rtsp_demuxer_select="http_protocol sdp_demuxer" rtsp_muxer_select="rtp_muxer http_protocol sdp_demuxer" +sap_muxer_deps="network" sap_muxer_select="rtp_muxer" sdp_demuxer_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer" spdif_muxer_select="aac_parser" 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);