From fd1b04932a07e146a0a3c4ce52ace068a112587b Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 11 May 2014 18:25:55 +0200 Subject: InputStream: remove attribute "plugin" --- src/input/InputStream.hxx | 15 ++------------- src/input/ThreadInputStream.cxx | 2 +- src/input/ThreadInputStream.hxx | 7 +++++-- src/input/plugins/AlsaInputPlugin.cxx | 2 +- src/input/plugins/CdioParanoiaInputPlugin.cxx | 2 +- src/input/plugins/CurlInputPlugin.cxx | 2 +- src/input/plugins/DespotifyInputPlugin.cxx | 2 +- src/input/plugins/FfmpegInputPlugin.cxx | 2 +- src/input/plugins/FileInputPlugin.cxx | 2 +- src/input/plugins/MmsInputPlugin.cxx | 2 +- src/input/plugins/NfsInputPlugin.cxx | 2 +- src/input/plugins/RewindInputPlugin.cxx | 9 +-------- src/input/plugins/SmbclientInputPlugin.cxx | 2 +- 13 files changed, 18 insertions(+), 33 deletions(-) (limited to 'src/input') diff --git a/src/input/InputStream.hxx b/src/input/InputStream.hxx index b1f8c0d8c..13f6af32b 100644 --- a/src/input/InputStream.hxx +++ b/src/input/InputStream.hxx @@ -32,18 +32,12 @@ class Cond; class Error; struct Tag; -struct InputPlugin; class InputStream { public: typedef int64_t offset_type; private: - /** - * the plugin which implements this input stream - */ - const InputPlugin &plugin; - /** * The absolute URI which was used to open this stream. */ @@ -99,9 +93,8 @@ private: std::string mime; public: - InputStream(const InputPlugin &_plugin, - const char *_uri, Mutex &_mutex, Cond &_cond) - :plugin(_plugin), uri(_uri), + InputStream(const char *_uri, Mutex &_mutex, Cond &_cond) + :uri(_uri), mutex(_mutex), cond(_cond), ready(false), seekable(false), size(-1), offset(0) { @@ -140,10 +133,6 @@ public: Mutex &mutex, Cond &cond, Error &error); - const InputPlugin &GetPlugin() const { - return plugin; - } - /** * The absolute URI which was used to open this stream. * diff --git a/src/input/ThreadInputStream.cxx b/src/input/ThreadInputStream.cxx index efbb8c9f9..4311d63ae 100644 --- a/src/input/ThreadInputStream.cxx +++ b/src/input/ThreadInputStream.cxx @@ -67,7 +67,7 @@ ThreadInputStream::Start(Error &error) inline void ThreadInputStream::ThreadFunc() { - FormatThreadName("input:%s", GetPlugin().name); + FormatThreadName("input:%s", plugin); Lock(); if (!Open(postponed_error)) { diff --git a/src/input/ThreadInputStream.hxx b/src/input/ThreadInputStream.hxx index 4d4ec3972..c6ac7669c 100644 --- a/src/input/ThreadInputStream.hxx +++ b/src/input/ThreadInputStream.hxx @@ -40,6 +40,8 @@ template class CircularBuffer; * This works only for "streams": unknown length, no seeking, no tags. */ class ThreadInputStream : public InputStream { + const char *const plugin; + Thread thread; /** @@ -65,10 +67,11 @@ class ThreadInputStream : public InputStream { bool eof; public: - ThreadInputStream(const InputPlugin &_plugin, + ThreadInputStream(const char *_plugin, const char *_uri, Mutex &_mutex, Cond &_cond, size_t _buffer_size) - :InputStream(_plugin, _uri, _mutex, _cond), + :InputStream(_uri, _mutex, _cond), + plugin(_plugin), buffer_size(_buffer_size), buffer(nullptr), close(false), eof(false) {} diff --git a/src/input/plugins/AlsaInputPlugin.cxx b/src/input/plugins/AlsaInputPlugin.cxx index b4673afcf..82b96f7df 100644 --- a/src/input/plugins/AlsaInputPlugin.cxx +++ b/src/input/plugins/AlsaInputPlugin.cxx @@ -84,7 +84,7 @@ public: AlsaInputStream(EventLoop &loop, const char *_uri, Mutex &_mutex, Cond &_cond, snd_pcm_t *_handle, int _frame_size) - :InputStream(input_plugin_alsa, _uri, _mutex, _cond), + :InputStream(_uri, _mutex, _cond), MultiSocketMonitor(loop), DeferredMonitor(loop), capture_handle(_handle), diff --git a/src/input/plugins/CdioParanoiaInputPlugin.cxx b/src/input/plugins/CdioParanoiaInputPlugin.cxx index a5c848f68..9b6f7437e 100644 --- a/src/input/plugins/CdioParanoiaInputPlugin.cxx +++ b/src/input/plugins/CdioParanoiaInputPlugin.cxx @@ -65,7 +65,7 @@ struct CdioParanoiaInputStream final : public InputStream { CdioParanoiaInputStream(const char *_uri, Mutex &_mutex, Cond &_cond, int _trackno) - :InputStream(input_plugin_cdio_paranoia, _uri, _mutex, _cond), + :InputStream(_uri, _mutex, _cond), drv(nullptr), cdio(nullptr), para(nullptr), trackno(_trackno) { diff --git a/src/input/plugins/CurlInputPlugin.cxx b/src/input/plugins/CurlInputPlugin.cxx index bb7ddcfdb..1b00258ea 100644 --- a/src/input/plugins/CurlInputPlugin.cxx +++ b/src/input/plugins/CurlInputPlugin.cxx @@ -106,7 +106,7 @@ struct CurlInputStream final : public InputStream { CurlInputStream(const char *_url, Mutex &_mutex, Cond &_cond, void *_buffer) - :InputStream(input_plugin_curl, _url, _mutex, _cond), + :InputStream(_url, _mutex, _cond), request_headers(nullptr), buffer((uint8_t *)_buffer, CURL_MAX_BUFFERED), paused(false), diff --git a/src/input/plugins/DespotifyInputPlugin.cxx b/src/input/plugins/DespotifyInputPlugin.cxx index faceb6057..29d9186d0 100644 --- a/src/input/plugins/DespotifyInputPlugin.cxx +++ b/src/input/plugins/DespotifyInputPlugin.cxx @@ -48,7 +48,7 @@ class DespotifyInputStream final : public InputStream { Mutex &_mutex, Cond &_cond, despotify_session *_session, ds_track *_track) - :InputStream(input_plugin_despotify, _uri, _mutex, _cond), + :InputStream(_uri, _mutex, _cond), session(_session), track(_track), tag(mpd_despotify_tag_from_track(*track)), len_available(0), eof(false) { diff --git a/src/input/plugins/FfmpegInputPlugin.cxx b/src/input/plugins/FfmpegInputPlugin.cxx index de79a09ed..9ae07dbef 100644 --- a/src/input/plugins/FfmpegInputPlugin.cxx +++ b/src/input/plugins/FfmpegInputPlugin.cxx @@ -40,7 +40,7 @@ struct FfmpegInputStream final : public InputStream { FfmpegInputStream(const char *_uri, Mutex &_mutex, Cond &_cond, AVIOContext *_h) - :InputStream(input_plugin_ffmpeg, _uri, _mutex, _cond), + :InputStream(_uri, _mutex, _cond), h(_h), eof(false) { seekable = (h->seekable & AVIO_SEEKABLE_NORMAL) != 0; size = avio_size(h); diff --git a/src/input/plugins/FileInputPlugin.cxx b/src/input/plugins/FileInputPlugin.cxx index 7c7b4e85f..1035973b6 100644 --- a/src/input/plugins/FileInputPlugin.cxx +++ b/src/input/plugins/FileInputPlugin.cxx @@ -38,7 +38,7 @@ struct FileInputStream final : public InputStream { FileInputStream(const char *path, int _fd, off_t _size, Mutex &_mutex, Cond &_cond) - :InputStream(input_plugin_file, path, _mutex, _cond), + :InputStream(path, _mutex, _cond), fd(_fd) { size = _size; seekable = true; diff --git a/src/input/plugins/MmsInputPlugin.cxx b/src/input/plugins/MmsInputPlugin.cxx index b1ff6a890..1aed9c662 100644 --- a/src/input/plugins/MmsInputPlugin.cxx +++ b/src/input/plugins/MmsInputPlugin.cxx @@ -34,7 +34,7 @@ class MmsInputStream final : public ThreadInputStream { public: MmsInputStream(const char *_uri, Mutex &_mutex, Cond &_cond) - :ThreadInputStream(input_plugin_mms, _uri, _mutex, _cond, + :ThreadInputStream(input_plugin_mms.name, _uri, _mutex, _cond, MMS_BUFFER_SIZE) { } diff --git a/src/input/plugins/NfsInputPlugin.cxx b/src/input/plugins/NfsInputPlugin.cxx index d667e8f2d..b73389662 100644 --- a/src/input/plugins/NfsInputPlugin.cxx +++ b/src/input/plugins/NfsInputPlugin.cxx @@ -42,7 +42,7 @@ public: Mutex &_mutex, Cond &_cond, nfs_context *_ctx, nfsfh *_fh, InputStream::offset_type _size) - :InputStream(input_plugin_nfs, _uri, _mutex, _cond), + :InputStream(_uri, _mutex, _cond), ctx(_ctx), fh(_fh) { seekable = true; size = _size; diff --git a/src/input/plugins/RewindInputPlugin.cxx b/src/input/plugins/RewindInputPlugin.cxx index b11fd8b80..80f3beea1 100644 --- a/src/input/plugins/RewindInputPlugin.cxx +++ b/src/input/plugins/RewindInputPlugin.cxx @@ -26,13 +26,6 @@ #include #include -static const InputPlugin rewind_input_plugin = { - nullptr, - nullptr, - nullptr, - nullptr, -}; - class RewindInputStream final : public InputStream { InputStream *input; @@ -59,7 +52,7 @@ class RewindInputStream final : public InputStream { public: RewindInputStream(InputStream *_input) - :InputStream(rewind_input_plugin, _input->GetURI(), + :InputStream(_input->GetURI(), _input->mutex, _input->cond), input(_input), tail(0) { } diff --git a/src/input/plugins/SmbclientInputPlugin.cxx b/src/input/plugins/SmbclientInputPlugin.cxx index 01ee2616a..aa1ba0381 100644 --- a/src/input/plugins/SmbclientInputPlugin.cxx +++ b/src/input/plugins/SmbclientInputPlugin.cxx @@ -36,7 +36,7 @@ public: SmbclientInputStream(const char *_uri, Mutex &_mutex, Cond &_cond, SMBCCTX *_ctx, int _fd, const struct stat &st) - :InputStream(input_plugin_smbclient, _uri, _mutex, _cond), + :InputStream(_uri, _mutex, _cond), ctx(_ctx), fd(_fd) { seekable = true; size = st.st_size; -- cgit v1.2.3