summaryrefslogtreecommitdiff
path: root/encoders
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2010-09-05 20:39:32 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2010-09-05 20:39:32 +0200
commita6e733f5f43ced09a06fe2de569e5d6ab6d63604 (patch)
tree28088f41db72bffc7fb290b814a97305ed3e018a /encoders
parente4dedafd25149b200f5c56a992ac57f91ee4f42f (diff)
Added proper error handling to encoders/decoders.
Diffstat (limited to 'encoders')
-rw-r--r--encoders/encoder_lame.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/encoders/encoder_lame.c b/encoders/encoder_lame.c
index bf3baff..0836d17 100644
--- a/encoders/encoder_lame.c
+++ b/encoders/encoder_lame.c
@@ -13,7 +13,7 @@ static gboolean lame_encoder_init(gpointer *data) {
}
static gssize lame_encoder_encode(gpointer data, GInputStream *input,
- GOutputStream *output) {
+ GOutputStream *output, GError **error) {
lame_global_flags *gfp = data;
const int inbuf_size = 0x400*8;
const int outbuf_size = 0x400*8;
@@ -25,7 +25,13 @@ static gssize lame_encoder_encode(gpointer data, GInputStream *input,
int ret = lame_encode_buffer_interleaved(gfp, (short*)inbuf, inbuf_read / 4,
outbuf, outbuf_size);
- return g_output_stream_write(output, outbuf, ret, NULL, NULL);
+ ret = g_output_stream_write(output, outbuf, ret, NULL, error);
+
+ if(ret == 0) {
+ *error = g_error_new(encoder_quark(), ENCODER_CODE_DONE, "encoding done");
+ }
+
+ return ret;
}
static void lame_encoder_close(gpointer data) {