output/{recorder,httpd,shout}: use std::unique_ptr to manage PreparedEncoder pointer
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
|
||||
#include <queue>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
|
||||
struct ConfigBlock;
|
||||
class EventLoop;
|
||||
@@ -60,7 +61,7 @@ class HttpdOutput final : AudioOutput, ServerSocket {
|
||||
/**
|
||||
* The configured encoder plugin.
|
||||
*/
|
||||
PreparedEncoder *prepared_encoder = nullptr;
|
||||
std::unique_ptr<PreparedEncoder> prepared_encoder;
|
||||
Encoder *encoder = nullptr;
|
||||
|
||||
/**
|
||||
@@ -152,7 +153,6 @@ private:
|
||||
|
||||
public:
|
||||
HttpdOutput(EventLoop &_loop, const ConfigBlock &block);
|
||||
~HttpdOutput();
|
||||
|
||||
static AudioOutput *Create(EventLoop &event_loop,
|
||||
const ConfigBlock &block) {
|
||||
|
||||
@@ -79,7 +79,7 @@ HttpdOutput::HttpdOutput(EventLoop &_loop, const ConfigBlock &block)
|
||||
|
||||
/* initialize encoder */
|
||||
|
||||
prepared_encoder = encoder_init(*encoder_plugin, block);
|
||||
prepared_encoder.reset(encoder_init(*encoder_plugin, block));
|
||||
|
||||
/* determine content type */
|
||||
content_type = prepared_encoder->GetMimeType();
|
||||
@@ -87,11 +87,6 @@ HttpdOutput::HttpdOutput(EventLoop &_loop, const ConfigBlock &block)
|
||||
content_type = "application/octet-stream";
|
||||
}
|
||||
|
||||
HttpdOutput::~HttpdOutput()
|
||||
{
|
||||
delete prepared_encoder;
|
||||
}
|
||||
|
||||
inline void
|
||||
HttpdOutput::Bind()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user