From 3a23129ac5110d72040692b229554babc2aa2a99 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Sat, 25 Dec 2010 23:33:46 +0100 Subject: Added encoder_flush() to flush encoder buffers. --- encoders/encoder_lame.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'encoders/encoder_lame.c') diff --git a/encoders/encoder_lame.c b/encoders/encoder_lame.c index 0836d17..ead8f7c 100644 --- a/encoders/encoder_lame.c +++ b/encoders/encoder_lame.c @@ -34,6 +34,14 @@ static gssize lame_encoder_encode(gpointer data, GInputStream *input, return ret; } +static void lame_encoder_flush(gpointer data, GOutputStream *output, GError **error) { + lame_global_flags *gfp = data; + const int outbuf_size = 7200; + unsigned char outbuf[outbuf_size]; + int size = lame_encode_flush(gfp, outbuf, outbuf_size); + g_output_stream_write(output, outbuf, size, NULL, error); +} + static void lame_encoder_close(gpointer data) { lame_global_flags *gfp = data; lame_close(gfp); @@ -43,5 +51,6 @@ const struct encoder_plugin encoder_lame_encoder = { .name = "lame", .init = lame_encoder_init, .encode = lame_encoder_encode, + .flush = lame_encoder_flush, .close = lame_encoder_close, }; -- cgit v1.2.3