Revision 7934b15d libavformat/rtsp.c

View differences:

libavformat/rtsp.c
696 696
                    th->ttl = strtol(p, (char **)&p, 10);
697 697
                }
698 698
            } else if (!strcmp(parameter, "destination")) {
699
                struct in_addr ipaddr;
700

  
701 699
                if (*p == '=') {
702 700
                    p++;
703 701
                    get_word_sep(buf, sizeof(buf), ";,", &p);
704
                    if (ff_inet_aton(buf, &ipaddr))
705
                        th->destination = ntohl(ipaddr.s_addr);
702
                    get_sockaddr(buf, &th->destination);
706 703
                }
707 704
            }
708 705
            while (*p != ';' && *p != '\0' && *p != ',')
......
1174 1171
            break;
1175 1172
        }
1176 1173
        case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: {
1177
            char url[1024];
1178
            struct in_addr in;
1174
            char url[1024], namebuf[50];
1175
            struct sockaddr_storage addr;
1179 1176
            int port, ttl;
1180 1177

  
1181
            if (reply->transports[0].destination) {
1182
                in.s_addr = htonl(reply->transports[0].destination);
1178
            if (reply->transports[0].destination.ss_family) {
1179
                addr      = reply->transports[0].destination;
1183 1180
                port      = reply->transports[0].port_min;
1184 1181
                ttl       = reply->transports[0].ttl;
1185 1182
            } else {
1186
                in        = ((struct sockaddr_in*)&rtsp_st->sdp_ip)->sin_addr;
1183
                addr      = rtsp_st->sdp_ip;
1187 1184
                port      = rtsp_st->sdp_port;
1188 1185
                ttl       = rtsp_st->sdp_ttl;
1189 1186
            }
1190
            ff_url_join(url, sizeof(url), "rtp", NULL, inet_ntoa(in),
1187
            getnameinfo((struct sockaddr*) &addr, sizeof(addr),
1188
                        namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);
1189
            ff_url_join(url, sizeof(url), "rtp", NULL, namebuf,
1191 1190
                        port, "?ttl=%d", ttl);
1192 1191
            if (url_open(&rtsp_st->rtp_handle, url, URL_RDWR) < 0) {
1193 1192
                err = AVERROR_INVALIDDATA;

Also available in: Unified diff