Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
converter_sink.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_pipeline/converter_sink.h
10//! @brief Converter sink pipeline.
11
12#ifndef ROC_PIPELINE_CONVERTER_SINK_H_
13#define ROC_PIPELINE_CONVERTER_SINK_H_
14
24#include "roc_core/optional.h"
25#include "roc_core/scoped_ptr.h"
26#include "roc_pipeline/config.h"
27#include "roc_sndio/isink.h"
28
29namespace roc {
30namespace pipeline {
31
32//! Converter sink pipeline.
33//! @remarks
34//! - input: frames
35//! - output: frames
37public:
38 //! Initialize.
40 audio::IFrameWriter* output_writer,
42 core::IAllocator& allocator);
43
44 //! Check if the pipeline was successfully constructed.
45 bool valid();
46
47 //! Get sample specification of the sink.
49
50 //! Get latency of the sink.
52
53 //! Check if the sink has own clock.
54 virtual bool has_clock() const;
55
56 //! Write audio frame.
57 virtual void write(audio::Frame& frame);
58
59private:
60 audio::NullWriter null_writer_;
61
62 core::Optional<audio::ChannelMapperWriter> channel_mapper_writer_;
63
64 core::Optional<audio::PoisonWriter> resampler_poisoner_;
67
68 core::Optional<audio::PoisonWriter> pipeline_poisoner_;
69
71
72 audio::IFrameWriter* audio_writer_;
73
74 const ConverterConfig config_;
75};
76
77} // namespace pipeline
78} // namespace roc
79
80#endif // ROC_PIPELINE_CONVERTER_SINK_H_
Buffer factory.
Channel mapper writer.
Audio frame.
Definition frame.h:22
Frame writer interface.
Sample stream specification. Defines sample rate and channel layout.
Definition sample_spec.h:24
Memory allocator interface.
Definition iallocator.h:23
Base class for non-copyable objects.
Definition noncopyable.h:23
Optionally constructed object.
Definition optional.h:25
Unique ownrship pointer.
Definition scoped_ptr.h:32
Converter sink pipeline.
virtual core::nanoseconds_t latency() const
Get latency of the sink.
virtual void write(audio::Frame &frame)
Write audio frame.
bool valid()
Check if the pipeline was successfully constructed.
ConverterSink(const ConverterConfig &config, audio::IFrameWriter *output_writer, core::BufferFactory< audio::sample_t > &buffer_factory, core::IAllocator &allocator)
Initialize.
virtual audio::SampleSpec sample_spec() const
Get sample specification of the sink.
virtual bool has_clock() const
Check if the sink has own clock.
Sink interface.
Definition isink.h:22
Audio resampler interface.
Sink interface.
int64_t nanoseconds_t
Nanoseconds.
Definition time.h:58
Root namespace.
Null writer.
Optionally constructed object.
Poison writer.
Profiling writer.
Resampler map.
Resampler profile.
Pipeline config.
Unique ownrship pointer.
Converter parameters.
Definition config.h:259