00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00025 #ifndef AVFORMAT_URL_H
00026 #define AVFORMAT_URL_H
00027
00028 #include "avio.h"
00029 #include "libavformat/version.h"
00030
00031 #include "libavutil/dict.h"
00032 #include "libavutil/log.h"
00033
00034 #define URL_PROTOCOL_FLAG_NESTED_SCHEME 1
00035 #define URL_PROTOCOL_FLAG_NETWORK 2
00036
00037 extern int (*url_interrupt_cb)(void);
00038
00039 extern const AVClass ffurl_context_class;
00040
00041 typedef struct URLContext {
00042 const AVClass *av_class;
00043 struct URLProtocol *prot;
00044 void *priv_data;
00045 char *filename;
00046 int flags;
00047 int max_packet_size;
00048 int is_streamed;
00049 int is_connected;
00050 AVIOInterruptCB interrupt_callback;
00051 } URLContext;
00052
00053 typedef struct URLProtocol {
00054 const char *name;
00055 int (*url_open)( URLContext *h, const char *url, int flags);
00061 int (*url_open2)(URLContext *h, const char *url, int flags, AVDictionary **options);
00062
00075 int (*url_read)( URLContext *h, unsigned char *buf, int size);
00076 int (*url_write)(URLContext *h, const unsigned char *buf, int size);
00077 int64_t (*url_seek)( URLContext *h, int64_t pos, int whence);
00078 int (*url_close)(URLContext *h);
00079 struct URLProtocol *next;
00080 int (*url_read_pause)(URLContext *h, int pause);
00081 int64_t (*url_read_seek)(URLContext *h, int stream_index,
00082 int64_t timestamp, int flags);
00083 int (*url_get_file_handle)(URLContext *h);
00084 int (*url_shutdown)(URLContext *h, int flags);
00085 int priv_data_size;
00086 const AVClass *priv_data_class;
00087 int flags;
00088 int (*url_check)(URLContext *h, int mask);
00089 } URLProtocol;
00090
00104 int ffurl_alloc(URLContext **puc, const char *filename, int flags,
00105 const AVIOInterruptCB *int_cb);
00106
00115 int ffurl_connect(URLContext *uc, AVDictionary **options);
00116
00133 int ffurl_open(URLContext **puc, const char *filename, int flags,
00134 const AVIOInterruptCB *int_cb, AVDictionary **options);
00135
00145 int ffurl_read(URLContext *h, unsigned char *buf, int size);
00146
00154 int ffurl_read_complete(URLContext *h, unsigned char *buf, int size);
00155
00162 int ffurl_write(URLContext *h, const unsigned char *buf, int size);
00163
00178 int64_t ffurl_seek(URLContext *h, int64_t pos, int whence);
00179
00187 int ffurl_close(URLContext *h);
00188
00194 int64_t ffurl_size(URLContext *h);
00195
00202 int ffurl_get_file_handle(URLContext *h);
00203
00214 int ffurl_shutdown(URLContext *h, int flags);
00215
00221 int ffurl_register_protocol(URLProtocol *protocol, int size);
00222
00227 int ff_check_interrupt(AVIOInterruptCB *cb);
00228
00234 URLProtocol *ffurl_protocol_next(URLProtocol *prev);
00235
00236
00237 int ff_udp_set_remote_url(URLContext *h, const char *uri);
00238 int ff_udp_get_local_port(URLContext *h);
00239
00240 #endif