aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/plugins
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-07-10 09:32:33 +0200
committerMax Kellermann <max@duempel.org>2014-07-10 09:37:43 +0200
commitccbb5c3e01682ccdd44a34b66a2eb213b2a1d661 (patch)
tree76760b74d1c36b6cb27edf4dfa4826570f131784 /src/decoder/plugins
parent49b63e084f3fc52d998af5a442e14f3b7f8d2a81 (diff)
downloadmpd-ccbb5c3e01682ccdd44a34b66a2eb213b2a1d661.tar.gz
mpd-ccbb5c3e01682ccdd44a34b66a2eb213b2a1d661.tar.xz
mpd-ccbb5c3e01682ccdd44a34b66a2eb213b2a1d661.zip
decoder/audiofile: log libaudiofile errors
Diffstat (limited to 'src/decoder/plugins')
-rw-r--r--src/decoder/plugins/AudiofileDecoderPlugin.cxx19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/decoder/plugins/AudiofileDecoderPlugin.cxx b/src/decoder/plugins/AudiofileDecoderPlugin.cxx
index 324dacfed..603f714d1 100644
--- a/src/decoder/plugins/AudiofileDecoderPlugin.cxx
+++ b/src/decoder/plugins/AudiofileDecoderPlugin.cxx
@@ -36,6 +36,19 @@
static constexpr Domain audiofile_domain("audiofile");
+static void
+audiofile_error_func(long, const char *msg)
+{
+ LogWarning(audiofile_domain, msg);
+}
+
+static bool
+audiofile_init(const config_param &)
+{
+ afSetErrorHandler(audiofile_error_func);
+ return true;
+}
+
struct AudioFileInputStream {
Decoder *const decoder;
InputStream &is;
@@ -178,10 +191,8 @@ audiofile_stream_decode(Decoder &decoder, InputStream &is)
AFvirtualfile *const vf = setup_virtual_fops(afis);
const AFfilehandle fh = afOpenVirtualFile(vf, "r", nullptr);
- if (fh == AF_NULL_FILEHANDLE) {
- LogWarning(audiofile_domain, "failed to input stream");
+ if (fh == AF_NULL_FILEHANDLE)
return;
- }
Error error;
AudioFormat audio_format;
@@ -275,7 +286,7 @@ static const char *const audiofile_mime_types[] = {
const struct DecoderPlugin audiofile_decoder_plugin = {
"audiofile",
- nullptr,
+ audiofile_init,
nullptr,
audiofile_stream_decode,
nullptr,