Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Toggle main menu visibility
Loading...
Searching...
No Matches
backend_dispatcher.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2019 Roc Streaming authors
3
*
4
* This Source Code Form is subject to the terms of the Mozilla Public
5
* License, v. 2.0. If a copy of the MPL was not distributed with this
6
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
*/
8
9
//! @file roc_sndio/backend_dispatcher.h
10
//! @brief Backend dispatcher.
11
12
#ifndef ROC_SNDIO_BACKEND_DISPATCHER_H_
13
#define ROC_SNDIO_BACKEND_DISPATCHER_H_
14
15
#include "
roc_address/io_uri.h
"
16
#include "
roc_audio/sample_spec.h
"
17
#include "
roc_core/attributes.h
"
18
#include "
roc_core/iarena.h
"
19
#include "
roc_core/noncopyable.h
"
20
#include "
roc_core/singleton.h
"
21
#include "
roc_core/string_list.h
"
22
#include "
roc_sndio/device_type.h
"
23
#include "
roc_sndio/driver.h
"
24
#include "
roc_sndio/ibackend.h
"
25
#include "
roc_sndio/isink.h
"
26
#include "
roc_sndio/isource.h
"
27
28
namespace
roc
{
29
namespace
sndio
{
30
31
//! Backend dispatcher.
32
class
BackendDispatcher
:
public
core::NonCopyable
<> {
33
public
:
34
//! Initialize.
35
BackendDispatcher
(
core::IArena
& arena);
36
37
//! Create and open default sink.
38
ISink
*
open_default_sink
(
const
Config
& config);
39
40
//! Create and open default source.
41
ISource
*
open_default_source
(
const
Config
& config);
42
43
//! Create and open a sink.
44
ISink
*
45
open_sink
(
const
address::IoUri
& uri,
const
char
* force_format,
const
Config
& config);
46
47
//! Create and open a source.
48
ISource
*
open_source
(
const
address::IoUri
& uri,
49
const
char
* force_format,
50
const
Config
& config);
51
52
//! Get all supported URI schemes.
53
ROC_ATTR_NODISCARD
bool
get_supported_schemes
(
core::StringList
& result);
54
55
//! Get all supported file formats.
56
ROC_ATTR_NODISCARD
bool
get_supported_formats
(
core::StringList
& result);
57
58
private
:
59
IDevice
* open_default_device_(
DeviceType
device_type,
const
Config
& config);
60
61
IDevice
* open_device_(
DeviceType
device_type,
62
DriverType
driver_type,
63
const
char
* driver_name,
64
const
char
* path,
65
const
Config
& config);
66
67
core::IArena
& arena_;
68
};
69
70
}
// namespace sndio
71
}
// namespace roc
72
73
#endif
// ROC_SNDIO_BACKEND_DISPATCHER_H_
attributes.h
Compiler attributes.
ROC_ATTR_NODISCARD
#define ROC_ATTR_NODISCARD
Emit warning if function result is not checked.
Definition
attributes.h:31
roc::address::IoUri
Audio file or device URI.
Definition
io_uri.h:25
roc::core::IArena
Memory arena interface.
Definition
iarena.h:23
roc::core::NonCopyable
Base class for non-copyable objects.
Definition
noncopyable.h:23
roc::core::StringList
Dynamic list of strings.
Definition
string_list.h:36
roc::sndio::BackendDispatcher::open_sink
ISink * open_sink(const address::IoUri &uri, const char *force_format, const Config &config)
Create and open a sink.
roc::sndio::BackendDispatcher::open_source
ISource * open_source(const address::IoUri &uri, const char *force_format, const Config &config)
Create and open a source.
roc::sndio::BackendDispatcher::BackendDispatcher
BackendDispatcher(core::IArena &arena)
Initialize.
roc::sndio::BackendDispatcher::get_supported_schemes
ROC_ATTR_NODISCARD bool get_supported_schemes(core::StringList &result)
Get all supported URI schemes.
roc::sndio::BackendDispatcher::get_supported_formats
ROC_ATTR_NODISCARD bool get_supported_formats(core::StringList &result)
Get all supported file formats.
roc::sndio::BackendDispatcher::open_default_source
ISource * open_default_source(const Config &config)
Create and open default source.
roc::sndio::BackendDispatcher::open_default_sink
ISink * open_default_sink(const Config &config)
Create and open default sink.
roc::sndio::IDevice
Base interface for sinks and sources.
Definition
idevice.h:28
roc::sndio::ISink
Sink interface.
Definition
isink.h:22
roc::sndio::ISource
Source interface.
Definition
isource.h:23
device_type.h
Device type.
driver.h
Driver types.
iarena.h
Memory arena interface.
ibackend.h
Backend interface.
io_uri.h
Audio file or device URI.
isink.h
Sink interface.
isource.h
Source interface.
roc::sndio
Sound I/O.
roc::sndio::DeviceType
DeviceType
Device type.
Definition
device_type.h:19
roc::sndio::DriverType
DriverType
Driver type.
Definition
driver.h:27
roc
Root namespace.
noncopyable.h
Non-copyable object.
sample_spec.h
Sample specifications.
singleton.h
Singleton.
string_list.h
Dynamic list of strings.
roc::sndio::Config
Sink and source config.
Definition
config.h:29
roc_sndio
backend_dispatcher.h
Generated by
1.17.0