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
8f8ff669
Commit
8f8ff669
authored
Jul 21, 2013
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
access: info.i_size -> control(ACCESS_GET_SIZE)
parent
f9053346
Changes
23
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
154 additions
and
87 deletions
+154
-87
include/vlc_access.h
include/vlc_access.h
+9
-2
modules/access/avio.c
modules/access/avio.c
+8
-3
modules/access/cdda.c
modules/access/cdda.c
+5
-2
modules/access/dshow/dshow.cpp
modules/access/dshow/dshow.cpp
+0
-1
modules/access/file.c
modules/access/file.c
+9
-4
modules/access/ftp.c
modules/access/ftp.c
+7
-2
modules/access/gnomevfs.c
modules/access/gnomevfs.c
+7
-6
modules/access/http.c
modules/access/http.c
+16
-14
modules/access/imem.c
modules/access/imem.c
+5
-1
modules/access/mms/mmsh.c
modules/access/mms/mmsh.c
+7
-5
modules/access/mms/mmstu.c
modules/access/mms/mmstu.c
+5
-1
modules/access/mms/mmstu.h
modules/access/mms/mmstu.h
+1
-0
modules/access/mtp.c
modules/access/mtp.c
+14
-5
modules/access/rar/access.c
modules/access/rar/access.c
+5
-2
modules/access/rtsp/access.c
modules/access/rtsp/access.c
+0
-1
modules/access/sftp.c
modules/access/sftp.c
+10
-3
modules/access/smb.c
modules/access/smb.c
+6
-1
modules/access/vcd/vcd.c
modules/access/vcd/vcd.c
+5
-3
modules/access/vcdx/access.c
modules/access/vcdx/access.c
+6
-6
modules/access/vcdx/vcdplayer.h
modules/access/vcdx/vcdplayer.h
+1
-0
modules/access/vdr.c
modules/access/vdr.c
+7
-6
modules/access/zip/zipaccess.c
modules/access/zip/zipaccess.c
+15
-12
src/input/stream.c
src/input/stream.c
+6
-7
No files found.
include/vlc_access.h
View file @
8f8ff669
...
...
@@ -43,6 +43,7 @@ enum access_query_e
ACCESS_CAN_FASTSEEK
,
/* arg1= bool* cannot fail */
ACCESS_CAN_PAUSE
,
/* arg1= bool* cannot fail */
ACCESS_CAN_CONTROL_PACE
,
/* arg1= bool* cannot fail */
ACCESS_GET_SIZE
=
6
,
/* arg1= uin64_t* */
/* */
ACCESS_GET_PTS_DELAY
=
0x101
,
/* arg1= int64_t* cannot fail */
...
...
@@ -107,7 +108,6 @@ struct access_t
unsigned
int
i_update
;
/* Access sets them on change,
Input removes them once take into account*/
uint64_t
i_size
;
/* Write only for access, read only for input */
uint64_t
i_pos
;
/* idem */
bool
b_eof
;
/* idem */
...
...
@@ -137,10 +137,17 @@ static inline int access_Control( access_t *p_access, int i_query, ... )
return
i_result
;
}
static
inline
uint64_t
access_GetSize
(
access_t
*
p_access
)
{
uint64_t
val
;
if
(
access_Control
(
p_access
,
ACCESS_GET_SIZE
,
&
val
)
)
val
=
0
;
return
val
;
}
static
inline
void
access_InitFields
(
access_t
*
p_a
)
{
p_a
->
info
.
i_update
=
0
;
p_a
->
info
.
i_size
=
0
;
p_a
->
info
.
i_pos
=
0
;
p_a
->
info
.
b_eof
=
false
;
p_a
->
info
.
i_title
=
0
;
...
...
modules/access/avio.c
View file @
8f8ff669
...
...
@@ -73,8 +73,10 @@ static int UrlInterruptCallback(void *access)
return
!
vlc_object_alive
((
vlc_object_t
*
)
access
);
}
struct
access_sys_t
{
struct
access_sys_t
{
AVIOContext
*
context
;
uint64_t
size
;
};
struct
sout_access_out_sys_t
{
...
...
@@ -185,10 +187,10 @@ int OpenAvio(vlc_object_t *object)
seekable
=
sys
->
context
->
seekable
;
#endif
msg_Dbg
(
access
,
"%sseekable, size=%"
PRIi64
,
seekable
?
""
:
"not "
,
size
);
sys
->
size
=
size
>
0
?
size
:
0
;
/* */
access_InitFields
(
access
);
access
->
info
.
i_size
=
size
>
0
?
size
:
0
;
access
->
pf_read
=
Read
;
access
->
pf_block
=
NULL
;
...
...
@@ -368,7 +370,7 @@ static int Seek(access_t *access, uint64_t position)
if
(
ret
<
0
)
{
errno
=
AVUNERROR
(
ret
);
msg_Err
(
access
,
"Seek to %"
PRIu64
" failed: %m"
,
position
);
if
(
access
->
info
.
i_size
<=
0
||
position
!=
access
->
info
.
i_
size
)
if
(
sys
->
size
==
0
||
position
!=
sys
->
size
)
return
VLC_EGENERIC
;
}
access
->
info
.
i_pos
=
position
;
...
...
@@ -431,6 +433,9 @@ static int Control(access_t *access, int query, va_list args)
b
=
va_arg
(
args
,
bool
*
);
*
b
=
true
;
/* FIXME */
return
VLC_SUCCESS
;
case
ACCESS_GET_SIZE
:
*
va_arg
(
args
,
uint64_t
*
)
=
sys
->
size
;
return
VLC_SUCCESS
;
case
ACCESS_GET_PTS_DELAY
:
{
int64_t
*
delay
=
va_arg
(
args
,
int64_t
*
);
*
delay
=
DEFAULT_PTS_DELAY
;
/* FIXME */
...
...
modules/access/cdda.c
View file @
8f8ff669
...
...
@@ -96,6 +96,7 @@ vlc_module_end ()
struct
access_sys_t
{
vcddev_t
*
vcddev
;
/* vcd device descriptor */
uint64_t
size
;
/* Current position */
int
i_sector
;
/* Current Sector */
...
...
@@ -219,7 +220,7 @@ static int Open( vlc_object_t *p_this )
}
p_sys
->
i_sector
=
p_sys
->
i_first_sector
;
p_
access
->
info
.
i_
size
=
(
p_sys
->
i_last_sector
-
p_sys
->
i_first_sector
)
p_
sys
->
size
=
(
p_sys
->
i_last_sector
-
p_sys
->
i_first_sector
)
*
(
int64_t
)
CDDA_DATA_SIZE
;
}
...
...
@@ -333,7 +334,9 @@ static int Control( access_t *p_access, int i_query, va_list args )
case
ACCESS_CAN_CONTROL_PACE
:
*
va_arg
(
args
,
bool
*
)
=
true
;
break
;
case
ACCESS_GET_SIZE
:
*
va_arg
(
args
,
uint64_t
*
)
=
p_access
->
p_sys
->
size
;
break
;
case
ACCESS_GET_PTS_DELAY
:
*
va_arg
(
args
,
int64_t
*
)
=
INT64_C
(
1000
)
*
var_InheritInteger
(
p_access
,
"disc-caching"
);
...
...
modules/access/dshow/dshow.cpp
View file @
8f8ff669
...
...
@@ -814,7 +814,6 @@ static int AccessOpen( vlc_object_t *p_this )
p_access
->
pf_control
=
AccessControl
;
p_access
->
pf_seek
=
NULL
;
p_access
->
info
.
i_update
=
0
;
p_access
->
info
.
i_size
=
0
;
p_access
->
info
.
i_pos
=
0
;
p_access
->
info
.
b_eof
=
false
;
p_access
->
info
.
i_title
=
0
;
...
...
modules/access/file.c
View file @
8f8ff669
...
...
@@ -68,8 +68,8 @@ struct access_sys_t
{
int
fd
;
/* */
bool
b_pace_control
;
uint64_t
size
;
};
#if !defined (_WIN32) && !defined (__OS2__)
...
...
@@ -226,8 +226,8 @@ int FileOpen( vlc_object_t *p_this )
{
p_access
->
pf_read
=
FileRead
;
p_access
->
pf_seek
=
FileSeek
;
p_access
->
info
.
i_size
=
st
.
st_size
;
p_sys
->
b_pace_control
=
true
;
p_sys
->
size
=
st
.
st_size
;
/* Demuxers will need the beginning of the file for probing. */
posix_fadvise
(
fd
,
0
,
4096
,
POSIX_FADV_WILLNEED
);
...
...
@@ -245,6 +245,7 @@ int FileOpen( vlc_object_t *p_this )
p_access
->
pf_read
=
StreamRead
;
p_access
->
pf_seek
=
NoSeek
;
p_sys
->
b_pace_control
=
strcasecmp
(
p_access
->
psz_access
,
"stream"
);
p_sys
->
size
=
0
;
}
return
VLC_SUCCESS
;
...
...
@@ -302,12 +303,12 @@ static ssize_t FileRead (access_t *p_access, uint8_t *p_buffer, size_t i_len)
p_access
->
info
.
i_pos
+=
val
;
p_access
->
info
.
b_eof
=
!
val
;
if
(
p_access
->
info
.
i_pos
>=
p_
access
->
info
.
i_
size
)
if
(
p_access
->
info
.
i_pos
>=
p_
sys
->
size
)
{
struct
stat
st
;
if
(
fstat
(
fd
,
&
st
)
==
0
)
p_
access
->
info
.
i_
size
=
st
.
st_size
;
p_
sys
->
size
=
st
.
st_size
;
}
return
val
;
}
...
...
@@ -387,6 +388,10 @@ static int FileControl( access_t *p_access, int i_query, va_list args )
*
pb_bool
=
p_sys
->
b_pace_control
;
break
;
case
ACCESS_GET_SIZE
:
*
va_arg
(
args
,
uint64_t
*
)
=
p_sys
->
size
;
break
;
/* */
case
ACCESS_GET_PTS_DELAY
:
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
...
...
modules/access/ftp.c
View file @
8f8ff669
...
...
@@ -109,6 +109,7 @@ struct access_sys_t
char
sz_epsv_ip
[
NI_MAXNUMERICHOST
];
bool
out
;
bool
directory
;
uint64_t
size
;
};
#define GET_OUT_SYS( p_this ) \
((access_sys_t *)(((sout_access_out_t *)(p_this))->p_sys))
...
...
@@ -475,6 +476,7 @@ static int InOpen( vlc_object_t *p_this )
p_sys
->
fd_data
=
-
1
;
p_sys
->
out
=
false
;
p_sys
->
directory
=
false
;
p_sys
->
size
=
0
;
if
(
parseURL
(
&
p_sys
->
url
,
p_access
->
psz_location
)
)
goto
exit_error
;
...
...
@@ -491,9 +493,9 @@ static int InOpen( vlc_object_t *p_this )
else
if
(
ftp_RecvCommand
(
p_this
,
p_sys
,
NULL
,
&
psz_arg
)
==
2
)
{
p_
access
->
info
.
i_
size
=
atoll
(
&
psz_arg
[
4
]
);
p_
sys
->
size
=
atoll
(
&
psz_arg
[
4
]
);
free
(
psz_arg
);
msg_Dbg
(
p_access
,
"file size: %"
PRIu64
,
p_
access
->
info
.
i_
size
);
msg_Dbg
(
p_access
,
"file size: %"
PRIu64
,
p_
sys
->
size
);
}
else
if
(
ftp_SendCommand
(
p_this
,
p_sys
,
"CWD %s"
,
p_sys
->
url
.
psz_path
)
<
0
)
...
...
@@ -728,6 +730,9 @@ static int Control( access_t *p_access, int i_query, va_list args )
pb_bool
=
(
bool
*
)
va_arg
(
args
,
bool
*
);
*
pb_bool
=
true
;
/* FIXME */
break
;
case
ACCESS_GET_SIZE
:
*
va_arg
(
args
,
uint64_t
*
)
=
p_access
->
p_sys
->
size
;
break
;
/* */
case
ACCESS_GET_PTS_DELAY
:
...
...
modules/access/gnomevfs.c
View file @
8f8ff669
...
...
@@ -213,7 +213,6 @@ static int Open( vlc_object_t *p_this )
p_sys
->
p_file_info
->
type
==
GNOME_VFS_FILE_TYPE_BLOCK_DEVICE
)
{
p_sys
->
b_seekable
=
true
;
p_access
->
info
.
i_size
=
(
int64_t
)(
p_sys
->
p_file_info
->
size
);
}
else
if
(
p_sys
->
p_file_info
->
type
==
GNOME_VFS_FILE_TYPE_FIFO
||
p_sys
->
p_file_info
->
type
==
GNOME_VFS_FILE_TYPE_SOCKET
)
...
...
@@ -226,7 +225,7 @@ static int Open( vlc_object_t *p_this )
return
VLC_EGENERIC
;
}
if
(
p_sys
->
b_seekable
&&
!
p_
access
->
info
.
i_
size
)
if
(
p_sys
->
b_seekable
&&
!
p_
sys
->
p_file_info
->
size
)
{
/* FIXME that's bad because all others access will be probed */
msg_Warn
(
p_access
,
"file %s is empty, aborting"
,
psz_name
);
...
...
@@ -288,8 +287,8 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
}
p_access
->
info
.
i_pos
+=
(
int64_t
)
i_read_len
;
if
(
p_access
->
info
.
i_pos
>=
p_
access
->
info
.
i_
size
&&
p_
access
->
info
.
i_
size
!=
0
&&
p_sys
->
b_local
)
if
(
p_access
->
info
.
i_pos
>=
p_
sys
->
p_file_info
->
size
&&
p_
sys
->
p_file_info
->
size
!=
0
&&
p_sys
->
b_local
)
{
gnome_vfs_file_info_clear
(
p_sys
->
p_file_info
);
i_ret
=
gnome_vfs_get_file_info_from_handle
(
p_sys
->
p_handle
,
...
...
@@ -297,8 +296,6 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
if
(
i_ret
)
msg_Warn
(
p_access
,
"couldn't get file properties again (%s)"
,
gnome_vfs_result_to_string
(
i_ret
)
);
else
p_access
->
info
.
i_size
=
(
int64_t
)(
p_sys
->
p_file_info
->
size
);
}
return
(
int
)
i_read_len
;
}
...
...
@@ -361,6 +358,10 @@ static int Control( access_t *p_access, int i_query, va_list args )
*
pb_bool
=
p_sys
->
b_pace_control
;
break
;
case
ACCESS_GET_SIZE
:
*
va_arg
(
args
,
uint64_t
*
)
=
p_sys
->
p_file_info
->
size
;
break
;
case
ACCESS_GET_PTS_DELAY
:
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
*
pi_64
=
DEFAULT_PTS_DELAY
;
/* FIXME */
...
...
modules/access/http.c
View file @
8f8ff669
...
...
@@ -176,6 +176,7 @@ struct access_sys_t
char
*
psz_icy_title
;
uint64_t
i_remaining
;
uint64_t
size
;
bool
b_seekable
;
bool
b_reconnect
;
...
...
@@ -281,7 +282,7 @@ static int OpenWithCookies( vlc_object_t *p_this, const char *psz_access,
p_sys
->
i_remaining
=
0
;
p_sys
->
b_persist
=
false
;
p_sys
->
b_has_size
=
false
;
p_
access
->
info
.
i_
size
=
0
;
p_
sys
->
size
=
0
;
p_access
->
info
.
i_pos
=
0
;
p_access
->
info
.
b_eof
=
false
;
...
...
@@ -732,7 +733,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
if
(
p_sys
->
b_has_size
)
{
/* Remaining bytes in the file */
uint64_t
remainder
=
p_
access
->
info
.
i_
size
-
p_access
->
info
.
i_pos
;
uint64_t
remainder
=
p_
sys
->
size
-
p_access
->
info
.
i_pos
;
if
(
remainder
<
i_len
)
i_len
=
remainder
;
...
...
@@ -805,7 +806,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
p_access
->
info
.
i_pos
+=
i_read
;
if
(
p_sys
->
b_has_size
)
{
assert
(
p_access
->
info
.
i_pos
<=
p_
access
->
info
.
i_
size
);
assert
(
p_access
->
info
.
i_pos
<=
p_
sys
->
size
);
assert
(
(
unsigned
)
i_read
<=
p_sys
->
i_remaining
);
p_sys
->
i_remaining
-=
i_read
;
}
...
...
@@ -929,14 +930,15 @@ static ssize_t ReadCompressed( access_t *p_access, uint8_t *p_buffer,
*****************************************************************************/
static
int
Seek
(
access_t
*
p_access
,
uint64_t
i_pos
)
{
msg_Dbg
(
p_access
,
"trying to seek to %"
PRId64
,
i_pos
)
;
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
msg_Dbg
(
p_access
,
"trying to seek to %"
PRId64
,
i_pos
);
Disconnect
(
p_access
);
if
(
p_
access
->
info
.
i_size
&&
i_pos
>=
p_access
->
info
.
i_size
)
{
if
(
p_
sys
->
size
&&
i_pos
>=
p_sys
->
size
)
{
msg_Err
(
p_access
,
"seek too far"
);
int
retval
=
Seek
(
p_access
,
p_
access
->
info
.
i_
size
-
1
);
int
retval
=
Seek
(
p_access
,
p_
sys
->
size
-
1
);
if
(
retval
==
VLC_SUCCESS
)
{
uint8_t
p_buffer
[
2
];
Read
(
p_access
,
p_buffer
,
1
);
...
...
@@ -1058,7 +1060,7 @@ static int Connect( access_t *p_access, uint64_t i_tell )
p_sys
->
i_remaining
=
0
;
p_sys
->
b_persist
=
false
;
p_sys
->
b_has_size
=
false
;
p_
access
->
info
.
i_
size
=
0
;
p_
sys
->
size
=
0
;
p_access
->
info
.
i_pos
=
i_tell
;
p_access
->
info
.
b_eof
=
false
;
...
...
@@ -1337,25 +1339,25 @@ static int Request( access_t *p_access, uint64_t i_tell )
if
(
!
strcasecmp
(
psz
,
"Content-Length"
)
)
{
uint64_t
i_size
=
i_tell
+
(
p_sys
->
i_remaining
=
(
uint64_t
)
atoll
(
p
));
if
(
i_size
>
p_
access
->
info
.
i_
size
)
{
if
(
i_size
>
p_
sys
->
size
)
{
p_sys
->
b_has_size
=
true
;
p_
access
->
info
.
i_
size
=
i_size
;
p_
sys
->
size
=
i_size
;
}
msg_Dbg
(
p_access
,
"this frame size=%"
PRIu64
,
p_sys
->
i_remaining
);
}
else
if
(
!
strcasecmp
(
psz
,
"Content-Range"
)
)
{
uint64_t
i_ntell
=
i_tell
;
uint64_t
i_nend
=
(
p_
access
->
info
.
i_size
>
0
)
?
(
p_access
->
info
.
i_size
-
1
)
:
i_tell
;
uint64_t
i_nsize
=
p_
access
->
info
.
i_
size
;
uint64_t
i_nend
=
(
p_
sys
->
size
>
0
)
?
(
p_sys
->
size
-
1
)
:
i_tell
;
uint64_t
i_nsize
=
p_
sys
->
size
;
sscanf
(
p
,
"bytes %"
SCNu64
"-%"
SCNu64
"/%"
SCNu64
,
&
i_ntell
,
&
i_nend
,
&
i_nsize
);
if
(
i_nend
>
i_ntell
)
{
p_access
->
info
.
i_pos
=
i_ntell
;
p_sys
->
i_icy_offset
=
i_ntell
;
p_sys
->
i_remaining
=
i_nend
+
1
-
i_ntell
;
uint64_t
i_size
=
(
i_nsize
>
i_nend
)
?
i_nsize
:
(
i_nend
+
1
);
if
(
i_size
>
p_
access
->
info
.
i_
size
)
{
if
(
i_size
>
p_
sys
->
size
)
{
p_sys
->
b_has_size
=
true
;
p_
access
->
info
.
i_
size
=
i_size
;
p_
sys
->
size
=
i_size
;
}
msg_Dbg
(
p_access
,
"stream size=%"
PRIu64
",pos=%"
PRIu64
",remaining=%"
PRIu64
,
i_nsize
,
i_ntell
,
p_sys
->
i_remaining
);
...
...
modules/access/imem.c
View file @
8f8ff669
...
...
@@ -309,7 +309,6 @@ static int OpenAccess(vlc_object_t *object)
access
->
pf_block
=
Block
;
access
->
pf_seek
=
NULL
;
access
->
p_sys
=
(
access_sys_t
*
)
sys
;
access
->
info
.
i_size
=
var_InheritInteger
(
object
,
"imem-size"
);
return
VLC_SUCCESS
;
}
...
...
@@ -344,6 +343,11 @@ static int ControlAccess(access_t *access, int i_query, va_list args)
*
b
=
true
;
return
VLC_SUCCESS
;
}
case
ACCESS_GET_SIZE
:
{
uint64_t
*
s
=
va_arg
(
args
,
uint64_t
*
);
*
s
=
var_InheritInteger
(
access
,
"imem-size"
);
return
VLC_SUCCESS
;
}
case
ACCESS_GET_PTS_DELAY
:
{
int64_t
*
delay
=
va_arg
(
args
,
int64_t
*
);
*
delay
=
DEFAULT_PTS_DELAY
;
/* FIXME? */
...
...
modules/access/mms/mmsh.c
View file @
8f8ff669
...
...
@@ -185,11 +185,6 @@ int MMSHOpen( access_t *p_access )
goto
error
;
}
if
(
!
p_sys
->
b_broadcast
)
{
p_access
->
info
.
i_size
=
p_sys
->
asfh
.
i_file_size
;
}
return
VLC_SUCCESS
;
error:
...
...
@@ -245,6 +240,13 @@ static int Control( access_t *p_access, int i_query, va_list args )
*
pb_bool
=
true
;
break
;
case
ACCESS_GET_SIZE
:
{
uint64_t
*
s
=
va_arg
(
args
,
uint64_t
*
);
*
s
=
p_sys
->
b_broadcast
?
0
:
p_sys
->
asfh
.
i_file_size
;
return
VLC_SUCCESS
;
}
/* */
case
ACCESS_GET_PTS_DELAY
:
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
...
...
modules/access/mms/mmstu.c
View file @
8f8ff669
...
...
@@ -176,7 +176,7 @@ int MMSTUOpen( access_t *p_access )
else
{
p_sys
->
b_seekable
=
true
;
p_
access
->
info
.
i_size
=
p_
sys
->
i_size
=
(
uint64_t
)
p_sys
->
i_header
+
(
uint64_t
)
p_sys
->
i_packet_count
*
(
uint64_t
)
p_sys
->
i_packet_length
;
}
...
...
@@ -250,6 +250,10 @@ static int Control( access_t *p_access, int i_query, va_list args )
*
pb_bool
=
true
;
break
;
case
ACCESS_GET_SIZE
:
*
va_arg
(
args
,
uint64_t
*
)
=
p_sys
->
i_size
;
break
;
/* */
case
ACCESS_GET_PTS_DELAY
:
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
...
...
modules/access/mms/mmstu.h
View file @
8f8ff669
...
...
@@ -43,6 +43,7 @@ struct access_sys_t
char
sz_bind_addr
[
NI_MAXNUMERICHOST
];
/* used by udp */
vlc_url_t
url
;
uint64_t
i_size
;
asf_header_t
asfh
;
...
...
modules/access/mtp.c
View file @
8f8ff669
...
...
@@ -153,11 +153,6 @@ static int Open( vlc_object_t *p_this )
}
p_sys
->
fd
=
fd
;
struct
stat
st
;
if
(
fstat
(
fd
,
&
st
)
)
msg_Err
(
p_access
,
"fstat(%d): %m"
,
fd
);
p_access
->
info
.
i_size
=
st
.
st_size
;
return
VLC_SUCCESS
;
}
...
...
@@ -229,6 +224,7 @@ static int Seek( access_t *p_access, uint64_t i_pos )
*****************************************************************************/
static
int
Control
(
access_t
*
p_access
,
int
i_query
,
va_list
args
)
{
access_sys_t
*
sys
=
p_access
->
p_sys
;
bool
*
pb_bool
;
int64_t
*
pi_64
;
...
...
@@ -247,6 +243,19 @@ static int Control( access_t *p_access, int i_query, va_list args )
*
pb_bool
=
true
;
break
;
case
ACCESS_GET_SIZE
:
{
uint64_t
*
s
=
va_arg
(
args
,
uint64_t
*
);
struct
stat
st
;
if
(
fstat
(
sys
->
fd
,
&
st
)
)
{
msg_Err
(
p_access
,
"fstat error: %m"
);
return
VLC_EGENERIC
;
}
*
s
=
st
.
st_size
;
break
;
}
case
ACCESS_GET_PTS_DELAY
:
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
*
pi_64
=
INT64_C
(
1000
)
...
...
modules/access/rar/access.c
View file @
8f8ff669
...
...
@@ -123,7 +123,8 @@ static ssize_t Read(access_t *access, uint8_t *data, size_t size)
static
int
Control
(
access_t
*
access
,
int
query
,
va_list
args
)
{
stream_t
*
s
=
access
->
p_sys
->
s
;
access_sys_t
*
sys
=
access
->
p_sys
;
stream_t
*
s
=
sys
->
s
;
if
(
!
s
)
return
VLC_EGENERIC
;
...
...
@@ -143,6 +144,9 @@ static int Control(access_t *access, int query, va_list args)
*
b
=
true
;
return
VLC_SUCCESS
;
}
case
ACCESS_GET_SIZE
:
*
va_arg
(
args
,
uint64_t
*
)
=
sys
->
file
->
size
;
return
VLC_SUCCESS
;
case
ACCESS_GET_PTS_DELAY
:
{
int64_t
*
delay
=
va_arg
(
args
,
int64_t
*
);
*
delay
=
DEFAULT_PTS_DELAY
;
...
...
@@ -198,7 +202,6 @@ static int Open(vlc_object_t *object)
access
->
pf_seek
=
Seek
;
access_InitFields
(
access
);
access
->
info
.
i_size
=
file
->
size
;
rar_file_chunk_t
dummy
=
{
.
mrl
=
base
,
...
...
modules/access/rtsp/access.c
View file @
8f8ff669
...
...
@@ -160,7 +160,6 @@ static int Open( vlc_object_t *p_this )
p_access
->
pf_seek
=
Seek
;
p_access
->
pf_control
=
Control
;
p_access
->
info
.
i_update
=
0
;
p_access
->
info
.
i_size
=
0
;
p_access
->
info
.
i_pos
=
0
;
p_access
->
info
.
b_eof
=
false
;
p_access
->
info
.
i_title
=
0
;
...
...
modules/access/sftp.c
View file @
8f8ff669
...
...
@@ -80,6 +80,7 @@ struct access_sys_t
LIBSSH2_SESSION
*
ssh_session
;
LIBSSH2_SFTP
*
sftp_session
;
LIBSSH2_SFTP_HANDLE
*
file
;
uint64_t
filesize
;
size_t
i_read_size
;
};
...
...
@@ -233,7 +234,7 @@ static int Open( vlc_object_t* p_this )
msg_Err
(
p_access
,
"Impossible to get information about the remote file %s"
,
url
.
psz_path
);
goto
error
;
}
p_
access
->
info
.
i_
size
=
attributes
.
filesize
;
p_
sys
->
file
size
=
attributes
.
filesize
;
p_sys
->
i_read_size
=
var_InheritInteger
(
p_access
,
"sftp-readsize"
);
...
...
@@ -269,12 +270,14 @@ static void Close( vlc_object_t* p_this )
static
block_t
*
Block
(
access_t
*
p_access
)
{
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
if
(
p_access
->
info
.
b_eof
)
return
NULL
;
/* Allocate the buffer we need */
size_t
i_len
=
__MIN
(
p_
access
->
p_sys
->
i_read_size
,
p_access
->
info
.
i_size
-
p_access
->
info
.
i_pos
);
size_t
i_len
=
__MIN
(
p_
sys
->
i_read_size
,
p_sys
->
filesize
-
p_access
->
info
.
i_pos
);
block_t
*
p_block
=
block_Alloc
(
i_len
);
if
(
!
p_block
)
return
NULL
;
...
...
@@ -335,6 +338,10 @@ static int Control( access_t* p_access, int i_query, va_list args )
*
pb_bool
=
true
;
break
;
case
ACCESS_GET_SIZE
:
*
va_arg
(
args
,
uint64_t
*
)
=
p_access
->
p_sys
->
filesize
;
break
;
case
ACCESS_GET_PTS_DELAY
:
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
*
pi_64
=
INT64_C
(
1000
)
...
...
modules/access/smb.c
View file @
8f8ff669
...
...
@@ -91,6 +91,7 @@ static int Control( access_t *, int, va_list );
struct
access_sys_t
{
int
i_smb
;
uint64_t
size
;
};
#ifdef _WIN32
...
...
@@ -234,7 +235,7 @@ static int Open( vlc_object_t *p_this )
msg_Err
(
p_access
,
"stat failed (%m)"
);
}
else
p_
access
->
info
.
i_
size
=
filestat
.
st_size
;
p_
sys
->
size
=
filestat
.
st_size
;
free
(
psz_uri
);
...
...
@@ -318,6 +319,10 @@ static int Control( access_t *p_access, int i_query, va_list args )
*
va_arg
(
args
,
bool
*
)
=
true
;
break
;
case
ACCESS_GET_SIZE
:
*
va_arg
(
args
,
uint64_t
*
)
=
p_access
->
p_sys
->
size
;
break
;
case
ACCESS_GET_PTS_DELAY
:
*
va_arg
(
args
,
int64_t
*
)
=
INT64_C
(
1000
)
*
var_InheritInteger
(
p_access
,
"network-caching"
);
...
...
modules/access/vcd/vcd.c
View file @
8f8ff669
...
...
@@ -199,7 +199,6 @@ static int Open( vlc_object_t *p_this )
p_access
->
info
.
i_title
=
i_title
;
p_access
->
info
.
i_seekpoint
=
i_chapter
;
p_access
->
info
.
i_size
=
p_sys
->
title
[
i_title
]
->
i_size
;
p_access
->
info
.
i_pos
=
(
uint64_t
)(
p_sys
->
i_sector
-
p_sys
->
p_sectors
[
1
+
i_title
]
)
*
VCD_DATA_SIZE
;
...
...
@@ -245,6 +244,11 @@ static int Control( access_t *p_access, int i_query, va_list args )
*
va_arg
(
args
,
bool
*
)
=
true
;
break
;
case
ACCESS_GET_SIZE
:
*
va_arg
(
args
,
uint64_t
*
)
=
p_sys
->
title
[
p_access
->
info
.
i_title
]
->
i_size
;
break
;
/* */
case
ACCESS_GET_PTS_DELAY
:
*
va_arg
(
args
,
int64_t
*
)
=
INT64_C
(
1000
)
...
...
@@ -276,7 +280,6 @@ static int Control( access_t *p_access, int i_query, va_list args )
INPUT_UPDATE_TITLE
|
INPUT_UPDATE_SEEKPOINT
;
p_access
->
info
.
i_title
=
i
;
p_access
->
info
.
i_seekpoint
=
0
;
p_access
->
info
.
i_size
=
p_sys
->
title
[
i
]
->
i_size
;
p_access
->
info
.
i_pos
=
0
;
/* Next sector to read */
...
...
@@ -339,7 +342,6 @@ static block_t *Block( access_t *p_access )
INPUT_UPDATE_TITLE
|
INPUT_UPDATE_SEEKPOINT
;
p_access
->
info
.
i_title
++
;
p_access
->
info
.
i_seekpoint
=
0
;
p_access
->
info
.
i_size
=
p_sys
->
title
[
p_access
->
info
.
i_title
]
->
i_size
;
p_access
->
info
.
i_pos
=
0
;
}
...
...
modules/access/vcdx/access.c
View file @
8f8ff669
...
...
@@ -675,16 +675,16 @@ VCDSetOrigin( access_t *p_access, lsn_t i_lsn, track_t i_track,
p_access
->
info
.
i_title
=
i_track
-
1
;
if
(
p_vcdplayer
->
b_track_length
)
{
p_access
->
info
.
i_
size
=
p_vcdplayer
->
p_title
[
i_track
-
1
]
->
i_size
;
p_access
->
p_sys
->
size
=
p_vcdplayer
->
p_title
[
i_track
-
1
]
->
i_size
;
p_access
->
info
.
i_pos
=
(
uint64_t
)
M2F2_SECTOR_SIZE
*
(
vcdinfo_get_track_lsn
(
p_vcdplayer
->
vcd
,
i_track
)
-
i_lsn
);
}
else
{
p_access
->
info
.
i_
size
=
M2F2_SECTOR_SIZE
*
(
int64_t
)
p_access
->
p_sys
->
size
=
M2F2_SECTOR_SIZE
*
(
int64_t
)
vcdinfo_get_entry_sect_count
(
p_vcdplayer
->
vcd
,
p_itemid
->
num
);
p_access
->
info
.
i_pos
=
0
;
}
dbg_print
(
(
INPUT_DBG_LSN
|
INPUT_DBG_PBC
),
"size: %"
PRIu64
", pos: %"
PRIu64
,
p_access
->
info
.
i_
size
,
p_access
->
info
.
i_pos
);
p_access
->
p_sys
->
size
,
p_access
->
info
.
i_pos
);
p_access
->
info
.
i_seekpoint
=
p_itemid
->
num
;
break
;
...
...
@@ -696,7 +696,7 @@ VCDSetOrigin( access_t *p_access, lsn_t i_lsn, track_t i_track,
the entry seekpoints and (zeroed) lid seekpoints.
*/
p_access
->
info
.
i_title
=
p_vcdplayer
->
i_titles
-
1
;
p_access
->
info
.
i_
size
=
0
;
/* No seeking on stills, please. */
p_access
->
p_sys
->
size
=
0
;
/* No seeking on stills, please. */
p_access
->
info
.
i_pos
=
0
;
p_access
->
info
.
i_seekpoint
=
p_vcdplayer
->
i_entries
+
p_vcdplayer
->
i_lids
+
p_itemid
->
num
;
...
...
@@ -704,7 +704,7 @@ VCDSetOrigin( access_t *p_access, lsn_t i_lsn, track_t i_track,
case
VCDINFO_ITEM_TYPE_TRACK
:
p_access
->
info
.
i_title
=
i_track
-
1
;
p_access
->
info
.
i_
size
=
p_vcdplayer
->
p_title
[
i_track
-
1
]
->
i_size
;
p_access
->
p_sys
->
size
=
p_vcdplayer
->
p_title
[
i_track
-
1
]
->
i_size
;
p_access
->
info
.
i_pos
=
0
;
p_access
->
info
.
i_seekpoint
=
vcdinfo_track_get_entry
(
p_vcdplayer
->
vcd
,
i_track
);
...
...
@@ -853,7 +853,6 @@ VCDOpen ( vlc_object_t *p_this )
p_access
->
pf_seek
=
VCDSeek
;
p_access
->
info
.
i_update
=
0
;
p_access
->
info
.
i_size
=
0
;
p_access
->
info
.
i_pos
=
0
;
p_access
->
info
.
b_eof
=
false
;
p_access
->
info
.
i_title
=
0
;
...
...
@@ -866,6 +865,7 @@ VCDOpen ( vlc_object_t *p_this )
p_vcdplayer
->
i_debug
=
var_InheritInteger
(
p_this
,
MODULE_STRING
"-debug"
);
p_access
->
p_sys
=
(
access_sys_t
*
)
p_vcdplayer
;
p_access
->
p_sys
->
size
=
0
;
/* Set where to log errors messages from libcdio. */
p_vcd_access
=
p_access
;
...
...
modules/access/vcdx/vcdplayer.h
View file @
8f8ff669
...
...
@@ -160,6 +160,7 @@ typedef struct vcdplayer_input_s
bool
b_track_length
;
/* Use track as max unit in seek */
input_thread_t
*
p_input
;
access_t
*
p_access
;
uint64_t
size
;
}
vcdplayer_t
;
...
...
modules/access/vdr.c
View file @
8f8ff669
...
...
@@ -114,6 +114,7 @@ struct access_sys_t
{
/* file sizes of all parts */
size_array_t
file_sizes
;
uint64_t
size
;
/* total size */
/* index and fd of current open file */
unsigned
i_current_file
;
...
...
@@ -379,7 +380,7 @@ static int Seek( access_t *p_access, uint64_t i_pos )
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
/* might happen if called by ACCESS_SET_SEEKPOINT */
i_pos
=
__MIN
(
i_pos
,
p_
access
->
info
.
i_
size
);
i_pos
=
__MIN
(
i_pos
,
p_
sys
->
size
);
p_access
->
info
.
i_pos
=
i_pos
;
p_access
->
info
.
b_eof
=
false
;
...
...
@@ -478,7 +479,7 @@ static bool ImportNextFile( access_t *p_access )
free
(
psz_path
);
ARRAY_APPEND
(
p_sys
->
file_sizes
,
st
.
st_size
);
p_
access
->
info
.
i_
size
+=
st
.
st_size
;
p_
sys
->
size
+=
st
.
st_size
;
return
true
;
}
...
...
@@ -571,7 +572,7 @@ static void UpdateFileSize( access_t *p_access )
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
struct
stat
st
;
if
(
p_
access
->
info
.
i_
size
>=
p_access
->
info
.
i_pos
)
if
(
p_
sys
->
size
>=
p_access
->
info
.
i_pos
)
return
;
/* TODO: not sure if this can happen or what to do in this case */
...
...
@@ -580,9 +581,9 @@ static void UpdateFileSize( access_t *p_access )
if
(
(
uint64_t
)
st
.
st_size
<=
CURRENT_FILE_SIZE
)
return
;
p_
access
->
info
.
i_
size
-=
CURRENT_FILE_SIZE
;
p_
sys
->
size
-=
CURRENT_FILE_SIZE
;
CURRENT_FILE_SIZE
=
st
.
st_size
;
p_
access
->
info
.
i_
size
+=
CURRENT_FILE_SIZE
;
p_
sys
->
size
+=
CURRENT_FILE_SIZE
;
}
/*****************************************************************************
...
...
@@ -808,7 +809,7 @@ static void ImportMarks( access_t *p_access )
}
p_marks
->
psz_name
=
strdup
(
_
(
"VDR Cut Marks"
)
);
p_marks
->
i_length
=
i_frame_count
*
(
int64_t
)(
CLOCK_FREQ
/
p_sys
->
fps
);
p_marks
->
i_size
=
p_
access
->
info
.
i_
size
;
p_marks
->
i_size
=
p_
sys
->
size
;
/* offset for chapter positions */
int
i_chapter_offset
=
p_sys
->
fps
/
1000
*
...
...
modules/access/zip/zipaccess.c
View file @
8f8ff669
...
...
@@ -101,7 +101,6 @@ int AccessOpen( vlc_object_t *p_this )
access_t
*
p_access
=
(
access_t
*
)
p_this
;
access_sys_t
*
p_sys
;
int
i_ret
=
VLC_EGENERIC
;
unzFile
file
=
0
;
char
*
psz_pathToZip
=
NULL
,
*
psz_path
=
NULL
,
*
psz_sep
=
NULL
;
...
...
@@ -163,8 +162,8 @@ int AccessOpen( vlc_object_t *p_this )
p_func
->
opaque
=
p_access
;
/* Open zip archive */
file
=
p_access
->
p_sys
->
zipFile
=
unzOpen2
(
psz_pathToZip
,
p_func
);
if
(
!
f
ile
)
p_access
->
p_sys
->
zipFile
=
unzOpen2
(
psz_pathToZip
,
p_func
);
if
(
!
p_access
->
p_sys
->
zipF
ile
)
{
msg_Err
(
p_access
,
"not a valid zip archive: '%s'"
,
psz_pathToZip
);
i_ret
=
VLC_EGENERIC
;
...
...
@@ -178,12 +177,6 @@ int AccessOpen( vlc_object_t *p_this )
/* Set callback */
ACCESS_SET_CALLBACKS
(
AccessRead
,
NULL
,
AccessControl
,
AccessSeek
);
/* Get some infos about current file. Maybe we could want some more ? */
unz_file_info
z_info
;
unzGetCurrentFileInfo
(
file
,
&
z_info
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
);
/* Set access information: size is needed for AccessSeek */
p_access
->
info
.
i_size
=
z_info
.
uncompressed_size
;
p_access
->
info
.
i_pos
=
0
;
p_access
->
info
.
b_eof
=
false
;
...
...
@@ -192,10 +185,10 @@ int AccessOpen( vlc_object_t *p_this )
exit:
if
(
i_ret
!=
VLC_SUCCESS
)
{
if
(
f
ile
)
if
(
p_access
->
p_sys
->
zipF
ile
)
{
unzCloseCurrentFile
(
f
ile
);
unzClose
(
f
ile
);
unzCloseCurrentFile
(
p_access
->
p_sys
->
zipF
ile
);
unzClose
(
p_access
->
p_sys
->
zipF
ile
);
}
free
(
p_sys
->
psz_fileInzip
);
free
(
p_sys
->
fileFunctions
);
...
...
@@ -251,6 +244,16 @@ static int AccessControl( access_t *p_access, int i_query, va_list args )
*
pb_bool
=
false
;
break
;
case
ACCESS_GET_SIZE
:
{
unz_file_info
z_info
;
unzGetCurrentFileInfo
(
p_access
->
p_sys
->
zipFile
,
&
z_info
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
);
*
va_arg
(
args
,
uint64_t
*
)
=
z_info
.
uncompressed_size
;
break
;
}
case
ACCESS_GET_PTS_DELAY
:
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
*
pi_64
=
DEFAULT_PTS_DELAY
;
...
...
src/input/stream.c
View file @
8f8ff669
...
...
@@ -318,7 +318,7 @@ stream_t *stream_AccessNew( access_t *p_access, char **ppsz_list )
if
(
!
p_entry
)
goto
error
;
p_entry
->
i_size
=
p_access
->
info
.
i_size
;
p_entry
->
i_size
=
access_GetSize
(
p_access
)
;
p_entry
->
psz_path
=
strdup
(
p_access
->
psz_location
);
if
(
!
p_entry
->
psz_path
)
{
...
...
@@ -328,7 +328,7 @@ stream_t *stream_AccessNew( access_t *p_access, char **ppsz_list )
p_sys
->
p_list_access
=
p_access
;
TAB_APPEND
(
p_sys
->
i_list
,
p_sys
->
list
,
p_entry
);
msg_Dbg
(
p_access
,
"adding file `%s', (%"
PRId64
" bytes)"
,
p_entry
->
psz_path
,
p_
access
->
info
.
i_size
);
p_entry
->
psz_path
,
p_
entry
->
i_size
);
for
(
int
i
=
0
;
ppsz_list
[
i
]
!=
NULL
;
i
++
)
{
...
...
@@ -342,15 +342,14 @@ stream_t *stream_AccessNew( access_t *p_access, char **ppsz_list )
if
(
!
p_tmp
)
continue
;
msg_Dbg
(
p_access
,
"adding file `%s', (%"
PRId64
" bytes)"
,
psz_name
,
p_tmp
->
info
.
i_size
);
p_entry
=
malloc
(
sizeof
(
*
p_entry
)
);
if
(
p_entry
)
{
p_entry
->
i_size
=
p_tmp
->
info
.
i_size
;
p_entry
->
i_size
=
access_GetSize
(
p_tmp
)
;
p_entry
->
psz_path
=
psz_name
;
TAB_APPEND
(
p_sys
->
i_list
,
p_sys
->
list
,
p_entry
);
msg_Dbg
(
p_access
,
"adding file `%s', (%"
PRId64
" bytes)"
,
p_entry
->
psz_path
,
p_entry
->
i_size
);
}
access_Delete
(
p_tmp
);
}
...
...
@@ -562,7 +561,7 @@ static int AStreamControl( stream_t *s, int i_query, va_list args )
*
pi_64
+=
s
->
p_sys
->
list
[
i
]
->
i_size
;
break
;
}
*
pi_64
=
p_access
->
info
.
i_size
;
*
pi_64
=
access_GetSize
(
p_access
)
;
break
;
case
STREAM_CAN_SEEK
:
...
...
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