}
}
-static int get_sockaddr(const char *buf, struct sockaddr_storage *sock)
+static int get_sockaddr(AVFormatContext *s,
+ const char *buf, struct sockaddr_storage *sock)
{
struct addrinfo hints = { 0 }, *ai = NULL;
+ int ret;
+
hints.ai_flags = AI_NUMERICHOST;
- if (getaddrinfo(buf, NULL, &hints, &ai))
+ if ((ret = getaddrinfo(buf, NULL, &hints, &ai))) {
+ av_log(s, AV_LOG_ERROR, "getaddrinfo(%s): %s\n",
+ buf,
+ gai_strerror(ret));
return -1;
+ }
memcpy(sock, ai->ai_addr, FFMIN(sizeof(*sock), ai->ai_addrlen));
freeaddrinfo(ai);
return 0;
if (strcmp(buf1, "IP4") && strcmp(buf1, "IP6"))
return;
get_word_sep(buf1, sizeof(buf1), "/", &p);
- if (get_sockaddr(buf1, &sdp_ip))
+ if (get_sockaddr(s, buf1, &sdp_ip))
return;
ttl = 16;
if (*p == '/') {
}
/* XXX: only one transport specification is parsed */
-static void rtsp_parse_transport(RTSPMessageHeader *reply, const char *p)
+static void rtsp_parse_transport(AVFormatContext *s,
+ RTSPMessageHeader *reply, const char *p)
{
char transport_protocol[16];
char profile[16];
if (*p == '=') {
p++;
get_word_sep(buf, sizeof(buf), ";,", &p);
- get_sockaddr(buf, &th->destination);
+ get_sockaddr(s, buf, &th->destination);
}
} else if (!strcmp(parameter, "source")) {
if (*p == '=') {
handle_rtp_info(rt, url, seq, rtptime);
}
-void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf,
+void ff_rtsp_parse_line(AVFormatContext *s,
+ RTSPMessageHeader *reply, const char *buf,
RTSPState *rt, const char *method)
{
const char *p;
} else if (av_stristart(p, "Content-Length:", &p)) {
reply->content_length = strtol(p, NULL, 10);
} else if (av_stristart(p, "Transport:", &p)) {
- rtsp_parse_transport(reply, p);
+ rtsp_parse_transport(s, reply, p);
} else if (av_stristart(p, "CSeq:", &p)) {
reply->seq = strtol(p, NULL, 10);
} else if (av_stristart(p, "Range:", &p)) {
request = 1;
}
} else {
- ff_rtsp_parse_line(reply, p, rt, method);
+ ff_rtsp_parse_line(s, reply, p, rt, method);
av_strlcat(rt->last_reply, p, sizeof(rt->last_reply));
av_strlcat(rt->last_reply, "\n", sizeof(rt->last_reply));
}