diff --git a/libavformat/avio.c b/libavformat/avio.c index 76d3d4d4d91ce8689256f43e46f022b0f6923d25..a0eee9355ebd7d31a44e298771ab2fe93e892ad9 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -204,6 +204,10 @@ int64_t url_filesize(URLContext *h) { return ffurl_size(h); } +int url_get_file_handle(URLContext *h) +{ + return ffurl_get_file_handle(h); +} #endif #define URL_SCHEME_CHARS \ @@ -357,7 +361,7 @@ int64_t ffurl_size(URLContext *h) return size; } -int url_get_file_handle(URLContext *h) +int ffurl_get_file_handle(URLContext *h) { if (!h->prot->url_get_file_handle) return -1; diff --git a/libavformat/avio.h b/libavformat/avio.h index 28f24e06aaa29917dbbd894aad4ad31670566297..020a75aa030c80cb66fd22db30e4455bccdcba22 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -111,6 +111,7 @@ attribute_deprecated int url_write(URLContext *h, const unsigned char *buf, int attribute_deprecated int64_t url_seek(URLContext *h, int64_t pos, int whence); attribute_deprecated int url_close(URLContext *h); attribute_deprecated int64_t url_filesize(URLContext *h); +attribute_deprecated int url_get_file_handle(URLContext *h); #endif /** @@ -119,14 +120,6 @@ attribute_deprecated int64_t url_filesize(URLContext *h); */ int url_exist(const char *url); -/** - * Return the file descriptor associated with this URL. For RTP, this - * will return only the RTP file descriptor, not the RTCP file descriptor. - * - * @return the file descriptor associated with this URL, or <0 on error. - */ -int url_get_file_handle(URLContext *h); - /** * Return the maximum packet size associated to packetized file * handle. If the file is not packetized (stream like HTTP or file on diff --git a/libavformat/http.c b/libavformat/http.c index bb756c28439ac76b48c6b2875bae478b6f738832..c3845c642054388d5bb1378487510c1e9ed57762 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -501,7 +501,7 @@ static int http_get_file_handle(URLContext *h) { HTTPContext *s = h->priv_data; - return url_get_file_handle(s->hd); + return ffurl_get_file_handle(s->hd); } URLProtocol ff_http_protocol = { diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c index 8772510ac5ab0ec8b61ef5a911c6371e907b128d..0439bc07fc08dfaf88115d473b85dc18f918b623 100644 --- a/libavformat/rtpproto.c +++ b/libavformat/rtpproto.c @@ -203,8 +203,8 @@ static int rtp_open(URLContext *h, const char *uri, int flags) /* just to ease handle access. XXX: need to suppress direct handle access */ - s->rtp_fd = url_get_file_handle(s->rtp_hd); - s->rtcp_fd = url_get_file_handle(s->rtcp_hd); + s->rtp_fd = ffurl_get_file_handle(s->rtp_hd); + s->rtcp_fd = ffurl_get_file_handle(s->rtcp_hd); h->max_packet_size = url_get_max_packet_size(s->rtp_hd); h->is_streamed = 1; diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index ac40430c57c8a53615cebfa0b212f84c609dd433..d314453110655ea4295e542415c7d86c9597091f 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1468,7 +1468,7 @@ redirect: } rt->seq = 0; - tcp_fd = url_get_file_handle(rt->rtsp_hd); + tcp_fd = ffurl_get_file_handle(rt->rtsp_hd); if (!getpeername(tcp_fd, (struct sockaddr*) &peer, &peer_len)) { getnameinfo((struct sockaddr*) &peer, peer_len, host, sizeof(host), NULL, 0, NI_NUMERICHOST); @@ -1571,7 +1571,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, return AVERROR(EAGAIN); max_p = 0; if (rt->rtsp_hd) { - tcp_fd = url_get_file_handle(rt->rtsp_hd); + tcp_fd = ffurl_get_file_handle(rt->rtsp_hd); p[max_p].fd = tcp_fd; p[max_p++].events = POLLIN; } else { @@ -1580,7 +1580,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, for (i = 0; i < rt->nb_rtsp_streams; i++) { rtsp_st = rt->rtsp_streams[i]; if (rtsp_st->rtp_handle) { - p[max_p].fd = url_get_file_handle(rtsp_st->rtp_handle); + p[max_p].fd = ffurl_get_file_handle(rtsp_st->rtp_handle); p[max_p++].events = POLLIN; p[max_p].fd = rtp_get_rtcp_file_handle(rtsp_st->rtp_handle); p[max_p++].events = POLLIN; @@ -1887,7 +1887,7 @@ static int rtp_read_header(AVFormatContext *s, payload_type = recvbuf[1] & 0x7f; break; } - getsockname(url_get_file_handle(in), (struct sockaddr*) &addr, &addrlen); + getsockname(ffurl_get_file_handle(in), (struct sockaddr*) &addr, &addrlen); ffurl_close(in); in = NULL; diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c index b4b26204f9ea34f972a2f8bf618291b2c2045f32..684f2fe558803131cdd6f51b18fbd8fd94b451b8 100644 --- a/libavformat/rtspenc.c +++ b/libavformat/rtspenc.c @@ -173,7 +173,7 @@ static int rtsp_write_packet(AVFormatContext *s, AVPacket *pkt) RTSPState *rt = s->priv_data; RTSPStream *rtsp_st; int n; - struct pollfd p = {url_get_file_handle(rt->rtsp_hd), POLLIN, 0}; + struct pollfd p = {ffurl_get_file_handle(rt->rtsp_hd), POLLIN, 0}; AVFormatContext *rtpctx; int ret; diff --git a/libavformat/sapdec.c b/libavformat/sapdec.c index c3e7a8bbc0636bc29f3facda1f5d727d5270399e..ed22e0b4c495d62ac927840f12bdcd91ad0cfa72 100644 --- a/libavformat/sapdec.c +++ b/libavformat/sapdec.c @@ -183,7 +183,7 @@ fail: static int sap_fetch_packet(AVFormatContext *s, AVPacket *pkt) { struct SAPState *sap = s->priv_data; - int fd = url_get_file_handle(sap->ann_fd); + int fd = ffurl_get_file_handle(sap->ann_fd); int n, ret; struct pollfd p = {fd, POLLIN, 0}; uint8_t recvbuf[1500]; diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c index ad8cbac52f285adf4df8e407f75375f3db260724..14be5a7428ae3e044dd5aaab956757998dd81630 100644 --- a/libavformat/sapenc.c +++ b/libavformat/sapenc.c @@ -164,7 +164,7 @@ static int sap_write_header(AVFormatContext *s) goto fail; } - udp_fd = url_get_file_handle(sap->ann_fd); + udp_fd = ffurl_get_file_handle(sap->ann_fd); if (getsockname(udp_fd, (struct sockaddr*) &localaddr, &addrlen)) { ret = AVERROR(EIO); goto fail; diff --git a/libavformat/url.h b/libavformat/url.h index df3cb46df9fd9d15e2458cf7d0c300a8af6d23f9..eea9678ddcbae9919f385e37e77781938c7c0a15 100644 --- a/libavformat/url.h +++ b/libavformat/url.h @@ -118,4 +118,12 @@ int ffurl_close(URLContext *h); */ int64_t ffurl_size(URLContext *h); +/** + * Return the file descriptor associated with this URL. For RTP, this + * will return only the RTP file descriptor, not the RTCP file descriptor. + * + * @return the file descriptor associated with this URL, or <0 on error. + */ +int ffurl_get_file_handle(URLContext *h); + #endif //AVFORMAT_URL_H