OutputPlugin: rename struct audio_output_plugin to AudioOutputPlugin

This commit is contained in:
Max Kellermann 2014-01-28 11:22:27 +01:00
parent 2f873edc9c
commit e0dc721324
39 changed files with 53 additions and 50 deletions

View File

@ -35,7 +35,7 @@ struct mixer_plugin {
/** /**
* Alocates and configures a mixer device. * Alocates and configures a mixer device.
* *
* @param ao the pointer returned by audio_output_plugin.init * @param ao the pointer returned by AudioOutputPlugin.init
* @param param the configuration section * @param param the configuration section
* @param error_r location to store the error occurring, or * @param error_r location to store the error occurring, or
* nullptr to ignore errors * nullptr to ignore errors

View File

@ -46,7 +46,7 @@
#define AUDIO_OUTPUT_FORMAT "format" #define AUDIO_OUTPUT_FORMAT "format"
#define AUDIO_FILTERS "filters" #define AUDIO_FILTERS "filters"
static const struct audio_output_plugin * static const AudioOutputPlugin *
audio_output_detect(Error &error) audio_output_detect(Error &error)
{ {
LogDefault(output_domain, "Attempt to detect audio output device"); LogDefault(output_domain, "Attempt to detect audio output device");
@ -129,7 +129,7 @@ audio_output_load_mixer(struct audio_output *ao,
bool bool
ao_base_init(struct audio_output *ao, ao_base_init(struct audio_output *ao,
const struct audio_output_plugin *plugin, const AudioOutputPlugin *plugin,
const config_param &param, Error &error) const config_param &param, Error &error)
{ {
assert(ao != nullptr); assert(ao != nullptr);
@ -284,7 +284,7 @@ audio_output_new(const config_param &param,
PlayerControl &pc, PlayerControl &pc,
Error &error) Error &error)
{ {
const struct audio_output_plugin *plugin; const AudioOutputPlugin *plugin;
if (!param.IsNull()) { if (!param.IsNull()) {
const char *p; const char *p;
@ -296,7 +296,7 @@ audio_output_new(const config_param &param,
return nullptr; return nullptr;
} }
plugin = audio_output_plugin_get(p); plugin = AudioOutputPlugin_get(p);
if (plugin == nullptr) { if (plugin == nullptr) {
error.Format(config_domain, error.Format(config_domain,
"No such audio output plugin: %s", p); "No such audio output plugin: %s", p);

View File

@ -33,6 +33,7 @@ class Filter;
class MusicPipe; class MusicPipe;
struct config_param; struct config_param;
struct PlayerControl; struct PlayerControl;
struct AudioOutputPlugin;
enum audio_output_command { enum audio_output_command {
AO_COMMAND_NONE = 0, AO_COMMAND_NONE = 0,
@ -68,7 +69,7 @@ struct audio_output {
/** /**
* The plugin which implements this output device. * The plugin which implements this output device.
*/ */
const struct audio_output_plugin *plugin; const AudioOutputPlugin *plugin;
/** /**
* The #mixer object associated with this audio output device. * The #mixer object associated with this audio output device.
@ -289,7 +290,7 @@ audio_output_new(const config_param &param,
bool bool
ao_base_init(struct audio_output *ao, ao_base_init(struct audio_output *ao,
const struct audio_output_plugin *plugin, const AudioOutputPlugin *plugin,
const config_param &param, Error &error); const config_param &param, Error &error);
void void

View File

@ -39,7 +39,7 @@
#include <string.h> #include <string.h>
const struct audio_output_plugin *const audio_output_plugins[] = { const AudioOutputPlugin *const audio_output_plugins[] = {
#ifdef HAVE_SHOUT #ifdef HAVE_SHOUT
&shout_output_plugin, &shout_output_plugin,
#endif #endif
@ -89,8 +89,8 @@ const struct audio_output_plugin *const audio_output_plugins[] = {
nullptr nullptr
}; };
const struct audio_output_plugin * const AudioOutputPlugin *
audio_output_plugin_get(const char *name) AudioOutputPlugin_get(const char *name)
{ {
audio_output_plugins_for_each(plugin) audio_output_plugins_for_each(plugin)
if (strcmp(plugin->name, name) == 0) if (strcmp(plugin->name, name) == 0)

View File

@ -20,13 +20,15 @@
#ifndef MPD_OUTPUT_LIST_HXX #ifndef MPD_OUTPUT_LIST_HXX
#define MPD_OUTPUT_LIST_HXX #define MPD_OUTPUT_LIST_HXX
extern const struct audio_output_plugin *const audio_output_plugins[]; struct AudioOutputPlugin;
const struct audio_output_plugin * extern const AudioOutputPlugin *const audio_output_plugins[];
audio_output_plugin_get(const char *name);
const AudioOutputPlugin *
AudioOutputPlugin_get(const char *name);
#define audio_output_plugins_for_each(plugin) \ #define audio_output_plugins_for_each(plugin) \
for (const struct audio_output_plugin *plugin, \ for (const AudioOutputPlugin *plugin, \
*const*output_plugin_iterator = &audio_output_plugins[0]; \ *const*output_plugin_iterator = &audio_output_plugins[0]; \
(plugin = *output_plugin_iterator) != nullptr; ++output_plugin_iterator) (plugin = *output_plugin_iterator) != nullptr; ++output_plugin_iterator)

View File

@ -22,7 +22,7 @@
#include "OutputInternal.hxx" #include "OutputInternal.hxx"
struct audio_output * struct audio_output *
ao_plugin_init(const struct audio_output_plugin *plugin, ao_plugin_init(const AudioOutputPlugin *plugin,
const config_param &param, const config_param &param,
Error &error) Error &error)
{ {

View File

@ -32,7 +32,7 @@ class Error;
/** /**
* A plugin which controls an audio output device. * A plugin which controls an audio output device.
*/ */
struct audio_output_plugin { struct AudioOutputPlugin {
/** /**
* the plugin's name * the plugin's name
*/ */
@ -150,7 +150,7 @@ struct audio_output_plugin {
}; };
static inline bool static inline bool
ao_plugin_test_default_device(const struct audio_output_plugin *plugin) ao_plugin_test_default_device(const AudioOutputPlugin *plugin)
{ {
return plugin->test_default_device != nullptr return plugin->test_default_device != nullptr
? plugin->test_default_device() ? plugin->test_default_device()
@ -159,7 +159,7 @@ ao_plugin_test_default_device(const struct audio_output_plugin *plugin)
gcc_malloc gcc_malloc
struct audio_output * struct audio_output *
ao_plugin_init(const struct audio_output_plugin *plugin, ao_plugin_init(const AudioOutputPlugin *plugin,
const config_param &param, const config_param &param,
Error &error); Error &error);

View File

@ -848,7 +848,7 @@ alsa_play(struct audio_output *ao, const void *chunk, size_t size,
} }
} }
const struct audio_output_plugin alsa_output_plugin = { const struct AudioOutputPlugin alsa_output_plugin = {
"alsa", "alsa",
alsa_test_default_device, alsa_test_default_device,
alsa_init, alsa_init,

View File

@ -20,6 +20,6 @@
#ifndef MPD_ALSA_OUTPUT_PLUGIN_HXX #ifndef MPD_ALSA_OUTPUT_PLUGIN_HXX
#define MPD_ALSA_OUTPUT_PLUGIN_HXX #define MPD_ALSA_OUTPUT_PLUGIN_HXX
extern const struct audio_output_plugin alsa_output_plugin; extern const struct AudioOutputPlugin alsa_output_plugin;
#endif #endif

View File

@ -267,7 +267,7 @@ ao_output_play(struct audio_output *ao, const void *chunk, size_t size,
return size; return size;
} }
const struct audio_output_plugin ao_output_plugin = { const struct AudioOutputPlugin ao_output_plugin = {
"ao", "ao",
nullptr, nullptr,
ao_output_init, ao_output_init,

View File

@ -20,6 +20,6 @@
#ifndef MPD_AO_OUTPUT_PLUGIN_HXX #ifndef MPD_AO_OUTPUT_PLUGIN_HXX
#define MPD_AO_OUTPUT_PLUGIN_HXX #define MPD_AO_OUTPUT_PLUGIN_HXX
extern const struct audio_output_plugin ao_output_plugin; extern const struct AudioOutputPlugin ao_output_plugin;
#endif #endif

View File

@ -294,7 +294,7 @@ fifo_output_play(struct audio_output *ao, const void *chunk, size_t size,
} }
} }
const struct audio_output_plugin fifo_output_plugin = { const struct AudioOutputPlugin fifo_output_plugin = {
"fifo", "fifo",
nullptr, nullptr,
fifo_output_init, fifo_output_init,

View File

@ -20,6 +20,6 @@
#ifndef MPD_FIFO_OUTPUT_PLUGIN_HXX #ifndef MPD_FIFO_OUTPUT_PLUGIN_HXX
#define MPD_FIFO_OUTPUT_PLUGIN_HXX #define MPD_FIFO_OUTPUT_PLUGIN_HXX
extern const struct audio_output_plugin fifo_output_plugin; extern const struct AudioOutputPlugin fifo_output_plugin;
#endif #endif

View File

@ -582,7 +582,7 @@ httpd_output_cancel(struct audio_output *ao)
}); });
} }
const struct audio_output_plugin httpd_output_plugin = { const struct AudioOutputPlugin httpd_output_plugin = {
"httpd", "httpd",
nullptr, nullptr,
httpd_output_init, httpd_output_init,

View File

@ -20,6 +20,6 @@
#ifndef MPD_HTTPD_OUTPUT_PLUGIN_HXX #ifndef MPD_HTTPD_OUTPUT_PLUGIN_HXX
#define MPD_HTTPD_OUTPUT_PLUGIN_HXX #define MPD_HTTPD_OUTPUT_PLUGIN_HXX
extern const struct audio_output_plugin httpd_output_plugin; extern const struct AudioOutputPlugin httpd_output_plugin;
#endif #endif

View File

@ -746,7 +746,7 @@ mpd_jack_pause(struct audio_output *ao)
return true; return true;
} }
const struct audio_output_plugin jack_output_plugin = { const struct AudioOutputPlugin jack_output_plugin = {
"jack", "jack",
mpd_jack_test_default_device, mpd_jack_test_default_device,
mpd_jack_init, mpd_jack_init,

View File

@ -20,6 +20,6 @@
#ifndef MPD_JACK_OUTPUT_PLUGIN_HXX #ifndef MPD_JACK_OUTPUT_PLUGIN_HXX
#define MPD_JACK_OUTPUT_PLUGIN_HXX #define MPD_JACK_OUTPUT_PLUGIN_HXX
extern const struct audio_output_plugin jack_output_plugin; extern const struct AudioOutputPlugin jack_output_plugin;
#endif #endif

View File

@ -122,7 +122,7 @@ null_cancel(struct audio_output *ao)
nd->timer->Reset(); nd->timer->Reset();
} }
const struct audio_output_plugin null_output_plugin = { const struct AudioOutputPlugin null_output_plugin = {
"null", "null",
nullptr, nullptr,
null_init, null_init,

View File

@ -20,6 +20,6 @@
#ifndef MPD_NULL_OUTPUT_PLUGIN_HXX #ifndef MPD_NULL_OUTPUT_PLUGIN_HXX
#define MPD_NULL_OUTPUT_PLUGIN_HXX #define MPD_NULL_OUTPUT_PLUGIN_HXX
extern const struct audio_output_plugin null_output_plugin; extern const struct AudioOutputPlugin null_output_plugin;
#endif #endif

View File

@ -409,7 +409,7 @@ osx_output_play(struct audio_output *ao, const void *chunk, size_t size,
return size; return size;
} }
const struct audio_output_plugin osx_output_plugin = { const struct AudioOutputPlugin osx_output_plugin = {
"osx", "osx",
osx_output_test_default_device, osx_output_test_default_device,
osx_output_init, osx_output_init,

View File

@ -20,6 +20,6 @@
#ifndef MPD_OSX_OUTPUT_PLUGIN_HXX #ifndef MPD_OSX_OUTPUT_PLUGIN_HXX
#define MPD_OSX_OUTPUT_PLUGIN_HXX #define MPD_OSX_OUTPUT_PLUGIN_HXX
extern const struct audio_output_plugin osx_output_plugin; extern const struct AudioOutputPlugin osx_output_plugin;
#endif #endif

View File

@ -266,7 +266,7 @@ openal_cancel(struct audio_output *ao)
od->filled = 0; od->filled = 0;
} }
const struct audio_output_plugin openal_output_plugin = { const struct AudioOutputPlugin openal_output_plugin = {
"openal", "openal",
nullptr, nullptr,
openal_init, openal_init,

View File

@ -20,6 +20,6 @@
#ifndef MPD_OPENAL_OUTPUT_PLUGIN_HXX #ifndef MPD_OPENAL_OUTPUT_PLUGIN_HXX
#define MPD_OPENAL_OUTPUT_PLUGIN_HXX #define MPD_OPENAL_OUTPUT_PLUGIN_HXX
extern const struct audio_output_plugin openal_output_plugin; extern const struct AudioOutputPlugin openal_output_plugin;
#endif #endif

View File

@ -751,7 +751,7 @@ oss_output_play(struct audio_output *ao, const void *chunk, size_t size,
} }
} }
const struct audio_output_plugin oss_output_plugin = { const struct AudioOutputPlugin oss_output_plugin = {
"oss", "oss",
oss_output_test_default_device, oss_output_test_default_device,
oss_output_init, oss_output_init,

View File

@ -20,6 +20,6 @@
#ifndef MPD_OSS_OUTPUT_PLUGIN_HXX #ifndef MPD_OSS_OUTPUT_PLUGIN_HXX
#define MPD_OSS_OUTPUT_PLUGIN_HXX #define MPD_OSS_OUTPUT_PLUGIN_HXX
extern const struct audio_output_plugin oss_output_plugin; extern const struct AudioOutputPlugin oss_output_plugin;
#endif #endif

View File

@ -128,7 +128,7 @@ pipe_output_play(struct audio_output *ao, const void *chunk, size_t size,
return ret; return ret;
} }
const struct audio_output_plugin pipe_output_plugin = { const struct AudioOutputPlugin pipe_output_plugin = {
"pipe", "pipe",
nullptr, nullptr,
pipe_output_init, pipe_output_init,

View File

@ -20,6 +20,6 @@
#ifndef MPD_PIPE_OUTPUT_PLUGIN_HXX #ifndef MPD_PIPE_OUTPUT_PLUGIN_HXX
#define MPD_PIPE_OUTPUT_PLUGIN_HXX #define MPD_PIPE_OUTPUT_PLUGIN_HXX
extern const struct audio_output_plugin pipe_output_plugin; extern const struct AudioOutputPlugin pipe_output_plugin;
#endif #endif

View File

@ -869,7 +869,7 @@ pulse_output_test_default_device(void)
return success; return success;
} }
const struct audio_output_plugin pulse_output_plugin = { const struct AudioOutputPlugin pulse_output_plugin = {
"pulse", "pulse",
pulse_output_test_default_device, pulse_output_test_default_device,
pulse_output_init, pulse_output_init,

View File

@ -25,7 +25,7 @@ struct PulseMixer;
struct pa_cvolume; struct pa_cvolume;
class Error; class Error;
extern const struct audio_output_plugin pulse_output_plugin; extern const struct AudioOutputPlugin pulse_output_plugin;
void void
pulse_output_lock(PulseOutput *po); pulse_output_lock(PulseOutput *po);

View File

@ -243,7 +243,7 @@ recorder_output_play(struct audio_output *ao, const void *chunk, size_t size,
? size : 0; ? size : 0;
} }
const struct audio_output_plugin recorder_output_plugin = { const struct AudioOutputPlugin recorder_output_plugin = {
"recorder", "recorder",
nullptr, nullptr,
recorder_output_init, recorder_output_init,

View File

@ -20,6 +20,6 @@
#ifndef MPD_RECORDER_OUTPUT_PLUGIN_HXX #ifndef MPD_RECORDER_OUTPUT_PLUGIN_HXX
#define MPD_RECORDER_OUTPUT_PLUGIN_HXX #define MPD_RECORDER_OUTPUT_PLUGIN_HXX
extern const struct audio_output_plugin recorder_output_plugin; extern const struct AudioOutputPlugin recorder_output_plugin;
#endif #endif

View File

@ -409,7 +409,7 @@ roar_send_tag(struct audio_output *ao, const Tag *meta)
self->SendTag(*meta); self->SendTag(*meta);
} }
const struct audio_output_plugin roar_output_plugin = { const struct AudioOutputPlugin roar_output_plugin = {
"roar", "roar",
nullptr, nullptr,
roar_init, roar_init,

View File

@ -22,7 +22,7 @@
class RoarOutput; class RoarOutput;
extern const struct audio_output_plugin roar_output_plugin; extern const struct AudioOutputPlugin roar_output_plugin;
int int
roar_output_get_volume(RoarOutput *roar); roar_output_get_volume(RoarOutput *roar);

View File

@ -525,7 +525,7 @@ static void my_shout_set_tag(struct audio_output *ao,
write_page(sd, IgnoreError()); write_page(sd, IgnoreError());
} }
const struct audio_output_plugin shout_output_plugin = { const struct AudioOutputPlugin shout_output_plugin = {
"shout", "shout",
nullptr, nullptr,
my_shout_init_driver, my_shout_init_driver,

View File

@ -20,6 +20,6 @@
#ifndef MPD_SHOUT_OUTPUT_PLUGIN_HXX #ifndef MPD_SHOUT_OUTPUT_PLUGIN_HXX
#define MPD_SHOUT_OUTPUT_PLUGIN_HXX #define MPD_SHOUT_OUTPUT_PLUGIN_HXX
extern const struct audio_output_plugin shout_output_plugin; extern const struct AudioOutputPlugin shout_output_plugin;
#endif #endif

View File

@ -182,7 +182,7 @@ solaris_output_cancel(struct audio_output *ao)
ioctl(so->fd, I_FLUSH); ioctl(so->fd, I_FLUSH);
} }
const struct audio_output_plugin solaris_output_plugin = { const struct AudioOutputPlugin solaris_output_plugin = {
"solaris", "solaris",
solaris_output_test_default_device, solaris_output_test_default_device,
solaris_output_init, solaris_output_init,

View File

@ -20,6 +20,6 @@
#ifndef MPD_SOLARIS_OUTPUT_PLUGIN_HXX #ifndef MPD_SOLARIS_OUTPUT_PLUGIN_HXX
#define MPD_SOLARIS_OUTPUT_PLUGIN_HXX #define MPD_SOLARIS_OUTPUT_PLUGIN_HXX
extern const struct audio_output_plugin solaris_output_plugin; extern const struct AudioOutputPlugin solaris_output_plugin;
#endif #endif

View File

@ -334,7 +334,7 @@ winmm_output_cancel(struct audio_output *ao)
winmm_stop(wo); winmm_stop(wo);
} }
const struct audio_output_plugin winmm_output_plugin = { const struct AudioOutputPlugin winmm_output_plugin = {
"winmm", "winmm",
winmm_output_test_default_device, winmm_output_test_default_device,
winmm_output_init, winmm_output_init,

View File

@ -31,7 +31,7 @@
struct WinmmOutput; struct WinmmOutput;
extern const struct audio_output_plugin winmm_output_plugin; extern const struct AudioOutputPlugin winmm_output_plugin;
gcc_pure gcc_pure
HWAVEOUT HWAVEOUT