summaryrefslogtreecommitdiff
path: root/test/run_encoder.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-07-30 09:04:05 +0200
committerMax Kellermann <max@duempel.org>2013-07-30 09:04:05 +0200
commit9a0061c511403bc023430feb91094355da83a663 (patch)
tree7601036948af024a350f3947771375f3588442d9 /test/run_encoder.cxx
parent7a3aac1843a9c84cd87512ef4e9bbc2def727591 (diff)
encoder_api: convert to C++
Diffstat (limited to 'test/run_encoder.cxx')
-rw-r--r--test/run_encoder.cxx18
1 files changed, 8 insertions, 10 deletions
diff --git a/test/run_encoder.cxx b/test/run_encoder.cxx
index 91993c95a..1beb434df 100644
--- a/test/run_encoder.cxx
+++ b/test/run_encoder.cxx
@@ -19,7 +19,7 @@
#include "config.h"
#include "EncoderList.hxx"
-#include "encoder_plugin.h"
+#include "EncoderPlugin.hxx"
#include "audio_format.h"
#include "AudioParser.hxx"
#include "conf.h"
@@ -31,12 +31,12 @@
#include <unistd.h>
static void
-encoder_to_stdout(struct encoder *encoder)
+encoder_to_stdout(Encoder &encoder)
{
size_t length;
static char buffer[32768];
- while ((length = encoder_read(encoder, buffer, sizeof(buffer))) > 0) {
+ while ((length = encoder_read(&encoder, buffer, sizeof(buffer))) > 0) {
G_GNUC_UNUSED ssize_t ignored = write(1, buffer, length);
}
}
@@ -47,8 +47,6 @@ int main(int argc, char **argv)
struct audio_format audio_format;
bool ret;
const char *encoder_name;
- const struct encoder_plugin *plugin;
- struct encoder *encoder;
static char buffer[32768];
/* parse command line */
@@ -67,7 +65,7 @@ int main(int argc, char **argv)
/* create the encoder */
- plugin = encoder_plugin_get(encoder_name);
+ const auto plugin = encoder_plugin_get(encoder_name);
if (plugin == NULL) {
g_printerr("No such encoder: %s\n", encoder_name);
return 1;
@@ -76,7 +74,7 @@ int main(int argc, char **argv)
config_param param;
param.AddBlockParam("quality", "5.0", -1);
- encoder = encoder_init(plugin, &param, &error);
+ const auto encoder = encoder_init(*plugin, &param, &error);
if (encoder == NULL) {
g_printerr("Failed to initialize encoder: %s\n",
error->message);
@@ -104,7 +102,7 @@ int main(int argc, char **argv)
return 1;
}
- encoder_to_stdout(encoder);
+ encoder_to_stdout(*encoder);
/* do it */
@@ -118,7 +116,7 @@ int main(int argc, char **argv)
return 1;
}
- encoder_to_stdout(encoder);
+ encoder_to_stdout(*encoder);
}
ret = encoder_end(encoder, &error);
@@ -129,5 +127,5 @@ int main(int argc, char **argv)
return 1;
}
- encoder_to_stdout(encoder);
+ encoder_to_stdout(*encoder);
}