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 int64_t rw_timeout;
00052 } URLContext;
00053
00054 typedef struct URLProtocol {
00055 const char *name;
00056 int (*url_open)( URLContext *h, const char *url, int flags);
00062 int (*url_open2)(URLContext *h, const char *url, int flags, AVDictionary **options);
00063
00076 int (*url_read)( URLContext *h, unsigned char *buf, int size);
00077 int (*url_write)(URLContext *h, const unsigned char *buf, int size);
00078 int64_t (*url_seek)( URLContext *h, int64_t pos, int whence);
00079 int (*url_close)(URLContext *h);
00080 struct URLProtocol *next;
00081 int (*url_read_pause)(URLContext *h, int pause);
00082 int64_t (*url_read_seek)(URLContext *h, int stream_index,
00083 int64_t timestamp, int flags);
00084 int (*url_get_file_handle)(URLContext *h);
00085 int (*url_get_multi_file_handle)(URLContext *h, int **handles,
00086 int *numhandles);
00087 int (*url_shutdown)(URLContext *h, int flags);
00088 int priv_data_size;
00089 const AVClass *priv_data_class;
00090 int flags;
00091 int (*url_check)(URLContext *h, int mask);
00092 } URLProtocol;
00093
00107 int ffurl_alloc(URLContext **puc, const char *filename, int flags,
00108 const AVIOInterruptCB *int_cb);
00109
00118 int ffurl_connect(URLContext *uc, AVDictionary **options);
00119
00136 int ffurl_open(URLContext **puc, const char *filename, int flags,
00137 const AVIOInterruptCB *int_cb, AVDictionary **options);
00138
00148 int ffurl_read(URLContext *h, unsigned char *buf, int size);
00149
00157 int ffurl_read_complete(URLContext *h, unsigned char *buf, int size);
00158
00165 int ffurl_write(URLContext *h, const unsigned char *buf, int size);
00166
00181 int64_t ffurl_seek(URLContext *h, int64_t pos, int whence);
00182
00190 int ffurl_closep(URLContext **h);
00191 int ffurl_close(URLContext *h);
00192
00198 int64_t ffurl_size(URLContext *h);
00199
00206 int ffurl_get_file_handle(URLContext *h);
00207
00213 int ffurl_get_multi_file_handle(URLContext *h, int **handles, int *numhandles);
00214
00225 int ffurl_shutdown(URLContext *h, int flags);
00226
00232 int ffurl_register_protocol(URLProtocol *protocol, int size);
00233
00238 int ff_check_interrupt(AVIOInterruptCB *cb);
00239
00245 URLProtocol *ffurl_protocol_next(URLProtocol *prev);
00246
00247
00248 int ff_udp_set_remote_url(URLContext *h, const char *uri);
00249 int ff_udp_get_local_port(URLContext *h);
00250
00251 #endif