Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
ibackend.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/ibackend.h
10 //! @brief Backend interface.
11 
12 #ifndef ROC_SNDIO_IBACKEND_H_
13 #define ROC_SNDIO_IBACKEND_H_
14 
15 #include "roc_core/array.h"
16 #include "roc_core/iarena.h"
17 #include "roc_sndio/config.h"
18 #include "roc_sndio/device_type.h"
19 #include "roc_sndio/driver.h"
20 #include "roc_sndio/idevice.h"
21 
22 namespace roc {
23 namespace sndio {
24 
25 //! Maximum number of backends.
26 static const size_t MaxBackends = 8;
27 
28 //! Backend interface.
29 class IBackend {
30 public:
31  virtual ~IBackend();
32 
33  //! Append supported drivers to the list.
34  virtual void discover_drivers(core::Array<DriverInfo, MaxDrivers>& driver_list) = 0;
35 
36  //! Create and open a sink or source.
37  virtual IDevice* open_device(DeviceType device_type,
38  DriverType driver_type,
39  const char* driver,
40  const char* path,
41  const Config& config,
42  core::IArena& arena) = 0;
43  //! Returns name of backend.
44  virtual const char* name() const = 0;
45 };
46 
47 } // namespace sndio
48 } // namespace roc
49 
50 #endif // ROC_SNDIO_IBACKEND_H_
Dynamic array.
Dynamic array.
Definition: array.h:40
Memory arena interface.
Definition: iarena.h:23
Backend interface.
Definition: ibackend.h:29
virtual const char * name() const =0
Returns name of backend.
virtual void discover_drivers(core::Array< DriverInfo, MaxDrivers > &driver_list)=0
Append supported drivers to the list.
virtual IDevice * open_device(DeviceType device_type, DriverType driver_type, const char *driver, const char *path, const Config &config, core::IArena &arena)=0
Create and open a sink or source.
Base interface for sinks and sources.
Definition: idevice.h:28
Device type.
Driver types.
Memory arena interface.
Device interface.
DeviceType
Device type.
Definition: device_type.h:19
DriverType
Driver type.
Definition: driver.h:27
Root namespace.
Sink and source config.
Sink and source config.
Definition: config.h:29