InputStream: add constructor/destructor
Eliminate input_stream_init() and input_stream_deinit().
This commit is contained in:
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user