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
f885e068
Commit
f885e068
authored
Sep 01, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playlist/Plugin: add constructors
parent
0d16772d
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
80 additions
and
129 deletions
+80
-129
PlaylistPlugin.hxx
src/playlist/PlaylistPlugin.hxx
+42
-7
AsxPlaylistPlugin.cxx
src/playlist/plugins/AsxPlaylistPlugin.cxx
+4
-12
CuePlaylistPlugin.cxx
src/playlist/plugins/CuePlaylistPlugin.cxx
+4
-12
EmbeddedCuePlaylistPlugin.cxx
src/playlist/plugins/EmbeddedCuePlaylistPlugin.cxx
+3
-12
ExtM3uPlaylistPlugin.cxx
src/playlist/plugins/ExtM3uPlaylistPlugin.cxx
+4
-12
FlacPlaylistPlugin.cxx
src/playlist/plugins/FlacPlaylistPlugin.cxx
+3
-12
M3uPlaylistPlugin.cxx
src/playlist/plugins/M3uPlaylistPlugin.cxx
+4
-12
PlsPlaylistPlugin.cxx
src/playlist/plugins/PlsPlaylistPlugin.cxx
+4
-12
RssPlaylistPlugin.cxx
src/playlist/plugins/RssPlaylistPlugin.cxx
+4
-12
SoundCloudPlaylistPlugin.cxx
src/playlist/plugins/SoundCloudPlaylistPlugin.cxx
+4
-14
XspfPlaylistPlugin.cxx
src/playlist/plugins/XspfPlaylistPlugin.cxx
+4
-12
No files found.
src/playlist/PlaylistPlugin.hxx
View file @
f885e068
...
...
@@ -38,20 +38,20 @@ struct PlaylistPlugin {
* @return true if the plugin was initialized successfully,
* false if the plugin is not available
*/
bool
(
*
init
)(
const
ConfigBlock
&
block
);
bool
(
*
init
)(
const
ConfigBlock
&
block
)
=
nullptr
;
/**
* Deinitialize a plugin which was initialized successfully.
* Optional method.
*/
void
(
*
finish
)();
void
(
*
finish
)()
=
nullptr
;
/**
* Opens the playlist on the specified URI. This URI has
* either matched one of the schemes or one of the suffixes.
*/
std
::
unique_ptr
<
SongEnumerator
>
(
*
open_uri
)(
const
char
*
uri
,
Mutex
&
mutex
);
Mutex
&
mutex
)
=
nullptr
;
/**
* Opens the playlist in the specified input stream. It has
...
...
@@ -61,11 +61,46 @@ struct PlaylistPlugin {
* @parm is the input stream; the pointer will not be
* invalidated when the function returns nullptr
*/
std
::
unique_ptr
<
SongEnumerator
>
(
*
open_stream
)(
InputStreamPtr
&&
is
);
std
::
unique_ptr
<
SongEnumerator
>
(
*
open_stream
)(
InputStreamPtr
&&
is
)
=
nullptr
;
const
char
*
const
*
schemes
;
const
char
*
const
*
suffixes
;
const
char
*
const
*
mime_types
;
const
char
*
const
*
schemes
=
nullptr
;
const
char
*
const
*
suffixes
=
nullptr
;
const
char
*
const
*
mime_types
=
nullptr
;
constexpr
PlaylistPlugin
(
const
char
*
_name
,
std
::
unique_ptr
<
SongEnumerator
>
(
*
_open_uri
)(
const
char
*
uri
,
Mutex
&
mutex
))
noexcept
:
name
(
_name
),
open_uri
(
_open_uri
)
{}
constexpr
PlaylistPlugin
(
const
char
*
_name
,
std
::
unique_ptr
<
SongEnumerator
>
(
*
_open_stream
)(
InputStreamPtr
&&
is
))
noexcept
:
name
(
_name
),
open_stream
(
_open_stream
)
{}
constexpr
auto
WithInit
(
bool
(
*
_init
)(
const
ConfigBlock
&
block
),
void
(
*
_finish
)()
noexcept
=
nullptr
)
noexcept
{
auto
copy
=
*
this
;
copy
.
init
=
_init
;
copy
.
finish
=
_finish
;
return
copy
;
}
constexpr
auto
WithSchemes
(
const
char
*
const
*
_schemes
)
noexcept
{
auto
copy
=
*
this
;
copy
.
schemes
=
_schemes
;
return
copy
;
}
constexpr
auto
WithSuffixes
(
const
char
*
const
*
_suffixes
)
noexcept
{
auto
copy
=
*
this
;
copy
.
suffixes
=
_suffixes
;
return
copy
;
}
constexpr
auto
WithMimeTypes
(
const
char
*
const
*
_mime_types
)
noexcept
{
auto
copy
=
*
this
;
copy
.
mime_types
=
_mime_types
;
return
copy
;
}
};
/**
...
...
src/playlist/plugins/AsxPlaylistPlugin.cxx
View file @
f885e068
...
...
@@ -166,15 +166,7 @@ static const char *const asx_mime_types[] = {
nullptr
};
const
PlaylistPlugin
asx_playlist_plugin
=
{
"asx"
,
nullptr
,
nullptr
,
nullptr
,
asx_open_stream
,
nullptr
,
asx_suffixes
,
asx_mime_types
,
};
const
PlaylistPlugin
asx_playlist_plugin
=
PlaylistPlugin
(
"asx"
,
asx_open_stream
)
.
WithSuffixes
(
asx_suffixes
)
.
WithMimeTypes
(
asx_mime_types
);
src/playlist/plugins/CuePlaylistPlugin.cxx
View file @
f885e068
...
...
@@ -70,15 +70,7 @@ static const char *const cue_playlist_mime_types[] = {
nullptr
};
const
PlaylistPlugin
cue_playlist_plugin
=
{
"cue"
,
nullptr
,
nullptr
,
nullptr
,
cue_playlist_open_stream
,
nullptr
,
cue_playlist_suffixes
,
cue_playlist_mime_types
,
};
const
PlaylistPlugin
cue_playlist_plugin
=
PlaylistPlugin
(
"cue"
,
cue_playlist_open_stream
)
.
WithSuffixes
(
cue_playlist_suffixes
)
.
WithMimeTypes
(
cue_playlist_mime_types
);
src/playlist/plugins/EmbeddedCuePlaylistPlugin.cxx
View file @
f885e068
...
...
@@ -159,15 +159,6 @@ static const char *const embcue_playlist_suffixes[] = {
nullptr
};
const
PlaylistPlugin
embcue_playlist_plugin
=
{
"embcue"
,
nullptr
,
nullptr
,
embcue_playlist_open_uri
,
nullptr
,
nullptr
,
embcue_playlist_suffixes
,
nullptr
,
};
const
PlaylistPlugin
embcue_playlist_plugin
=
PlaylistPlugin
(
"embcue"
,
embcue_playlist_open_uri
)
.
WithSuffixes
(
embcue_playlist_suffixes
);
src/playlist/plugins/ExtM3uPlaylistPlugin.cxx
View file @
f885e068
...
...
@@ -147,15 +147,7 @@ static const char *const extm3u_mime_types[] = {
nullptr
};
const
PlaylistPlugin
extm3u_playlist_plugin
=
{
"extm3u"
,
nullptr
,
nullptr
,
nullptr
,
extm3u_open_stream
,
nullptr
,
extm3u_suffixes
,
extm3u_mime_types
,
};
const
PlaylistPlugin
extm3u_playlist_plugin
=
PlaylistPlugin
(
"extm3u"
,
extm3u_open_stream
)
.
WithSuffixes
(
extm3u_suffixes
)
.
WithMimeTypes
(
extm3u_mime_types
);
src/playlist/plugins/FlacPlaylistPlugin.cxx
View file @
f885e068
...
...
@@ -103,15 +103,6 @@ static const char *const flac_playlist_suffixes[] = {
nullptr
};
const
PlaylistPlugin
flac_playlist_plugin
=
{
"flac"
,
nullptr
,
nullptr
,
nullptr
,
flac_playlist_open_stream
,
nullptr
,
flac_playlist_suffixes
,
nullptr
,
};
const
PlaylistPlugin
flac_playlist_plugin
=
PlaylistPlugin
(
"flac"
,
flac_playlist_open_stream
)
.
WithSuffixes
(
flac_playlist_suffixes
);
src/playlist/plugins/M3uPlaylistPlugin.cxx
View file @
f885e068
...
...
@@ -69,15 +69,7 @@ static const char *const m3u_mime_types[] = {
nullptr
};
const
PlaylistPlugin
m3u_playlist_plugin
=
{
"m3u"
,
nullptr
,
nullptr
,
nullptr
,
m3u_open_stream
,
nullptr
,
m3u_suffixes
,
m3u_mime_types
,
};
const
PlaylistPlugin
m3u_playlist_plugin
=
PlaylistPlugin
(
"m3u"
,
m3u_open_stream
)
.
WithSuffixes
(
m3u_suffixes
)
.
WithMimeTypes
(
m3u_mime_types
);
src/playlist/plugins/PlsPlaylistPlugin.cxx
View file @
f885e068
...
...
@@ -172,15 +172,7 @@ static const char *const pls_mime_types[] = {
nullptr
};
const
PlaylistPlugin
pls_playlist_plugin
=
{
"pls"
,
nullptr
,
nullptr
,
nullptr
,
pls_open_stream
,
nullptr
,
pls_suffixes
,
pls_mime_types
,
};
const
PlaylistPlugin
pls_playlist_plugin
=
PlaylistPlugin
(
"pls"
,
pls_open_stream
)
.
WithSuffixes
(
pls_suffixes
)
.
WithMimeTypes
(
pls_mime_types
);
src/playlist/plugins/RssPlaylistPlugin.cxx
View file @
f885e068
...
...
@@ -165,15 +165,7 @@ static const char *const rss_mime_types[] = {
nullptr
};
const
PlaylistPlugin
rss_playlist_plugin
=
{
"rss"
,
nullptr
,
nullptr
,
nullptr
,
rss_open_stream
,
nullptr
,
rss_suffixes
,
rss_mime_types
,
};
const
PlaylistPlugin
rss_playlist_plugin
=
PlaylistPlugin
(
"rss"
,
rss_open_stream
)
.
WithSuffixes
(
rss_suffixes
)
.
WithMimeTypes
(
rss_mime_types
);
src/playlist/plugins/SoundCloudPlaylistPlugin.cxx
View file @
f885e068
...
...
@@ -288,17 +288,7 @@ static const char *const soundcloud_schemes[] = {
nullptr
};
const
PlaylistPlugin
soundcloud_playlist_plugin
=
{
"soundcloud"
,
soundcloud_init
,
nullptr
,
soundcloud_open_uri
,
nullptr
,
soundcloud_schemes
,
nullptr
,
nullptr
,
};
const
PlaylistPlugin
soundcloud_playlist_plugin
=
PlaylistPlugin
(
"soundcloud"
,
soundcloud_open_uri
)
.
WithInit
(
soundcloud_init
)
.
WithSchemes
(
soundcloud_schemes
);
src/playlist/plugins/XspfPlaylistPlugin.cxx
View file @
f885e068
...
...
@@ -211,15 +211,7 @@ static const char *const xspf_mime_types[] = {
nullptr
};
const
PlaylistPlugin
xspf_playlist_plugin
=
{
"xspf"
,
nullptr
,
nullptr
,
nullptr
,
xspf_open_stream
,
nullptr
,
xspf_suffixes
,
xspf_mime_types
,
};
const
PlaylistPlugin
xspf_playlist_plugin
=
PlaylistPlugin
(
"xspf"
,
xspf_open_stream
)
.
WithSuffixes
(
xspf_suffixes
)
.
WithMimeTypes
(
xspf_mime_types
);
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