aboutsummaryrefslogtreecommitdiffstats
path: root/src/input
diff options
context:
space:
mode:
Diffstat (limited to 'src/input')
-rw-r--r--src/input/ArchiveInputPlugin.cxx3
-rw-r--r--src/input/CdioParanoiaInputPlugin.cxx3
-rw-r--r--src/input/CurlInputPlugin.cxx14
-rw-r--r--src/input/DespotifyInputPlugin.cxx5
-rw-r--r--src/input/FfmpegInputPlugin.cxx16
-rw-r--r--src/input/FileInputPlugin.cxx4
-rw-r--r--src/input/MmsInputPlugin.cxx13
-rw-r--r--src/input/RewindInputPlugin.cxx1
8 files changed, 28 insertions, 31 deletions
diff --git a/src/input/ArchiveInputPlugin.cxx b/src/input/ArchiveInputPlugin.cxx
index 5288f2b3b..5797caced 100644
--- a/src/input/ArchiveInputPlugin.cxx
+++ b/src/input/ArchiveInputPlugin.cxx
@@ -25,7 +25,6 @@
#include "ArchivePlugin.hxx"
#include "ArchiveFile.hxx"
#include "InputPlugin.hxx"
-#include "util/Error.hxx"
#include "fs/Traits.hxx"
#include "Log.hxx"
@@ -47,7 +46,7 @@ input_archive_open(const char *pathname,
const struct archive_plugin *arplug;
InputStream *is;
- if (!PathTraits::IsAbsoluteFS(pathname))
+ if (!PathTraitsFS::IsAbsolute(pathname))
return nullptr;
char *pname = g_strdup(pathname);
diff --git a/src/input/CdioParanoiaInputPlugin.cxx b/src/input/CdioParanoiaInputPlugin.cxx
index 3978ab9c5..73fb8acdd 100644
--- a/src/input/CdioParanoiaInputPlugin.cxx
+++ b/src/input/CdioParanoiaInputPlugin.cxx
@@ -25,6 +25,7 @@
#include "CdioParanoiaInputPlugin.hxx"
#include "InputStream.hxx"
#include "InputPlugin.hxx"
+#include "util/StringUtil.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
#include "system/ByteOrder.hxx"
@@ -122,7 +123,7 @@ struct cdio_uri {
static bool
parse_cdio_uri(struct cdio_uri *dest, const char *src, Error &error)
{
- if (!g_str_has_prefix(src, "cdda://"))
+ if (!StringStartsWith(src, "cdda://"))
return false;
src += 7;
diff --git a/src/input/CurlInputPlugin.cxx b/src/input/CurlInputPlugin.cxx
index b78545951..fa8f9affc 100644
--- a/src/input/CurlInputPlugin.cxx
+++ b/src/input/CurlInputPlugin.cxx
@@ -24,6 +24,7 @@
#include "ConfigGlobal.hxx"
#include "ConfigData.hxx"
#include "tag/Tag.hxx"
+#include "tag/TagBuilder.hxx"
#include "IcyMetaDataParser.hxx"
#include "event/SocketMonitor.hxx"
#include "event/TimeoutMonitor.hxx"
@@ -780,8 +781,11 @@ copy_icy_tag(struct input_curl *c)
delete c->tag;
- if (!c->meta_name.empty() && !tag->HasType(TAG_NAME))
- tag->AddItem(TAG_NAME, c->meta_name.c_str());
+ if (!c->meta_name.empty() && !tag->HasType(TAG_NAME)) {
+ TagBuilder tag_builder(std::move(*tag));
+ tag_builder.AddItem(TAG_NAME, c->meta_name.c_str());
+ tag_builder.Commit(*tag);
+ }
c->tag = tag;
}
@@ -910,8 +914,10 @@ input_curl_headerfunction(void *ptr, size_t size, size_t nmemb, void *stream)
delete c->tag;
- c->tag = new Tag();
- c->tag->AddItem(TAG_NAME, c->meta_name.c_str());
+ TagBuilder tag_builder;
+ tag_builder.AddItem(TAG_NAME, c->meta_name.c_str());
+
+ c->tag = tag_builder.Commit();
} else if (StringEqualsCaseASCII(name, "icy-metaint")) {
char buffer[64];
size_t icy_metaint;
diff --git a/src/input/DespotifyInputPlugin.cxx b/src/input/DespotifyInputPlugin.cxx
index b08299516..9441ef327 100644
--- a/src/input/DespotifyInputPlugin.cxx
+++ b/src/input/DespotifyInputPlugin.cxx
@@ -23,14 +23,13 @@
#include "InputStream.hxx"
#include "InputPlugin.hxx"
#include "tag/Tag.hxx"
+#include "util/StringUtil.hxx"
#include "Log.hxx"
extern "C" {
#include <despotify.h>
}
-#include <glib.h>
-
#include <unistd.h>
#include <string.h>
#include <errno.h>
@@ -130,7 +129,7 @@ input_despotify_open(const char *url,
struct ds_link *ds_link;
struct ds_track *track;
- if (!g_str_has_prefix(url, "spt://"))
+ if (!StringStartsWith(url, "spt://"))
return nullptr;
session = mpd_despotify_get_session();
diff --git a/src/input/FfmpegInputPlugin.cxx b/src/input/FfmpegInputPlugin.cxx
index 8f9cd0b86..7d041677b 100644
--- a/src/input/FfmpegInputPlugin.cxx
+++ b/src/input/FfmpegInputPlugin.cxx
@@ -24,17 +24,15 @@
#include "FfmpegInputPlugin.hxx"
#include "InputStream.hxx"
#include "InputPlugin.hxx"
+#include "util/StringUtil.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
extern "C" {
-#include <libavutil/avutil.h>
#include <libavformat/avio.h>
#include <libavformat/avformat.h>
}
-#include <glib.h>
-
struct FfmpegInputStream {
InputStream base;
@@ -91,12 +89,12 @@ input_ffmpeg_open(const char *uri,
Mutex &mutex, Cond &cond,
Error &error)
{
- if (!g_str_has_prefix(uri, "gopher://") &&
- !g_str_has_prefix(uri, "rtp://") &&
- !g_str_has_prefix(uri, "rtsp://") &&
- !g_str_has_prefix(uri, "rtmp://") &&
- !g_str_has_prefix(uri, "rtmpt://") &&
- !g_str_has_prefix(uri, "rtmps://"))
+ if (!StringStartsWith(uri, "gopher://") &&
+ !StringStartsWith(uri, "rtp://") &&
+ !StringStartsWith(uri, "rtsp://") &&
+ !StringStartsWith(uri, "rtmp://") &&
+ !StringStartsWith(uri, "rtmpt://") &&
+ !StringStartsWith(uri, "rtmps://"))
return nullptr;
AVIOContext *h;
diff --git a/src/input/FileInputPlugin.cxx b/src/input/FileInputPlugin.cxx
index 26e40d609..5a63a469c 100644
--- a/src/input/FileInputPlugin.cxx
+++ b/src/input/FileInputPlugin.cxx
@@ -30,8 +30,6 @@
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
-#include <string.h>
-#include <glib.h>
static constexpr Domain file_domain("file");
@@ -62,7 +60,7 @@ input_file_open(const char *filename,
int fd, ret;
struct stat st;
- if (!PathTraits::IsAbsoluteFS(filename))
+ if (!PathTraitsFS::IsAbsolute(filename))
return nullptr;
fd = open_cloexec(filename, O_RDONLY|O_BINARY, 0);
diff --git a/src/input/MmsInputPlugin.cxx b/src/input/MmsInputPlugin.cxx
index e97c1eb3f..2c7f6d166 100644
--- a/src/input/MmsInputPlugin.cxx
+++ b/src/input/MmsInputPlugin.cxx
@@ -21,15 +21,12 @@
#include "MmsInputPlugin.hxx"
#include "InputStream.hxx"
#include "InputPlugin.hxx"
+#include "util/StringUtil.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
-#include <glib.h>
#include <libmms/mmsx.h>
-#include <string.h>
-#include <errno.h>
-
struct MmsInputStream {
InputStream base;
@@ -61,10 +58,10 @@ input_mms_open(const char *url,
Mutex &mutex, Cond &cond,
Error &error)
{
- if (!g_str_has_prefix(url, "mms://") &&
- !g_str_has_prefix(url, "mmsh://") &&
- !g_str_has_prefix(url, "mmst://") &&
- !g_str_has_prefix(url, "mmsu://"))
+ if (!StringStartsWith(url, "mms://") &&
+ !StringStartsWith(url, "mmsh://") &&
+ !StringStartsWith(url, "mmst://") &&
+ !StringStartsWith(url, "mmsu://"))
return nullptr;
const auto mms = mmsx_connect(nullptr, nullptr, url, 128 * 1024);
diff --git a/src/input/RewindInputPlugin.cxx b/src/input/RewindInputPlugin.cxx
index e11f56631..78ab75660 100644
--- a/src/input/RewindInputPlugin.cxx
+++ b/src/input/RewindInputPlugin.cxx
@@ -21,7 +21,6 @@
#include "RewindInputPlugin.hxx"
#include "InputStream.hxx"
#include "InputPlugin.hxx"
-#include "tag/Tag.hxx"
#include <assert.h>
#include <string.h>