Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
73f6d31e
Commit
73f6d31e
authored
Jan 05, 2011
by
Daniel Verkamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Win32 support for av_file_map()
Originally committed as revision 26221 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
db613296
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
configure
configure
+2
-0
file.c
libavutil/file.c
+26
-0
No files found.
configure
View file @
73f6d31e
...
...
@@ -1040,6 +1040,7 @@ HAVE_LIST="
machine_ioctl_bt848_h
machine_ioctl_meteor_h
malloc_h
MapViewOfFile
memalign
mkstemp
mmap
...
...
@@ -2687,6 +2688,7 @@ check_func_headers io.h setmode
check_func_headers lzo/lzo1x.h lzo1x_999_compress
check_lib2
"windows.h psapi.h"
GetProcessMemoryInfo
-lpsapi
check_func_headers windows.h GetProcessTimes
check_func_headers windows.h MapViewOfFile
check_func_headers windows.h VirtualAlloc
check_header conio.h
...
...
libavutil/file.c
View file @
73f6d31e
...
...
@@ -22,6 +22,9 @@
#include <unistd.h>
#if HAVE_MMAP
#include <sys/mman.h>
#elif HAVE_MAPVIEWOFFILE
#include <io.h>
#include <windows.h>
#endif
typedef
struct
{
...
...
@@ -81,6 +84,27 @@ int av_file_map(const char *filename, uint8_t **bufptr, size_t *size,
return
err
;
}
*
bufptr
=
ptr
;
#elif HAVE_MAPVIEWOFFILE
{
HANDLE
mh
,
fh
=
(
HANDLE
)
_get_osfhandle
(
fd
);
mh
=
CreateFileMapping
(
fh
,
NULL
,
PAGE_READONLY
,
0
,
0
,
NULL
);
if
(
!
mh
)
{
av_log
(
&
file_log_ctx
,
AV_LOG_ERROR
,
"Error occurred in CreateFileMapping()
\n
"
);
close
(
fd
);
return
-
1
;
}
ptr
=
MapViewOfFile
(
mh
,
FILE_MAP_READ
,
0
,
0
,
*
size
);
CloseHandle
(
mh
);
if
(
!
ptr
)
{
av_log
(
&
file_log_ctx
,
AV_LOG_ERROR
,
"Error occurred in MapViewOfFile()
\n
"
);
close
(
fd
);
return
-
1
;
}
*
bufptr
=
ptr
;
}
#else
*
bufptr
=
av_malloc
(
*
size
);
if
(
!*
bufptr
)
{
...
...
@@ -99,6 +123,8 @@ void av_file_unmap(uint8_t *bufptr, size_t size)
{
#if HAVE_MMAP
munmap
(
bufptr
,
size
);
#elif HAVE_MAPVIEWOFFILE
UnmapViewOfFile
(
bufptr
);
#else
av_free
(
bufptr
);
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment