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