output/recorder: move code to encoder/ToOutputStream.cxx

This commit is contained in:
Max Kellermann
2015-01-14 20:11:00 +01:00
parent 5d6f75aaef
commit bf59635280
4 changed files with 76 additions and 17 deletions

View File

@@ -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