87 #if FF_API_OLD_INTERRUPT_CB
88 static int default_interrupt_cb(
void);
103 if (!*p)
return NULL;
104 if ((output && (*p)->url_write) || (!output && (*p)->url_read))
114 memcpy(temp, protocol, size);
125 const char *filename,
int flags,
188 const char *filename,
int flags)
203 int url_alloc(
URLContext **puc,
const char *filename,
int flags)
211 int url_open(
URLContext **puc,
const char *filename,
int flags)
219 int url_read_complete(
URLContext *h,
unsigned char *buf,
int size)
227 int64_t url_seek(
URLContext *h, int64_t pos,
int whence)
247 void url_get_filename(
URLContext *h,
char *buf,
int buf_size)
251 void url_set_interrupt_cb(URLInterruptCB *interrupt_cb)
253 avio_set_interrupt_cb(interrupt_cb);
261 #define URL_SCHEME_CHARS \
262 "abcdefghijklmnopqrstuvwxyz" \
263 "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
270 char proto_str[128], proto_nested[128], *ptr;
273 if (filename[proto_len] !=
':' ||
is_dos_path(filename))
274 strcpy(proto_str,
"file");
276 av_strlcpy(proto_str, filename,
FFMIN(proto_len+1,
sizeof(proto_str)));
278 av_strlcpy(proto_nested, proto_str,
sizeof(proto_nested));
279 if ((ptr = strchr(proto_nested,
'+')))
283 if (!strcmp(proto_str, up->
name))
286 !strcmp(proto_nested, up->
name))
296 int ret =
ffurl_alloc(puc, filename, flags, int_cb);
299 if (options && (*puc)->prot->priv_data_class &&
312 int (*transfer_func)(
URLContext *h,
unsigned char *buf,
int size))
315 int fast_retries = 5;
318 while (len < size_min) {
319 ret = transfer_func(h, buf+len, size-len);
333 fast_retries =
FFMAX(fast_retries, 2);
397 int url_exist(
const char *filename)
448 #if FF_API_OLD_INTERRUPT_CB
449 static int default_interrupt_cb(
void)
454 void avio_set_interrupt_cb(
int (*interrupt_cb)(
void))
457 interrupt_cb = default_interrupt_cb;
467 #if FF_API_OLD_INTERRUPT_CB
475 int av_url_read_pause(
URLContext *h,
int pause)
483 int stream_index, int64_t timestamp,
int flags)
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
int ffurl_register_protocol(URLProtocol *protocol, int size)
Register the URLProtocol protocol.
#define URL_PROTOCOL_FLAG_NETWORK
int(* url_check)(URLContext *h, int mask)
int ffurl_write(URLContext *h, const unsigned char *buf, int size)
Write size bytes from buf to the resource accessed by h.
int is_streamed
true if streamed (no seek possible), default = false
static URLProtocol * first_protocol
int ffurl_connect(URLContext *uc, AVDictionary **options)
Connect an URLContext that has been allocated by ffurl_alloc.
AVIOInterruptCB interrupt_callback
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
#define AVIO_FLAG_READ
read-only
struct URLProtocol * prot
#define AVIO_FLAG_WRITE
write-only
void ff_network_close(void)
static void * urlcontext_child_next(void *obj, void *prev)
const AVClass * priv_data_class
struct URLProtocol * next
int avio_check(const char *url, int flags)
Return AVIO_FLAG_* access flags corresponding to the access permissions of the resource in url...
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
int ff_network_init(void)
miscellaneous OS support macros and functions.
static int url_alloc_for_protocol(URLContext **puc, struct URLProtocol *up, const char *filename, int flags, const AVIOInterruptCB *int_cb)
int(* url_get_file_handle)(URLContext *h)
static int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int size, int size_min, int(*transfer_func)(URLContext *h, unsigned char *buf, int size))
#define AVERROR_EOF
End of file.
Callback for checking whether to abort blocking functions.
int ffurl_alloc(URLContext **puc, const char *filename, int flags, const AVIOInterruptCB *int_cb)
Create a URLContext for accessing to the resource indicated by url, but do not initiate the connectio...
int(* url_open2)(URLContext *h, const char *url, int flags, AVDictionary **options)
This callback is to be used by protocols which open further nested protocols.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
#define URL_PROTOCOL_FLAG_NESTED_SCHEME
int(* url_open)(URLContext *h, const char *url, int flags)
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
static const char * urlcontext_to_name(void *ptr)
int(* url_write)(URLContext *h, const unsigned char *buf, int size)
int(* url_read)(URLContext *h, unsigned char *buf, int size)
static const AVOption options[]
URLProtocol * ffurl_protocol_next(URLProtocol *prev)
Iterate over all available protocols.
static const AVIOInterruptCB int_cb
static const AVClass * urlcontext_child_class_next(const AVClass *prev)
const char * avio_enum_protocols(void **opaque, int output)
Iterate through names of available protocols.
int(* url_read_pause)(URLContext *h, int pause)
int64_t(* url_seek)(URLContext *h, int64_t pos, int whence)
int ffurl_get_file_handle(URLContext *h)
Return the file descriptor associated with this URL.
#define AVERROR_EXIT
Immediate exit was requested; the called function should not be restarted.
static int is_dos_path(const char *path)
int ff_check_interrupt(AVIOInterruptCB *cb)
Check if the user has requested to interrup a blocking function associated with cb.
int av_opt_set_dict(void *obj, AVDictionary **options)
#define AVIO_FLAG_NONBLOCK
Use non-blocking mode.
int64_t(* url_read_seek)(URLContext *h, int stream_index, int64_t timestamp, int flags)
static void(WINAPI *cond_broadcast)(pthread_cond_t *cond)
int64_t ffurl_size(URLContext *h)
Return the filesize of the resource accessed by h, AVERROR(ENOSYS) if the operation is not supported ...
Describe the class of an AVClass context structure.
#define AVSEEK_FORCE
Oring this flag as into the "whence" parameter to a seek function causes it to seek by any means (lik...
const AVClass * av_class
information for av_log().
int ffurl_close(URLContext *h)
Close the resource accessed by the URLContext h, and free the memory used by it.
const AVClass ffurl_context_class
void av_opt_free(void *obj)
Free all string and binary options in obj.
int64_t ffurl_seek(URLContext *h, int64_t pos, int whence)
Change the position that will be used by the next read/write operation on the resource accessed by h...
int ffurl_open(URLContext **puc, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
Create an URLContext for accessing to the resource indicated by url, and open it. ...
int ffurl_read_complete(URLContext *h, unsigned char *buf, int size)
Read as many bytes as possible (up to size), calling the read function multiple times if necessary...
char * filename
specified URL
#define AVSEEK_SIZE
Passing this as the "whence" parameter to a seek function causes it to return the filesize without se...
int(* url_interrupt_cb)(void)
int max_packet_size
if non zero, the stream is packetized with this max packet size
int(* url_close)(URLContext *h)
unbuffered private I/O API
int ffurl_read(URLContext *h, unsigned char *buf, int size)
Read up to size bytes from the resource accessed by h, and store the read bytes in buf...