};
static int read_packet(
void *opaque, uint8_t *buf,
int buf_size)
{
if (!buf_size)
printf(
"ptr:%p size:%zu\n", bd->
ptr, bd->
size);
memcpy(buf, bd->
ptr, buf_size);
return buf_size;
}
int main(
int argc,
char *argv[])
{
uint8_t *buffer = NULL, *avio_ctx_buffer = NULL;
size_t buffer_size, avio_ctx_buffer_size = 4096;
char *input_filename = NULL;
int ret = 0;
if (argc != 2) {
fprintf(stderr, "usage: %s input_file\n"
"API example program to show how to read from a custom buffer "
"accessed through AVIOContext.\n", argv[0]);
return 1;
}
input_filename = argv[1];
ret =
av_file_map(input_filename, &buffer, &buffer_size, 0, NULL);
if (ret < 0)
goto end;
goto end;
}
avio_ctx_buffer =
av_malloc(avio_ctx_buffer_size);
if (!avio_ctx_buffer) {
goto end;
}
if (!avio_ctx) {
goto end;
}
if (ret < 0) {
fprintf(stderr, "Could not open input\n");
goto end;
}
if (ret < 0) {
fprintf(stderr, "Could not find stream information\n");
goto end;
}
end:
if (avio_ctx)
if (ret < 0) {
fprintf(stderr,
"Error occurred: %s\n",
av_err2str(ret));
return 1;
}
return 0;
}