From dcf55c7e328578d435eb14277cb6ba9e072f7e9c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 28 Jan 2013 20:32:23 +0100 Subject: InputStream: add constructor/destructor Eliminate input_stream_init() and input_stream_deinit(). --- src/input/CdioParanoiaInputPlugin.cxx | 7 ++----- src/input/CurlInputPlugin.cxx | 6 ++---- src/input/DespotifyInputPlugin.cxx | 6 ++---- src/input/FfmpegInputPlugin.cxx | 7 ++----- src/input/FileInputPlugin.cxx | 7 ++----- src/input/MmsInputPlugin.cxx | 6 ++---- src/input/RewindInputPlugin.cxx | 8 +++----- src/input/SoupInputPlugin.cxx | 8 ++------ 8 files changed, 17 insertions(+), 38 deletions(-) (limited to 'src/input') diff --git a/src/input/CdioParanoiaInputPlugin.cxx b/src/input/CdioParanoiaInputPlugin.cxx index 129eb75b..942eefb9 100644 --- a/src/input/CdioParanoiaInputPlugin.cxx +++ b/src/input/CdioParanoiaInputPlugin.cxx @@ -56,11 +56,10 @@ struct CdioParanoiaInputStream { CdioParanoiaInputStream(const char *uri, Mutex &mutex, Cond &cond, int _trackno) - :drv(nullptr), cdio(nullptr), para(nullptr), + :base(input_plugin_cdio_paranoia, uri, mutex, cond), + drv(nullptr), cdio(nullptr), para(nullptr), trackno(_trackno) { - input_stream_init(&base, &input_plugin_cdio_paranoia, uri, - mutex, cond); } ~CdioParanoiaInputStream() { @@ -70,8 +69,6 @@ struct CdioParanoiaInputStream { cdio_cddap_close_no_free_cdio(drv); if (cdio != nullptr) cdio_destroy(cdio); - - input_stream_deinit(&base); } }; diff --git a/src/input/CurlInputPlugin.cxx b/src/input/CurlInputPlugin.cxx index 8ed25f9a..0fbfa29d 100644 --- a/src/input/CurlInputPlugin.cxx +++ b/src/input/CurlInputPlugin.cxx @@ -166,12 +166,12 @@ struct input_curl { GError *postponed_error; input_curl(const char *url, Mutex &mutex, Cond &cond) - :range(nullptr), request_headers(nullptr), + :base(input_plugin_curl, url, mutex, cond), + range(nullptr), request_headers(nullptr), paused(false), meta_name(nullptr), tag(nullptr), postponed_error(nullptr) { - input_stream_init(&base, &input_plugin_curl, url, mutex, cond); } ~input_curl(); @@ -705,8 +705,6 @@ input_curl::~input_curl() if (postponed_error != NULL) g_error_free(postponed_error); - - input_stream_deinit(&base); } static bool diff --git a/src/input/DespotifyInputPlugin.cxx b/src/input/DespotifyInputPlugin.cxx index 669ebd03..1e5a8c60 100644 --- a/src/input/DespotifyInputPlugin.cxx +++ b/src/input/DespotifyInputPlugin.cxx @@ -51,11 +51,10 @@ struct DespotifyInputStream { Mutex &mutex, Cond &cond, despotify_session *_session, ds_track *_track) - :session(_session), track(_track), + :base(input_plugin_despotify, uri, mutex, cond), + session(_session), track(_track), tag(mpd_despotify_tag_from_track(track)), len_available(0), eof(false) { - input_stream_init(&base, &input_plugin_despotify, uri, - mutex, cond); memset(&pcm, 0, sizeof(pcm)); @@ -69,7 +68,6 @@ struct DespotifyInputStream { tag_free(tag); despotify_free_track(track); - input_stream_deinit(&base); } }; diff --git a/src/input/FfmpegInputPlugin.cxx b/src/input/FfmpegInputPlugin.cxx index 2e44f74b..1660f177 100644 --- a/src/input/FfmpegInputPlugin.cxx +++ b/src/input/FfmpegInputPlugin.cxx @@ -44,10 +44,8 @@ struct FfmpegInputStream { FfmpegInputStream(const char *uri, Mutex &mutex, Cond &cond, AVIOContext *_h) - :h(_h), eof(false) { - input_stream_init(&base, &input_plugin_ffmpeg, - uri, mutex, cond); - + :base(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); @@ -61,7 +59,6 @@ struct FfmpegInputStream { ~FfmpegInputStream() { avio_close(h); - input_stream_deinit(&base); } }; diff --git a/src/input/FileInputPlugin.cxx b/src/input/FileInputPlugin.cxx index 7681ee0c..2eecf32b 100644 --- a/src/input/FileInputPlugin.cxx +++ b/src/input/FileInputPlugin.cxx @@ -42,10 +42,8 @@ struct FileInputStream { FileInputStream(const char *path, int _fd, off_t size, Mutex &mutex, Cond &cond) - :fd(_fd) { - input_stream_init(&base, &input_plugin_file, path, - mutex, cond); - + :base(input_plugin_file, path, mutex, cond), + fd(_fd) { base.size = size; base.seekable = true; base.ready = true; @@ -53,7 +51,6 @@ struct FileInputStream { ~FileInputStream() { close(fd); - input_stream_deinit(&base); } }; diff --git a/src/input/MmsInputPlugin.cxx b/src/input/MmsInputPlugin.cxx index be583e28..b347eb92 100644 --- a/src/input/MmsInputPlugin.cxx +++ b/src/input/MmsInputPlugin.cxx @@ -42,9 +42,8 @@ struct MmsInputStream { MmsInputStream(const char *uri, Mutex &mutex, Cond &cond, mmsx_t *_mms) - :mms(_mms), eof(false) { - input_stream_init(&base, &input_plugin_mms, uri, mutex, cond); - + :base(input_plugin_mms, uri, mutex, cond), + mms(_mms), eof(false) { /* XX is this correct? at least this selects the ffmpeg decoder, which seems to work fine*/ base.mime = g_strdup("audio/x-ms-wma"); @@ -54,7 +53,6 @@ struct MmsInputStream { ~MmsInputStream() { mmsx_close(mms); - input_stream_deinit(&base); } }; diff --git a/src/input/RewindInputPlugin.cxx b/src/input/RewindInputPlugin.cxx index bc428e7a..6c0093a3 100644 --- a/src/input/RewindInputPlugin.cxx +++ b/src/input/RewindInputPlugin.cxx @@ -61,15 +61,13 @@ struct RewindInputStream { char buffer[64 * 1024]; RewindInputStream(input_stream *_input) - :input(_input), tail(0) { - input_stream_init(&base, &rewind_input_plugin, input->uri, - *input->mutex, *input->cond); + :base(rewind_input_plugin, _input->uri, + *_input->mutex, *_input->cond), + input(_input), tail(0) { } ~RewindInputStream() { input_stream_close(input); - - input_stream_deinit(&base); } /** diff --git a/src/input/SoupInputPlugin.cxx b/src/input/SoupInputPlugin.cxx index b781cd44..6615a3c7 100644 --- a/src/input/SoupInputPlugin.cxx +++ b/src/input/SoupInputPlugin.cxx @@ -278,14 +278,12 @@ input_soup_queue(gpointer data) SoupInputStream::SoupInputStream(const char *uri, Mutex &mutex, Cond &cond) - :buffers(g_queue_new()), + :base(input_plugin_soup, uri, mutex, cond), + buffers(g_queue_new()), current_consumed(0), total_buffered(0), alive(false), pause(false), eof(false), completed(false), postponed_error(nullptr) { - input_stream_init(&base, &input_plugin_soup, uri, - mutex, cond); - #if GCC_CHECK_VERSION(4,6) #pragma GCC diagnostic push /* the libsoup macro SOUP_METHOD_GET discards the "const" @@ -365,8 +363,6 @@ SoupInputStream::~SoupInputStream() if (postponed_error != NULL) g_error_free(postponed_error); - - input_stream_deinit(&base); } static void -- cgit v1.2.3