26 #elif HAVE_MAPVIEWOFFILE
43 int log_offset,
void *log_ctx)
46 int err, fd = open(filename, O_RDONLY);
60 if (fstat(fd, &st) < 0) {
68 off_size = st.st_size;
69 if (off_size > SIZE_MAX) {
71 "File size for file '%s' is too big\n", filename);
78 ptr = mmap(
NULL, *size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
79 if (ptr == MAP_FAILED) {
87 #elif HAVE_MAPVIEWOFFILE
89 HANDLE mh, fh = (HANDLE)_get_osfhandle(fd);
91 mh = CreateFileMapping(fh,
NULL, PAGE_READONLY, 0, 0,
NULL);
98 ptr = MapViewOfFile(mh, FILE_MAP_READ, 0, 0, *size);
115 read(fd, *bufptr, *size);
125 munmap(bufptr, size);
126 #elif HAVE_MAPVIEWOFFILE
127 UnmapViewOfFile(bufptr);
void av_file_unmap(uint8_t *bufptr, size_t size)
Unmap or free the buffer bufptr created by av_file_map().
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
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_log(void *avcl, int level, const char *fmt,...)
int main(int argc, char **argv)
static void close(AVCodecParserContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Describe the class of an AVClass context structure.
int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
Put a description of the AVERROR code errnum in errbuf.
static const AVClass file_log_ctx_class