summaryrefslogtreecommitdiff
path: root/decoders/decoder_mpg123.c
diff options
context:
space:
mode:
Diffstat (limited to 'decoders/decoder_mpg123.c')
-rw-r--r--decoders/decoder_mpg123.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/decoders/decoder_mpg123.c b/decoders/decoder_mpg123.c
index e80bac3..a7cf3d0 100644
--- a/decoders/decoder_mpg123.c
+++ b/decoders/decoder_mpg123.c
@@ -29,13 +29,19 @@ static gboolean mpg123_decoder_init(gpointer *data) {
return TRUE;
}
-static gssize mpg123_decoder_decode(gpointer data, const guchar *inbuf,
- gsize inbuf_size, guchar *outbuf, gsize outbuf_size) {
+static gssize mpg123_decoder_decode(gpointer data, GInputStream *input,
+ GOutputStream *output) {
mpg123_handle *handle = data;
gssize size;
int ret;
+ const int inbuf_size = 0x400*8;
+ const int outbuf_size = 0x400*8;
+ char inbuf[inbuf_size];
+ char outbuf[inbuf_size];
- if(mpg123_feed(handle, inbuf, inbuf_size) != MPG123_OK) {
+ gsize inbuf_read = g_input_stream_read(input, inbuf, inbuf_size, NULL, NULL);
+
+ if(mpg123_feed(handle, inbuf, inbuf_read) != MPG123_OK) {
g_debug("asdfasdf");
g_warning(mpg123_strerror(handle));
return -1;
@@ -57,6 +63,8 @@ static gssize mpg123_decoder_decode(gpointer data, const guchar *inbuf,
return -1;
}
+ g_output_stream_write(output, outbuf, size, NULL, NULL);
+
return size;
}