47 printf(
"ptr:%p size:%zu\n", bd->
ptr, bd->
size);
50 memcpy(buf, bd->
ptr, buf_size);
57 int main(
int argc,
char *argv[])
62 size_t buffer_size, avio_ctx_buffer_size = 4096;
68 fprintf(stderr,
"usage: %s input_file\n"
69 "API example program to show how to read from a custom buffer "
70 "accessed through AVIOContext.\n", argv[0]);
73 input_filename = argv[1];
85 bd.
size = buffer_size;
92 avio_ctx_buffer =
av_malloc(avio_ctx_buffer_size);
93 if (!avio_ctx_buffer) {
103 fmt_ctx->
pb = avio_ctx;
107 fprintf(stderr,
"Could not open input\n");
113 fprintf(stderr,
"Could not find stream information\n");
129 fprintf(stderr,
"Error occurred: %s\n",
av_err2str(ret));