aboutsummaryrefslogtreecommitdiffstats
path: root/src/input/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/input/plugins')
-rw-r--r--src/input/plugins/AlsaInputPlugin.cxx5
-rw-r--r--src/input/plugins/CdioParanoiaInputPlugin.cxx6
-rw-r--r--src/input/plugins/CurlInputPlugin.cxx11
-rw-r--r--src/input/plugins/DespotifyInputPlugin.cxx4
-rw-r--r--src/input/plugins/FfmpegInputPlugin.cxx2
-rw-r--r--src/input/plugins/FileInputPlugin.cxx4
-rw-r--r--src/input/plugins/RewindInputPlugin.cxx21
-rw-r--r--src/input/plugins/RewindInputPlugin.hxx2
8 files changed, 27 insertions, 28 deletions
diff --git a/src/input/plugins/AlsaInputPlugin.cxx b/src/input/plugins/AlsaInputPlugin.cxx
index eae06ba6c..129219c01 100644
--- a/src/input/plugins/AlsaInputPlugin.cxx
+++ b/src/input/plugins/AlsaInputPlugin.cxx
@@ -96,8 +96,9 @@ public:
/* this mime type forces use of the PcmDecoderPlugin.
Needs to be generalised when/if that decoder is
updated to support other audio formats */
- base.mime = "audio/x-mpd-cdda-pcm";
- base.ready = true;
+ base.SetMimeType("audio/x-mpd-cdda-pcm");
+ base.SetReady();
+
frames_to_read = read_buffer_size / frame_size;
snd_pcm_start(capture_handle);
diff --git a/src/input/plugins/CdioParanoiaInputPlugin.cxx b/src/input/plugins/CdioParanoiaInputPlugin.cxx
index 767b2600f..5b4ce2ec6 100644
--- a/src/input/plugins/CdioParanoiaInputPlugin.cxx
+++ b/src/input/plugins/CdioParanoiaInputPlugin.cxx
@@ -269,9 +269,9 @@ input_cdio_open(const char *uri,
i->base.size = (i->lsn_to - i->lsn_from + 1) * CDIO_CD_FRAMESIZE_RAW;
/* hack to make MPD select the "pcm" decoder plugin */
- i->base.mime = reverse_endian
- ? "audio/x-mpd-cdda-pcm-reverse"
- : "audio/x-mpd-cdda-pcm";
+ i->base.SetMimeType(reverse_endian
+ ? "audio/x-mpd-cdda-pcm-reverse"
+ : "audio/x-mpd-cdda-pcm");
return &i->base;
}
diff --git a/src/input/plugins/CurlInputPlugin.cxx b/src/input/plugins/CurlInputPlugin.cxx
index 37509e998..5f8b9150a 100644
--- a/src/input/plugins/CurlInputPlugin.cxx
+++ b/src/input/plugins/CurlInputPlugin.cxx
@@ -497,8 +497,7 @@ CurlInputStream::RequestDone(CURLcode result, long status)
status);
}
- base.ready = true;
- base.cond.broadcast();
+ base.SetReady();
}
static void
@@ -833,7 +832,7 @@ CurlInputStream::HeaderReceived(const char *name, std::string &&value)
} else if (StringEqualsCaseASCII(name, "content-length")) {
base.size = base.offset + ParseUint64(value.c_str());
} else if (StringEqualsCaseASCII(name, "content-type")) {
- base.mime = std::move(value);
+ base.SetMimeType(std::move(value));
} else if (StringEqualsCaseASCII(name, "icy-name") ||
StringEqualsCaseASCII(name, "ice-name") ||
StringEqualsCaseASCII(name, "x-audiocast-name")) {
@@ -987,7 +986,7 @@ CurlInputStream::InitEasy(Error &error)
curl_easy_setopt(easy, CURLOPT_PROXYUSERPWD, proxy_auth_str);
}
- CURLcode code = curl_easy_setopt(easy, CURLOPT_URL, base.uri.c_str());
+ CURLcode code = curl_easy_setopt(easy, CURLOPT_URL, base.GetURI());
if (code != CURLE_OK) {
error.Format(curl_domain, code,
"curl_easy_setopt() failed: %s",
@@ -1091,9 +1090,7 @@ CurlInputStream::Seek(InputPlugin::offset_type offset, int whence,
return false;
base.mutex.lock();
-
- while (!base.ready)
- base.cond.wait(base.mutex);
+ base.WaitReady();
if (postponed_error.IsDefined()) {
error = std::move(postponed_error);
diff --git a/src/input/plugins/DespotifyInputPlugin.cxx b/src/input/plugins/DespotifyInputPlugin.cxx
index 152fda95f..702ebc132 100644
--- a/src/input/plugins/DespotifyInputPlugin.cxx
+++ b/src/input/plugins/DespotifyInputPlugin.cxx
@@ -58,8 +58,8 @@ class DespotifyInputStream {
memset(&pcm, 0, sizeof(pcm));
/* Despotify outputs pcm data */
- base.mime = "audio/x-mpd-cdda-pcm";
- base.ready = true;
+ base.SetMimeType("audio/x-mpd-cdda-pcm");
+ base.SetReady();
}
public:
diff --git a/src/input/plugins/FfmpegInputPlugin.cxx b/src/input/plugins/FfmpegInputPlugin.cxx
index dab4b59fb..d06d4705a 100644
--- a/src/input/plugins/FfmpegInputPlugin.cxx
+++ b/src/input/plugins/FfmpegInputPlugin.cxx
@@ -52,7 +52,7 @@ struct FfmpegInputStream {
- 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.mime = "audio/x-mpd-ffmpeg";
+ base.SetMimeType("audio/x-mpd-ffmpeg");
}
~FfmpegInputStream() {
diff --git a/src/input/plugins/FileInputPlugin.cxx b/src/input/plugins/FileInputPlugin.cxx
index 780e93263..49dc3df7e 100644
--- a/src/input/plugins/FileInputPlugin.cxx
+++ b/src/input/plugins/FileInputPlugin.cxx
@@ -44,7 +44,7 @@ struct FileInputStream {
fd(_fd) {
base.size = size;
base.seekable = true;
- base.ready = true;
+ base.SetReady();
}
~FileInputStream() {
@@ -138,7 +138,7 @@ input_file_close(InputStream *is)
static bool
input_file_eof(InputStream *is)
{
- return is->offset >= is->size;
+ return is->GetOffset() >= is->GetSize();
}
const InputPlugin input_plugin_file = {
diff --git a/src/input/plugins/RewindInputPlugin.cxx b/src/input/plugins/RewindInputPlugin.cxx
index 1a930ac53..1cc146d3f 100644
--- a/src/input/plugins/RewindInputPlugin.cxx
+++ b/src/input/plugins/RewindInputPlugin.cxx
@@ -55,7 +55,7 @@ struct RewindInputStream {
char buffer[64 * 1024];
RewindInputStream(InputStream *_input)
- :base(rewind_input_plugin, _input->uri.c_str(),
+ :base(rewind_input_plugin, _input->GetURI(),
_input->mutex, _input->cond),
input(_input), tail(0) {
}
@@ -84,15 +84,16 @@ struct RewindInputStream {
assert(dest != src);
- bool dest_ready = dest->ready;
+ if (!dest->IsReady() && src->IsReady()) {
+ if (src->HasMimeType())
+ dest->SetMimeType(src->GetMimeType());
- dest->ready = src->ready;
- dest->seekable = src->seekable;
- dest->size = src->size;
- dest->offset = src->offset;
+ dest->size = src->GetSize();
+ dest->seekable = src->IsSeekable();
+ dest->SetReady();
+ }
- if (!dest_ready && src->ready)
- dest->mime = src->mime;
+ dest->offset = src->offset;
}
};
@@ -195,7 +196,7 @@ input_rewind_seek(InputStream *is, InputPlugin::offset_type offset,
{
RewindInputStream *r = (RewindInputStream *)is;
- assert(is->ready);
+ assert(is->IsReady());
if (whence == SEEK_SET && r->tail > 0 &&
offset <= (InputPlugin::offset_type)r->tail) {
@@ -242,7 +243,7 @@ input_rewind_open(InputStream *is)
assert(is != nullptr);
assert(is->offset == 0);
- if (is->seekable)
+ if (is->IsReady() && is->IsSeekable())
/* seekable resources don't need this plugin */
return is;
diff --git a/src/input/plugins/RewindInputPlugin.hxx b/src/input/plugins/RewindInputPlugin.hxx
index f19705154..56b01b585 100644
--- a/src/input/plugins/RewindInputPlugin.hxx
+++ b/src/input/plugins/RewindInputPlugin.hxx
@@ -29,7 +29,7 @@
#include "check.h"
-struct InputStream;
+class InputStream;
InputStream *
input_rewind_open(InputStream *is);