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
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 int (*url_read)( URLContext *h, unsigned char *buf, int size);
00063 int (*url_write)(URLContext *h, const unsigned char *buf, int size);
00064 int64_t (*url_seek)( URLContext *h, int64_t pos, int whence);
00065 int (*url_close)(URLContext *h);
00066 struct URLProtocol *next;
00067 int (*url_read_pause)(URLContext *h, int pause);
00068 int64_t (*url_read_seek)(URLContext *h, int stream_index,
00069 int64_t timestamp, int flags);
00070 int (*url_get_file_handle)(URLContext *h);
00071 int priv_data_size;
00072 const AVClass *priv_data_class;
00073 int flags;
00074 int (*url_check)(URLContext *h, int mask);
00075 } URLProtocol;
00076 #endif
00077
00091 int ffurl_alloc(URLContext **puc, const char *filename, int flags,
00092 const AVIOInterruptCB *int_cb);
00093
00102 int ffurl_connect(URLContext *uc, AVDictionary **options);
00103
00120 int ffurl_open(URLContext **puc, const char *filename, int flags,
00121 const AVIOInterruptCB *int_cb, AVDictionary **options);
00122
00132 int ffurl_read(URLContext *h, unsigned char *buf, int size);
00133
00141 int ffurl_read_complete(URLContext *h, unsigned char *buf, int size);
00142
00149 int ffurl_write(URLContext *h, const unsigned char *buf, int size);
00150
00165 int64_t ffurl_seek(URLContext *h, int64_t pos, int whence);
00166
00174 int ffurl_close(URLContext *h);
00175
00181 int64_t ffurl_size(URLContext *h);
00182
00189 int ffurl_get_file_handle(URLContext *h);
00190
00196 int ffurl_register_protocol(URLProtocol *protocol, int size);
00197
00202 int ff_check_interrupt(AVIOInterruptCB *cb);
00203
00209 URLProtocol *ffurl_protocol_next(URLProtocol *prev);
00210
00211
00212 int ff_udp_set_remote_url(URLContext *h, const char *uri);
00213 int ff_udp_get_local_port(URLContext *h);
00214
00215 #endif