Go to the documentation of this file.
52 memcpy(
buf, bd->
ptr, buf_size);
59 int main(
int argc,
char *argv[])
64 size_t buffer_size, avio_ctx_buffer_size = 4096;
70 fprintf(stderr,
"usage: %s input_file\n"
71 "API example program to show how to read from a custom buffer "
72 "accessed through AVIOContext.\n", argv[0]);
84 bd.
size = buffer_size;
91 avio_ctx_buffer =
av_malloc(avio_ctx_buffer_size);
92 if (!avio_ctx_buffer) {
106 fprintf(stderr,
"Could not open input\n");
112 fprintf(stderr,
"Could not find stream information\n");
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
#define AVERROR_EOF
End of file.
void avio_context_free(AVIOContext **s)
Free the supplied IO context and everything associated with it.
static av_cold int end(AVCodecContext *avctx)
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, int log_offset, void *log_ctx)
Read the file with name filename, and put its content in a newly allocated buffer or map it with mmap...
void av_dump_format(AVFormatContext *ic, int index, const char *url, int is_output)
Print detailed information about the input or output format, such as duration, bitrate,...
void av_file_unmap(uint8_t *bufptr, size_t size)
Unmap or free the buffer bufptr created by av_file_map().
static AVFormatContext * fmt_ctx
AVIOContext * pb
I/O context.
size_t size
size left in the buffer
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
Read packets of a media file to get stream information.
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
printf("static const uint8_t my_array[100] = {\n")
int avformat_open_input(AVFormatContext **ps, const char *url, ff_const59 AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
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.
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
int main(int argc, char *argv[])
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
static const char * input_filename
unsigned char * buffer
Start of the buffer.