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
356372b2
Commit
356372b2
authored
Feb 27, 2010
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cosmetics (zip).
parent
7bbc2ae8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
20 deletions
+25
-20
modules/access/zip/zipstream.c
modules/access/zip/zipstream.c
+25
-20
No files found.
modules/access/zip/zipstream.c
View file @
356372b2
...
@@ -67,6 +67,7 @@ static int Control( stream_t *, int i_query, va_list );
...
@@ -67,6 +67,7 @@ static int Control( stream_t *, int i_query, va_list );
typedef
struct
node
node
;
typedef
struct
node
node
;
typedef
struct
item
item
;
typedef
struct
item
item
;
static
int
Fill
(
stream_t
*
);
static
int
CreatePlaylist
(
stream_t
*
s
,
char
**
pp_buffer
);
static
int
CreatePlaylist
(
stream_t
*
s
,
char
**
pp_buffer
);
static
int
GetFilesInZip
(
stream_t
*
,
unzFile
,
vlc_array_t
*
,
vlc_array_t
*
);
static
int
GetFilesInZip
(
stream_t
*
,
unzFile
,
vlc_array_t
*
,
vlc_array_t
*
);
static
node
*
findOrCreateParentNode
(
node
*
root
,
const
char
*
fullpath
);
static
node
*
findOrCreateParentNode
(
node
*
root
,
const
char
*
fullpath
);
...
@@ -255,14 +256,8 @@ static int Read( stream_t *s, void *p_read, unsigned int i_read )
...
@@ -255,14 +256,8 @@ static int Read( stream_t *s, void *p_read, unsigned int i_read )
if
(
!
p_read
)
return
0
;
if
(
!
p_read
)
return
0
;
/* Fill the buffer */
/* Fill the buffer */
if
(
p_sys
->
psz_xspf
==
NULL
)
if
(
Fill
(
s
)
)
{
return
-
1
;
int
i_ret
=
CreatePlaylist
(
s
,
&
p_sys
->
psz_xspf
);
if
(
i_ret
<
0
)
return
-
1
;
p_sys
->
i_len
=
strlen
(
p_sys
->
psz_xspf
);
p_sys
->
i_pos
=
0
;
}
/* Read the buffer */
/* Read the buffer */
int
i_len
=
__MIN
(
i_read
,
p_sys
->
i_len
-
p_sys
->
i_pos
);
int
i_len
=
__MIN
(
i_read
,
p_sys
->
i_len
-
p_sys
->
i_pos
);
...
@@ -280,15 +275,8 @@ static int Peek( stream_t *s, const uint8_t **pp_peek, unsigned int i_peek )
...
@@ -280,15 +275,8 @@ static int Peek( stream_t *s, const uint8_t **pp_peek, unsigned int i_peek )
stream_sys_t
*
p_sys
=
s
->
p_sys
;
stream_sys_t
*
p_sys
=
s
->
p_sys
;
/* Fill the buffer */
/* Fill the buffer */
if
(
p_sys
->
psz_xspf
==
NULL
)
if
(
Fill
(
s
)
)
{
return
-
1
;
int
i_ret
=
CreatePlaylist
(
s
,
&
p_sys
->
psz_xspf
);
if
(
i_ret
<
0
)
return
-
1
;
p_sys
->
i_len
=
strlen
(
p_sys
->
psz_xspf
);
p_sys
->
i_pos
=
0
;
}
/* Point to the buffer */
/* Point to the buffer */
int
i_len
=
__MIN
(
i_peek
,
p_sys
->
i_len
-
p_sys
->
i_pos
);
int
i_len
=
__MIN
(
i_peek
,
p_sys
->
i_len
-
p_sys
->
i_pos
);
...
@@ -347,11 +335,28 @@ static int Control( stream_t *s, int i_query, va_list args )
...
@@ -347,11 +335,28 @@ static int Control( stream_t *s, int i_query, va_list args )
}
}
}
}
static
int
Fill
(
stream_t
*
s
)
{
stream_sys_t
*
p_sys
=
s
->
p_sys
;
if
(
p_sys
->
psz_xspf
)
return
VLC_SUCCESS
;
if
(
CreatePlaylist
(
s
,
&
p_sys
->
psz_xspf
)
<
0
)
return
VLC_EGENERIC
;
p_sys
->
i_len
=
strlen
(
p_sys
->
psz_xspf
);
p_sys
->
i_pos
=
0
;
return
VLC_SUCCESS
;
}
static
int
CreatePlaylist
(
stream_t
*
s
,
char
**
pp_buffer
)
static
int
CreatePlaylist
(
stream_t
*
s
,
char
**
pp_buffer
)
{
{
stream_sys_t
*
p_sys
=
s
->
p_sys
;
/* Get some infos about zip archive */
/* Get some infos about zip archive */
int
i_ret
=
0
;
int
i_ret
=
0
;
unzFile
file
=
s
->
p_sys
->
zipFile
;
unzFile
file
=
p_sys
->
zipFile
;
vlc_array_t
*
p_filenames
=
vlc_array_new
();
/* Will contain char* */
vlc_array_t
*
p_filenames
=
vlc_array_new
();
/* Will contain char* */
/* List all file names in Zip archive */
/* List all file names in Zip archive */
...
@@ -365,10 +370,10 @@ static int CreatePlaylist( stream_t *s, char **pp_buffer )
...
@@ -365,10 +370,10 @@ static int CreatePlaylist( stream_t *s, char **pp_buffer )
/* Close archive */
/* Close archive */
unzClose
(
file
);
unzClose
(
file
);
s
->
p_sys
->
zipFile
=
NULL
;
p_sys
->
zipFile
=
NULL
;
/* Construct the xspf playlist */
/* Construct the xspf playlist */
i_ret
=
WriteXSPF
(
pp_buffer
,
p_filenames
,
s
->
p_sys
->
psz_path
);
i_ret
=
WriteXSPF
(
pp_buffer
,
p_filenames
,
p_sys
->
psz_path
);
if
(
i_ret
>
0
)
if
(
i_ret
>
0
)
i_ret
=
1
;
i_ret
=
1
;
else
if
(
i_ret
<
0
)
else
if
(
i_ret
<
0
)
...
...
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