output/{recorder,httpd,shout}: use std::unique_ptr to manage PreparedEncoder pointer

This commit is contained in:
Max Kellermann
2017-11-10 21:35:22 +01:00
parent c54a920d13
commit 13816c1c7d
4 changed files with 9 additions and 18 deletions
+3 -6
View File
@@ -35,6 +35,7 @@
#include "util/ScopeExit.hxx"
#include <stdexcept>
#include <memory>
#include <assert.h>
#include <stdlib.h>
@@ -45,7 +46,7 @@ class RecorderOutput final : AudioOutput {
/**
* The configured encoder plugin.
*/
PreparedEncoder *prepared_encoder = nullptr;
std::unique_ptr<PreparedEncoder> prepared_encoder;
Encoder *encoder;
/**
@@ -72,10 +73,6 @@ class RecorderOutput final : AudioOutput {
RecorderOutput(const ConfigBlock &block);
~RecorderOutput() {
delete prepared_encoder;
}
public:
static AudioOutput *Create(EventLoop &, const ConfigBlock &block) {
return new RecorderOutput(block);
@@ -136,7 +133,7 @@ RecorderOutput::RecorderOutput(const ConfigBlock &block)
/* initialize encoder */
prepared_encoder = encoder_init(*encoder_plugin, block);
prepared_encoder.reset(encoder_init(*encoder_plugin, block));
}
inline void