Browse code

avio: make url_get_file_handle() internal.

Anton Khirnov authored on 2011/04/01 00:51:24
Showing 9 changed files
... ...
@@ -204,6 +204,10 @@ int64_t url_filesize(URLContext *h)
204 204
 {
205 205
     return ffurl_size(h);
206 206
 }
207
+int url_get_file_handle(URLContext *h)
208
+{
209
+    return ffurl_get_file_handle(h);
210
+}
207 211
 #endif
208 212
 
209 213
 #define URL_SCHEME_CHARS                        \
... ...
@@ -357,7 +361,7 @@ int64_t ffurl_size(URLContext *h)
357 357
     return size;
358 358
 }
359 359
 
360
-int url_get_file_handle(URLContext *h)
360
+int ffurl_get_file_handle(URLContext *h)
361 361
 {
362 362
     if (!h->prot->url_get_file_handle)
363 363
         return -1;
... ...
@@ -111,6 +111,7 @@ attribute_deprecated int url_write(URLContext *h, const unsigned char *buf, int
111 111
 attribute_deprecated int64_t url_seek(URLContext *h, int64_t pos, int whence);
112 112
 attribute_deprecated int url_close(URLContext *h);
113 113
 attribute_deprecated int64_t url_filesize(URLContext *h);
114
+attribute_deprecated int url_get_file_handle(URLContext *h);
114 115
 #endif
115 116
 
116 117
 /**
... ...
@@ -120,14 +121,6 @@ attribute_deprecated int64_t url_filesize(URLContext *h);
120 120
 int url_exist(const char *url);
121 121
 
122 122
 /**
123
- * Return the file descriptor associated with this URL. For RTP, this
124
- * will return only the RTP file descriptor, not the RTCP file descriptor.
125
- *
126
- * @return the file descriptor associated with this URL, or <0 on error.
127
- */
128
-int url_get_file_handle(URLContext *h);
129
-
130
-/**
131 123
  * Return the maximum packet size associated to packetized file
132 124
  * handle. If the file is not packetized (stream like HTTP or file on
133 125
  * disk), then 0 is returned.
... ...
@@ -501,7 +501,7 @@ static int
501 501
 http_get_file_handle(URLContext *h)
502 502
 {
503 503
     HTTPContext *s = h->priv_data;
504
-    return url_get_file_handle(s->hd);
504
+    return ffurl_get_file_handle(s->hd);
505 505
 }
506 506
 
507 507
 URLProtocol ff_http_protocol = {
... ...
@@ -203,8 +203,8 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
203 203
 
204 204
     /* just to ease handle access. XXX: need to suppress direct handle
205 205
        access */
206
-    s->rtp_fd = url_get_file_handle(s->rtp_hd);
207
-    s->rtcp_fd = url_get_file_handle(s->rtcp_hd);
206
+    s->rtp_fd = ffurl_get_file_handle(s->rtp_hd);
207
+    s->rtcp_fd = ffurl_get_file_handle(s->rtcp_hd);
208 208
 
209 209
     h->max_packet_size = url_get_max_packet_size(s->rtp_hd);
210 210
     h->is_streamed = 1;
... ...
@@ -1468,7 +1468,7 @@ redirect:
1468 1468
     }
1469 1469
     rt->seq = 0;
1470 1470
 
1471
-    tcp_fd = url_get_file_handle(rt->rtsp_hd);
1471
+    tcp_fd = ffurl_get_file_handle(rt->rtsp_hd);
1472 1472
     if (!getpeername(tcp_fd, (struct sockaddr*) &peer, &peer_len)) {
1473 1473
         getnameinfo((struct sockaddr*) &peer, peer_len, host, sizeof(host),
1474 1474
                     NULL, 0, NI_NUMERICHOST);
... ...
@@ -1571,7 +1571,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
1571 1571
             return AVERROR(EAGAIN);
1572 1572
         max_p = 0;
1573 1573
         if (rt->rtsp_hd) {
1574
-            tcp_fd = url_get_file_handle(rt->rtsp_hd);
1574
+            tcp_fd = ffurl_get_file_handle(rt->rtsp_hd);
1575 1575
             p[max_p].fd = tcp_fd;
1576 1576
             p[max_p++].events = POLLIN;
1577 1577
         } else {
... ...
@@ -1580,7 +1580,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
1580 1580
         for (i = 0; i < rt->nb_rtsp_streams; i++) {
1581 1581
             rtsp_st = rt->rtsp_streams[i];
1582 1582
             if (rtsp_st->rtp_handle) {
1583
-                p[max_p].fd = url_get_file_handle(rtsp_st->rtp_handle);
1583
+                p[max_p].fd = ffurl_get_file_handle(rtsp_st->rtp_handle);
1584 1584
                 p[max_p++].events = POLLIN;
1585 1585
                 p[max_p].fd = rtp_get_rtcp_file_handle(rtsp_st->rtp_handle);
1586 1586
                 p[max_p++].events = POLLIN;
... ...
@@ -1887,7 +1887,7 @@ static int rtp_read_header(AVFormatContext *s,
1887 1887
         payload_type = recvbuf[1] & 0x7f;
1888 1888
         break;
1889 1889
     }
1890
-    getsockname(url_get_file_handle(in), (struct sockaddr*) &addr, &addrlen);
1890
+    getsockname(ffurl_get_file_handle(in), (struct sockaddr*) &addr, &addrlen);
1891 1891
     ffurl_close(in);
1892 1892
     in = NULL;
1893 1893
 
... ...
@@ -173,7 +173,7 @@ static int rtsp_write_packet(AVFormatContext *s, AVPacket *pkt)
173 173
     RTSPState *rt = s->priv_data;
174 174
     RTSPStream *rtsp_st;
175 175
     int n;
176
-    struct pollfd p = {url_get_file_handle(rt->rtsp_hd), POLLIN, 0};
176
+    struct pollfd p = {ffurl_get_file_handle(rt->rtsp_hd), POLLIN, 0};
177 177
     AVFormatContext *rtpctx;
178 178
     int ret;
179 179
 
... ...
@@ -183,7 +183,7 @@ fail:
183 183
 static int sap_fetch_packet(AVFormatContext *s, AVPacket *pkt)
184 184
 {
185 185
     struct SAPState *sap = s->priv_data;
186
-    int fd = url_get_file_handle(sap->ann_fd);
186
+    int fd = ffurl_get_file_handle(sap->ann_fd);
187 187
     int n, ret;
188 188
     struct pollfd p = {fd, POLLIN, 0};
189 189
     uint8_t recvbuf[1500];
... ...
@@ -164,7 +164,7 @@ static int sap_write_header(AVFormatContext *s)
164 164
         goto fail;
165 165
     }
166 166
 
167
-    udp_fd = url_get_file_handle(sap->ann_fd);
167
+    udp_fd = ffurl_get_file_handle(sap->ann_fd);
168 168
     if (getsockname(udp_fd, (struct sockaddr*) &localaddr, &addrlen)) {
169 169
         ret = AVERROR(EIO);
170 170
         goto fail;
... ...
@@ -118,4 +118,12 @@ int ffurl_close(URLContext *h);
118 118
  */
119 119
 int64_t ffurl_size(URLContext *h);
120 120
 
121
+/**
122
+ * Return the file descriptor associated with this URL. For RTP, this
123
+ * will return only the RTP file descriptor, not the RTCP file descriptor.
124
+ *
125
+ * @return the file descriptor associated with this URL, or <0 on error.
126
+ */
127
+int ffurl_get_file_handle(URLContext *h);
128
+
121 129
 #endif //AVFORMAT_URL_H