aboutsummaryrefslogtreecommitdiffstats
path: root/src/input
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/input/AsyncInputStream.cxx2
-rw-r--r--src/input/AsyncInputStream.hxx6
-rw-r--r--src/input/Domain.cxx2
-rw-r--r--src/input/Domain.hxx2
-rw-r--r--src/input/IcyInputStream.cxx2
-rw-r--r--src/input/IcyInputStream.hxx2
-rw-r--r--src/input/Init.cxx19
-rw-r--r--src/input/Init.hxx9
-rw-r--r--src/input/InputPlugin.hxx8
-rw-r--r--src/input/InputStream.cxx2
-rw-r--r--src/input/InputStream.hxx3
-rw-r--r--src/input/LocalOpen.cxx2
-rw-r--r--src/input/LocalOpen.hxx2
-rw-r--r--src/input/Offset.hxx2
-rw-r--r--src/input/Open.cxx13
-rw-r--r--src/input/ProxyInputStream.cxx2
-rw-r--r--src/input/ProxyInputStream.hxx2
-rw-r--r--src/input/Registry.cxx10
-rw-r--r--src/input/Registry.hxx2
-rw-r--r--src/input/TextInputStream.cxx2
-rw-r--r--src/input/TextInputStream.hxx6
-rw-r--r--src/input/ThreadInputStream.cxx2
-rw-r--r--src/input/ThreadInputStream.hxx2
-rw-r--r--src/input/plugins/AlsaInputPlugin.cxx2
-rw-r--r--src/input/plugins/AlsaInputPlugin.hxx2
-rw-r--r--src/input/plugins/ArchiveInputPlugin.cxx2
-rw-r--r--src/input/plugins/ArchiveInputPlugin.hxx2
-rw-r--r--src/input/plugins/CdioParanoiaInputPlugin.cxx11
-rw-r--r--src/input/plugins/CdioParanoiaInputPlugin.hxx2
-rw-r--r--src/input/plugins/CurlInputPlugin.cxx29
-rw-r--r--src/input/plugins/CurlInputPlugin.hxx2
-rw-r--r--src/input/plugins/FfmpegInputPlugin.cxx8
-rw-r--r--src/input/plugins/FfmpegInputPlugin.hxx2
-rw-r--r--src/input/plugins/FileInputPlugin.cxx57
-rw-r--r--src/input/plugins/FileInputPlugin.hxx2
-rw-r--r--src/input/plugins/MmsInputPlugin.cxx2
-rw-r--r--src/input/plugins/MmsInputPlugin.hxx2
-rw-r--r--src/input/plugins/NfsInputPlugin.cxx8
-rw-r--r--src/input/plugins/NfsInputPlugin.hxx2
-rw-r--r--src/input/plugins/RewindInputPlugin.cxx2
-rw-r--r--src/input/plugins/RewindInputPlugin.hxx2
-rw-r--r--src/input/plugins/SmbclientInputPlugin.cxx6
-rw-r--r--src/input/plugins/SmbclientInputPlugin.hxx2
43 files changed, 123 insertions, 128 deletions
diff --git a/src/input/AsyncInputStream.cxx b/src/input/AsyncInputStream.cxx
index 5795ecead..68cb8ff68 100644
--- a/src/input/AsyncInputStream.cxx
+++ b/src/input/AsyncInputStream.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/AsyncInputStream.hxx b/src/input/AsyncInputStream.hxx
index d1f0c3b9d..64f566a97 100644
--- a/src/input/AsyncInputStream.hxx
+++ b/src/input/AsyncInputStream.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -62,6 +62,10 @@ protected:
Error postponed_error;
public:
+ /**
+ * @param _buffer a buffer allocated with HugeAllocate(); the
+ * destructor will free it using HugeFree()
+ */
AsyncInputStream(const char *_url,
Mutex &_mutex, Cond &_cond,
void *_buffer, size_t _buffer_size,
diff --git a/src/input/Domain.cxx b/src/input/Domain.cxx
index 26ae298a4..12417af34 100644
--- a/src/input/Domain.cxx
+++ b/src/input/Domain.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/Domain.hxx b/src/input/Domain.hxx
index 16fa5e0f1..a18a26426 100644
--- a/src/input/Domain.hxx
+++ b/src/input/Domain.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/IcyInputStream.cxx b/src/input/IcyInputStream.cxx
index fb82cdec6..5344a71ec 100644
--- a/src/input/IcyInputStream.cxx
+++ b/src/input/IcyInputStream.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/IcyInputStream.hxx b/src/input/IcyInputStream.hxx
index d8968a741..4fca11eb3 100644
--- a/src/input/IcyInputStream.hxx
+++ b/src/input/IcyInputStream.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/Init.cxx b/src/input/Init.cxx
index 0ee87c4d8..4ed44f100 100644
--- a/src/input/Init.cxx
+++ b/src/input/Init.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -24,7 +24,7 @@
#include "util/Error.hxx"
#include "config/ConfigGlobal.hxx"
#include "config/ConfigOption.hxx"
-#include "config/ConfigData.hxx"
+#include "config/Block.hxx"
#include "Log.hxx"
#include <assert.h>
@@ -33,7 +33,7 @@
bool
input_stream_global_init(Error &error)
{
- const config_param empty;
+ const ConfigBlock empty;
for (unsigned i = 0; input_plugins[i] != nullptr; ++i) {
const InputPlugin *plugin = input_plugins[i];
@@ -42,16 +42,17 @@ input_stream_global_init(Error &error)
assert(*plugin->name != 0);
assert(plugin->open != nullptr);
- const struct config_param *param =
- config_find_block(CONF_INPUT, "plugin", plugin->name);
- if (param == nullptr) {
- param = &empty;
- } else if (!param->GetBlockValue("enabled", true))
+ const auto *block =
+ config_find_block(ConfigBlockOption::INPUT, "plugin",
+ plugin->name);
+ if (block == nullptr) {
+ block = &empty;
+ } else if (!block->GetBlockValue("enabled", true))
/* the plugin is disabled in mpd.conf */
continue;
InputPlugin::InitResult result = plugin->init != nullptr
- ? plugin->init(*param, error)
+ ? plugin->init(*block, error)
: InputPlugin::InitResult::SUCCESS;
switch (result) {
diff --git a/src/input/Init.hxx b/src/input/Init.hxx
index 875fdce7c..eb4f8b1b2 100644
--- a/src/input/Init.hxx
+++ b/src/input/Init.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -23,14 +23,15 @@
class Error;
/**
- * Initializes this library and all input_stream implementations.
+ * Initializes this library and all #InputStream implementations.
*/
bool
input_stream_global_init(Error &error);
/**
- * Deinitializes this library and all input_stream implementations.
+ * Deinitializes this library and all #InputStream implementations.
*/
-void input_stream_global_finish(void);
+void
+input_stream_global_finish();
#endif
diff --git a/src/input/InputPlugin.hxx b/src/input/InputPlugin.hxx
index c2adb419c..a7c19bef3 100644
--- a/src/input/InputPlugin.hxx
+++ b/src/input/InputPlugin.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -34,7 +34,7 @@
#endif
#endif
-struct config_param;
+struct ConfigBlock;
class InputStream;
class Error;
struct Tag;
@@ -69,13 +69,13 @@ struct InputPlugin {
* @return true on success, false if the plugin should be
* disabled
*/
- InitResult (*init)(const config_param &param, Error &error);
+ InitResult (*init)(const ConfigBlock &block, Error &error);
/**
* Global deinitialization. Called once before MPD shuts
* down (only if init() has returned true).
*/
- void (*finish)(void);
+ void (*finish)();
InputStream *(*open)(const char *uri,
Mutex &mutex, Cond &cond,
diff --git a/src/input/InputStream.cxx b/src/input/InputStream.cxx
index 44f726a62..419c4f07f 100644
--- a/src/input/InputStream.cxx
+++ b/src/input/InputStream.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/InputStream.hxx b/src/input/InputStream.hxx
index 81b903ba2..84b4f3fae 100644
--- a/src/input/InputStream.hxx
+++ b/src/input/InputStream.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -350,7 +350,6 @@ public:
*
* The caller must lock the mutex.
*
- * @param is the InputStream object
* @param ptr the buffer to read into
* @param size the maximum number of bytes to read
* @return the number of bytes read
diff --git a/src/input/LocalOpen.cxx b/src/input/LocalOpen.cxx
index ad8eba8ce..25644bae1 100644
--- a/src/input/LocalOpen.cxx
+++ b/src/input/LocalOpen.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/LocalOpen.hxx b/src/input/LocalOpen.hxx
index cf1b2b632..6f4ef2a2c 100644
--- a/src/input/LocalOpen.hxx
+++ b/src/input/LocalOpen.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/Offset.hxx b/src/input/Offset.hxx
index 552397904..fbda933ba 100644
--- a/src/input/Offset.hxx
+++ b/src/input/Offset.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/Open.cxx b/src/input/Open.cxx
index 66ccdce74..6bcca0b84 100644
--- a/src/input/Open.cxx
+++ b/src/input/Open.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -26,6 +26,7 @@
#include "plugins/RewindInputPlugin.hxx"
#include "fs/Traits.hxx"
#include "fs/Path.hxx"
+#include "fs/AllocatedPath.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
@@ -34,10 +35,14 @@ InputStream::Open(const char *url,
Mutex &mutex, Cond &cond,
Error &error)
{
- if (PathTraitsFS::IsAbsolute(url))
- /* TODO: the parameter is UTF-8, not filesystem charset */
- return OpenLocalInputStream(Path::FromFS(url),
+ if (PathTraitsUTF8::IsAbsolute(url)) {
+ const auto path = AllocatedPath::FromUTF8(url, error);
+ if (path.IsNull())
+ return nullptr;
+
+ return OpenLocalInputStream(path,
mutex, cond, error);
+ }
input_plugins_for_each_enabled(plugin) {
InputStream *is;
diff --git a/src/input/ProxyInputStream.cxx b/src/input/ProxyInputStream.cxx
index 74a272f6a..013d880d8 100644
--- a/src/input/ProxyInputStream.cxx
+++ b/src/input/ProxyInputStream.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/ProxyInputStream.hxx b/src/input/ProxyInputStream.hxx
index 727ae5917..c91c1a952 100644
--- a/src/input/ProxyInputStream.hxx
+++ b/src/input/ProxyInputStream.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/Registry.cxx b/src/input/Registry.cxx
index 748c18ca8..e33e51bb9 100644
--- a/src/input/Registry.cxx
+++ b/src/input/Registry.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -22,7 +22,7 @@
#include "util/Macros.hxx"
#include "plugins/FileInputPlugin.hxx"
-#ifdef HAVE_ALSA
+#ifdef ENABLE_ALSA
#include "plugins/AlsaInputPlugin.hxx"
#endif
@@ -34,7 +34,7 @@
#include "plugins/CurlInputPlugin.hxx"
#endif
-#ifdef HAVE_FFMPEG
+#ifdef ENABLE_FFMPEG
#include "plugins/FfmpegInputPlugin.hxx"
#endif
@@ -56,7 +56,7 @@
const InputPlugin *const input_plugins[] = {
&input_plugin_file,
-#ifdef HAVE_ALSA
+#ifdef ENABLE_ALSA
&input_plugin_alsa,
#endif
#ifdef ENABLE_ARCHIVE
@@ -65,7 +65,7 @@ const InputPlugin *const input_plugins[] = {
#ifdef ENABLE_CURL
&input_plugin_curl,
#endif
-#ifdef HAVE_FFMPEG
+#ifdef ENABLE_FFMPEG
&input_plugin_ffmpeg,
#endif
#ifdef ENABLE_SMBCLIENT
diff --git a/src/input/Registry.hxx b/src/input/Registry.hxx
index 1b81f8f06..af1b3be8b 100644
--- a/src/input/Registry.hxx
+++ b/src/input/Registry.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/TextInputStream.cxx b/src/input/TextInputStream.cxx
index 5a8dcc065..897b2b472 100644
--- a/src/input/TextInputStream.cxx
+++ b/src/input/TextInputStream.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/TextInputStream.hxx b/src/input/TextInputStream.hxx
index 6f39d22cf..d0b5d5f40 100644
--- a/src/input/TextInputStream.hxx
+++ b/src/input/TextInputStream.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -30,10 +30,10 @@ class TextInputStream {
public:
/**
- * Wraps an existing #input_stream object into a #TextInputStream,
+ * Wraps an existing #InputStream object into a #TextInputStream,
* to read its contents as text lines.
*
- * @param _is an open #input_stream object
+ * @param _is an open #InputStream object
*/
explicit TextInputStream(InputStream &_is)
:is(_is) {}
diff --git a/src/input/ThreadInputStream.cxx b/src/input/ThreadInputStream.cxx
index 235ed2b01..061d5cbfe 100644
--- a/src/input/ThreadInputStream.cxx
+++ b/src/input/ThreadInputStream.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/ThreadInputStream.hxx b/src/input/ThreadInputStream.hxx
index c6ac7669c..6fc3e2e7b 100644
--- a/src/input/ThreadInputStream.hxx
+++ b/src/input/ThreadInputStream.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/plugins/AlsaInputPlugin.cxx b/src/input/plugins/AlsaInputPlugin.cxx
index f03f745c6..d2be734b5 100644
--- a/src/input/plugins/AlsaInputPlugin.cxx
+++ b/src/input/plugins/AlsaInputPlugin.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/plugins/AlsaInputPlugin.hxx b/src/input/plugins/AlsaInputPlugin.hxx
index dddf7dfd7..eb50ec8d6 100644
--- a/src/input/plugins/AlsaInputPlugin.hxx
+++ b/src/input/plugins/AlsaInputPlugin.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/plugins/ArchiveInputPlugin.cxx b/src/input/plugins/ArchiveInputPlugin.cxx
index da3d7ca71..b6472e00a 100644
--- a/src/input/plugins/ArchiveInputPlugin.cxx
+++ b/src/input/plugins/ArchiveInputPlugin.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/plugins/ArchiveInputPlugin.hxx b/src/input/plugins/ArchiveInputPlugin.hxx
index b6158684a..79331cd5a 100644
--- a/src/input/plugins/ArchiveInputPlugin.hxx
+++ b/src/input/plugins/ArchiveInputPlugin.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/plugins/CdioParanoiaInputPlugin.cxx b/src/input/plugins/CdioParanoiaInputPlugin.cxx
index f847b35c1..dda5cb83f 100644
--- a/src/input/plugins/CdioParanoiaInputPlugin.cxx
+++ b/src/input/plugins/CdioParanoiaInputPlugin.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -31,7 +31,7 @@
#include "system/ByteOrder.hxx"
#include "fs/AllocatedPath.hxx"
#include "Log.hxx"
-#include "config/ConfigData.hxx"
+#include "config/Block.hxx"
#include "config/ConfigError.hxx"
#include <stdio.h>
@@ -39,7 +39,6 @@
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
-#include <glib.h>
#include <assert.h>
#ifdef HAVE_CDIO_PARANOIA_PARANOIA_H
@@ -107,9 +106,9 @@ static constexpr Domain cdio_domain("cdio");
static bool default_reverse_endian;
static InputPlugin::InitResult
-input_cdio_init(const config_param &param, Error &error)
+input_cdio_init(const ConfigBlock &block, Error &error)
{
- const char *value = param.GetBlockValue("default_byte_order");
+ const char *value = block.GetBlockValue("default_byte_order");
if (value != nullptr) {
if (strcmp(value, "little_endian") == 0)
default_reverse_endian = IsBigEndian();
@@ -149,7 +148,7 @@ parse_cdio_uri(struct cdio_uri *dest, const char *src, Error &error)
const char *slash = strrchr(src, '/');
if (slash == nullptr) {
/* play the whole CD in the specified drive */
- g_strlcpy(dest->device, src, sizeof(dest->device));
+ CopyString(dest->device, src, sizeof(dest->device));
dest->track = -1;
return true;
}
diff --git a/src/input/plugins/CdioParanoiaInputPlugin.hxx b/src/input/plugins/CdioParanoiaInputPlugin.hxx
index e2804e8c7..a51b43827 100644
--- a/src/input/plugins/CdioParanoiaInputPlugin.hxx
+++ b/src/input/plugins/CdioParanoiaInputPlugin.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/plugins/CurlInputPlugin.cxx b/src/input/plugins/CurlInputPlugin.cxx
index 3aa3b0018..ade8324ec 100644
--- a/src/input/plugins/CurlInputPlugin.cxx
+++ b/src/input/plugins/CurlInputPlugin.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -23,7 +23,7 @@
#include "../IcyInputStream.hxx"
#include "../InputPlugin.hxx"
#include "config/ConfigGlobal.hxx"
-#include "config/ConfigData.hxx"
+#include "config/Block.hxx"
#include "tag/Tag.hxx"
#include "tag/TagBuilder.hxx"
#include "event/SocketMonitor.hxx"
@@ -537,7 +537,7 @@ CurlMulti::OnTimeout()
*/
static InputPlugin::InitResult
-input_curl_init(const config_param &param, Error &error)
+input_curl_init(const ConfigBlock &block, Error &error)
{
CURLcode code = curl_global_init(CURL_GLOBAL_ALL);
if (code != CURLE_OK) {
@@ -559,22 +559,22 @@ input_curl_init(const config_param &param, Error &error)
http_200_aliases = curl_slist_append(http_200_aliases, "ICY 200 OK");
- proxy = param.GetBlockValue("proxy");
- proxy_port = param.GetBlockValue("proxy_port", 0u);
- proxy_user = param.GetBlockValue("proxy_user");
- proxy_password = param.GetBlockValue("proxy_password");
+ proxy = block.GetBlockValue("proxy");
+ proxy_port = block.GetBlockValue("proxy_port", 0u);
+ proxy_user = block.GetBlockValue("proxy_user");
+ proxy_password = block.GetBlockValue("proxy_password");
if (proxy == nullptr) {
/* deprecated proxy configuration */
- proxy = config_get_string(CONF_HTTP_PROXY_HOST, nullptr);
- proxy_port = config_get_positive(CONF_HTTP_PROXY_PORT, 0);
- proxy_user = config_get_string(CONF_HTTP_PROXY_USER, nullptr);
- proxy_password = config_get_string(CONF_HTTP_PROXY_PASSWORD,
+ proxy = config_get_string(ConfigOption::HTTP_PROXY_HOST, nullptr);
+ proxy_port = config_get_positive(ConfigOption::HTTP_PROXY_PORT, 0);
+ proxy_user = config_get_string(ConfigOption::HTTP_PROXY_USER, nullptr);
+ proxy_password = config_get_string(ConfigOption::HTTP_PROXY_PASSWORD,
"");
}
- verify_peer = param.GetBlockValue("verify_peer", true);
- verify_host = param.GetBlockValue("verify_host", true);
+ verify_peer = block.GetBlockValue("verify_peer", true);
+ verify_host = block.GetBlockValue("verify_host", true);
CURLM *multi = curl_multi_init();
if (multi == nullptr) {
@@ -651,7 +651,10 @@ CurlInputStream::HeaderReceived(const char *name, std::string &&value)
return;
size_t icy_metaint = ParseUint64(value.c_str());
+#ifndef WIN32
+ /* Windows doesn't know "%z" */
FormatDebug(curl_domain, "icy-metaint=%zu", icy_metaint);
+#endif
if (icy_metaint > 0) {
icy->Enable(icy_metaint);
diff --git a/src/input/plugins/CurlInputPlugin.hxx b/src/input/plugins/CurlInputPlugin.hxx
index 4acb18bfc..57bbe714b 100644
--- a/src/input/plugins/CurlInputPlugin.hxx
+++ b/src/input/plugins/CurlInputPlugin.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/plugins/FfmpegInputPlugin.cxx b/src/input/plugins/FfmpegInputPlugin.cxx
index 669f8d403..444273d90 100644
--- a/src/input/plugins/FfmpegInputPlugin.cxx
+++ b/src/input/plugins/FfmpegInputPlugin.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -22,6 +22,7 @@
#include "config.h"
#include "FfmpegInputPlugin.hxx"
+#include "lib/ffmpeg/Init.hxx"
#include "lib/ffmpeg/Domain.hxx"
#include "lib/ffmpeg/Error.hxx"
#include "../InputStream.hxx"
@@ -31,7 +32,6 @@
extern "C" {
#include <libavformat/avio.h>
-#include <libavformat/avformat.h>
}
struct FfmpegInputStream final : public InputStream {
@@ -72,10 +72,10 @@ input_ffmpeg_supported(void)
}
static InputPlugin::InitResult
-input_ffmpeg_init(gcc_unused const config_param &param,
+input_ffmpeg_init(gcc_unused const ConfigBlock &block,
Error &error)
{
- av_register_all();
+ FfmpegInit();
/* disable this plugin if there's no registered protocol */
if (!input_ffmpeg_supported()) {
diff --git a/src/input/plugins/FfmpegInputPlugin.hxx b/src/input/plugins/FfmpegInputPlugin.hxx
index 43f829e89..40a834bdc 100644
--- a/src/input/plugins/FfmpegInputPlugin.hxx
+++ b/src/input/plugins/FfmpegInputPlugin.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/plugins/FileInputPlugin.cxx b/src/input/plugins/FileInputPlugin.cxx
index 867b5722d..aa4676470 100644
--- a/src/input/plugins/FileInputPlugin.cxx
+++ b/src/input/plugins/FileInputPlugin.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -23,34 +23,30 @@
#include "../InputPlugin.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
-#include "fs/FileSystem.hxx"
#include "fs/Path.hxx"
-#include "system/fd_util.h"
-#include "open.h"
+#include "fs/FileInfo.hxx"
+#include "fs/io/FileReader.hxx"
+#include "system/FileDescriptor.hxx"
#include <sys/stat.h>
-#include <unistd.h>
+#include <fcntl.h>
#include <errno.h>
static constexpr Domain file_domain("file");
class FileInputStream final : public InputStream {
- const int fd;
+ FileReader reader;
public:
- FileInputStream(const char *path, int _fd, off_t _size,
+ FileInputStream(const char *path, FileReader &&_reader, off_t _size,
Mutex &_mutex, Cond &_cond)
:InputStream(path, _mutex, _cond),
- fd(_fd) {
+ reader(std::move(_reader)) {
size = _size;
seekable = true;
SetReady();
}
- ~FileInputStream() {
- close(fd);
- }
-
/* virtual methods from InputStream */
bool IsEOF() override {
@@ -66,32 +62,28 @@ OpenFileInputStream(Path path,
Mutex &mutex, Cond &cond,
Error &error)
{
- const int fd = OpenFile(path, O_RDONLY|O_BINARY, 0);
- if (fd < 0) {
- error.FormatErrno("Failed to open \"%s\"",
- path.c_str());
+ FileReader reader(path, error);
+ if (!reader.IsDefined())
return nullptr;
- }
- struct stat st;
- if (fstat(fd, &st) < 0) {
- error.FormatErrno("Failed to stat \"%s\"", path.c_str());
- close(fd);
+ FileInfo info;
+ if (!reader.GetFileInfo(info, error))
return nullptr;
- }
- if (!S_ISREG(st.st_mode)) {
+ if (!info.IsRegular()) {
error.Format(file_domain, "Not a regular file: %s",
path.c_str());
- close(fd);
return nullptr;
}
#ifdef POSIX_FADV_SEQUENTIAL
- posix_fadvise(fd, (off_t)0, st.st_size, POSIX_FADV_SEQUENTIAL);
+ posix_fadvise(reader.GetFD().Get(), (off_t)0, info.GetSize(),
+ POSIX_FADV_SEQUENTIAL);
#endif
- return new FileInputStream(path.c_str(), fd, st.st_size, mutex, cond);
+ return new FileInputStream(path.ToUTF8().c_str(),
+ std::move(reader), info.GetSize(),
+ mutex, cond);
}
static InputStream *
@@ -107,24 +99,19 @@ input_file_open(gcc_unused const char *filename,
bool
FileInputStream::Seek(offset_type new_offset, Error &error)
{
- auto result = lseek(fd, (off_t)new_offset, SEEK_SET);
- if (result < 0) {
- error.SetErrno("Failed to seek");
+ if (!reader.Seek((off_t)new_offset, error))
return false;
- }
- offset = (offset_type)result;
+ offset = new_offset;
return true;
}
size_t
FileInputStream::Read(void *ptr, size_t read_size, Error &error)
{
- ssize_t nbytes = read(fd, ptr, read_size);
- if (nbytes < 0) {
- error.SetErrno("Failed to read");
+ ssize_t nbytes = reader.Read(ptr, read_size, error);
+ if (nbytes < 0)
return 0;
- }
offset += nbytes;
return (size_t)nbytes;
diff --git a/src/input/plugins/FileInputPlugin.hxx b/src/input/plugins/FileInputPlugin.hxx
index ee194ec34..a00401c53 100644
--- a/src/input/plugins/FileInputPlugin.hxx
+++ b/src/input/plugins/FileInputPlugin.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/plugins/MmsInputPlugin.cxx b/src/input/plugins/MmsInputPlugin.cxx
index d01cff3b3..244dfd945 100644
--- a/src/input/plugins/MmsInputPlugin.cxx
+++ b/src/input/plugins/MmsInputPlugin.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/plugins/MmsInputPlugin.hxx b/src/input/plugins/MmsInputPlugin.hxx
index b4017ffd6..cf1b9ba65 100644
--- a/src/input/plugins/MmsInputPlugin.hxx
+++ b/src/input/plugins/MmsInputPlugin.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/plugins/NfsInputPlugin.cxx b/src/input/plugins/NfsInputPlugin.cxx
index c6c0970b9..077362c18 100644
--- a/src/input/plugins/NfsInputPlugin.cxx
+++ b/src/input/plugins/NfsInputPlugin.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -28,10 +28,6 @@
#include "util/StringUtil.hxx"
#include "util/Error.hxx"
-extern "C" {
-#include <nfsc/libnfs.h>
-}
-
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -225,7 +221,7 @@ NfsInputStream::OnNfsFileError(Error &&error)
*/
static InputPlugin::InitResult
-input_nfs_init(const config_param &, Error &)
+input_nfs_init(const ConfigBlock &, Error &)
{
nfs_init();
return InputPlugin::InitResult::SUCCESS;
diff --git a/src/input/plugins/NfsInputPlugin.hxx b/src/input/plugins/NfsInputPlugin.hxx
index d2cc87549..5420ec967 100644
--- a/src/input/plugins/NfsInputPlugin.hxx
+++ b/src/input/plugins/NfsInputPlugin.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/plugins/RewindInputPlugin.cxx b/src/input/plugins/RewindInputPlugin.cxx
index 95f604044..cd027299c 100644
--- a/src/input/plugins/RewindInputPlugin.cxx
+++ b/src/input/plugins/RewindInputPlugin.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/plugins/RewindInputPlugin.hxx b/src/input/plugins/RewindInputPlugin.hxx
index 56b01b585..099921e7a 100644
--- a/src/input/plugins/RewindInputPlugin.hxx
+++ b/src/input/plugins/RewindInputPlugin.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/input/plugins/SmbclientInputPlugin.cxx b/src/input/plugins/SmbclientInputPlugin.cxx
index 399613720..ec6857c19 100644
--- a/src/input/plugins/SmbclientInputPlugin.cxx
+++ b/src/input/plugins/SmbclientInputPlugin.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -66,14 +66,14 @@ public:
*/
static InputPlugin::InitResult
-input_smbclient_init(gcc_unused const config_param &param, Error &error)
+input_smbclient_init(gcc_unused const ConfigBlock &block, Error &error)
{
if (!SmbclientInit(error))
return InputPlugin::InitResult::UNAVAILABLE;
// TODO: create one global SMBCCTX here?
- // TODO: evaluate config_param, call smbc_setOption*()
+ // TODO: evaluate ConfigBlock, call smbc_setOption*()
return InputPlugin::InitResult::SUCCESS;
}
diff --git a/src/input/plugins/SmbclientInputPlugin.hxx b/src/input/plugins/SmbclientInputPlugin.hxx
index a0539d020..31c55196c 100644
--- a/src/input/plugins/SmbclientInputPlugin.hxx
+++ b/src/input/plugins/SmbclientInputPlugin.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify