From 6773adc7716eea7656c4590b54f7c99840ff4087 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 11 May 2014 15:34:48 +0200 Subject: InputStream: convert to class --- src/decoder/DecoderBuffer.hxx | 2 +- src/decoder/DecoderPlugin.hxx | 2 +- src/decoder/DecoderThread.cxx | 7 ++++--- src/decoder/plugins/DsdLib.hxx | 2 +- src/decoder/plugins/FfmpegDecoderPlugin.cxx | 6 +++--- src/decoder/plugins/FlacInput.hxx | 2 +- src/decoder/plugins/OggCodec.hxx | 2 +- src/decoder/plugins/OggUtil.hxx | 2 +- src/decoder/plugins/WavpackDecoderPlugin.cxx | 2 +- 9 files changed, 14 insertions(+), 13 deletions(-) (limited to 'src/decoder') diff --git a/src/decoder/DecoderBuffer.hxx b/src/decoder/DecoderBuffer.hxx index 4cadd7740..d6f303c36 100644 --- a/src/decoder/DecoderBuffer.hxx +++ b/src/decoder/DecoderBuffer.hxx @@ -32,7 +32,7 @@ struct DecoderBuffer; struct Decoder; -struct InputStream; +class InputStream; template struct ConstBuffer; diff --git a/src/decoder/DecoderPlugin.hxx b/src/decoder/DecoderPlugin.hxx index fd255ffb8..dbf3db9aa 100644 --- a/src/decoder/DecoderPlugin.hxx +++ b/src/decoder/DecoderPlugin.hxx @@ -23,7 +23,7 @@ #include "Compiler.h" struct config_param; -struct InputStream; +class InputStream; struct tag_handler; class Path; diff --git a/src/decoder/DecoderThread.cxx b/src/decoder/DecoderThread.cxx index 37b45bd24..4dd3c215c 100644 --- a/src/decoder/DecoderThread.cxx +++ b/src/decoder/DecoderThread.cxx @@ -87,7 +87,7 @@ decoder_input_stream_open(DecoderControl &dc, const char *uri) dc.Lock(); is->Update(); - while (!is->ready && + while (!is->IsReady() && dc.command != DecoderCommand::STOP) { dc.Wait(); @@ -114,7 +114,7 @@ decoder_stream_decode(const DecoderPlugin &plugin, assert(plugin.stream_decode != nullptr); assert(decoder.stream_tag == nullptr); assert(decoder.decoder_tag == nullptr); - assert(input_stream.ready); + assert(input_stream.IsReady()); assert(decoder.dc.state == DecoderState::START); FormatDebug(decoder_thread_domain, "probing plugin %s", plugin.name); @@ -179,7 +179,8 @@ decoder_check_plugin_mime(const DecoderPlugin &plugin, const InputStream &is) { assert(plugin.stream_decode != nullptr); - return !is.mime.empty() && plugin.SupportsMimeType(is.mime.c_str()); + const char *mime_type = is.GetMimeType(); + return mime_type != nullptr && plugin.SupportsMimeType(mime_type); } gcc_pure diff --git a/src/decoder/plugins/DsdLib.hxx b/src/decoder/plugins/DsdLib.hxx index 4c5e83114..88a76d72a 100644 --- a/src/decoder/plugins/DsdLib.hxx +++ b/src/decoder/plugins/DsdLib.hxx @@ -27,7 +27,7 @@ #include struct Decoder; -struct InputStream; +class InputStream; struct DsdId { char value[4]; diff --git a/src/decoder/plugins/FfmpegDecoderPlugin.cxx b/src/decoder/plugins/FfmpegDecoderPlugin.cxx index 6310ea7fe..3a0fa7389 100644 --- a/src/decoder/plugins/FfmpegDecoderPlugin.cxx +++ b/src/decoder/plugins/FfmpegDecoderPlugin.cxx @@ -385,7 +385,7 @@ ffmpeg_probe(Decoder *decoder, InputStream &is) AVProbeData avpd; avpd.buf = buffer; avpd.buf_size = nbytes; - avpd.filename = is.uri.c_str(); + avpd.filename = is.GetURI(); return av_probe_input_format(&avpd, true); } @@ -409,7 +409,7 @@ ffmpeg_decode(Decoder &decoder, InputStream &input) //ffmpeg works with ours "fileops" helper AVFormatContext *format_context = nullptr; if (mpd_ffmpeg_open_input(&format_context, stream.io, - input.uri.c_str(), + input.GetURI(), input_format) != 0) { LogError(ffmpeg_domain, "Open failed"); return; @@ -558,7 +558,7 @@ ffmpeg_scan_stream(InputStream &is, return false; AVFormatContext *f = nullptr; - if (mpd_ffmpeg_open_input(&f, stream.io, is.uri.c_str(), + if (mpd_ffmpeg_open_input(&f, stream.io, is.GetURI(), input_format) != 0) return false; diff --git a/src/decoder/plugins/FlacInput.hxx b/src/decoder/plugins/FlacInput.hxx index 30ed55fd0..427abccb4 100644 --- a/src/decoder/plugins/FlacInput.hxx +++ b/src/decoder/plugins/FlacInput.hxx @@ -23,7 +23,7 @@ #include struct Decoder; -struct InputStream; +class InputStream; /** * This class wraps an #InputStream in libFLAC stream decoder diff --git a/src/decoder/plugins/OggCodec.hxx b/src/decoder/plugins/OggCodec.hxx index 6643d85ad..3b096561c 100644 --- a/src/decoder/plugins/OggCodec.hxx +++ b/src/decoder/plugins/OggCodec.hxx @@ -25,7 +25,7 @@ #define MPD_OGG_CODEC_HXX struct Decoder; -struct InputStream; +class InputStream; enum ogg_codec { OGG_CODEC_UNKNOWN, diff --git a/src/decoder/plugins/OggUtil.hxx b/src/decoder/plugins/OggUtil.hxx index 3289702a3..94c380ef4 100644 --- a/src/decoder/plugins/OggUtil.hxx +++ b/src/decoder/plugins/OggUtil.hxx @@ -26,7 +26,7 @@ #include -struct InputStream; +class InputStream; struct Decoder; /** diff --git a/src/decoder/plugins/WavpackDecoderPlugin.cxx b/src/decoder/plugins/WavpackDecoderPlugin.cxx index 27bede56c..070a913f2 100644 --- a/src/decoder/plugins/WavpackDecoderPlugin.cxx +++ b/src/decoder/plugins/WavpackDecoderPlugin.cxx @@ -487,7 +487,7 @@ wavpack_streamdecode(Decoder &decoder, InputStream &is) bool can_seek = is.seekable; wavpack_input isp_wvc; - InputStream *is_wvc = wavpack_open_wvc(decoder, is.uri.c_str(), + InputStream *is_wvc = wavpack_open_wvc(decoder, is.GetURI(), is.mutex, is.cond, &isp_wvc); if (is_wvc != nullptr) { -- cgit v1.2.3