input/async: pass std::string_view to constructor
This commit is contained in:
parent
4800f1d8f2
commit
6d5dab38dd
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
AsyncInputStream::AsyncInputStream(EventLoop &event_loop, const char *_url,
|
AsyncInputStream::AsyncInputStream(EventLoop &event_loop, std::string_view _url,
|
||||||
Mutex &_mutex,
|
Mutex &_mutex,
|
||||||
size_t _buffer_size,
|
size_t _buffer_size,
|
||||||
size_t _resume_at) noexcept
|
size_t _resume_at) noexcept
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
// Copyright The Music Player Daemon Project
|
// Copyright The Music Player Daemon Project
|
||||||
|
|
||||||
#ifndef MPD_ASYNC_INPUT_STREAM_HXX
|
#pragma once
|
||||||
#define MPD_ASYNC_INPUT_STREAM_HXX
|
|
||||||
|
|
||||||
#include "InputStream.hxx"
|
#include "InputStream.hxx"
|
||||||
#include "event/InjectEvent.hxx"
|
#include "event/InjectEvent.hxx"
|
||||||
@ -54,7 +53,7 @@ protected:
|
|||||||
std::exception_ptr postponed_exception;
|
std::exception_ptr postponed_exception;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AsyncInputStream(EventLoop &event_loop, const char *_url,
|
AsyncInputStream(EventLoop &event_loop, std::string_view _url,
|
||||||
Mutex &_mutex,
|
Mutex &_mutex,
|
||||||
size_t _buffer_size,
|
size_t _buffer_size,
|
||||||
size_t _resume_at) noexcept;
|
size_t _resume_at) noexcept;
|
||||||
@ -155,5 +154,3 @@ private:
|
|||||||
void DeferredResume() noexcept;
|
void DeferredResume() noexcept;
|
||||||
void DeferredSeek() noexcept;
|
void DeferredSeek() noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -66,7 +66,7 @@ class CurlInputStream final : public AsyncInputStream, CurlResponseHandler {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
template<typename I>
|
template<typename I>
|
||||||
CurlInputStream(EventLoop &event_loop, const char *_url,
|
CurlInputStream(EventLoop &event_loop, std::string_view _url,
|
||||||
const Curl::Headers &headers,
|
const Curl::Headers &headers,
|
||||||
I &&_icy,
|
I &&_icy,
|
||||||
Mutex &_mutex);
|
Mutex &_mutex);
|
||||||
@ -76,7 +76,7 @@ public:
|
|||||||
CurlInputStream(const CurlInputStream &) = delete;
|
CurlInputStream(const CurlInputStream &) = delete;
|
||||||
CurlInputStream &operator=(const CurlInputStream &) = delete;
|
CurlInputStream &operator=(const CurlInputStream &) = delete;
|
||||||
|
|
||||||
static InputStreamPtr Open(const char *url,
|
static InputStreamPtr Open(std::string_view url,
|
||||||
const Curl::Headers &headers,
|
const Curl::Headers &headers,
|
||||||
Mutex &mutex);
|
Mutex &mutex);
|
||||||
|
|
||||||
@ -435,7 +435,7 @@ input_curl_finish() noexcept
|
|||||||
|
|
||||||
template<typename I>
|
template<typename I>
|
||||||
inline
|
inline
|
||||||
CurlInputStream::CurlInputStream(EventLoop &event_loop, const char *_url,
|
CurlInputStream::CurlInputStream(EventLoop &event_loop, std::string_view _url,
|
||||||
const Curl::Headers &headers,
|
const Curl::Headers &headers,
|
||||||
I &&_icy,
|
I &&_icy,
|
||||||
Mutex &_mutex)
|
Mutex &_mutex)
|
||||||
@ -568,7 +568,7 @@ CurlInputStream::DoSeek(offset_type new_offset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline InputStreamPtr
|
inline InputStreamPtr
|
||||||
CurlInputStream::Open(const char *url,
|
CurlInputStream::Open(std::string_view url,
|
||||||
const Curl::Headers &headers,
|
const Curl::Headers &headers,
|
||||||
Mutex &mutex)
|
Mutex &mutex)
|
||||||
{
|
{
|
||||||
@ -588,7 +588,7 @@ CurlInputStream::Open(const char *url,
|
|||||||
}
|
}
|
||||||
|
|
||||||
InputStreamPtr
|
InputStreamPtr
|
||||||
OpenCurlInputStream(const char *uri, const Curl::Headers &headers,
|
OpenCurlInputStream(std::string_view uri, const Curl::Headers &headers,
|
||||||
Mutex &mutex)
|
Mutex &mutex)
|
||||||
{
|
{
|
||||||
return CurlInputStream::Open(uri, headers, mutex);
|
return CurlInputStream::Open(uri, headers, mutex);
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
// Copyright The Music Player Daemon Project
|
// Copyright The Music Player Daemon Project
|
||||||
|
|
||||||
#ifndef MPD_INPUT_CURL_HXX
|
#pragma once
|
||||||
#define MPD_INPUT_CURL_HXX
|
|
||||||
|
|
||||||
#include "lib/curl/Headers.hxx"
|
#include "lib/curl/Headers.hxx"
|
||||||
#include "input/Ptr.hxx"
|
#include "input/Ptr.hxx"
|
||||||
#include "thread/Mutex.hxx"
|
#include "thread/Mutex.hxx"
|
||||||
|
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
extern const struct InputPlugin input_plugin_curl;
|
extern const struct InputPlugin input_plugin_curl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -18,7 +19,5 @@ extern const struct InputPlugin input_plugin_curl;
|
|||||||
* Throws on error.
|
* Throws on error.
|
||||||
*/
|
*/
|
||||||
InputStreamPtr
|
InputStreamPtr
|
||||||
OpenCurlInputStream(const char *uri, const Curl::Headers &headers,
|
OpenCurlInputStream(std::string_view uri, const Curl::Headers &headers,
|
||||||
Mutex &mutex);
|
Mutex &mutex);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -25,7 +25,7 @@ class NfsInputStream final : NfsFileReader, public AsyncInputStream {
|
|||||||
bool reconnect_on_resume = false, reconnecting = false;
|
bool reconnect_on_resume = false, reconnecting = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NfsInputStream(const char *_uri, Mutex &_mutex)
|
NfsInputStream(std::string_view _uri, Mutex &_mutex) noexcept
|
||||||
:AsyncInputStream(NfsFileReader::GetEventLoop(),
|
:AsyncInputStream(NfsFileReader::GetEventLoop(),
|
||||||
_uri, _mutex,
|
_uri, _mutex,
|
||||||
NFS_MAX_BUFFERED,
|
NFS_MAX_BUFFERED,
|
||||||
|
@ -45,7 +45,7 @@ class UringInputStream final : public AsyncInputStream, Uring::ReadHandler {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
UringInputStream(EventLoop &event_loop, Uring::Queue &_uring,
|
UringInputStream(EventLoop &event_loop, Uring::Queue &_uring,
|
||||||
const char *path,
|
std::string_view path,
|
||||||
UniqueFileDescriptor &&_fd,
|
UniqueFileDescriptor &&_fd,
|
||||||
offset_type _size, Mutex &_mutex)
|
offset_type _size, Mutex &_mutex)
|
||||||
:AsyncInputStream(event_loop,
|
:AsyncInputStream(event_loop,
|
||||||
|
Loading…
Reference in New Issue
Block a user