... | ... |
@@ -29,6 +29,7 @@ |
29 | 29 |
#if CONFIG_NETWORK |
30 | 30 |
#include "network.h" |
31 | 31 |
#endif |
32 |
+#include "url.h" |
|
32 | 33 |
|
33 | 34 |
#if FF_API_URL_CLASS |
34 | 35 |
/** @name Logging context. */ |
... | ... |
@@ -167,6 +168,10 @@ int url_open_protocol (URLContext **puc, struct URLProtocol *up, |
167 | 167 |
*puc = NULL; |
168 | 168 |
return ret; |
169 | 169 |
} |
170 |
+int url_alloc(URLContext **puc, const char *filename, int flags) |
|
171 |
+{ |
|
172 |
+ return ffurl_alloc(puc, filename, flags); |
|
173 |
+} |
|
170 | 174 |
#endif |
171 | 175 |
|
172 | 176 |
#define URL_SCHEME_CHARS \ |
... | ... |
@@ -174,7 +179,7 @@ int url_open_protocol (URLContext **puc, struct URLProtocol *up, |
174 | 174 |
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" \ |
175 | 175 |
"0123456789+-." |
176 | 176 |
|
177 |
-int url_alloc(URLContext **puc, const char *filename, int flags) |
|
177 |
+int ffurl_alloc(URLContext **puc, const char *filename, int flags) |
|
178 | 178 |
{ |
179 | 179 |
URLProtocol *up; |
180 | 180 |
char proto_str[128], proto_nested[128], *ptr; |
... | ... |
@@ -204,7 +209,7 @@ int url_alloc(URLContext **puc, const char *filename, int flags) |
204 | 204 |
|
205 | 205 |
int url_open(URLContext **puc, const char *filename, int flags) |
206 | 206 |
{ |
207 |
- int ret = url_alloc(puc, filename, flags); |
|
207 |
+ int ret = ffurl_alloc(puc, filename, flags); |
|
208 | 208 |
if (ret) |
209 | 209 |
return ret; |
210 | 210 |
ret = url_connect(*puc); |
... | ... |
@@ -102,22 +102,10 @@ typedef int URLInterruptCB(void); |
102 | 102 |
*/ |
103 | 103 |
attribute_deprecated int url_open_protocol (URLContext **puc, struct URLProtocol *up, |
104 | 104 |
const char *url, int flags); |
105 |
+attribute_deprecated int url_alloc(URLContext **h, const char *url, int flags); |
|
105 | 106 |
#endif |
106 | 107 |
|
107 | 108 |
/** |
108 |
- * Create a URLContext for accessing to the resource indicated by |
|
109 |
- * url, but do not initiate the connection yet. |
|
110 |
- * |
|
111 |
- * @param puc pointer to the location where, in case of success, the |
|
112 |
- * function puts the pointer to the created URLContext |
|
113 |
- * @param flags flags which control how the resource indicated by url |
|
114 |
- * is to be opened |
|
115 |
- * @return 0 in case of success, a negative value corresponding to an |
|
116 |
- * AVERROR code in case of failure |
|
117 |
- */ |
|
118 |
-int url_alloc(URLContext **h, const char *url, int flags); |
|
119 |
- |
|
120 |
-/** |
|
121 | 109 |
* Connect an URLContext that has been allocated by url_alloc |
122 | 110 |
*/ |
123 | 111 |
int url_connect(URLContext *h); |
... | ... |
@@ -32,6 +32,7 @@ |
32 | 32 |
#include "mms.h" |
33 | 33 |
#include "asf.h" |
34 | 34 |
#include "http.h" |
35 |
+#include "url.h" |
|
35 | 36 |
|
36 | 37 |
#define CHUNK_HEADER_LENGTH 4 // 2bytes chunk type and 2bytes chunk length. |
37 | 38 |
#define EXT_HEADER_LENGTH 8 // 4bytes sequence, 2bytes useless and 2bytes chunk length. |
... | ... |
@@ -232,7 +233,7 @@ static int mmsh_open(URLContext *h, const char *uri, int flags) |
232 | 232 |
port = 80; // default mmsh protocol port |
233 | 233 |
ff_url_join(httpname, sizeof(httpname), "http", NULL, host, port, path); |
234 | 234 |
|
235 |
- if (url_alloc(&mms->mms_hd, httpname, URL_RDONLY) < 0) { |
|
235 |
+ if (ffurl_alloc(&mms->mms_hd, httpname, URL_RDONLY) < 0) { |
|
236 | 236 |
return AVERROR(EIO); |
237 | 237 |
} |
238 | 238 |
|
... | ... |
@@ -260,7 +261,7 @@ static int mmsh_open(URLContext *h, const char *uri, int flags) |
260 | 260 |
// close the socket and then reopen it for sending the second play request. |
261 | 261 |
url_close(mms->mms_hd); |
262 | 262 |
memset(headers, 0, sizeof(headers)); |
263 |
- if (url_alloc(&mms->mms_hd, httpname, URL_RDONLY) < 0) { |
|
263 |
+ if (ffurl_alloc(&mms->mms_hd, httpname, URL_RDONLY) < 0) { |
|
264 | 264 |
return AVERROR(EIO); |
265 | 265 |
} |
266 | 266 |
stream_selection = av_mallocz(mms->stream_num * 19 + 1); |
... | ... |
@@ -42,6 +42,7 @@ |
42 | 42 |
#include "rdt.h" |
43 | 43 |
#include "rtpdec_formats.h" |
44 | 44 |
#include "rtpenc_chain.h" |
45 |
+#include "url.h" |
|
45 | 46 |
|
46 | 47 |
//#define DEBUG |
47 | 48 |
//#define DEBUG_RTP_TCP |
... | ... |
@@ -1395,7 +1396,7 @@ redirect: |
1395 | 1395 |
av_get_random_seed(), av_get_random_seed()); |
1396 | 1396 |
|
1397 | 1397 |
/* GET requests */ |
1398 |
- if (url_alloc(&rt->rtsp_hd, httpname, URL_RDONLY) < 0) { |
|
1398 |
+ if (ffurl_alloc(&rt->rtsp_hd, httpname, URL_RDONLY) < 0) { |
|
1399 | 1399 |
err = AVERROR(EIO); |
1400 | 1400 |
goto fail; |
1401 | 1401 |
} |
... | ... |
@@ -1416,7 +1417,7 @@ redirect: |
1416 | 1416 |
} |
1417 | 1417 |
|
1418 | 1418 |
/* POST requests */ |
1419 |
- if (url_alloc(&rt->rtsp_hd_out, httpname, URL_WRONLY) < 0 ) { |
|
1419 |
+ if (ffurl_alloc(&rt->rtsp_hd_out, httpname, URL_WRONLY) < 0 ) { |
|
1420 | 1420 |
err = AVERROR(EIO); |
1421 | 1421 |
goto fail; |
1422 | 1422 |
} |
1423 | 1423 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,43 @@ |
0 |
+/* |
|
1 |
+ * |
|
2 |
+ * This file is part of Libav. |
|
3 |
+ * |
|
4 |
+ * Libav is free software; you can redistribute it and/or |
|
5 |
+ * modify it under the terms of the GNU Lesser General Public |
|
6 |
+ * License as published by the Free Software Foundation; either |
|
7 |
+ * version 2.1 of the License, or (at your option) any later version. |
|
8 |
+ * |
|
9 |
+ * Libav is distributed in the hope that it will be useful, |
|
10 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
12 |
+ * Lesser General Public License for more details. |
|
13 |
+ * |
|
14 |
+ * You should have received a copy of the GNU Lesser General Public |
|
15 |
+ * License along with Libav; if not, write to the Free Software |
|
16 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
17 |
+ */ |
|
18 |
+ |
|
19 |
+/** |
|
20 |
+ * @file |
|
21 |
+ * unbuffered private I/O API |
|
22 |
+ */ |
|
23 |
+ |
|
24 |
+#ifndef AVFORMAT_URL_H |
|
25 |
+#define AVFORMAT_URL_H |
|
26 |
+ |
|
27 |
+#include "avio.h" |
|
28 |
+ |
|
29 |
+/** |
|
30 |
+ * Create a URLContext for accessing to the resource indicated by |
|
31 |
+ * url, but do not initiate the connection yet. |
|
32 |
+ * |
|
33 |
+ * @param puc pointer to the location where, in case of success, the |
|
34 |
+ * function puts the pointer to the created URLContext |
|
35 |
+ * @param flags flags which control how the resource indicated by url |
|
36 |
+ * is to be opened |
|
37 |
+ * @return 0 in case of success, a negative value corresponding to an |
|
38 |
+ * AVERROR code in case of failure |
|
39 |
+ */ |
|
40 |
+int ffurl_alloc(URLContext **h, const char *url, int flags); |
|
41 |
+ |
|
42 |
+#endif //AVFORMAT_URL_H |