Browse code

avio: AVIO_ prefixes for URL_ open flags.

Anton Khirnov authored on 2011/04/05 03:11:19
Showing 26 changed files
... ...
@@ -3750,7 +3750,7 @@ static void opt_output_file(const char *filename)
3750 3750
         }
3751 3751
 
3752 3752
         /* open the file */
3753
-        if ((err = avio_open(&oc->pb, filename, URL_WRONLY)) < 0) {
3753
+        if ((err = avio_open(&oc->pb, filename, AVIO_WRONLY)) < 0) {
3754 3754
             print_error(filename, err);
3755 3755
             ffmpeg_exit(1);
3756 3756
         }
... ...
@@ -3427,7 +3427,7 @@ static int rtp_new_av_stream(HTTPContext *c,
3427 3427
                      "rtp://%s:%d", ipaddr, ntohs(dest_addr->sin_port));
3428 3428
         }
3429 3429
 
3430
-        if (url_open(&h, ctx->filename, URL_WRONLY) < 0)
3430
+        if (url_open(&h, ctx->filename, AVIO_WRONLY) < 0)
3431 3431
             goto fail;
3432 3432
         c->rtp_handles[stream_index] = h;
3433 3433
         max_packet_size = url_get_max_packet_size(h);
... ...
@@ -3767,7 +3767,7 @@ static void build_feed_streams(void)
3767 3767
             }
3768 3768
 
3769 3769
             /* only write the header of the ffm file */
3770
-            if (avio_open(&s->pb, feed->feed_filename, URL_WRONLY) < 0) {
3770
+            if (avio_open(&s->pb, feed->feed_filename, AVIO_WRONLY) < 0) {
3771 3771
                 http_log("Could not open output feed file '%s'\n",
3772 3772
                          feed->feed_filename);
3773 3773
                 exit(1);
... ...
@@ -169,7 +169,7 @@ static int parse_playlist(AppleHTTPContext *c, const char *url,
169 169
 
170 170
     if (!in) {
171 171
         close_in = 1;
172
-        if ((ret = avio_open(&in, url, URL_RDONLY)) < 0)
172
+        if ((ret = avio_open(&in, url, AVIO_RDONLY)) < 0)
173 173
             return ret;
174 174
     }
175 175
 
... ...
@@ -292,7 +292,7 @@ reload:
292 292
 
293 293
         ret = url_open(&v->input,
294 294
                        v->segments[v->cur_seq_no - v->start_seq_no]->url,
295
-                       URL_RDONLY);
295
+                       AVIO_RDONLY);
296 296
         if (ret < 0)
297 297
             return ret;
298 298
     }
... ...
@@ -115,7 +115,7 @@ static int parse_playlist(URLContext *h, const char *url)
115 115
     char line[1024];
116 116
     const char *ptr;
117 117
 
118
-    if ((ret = avio_open(&in, url, URL_RDONLY)) < 0)
118
+    if ((ret = avio_open(&in, url, AVIO_RDONLY)) < 0)
119 119
         return ret;
120 120
 
121 121
     read_chomp_line(in, line, sizeof(line));
... ...
@@ -180,7 +180,7 @@ static int applehttp_open(URLContext *h, const char *uri, int flags)
180 180
     int ret, i;
181 181
     const char *nested_url;
182 182
 
183
-    if (flags & (URL_WRONLY | URL_RDWR))
183
+    if (flags & (AVIO_WRONLY | AVIO_RDWR))
184 184
         return AVERROR(ENOSYS);
185 185
 
186 186
     s = av_mallocz(sizeof(AppleHTTPContext));
... ...
@@ -275,7 +275,7 @@ retry:
275 275
     }
276 276
     url = s->segments[s->cur_seq_no - s->start_seq_no]->url,
277 277
     av_log(NULL, AV_LOG_DEBUG, "opening %s\n", url);
