Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
4b63cbc9
Commit
4b63cbc9
authored
Jun 25, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for remote file - Linux support
(cherry picked from commit
a427e327
)
parent
2a3e46f2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
7 deletions
+43
-7
modules/access/file.c
modules/access/file.c
+43
-7
No files found.
modules/access/file.c
View file @
4b63cbc9
...
...
@@ -47,8 +47,13 @@
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#if HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#if defined (__linux__)
# include <sys/vfs.h>
# include <linux/magic.h>
# define HAVE_FSTATFS 1
#elif defined (HAVE_SYS_MOUNT_H)
# include <sys/mount.h>
# define HAVE_FSTATFS 1
#endif
#if defined( WIN32 )
...
...
@@ -118,6 +123,38 @@ struct access_sys_t
bool
b_pace_control
;
};
static
bool
IsRemote
(
int
fd
)
{
#ifdef HAVE_FSTATFS
struct
statfs
stf
;
if
(
fstatfs
(
fd
,
&
stf
))
return
false
;
#if defined(MNT_LOCAL)
return
!
(
stf
.
f_flags
&
MNT_LOCAL
);
#elif defined (__linux__)
switch
(
stf
.
f_type
)
{
case
AFS_SUPER_MAGIC
:
case
CODA_SUPER_MAGIC
:
case
NCP_SUPER_MAGIC
:
case
NFS_SUPER_MAGIC
:
case
SMB_SUPER_MAGIC
:
case
0xFF534D42
/*CIFS_MAGIC_NUMBER*/
:
return
true
;
}
return
false
;
#endif
#else
/* !HAVE_FSTATFS */
return
false
;
#endif
}
/*****************************************************************************
* Open: open the file
*****************************************************************************/
...
...
@@ -174,14 +211,13 @@ static int Open( vlc_object_t *p_this )
# warning File size not known!
#endif
#if defined(HAVE_SYS_MOUNT_H) && defined(MNT_LOCAL)
struct
statfs
stat
;
if
((
fstatfs
(
fd
,
&
stat
)
==
0
)
&&
!
(
stat
.
f_flags
&
MNT_LOCAL
)
)
{
if
(
IsRemote
(
fd
))
{
int
i_cache
=
var_GetInteger
(
p_access
,
"file-caching"
)
+
700
;
var_SetInteger
(
p_access
,
"file-caching"
,
i_cache
);
msg_Warn
(
p_access
,
"Opening non-local file, use more caching: %d"
,
i_cache
);
msg_Warn
(
p_access
,
"Opening remote file, increasing cache: %d"
,
i_cache
);
}
#endif
p_sys
->
fd
=
fd
;
return
VLC_SUCCESS
;
...
...
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