aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder_thread.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-08-08 21:54:54 +0200
committerMax Kellermann <max@duempel.org>2012-08-08 22:38:16 +0200
commit8c425c758c9217b3388ca5bc1ea2883a1c3c2bc6 (patch)
tree9ecf8a7652966be4f0655f8a377d6c2613ec88db /src/decoder_thread.c
parent0b9e91229791e143d5da79f14cf7012ead9c3bc7 (diff)
downloadmpd-8c425c758c9217b3388ca5bc1ea2883a1c3c2bc6.tar.gz
mpd-8c425c758c9217b3388ca5bc1ea2883a1c3c2bc6.tar.xz
mpd-8c425c758c9217b3388ca5bc1ea2883a1c3c2bc6.zip
decoder_control: add GError attribute
Diffstat (limited to '')
-rw-r--r--src/decoder_thread.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/decoder_thread.c b/src/decoder_thread.c
index 1440fc272..11d96b35c 100644
--- a/src/decoder_thread.c
+++ b/src/decoder_thread.c
@@ -19,6 +19,7 @@
#include "config.h"
#include "decoder_thread.h"
+#include "decoder_error.h"
#include "decoder_control.h"
#include "decoder_internal.h"
#include "decoder_list.h"
@@ -428,12 +429,27 @@ decoder_run_song(struct decoder_control *dc,
decoder_lock(dc);
- dc->state = ret ? DECODE_STATE_STOP : DECODE_STATE_ERROR;
+ if (ret)
+ dc->state = DECODE_STATE_STOP;
+ else {
+ dc->state = DECODE_STATE_ERROR;
+
+ const char *error_uri = song->uri;
+ char *allocated = uri_remove_auth(error_uri);
+ if (allocated != NULL)
+ error_uri = allocated;
+
+ dc->error = g_error_new(decoder_quark(), 0,
+ "Failed to decode %s", error_uri);
+ g_free(allocated);
+ }
}
static void
decoder_run(struct decoder_control *dc)
{
+ dc_clear_error(dc);
+
const struct song *song = dc->song;
char *uri;