Go to the documentation of this file.
20 #ifndef AVFORMAT_AVIO_H
21 #define AVFORMAT_AVIO_H
40 #define AVIO_SEEKABLE_NORMAL (1 << 0)
45 #define AVIO_SEEKABLE_TIME (1 << 1)
256 int64_t timestamp,
int flags);
469 int64_t (*seek)(
void *opaque, int64_t
offset,
int whence));
531 #define AVSEEK_SIZE 0x10000
539 #define AVSEEK_FORCE 0x20000
594 #define avio_print(s, ...) \
595 avio_print_string_array(s, (const char*[]){__VA_ARGS__, NULL})
674 #define AVIO_FLAG_READ 1
675 #define AVIO_FLAG_WRITE 2
676 #define AVIO_FLAG_READ_WRITE (AVIO_FLAG_READ|AVIO_FLAG_WRITE)
693 #define AVIO_FLAG_NONBLOCK 8
701 #define AVIO_FLAG_DIRECT 0x8000
846 int64_t timestamp,
int flags);
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
@ AVIO_DATA_MARKER_BOUNDARY_POINT
A point in the output bytestream where a demuxer can start parsing (for non self synchronizing bytest...
const AVClass * avio_protocol_get_class(const char *name)
Get AVClass by names of available protocols.
int64_t(* seek)(void *opaque, int64_t offset, int whence)
int avio_close(AVIOContext *s)
Close the resource accessed by the AVIOContext s and free it.
int seek_count
seek statistic This field is internal to libavformat and access from outside is not allowed.
void avio_context_free(AVIOContext **s)
Free the supplied IO context and everything associated with it.
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen)
int utf8
Set to 1 when name is encoded with UTF-8, 0 otherwise.
const char * protocol_blacklist
',' separated list of disallowed protocols.
int type
Type of the entry.
int avio_read_dir(AVIODirContext *s, AVIODirEntry **next)
Get next directory entry.
const char * avio_enum_protocols(void **opaque, int output)
Iterate through names of available protocols.
int error
contains the error code or 0 if no error happened
void avio_wl64(AVIOContext *s, uint64_t val)
AVIODataMarkerType
Different data types that can be returned via the AVIO write_data_type callback.
int64_t avio_size(AVIOContext *s)
Get the filesize.
int avio_get_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
Callback for checking whether to abort blocking functions.
int64_t access_timestamp
Time of last access in microseconds since unix epoch, -1 if unknown.
void avio_wl16(AVIOContext *s, unsigned int val)
int avio_handshake(AVIOContext *c)
Perform one step of the protocol handshake to accept a new client.
void avio_write_marker(AVIOContext *s, int64_t time, enum AVIODataMarkerType type)
Mark the written bytestream as a specific type.
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 avio_close_dir(AVIODirContext **s)
Close directory.
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.
@ AVIO_ENTRY_CHARACTER_DEVICE
int64_t pos
position in the file of the current buffer
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
static double val(void *priv, double ch)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
unsigned int avio_rl16(AVIOContext *s)
int64_t modification_timestamp
Time of last modification in microseconds since unix epoch, -1 if unknown.
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
unsigned int avio_rb32(AVIOContext *s)
int writeout_count
writeout statistic This field is internal to libavformat and access from outside is not allowed.
@ AVIO_ENTRY_SYMBOLIC_LINK
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_free_directory_entry(AVIODirEntry **entry)
Free entry allocated by avio_read_dir().
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.
int void avio_print_string_array(AVIOContext *s, const char *strings[])
Write a NULL terminated array of strings to the context.
int write_flag
true if open for writing
void avio_flush(AVIOContext *s)
Force flushing of buffered data.
AVIODirEntryType
Directory entry types.
enum AVIODataMarkerType current_type
Internal, not meant to be used from outside of AVIOContext.
Describe the class of an AVClass context structure.
int min_packet_size
Try to buffer at least this amount of data before flushing it.
int64_t size
File size in bytes, -1 if unknown.
@ AVIO_DATA_MARKER_TRAILER
Trailer data, which doesn't contain actual content, but only for finalizing the output file.
int(* read_pause)(void *opaque, int pause)
Pause or resume playback for network streaming protocols - e.g.
uint64_t avio_rb64(AVIOContext *s)
#define av_printf_format(fmtpos, attrpos)
int avio_accept(AVIOContext *s, AVIOContext **c)
Accept and allocate a client context on a server context.
int avio_pause(AVIOContext *h, int pause)
Pause and resume playing - only meaningful if using a network streaming protocol (e....
void avio_w8(AVIOContext *s, int b)
int64_t group_id
Group ID of owner, -1 if unknown.
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
int64_t filemode
Unix file mode, -1 if unknown.
const char * protocol_whitelist
',' separated list of allowed protocols.
const OptionDef options[]
unsigned int avio_rl32(AVIOContext *s)
unsigned int avio_rb24(AVIOContext *s)
int(* short_seek_get)(void *opaque)
A callback that is used instead of short_seek_threshold.
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
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 avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen)
Read a string from pb into buf.
int(* write_data_type)(void *opaque, uint8_t *buf, int buf_size, enum AVIODataMarkerType type, int64_t time)
A callback that is used instead of write_packet.
Describes single entry of the directory.
@ AVIO_DATA_MARKER_SYNC_POINT
A point in the output bytestream where a decoder can start decoding (i.e.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
void avio_wb32(AVIOContext *s, unsigned int val)
int avio_r8(AVIOContext *s)
int(* write_packet)(void *opaque, uint8_t *buf, int buf_size)
void avio_wl32(AVIOContext *s, unsigned int val)
unsigned char * checksum_ptr
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
int64_t status_change_timestamp
Time of last status change in microseconds since unix epoch, -1 if unknown.
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
int64_t user_id
User ID of owner, -1 if unknown.
int avio_closep(AVIOContext **s)
Close the resource accessed by the AVIOContext *s, free it and set the pointer pointing to it to NULL...
void * opaque
A private pointer, passed to the read/write/seek/...
int64_t bytes_read
Bytes read statistic This field is internal to libavformat and access from outside is not allowed.
int direct
avio_read and avio_write should if possible be satisfied directly instead of going through a buffer,...
unsigned int avio_rl24(AVIOContext *s)
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.
const AVIOInterruptCB int_cb
int avio_check(const char *url, int flags)
Return AVIO_FLAG_* access flags corresponding to the access permissions of the resource in url,...
@ AVIO_DATA_MARKER_UNKNOWN
This is any, unlabelled data.
@ AVIO_ENTRY_BLOCK_DEVICE
int avpriv_io_delete(const char *url)
Delete a resource.
int avpriv_io_move(const char *url_src, const char *url_dst)
Move or rename a resource.
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
unsigned int avio_rb16(AVIOContext *s)
int ignore_boundary_point
If set, don't call write_data_type separately for AVIO_DATA_MARKER_BOUNDARY_POINT,...
int avio_printf(AVIOContext *s, const char *fmt,...) av_printf_format(2
Writes a formatted string to the context.
int avio_put_str16be(AVIOContext *s, const char *str)
Convert an UTF-8 string to UTF-16BE and write it.
unsigned char * buf_ptr_max
Maximum reached position before a backward seek in the write buffer, used keeping track of already wr...
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
unsigned long(* update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size)
@ AVIO_DATA_MARKER_HEADER
Header data; this needs to be present for the stream to be decodeable.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
int eof_reached
true if was unable to read due to error or eof
int avio_open(AVIOContext **s, const char *url, int flags)
Create and initialize a AVIOContext for accessing the resource indicated by url.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
void avio_wb64(AVIOContext *s, uint64_t val)
int64_t maxsize
max filesize, used to limit allocations This field is internal to libavformat and access from outside...
int(* read_packet)(void *opaque, uint8_t *buf, int buf_size)
const char * avio_find_protocol_name(const char *url)
Return the name of the protocol that will handle the passed URL.
int orig_buffer_size
Original buffer size used internally after probing and ensure seekback to reset the buffer size This ...
void avio_wb24(AVIOContext *s, unsigned int val)
unsigned char * buffer
Start of the buffer.
uint64_t avio_rl64(AVIOContext *s)
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.
struct URLContext * url_context
int avio_put_str16le(AVIOContext *s, const char *str)
Convert an UTF-8 string to UTF-16LE and write it.
void avio_wb16(AVIOContext *s, unsigned int val)
#define flags(name, subs,...)
void avio_wl24(AVIOContext *s, unsigned int val)
int buffer_size
Maximum buffer size.
int avio_open_dir(AVIODirContext **s, const char *url, AVDictionary **options)
Open directory for reading.
unsigned char * buf_ptr
Current position in the buffer.
int avio_put_str(AVIOContext *s, const char *str)
Write a NULL-terminated string.
int short_seek_threshold
Threshold to favor readahead over seek.
int avio_read_partial(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
const AVClass * av_class
A class for private options.
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
@ AVIO_DATA_MARKER_FLUSH_POINT
A point in the output bytestream where the underlying AVIOContext might flush the buffer depending on...