Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
0c461c38
Commit
0c461c38
authored
Oct 02, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input/archive: export function OpenArchiveInputStream()
parent
0d38bd9b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
16 deletions
+33
-16
ArchiveInputPlugin.cxx
src/input/plugins/ArchiveInputPlugin.cxx
+24
-16
ArchiveInputPlugin.hxx
src/input/plugins/ArchiveInputPlugin.hxx
+9
-0
No files found.
src/input/plugins/ArchiveInputPlugin.cxx
View file @
0c461c38
...
@@ -32,26 +32,13 @@
...
@@ -32,26 +32,13 @@
#include <stdlib.h>
#include <stdlib.h>
/**
InputStream
*
* select correct archive plugin to handle the input stream
OpenArchiveInputStream
(
Path
path
,
Mutex
&
mutex
,
Cond
&
cond
,
Error
&
error
)
* may allow stacking of archive plugins. for example for handling
* tar.gz a gzip handler opens file (through inputfile stream)
* then it opens a tar handler and sets gzip inputstream as
* parent_stream so tar plugin fetches file data from gzip
* plugin and gzip fetches file from disk
*/
static
InputStream
*
input_archive_open
(
const
char
*
pathname
,
Mutex
&
mutex
,
Cond
&
cond
,
Error
&
error
)
{
{
const
ArchivePlugin
*
arplug
;
const
ArchivePlugin
*
arplug
;
InputStream
*
is
;
InputStream
*
is
;
if
(
!
PathTraitsFS
::
IsAbsolute
(
pathname
))
char
*
pname
=
strdup
(
path
.
c_str
());
return
nullptr
;
char
*
pname
=
strdup
(
pathname
);
// archive_lookup will modify pname when true is returned
// archive_lookup will modify pname when true is returned
const
char
*
archive
,
*
filename
,
*
suffix
;
const
char
*
archive
,
*
filename
,
*
suffix
;
if
(
!
archive_lookup
(
pname
,
&
archive
,
&
filename
,
&
suffix
))
{
if
(
!
archive_lookup
(
pname
,
&
archive
,
&
filename
,
&
suffix
))
{
...
@@ -84,6 +71,27 @@ input_archive_open(const char *pathname,
...
@@ -84,6 +71,27 @@ input_archive_open(const char *pathname,
return
is
;
return
is
;
}
}
/**
* select correct archive plugin to handle the input stream
* may allow stacking of archive plugins. for example for handling
* tar.gz a gzip handler opens file (through inputfile stream)
* then it opens a tar handler and sets gzip inputstream as
* parent_stream so tar plugin fetches file data from gzip
* plugin and gzip fetches file from disk
*/
static
InputStream
*
input_archive_open
(
const
char
*
pathname
,
Mutex
&
mutex
,
Cond
&
cond
,
Error
&
error
)
{
if
(
!
PathTraitsFS
::
IsAbsolute
(
pathname
))
return
nullptr
;
/* TODO: the parameter is UTF-8, not filesystem charset */
return
OpenArchiveInputStream
(
Path
::
FromFS
(
pathname
),
mutex
,
cond
,
error
);
}
const
InputPlugin
input_plugin_archive
=
{
const
InputPlugin
input_plugin_archive
=
{
"archive"
,
"archive"
,
nullptr
,
nullptr
,
...
...
src/input/plugins/ArchiveInputPlugin.hxx
View file @
0c461c38
...
@@ -20,6 +20,15 @@
...
@@ -20,6 +20,15 @@
#ifndef MPD_INPUT_ARCHIVE_HXX
#ifndef MPD_INPUT_ARCHIVE_HXX
#define MPD_INPUT_ARCHIVE_HXX
#define MPD_INPUT_ARCHIVE_HXX
class
InputStream
;
class
Path
;
class
Mutex
;
class
Cond
;
class
Error
;
extern
const
struct
InputPlugin
input_plugin_archive
;
extern
const
struct
InputPlugin
input_plugin_archive
;
InputStream
*
OpenArchiveInputStream
(
Path
path
,
Mutex
&
mutex
,
Cond
&
cond
,
Error
&
error
);
#endif
#endif
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