From f1d07002521a4a98acf130127cf42aef20a5e258 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 11 May 2014 16:02:57 +0200 Subject: input/plugins: make InputStream the base class Prepare for adding virtual methods. --- src/input/plugins/FfmpegInputPlugin.cxx | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/input/plugins/FfmpegInputPlugin.cxx') 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 } -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 -- cgit v1.2.3