aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-01-07 18:52:47 +0100
committerMax Kellermann <max@duempel.org>2015-01-07 18:55:34 +0100
commit7a2af0fbf4a0261a47a05b7587d6352ca8d35c7d (patch)
treecc7ece811a6130e77ce6631d537319a1c3370364
parentd83127722f2aad4e5d1ebd8aa91d7490893b0d51 (diff)
downloadmpd-7a2af0fbf4a0261a47a05b7587d6352ca8d35c7d.tar.gz
mpd-7a2af0fbf4a0261a47a05b7587d6352ca8d35c7d.tar.xz
mpd-7a2af0fbf4a0261a47a05b7587d6352ca8d35c7d.zip
output/recorder: move more functions into the struct
-rw-r--r--src/output/plugins/RecorderOutputPlugin.cxx25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/output/plugins/RecorderOutputPlugin.cxx b/src/output/plugins/RecorderOutputPlugin.cxx
index 39fbca6e9..52fdb229f 100644
--- a/src/output/plugins/RecorderOutputPlugin.cxx
+++ b/src/output/plugins/RecorderOutputPlugin.cxx
@@ -69,6 +69,8 @@ struct RecorderOutput {
return base.Configure(param, error_r);
}
+ static RecorderOutput *Create(const config_param &param, Error &error);
+
bool Configure(const config_param &param, Error &error);
bool Open(AudioFormat &audio_format, Error &error);
@@ -82,6 +84,8 @@ struct RecorderOutput {
bool EncoderToFile(Error &error);
void SendTag(const Tag &tag);
+
+ size_t Play(const void *chunk, size_t size, Error &error);
};
static constexpr Domain recorder_output_domain("recorder_output");
@@ -116,8 +120,8 @@ RecorderOutput::Configure(const config_param &param, Error &error)
return true;
}
-static AudioOutput *
-recorder_output_init(const config_param &param, Error &error)
+RecorderOutput *
+RecorderOutput::Create(const config_param &param, Error &error)
{
RecorderOutput *recorder = new RecorderOutput();
@@ -131,7 +135,7 @@ recorder_output_init(const config_param &param, Error &error)
return nullptr;
}
- return &recorder->base;
+ return recorder;
}
static void
@@ -252,14 +256,11 @@ recorder_output_send_tag(AudioOutput *ao, const Tag &tag)
recorder.SendTag(tag);
}
-static size_t
-recorder_output_play(AudioOutput *ao, const void *chunk, size_t size,
- Error &error)
+inline size_t
+RecorderOutput::Play(const void *chunk, size_t size, Error &error)
{
- RecorderOutput *recorder = (RecorderOutput *)ao;
-
- return encoder_write(recorder->encoder, chunk, size, error) &&
- recorder->EncoderToFile(error)
+ return encoder_write(encoder, chunk, size, error) &&
+ EncoderToFile(error)
? size : 0;
}
@@ -268,7 +269,7 @@ typedef AudioOutputWrapper<RecorderOutput> Wrapper;
const struct AudioOutputPlugin recorder_output_plugin = {
"recorder",
nullptr,
- recorder_output_init,
+ &Wrapper::Init,
recorder_output_finish,
nullptr,
nullptr,
@@ -276,7 +277,7 @@ const struct AudioOutputPlugin recorder_output_plugin = {
&Wrapper::Close,
nullptr,
recorder_output_send_tag,
- recorder_output_play,
+ &Wrapper::Play,
nullptr,
nullptr,
nullptr,