278
-    ret = ffurl_open(&s->seg_hd, url, URL_RDONLY);
278
+    ret = ffurl_open(&s->seg_hd, url, AVIO_RDONLY);
279 279
     if (ret < 0) {
280 280
         if (url_interrupt_cb())
281 281
             return AVERROR_EXIT;
... ...
@@ -144,7 +144,7 @@ int ffurl_connect(URLContext* uc)
144 144
         return err;
145 145
     uc->is_connected = 1;
146 146
     //We must be careful here as ffurl_seek() could be slow, for example for http
147
-    if(   (uc->flags & (URL_WRONLY | URL_RDWR))
147
+    if(   (uc->flags & (AVIO_WRONLY | AVIO_RDWR))
148 148
        || !strcmp(uc->prot->name, "file"))
149 149
         if(!uc->is_streamed && ffurl_seek(uc, 0, SEEK_SET) < 0)
150 150
             uc->is_streamed= 1;
... ...
@@ -275,7 +275,7 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int
275 275
         ret = transfer_func(h, buf+len, size-len);
276 276
         if (ret == AVERROR(EINTR))
277 277
             continue;
278
-        if (h->flags & URL_FLAG_NONBLOCK)
278
+        if (h->flags & AVIO_FLAG_NONBLOCK)
279 279
             return ret;
280 280
         if (ret == AVERROR(EAGAIN)) {
281 281
             ret = 0;
... ...
@@ -296,21 +296,21 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int
296 296
 
297 297
 int ffurl_read(URLContext *h, unsigned char *buf, int size)
298 298
 {
299
-    if (h->flags & URL_WRONLY)
299
+    if (h->flags & AVIO_WRONLY)
300 300
         return AVERROR(EIO);
301 301
     return retry_transfer_wrapper(h, buf, size, 1, h->prot->url_read);
302 302
 }
303 303
 
304 304
 int ffurl_read_complete(URLContext *h, unsigned char *buf, int size)
305 305
 {
306
-    if (h->flags & URL_WRONLY)
306
+    if (h->flags & AVIO_WRONLY)
307 307
         return AVERROR(EIO);
308 308
     return retry_transfer_wrapper(h, buf, size, size, h->prot->url_read);
309 309
 }
310 310
 
311 311
 int ffurl_write(URLContext *h, const unsigned char *buf, int size)
312 312
 {
313
-    if (!(h->flags & (URL_WRONLY | URL_RDWR)))
313
+    if (!(h->flags & (AVIO_WRONLY | AVIO_RDWR)))
314 314
         return AVERROR(EIO);
315 315
     /* avoid sending too big packets */
316 316
     if (h->max_packet_size && size > h->max_packet_size)
... ...
@@ -348,7 +348,7 @@ int ffurl_close(URLContext *h)
348 348
 int url_exist(const char *filename)
349 349
 {
350 350
     URLContext *h;
351
-    if (ffurl_open(&h, filename, URL_RDONLY) < 0)
351
+    if (ffurl_open(&h, filename, AVIO_RDONLY) < 0)
352 352
         return 0;
353 353
     ffurl_close(h);
354 354
     return 1;
... ...
@@ -63,7 +63,6 @@ typedef struct URLPollEntry {
63 63
     int events;
64 64
     int revents;
65 65
 } URLPollEntry;
66
-#endif
67 66
 
68 67
 /**
69 68
  * @defgroup open_modes URL open modes
... ...
@@ -91,6 +90,7 @@ typedef struct URLPollEntry {
91 91
  * silently ignored.
92 92
  */
93 93
 #define URL_FLAG_NONBLOCK 4
94
+#endif
94 95
 
95 96
 typedef int URLInterruptCB(void);
96 97
 
... ...
@@ -512,6 +512,33 @@ int url_resetbuf(AVIOContext *s, int flags);
512 512
 #endif
513 513
 
514 514
 /**
515
+ * @defgroup open_modes URL open modes
516
+ * The flags argument to avio_open must be one of the following
517
+ * constants, optionally ORed with other flags.
518
+ * @{
519
+ */
520
+#define AVIO_RDONLY 0  /**< read-only */
521
+#define AVIO_WRONLY 1  /**< write-only */
522
+#define AVIO_RDWR   2  /**< read-write */
523
+/**
524
+ * @}
525
+ */
526
+
527
+/**
528
+ * Use non-blocking mode.
529
+ * If this flag is set, operations on the context will return
530
+ * AVERROR(EAGAIN) if they can not be performed immediately.
531
+ * If this flag is not set, operations on the context will never return
532
+ * AVERROR(EAGAIN).
533
+ * Note that this flag does not affect the opening/connecting of the
534
+ * context. Connecting a protocol will always block if necessary (e.g. on
535
+ * network protocols) but never hang (e.g. on busy devices).
536
+ * Warning: non-blocking protocols is work-in-progress; this flag may be
537
+ * silently ignored.
538
+ */
539
+#define AVIO_FLAG_NONBLOCK 4
540
+
541
+/**
515 542
  * Create and initialize a AVIOContext for accessing the
516 543
  * resource indicated by url.
517 544
  * @note When the resource indicated by url has been opened in
... ...
@@ -55,7 +55,7 @@ int ffio_init_context(AVIOContext *s,
55 55
     s->buffer_size = buffer_size;
56 56
     s->buf_ptr = buffer;
57 57
     s->opaque = opaque;
58
-    url_resetbuf(s, write_flag ? URL_WRONLY : URL_RDONLY);
58
+    url_resetbuf(s, write_flag ? AVIO_WRONLY : AVIO_RDONLY);
59 59
     s->write_packet = write_packet;
60 60
     s->read_packet = read_packet;
61 61
     s->seek = seek;
... ...
@@ -845,7 +845,7 @@ int ffio_fdopen(AVIOContext **s, URLContext *h)
845 845
     }
846 846
 
847 847
     if (ffio_init_context(*s, buffer, buffer_size,
848
-                      (h->flags & URL_WRONLY || h->flags & URL_RDWR), h,
848
+                      (h->flags & AVIO_WRONLY || h->flags & AVIO_RDWR), h,
849 849
                       ffurl_read, ffurl_write, ffurl_seek) < 0) {
850 850
         av_free(buffer);
851 851
         av_freep(s);
... ...
@@ -874,7 +874,7 @@ int ffio_set_buf_size(AVIOContext *s, int buf_size)
874 874
     s->buffer = buffer;
875 875
     s->buffer_size = buf_size;
876 876
     s->buf_ptr = buffer;
877
-    url_resetbuf(s, s->write_flag ? URL_WRONLY : URL_RDONLY);
877
+    url_resetbuf(s, s->write_flag ? AVIO_WRONLY : AVIO_RDONLY);
878 878
     return 0;
879 879
 }
880 880
 
... ...
@@ -885,13 +885,13 @@ static int url_resetbuf(AVIOContext *s, int flags)
885 885
 #endif
886 886
 {
887 887
 #if FF_API_URL_RESETBUF
888
-    if (flags & URL_RDWR)
888
+    if (flags & AVIO_RDWR)
889 889
         return AVERROR(EINVAL);
890 890
 #else
891
-    assert(flags == URL_WRONLY || flags == URL_RDONLY);
891
+    assert(flags == AVIO_WRONLY || flags == AVIO_RDONLY);
892 892
 #endif
893 893
 
894
-    if (flags & URL_WRONLY) {
894
+    if (flags & AVIO_WRONLY) {
895 895
         s->buf_end = s->buffer + s->buffer_size;
896 896
         s->write_flag = 1;
897 897
     } else {
... ...
@@ -1049,7 +1049,7 @@ int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags)
1049 1049
     if(!*s)
1050 1050
         return AVERROR(ENOMEM);
1051 1051
     ret = ffio_init_context(*s, buf, buf_size,
1052
-                        (flags & URL_WRONLY || flags & URL_RDWR),
1052
+                        (flags & AVIO_WRONLY || flags & AVIO_RDWR),
1053 1053
                         NULL, NULL, NULL, NULL);
1054 1054
     if(ret != 0)
1055 1055
         av_freep(s);
... ...
@@ -59,9 +59,9 @@ static int file_open(URLContext *h, const char *filename, int flags)
59 59
 
60 60
     av_strstart(filename, "file:", &filename);
61 61
 
62
-    if (flags & URL_RDWR) {
62
+    if (flags & AVIO_RDWR) {
63 63
         access = O_CREAT | O_TRUNC | O_RDWR;
64
-    } else if (flags & URL_WRONLY) {
64
+    } else if (flags & AVIO_WRONLY) {
65 65
         access = O_CREAT | O_TRUNC | O_WRONLY;
66 66
     } else {
67 67
         access = O_RDONLY;
... ...
@@ -116,7 +116,7 @@ static int pipe_open(URLContext *h, const char *filename, int flags)
116 116
 
117 117
     fd = strtol(filename, &final, 10);
118 118
     if((filename == final) || *final ) {/* No digits found, or something like 10ab */
119
-        if (flags & URL_WRONLY) {
119
+        if (flags & AVIO_WRONLY) {
120 120
             fd = 1;
121 121
         } else {
122 122
             fd = 0;
... ...
@@ -100,7 +100,7 @@ static int gopher_open(URLContext *h, const char *uri, int flags)
100 100
     ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL);
101 101
 
102 102
     s->hd = NULL;
103
-    err = ffurl_open(&s->hd, buf, URL_RDWR);
103
+    err = ffurl_open(&s->hd, buf, AVIO_RDWR);
104 104
     if (err < 0)
105 105
         goto fail;
106 106
 
... ...
@@ -124,7 +124,7 @@ static int http_open_cnx(URLContext *h)
124 124
         port = 80;
125 125
 
126 126
     ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL);
127
-    err = ffurl_open(&hd, buf, URL_RDWR);
127
+    err = ffurl_open(&hd, buf, AVIO_RDWR);
128 128
     if (err < 0)
129 129
         goto fail;
130 130
 
... ...
@@ -296,7 +296,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr,
296 296
 
297 297
 
298 298
     /* send http header */
299
-    post = h->flags & URL_WRONLY;
299
+    post = h->flags & AVIO_WRONLY;
300 300
     authstr = ff_http_auth_create_response(&s->auth_state, auth, path,
301 301
                                         post ? "POST" : "GET");
302 302
 
... ...
@@ -451,7 +451,7 @@ static int http_close(URLContext *h)
451 451
     HTTPContext *s = h->priv_data;
452 452
 
453 453
     /* signal end of chunked encoding if used */
454
-    if ((h->flags & URL_WRONLY) && s->chunksize != -1) {
454
+    if ((h->flags & AVIO_WRONLY) && s->chunksize != -1) {
455 455
         ret = ffurl_write(s->hd, footer, sizeof(footer) - 1);
456 456
         ret = ret > 0 ? 0 : ret;
457 457
     }
... ...
@@ -270,7 +270,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt)
270 270
                                   s->path, s->img_number)<0 && s->img_number > 1)
271 271
             return AVERROR(EIO);
272 272
         for(i=0; i<3; i++){
273
-            if (avio_open(&f[i], filename, URL_RDONLY) < 0) {
273
+            if (avio_open(&f[i], filename, AVIO_RDONLY) < 0) {
274 274
                 if(i==1)
275 275
                     break;
276 276
                 av_log(s1, AV_LOG_ERROR, "Could not open file : %s\n",filename);
... ...
@@ -354,7 +354,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
354 354
             return AVERROR(EIO);
355 355
         }
356 356
         for(i=0; i<3; i++){
357
-            if (avio_open(&pb[i], filename, URL_WRONLY) < 0) {
357
+            if (avio_open(&pb[i], filename, AVIO_WRONLY) < 0) {
358 358
                 av_log(s, AV_LOG_ERROR, "Could not open file : %s\n",filename);
359 359
                 return AVERROR(EIO);
360 360
             }
... ...
@@ -93,7 +93,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
93 93
         goto fail;
94 94
     }
95 95
 
96
-    if (flags & URL_WRONLY)
96
+    if (flags & AVIO_WRONLY)
97 97
         RTMP_EnableWrite(r);
98 98
 
99 99
     if (!RTMP_Connect(r, NULL) || !RTMP_ConnectStream(r, 0)) {
... ...
@@ -1330,7 +1330,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
1330 1330
                    && track->codec_priv.size >= 14
1331 1331
                    && track->codec_priv.data != NULL) {
1332 1332
             ffio_init_context(&b, track->codec_priv.data, track->codec_priv.size,
1333
-                          URL_RDONLY, NULL, NULL, NULL, NULL);
1333
+                          AVIO_RDONLY, NULL, NULL, NULL, NULL);
1334 1334
             ff_get_wav_header(&b, st->codec, track->codec_priv.size);
1335 1335
             codec_id = st->codec->codec_id;
1336 1336
             extradata_offset = FFMIN(track->codec_priv.size, 18);
... ...
@@ -36,7 +36,7 @@ static int md5_open(URLContext *h, const char *filename, int flags)
36 36
         return -1;
37 37
     }
38 38
 
39
-    if (flags != URL_WRONLY)
39
+    if (flags != AVIO_WRONLY)
40 40
         return AVERROR(EINVAL);
41 41
 
42 42
     av_md5_init(h->priv_data);
... ...
@@ -65,7 +65,7 @@ static int md5_close(URLContext *h)
65 65
     av_strstart(filename, "md5:", &filename);
66 66
 
67 67
     if (*filename) {
68
-        err = ffurl_open(&out, filename, URL_WRONLY);
68
+        err = ffurl_open(&out, filename, AVIO_WRONLY);
69 69
         if (err)
70 70
             return err;
71 71
         err = ffurl_write(out, buf, i*2+1);
... ...
@@ -233,7 +233,7 @@ static int mmsh_open(URLContext *h, const char *uri, int flags)
233 233
         port = 80; // default mmsh protocol port
234 234
     ff_url_join(httpname, sizeof(httpname), "http", NULL, host, port, path);
235 235
 
236
-    if (ffurl_alloc(&mms->mms_hd, httpname, URL_RDONLY) < 0) {
236
+    if (ffurl_alloc(&mms->mms_hd, httpname, AVIO_RDONLY) < 0) {
237 237
         return AVERROR(EIO);
238 238
     }
239 239
 
... ...
@@ -261,7 +261,7 @@ static int mmsh_open(URLContext *h, const char *uri, int flags)
261 261
     // close the socket and then reopen it for sending the second play request.
262 262
     ffurl_close(mms->mms_hd);
263 263
     memset(headers, 0, sizeof(headers));
264
-    if (ffurl_alloc(&mms->mms_hd, httpname, URL_RDONLY) < 0) {
264
+    if (ffurl_alloc(&mms->mms_hd, httpname, AVIO_RDONLY) < 0) {
265 265
         return AVERROR(EIO);
266 266
     }
267 267
     stream_selection = av_mallocz(mms->stream_num * 19 + 1);
... ...
@@ -523,7 +523,7 @@ static int mms_open(URLContext *h, const char *uri, int flags)
523 523
 
524 524
     // establish tcp connection.
525 525
     ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, mmst->host, port, NULL);
526
-    err = ffurl_open(&mms->mms_hd, tcpname, URL_RDWR);
526
+    err = ffurl_open(&mms->mms_hd, tcpname, AVIO_RDWR);
527 527
     if (err)
528 528
         goto fail;
529 529
 
... ...
@@ -1722,7 +1722,7 @@ static int mov_open_dref(AVIOContext **pb, char *src, MOVDref *ref)
1722 1722
 
1723 1723
             av_strlcat(filename, ref->path + l + 1, 1024);
1724 1724
 
1725
-            if (!avio_open(pb, filename, URL_RDONLY))
1725
+            if (!avio_open(pb, filename, AVIO_RDONLY))
1726 1726
                 return 0;
1727 1727
         }
1728 1728
     }
... ...
@@ -492,7 +492,7 @@ int main(int argc, char **argv)
492 492
 
493 493
     /* open the output file, if needed */
494 494
     if (!(fmt->flags & AVFMT_NOFILE)) {
495
-        if (avio_open(&oc->pb, filename, URL_WRONLY) < 0) {
495
+        if (avio_open(&oc->pb, filename, AVIO_WRONLY) < 0) {
496 496
             fprintf(stderr, "Could not open '%s'\n", filename);
497 497
             exit(1);
498 498
         }
... ...
@@ -812,7 +812,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
812 812
     if (!rt)
813 813
         return AVERROR(ENOMEM);
814 814
     s->priv_data = rt;
815
-    rt->is_input = !(flags & URL_WRONLY);
815
+    rt->is_input = !(flags & AVIO_WRONLY);
816 816
 
817 817
     av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), &port,
818 818
                  path, sizeof(path), s->filename);
... ...
@@ -821,7 +821,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
821 821
         port = RTMP_DEFAULT_PORT;
822 822
     ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL);
823 823
 
824
-    if (ffurl_open(&rt->stream, buf, URL_RDWR) < 0) {
824
+    if (ffurl_open(&rt->stream, buf, AVIO_RDWR) < 0) {
825 825
         av_log(LOG_CONTEXT, AV_LOG_ERROR, "Cannot open connection %s\n", buf);
826 826
         goto fail;
827 827
     }
... ...
@@ -145,7 +145,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
145 145
     char path[1024];
146 146
     const char *p;
147 147
 
148
-    is_output = (flags & URL_WRONLY);
148
+    is_output = (flags & AVIO_WRONLY);
149 149
 
150 150
     s = av_mallocz(sizeof(RTPContext));
151 151
     if (!s)
... ...
@@ -1116,14 +1116,14 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
1116 1116
                                 "?localport=%d", j);
1117 1117
                     /* we will use two ports per rtp stream (rtp and rtcp) */
1118 1118
                     j += 2;
1119
-                    if (ffurl_open(&rtsp_st->rtp_handle, buf, URL_RDWR) == 0)
1119
+                    if (ffurl_open(&rtsp_st->rtp_handle, buf, AVIO_RDWR) == 0)
1120 1120
                         goto rtp_opened;
1121 1121
                 }
1122 1122
             }
1123 1123
 
1124 1124
 #if 0
1125 1125
             /* then try on any port */
1126
-            if (ffurl_open(&rtsp_st->rtp_handle, "rtp://", URL_RDONLY) < 0) {
1126
+            if (ffurl_open(&rtsp_st->rtp_handle, "rtp://", AVIO_RDONLY) < 0) {
1127 1127
                 err = AVERROR_INVALIDDATA;
1128 1128
                 goto fail;
1129 1129
             }
... ...
@@ -1269,7 +1269,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
1269 1269
                         namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);
1270 1270
             ff_url_join(url, sizeof(url), "rtp", NULL, namebuf,
1271 1271
                         port, "?ttl=%d", ttl);
1272
-            if (ffurl_open(&rtsp_st->rtp_handle, url, URL_RDWR) < 0) {
1272
+            if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_RDWR) < 0) {
1273 1273
                 err = AVERROR_INVALIDDATA;
1274 1274
                 goto fail;
1275 1275
             }
... ...
@@ -1396,7 +1396,7 @@ redirect:
1396 1396
                  av_get_random_seed(), av_get_random_seed());
