summaryrefslogtreecommitdiff
path: root/encoders/encoder_lame.c
diff options
context:
space:
mode:
Diffstat (limited to 'encoders/encoder_lame.c')
-rw-r--r--encoders/encoder_lame.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/encoders/encoder_lame.c b/encoders/encoder_lame.c
index ec50047..b28e52e 100644
--- a/encoders/encoder_lame.c
+++ b/encoders/encoder_lame.c
@@ -12,13 +12,21 @@ static gboolean lame_encoder_init(gpointer *data) {
return (ret >= 0 ? TRUE : FALSE);
}
-static gssize lame_encoder_encode(gpointer data, const guchar *inbuf, gsize inbuf_size,
- guchar *outbuf, gsize outbuf_size) {
+static gssize lame_encoder_encode(gpointer data, GInputStream *input,
+ GOutputStream *output) {
lame_global_flags *gfp = data;
+ const inbuf_size = 0x400*8;
+ const outbuf_size = 0x400*8;
+ gchar inbuf[inbuf_size];
+ gchar outbuf[inbuf_size];
- int ret = lame_encode_buffer_interleaved(gfp, (short*)inbuf, inbuf_size / 4,
+ int inbuf_read = g_input_stream_read(input, inbuf, inbuf_size, NULL, NULL);
+
+ int ret = lame_encode_buffer_interleaved(gfp, (short*)inbuf, inbuf_read / 4,
outbuf, outbuf_size);
+ g_output_stream_write(output, outbuf, ret, NULL, NULL);
+
return ret;
}