diff options
| author | Jon Bergli Heier <snakebite@jvnv.net> | 2010-09-05 18:26:30 +0200 | 
|---|---|---|
| committer | Jon Bergli Heier <snakebite@jvnv.net> | 2010-09-05 18:26:30 +0200 | 
| commit | 30aa38e29a03250192c3c0d4faa3c37a9d4d0357 (patch) | |
| tree | e18de4873a9f3e993086b9cfdd1b5c2a3dcc171f /decoders | |
| parent | b6567cbdf77f0ebf1790b1e7d800ad4df88253ca (diff) | |
Rewrote encoder/decoder setup to use streams instead of buffers.
Diffstat (limited to 'decoders')
| -rw-r--r-- | decoders/decoder_mpg123.c | 14 | 
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;  } | 
