Mercurial > libavformat.hg
comparison sdp.c @ 6408:3a89d4044e01 libavformat
Simplify resolve_destination in sdp.c further, now that we don't enforce IPv4 any longer
author | mstorsjo |
---|---|
date | Wed, 25 Aug 2010 13:30:06 +0000 |
parents | cb173cbeaa96 |
children | fe8fadaf5fb6 |
comparison
equal
deleted
inserted
replaced
6407:cb173cbeaa96 | 6408:3a89d4044e01 |
---|---|
80 | 80 |
81 #if CONFIG_NETWORK | 81 #if CONFIG_NETWORK |
82 static void resolve_destination(char *dest_addr, int size, char *type, | 82 static void resolve_destination(char *dest_addr, int size, char *type, |
83 int type_size) | 83 int type_size) |
84 { | 84 { |
85 struct addrinfo hints, *ai, *cur; | 85 struct addrinfo hints, *ai; |
86 | 86 |
87 av_strlcpy(type, "IP4", type_size); | 87 av_strlcpy(type, "IP4", type_size); |
88 if (!dest_addr[0]) | 88 if (!dest_addr[0]) |
89 return; | 89 return; |
90 | 90 |
92 * as a numeric IP address in the SDP. */ | 92 * as a numeric IP address in the SDP. */ |
93 | 93 |
94 memset(&hints, 0, sizeof(hints)); | 94 memset(&hints, 0, sizeof(hints)); |
95 if (getaddrinfo(dest_addr, NULL, &hints, &ai)) | 95 if (getaddrinfo(dest_addr, NULL, &hints, &ai)) |
96 return; | 96 return; |
97 for (cur = ai; cur; cur = cur->ai_next) { | 97 getnameinfo(ai->ai_addr, ai->ai_addrlen, dest_addr, size, |
98 getnameinfo(cur->ai_addr, cur->ai_addrlen, dest_addr, size, | |
99 NULL, 0, NI_NUMERICHOST); | 98 NULL, 0, NI_NUMERICHOST); |
100 if (cur->ai_family == AF_INET6) | 99 if (ai->ai_family == AF_INET6) |
101 av_strlcpy(type, "IP6", type_size); | 100 av_strlcpy(type, "IP6", type_size); |
102 break; | |
103 } | |
104 freeaddrinfo(ai); | 101 freeaddrinfo(ai); |
105 } | 102 } |
106 #else | 103 #else |
107 static void resolve_destination(char *dest_addr, int size, char *type, | 104 static void resolve_destination(char *dest_addr, int size, char *type, |
108 int type_size) | 105 int type_size) |