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 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/iallocator.h"
17 #include "roc_core/shared_ptr.h"
18 #include "roc_sndio/config.h"
19 #include "roc_sndio/driver_info.h"
20 #include "roc_sndio/isink.h"
21 #include "roc_sndio/isource.h"
22 
23 namespace roc {
24 namespace sndio {
25 
26 //! Backend interface.
27 class IBackend {
28 public:
29  virtual ~IBackend();
30 
31  //! Probing flags.
32  enum FilterFlags {
33  //! Input or output may be a sink.
34  FilterSink = (1 << 0),
35 
36  //! Input or output may be a source.
37  FilterSource = (1 << 1),
38 
39  //! Input or output may be a file.
40  FilterFile = (1 << 2),
41 
42  //! Input or output may be a device.
43  FilterDevice = (1 << 3)
44  };
45 
46  //! Check whether the backend can handle given input or output.
47  virtual bool probe(const char* driver, const char* inout, int filter_flags) = 0;
48 
49  //! Create and open a sink.
50  virtual ISink* open_sink(core::IAllocator& allocator,
51  const char* driver,
52  const char* output,
53  const Config& config) = 0;
54 
55  //! Create and open a source.
56  virtual ISource* open_source(core::IAllocator& allocator,
57  const char* driver,
58  const char* input,
59  const Config& config) = 0;
60 
61  //! Append supported dirvers to the list.
62  virtual bool get_drivers(core::Array<DriverInfo>& arr, int filter_flags) = 0;
63 };
64 
65 } // namespace sndio
66 } // namespace roc
67 
68 #endif // ROC_SNDIO_IBACKEND_H_
virtual ISink * open_sink(core::IAllocator &allocator, const char *driver, const char *output, const Config &config)=0
Create and open a sink.
Sink interface.
Definition: isink.h:21
Memory allocator interface.
Definition: iallocator.h:23
Sink interface.
virtual ISource * open_source(core::IAllocator &allocator, const char *driver, const char *input, const Config &config)=0
Create and open a source.
virtual bool probe(const char *driver, const char *inout, int filter_flags)=0
Check whether the backend can handle given input or output.
Root namespace.
Input or output may be a sink.
Definition: ibackend.h:34
Shared ownership intrusive pointer.
Sink and source config.
Dynamic array.
Input or output may be a file.
Definition: ibackend.h:40
Sink and source config.
Definition: config.h:22
Source interface.
Driver info interface.
FilterFlags
Probing flags.
Definition: ibackend.h:32
Dynamic array.
Definition: array.h:25
Input or output may be a source.
Definition: ibackend.h:37
virtual bool get_drivers(core::Array< DriverInfo > &arr, int filter_flags)=0
Append supported dirvers to the list.
Input or output may be a device.
Definition: ibackend.h:43
Source interface.
Definition: isource.h:21
Backend interface.
Definition: ibackend.h:27
Memory allocator interface.