aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/FfmpegDecoderPlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-08-10 18:02:44 +0200
committerMax Kellermann <max@duempel.org>2013-09-04 18:14:22 +0200
commit29030b54c98b0aee65fbc10ebf7ba36bed98c02c (patch)
tree79766830b55ebca38ddbce84d8d548227eedb69e /src/decoder/FfmpegDecoderPlugin.cxx
parentc9fcc7f14860777458153eb2d13c773ccfa1daa2 (diff)
downloadmpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.tar.gz
mpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.tar.xz
mpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.zip
util/Error: new error passing library
Replaces GLib's GError.
Diffstat (limited to 'src/decoder/FfmpegDecoderPlugin.cxx')
-rw-r--r--src/decoder/FfmpegDecoderPlugin.cxx15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/decoder/FfmpegDecoderPlugin.cxx b/src/decoder/FfmpegDecoderPlugin.cxx
index cf162b918..305662e6c 100644
--- a/src/decoder/FfmpegDecoderPlugin.cxx
+++ b/src/decoder/FfmpegDecoderPlugin.cxx
@@ -27,6 +27,7 @@
#include "TagHandler.hxx"
#include "InputStream.hxx"
#include "CheckAudioFormat.hxx"
+#include "util/Error.hxx"
#include <glib.h>
@@ -124,7 +125,8 @@ mpd_ffmpeg_stream_seek(void *opaque, int64_t pos, int whence)
if (whence == AVSEEK_SIZE)
return stream->input->size;
- if (!input_stream_lock_seek(stream->input, pos, whence, NULL))
+ Error error;
+ if (!input_stream_lock_seek(stream->input, pos, whence, error))
return -1;
return stream->input->offset;
@@ -343,10 +345,12 @@ ffmpeg_probe(struct decoder *decoder, struct input_stream *is)
PADDING = 16,
};
+ Error error;
+
unsigned char *buffer = (unsigned char *)g_malloc(BUFFER_SIZE);
size_t nbytes = decoder_read(decoder, is, buffer, BUFFER_SIZE);
if (nbytes <= PADDING ||
- !input_stream_lock_seek(is, 0, SEEK_SET, NULL)) {
+ !input_stream_lock_seek(is, 0, SEEK_SET, error)) {
g_free(buffer);
return NULL;
}
@@ -427,14 +431,13 @@ ffmpeg_decode(struct decoder *decoder, struct input_stream *input)
if (sample_format == SampleFormat::UNDEFINED)
return;
- GError *error = NULL;
+ Error error;
AudioFormat audio_format;
if (!audio_format_init_checked(audio_format,
codec_context->sample_rate,
sample_format,
- codec_context->channels, &error)) {
- g_warning("%s", error->message);
- g_error_free(error);
+ codec_context->channels, error)) {
+ g_warning("%s", error.GetMessage());
avformat_close_input(&format_context);
return;
}