Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
1f4c62e8
Commit
1f4c62e8
authored
Jun 28, 2015
by
Mariusz Szczepańczyk
Committed by
Michael Niedermayer
Aug 25, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/file: check for dirent.h support
Signed-off-by:
Michael Niedermayer
<
michael@niedermayer.cc
>
parent
d39a9b01
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
28 deletions
+54
-28
configure
configure
+2
-0
file.c
libavformat/file.c
+52
-28
No files found.
configure
View file @
1f4c62e8
...
@@ -1692,6 +1692,7 @@ HEADERS_LIST="
...
@@ -1692,6 +1692,7 @@ HEADERS_LIST="
dev_video_bktr_ioctl_bt848_h
dev_video_bktr_ioctl_bt848_h
dev_video_meteor_ioctl_meteor_h
dev_video_meteor_ioctl_meteor_h
direct_h
direct_h
dirent_h
dlfcn_h
dlfcn_h
d3d11_h
d3d11_h
dxva_h
dxva_h
...
@@ -5104,6 +5105,7 @@ enabled xlib &&
...
@@ -5104,6 +5105,7 @@ enabled xlib &&
check_header CoreServices/CoreServices.h
check_header CoreServices/CoreServices.h
check_header direct.h
check_header direct.h
check_header dirent.h
check_header dlfcn.h
check_header dlfcn.h
check_header d3d11.h
check_header d3d11.h
check_header dxva.h
check_header dxva.h
...
...
libavformat/file.c
View file @
1f4c62e8
...
@@ -23,7 +23,9 @@
...
@@ -23,7 +23,9 @@
#include "libavutil/internal.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "libavutil/opt.h"
#include "avformat.h"
#include "avformat.h"
#if HAVE_DIRENT_H
#include <dirent.h>
#include <dirent.h>
#endif
#include <fcntl.h>
#include <fcntl.h>
#if HAVE_IO_H
#if HAVE_IO_H
#include <io.h>
#include <io.h>
...
@@ -45,6 +47,24 @@
...
@@ -45,6 +47,24 @@
# endif
# endif
#endif
#endif
/* Not available in POSIX.1-1996 */
#ifndef S_ISLNK
# ifdef S_IFLNK
# define S_ISLNK(m) (((m) & S_IFLNK) == S_IFLNK)
# else
# define S_ISLNK(m) 0
# endif
#endif
/* Not available in POSIX.1-1996 */
#ifndef S_ISSOCK
# ifdef S_IFSOCK
# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
# else
# define S_ISSOCK(m) 0
# endif
#endif
/* standard file protocol */
/* standard file protocol */
typedef
struct
FileContext
{
typedef
struct
FileContext
{
...
@@ -52,7 +72,9 @@ typedef struct FileContext {
...
@@ -52,7 +72,9 @@ typedef struct FileContext {
int
fd
;
int
fd
;
int
trunc
;
int
trunc
;
int
blocksize
;
int
blocksize
;
#if HAVE_DIRENT_H
DIR
*
dir
;
DIR
*
dir
;
#endif
}
FileContext
;
}
FileContext
;
static
const
AVOption
file_options
[]
=
{
static
const
AVOption
file_options
[]
=
{
...
@@ -229,6 +251,7 @@ static int file_close(URLContext *h)
...
@@ -229,6 +251,7 @@ static int file_close(URLContext *h)
static
int
file_open_dir
(
URLContext
*
h
)
static
int
file_open_dir
(
URLContext
*
h
)
{
{
#if HAVE_DIRENT_H
FileContext
*
c
=
h
->
priv_data
;
FileContext
*
c
=
h
->
priv_data
;
c
->
dir
=
opendir
(
h
->
filename
);
c
->
dir
=
opendir
(
h
->
filename
);
...
@@ -236,10 +259,14 @@ static int file_open_dir(URLContext *h)
...
@@ -236,10 +259,14 @@ static int file_open_dir(URLContext *h)
return
AVERROR
(
errno
);
return
AVERROR
(
errno
);
return
0
;
return
0
;
#else
return
AVERROR
(
ENOSYS
);
#endif
/* HAVE_DIRENT_H */
}
}
static
int
file_read_dir
(
URLContext
*
h
,
AVIODirEntry
**
next
)
static
int
file_read_dir
(
URLContext
*
h
,
AVIODirEntry
**
next
)
{
{
#if HAVE_DIRENT_H
FileContext
*
c
=
h
->
priv_data
;
FileContext
*
c
=
h
->
priv_data
;
struct
dirent
*
dir
;
struct
dirent
*
dir
;
char
*
fullpath
=
NULL
;
char
*
fullpath
=
NULL
;
...
@@ -259,7 +286,24 @@ static int file_read_dir(URLContext *h, AVIODirEntry **next)
...
@@ -259,7 +286,24 @@ static int file_read_dir(URLContext *h, AVIODirEntry **next)
fullpath
=
av_append_path_component
(
h
->
filename
,
dir
->
d_name
);
fullpath
=
av_append_path_component
(
h
->
filename
,
dir
->
d_name
);
if
(
fullpath
)
{
if
(
fullpath
)
{
struct
stat
st
;
struct
stat
st
;
if
(
!
stat
(
fullpath
,
&
st
))
{
if
(
!
lstat
(
fullpath
,
&
st
))
{
if
(
S_ISDIR
(
st
.
st_mode
))
(
*
next
)
->
type
=
AVIO_ENTRY_DIRECTORY
;
else
if
(
S_ISFIFO
(
st
.
st_mode
))
(
*
next
)
->
type
=
AVIO_ENTRY_NAMED_PIPE
;
else
if
(
S_ISCHR
(
st
.
st_mode
))
(
*
next
)
->
type
=
AVIO_ENTRY_CHARACTER_DEVICE
;
else
if
(
S_ISBLK
(
st
.
st_mode
))
(
*
next
)
->
type
=
AVIO_ENTRY_BLOCK_DEVICE
;
else
if
(
S_ISLNK
(
st
.
st_mode
))
(
*
next
)
->
type
=
AVIO_ENTRY_SYMBOLIC_LINK
;
else
if
(
S_ISSOCK
(
st
.
st_mode
))
(
*
next
)
->
type
=
AVIO_ENTRY_SOCKET
;
else
if
(
S_ISREG
(
st
.
st_mode
))
(
*
next
)
->
type
=
AVIO_ENTRY_FILE
;
else
(
*
next
)
->
type
=
AVIO_ENTRY_UNKNOWN
;
(
*
next
)
->
group_id
=
st
.
st_gid
;
(
*
next
)
->
group_id
=
st
.
st_gid
;
(
*
next
)
->
user_id
=
st
.
st_uid
;
(
*
next
)
->
user_id
=
st
.
st_uid
;
(
*
next
)
->
size
=
st
.
st_size
;
(
*
next
)
->
size
=
st
.
st_size
;
...
@@ -272,41 +316,21 @@ static int file_read_dir(URLContext *h, AVIODirEntry **next)
...
@@ -272,41 +316,21 @@ static int file_read_dir(URLContext *h, AVIODirEntry **next)
}
}
(
*
next
)
->
name
=
av_strdup
(
dir
->
d_name
);
(
*
next
)
->
name
=
av_strdup
(
dir
->
d_name
);
switch
(
dir
->
d_type
)
{
case
DT_FIFO
:
(
*
next
)
->
type
=
AVIO_ENTRY_NAMED_PIPE
;
break
;
case
DT_CHR
:
(
*
next
)
->
type
=
AVIO_ENTRY_CHARACTER_DEVICE
;
break
;
case
DT_DIR
:
(
*
next
)
->
type
=
AVIO_ENTRY_DIRECTORY
;
break
;
case
DT_BLK
:
(
*
next
)
->
type
=
AVIO_ENTRY_BLOCK_DEVICE
;
break
;
case
DT_REG
:
(
*
next
)
->
type
=
AVIO_ENTRY_FILE
;
break
;
case
DT_LNK
:
(
*
next
)
->
type
=
AVIO_ENTRY_SYMBOLIC_LINK
;
break
;
case
DT_SOCK
:
(
*
next
)
->
type
=
AVIO_ENTRY_SOCKET
;
break
;
case
DT_UNKNOWN
:
default:
(
*
next
)
->
type
=
AVIO_ENTRY_UNKNOWN
;
break
;
}
return
0
;
return
0
;
#else
return
AVERROR
(
ENOSYS
);
#endif
/* HAVE_DIRENT_H */
}
}
static
int
file_close_dir
(
URLContext
*
h
)
static
int
file_close_dir
(
URLContext
*
h
)
{
{
#if HAVE_DIRENT_H
FileContext
*
c
=
h
->
priv_data
;
FileContext
*
c
=
h
->
priv_data
;
closedir
(
c
->
dir
);
closedir
(
c
->
dir
);
return
0
;
return
0
;
#else
return
AVERROR
(
ENOSYS
);
#endif
/* HAVE_DIRENT_H */
}
}
URLProtocol
ff_file_protocol
=
{
URLProtocol
ff_file_protocol
=
{
...
...
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