aboutsummaryrefslogtreecommitdiffstats
path: root/src/input/plugins/FfmpegInputPlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-05-11 16:02:57 +0200
committerMax Kellermann <max@duempel.org>2014-05-11 17:12:50 +0200
commitf1d07002521a4a98acf130127cf42aef20a5e258 (patch)
tree9eb3b7c5d2aefc47a6ae30055f5257f0a9a55bea /src/input/plugins/FfmpegInputPlugin.cxx
parente1383a2d8e31bdbe4c0472006d7be5c22cc8345f (diff)
downloadmpd-f1d07002521a4a98acf130127cf42aef20a5e258.tar.gz
mpd-f1d07002521a4a98acf130127cf42aef20a5e258.tar.xz
mpd-f1d07002521a4a98acf130127cf42aef20a5e258.zip
input/plugins: make InputStream the base class
Prepare for adding virtual methods.
Diffstat (limited to 'src/input/plugins/FfmpegInputPlugin.cxx')
-rw-r--r--src/input/plugins/FfmpegInputPlugin.cxx19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/input/plugins/FfmpegInputPlugin.cxx b/src/input/plugins/FfmpegInputPlugin.cxx
index d06d4705a..affd76718 100644
--- a/src/input/plugins/FfmpegInputPlugin.cxx
+++ b/src/input/plugins/FfmpegInputPlugin.cxx
@@ -33,26 +33,24 @@ extern "C" {
#include <libavformat/avformat.h>
}
-struct FfmpegInputStream {
- InputStream base;
-
+struct FfmpegInputStream final : public InputStream {
AVIOContext *h;
bool eof;
- FfmpegInputStream(const char *uri, Mutex &mutex, Cond &cond,
+ FfmpegInputStream(const char *_uri, Mutex &_mutex, Cond &_cond,
AVIOContext *_h)
- :base(input_plugin_ffmpeg, uri, mutex, cond),
+ :InputStream(input_plugin_ffmpeg, _uri, _mutex, _cond),
h(_h), eof(false) {
- base.ready = true;
- base.seekable = (h->seekable & AVIO_SEEKABLE_NORMAL) != 0;
- base.size = avio_size(h);
+ seekable = (h->seekable & AVIO_SEEKABLE_NORMAL) != 0;
+ size = avio_size(h);
/* hack to make MPD select the "ffmpeg" decoder plugin
- since avio.h doesn't tell us the MIME type of the
resource, we can't select a decoder plugin, but the
"ffmpeg" plugin is quite good at auto-detection */
- base.SetMimeType("audio/x-mpd-ffmpeg");
+ SetMimeType("audio/x-mpd-ffmpeg");
+ SetReady();
}
~FfmpegInputStream() {
@@ -105,8 +103,7 @@ input_ffmpeg_open(const char *uri,
return nullptr;
}
- auto *i = new FfmpegInputStream(uri, mutex, cond, h);
- return &i->base;
+ return new FfmpegInputStream(uri, mutex, cond, h);
}
static size_t