1397 1397
 
1398 1398
         /* GET requests */
1399
-        if (ffurl_alloc(&rt->rtsp_hd, httpname, URL_RDONLY) < 0) {
1399
+        if (ffurl_alloc(&rt->rtsp_hd, httpname, AVIO_RDONLY) < 0) {
1400 1400
             err = AVERROR(EIO);
1401 1401
             goto fail;
1402 1402
         }
... ...
@@ -1417,7 +1417,7 @@ redirect:
1417 1417
         }
1418 1418
 
1419 1419
         /* POST requests */
1420
-        if (ffurl_alloc(&rt->rtsp_hd_out, httpname, URL_WRONLY) < 0 ) {
1420
+        if (ffurl_alloc(&rt->rtsp_hd_out, httpname, AVIO_WRONLY) < 0 ) {
1421 1421
             err = AVERROR(EIO);
1422 1422
             goto fail;
1423 1423
         }
... ...
@@ -1460,7 +1460,7 @@ redirect:
1460 1460
     } else {
1461 1461
         /* open the tcp connection */
1462 1462
         ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, host, port, NULL);
1463
-        if (ffurl_open(&rt->rtsp_hd, tcpname, URL_RDWR) < 0) {
1463
+        if (ffurl_open(&rt->rtsp_hd, tcpname, AVIO_RDWR) < 0) {
1464 1464
             err = AVERROR(EIO);
1465 1465
             goto fail;
1466 1466
         }
... ...
@@ -1807,7 +1807,7 @@ static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap)
1807 1807
                     namebuf, rtsp_st->sdp_port,
