aboutsummaryrefslogtreecommitdiffstats
path: root/src/output
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-01-08 16:56:13 +0100
committerMax Kellermann <max@duempel.org>2015-01-08 16:56:13 +0100
commit59ac9d39d5950bb8bb041c5d49dc818ee0384d8c (patch)
treebfc8c6fb70a02491bb3381775539d07d5db0643d /src/output
parentec41caade4ce07aca9097cf8298c9da04eea35e2 (diff)
downloadmpd-59ac9d39d5950bb8bb041c5d49dc818ee0384d8c.tar.gz
mpd-59ac9d39d5950bb8bb041c5d49dc818ee0384d8c.tar.xz
mpd-59ac9d39d5950bb8bb041c5d49dc818ee0384d8c.zip
output/recorder: move encoder_finish() call to destructor
Diffstat (limited to 'src/output')
-rw-r--r--src/output/plugins/RecorderOutputPlugin.cxx17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/output/plugins/RecorderOutputPlugin.cxx b/src/output/plugins/RecorderOutputPlugin.cxx
index 8f5379d74..5f6a55418 100644
--- a/src/output/plugins/RecorderOutputPlugin.cxx
+++ b/src/output/plugins/RecorderOutputPlugin.cxx
@@ -56,8 +56,14 @@ struct RecorderOutput {
RecorderOutput()
:base(recorder_output_plugin),
+ encoder(nullptr),
path(AllocatedPath::Null()) {}
+ ~RecorderOutput() {
+ if (encoder != nullptr)
+ encoder_finish(encoder);
+ }
+
bool Initialize(const config_param &param, Error &error_r) {
return base.Configure(param, error_r);
}
@@ -133,15 +139,6 @@ RecorderOutput::Create(const config_param &param, Error &error)
return recorder;
}
-static void
-recorder_output_finish(AudioOutput *ao)
-{
- RecorderOutput *recorder = (RecorderOutput *)ao;
-
- encoder_finish(recorder->encoder);
- delete recorder;
-}
-
inline bool
RecorderOutput::EncoderToFile(Error &error)
{
@@ -241,7 +238,7 @@ const struct AudioOutputPlugin recorder_output_plugin = {
"recorder",
nullptr,
&Wrapper::Init,
- recorder_output_finish,
+ &Wrapper::Finish,
nullptr,
nullptr,
&Wrapper::Open,