MPD 0.20.6

- Main Page
- Namespaces
- Data Structures
- Files

- File List
- Globals

OutputPlugin.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_OUTPUT_PLUGIN_HXX
21 #define MPD_OUTPUT_PLUGIN_HXX
22
23 #include "Compiler.h"
24
25 #include <chrono>
26
27 #include <stddef.h>
28
29 struct ConfigBlock;
30 struct AudioFormat;
31 struct Tag;
32 struct AudioOutput;
33 struct MixerPlugin;
34
38 struct AudioOutputPlugin {
42 const char *name;
43
48 bool (*test_default_device)();
49
59 AudioOutput *(*init)(const ConfigBlock &block);
60
64 void (*finish)(AudioOutput *data);
65
72 void (*enable)(AudioOutput *data);
73
78 void (*disable)(AudioOutput *data);
79
88 void (*open)(AudioOutput *data, AudioFormat &audio_format);
89
93 void (*close)(AudioOutput *data);
94
104 std::chrono::steady_clock::duration (*delay)(AudioOutput *data);
105
110 void (*send_tag)(AudioOutput *data, const Tag &tag);
111
119 size_t (*play)(AudioOutput *data,
120 const void *chunk, size_t size);
121
125 void (*drain)(AudioOutput *data);
126
131 void (*cancel)(AudioOutput *data);
132
144 bool (*pause)(AudioOutput *data);
145
152 const MixerPlugin *mixer_plugin;
153 };
154
155 static inline bool
156 ao_plugin_test_default_device(const AudioOutputPlugin *plugin)
157 {
158 return plugin->test_default_device != nullptr
159 ? plugin->test_default_device()
160 : false;
161 }
162
163 gcc_malloc
164 AudioOutput *
165 ao_plugin_init(const AudioOutputPlugin *plugin,
166 const ConfigBlock &block);
167
168 void
169 ao_plugin_finish(AudioOutput *ao);
170
171 void
172 ao_plugin_enable(AudioOutput *ao);
173
174 void
175 ao_plugin_disable(AudioOutput *ao);
176
177 void
178 ao_plugin_open(AudioOutput *ao, AudioFormat &audio_format);
179
180 void
181 ao_plugin_close(AudioOutput *ao);
182
183 gcc_pure
184 std::chrono::steady_clock::duration
185 ao_plugin_delay(AudioOutput *ao);
186
187 void
188 ao_plugin_send_tag(AudioOutput *ao, const Tag &tag);
189
190 size_t
191 ao_plugin_play(AudioOutput *ao, const void *chunk, size_t size);
192
193 void
194 ao_plugin_drain(AudioOutput *ao);
195
196 void
197 ao_plugin_cancel(AudioOutput *ao);
198
199 bool
200 ao_plugin_pause(AudioOutput *ao);
201
202 #endif
ao_plugin_disable
void ao_plugin_disable(AudioOutput *ao)
AudioOutputPlugin::enable
void(* enable)(AudioOutput *data)
Enable the device.
Definition: OutputPlugin.hxx:72
ao_plugin_delay
gcc_pure std::chrono::steady_clock::duration ao_plugin_delay(AudioOutput *ao)
AudioOutputPlugin::close
void(* close)(AudioOutput *data)
Close the device.
Definition: OutputPlugin.hxx:93
AudioFormat
This structure describes the format of a raw PCM stream.
Definition: AudioFormat.hxx:37
AudioOutputPlugin::test_default_device
bool(* test_default_device)()
Test if this plugin can provide a default output, in case none has been configured.
Definition: OutputPlugin.hxx:48
AudioOutputPlugin::play
size_t(* play)(AudioOutput *data, const void *chunk, size_t size)
Play a chunk of audio data.
Definition: OutputPlugin.hxx:119
AudioOutput
Definition: Internal.hxx:45
Tag
The meta information about a song file.
Definition: Tag.hxx:34
AudioOutputPlugin::open
void(* open)(AudioOutput *data, AudioFormat &audio_format)
Really open the device.
Definition: OutputPlugin.hxx:88
gcc_malloc
#define gcc_malloc
Definition: Compiler.h:112
ao_plugin_drain
void ao_plugin_drain(AudioOutput *ao)
AudioOutputPlugin::name
const char * name
the plugin's name
Definition: OutputPlugin.hxx:42
ao_plugin_send_tag
void ao_plugin_send_tag(AudioOutput *ao, const Tag &tag)
AudioOutputPlugin::finish
void(* finish)(AudioOutput *data)
Free resources allocated by this device.
Definition: OutputPlugin.hxx:64
MixerPlugin
Definition: MixerPlugin.hxx:36
ao_plugin_test_default_device
static bool ao_plugin_test_default_device(const AudioOutputPlugin *plugin)
Definition: OutputPlugin.hxx:156
ao_plugin_finish
void ao_plugin_finish(AudioOutput *ao)
AudioOutputPlugin::cancel
void(* cancel)(AudioOutput *data)
Try to cancel data which may still be in the device's buffers.
Definition: OutputPlugin.hxx:131
ao_plugin_cancel
void ao_plugin_cancel(AudioOutput *ao)
ConfigBlock
Definition: Block.hxx:57
AudioOutputPlugin::delay
std::chrono::steady_clock::duration(* delay)(AudioOutput *data)
Returns a positive number if the output thread shall further delay the next call to play() or pause()...
Definition: OutputPlugin.hxx:104
ao_plugin_enable
void ao_plugin_enable(AudioOutput *ao)
Compiler.h
AudioOutputPlugin::pause
bool(* pause)(AudioOutput *data)
Pause the device.
Definition: OutputPlugin.hxx:144
AudioOutputPlugin::drain
void(* drain)(AudioOutput *data)
Wait until the device has finished playing.
Definition: OutputPlugin.hxx:125
ao_plugin_close
void ao_plugin_close(AudioOutput *ao)
ao_plugin_open
void ao_plugin_open(AudioOutput *ao, AudioFormat &audio_format)
AudioOutputPlugin::send_tag
void(* send_tag)(AudioOutput *data, const Tag &tag)
Display metadata for the next chunk.
Definition: OutputPlugin.hxx:110
AudioOutputPlugin::mixer_plugin
const MixerPlugin * mixer_plugin
The mixer plugin associated with this output plugin.
Definition: OutputPlugin.hxx:152
ao_plugin_play
size_t ao_plugin_play(AudioOutput *ao, const void *chunk, size_t size)
ao_plugin_init
gcc_malloc AudioOutput * ao_plugin_init(const AudioOutputPlugin *plugin, const ConfigBlock &block)
ao_plugin_pause
bool ao_plugin_pause(AudioOutput *ao)
AudioOutputPlugin::disable
void(* disable)(AudioOutput *data)
Disables the device.
Definition: OutputPlugin.hxx:78
gcc_pure
#define gcc_pure
Definition: Compiler.h:116
AudioOutputPlugin
A plugin which controls an audio output device.
Definition: OutputPlugin.hxx:38