diff options
author | Fabrice Bellard <fabrice@bellard.org> | 2002-07-24 17:49:11 +0000 |
---|---|---|
committer | Fabrice Bellard <fabrice@bellard.org> | 2002-07-24 17:49:11 +0000 |
commit | f031df23feb2b4211a96fc0ac602dc1f6a0432a7 (patch) | |
tree | d7e52e421668790dca65047e975db5bc5292c6a3 /libav/avio.h | |
parent | 2d225591e97f407ce9ae794d698fcb5d15d009a2 (diff) | |
download | ffmpeg-f031df23feb2b4211a96fc0ac602dc1f6a0432a7.tar.gz |
api change for packet based protocols (such as UDP and RTP)
Originally committed as revision 794 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libav/avio.h')
-rw-r--r-- | libav/avio.h | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/libav/avio.h b/libav/avio.h index 36263167a8..2c13c0377c 100644 --- a/libav/avio.h +++ b/libav/avio.h @@ -1,3 +1,6 @@ +#ifndef AVIO_H +#define AVIO_H + /* output byte stream handling */ typedef INT64 offset_t; @@ -8,7 +11,7 @@ struct URLContext { struct URLProtocol *prot; int flags; int is_streamed; /* true if streamed (no seek possible), default = false */ - int packet_size; + int max_packet_size; /* if non zero, the stream is packetized with this max packet size */ void *priv_data; }; @@ -22,6 +25,8 @@ typedef struct URLPollEntry { #define URL_RDONLY 0 #define URL_WRONLY 1 +#define URL_RDWR 2 + int url_open(URLContext **h, const char *filename, int flags); int url_read(URLContext *h, unsigned char *buf, int size); int url_write(URLContext *h, unsigned char *buf, int size); @@ -29,6 +34,7 @@ offset_t url_seek(URLContext *h, offset_t pos, int whence); int url_close(URLContext *h); int url_exist(const char *filename); offset_t url_filesize(URLContext *h); +int url_get_max_packet_size(URLContext *h); /* not implemented */ int url_poll(URLPollEntry *poll_table, int n, int timeout); @@ -59,7 +65,7 @@ typedef struct { int eof_reached; /* true if eof reached */ int write_flag; /* true if open for writing */ int is_streamed; - int packet_size; + int max_packet_size; } ByteIOContext; int init_put_byte(ByteIOContext *s, @@ -86,6 +92,11 @@ void url_fskip(ByteIOContext *s, offset_t offset); offset_t url_ftell(ByteIOContext *s); int url_feof(ByteIOContext *s); +#define URL_EOF (-1) +int url_fgetc(ByteIOContext *s); +int url_fprintf(ByteIOContext *s, const char *fmt, ...); +char *url_fgets(ByteIOContext *s, char *buf, int buf_size); + void put_flush_packet(ByteIOContext *s); int get_buffer(ByteIOContext *s, unsigned char *buf, int size); @@ -102,28 +113,36 @@ static inline int url_is_streamed(ByteIOContext *s) { return s->is_streamed; } -/* get the prefered packet size of the device. All I/Os should be done - by multiple of this size */ -static inline int url_get_packet_size(ByteIOContext *s) -{ - return s->packet_size; -} int url_fdopen(ByteIOContext *s, URLContext *h); int url_setbufsize(ByteIOContext *s, int buf_size); int url_fopen(ByteIOContext *s, const char *filename, int flags); int url_fclose(ByteIOContext *s); URLContext *url_fileno(ByteIOContext *s); +int url_fget_max_packet_size(ByteIOContext *s); int url_open_buf(ByteIOContext *s, UINT8 *buf, int buf_size, int flags); int url_close_buf(ByteIOContext *s); +int url_open_dyn_buf(ByteIOContext *s); +int url_open_dyn_packet_buf(ByteIOContext *s, int max_packet_size); +int url_close_dyn_buf(ByteIOContext *s, UINT8 **pbuffer); + /* file.c */ extern URLProtocol file_protocol; extern URLProtocol pipe_protocol; /* udp.c */ extern URLProtocol udp_protocol; +int udp_set_remote_url(URLContext *h, const char *uri); +int udp_get_local_port(URLContext *h); +int udp_get_file_handle(URLContext *h); + +/* tcp.c */ +extern URLProtocol tcp_protocol; /* http.c */ extern URLProtocol http_protocol; + +#endif + |