diff options
author | Max Kellermann <max@duempel.org> | 2016-05-04 09:31:21 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2016-05-04 16:32:31 +0200 |
commit | e7edc0264745499609aa22bd19620e15f6ef3e62 (patch) | |
tree | 057402f9c77c5d5e9bf3346ca8cff4499ca444b6 /src/encoder/EncoderPlugin.hxx | |
parent | 69bf835059cfb8c233979b9988404a65c971e2a5 (diff) |
encoder/Interface: move instance methods to abstract class
Rename struct Encoder to PreparedEncoder, and add a new (abstract)
class Encoder which represents one encoder instance.
Diffstat (limited to 'src/encoder/EncoderPlugin.hxx')
-rw-r--r-- | src/encoder/EncoderPlugin.hxx | 39 |
1 files changed, 10 insertions, 29 deletions
diff --git a/src/encoder/EncoderPlugin.hxx b/src/encoder/EncoderPlugin.hxx index 851f233f2..de37f6d35 100644 --- a/src/encoder/EncoderPlugin.hxx +++ b/src/encoder/EncoderPlugin.hxx @@ -20,44 +20,25 @@ #ifndef MPD_ENCODER_PLUGIN_HXX #define MPD_ENCODER_PLUGIN_HXX -#include <stddef.h> - -struct Encoder; +struct PreparedEncoder; +class Encoder; struct AudioFormat; struct ConfigBlock; -struct Tag; class Error; struct EncoderPlugin { const char *name; - Encoder *(*init)(const ConfigBlock &block, - Error &error); - - void (*finish)(Encoder *encoder); - - bool (*open)(Encoder *encoder, - AudioFormat &audio_format, - Error &error); - - void (*close)(Encoder *encoder); + PreparedEncoder *(*init)(const ConfigBlock &block, + Error &error); - bool (*end)(Encoder *encoder, Error &error); + void (*finish)(PreparedEncoder *encoder); - bool (*flush)(Encoder *encoder, Error &error); - - bool (*pre_tag)(Encoder *encoder, Error &error); - - bool (*tag)(Encoder *encoder, const Tag &tag, - Error &error); - - bool (*write)(Encoder *encoder, - const void *data, size_t length, - Error &error); - - size_t (*read)(Encoder *encoder, void *dest, size_t length); + Encoder *(*open)(PreparedEncoder *encoder, + AudioFormat &audio_format, + Error &error); - const char *(*get_mime_type)(Encoder *encoder); + const char *(*get_mime_type)(PreparedEncoder *encoder); }; /** @@ -67,7 +48,7 @@ struct EncoderPlugin { * @param error location to store the error occurring, or nullptr to ignore errors. * @return an encoder object on success, nullptr on failure */ -static inline Encoder * +static inline PreparedEncoder * encoder_init(const EncoderPlugin &plugin, const ConfigBlock &block, Error &error) { |