20 #ifndef AVFORMAT_AVIO_H
21 #define AVFORMAT_AVIO_H
38 #define AVIO_SEEKABLE_NORMAL 0x0001
52 int (*callback)(
void*);
95 int64_t (*seek)(
void *opaque, int64_t offset,
int whence);
106 unsigned long (*update_checksum)(
unsigned long checksum,
const uint8_t *buf,
unsigned int size);
111 int (*read_pause)(
void *opaque,
int pause);
118 int64_t timestamp,
int flags);
148 #define URL_PROTOCOL_FLAG_NESTED_SCHEME 1
149 #define URL_PROTOCOL_FLAG_NETWORK 2
165 int64_t timestamp,
int flags);
173 typedef struct URLPollEntry {
190 #define URL_RDWR (URL_RDONLY|URL_WRONLY)
207 #define URL_FLAG_NONBLOCK 8
209 typedef int URLInterruptCB(
void);
219 const char *url,
int flags);
234 int64_t timestamp,
int flags);
260 int (*
read_packet)(
void *opaque, uint8_t *buf,
int buf_size),
261 int (*
write_packet)(
void *opaque, uint8_t *buf,
int buf_size),
262 int64_t (*seek)(
void *opaque, int64_t offset,
int whence));
264 unsigned char *buffer,
268 int (*
read_packet)(
void *opaque, uint8_t *buf,
int buf_size),
269 int (*
write_packet)(
void *opaque, uint8_t *buf,
int buf_size),
270 int64_t (*seek)(
void *opaque, int64_t offset,
int whence));
308 int64_t timestamp,
int flags);
345 unsigned long (*update_checksum)(
unsigned long c, const uint8_t *p,
unsigned int len),
346 unsigned long checksum);
381 #endif // FF_API_OLD_AVIO
397 #if FF_API_OLD_INTERRUPT_CB
427 unsigned char *buffer,
431 int (*
read_packet)(
void *opaque, uint8_t *buf,
int buf_size),
432 int (*
write_packet)(
void *opaque, uint8_t *buf,
int buf_size),
433 int64_t (*seek)(
void *opaque, int64_t offset,
int whence));
463 #define AVSEEK_SIZE 0x10000
471 #define AVSEEK_FORCE 0x20000
565 #define AVIO_FLAG_READ 1
566 #define AVIO_FLAG_WRITE 2
567 #define AVIO_FLAG_READ_WRITE (AVIO_FLAG_READ|AVIO_FLAG_WRITE)
584 #define AVIO_FLAG_NONBLOCK 8
686 int64_t timestamp,
int flags);
int avio_open(AVIOContext **s, const char *url, int flags)
Create and initialize a AVIOContext for accessing the resource indicated by url.
void avio_wb64(AVIOContext *s, uint64_t val)
void avio_wl16(AVIOContext *s, unsigned int val)
int64_t avio_size(AVIOContext *s)
Get the filesize.
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
int(* url_check)(URLContext *h, int mask)
unsigned char * buf_ptr
Current position in the buffer.
unsigned char * buf_end
End of the data, may be less than buffer+buffer_size if the read function returned less data than req...
int write_flag
true if open for writing
int is_streamed
true if streamed (no seek possible), default = false
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
AVIOInterruptCB interrupt_callback
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
struct URLProtocol * prot
unsigned char * buffer
Start of the buffer.
void * opaque
A private pointer, passed to the read/write/seek/...
unsigned int avio_rb16(AVIOContext *s)
int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen)
Read a UTF-16 string from pb and convert it to UTF-8.
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
const AVClass * priv_data_class
struct URLProtocol * next
void avio_wl32(AVIOContext *s, unsigned int val)
unsigned int avio_rb32(AVIOContext *s)
int(* url_get_file_handle)(URLContext *h)
uint64_t avio_rb64(AVIOContext *s)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
int avio_check(const char *url, int flags)
Return AVIO_FLAG_* access flags corresponding to the access permissions of the resource in url...
void avio_wl64(AVIOContext *s, uint64_t val)
Callback for checking whether to abort blocking functions.
AVIOContext * avio_alloc_context(unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int(*read_packet)(void *opaque, uint8_t *buf, int buf_size), int(*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t(*seek)(void *opaque, int64_t offset, int whence))
Allocate and initialize an AVIOContext for buffered I/O.
struct URLProtocol URLProtocol
static const uint16_t mask[17]
unsigned int avio_rl32(AVIOContext *s)
const char * avio_enum_protocols(void **opaque, int output)
Iterate through names of available protocols.
int avio_close(AVIOContext *s)
Close the resource accessed by the AVIOContext s and free it.
int(* url_open)(URLContext *h, const char *url, int flags)
#define av_printf_format(fmtpos, attrpos)
int(* url_write)(URLContext *h, const unsigned char *buf, int size)
int avio_r8(AVIOContext *s)
int(* url_read)(URLContext *h, unsigned char *buf, int size)
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
int void avio_flush(AVIOContext *s)
unsigned int avio_rb24(AVIOContext *s)
static const AVIOInterruptCB int_cb
unsigned char * checksum_ptr
void avio_wb24(AVIOContext *s, unsigned int val)
static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
int must_flush
true if the next seek should flush
struct URLContext URLContext
int(* url_read_pause)(URLContext *h, int pause)
int64_t(* url_seek)(URLContext *h, int64_t pos, int whence)
int buffer_size
Maximum buffer size.
int avio_put_str(AVIOContext *s, const char *str)
Write a NULL-terminated string.
int64_t(* url_read_seek)(URLContext *h, int stream_index, int64_t timestamp, int flags)
static const OptionDef options[]
void avio_w8(AVIOContext *s, int b)
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
Describe the class of an AVClass context structure.
int avio_put_str16le(AVIOContext *s, const char *str)
Convert an UTF-8 string to UTF-16LE and write it.
int avio_open2(AVIOContext **s, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
Create and initialize a AVIOContext for accessing the resource indicated by url.
int error
contains the error code or 0 if no error happened
void avio_wl24(AVIOContext *s, unsigned int val)
int avio_pause(AVIOContext *h, int pause)
Pause and resume playing - only meaningful if using a network streaming protocol (e.g.
void avio_wb16(AVIOContext *s, unsigned int val)
const AVClass * av_class
information for av_log().
#define attribute_deprecated
unsigned int avio_rl16(AVIOContext *s)
common internal and external API header
int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen)
char * filename
specified URL
int64_t pos
position in the file of the current buffer
int(* url_interrupt_cb)(void)
int64_t avio_seek_time(AVIOContext *h, int stream_index, int64_t timestamp, int flags)
Seek to a given timestamp relative to some component stream.
int eof_reached
true if eof reached
AVClass * av_class
A class for private options.
void avio_wb32(AVIOContext *s, unsigned int val)
int max_packet_size
if non zero, the stream is packetized with this max packet size
int(* url_close)(URLContext *h)
int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen)
Read a string from pb into buf.
unsigned int avio_rl24(AVIOContext *s)
uint64_t avio_rl64(AVIOContext *s)
int avio_printf(AVIOContext *s, const char *fmt,...) av_printf_format(2
static int get_byte(LZOContext *c)
Reads one byte from the input buffer, avoiding an overrun.