Commit ccbb5c3e authored by Max Kellermann's avatar Max Kellermann

decoder/audiofile: log libaudiofile errors

parent 49b63e08
...@@ -31,6 +31,7 @@ ver 0.19 (not yet released) ...@@ -31,6 +31,7 @@ ver 0.19 (not yet released)
* decoder: * decoder:
- vorbis, flac, opus: honor DESCRIPTION= tag in Xiph-based files as a comment to the song - vorbis, flac, opus: honor DESCRIPTION= tag in Xiph-based files as a comment to the song
- audiofile: support scanning remote files - audiofile: support scanning remote files
- audiofile: log libaudiofile errors
* encoder: * encoder:
- shine: new encoder plugin - shine: new encoder plugin
* threads: * threads:
......
...@@ -36,6 +36,19 @@ ...@@ -36,6 +36,19 @@
static constexpr Domain audiofile_domain("audiofile"); 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 { struct AudioFileInputStream {
Decoder *const decoder; Decoder *const decoder;
InputStream &is; InputStream &is;
...@@ -178,10 +191,8 @@ audiofile_stream_decode(Decoder &decoder, InputStream &is) ...@@ -178,10 +191,8 @@ audiofile_stream_decode(Decoder &decoder, InputStream &is)
AFvirtualfile *const vf = setup_virtual_fops(afis); AFvirtualfile *const vf = setup_virtual_fops(afis);
const AFfilehandle fh = afOpenVirtualFile(vf, "r", nullptr); const AFfilehandle fh = afOpenVirtualFile(vf, "r", nullptr);
if (fh == AF_NULL_FILEHANDLE) { if (fh == AF_NULL_FILEHANDLE)
LogWarning(audiofile_domain, "failed to input stream");
return; return;
}
Error error; Error error;
AudioFormat audio_format; AudioFormat audio_format;
...@@ -275,7 +286,7 @@ static const char *const audiofile_mime_types[] = { ...@@ -275,7 +286,7 @@ static const char *const audiofile_mime_types[] = {
const struct DecoderPlugin audiofile_decoder_plugin = { const struct DecoderPlugin audiofile_decoder_plugin = {
"audiofile", "audiofile",
nullptr, audiofile_init,
nullptr, nullptr,
audiofile_stream_decode, audiofile_stream_decode,
nullptr, nullptr,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment