36#elif HAVE_MAPVIEWOFFILE
56 int log_offset,
void *log_ctx)
72 if (fstat(fd, &st) < 0) {
79 off_size = st.st_size;
80 if (off_size > SIZE_MAX) {
82 "File size for file '%s' is too big\n", filename);
94 ptr = mmap(
NULL, *
size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
95 if (ptr == MAP_FAILED) {
103#elif HAVE_MAPVIEWOFFILE
105 HANDLE
mh, fh = (HANDLE)_get_osfhandle(fd);
107 mh = CreateFileMapping(fh,
NULL, PAGE_READONLY, 0, 0,
NULL);
115 ptr = MapViewOfFile(
mh, FILE_MAP_COPY, 0, 0, *
size);
144 if (!
size || !bufptr)
147 munmap(bufptr,
size);
148#elif HAVE_MAPVIEWOFFILE
149 UnmapViewOfFile(bufptr);
static av_cold void close(AVCodecParserContext *s)
static uint32_t BS_FUNC read(BSCTX *bc, unsigned int n)
Return n bits from the buffer, n has to be in the 0-32 range.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
#define LIBAVUTIL_VERSION_INT
void av_file_unmap(uint8_t *bufptr, size_t size)
Unmap or free the buffer bufptr created by av_file_map().
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...
static const AVClass file_log_ctx_class
int avpriv_open(const char *filename, int flags,...)
A wrapper for open() setting O_CLOEXEC.
common internal API header
Memory handling functions.
Describe the class of an AVClass context structure.