Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
ca6ed054
Commit
ca6ed054
authored
Jan 17, 2011
by
Jean-Philippe André
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Zip: fix seeking (closes #3867)
parent
c77acd6e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
11 deletions
+8
-11
modules/access/zip/zipaccess.c
modules/access/zip/zipaccess.c
+8
-11
No files found.
modules/access/zip/zipaccess.c
View file @
ca6ed054
...
...
@@ -50,7 +50,7 @@ struct access_sys_t
static
int
AccessControl
(
access_t
*
p_access
,
int
i_query
,
va_list
args
);
static
ssize_t
AccessRead
(
access_t
*
,
uint8_t
*
,
size_t
);
static
int
AccessSeek
(
access_t
*
,
uint64_t
);
static
int
OpenFileInZip
(
access_t
*
p_access
,
uint64_t
i_pos
);
static
int
OpenFileInZip
(
access_t
*
p_access
);
static
char
*
unescapeXml
(
const
char
*
psz_text
);
/** **************************************************************************
...
...
@@ -156,7 +156,7 @@ int AccessOpen( vlc_object_t *p_this )
}
/* Open file in zip */
OpenFileInZip
(
p_access
,
0
);
OpenFileInZip
(
p_access
);
/* Set callback */
ACCESS_SET_CALLBACKS
(
AccessRead
,
NULL
,
AccessControl
,
AccessSeek
);
...
...
@@ -292,6 +292,7 @@ static int AccessSeek( access_t *p_access, uint64_t seek_len )
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
assert
(
p_sys
);
unzFile
file
=
p_sys
->
zipFile
;
if
(
!
file
)
{
msg_Err
(
p_access
,
"archive not opened !"
);
...
...
@@ -299,9 +300,9 @@ static int AccessSeek( access_t *p_access, uint64_t seek_len )
}
/* Reopen file in zip if needed */
if
(
p_access
->
info
.
i_pos
!=
0
)
if
(
p_access
->
info
.
i_pos
>
seek_len
)
{
OpenFileInZip
(
p_access
,
p_access
->
info
.
i_pos
+
seek_len
);
OpenFileInZip
(
p_access
);
}
/* Read seek_len data and drop it */
...
...
@@ -333,7 +334,7 @@ static int AccessSeek( access_t *p_access, uint64_t seek_len )
/** **************************************************************************
* \brief Open file in zip
*****************************************************************************/
static
int
OpenFileInZip
(
access_t
*
p_access
,
uint64_t
i_pos
)
static
int
OpenFileInZip
(
access_t
*
p_access
)
{
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
unzFile
file
=
p_sys
->
zipFile
;
...
...
@@ -357,10 +358,8 @@ static int OpenFileInZip( access_t *p_access, uint64_t i_pos )
p_sys
->
psz_fileInzip
);
return
VLC_EGENERIC
;
}
if
(
i_pos
>
0
)
return
AccessSeek
(
p_access
,
i_pos
);
else
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
/** **************************************************************************
...
...
@@ -433,7 +432,6 @@ static long ZCALLBACK ZipIO_Seek( void* opaque, void* stream,
uLong
offset
,
int
origin
)
{
(
void
)
opaque
;
//access_t *p_access = (access_t*) opaque;
int64_t
pos
=
offset
;
switch
(
origin
)
{
...
...
@@ -450,7 +448,6 @@ static long ZCALLBACK ZipIO_Seek( void* opaque, void* stream,
}
if
(
pos
<
0
)
return
-
1
;
//msg_Dbg( p_access, "seek (%d,%d): %" PRIu64, offset, origin, pos );
stream_Seek
(
(
stream_t
*
)
stream
,
pos
);
/* Note: in unzip.c, unzlocal_SearchCentralDir seeks to the end of
the stream, which is doable but returns an error in VLC.
...
...
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