sapenc: Mark the muxer as depending on network functions
authorMartin Storsjö <martin@martin.st>
Fri, 8 Oct 2010 17:48:13 +0000 (17:48 +0000)
committerMartin Storsjö <martin@martin.st>
Fri, 8 Oct 2010 17:48:13 +0000 (17:48 +0000)
Hide all code mentioning IPv6 behind HAVE_STRUCT_SOCKADDR_IN6.

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

configure
libavformat/sapenc.c

index 29b07f3..f690b3f 100755 (executable)
--- 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"
index 862f114..3b7ff2d 100644 (file)
@@ -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);