output/{recorder,httpd,shout}: use std::unique_ptr to manage PreparedEncoder pointer
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user