aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/plugins/RecorderOutputPlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-12-26 14:57:21 +0100
committerMax Kellermann <max@duempel.org>2014-12-26 15:03:22 +0100
commitb3435ae43292bb0b0381485fa48896f33ff6f402 (patch)
treeb97dd2c24c1d3e8bf1650e572001ad65febf2159 /src/output/plugins/RecorderOutputPlugin.cxx
parenta31129333c9a6d702738cfd06d75f970179a3598 (diff)
downloadmpd-b3435ae43292bb0b0381485fa48896f33ff6f402.tar.gz
mpd-b3435ae43292bb0b0381485fa48896f33ff6f402.tar.xz
mpd-b3435ae43292bb0b0381485fa48896f33ff6f402.zip
output/recorder: implement send_tag()
Diffstat (limited to 'src/output/plugins/RecorderOutputPlugin.cxx')
-rw-r--r--src/output/plugins/RecorderOutputPlugin.cxx23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/output/plugins/RecorderOutputPlugin.cxx b/src/output/plugins/RecorderOutputPlugin.cxx
index e0ef569d0..d618aebdc 100644
--- a/src/output/plugins/RecorderOutputPlugin.cxx
+++ b/src/output/plugins/RecorderOutputPlugin.cxx
@@ -23,6 +23,7 @@
#include "encoder/EncoderPlugin.hxx"
#include "encoder/EncoderList.hxx"
#include "config/ConfigError.hxx"
+#include "Log.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
#include "system/fd_util.h"
@@ -75,6 +76,8 @@ struct RecorderOutput {
* Writes pending data from the encoder to the output file.
*/
bool EncoderToFile(Error &error);
+
+ void SendTag(const Tag &tag);
};
static constexpr Domain recorder_output_domain("recorder_output");
@@ -243,6 +246,24 @@ recorder_output_close(AudioOutput *ao)
recorder.Close();
}
+inline void
+RecorderOutput::SendTag(const Tag &tag)
+{
+ Error error;
+ if (!encoder_pre_tag(encoder, error) ||
+ !EncoderToFile(error) ||
+ !encoder_tag(encoder, &tag, error))
+ LogError(error);
+}
+
+static void
+recorder_output_send_tag(AudioOutput *ao, const Tag *tag)
+{
+ RecorderOutput &recorder = *(RecorderOutput *)ao;
+
+ recorder.SendTag(*tag);
+}
+
static size_t
recorder_output_play(AudioOutput *ao, const void *chunk, size_t size,
Error &error)
@@ -264,7 +285,7 @@ const struct AudioOutputPlugin recorder_output_plugin = {
recorder_output_open,
recorder_output_close,
nullptr,
- nullptr,
+ recorder_output_send_tag,
recorder_output_play,
nullptr,
nullptr,