diff options
Diffstat (limited to 'src/encoder')
-rw-r--r-- | src/encoder/FlacEncoderPlugin.cxx | 37 | ||||
-rw-r--r-- | src/encoder/FlacEncoderPlugin.hxx | 2 | ||||
-rw-r--r-- | src/encoder/LameEncoderPlugin.cxx | 25 | ||||
-rw-r--r-- | src/encoder/LameEncoderPlugin.hxx | 2 | ||||
-rw-r--r-- | src/encoder/NullEncoderPlugin.cxx | 23 | ||||
-rw-r--r-- | src/encoder/NullEncoderPlugin.hxx | 2 | ||||
-rw-r--r-- | src/encoder/OpusEncoderPlugin.cxx | 29 | ||||
-rw-r--r-- | src/encoder/OpusEncoderPlugin.hxx | 2 | ||||
-rw-r--r-- | src/encoder/TwolameEncoderPlugin.cxx | 27 | ||||
-rw-r--r-- | src/encoder/TwolameEncoderPlugin.hxx | 2 | ||||
-rw-r--r-- | src/encoder/VorbisEncoderPlugin.cxx | 31 | ||||
-rw-r--r-- | src/encoder/VorbisEncoderPlugin.hxx | 2 | ||||
-rw-r--r-- | src/encoder/WaveEncoderPlugin.cxx | 27 | ||||
-rw-r--r-- | src/encoder/WaveEncoderPlugin.hxx | 2 |
14 files changed, 94 insertions, 119 deletions
diff --git a/src/encoder/FlacEncoderPlugin.cxx b/src/encoder/FlacEncoderPlugin.cxx index a7f551422..3aeb96cf7 100644 --- a/src/encoder/FlacEncoderPlugin.cxx +++ b/src/encoder/FlacEncoderPlugin.cxx @@ -19,8 +19,7 @@ #include "config.h" #include "FlacEncoderPlugin.hxx" -#include "encoder_api.h" -#include "encoder_plugin.h" +#include "EncoderAPI.hxx" #include "audio_format.h" #include "pcm/PcmBuffer.hxx" #include "util/fifo_buffer.h" @@ -39,7 +38,7 @@ extern "C" { #endif struct flac_encoder { - struct encoder encoder; + Encoder encoder; struct audio_format audio_format; unsigned compression; @@ -53,10 +52,9 @@ struct flac_encoder { * picked up with flac_encoder_read(). */ struct fifo_buffer *output_buffer; -}; - -extern const struct encoder_plugin flac_encoder_plugin; + flac_encoder():encoder(flac_encoder_plugin) {} +}; static inline GQuark flac_encoder_quark(void) @@ -74,18 +72,15 @@ flac_encoder_configure(struct flac_encoder *encoder, return true; } -static struct encoder * +static Encoder * flac_encoder_init(const struct config_param *param, GError **error) { - struct flac_encoder *encoder; - - encoder = g_new(struct flac_encoder, 1); - encoder_struct_init(&encoder->encoder, &flac_encoder_plugin); + flac_encoder *encoder = new flac_encoder(); /* load configuration from "param" */ if (!flac_encoder_configure(encoder, param, error)) { /* configuration has failed, roll back and return error */ - g_free(encoder); + delete encoder; return nullptr; } @@ -93,13 +88,13 @@ flac_encoder_init(const struct config_param *param, GError **error) } static void -flac_encoder_finish(struct encoder *_encoder) +flac_encoder_finish(Encoder *_encoder) { struct flac_encoder *encoder = (struct flac_encoder *)_encoder; /* the real libFLAC cleanup was already performed by flac_encoder_close(), so no real work here */ - g_free(encoder); + delete encoder; } static bool @@ -154,7 +149,7 @@ flac_write_callback(G_GNUC_UNUSED const FLAC__StreamEncoder *fse, } static void -flac_encoder_close(struct encoder *_encoder) +flac_encoder_close(Encoder *_encoder) { struct flac_encoder *encoder = (struct flac_encoder *)_encoder; @@ -165,7 +160,7 @@ flac_encoder_close(struct encoder *_encoder) } static bool -flac_encoder_open(struct encoder *_encoder, struct audio_format *audio_format, +flac_encoder_open(Encoder *_encoder, struct audio_format *audio_format, GError **error) { struct flac_encoder *encoder = (struct flac_encoder *)_encoder; @@ -230,7 +225,7 @@ flac_encoder_open(struct encoder *_encoder, struct audio_format *audio_format, static bool -flac_encoder_flush(struct encoder *_encoder, G_GNUC_UNUSED GError **error) +flac_encoder_flush(Encoder *_encoder, G_GNUC_UNUSED GError **error) { struct flac_encoder *encoder = (struct flac_encoder *)_encoder; @@ -257,7 +252,7 @@ pcm16_to_flac(int32_t *out, const int16_t *in, unsigned num_samples) } static bool -flac_encoder_write(struct encoder *_encoder, +flac_encoder_write(Encoder *_encoder, const void *data, size_t length, G_GNUC_UNUSED GError **error) { @@ -308,7 +303,7 @@ flac_encoder_write(struct encoder *_encoder, } static size_t -flac_encoder_read(struct encoder *_encoder, void *dest, size_t length) +flac_encoder_read(Encoder *_encoder, void *dest, size_t length) { struct flac_encoder *encoder = (struct flac_encoder *)_encoder; @@ -327,12 +322,12 @@ flac_encoder_read(struct encoder *_encoder, void *dest, size_t length) } static const char * -flac_encoder_get_mime_type(G_GNUC_UNUSED struct encoder *_encoder) +flac_encoder_get_mime_type(G_GNUC_UNUSED Encoder *_encoder) { return "audio/flac"; } -const struct encoder_plugin flac_encoder_plugin = { +const EncoderPlugin flac_encoder_plugin = { "flac", flac_encoder_init, flac_encoder_finish, diff --git a/src/encoder/FlacEncoderPlugin.hxx b/src/encoder/FlacEncoderPlugin.hxx index da2d91a9a..928a7f93e 100644 --- a/src/encoder/FlacEncoderPlugin.hxx +++ b/src/encoder/FlacEncoderPlugin.hxx @@ -20,6 +20,6 @@ #ifndef MPD_ENCODER_FLAC_HXX #define MPD_ENCODER_FLAC_HXX -extern const struct encoder_plugin flac_encoder_plugin; +extern const struct EncoderPlugin flac_encoder_plugin; #endif diff --git a/src/encoder/LameEncoderPlugin.cxx b/src/encoder/LameEncoderPlugin.cxx index 32fa7a323..933fa3ff2 100644 --- a/src/encoder/LameEncoderPlugin.cxx +++ b/src/encoder/LameEncoderPlugin.cxx @@ -19,8 +19,7 @@ #include "config.h" #include "LameEncoderPlugin.hxx" -#include "encoder_api.h" -#include "encoder_plugin.h" +#include "EncoderAPI.hxx" #include "audio_format.h" #include <lame/lame.h> @@ -31,7 +30,7 @@ #include <string.h> struct LameEncoder final { - struct encoder encoder; + Encoder encoder; struct audio_format audio_format; float quality; @@ -42,9 +41,7 @@ struct LameEncoder final { unsigned char buffer[32768]; size_t buffer_length; - LameEncoder() { - encoder_struct_init(&encoder, &lame_encoder_plugin); - } + LameEncoder():encoder(lame_encoder_plugin) {} bool Configure(const config_param *param, GError **error); }; @@ -108,7 +105,7 @@ LameEncoder::Configure(const config_param *param, GError **error) return true; } -static struct encoder * +static Encoder * lame_encoder_init(const struct config_param *param, GError **error_r) { LameEncoder *encoder = new LameEncoder(); @@ -124,7 +121,7 @@ lame_encoder_init(const struct config_param *param, GError **error_r) } static void -lame_encoder_finish(struct encoder *_encoder) +lame_encoder_finish(Encoder *_encoder) { LameEncoder *encoder = (LameEncoder *)_encoder; @@ -190,7 +187,7 @@ lame_encoder_setup(LameEncoder *encoder, GError **error) } static bool -lame_encoder_open(struct encoder *_encoder, struct audio_format *audio_format, +lame_encoder_open(Encoder *_encoder, struct audio_format *audio_format, GError **error) { LameEncoder *encoder = (LameEncoder *)_encoder; @@ -218,7 +215,7 @@ lame_encoder_open(struct encoder *_encoder, struct audio_format *audio_format, } static void -lame_encoder_close(struct encoder *_encoder) +lame_encoder_close(Encoder *_encoder) { LameEncoder *encoder = (LameEncoder *)_encoder; @@ -226,7 +223,7 @@ lame_encoder_close(struct encoder *_encoder) } static bool -lame_encoder_write(struct encoder *_encoder, +lame_encoder_write(Encoder *_encoder, const void *data, size_t length, gcc_unused GError **error) { @@ -265,7 +262,7 @@ lame_encoder_write(struct encoder *_encoder, } static size_t -lame_encoder_read(struct encoder *_encoder, void *dest, size_t length) +lame_encoder_read(Encoder *_encoder, void *dest, size_t length) { LameEncoder *encoder = (LameEncoder *)_encoder; @@ -282,12 +279,12 @@ lame_encoder_read(struct encoder *_encoder, void *dest, size_t length) } static const char * -lame_encoder_get_mime_type(gcc_unused struct encoder *_encoder) +lame_encoder_get_mime_type(gcc_unused Encoder *_encoder) { return "audio/mpeg"; } -const struct encoder_plugin lame_encoder_plugin = { +const EncoderPlugin lame_encoder_plugin = { "lame", lame_encoder_init, lame_encoder_finish, diff --git a/src/encoder/LameEncoderPlugin.hxx b/src/encoder/LameEncoderPlugin.hxx index 3037ab4ec..49832baee 100644 --- a/src/encoder/LameEncoderPlugin.hxx +++ b/src/encoder/LameEncoderPlugin.hxx @@ -20,6 +20,6 @@ #ifndef MPD_ENCODER_LAME_HXX #define MPD_ENCODER_LAME_HXX -extern const struct encoder_plugin lame_encoder_plugin; +extern const struct EncoderPlugin lame_encoder_plugin; #endif diff --git a/src/encoder/NullEncoderPlugin.cxx b/src/encoder/NullEncoderPlugin.cxx index bdfab1563..39e391063 100644 --- a/src/encoder/NullEncoderPlugin.cxx +++ b/src/encoder/NullEncoderPlugin.cxx @@ -19,8 +19,7 @@ #include "config.h" #include "NullEncoderPlugin.hxx" -#include "encoder_api.h" -#include "encoder_plugin.h" +#include "EncoderAPI.hxx" #include "util/fifo_buffer.h" extern "C" { #include "util/growing_fifo.h" @@ -33,16 +32,14 @@ extern "C" { #include <string.h> struct NullEncoder final { - struct encoder encoder; + Encoder encoder; struct fifo_buffer *buffer; - NullEncoder() { - encoder_struct_init(&encoder, &null_encoder_plugin); - } + NullEncoder():encoder(null_encoder_plugin) {} }; -static struct encoder * +static Encoder * null_encoder_init(gcc_unused const struct config_param *param, gcc_unused GError **error) { @@ -51,7 +48,7 @@ null_encoder_init(gcc_unused const struct config_param *param, } static void -null_encoder_finish(struct encoder *_encoder) +null_encoder_finish(Encoder *_encoder) { NullEncoder *encoder = (NullEncoder *)_encoder; @@ -59,7 +56,7 @@ null_encoder_finish(struct encoder *_encoder) } static void -null_encoder_close(struct encoder *_encoder) +null_encoder_close(Encoder *_encoder) { NullEncoder *encoder = (NullEncoder *)_encoder; @@ -68,7 +65,7 @@ null_encoder_close(struct encoder *_encoder) static bool -null_encoder_open(struct encoder *_encoder, +null_encoder_open(Encoder *_encoder, gcc_unused struct audio_format *audio_format, gcc_unused GError **error) { @@ -78,7 +75,7 @@ null_encoder_open(struct encoder *_encoder, } static bool -null_encoder_write(struct encoder *_encoder, +null_encoder_write(Encoder *_encoder, const void *data, size_t length, gcc_unused GError **error) { @@ -89,7 +86,7 @@ null_encoder_write(struct encoder *_encoder, } static size_t -null_encoder_read(struct encoder *_encoder, void *dest, size_t length) +null_encoder_read(Encoder *_encoder, void *dest, size_t length) { NullEncoder *encoder = (NullEncoder *)_encoder; @@ -106,7 +103,7 @@ null_encoder_read(struct encoder *_encoder, void *dest, size_t length) return length; } -const struct encoder_plugin null_encoder_plugin = { +const EncoderPlugin null_encoder_plugin = { "null", null_encoder_init, null_encoder_finish, diff --git a/src/encoder/NullEncoderPlugin.hxx b/src/encoder/NullEncoderPlugin.hxx index bf2cfee60..b741a2f6d 100644 --- a/src/encoder/NullEncoderPlugin.hxx +++ b/src/encoder/NullEncoderPlugin.hxx @@ -20,6 +20,6 @@ #ifndef MPD_ENCODER_NULL_HXX #define MPD_ENCODER_NULL_HXX -extern const struct encoder_plugin null_encoder_plugin; +extern const struct EncoderPlugin null_encoder_plugin; #endif diff --git a/src/encoder/OpusEncoderPlugin.cxx b/src/encoder/OpusEncoderPlugin.cxx index 7167473e5..a5947e4b8 100644 --- a/src/encoder/OpusEncoderPlugin.cxx +++ b/src/encoder/OpusEncoderPlugin.cxx @@ -20,8 +20,7 @@ #include "config.h" #include "OpusEncoderPlugin.hxx" #include "OggStream.hxx" -#include "encoder_api.h" -#include "encoder_plugin.h" +#include "EncoderAPI.hxx" #include "audio_format.h" #include "mpd_error.h" @@ -35,7 +34,7 @@ struct opus_encoder { /** the base class */ - struct encoder encoder; + Encoder encoder; /* configuration */ @@ -64,9 +63,7 @@ struct opus_encoder { ogg_int64_t granulepos; - opus_encoder() { - encoder_struct_init(&encoder, &opus_encoder_plugin); - } + opus_encoder():encoder(opus_encoder_plugin) {} }; gcc_const @@ -120,7 +117,7 @@ opus_encoder_configure(struct opus_encoder *encoder, return true; } -static struct encoder * +static Encoder * opus_encoder_init(const struct config_param *param, GError **error) { opus_encoder *encoder = new opus_encoder(); @@ -136,7 +133,7 @@ opus_encoder_init(const struct config_param *param, GError **error) } static void -opus_encoder_finish(struct encoder *_encoder) +opus_encoder_finish(Encoder *_encoder) { struct opus_encoder *encoder = (struct opus_encoder *)_encoder; @@ -146,7 +143,7 @@ opus_encoder_finish(struct encoder *_encoder) } static bool -opus_encoder_open(struct encoder *_encoder, +opus_encoder_open(Encoder *_encoder, struct audio_format *audio_format, GError **error_r) { @@ -205,7 +202,7 @@ opus_encoder_open(struct encoder *_encoder, } static void -opus_encoder_close(struct encoder *_encoder) +opus_encoder_close(Encoder *_encoder) { struct opus_encoder *encoder = (struct opus_encoder *)_encoder; @@ -255,7 +252,7 @@ opus_encoder_do_encode(struct opus_encoder *encoder, bool eos, } static bool -opus_encoder_end(struct encoder *_encoder, GError **error_r) +opus_encoder_end(Encoder *_encoder, GError **error_r) { struct opus_encoder *encoder = (struct opus_encoder *)_encoder; @@ -269,7 +266,7 @@ opus_encoder_end(struct encoder *_encoder, GError **error_r) } static bool -opus_encoder_flush(struct encoder *_encoder, G_GNUC_UNUSED GError **error) +opus_encoder_flush(Encoder *_encoder, G_GNUC_UNUSED GError **error) { struct opus_encoder *encoder = (struct opus_encoder *)_encoder; @@ -303,7 +300,7 @@ opus_encoder_write_silence(struct opus_encoder *encoder, unsigned fill_frames, } static bool -opus_encoder_write(struct encoder *_encoder, +opus_encoder_write(Encoder *_encoder, const void *_data, size_t length, GError **error_r) { @@ -395,7 +392,7 @@ opus_encoder_generate_tags(struct opus_encoder *encoder) } static size_t -opus_encoder_read(struct encoder *_encoder, void *dest, size_t length) +opus_encoder_read(Encoder *_encoder, void *dest, size_t length) { struct opus_encoder *encoder = (struct opus_encoder *)_encoder; @@ -408,12 +405,12 @@ opus_encoder_read(struct encoder *_encoder, void *dest, size_t length) } static const char * -opus_encoder_get_mime_type(G_GNUC_UNUSED struct encoder *_encoder) +opus_encoder_get_mime_type(G_GNUC_UNUSED Encoder *_encoder) { return "audio/ogg"; } -const struct encoder_plugin opus_encoder_plugin = { +const EncoderPlugin opus_encoder_plugin = { "opus", opus_encoder_init, opus_encoder_finish, diff --git a/src/encoder/OpusEncoderPlugin.hxx b/src/encoder/OpusEncoderPlugin.hxx index f54377202..d6da0e960 100644 --- a/src/encoder/OpusEncoderPlugin.hxx +++ b/src/encoder/OpusEncoderPlugin.hxx @@ -20,6 +20,6 @@ #ifndef MPD_ENCODER_OPUS_H #define MPD_ENCODER_OPUS_H -extern const struct encoder_plugin opus_encoder_plugin; +extern const struct EncoderPlugin opus_encoder_plugin; #endif diff --git a/src/encoder/TwolameEncoderPlugin.cxx b/src/encoder/TwolameEncoderPlugin.cxx index a61426170..c307b7b4f 100644 --- a/src/encoder/TwolameEncoderPlugin.cxx +++ b/src/encoder/TwolameEncoderPlugin.cxx @@ -19,8 +19,7 @@ #include "config.h" #include "TwolameEncoderPlugin.hxx" -#include "encoder_api.h" -#include "encoder_plugin.h" +#include "EncoderAPI.hxx" #include "audio_format.h" #include <twolame.h> @@ -31,7 +30,7 @@ #include <string.h> struct TwolameEncoder final { - struct encoder encoder; + Encoder encoder; struct audio_format audio_format; float quality; @@ -47,9 +46,7 @@ struct TwolameEncoder final { */ bool flush; - TwolameEncoder() { - encoder_struct_init(&encoder, &twolame_encoder_plugin); - } + TwolameEncoder():encoder(twolame_encoder_plugin) {} bool Configure(const config_param *param, GError **error); }; @@ -113,7 +110,7 @@ TwolameEncoder::Configure(const config_param *param, GError **error) return true; } -static struct encoder * +static Encoder * twolame_encoder_init(const struct config_param *param, GError **error_r) { g_debug("libtwolame version %s", get_twolame_version()); @@ -131,7 +128,7 @@ twolame_encoder_init(const struct config_param *param, GError **error_r) } static void -twolame_encoder_finish(struct encoder *_encoder) +twolame_encoder_finish(Encoder *_encoder) { TwolameEncoder *encoder = (TwolameEncoder *)_encoder; @@ -190,7 +187,7 @@ twolame_encoder_setup(TwolameEncoder *encoder, GError **error) } static bool -twolame_encoder_open(struct encoder *_encoder, struct audio_format *audio_format, +twolame_encoder_open(Encoder *_encoder, struct audio_format *audio_format, GError **error) { TwolameEncoder *encoder = (TwolameEncoder *)_encoder; @@ -219,7 +216,7 @@ twolame_encoder_open(struct encoder *_encoder, struct audio_format *audio_format } static void -twolame_encoder_close(struct encoder *_encoder) +twolame_encoder_close(Encoder *_encoder) { TwolameEncoder *encoder = (TwolameEncoder *)_encoder; @@ -227,7 +224,7 @@ twolame_encoder_close(struct encoder *_encoder) } static bool -twolame_encoder_flush(struct encoder *_encoder, gcc_unused GError **error) +twolame_encoder_flush(Encoder *_encoder, gcc_unused GError **error) { TwolameEncoder *encoder = (TwolameEncoder *)_encoder; @@ -236,7 +233,7 @@ twolame_encoder_flush(struct encoder *_encoder, gcc_unused GError **error) } static bool -twolame_encoder_write(struct encoder *_encoder, +twolame_encoder_write(Encoder *_encoder, const void *data, size_t length, gcc_unused GError **error) { @@ -263,7 +260,7 @@ twolame_encoder_write(struct encoder *_encoder, } static size_t -twolame_encoder_read(struct encoder *_encoder, void *dest, size_t length) +twolame_encoder_read(Encoder *_encoder, void *dest, size_t length) { TwolameEncoder *encoder = (TwolameEncoder *)_encoder; @@ -290,12 +287,12 @@ twolame_encoder_read(struct encoder *_encoder, void *dest, size_t length) } static const char * -twolame_encoder_get_mime_type(gcc_unused struct encoder *_encoder) +twolame_encoder_get_mime_type(gcc_unused Encoder *_encoder) { return "audio/mpeg"; } -const struct encoder_plugin twolame_encoder_plugin = { +const EncoderPlugin twolame_encoder_plugin = { "twolame", twolame_encoder_init, twolame_encoder_finish, diff --git a/src/encoder/TwolameEncoderPlugin.hxx b/src/encoder/TwolameEncoderPlugin.hxx index 585345172..dd8a536f6 100644 --- a/src/encoder/TwolameEncoderPlugin.hxx +++ b/src/encoder/TwolameEncoderPlugin.hxx @@ -20,6 +20,6 @@ #ifndef MPD_ENCODER_TWOLAME_HXX #define MPD_ENCODER_TWOLAME_HXX -extern const struct encoder_plugin twolame_encoder_plugin; +extern const struct EncoderPlugin twolame_encoder_plugin; #endif diff --git a/src/encoder/VorbisEncoderPlugin.cxx b/src/encoder/VorbisEncoderPlugin.cxx index dc7ef0d5e..8996a57d6 100644 --- a/src/encoder/VorbisEncoderPlugin.cxx +++ b/src/encoder/VorbisEncoderPlugin.cxx @@ -20,8 +20,7 @@ #include "config.h" #include "VorbisEncoderPlugin.hxx" #include "OggStream.hxx" -#include "encoder_api.h" -#include "encoder_plugin.h" +#include "EncoderAPI.hxx" #include "tag.h" #include "audio_format.h" #include "mpd_error.h" @@ -35,7 +34,7 @@ struct vorbis_encoder { /** the base class */ - struct encoder encoder; + Encoder encoder; /* configuration */ @@ -52,9 +51,7 @@ struct vorbis_encoder { OggStream stream; - vorbis_encoder() { - encoder_struct_init(&encoder, &vorbis_encoder_plugin); - } + vorbis_encoder():encoder(vorbis_encoder_plugin) {} }; static inline GQuark @@ -117,7 +114,7 @@ vorbis_encoder_configure(struct vorbis_encoder *encoder, return true; } -static struct encoder * +static Encoder * vorbis_encoder_init(const struct config_param *param, GError **error) { vorbis_encoder *encoder = new vorbis_encoder(); @@ -133,7 +130,7 @@ vorbis_encoder_init(const struct config_param *param, GError **error) } static void -vorbis_encoder_finish(struct encoder *_encoder) +vorbis_encoder_finish(Encoder *_encoder) { struct vorbis_encoder *encoder = (struct vorbis_encoder *)_encoder; @@ -204,7 +201,7 @@ vorbis_encoder_send_header(struct vorbis_encoder *encoder) } static bool -vorbis_encoder_open(struct encoder *_encoder, +vorbis_encoder_open(Encoder *_encoder, struct audio_format *audio_format, GError **error) { @@ -232,7 +229,7 @@ vorbis_encoder_clear(struct vorbis_encoder *encoder) } static void -vorbis_encoder_close(struct encoder *_encoder) +vorbis_encoder_close(Encoder *_encoder) { struct vorbis_encoder *encoder = (struct vorbis_encoder *)_encoder; @@ -253,7 +250,7 @@ vorbis_encoder_blockout(struct vorbis_encoder *encoder) } static bool -vorbis_encoder_flush(struct encoder *_encoder, G_GNUC_UNUSED GError **error) +vorbis_encoder_flush(Encoder *_encoder, G_GNUC_UNUSED GError **error) { struct vorbis_encoder *encoder = (struct vorbis_encoder *)_encoder; @@ -262,7 +259,7 @@ vorbis_encoder_flush(struct encoder *_encoder, G_GNUC_UNUSED GError **error) } static bool -vorbis_encoder_pre_tag(struct encoder *_encoder, G_GNUC_UNUSED GError **error) +vorbis_encoder_pre_tag(Encoder *_encoder, G_GNUC_UNUSED GError **error) { struct vorbis_encoder *encoder = (struct vorbis_encoder *)_encoder; @@ -292,7 +289,7 @@ copy_tag_to_vorbis_comment(vorbis_comment *vc, const struct tag *tag) } static bool -vorbis_encoder_tag(struct encoder *_encoder, const struct tag *tag, +vorbis_encoder_tag(Encoder *_encoder, const struct tag *tag, G_GNUC_UNUSED GError **error) { struct vorbis_encoder *encoder = (struct vorbis_encoder *)_encoder; @@ -325,7 +322,7 @@ interleaved_to_vorbis_buffer(float **dest, const float *src, } static bool -vorbis_encoder_write(struct encoder *_encoder, +vorbis_encoder_write(Encoder *_encoder, const void *data, size_t length, G_GNUC_UNUSED GError **error) { @@ -348,7 +345,7 @@ vorbis_encoder_write(struct encoder *_encoder, } static size_t -vorbis_encoder_read(struct encoder *_encoder, void *dest, size_t length) +vorbis_encoder_read(Encoder *_encoder, void *dest, size_t length) { struct vorbis_encoder *encoder = (struct vorbis_encoder *)_encoder; @@ -356,12 +353,12 @@ vorbis_encoder_read(struct encoder *_encoder, void *dest, size_t length) } static const char * -vorbis_encoder_get_mime_type(G_GNUC_UNUSED struct encoder *_encoder) +vorbis_encoder_get_mime_type(G_GNUC_UNUSED Encoder *_encoder) { return "audio/ogg"; } -const struct encoder_plugin vorbis_encoder_plugin = { +const EncoderPlugin vorbis_encoder_plugin = { "vorbis", vorbis_encoder_init, vorbis_encoder_finish, diff --git a/src/encoder/VorbisEncoderPlugin.hxx b/src/encoder/VorbisEncoderPlugin.hxx index 4cddf1b11..72cc44f5c 100644 --- a/src/encoder/VorbisEncoderPlugin.hxx +++ b/src/encoder/VorbisEncoderPlugin.hxx @@ -20,6 +20,6 @@ #ifndef MPD_ENCODER_VORBIS_H #define MPD_ENCODER_VORBIS_H -extern const struct encoder_plugin vorbis_encoder_plugin; +extern const struct EncoderPlugin vorbis_encoder_plugin; #endif diff --git a/src/encoder/WaveEncoderPlugin.cxx b/src/encoder/WaveEncoderPlugin.cxx index fb52d7906..939012d89 100644 --- a/src/encoder/WaveEncoderPlugin.cxx +++ b/src/encoder/WaveEncoderPlugin.cxx @@ -19,8 +19,7 @@ #include "config.h" #include "WaveEncoderPlugin.hxx" -#include "encoder_api.h" -#include "encoder_plugin.h" +#include "EncoderAPI.hxx" #include "util/fifo_buffer.h" extern "C" { #include "util/growing_fifo.h" @@ -32,14 +31,12 @@ extern "C" { #include <string.h> struct WaveEncoder { - struct encoder encoder; + Encoder encoder; unsigned bits; struct fifo_buffer *buffer; - WaveEncoder() { - encoder_struct_init(&encoder, &wave_encoder_plugin); - } + WaveEncoder():encoder(wave_encoder_plugin) {} }; struct wave_header { @@ -58,8 +55,6 @@ struct wave_header { uint32_t data_size; }; -extern const struct encoder_plugin wave_encoder_plugin; - static void fill_wave_header(struct wave_header *header, int channels, int bits, int freq, int block_size) @@ -87,7 +82,7 @@ fill_wave_header(struct wave_header *header, int channels, int bits, (8 + data_size)); } -static struct encoder * +static Encoder * wave_encoder_init(gcc_unused const struct config_param *param, gcc_unused GError **error) { @@ -96,7 +91,7 @@ wave_encoder_init(gcc_unused const struct config_param *param, } static void -wave_encoder_finish(struct encoder *_encoder) +wave_encoder_finish(Encoder *_encoder) { WaveEncoder *encoder = (WaveEncoder *)_encoder; @@ -104,7 +99,7 @@ wave_encoder_finish(struct encoder *_encoder) } static bool -wave_encoder_open(struct encoder *_encoder, +wave_encoder_open(Encoder *_encoder, gcc_unused struct audio_format *audio_format, gcc_unused GError **error) { @@ -151,7 +146,7 @@ wave_encoder_open(struct encoder *_encoder, } static void -wave_encoder_close(struct encoder *_encoder) +wave_encoder_close(Encoder *_encoder) { WaveEncoder *encoder = (WaveEncoder *)_encoder; @@ -199,7 +194,7 @@ pcm24_to_wave(uint8_t *dst8, const uint32_t *src32, size_t length) } static bool -wave_encoder_write(struct encoder *_encoder, +wave_encoder_write(Encoder *_encoder, const void *src, size_t length, gcc_unused GError **error) { @@ -242,7 +237,7 @@ wave_encoder_write(struct encoder *_encoder, } static size_t -wave_encoder_read(struct encoder *_encoder, void *dest, size_t length) +wave_encoder_read(Encoder *_encoder, void *dest, size_t length) { WaveEncoder *encoder = (WaveEncoder *)_encoder; @@ -260,12 +255,12 @@ wave_encoder_read(struct encoder *_encoder, void *dest, size_t length) } static const char * -wave_encoder_get_mime_type(gcc_unused struct encoder *_encoder) +wave_encoder_get_mime_type(gcc_unused Encoder *_encoder) { return "audio/wav"; } -const struct encoder_plugin wave_encoder_plugin = { +const EncoderPlugin wave_encoder_plugin = { "wave", wave_encoder_init, wave_encoder_finish, diff --git a/src/encoder/WaveEncoderPlugin.hxx b/src/encoder/WaveEncoderPlugin.hxx index b50fe5514..190ee131e 100644 --- a/src/encoder/WaveEncoderPlugin.hxx +++ b/src/encoder/WaveEncoderPlugin.hxx @@ -20,6 +20,6 @@ #ifndef MPD_ENCODER_WAVE_HXX #define MPD_ENCODER_WAVE_HXX -extern const struct encoder_plugin wave_encoder_plugin; +extern const struct EncoderPlugin wave_encoder_plugin; #endif |