20 #ifndef AVFORMAT_AVIO_H
21 #define AVFORMAT_AVIO_H
38 #define AVIO_SEEKABLE_NORMAL 0x0001
93 int64_t (*
seek)(
void *
opaque, int64_t offset,
int whence);
113 int64_t timestamp,
int flags);
205 unsigned char *buffer,
209 int (*
read_packet)(
void *opaque, uint8_t *buf,
int buf_size),
210 int (*write_packet)(
void *opaque, uint8_t *buf,
int buf_size),
211 int64_t (*seek)(
void *opaque, int64_t offset,
int whence));
241 #define AVSEEK_SIZE 0x10000
249 #define AVSEEK_FORCE 0x20000
362 #define AVIO_FLAG_READ 1
363 #define AVIO_FLAG_WRITE 2
364 #define AVIO_FLAG_READ_WRITE (AVIO_FLAG_READ|AVIO_FLAG_WRITE)
381 #define AVIO_FLAG_NONBLOCK 8
389 #define AVIO_FLAG_DIRECT 0x8000
515 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.
int64_t(* read_seek)(void *opaque, int stream_index, int64_t timestamp, int flags)
Seek to a given timestamp in stream with the specified stream_index.
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
unsigned char * buf_ptr
Current position in the buffer.
int writeout_count
writeout statistic This field is internal to libavformat and access from outside is not allowed...
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 avio_read_to_bprint(AVIOContext *h, struct AVBPrint *pb, size_t max_size)
Read contents of h into print buffer, up to max_size bytes, or up to EOF.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
unsigned char * buffer
Start of the buffer.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
int64_t(* seek)(void *opaque, int64_t offset, int whence)
void * opaque
A private pointer, passed to the read/write/seek/...
unsigned int avio_rb16(AVIOContext *s)
int64_t maxsize
max filesize, used to limit allocations This field is internal to libavformat and access from outside...
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.
void avio_wl32(AVIOContext *s, unsigned int val)
unsigned int avio_rb32(AVIOContext *s)
const AVClass * av_class
A class for private options.
int64_t bytes_read
Bytes read statistic This field is internal to libavformat and access from outside is not allowed...
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.
int(* write_packet)(void *opaque, uint8_t *buf, int buf_size)
int(* read_packet)(void *opaque, uint8_t *buf, int buf_size)
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.
struct AVDictionary AVDictionary
int direct
avio_read and avio_write should if possible be satisfied directly instead of going through a buffer...
#define av_printf_format(fmtpos, attrpos)
int seek_count
seek statistic This field is internal to libavformat and access from outside is not allowed...
int avio_r8(AVIOContext *s)
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
int void avio_flush(AVIOContext *s)
Force flushing of buffered data.
unsigned int avio_rb24(AVIOContext *s)
unsigned char * checksum_ptr
void avio_wb24(AVIOContext *s, unsigned int val)
int must_flush
true if the next seek should flush
unsigned long(* update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size)
int buffer_size
Maximum buffer size.
int avio_put_str(AVIOContext *s, const char *str)
Write a NULL-terminated string.
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
void avio_w8(AVIOContext *s, int b)
Describe the class of an AVClass context structure.
const char * avio_find_protocol_name(const char *url)
Return the name of the protocol that will handle the passed URL.
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.
int(* read_pause)(void *opaque, int pause)
Pause or resume playback for network streaming protocols - e.g.
void avio_wb16(AVIOContext *s, unsigned int val)
#define attribute_deprecated
int orig_buffer_size
Original buffer size used internally after probing and ensure seekback to reset the buffer size This ...
unsigned int avio_rl16(AVIOContext *s)
common internal and external API header
int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen)
int64_t pos
position in the file of the current buffer
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
void avio_wb32(AVIOContext *s, unsigned int val)
int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen)
Read a string from pb into buf.
int avio_feof(AVIOContext *s)
feof() equivalent for AVIOContext.
unsigned int avio_rl24(AVIOContext *s)
int avio_closep(AVIOContext **s)
Close the resource accessed by the AVIOContext *s, free it and set the pointer pointing to it to NULL...
uint64_t avio_rl64(AVIOContext *s)
int avio_printf(AVIOContext *s, const char *fmt,...) av_printf_format(2