Browse code

avio: make url_fdopen internal.

The unbuffered URLContext API will be made private, so there's no point
in this function being public.

Anton Khirnov authored on 2011/03/17 16:44:44
Showing 4 changed files
... ...
@@ -450,6 +450,7 @@ attribute_deprecated void put_flush_packet(AVIOContext *s);
450 450
 attribute_deprecated int url_open_dyn_buf(AVIOContext **s);
451 451
 attribute_deprecated int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size);
452 452
 attribute_deprecated int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
453
+attribute_deprecated int url_fdopen(AVIOContext **s, URLContext *h);
453 454
 /**
454 455
  * @}
455 456
  */
... ...
@@ -625,19 +626,6 @@ attribute_deprecated static inline int url_is_streamed(AVIOContext *s)
625 625
 }
626 626
 #endif
627 627
 
628
-/**
629
- * Create and initialize a AVIOContext for accessing the
630
- * resource referenced by the URLContext h.
631
- * @note When the URLContext h has been opened in read+write mode, the
632
- * AVIOContext can be used only for writing.
633
- *
634
- * @param s Used to return the pointer to the created AVIOContext.
635
- * In case of failure the pointed to value is set to NULL.
636
- * @return 0 in case of success, a negative value corresponding to an
637
- * AVERROR code in case of failure
638
- */
639
-int url_fdopen(AVIOContext **s, URLContext *h);
640
-
641 628
 #if FF_API_URL_RESETBUF
642 629
 /** Reset the buffer for reading or writing.
643 630
  * @note Will drop any data currently in the buffer without transmitting it.
... ...
@@ -92,4 +92,17 @@ unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf,
92 92
  */
93 93
 int ffio_open_dyn_packet_buf(AVIOContext **s, int max_packet_size);
94 94
 
95
+/**
96
+ * Create and initialize a AVIOContext for accessing the
97
+ * resource referenced by the URLContext h.
98
+ * @note When the URLContext h has been opened in read+write mode, the
99
+ * AVIOContext can be used only for writing.
100
+ *
101
+ * @param s Used to return the pointer to the created AVIOContext.
102
+ * In case of failure the pointed to value is set to NULL.
103
+ * @return 0 in case of success, a negative value corresponding to an
104
+ * AVERROR code in case of failure
105
+ */
106
+int ffio_fdopen(AVIOContext **s, URLContext *h);
107
+
95 108
 #endif // AVFORMAT_AVIO_INTERNAL_H
... ...
@@ -431,6 +431,10 @@ int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
431 431
 {
432 432
     return avio_close_dyn_buf(s, pbuffer);
433 433
 }
434
+int url_fdopen(AVIOContext **s, URLContext *h)
435
+{
436
+    return ffio_fdopen(s, h);
437
+}
434 438
 #endif
435 439
 
436 440
 int avio_put_str(AVIOContext *s, const char *str)
... ...
@@ -818,7 +822,7 @@ uint64_t ffio_read_varlen(AVIOContext *bc){
818 818
     return val;
819 819
 }
820 820
 
821
-int url_fdopen(AVIOContext **s, URLContext *h)
821
+int ffio_fdopen(AVIOContext **s, URLContext *h)
822 822
 {
823 823
     uint8_t *buffer;
824 824
     int buffer_size, max_packet_size;
... ...
@@ -943,7 +947,7 @@ int avio_open(AVIOContext **s, const char *filename, int flags)
943 943
     err = url_open(&h, filename, flags);
944 944
     if (err < 0)
945 945
         return err;
946
-    err = url_fdopen(s, h);
946
+    err = ffio_fdopen(s, h);
947 947
     if (err < 0) {
948 948
         url_close(h);
949 949
         return err;
... ...
@@ -20,6 +20,7 @@
20 20
  */
21 21
 
22 22
 #include "avformat.h"
23
+#include "avio_internal.h"
23 24
 #include "rtpenc_chain.h"
24 25
 #include "avio_internal.h"
25 26
 
... ...
@@ -54,7 +55,7 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
54 54
     avcodec_copy_context(rtpctx->streams[0]->codec, st->codec);
55 55
 
56 56
     if (handle) {
57
-        url_fdopen(&rtpctx->pb, handle);
57
+        ffio_fdopen(&rtpctx->pb, handle);
58 58
     } else
59 59
         ffio_open_dyn_packet_buf(&rtpctx->pb, packet_size);
60 60
     ret = av_write_header(rtpctx);