aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/plugins/RecorderOutputPlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-01-14 20:11:00 +0100
committerMax Kellermann <max@duempel.org>2015-01-14 20:11:00 +0100
commitbf5963528045b65125fb379570f7c8a86a61ae5e (patch)
treef27b27d6902c18ce152fbb2703e567c7a04c759b /src/output/plugins/RecorderOutputPlugin.cxx
parent5d6f75aaef6f50b74fefa237927b4e93b649b1af (diff)
downloadmpd-bf5963528045b65125fb379570f7c8a86a61ae5e.tar.gz
mpd-bf5963528045b65125fb379570f7c8a86a61ae5e.tar.xz
mpd-bf5963528045b65125fb379570f7c8a86a61ae5e.zip
output/recorder: move code to encoder/ToOutputStream.cxx
Diffstat (limited to 'src/output/plugins/RecorderOutputPlugin.cxx')
-rw-r--r--src/output/plugins/RecorderOutputPlugin.cxx19
1 files changed, 2 insertions, 17 deletions
diff --git a/src/output/plugins/RecorderOutputPlugin.cxx b/src/output/plugins/RecorderOutputPlugin.cxx
index 22915e39f..973e60b47 100644
--- a/src/output/plugins/RecorderOutputPlugin.cxx
+++ b/src/output/plugins/RecorderOutputPlugin.cxx
@@ -21,6 +21,7 @@
#include "RecorderOutputPlugin.hxx"
#include "../OutputAPI.hxx"
#include "../Wrapper.hxx"
+#include "encoder/ToOutputStream.hxx"
#include "encoder/EncoderInterface.hxx"
#include "encoder/EncoderPlugin.hxx"
#include "encoder/EncoderList.hxx"
@@ -52,11 +53,6 @@ class RecorderOutput {
*/
FileOutputStream *file;
- /**
- * The buffer for encoder_read().
- */
- char buffer[32768];
-
RecorderOutput()
:base(recorder_output_plugin),
encoder(nullptr),
@@ -148,18 +144,7 @@ RecorderOutput::EncoderToFile(Error &error)
assert(file != nullptr);
assert(file->IsDefined());
- while (true) {
- /* read from the encoder */
-
- size_t size = encoder_read(encoder, buffer, sizeof(buffer));
- if (size == 0)
- return true;
-
- /* write everything into the file */
-
- if (!file->Write(buffer, size, error))
- return false;
- }
+ return EncoderToOutputStream(*file, *encoder, error);
}
inline bool