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 #if !FF_API_OLD_AVIO
00035 #define URL_PROTOCOL_FLAG_NESTED_SCHEME 1
00036 #define URL_PROTOCOL_FLAG_NETWORK 2
00037
00038 extern int (*url_interrupt_cb)(void);
00039
00040 extern const AVClass ffurl_context_class;
00041
00042 typedef struct URLContext {
00043 const AVClass *av_class;
00044 struct URLProtocol *prot;
00045 void *priv_data;
00046 char *filename;
00047 int flags;
00048 int max_packet_size;
00049 int is_streamed;
00050 int is_connected;
00051 AVIOInterruptCB interrupt_callback;
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 int (*url_read)( URLContext *h, unsigned char *buf, int size);
00064 int (*url_write)(URLContext *h, const unsigned char *buf, int size);
00065 int64_t (*url_seek)( URLContext *h, int64_t pos, int whence);
00066 int (*url_close)(URLContext *h);
00067 struct URLProtocol *next;
00068 int (*url_read_pause)(URLContext *h, int pause);
00069 int64_t (*url_read_seek)(URLContext *h, int stream_index,
00070 int64_t timestamp, int flags);
00071 int (*url_get_file_handle)(URLContext *h);
00072 int priv_data_size;
00073 const AVClass *priv_data_class;
00074 int flags;
00075 int (*url_check)(URLContext *h, int mask);
00076 } URLProtocol;
00077 #endif
00078
00092 int ffurl_alloc(URLContext **puc, const char *filename, int flags,
00093 const AVIOInterruptCB *int_cb);
00094
00103 int ffurl_connect(URLContext *uc, AVDictionary **options);
00104
00121 int ffurl_open(URLContext **puc, const char *filename, int flags,
00122 const AVIOInterruptCB *int_cb, AVDictionary **options);
00123
00133 int ffurl_read(URLContext *h, unsigned char *buf, int size);
00134
00142 int ffurl_read_complete(URLContext *h, unsigned char *buf, int size);
00143
00150 int ffurl_write(URLContext *h, const unsigned char *buf, int size);
00151
00166 int64_t ffurl_seek(URLContext *h, int64_t pos, int whence);
00167
00175 int ffurl_close(URLContext *h);
00176
00182 int64_t ffurl_size(URLContext *h);
00183
00190 int ffurl_get_file_handle(URLContext *h);
00191
00197 int ffurl_register_protocol(URLProtocol *protocol, int size);
00198
00203 int ff_check_interrupt(AVIOInterruptCB *cb);
00204
00210 URLProtocol *ffurl_protocol_next(URLProtocol *prev);
00211
00212
00213 int ff_udp_set_remote_url(URLContext *h, const char *uri);
00214 int ff_udp_get_local_port(URLContext *h);
00215
00216 #endif