aboutsummaryrefslogtreecommitdiffstats
path: root/src/encoder
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-07-20 20:54:34 +0200
committerMax Kellermann <max@duempel.org>2011-07-20 20:54:34 +0200
commit838f7cd210dbd3f071d48d54c168c123c3d20c58 (patch)
tree7ded7d68cbd7130b542094f08b50c4e10972a075 /src/encoder
parent13539961b25940ca6d28c28ab7972c244681e3b5 (diff)
downloadmpd-838f7cd210dbd3f071d48d54c168c123c3d20c58.tar.gz
mpd-838f7cd210dbd3f071d48d54c168c123c3d20c58.tar.xz
mpd-838f7cd210dbd3f071d48d54c168c123c3d20c58.zip
encoder_plugin: add method pre_tag()
In the "vorbis" plugin, this is a copy of the old flush() method, while flush() gets a lot of code remove, it just sets the "flush" flag and nothing else. It doesn't start a new stream now, which should fix a few problems in some players.
Diffstat (limited to 'src/encoder')
-rw-r--r--src/encoder/vorbis_encoder.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/encoder/vorbis_encoder.c b/src/encoder/vorbis_encoder.c
index 08147be1c..38a998bd2 100644
--- a/src/encoder/vorbis_encoder.c
+++ b/src/encoder/vorbis_encoder.c
@@ -266,6 +266,15 @@ vorbis_encoder_flush(struct encoder *_encoder, G_GNUC_UNUSED GError **error)
{
struct vorbis_encoder *encoder = (struct vorbis_encoder *)_encoder;
+ encoder->flush = true;
+ return true;
+}
+
+static bool
+vorbis_encoder_pre_tag(struct encoder *_encoder, G_GNUC_UNUSED GError **error)
+{
+ struct vorbis_encoder *encoder = (struct vorbis_encoder *)_encoder;
+
vorbis_analysis_wrote(&encoder->vd, 0);
vorbis_encoder_blockout(encoder);
@@ -366,6 +375,7 @@ vorbis_encoder_read(struct encoder *_encoder, void *_dest, size_t length)
if (ret == 0 && encoder->flush) {
encoder->flush = false;
ret = ogg_stream_flush(&encoder->os, &page);
+
}
if (ret == 0)
@@ -398,6 +408,7 @@ const struct encoder_plugin vorbis_encoder_plugin = {
.open = vorbis_encoder_open,
.close = vorbis_encoder_close,
.flush = vorbis_encoder_flush,
+ .pre_tag = vorbis_encoder_pre_tag,
.tag = vorbis_encoder_tag,
.write = vorbis_encoder_write,
.read = vorbis_encoder_read,