1808 1808
                     "?localport=%d&ttl=%d", rtsp_st->sdp_port,
1809 1809
                     rtsp_st->sdp_ttl);
1810
-        if (ffurl_open(&rtsp_st->rtp_handle, url, URL_RDWR) < 0) {
1810
+        if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_RDWR) < 0) {
1811 1811
             err = AVERROR_INVALIDDATA;
1812 1812
             goto fail;
1813 1813
         }
... ...
@@ -1863,7 +1863,7 @@ static int rtp_read_header(AVFormatContext *s,
1863 1863
     if (!ff_network_init())
1864 1864
         return AVERROR(EIO);
1865 1865
 
1866
-    ret = ffurl_open(&in, s->filename, URL_RDONLY);
1866
+    ret = ffurl_open(&in, s->filename, AVIO_RDONLY);
1867 1867
     if (ret)
1868 1868
         goto fail;
1869 1869
 
... ...
@@ -85,7 +85,7 @@ static int sap_read_header(AVFormatContext *s,
85 85
 
86 86
     ff_url_join(url, sizeof(url), "udp", NULL, host, port, "?localport=%d",
87 87
                 port);
88
-    ret = ffurl_open(&sap->ann_fd, url, URL_RDONLY);
88
+    ret = ffurl_open(&sap->ann_fd, url, AVIO_RDONLY);
89 89
     if (ret)
90 90
         goto fail;
91 91
 
... ...
@@ -146,7 +146,7 @@ static int sap_write_header(AVFormatContext *s)
146 146
                     "?ttl=%d", ttl);
147 147
         if (!same_port)
148 148
             base_port += 2;
149
-        ret = ffurl_open(&fd, url, URL_WRONLY);
149
+        ret = ffurl_open(&fd, url, AVIO_WRONLY);
150 150
         if (ret) {
151 151
             ret = AVERROR(EIO);
152 152
             goto fail;
... ...
@@ -158,7 +158,7 @@ static int sap_write_header(AVFormatContext *s)
158 158
 
159 159
     ff_url_join(url, sizeof(url), "udp", NULL, announce_addr, port,
160 160
                 "?ttl=%d&connect=1", ttl);
161
-    ret = ffurl_open(&sap->ann_fd, url, URL_WRONLY);
161
+    ret = ffurl_open(&sap->ann_fd, url, AVIO_WRONLY);
162 162
     if (ret) {
163 163
         ret = AVERROR(EIO);
164 164
         goto fail;
... ...
@@ -156,7 +156,7 @@ static int tcp_read(URLContext *h, uint8_t *buf, int size)
156 156
     TCPContext *s = h->priv_data;
157 157
     int ret;
158 158
 
159
-    if (!(h->flags & URL_FLAG_NONBLOCK)) {
159
+    if (!(h->flags & AVIO_FLAG_NONBLOCK)) {
160 160
         ret = ff_network_wait_fd(s->fd, 0);
161 161
         if (ret < 0)
162 162
             return ret;
... ...
@@ -170,7 +170,7 @@ static int tcp_write(URLContext *h, const uint8_t *buf, int size)
170 170
     TCPContext *s = h->priv_data;
171 171
     int ret;
172 172
 
173
-    if (!(h->flags & URL_FLAG_NONBLOCK)) {
173
+    if (!(h->flags & AVIO_FLAG_NONBLOCK)) {
174 174
         ret = ff_network_wait_fd(s->fd, 1);
175 175
         if (ret < 0)
176 176
             return ret;
... ...
@@ -317,7 +317,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
317 317
     h->is_streamed = 1;
318 318
     h->max_packet_size = 1472;
319 319
 
320
-    is_output = (flags & URL_WRONLY);
320
+    is_output = (flags & AVIO_WRONLY);
321 321
 
322 322
     s = av_mallocz(sizeof(UDPContext));
323 323
     if (!s)
... ...
@@ -360,14 +360,14 @@ static int udp_open(URLContext *h, const char *uri, int flags)
360 360
     /* XXX: fix av_url_split */
361 361
     if (hostname[0] == '\0' || hostname[0] == '?') {
362 362
         /* only accepts null hostname if input */
363
-        if (flags & URL_WRONLY)
363
+        if (flags & AVIO_WRONLY)
364 364
             goto fail;
365 365
     } else {
366 366
         if (ff_udp_set_remote_url(h, uri) < 0)
367 367
             goto fail;
368 368
     }
369 369
 
370
-    if (s->is_multicast && !(h->flags & URL_WRONLY))
370
+    if (s->is_multicast && !(h->flags & AVIO_WRONLY))
371 371
         s->local_port = port;
372 372
     udp_fd = udp_socket_create(s, &my_addr, &len);
373 373
     if (udp_fd < 0)
... ...
@@ -384,7 +384,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
384 384
 
385 385
     /* the bind is needed to give a port to the socket now */
386 386
     /* if multicast, try the multicast address bind first */
387
-    if (s->is_multicast && !(h->flags & URL_WRONLY)) {
387
+    if (s->is_multicast && !(h->flags & AVIO_WRONLY)) {
388 388
         bind_ret = bind(udp_fd,(struct sockaddr *)&s->dest_addr, len);
389 389
     }
390 390
     /* bind to the local address if not multicast or if the multicast
... ...
@@ -397,7 +397,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
397 397
     s->local_port = udp_port(&my_addr, len);
398 398
 
399 399
     if (s->is_multicast) {
400
-        if (h->flags & URL_WRONLY) {
400
+        if (h->flags & AVIO_WRONLY) {
401 401
             /* output */
402 402
             if (udp_set_multicast_ttl(udp_fd, s->ttl, (struct sockaddr *)&s->dest_addr) < 0)
403 403
                 goto fail;
... ...
@@ -446,7 +446,7 @@ static int udp_read(URLContext *h, uint8_t *buf, int size)
446 446
     UDPContext *s = h->priv_data;
447 447
     int ret;
448 448
 
449
-    if (!(h->flags & URL_FLAG_NONBLOCK)) {
449
+    if (!(h->flags & AVIO_FLAG_NONBLOCK)) {
450 450
         ret = ff_network_wait_fd(s->udp_fd, 0);
451 451
         if (ret < 0)
452 452
             return ret;
... ...
@@ -460,7 +460,7 @@ static int udp_write(URLContext *h, const uint8_t *buf, int size)
460 460
     UDPContext *s = h->priv_data;
461 461
     int ret;
462 462
 
463
-    if (!(h->flags & URL_FLAG_NONBLOCK)) {
463
+    if (!(h->flags & AVIO_FLAG_NONBLOCK)) {
464 464
         ret = ff_network_wait_fd(s->udp_fd, 1);
465 465
         if (ret < 0)
466 466
             return ret;
... ...
@@ -480,7 +480,7 @@ static int udp_close(URLContext *h)
480 480
 {
481 481
     UDPContext *s = h->priv_data;
482 482
 
483
-    if (s->is_multicast && !(h->flags & URL_WRONLY))
483
+    if (s->is_multicast && !(h->flags & AVIO_WRONLY))
484 484
         udp_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr);
485 485
     closesocket(s->udp_fd);
486 486
     av_free(s);
... ...
@@ -631,7 +631,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
631 631
        hack needed to handle RTSP/TCP */
632 632
     if (!fmt || !(fmt->flags & AVFMT_NOFILE)) {
633 633
         /* if no file needed do not try to open one */
634
-        if ((err=avio_open(&pb, filename, URL_RDONLY)) < 0) {
634
+        if ((err=avio_open(&pb, filename, AVIO_RDONLY)) < 0) {
635 635
             goto fail;
636 636
         }
637 637
         if (buf_size > 0) {