MPD 0.20.6

- Main Page
- Namespaces
- Data Structures
- Files

- File List
- Globals

PlaylistPlugin.hxx
Go to the documentation of this file.
1 /*
2 * Copyright 2003-2017 The Music Player Daemon Project
3 * http://www.musicpd.org
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #ifndef MPD_PLAYLIST_PLUGIN_HXX
21 #define MPD_PLAYLIST_PLUGIN_HXX
22
23 #include "input/Ptr.hxx"
24
25 struct ConfigBlock;
26 struct Tag;
27 class Mutex;
28 class Cond;
29 class SongEnumerator;
30
31 struct playlist_plugin {
32 const char *name;
33
42 bool (*init)(const ConfigBlock &block);
43
48 void (*finish)();
49
54 SongEnumerator *(*open_uri)(const char *uri,
55 Mutex &mutex, Cond &cond);
56
65 SongEnumerator *(*open_stream)(InputStreamPtr &&is);
66
67 const char *const*schemes;
68 const char *const*suffixes;
69 const char *const*mime_types;
70 };
71
80 static inline bool
81 playlist_plugin_init(const struct playlist_plugin *plugin,
82 const ConfigBlock &block)
83 {
84 return plugin->init != nullptr
85 ? plugin->init(block)
86 : true;
87 }
88
92 static inline void
93 playlist_plugin_finish(const struct playlist_plugin *plugin)
94 {
95 if (plugin->finish != nullptr)
96 plugin->finish();
97 }
98
99 static inline SongEnumerator *
100 playlist_plugin_open_uri(const struct playlist_plugin *plugin, const char *uri,
101 Mutex &mutex, Cond &cond)
102 {
103 return plugin->open_uri(uri, mutex, cond);
104 }
105
106 static inline SongEnumerator *
107 playlist_plugin_open_stream(const struct playlist_plugin *plugin,
108 InputStreamPtr &&is)
109 {
110 return plugin->open_stream(std::move(is));
111 }
112
113 #endif
Tag
The meta information about a song file.
Definition: Tag.hxx:34
playlist_plugin_finish
static void playlist_plugin_finish(const struct playlist_plugin *plugin)
Deinitialize a plugin which was initialized successfully.
Definition: PlaylistPlugin.hxx:93
playlist_plugin_open_stream
static SongEnumerator * playlist_plugin_open_stream(const struct playlist_plugin *plugin, InputStreamPtr &&is)
Definition: PlaylistPlugin.hxx:107
playlist_plugin::open_stream
SongEnumerator *(* open_stream)(InputStreamPtr &&is)
Opens the playlist in the specified input stream.
Definition: PlaylistPlugin.hxx:65
playlist_plugin::open_uri
SongEnumerator *(* open_uri)(const char *uri, Mutex &mutex, Cond &cond)
Opens the playlist on the specified URI.
Definition: PlaylistPlugin.hxx:54
Cond
Definition: Cond.hxx:41
Mutex
Definition: Mutex.hxx:43
playlist_plugin_open_uri
static SongEnumerator * playlist_plugin_open_uri(const struct playlist_plugin *plugin, const char *uri, Mutex &mutex, Cond &cond)
Definition: PlaylistPlugin.hxx:100
playlist_plugin::init
bool(* init)(const ConfigBlock &block)
Initialize the plugin.
Definition: PlaylistPlugin.hxx:42
ConfigBlock
Definition: Block.hxx:57
Ptr.hxx
InputStreamPtr
std::unique_ptr< InputStream > InputStreamPtr
Definition: Ptr.hxx:25
playlist_plugin_init
static bool playlist_plugin_init(const struct playlist_plugin *plugin, const ConfigBlock &block)
Initialize a plugin.
Definition: PlaylistPlugin.hxx:81
playlist_plugin::mime_types
const char *const * mime_types
Definition: PlaylistPlugin.hxx:69
playlist_plugin
Definition: PlaylistPlugin.hxx:31
playlist_plugin::suffixes
const char *const * suffixes
Definition: PlaylistPlugin.hxx:68
playlist_plugin::schemes
const char *const * schemes
Definition: PlaylistPlugin.hxx:67
uri
const Storage const char * uri
Definition: DatabasePlaylist.hxx:31
playlist_plugin::name
const char * name
Definition: PlaylistPlugin.hxx:32
SongEnumerator
An object which provides serial access to a number of Song objects.
Definition: SongEnumerator.hxx:31
playlist_plugin::finish
void(* finish)()
Deinitialize a plugin which was initialized successfully.
Definition: PlaylistPlugin.hxx:48