output/null: convert to C++
This commit is contained in:
parent
e6b04d1b50
commit
7bb5a960fd
@ -790,8 +790,8 @@ OUTPUT_API_SRC = \
|
||||
src/OutputInit.cxx
|
||||
|
||||
liboutput_plugins_a_SOURCES = \
|
||||
src/output/null_output_plugin.h \
|
||||
src/output/null_output_plugin.c
|
||||
src/output/NullOutputPlugin.cxx \
|
||||
src/output/NullOutputPlugin.hxx
|
||||
|
||||
MIXER_LIBS = \
|
||||
libmixer_plugins.a \
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "output/HttpdOutputPlugin.hxx"
|
||||
#include "output/jack_output_plugin.h"
|
||||
#include "output/mvp_output_plugin.h"
|
||||
#include "output/null_output_plugin.h"
|
||||
#include "output/NullOutputPlugin.hxx"
|
||||
#include "output/openal_output_plugin.h"
|
||||
#include "output/OssOutputPlugin.hxx"
|
||||
#include "output/OSXOutputPlugin.hxx"
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2003-2011 The Music Player Daemon Project
|
||||
* Copyright (C) 2003-2013 The Music Player Daemon Project
|
||||
* http://www.musicpd.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "null_output_plugin.h"
|
||||
#include "NullOutputPlugin.hxx"
|
||||
#include "output_api.h"
|
||||
#include "timer.h"
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
struct null_data {
|
||||
struct NullOutput {
|
||||
struct audio_output base;
|
||||
|
||||
bool sync;
|
||||
@ -37,7 +37,7 @@ struct null_data {
|
||||
static struct audio_output *
|
||||
null_init(const struct config_param *param, GError **error_r)
|
||||
{
|
||||
struct null_data *nd = g_new(struct null_data, 1);
|
||||
NullOutput *nd = g_new(NullOutput, 1);
|
||||
|
||||
if (!ao_base_init(&nd->base, &null_output_plugin, param, error_r)) {
|
||||
g_free(nd);
|
||||
@ -52,7 +52,7 @@ null_init(const struct config_param *param, GError **error_r)
|
||||
static void
|
||||
null_finish(struct audio_output *ao)
|
||||
{
|
||||
struct null_data *nd = (struct null_data *)ao;
|
||||
NullOutput *nd = (NullOutput *)ao;
|
||||
|
||||
ao_base_finish(&nd->base);
|
||||
g_free(nd);
|
||||
@ -62,7 +62,7 @@ static bool
|
||||
null_open(struct audio_output *ao, struct audio_format *audio_format,
|
||||
G_GNUC_UNUSED GError **error)
|
||||
{
|
||||
struct null_data *nd = (struct null_data *)ao;
|
||||
NullOutput *nd = (NullOutput *)ao;
|
||||
|
||||
if (nd->sync)
|
||||
nd->timer = timer_new(audio_format);
|
||||
@ -73,7 +73,7 @@ null_open(struct audio_output *ao, struct audio_format *audio_format,
|
||||
static void
|
||||
null_close(struct audio_output *ao)
|
||||
{
|
||||
struct null_data *nd = (struct null_data *)ao;
|
||||
NullOutput *nd = (NullOutput *)ao;
|
||||
|
||||
if (nd->sync)
|
||||
timer_free(nd->timer);
|
||||
@ -82,7 +82,7 @@ null_close(struct audio_output *ao)
|
||||
static unsigned
|
||||
null_delay(struct audio_output *ao)
|
||||
{
|
||||
struct null_data *nd = (struct null_data *)ao;
|
||||
NullOutput *nd = (NullOutput *)ao;
|
||||
|
||||
return nd->sync && nd->timer->started
|
||||
? timer_delay(nd->timer)
|
||||
@ -93,7 +93,7 @@ static size_t
|
||||
null_play(struct audio_output *ao, G_GNUC_UNUSED const void *chunk, size_t size,
|
||||
G_GNUC_UNUSED GError **error)
|
||||
{
|
||||
struct null_data *nd = (struct null_data *)ao;
|
||||
NullOutput *nd = (NullOutput *)ao;
|
||||
struct timer *timer = nd->timer;
|
||||
|
||||
if (!nd->sync)
|
||||
@ -109,7 +109,7 @@ null_play(struct audio_output *ao, G_GNUC_UNUSED const void *chunk, size_t size,
|
||||
static void
|
||||
null_cancel(struct audio_output *ao)
|
||||
{
|
||||
struct null_data *nd = (struct null_data *)ao;
|
||||
NullOutput *nd = (NullOutput *)ao;
|
||||
|
||||
if (!nd->sync)
|
||||
return;
|
||||
@ -118,12 +118,19 @@ null_cancel(struct audio_output *ao)
|
||||
}
|
||||
|
||||
const struct audio_output_plugin null_output_plugin = {
|
||||
.name = "null",
|
||||
.init = null_init,
|
||||
.finish = null_finish,
|
||||
.open = null_open,
|
||||
.close = null_close,
|
||||
.delay = null_delay,
|
||||
.play = null_play,
|
||||
.cancel = null_cancel,
|
||||
"null",
|
||||
nullptr,
|
||||
null_init,
|
||||
null_finish,
|
||||
nullptr,
|
||||
nullptr,
|
||||
null_open,
|
||||
null_close,
|
||||
null_delay,
|
||||
nullptr,
|
||||
null_play,
|
||||
nullptr,
|
||||
null_cancel,
|
||||
nullptr,
|
||||
nullptr,
|
||||
};
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2003-2011 The Music Player Daemon Project
|
||||
* Copyright (C) 2003-2013 The Music Player Daemon Project
|
||||
* http://www.musicpd.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -17,8 +17,8 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef MPD_NULL_OUTPUT_PLUGIN_H
|
||||
#define MPD_NULL_OUTPUT_PLUGIN_H
|
||||
#ifndef MPD_NULL_OUTPUT_PLUGIN_HXX
|
||||
#define MPD_NULL_OUTPUT_PLUGIN_HXX
|
||||
|
||||
extern const struct audio_output_plugin null_output_plugin;
|
||||
|
Loading…
Reference in New Issue
Block a user