Merge branch 'runtime_enumeration' of git://github.com/eugene2k/MPD
This commit is contained in:
@@ -486,4 +486,5 @@ const struct InputPlugin input_plugin_alsa = {
|
||||
alsa_input_init,
|
||||
nullptr,
|
||||
alsa_input_open,
|
||||
nullptr
|
||||
};
|
||||
|
||||
@@ -360,4 +360,5 @@ const InputPlugin input_plugin_cdio_paranoia = {
|
||||
input_cdio_init,
|
||||
nullptr,
|
||||
input_cdio_open,
|
||||
nullptr
|
||||
};
|
||||
|
||||
@@ -470,16 +470,25 @@ input_curl_open(const char *url, Mutex &mutex)
|
||||
return CurlInputStream::Open(url, {}, mutex);
|
||||
}
|
||||
|
||||
static constexpr const char *curl_prefixes[] = {
|
||||
"http://",
|
||||
"https://",
|
||||
nullptr
|
||||
};
|
||||
static std::set<std::string>
|
||||
input_curl_protocols() {
|
||||
std::set<std::string> protocols;
|
||||
auto version_info = curl_version_info(CURLVERSION_FIRST);
|
||||
for (auto proto_ptr = version_info->protocols; *proto_ptr != nullptr; proto_ptr++) {
|
||||
if (protocol_is_whitelisted(*proto_ptr)) {
|
||||
std::string schema(*proto_ptr);
|
||||
schema.append("://");
|
||||
protocols.emplace(schema);
|
||||
}
|
||||
}
|
||||
return protocols;
|
||||
}
|
||||
|
||||
const struct InputPlugin input_plugin_curl = {
|
||||
"curl",
|
||||
curl_prefixes,
|
||||
nullptr,
|
||||
input_curl_init,
|
||||
input_curl_finish,
|
||||
input_curl_open,
|
||||
input_curl_protocols
|
||||
};
|
||||
|
||||
@@ -25,8 +25,13 @@
|
||||
#include "lib/ffmpeg/Init.hxx"
|
||||
#include "lib/ffmpeg/Error.hxx"
|
||||
#include "../InputStream.hxx"
|
||||
#include "../InputPlugin.hxx"
|
||||
#include "PluginUnavailable.hxx"
|
||||
#include "util/StringAPI.hxx"
|
||||
#include "../InputPlugin.hxx"
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
#include <typeinfo>
|
||||
#include <stdexcept>
|
||||
|
||||
class FfmpegInputStream final : public InputStream {
|
||||
Ffmpeg::IOContext io;
|
||||
@@ -73,6 +78,22 @@ input_ffmpeg_init(EventLoop &, const ConfigBlock &)
|
||||
throw PluginUnavailable("No protocol");
|
||||
}
|
||||
|
||||
static std::set<std::string>
|
||||
input_ffmpeg_protocols() {
|
||||
void *opaque = nullptr;
|
||||
const char* protocol;
|
||||
std::set<std::string> protocols;
|
||||
while ((protocol = avio_enum_protocols(&opaque, 0))) {
|
||||
if (protocol_is_whitelisted(protocol)) {
|
||||
std::string schema(protocol);
|
||||
schema.append("://");
|
||||
protocols.emplace(schema);
|
||||
}
|
||||
}
|
||||
|
||||
return protocols;
|
||||
}
|
||||
|
||||
static InputStreamPtr
|
||||
input_ffmpeg_open(const char *uri,
|
||||
Mutex &mutex)
|
||||
@@ -114,20 +135,11 @@ FfmpegInputStream::Seek(std::unique_lock<Mutex> &, offset_type new_offset)
|
||||
offset = result;
|
||||
}
|
||||
|
||||
static constexpr const char *ffmpeg_prefixes[] = {
|
||||
"gopher://",
|
||||
"rtp://",
|
||||
"rtsp://",
|
||||
"rtmp://",
|
||||
"rtmpt://",
|
||||
"rtmps://",
|
||||
nullptr
|
||||
};
|
||||
|
||||
const InputPlugin input_plugin_ffmpeg = {
|
||||
"ffmpeg",
|
||||
ffmpeg_prefixes,
|
||||
nullptr,
|
||||
input_ffmpeg_init,
|
||||
nullptr,
|
||||
input_ffmpeg_open,
|
||||
input_ffmpeg_protocols
|
||||
};
|
||||
|
||||
@@ -110,4 +110,5 @@ const InputPlugin input_plugin_mms = {
|
||||
nullptr,
|
||||
nullptr,
|
||||
input_mms_open,
|
||||
nullptr
|
||||
};
|
||||
|
||||
@@ -232,4 +232,5 @@ const InputPlugin input_plugin_nfs = {
|
||||
input_nfs_init,
|
||||
input_nfs_finish,
|
||||
input_nfs_open,
|
||||
nullptr
|
||||
};
|
||||
|
||||
@@ -219,5 +219,6 @@ const InputPlugin qobuz_input_plugin = {
|
||||
InitQobuzInput,
|
||||
FinishQobuzInput,
|
||||
OpenQobuzInput,
|
||||
nullptr,
|
||||
ScanQobuzTags,
|
||||
};
|
||||
|
||||
@@ -166,4 +166,5 @@ const InputPlugin input_plugin_smbclient = {
|
||||
input_smbclient_init,
|
||||
nullptr,
|
||||
input_smbclient_open,
|
||||
nullptr
|
||||
};
|
||||
|
||||
@@ -251,5 +251,6 @@ const InputPlugin tidal_input_plugin = {
|
||||
InitTidalInput,
|
||||
FinishTidalInput,
|
||||
OpenTidalInput,
|
||||
nullptr,
|
||||
ScanTidalTags,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user