Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
transcoder_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/transcoder_sink.h
10//! @brief Transcoder sink pipeline.
11
12#ifndef ROC_PIPELINE_TRANSCODER_SINK_H_
13#define ROC_PIPELINE_TRANSCODER_SINK_H_
14
23#include "roc_core/optional.h"
24#include "roc_core/scoped_ptr.h"
25#include "roc_pipeline/config.h"
26#include "roc_sndio/isink.h"
27
28namespace roc {
29namespace pipeline {
30
31//! Transcoder sink pipeline.
32//! @remarks
33//! - input: frames
34//! - output: frames
36public:
37 //! Initialize.
39 audio::IFrameWriter* output_writer,
41 core::IArena& arena);
42
43 //! Check if the pipeline was successfully constructed.
44 bool is_valid();
45
46 //! Get device type.
47 virtual sndio::DeviceType type() const;
48
49 //! Get device state.
50 virtual sndio::DeviceState state() const;
51
52 //! Pause reading.
53 virtual void pause();
54
55 //! Resume paused reading.
56 virtual bool resume();
57
58 //! Restart reading from the beginning.
59 virtual bool restart();
60
61 //! Get sample specification of the sink.
63
64 //! Get latency of the sink.
66
67 //! Check if the sink supports latency reports.
68 virtual bool has_latency() const;
69
70 //! Check if the sink has own clock.
71 virtual bool has_clock() const;
72
73 //! Write audio frame.
74 virtual void write(audio::Frame& frame);
75
76private:
77 audio::NullWriter null_writer_;
78
79 core::Optional<audio::ChannelMapperWriter> channel_mapper_writer_;
80
83
85
86 audio::IFrameWriter* audio_writer_;
87
88 const TranscoderConfig config_;
89};
90
91} // namespace pipeline
92} // namespace roc
93
94#endif // ROC_PIPELINE_TRANSCODER_SINK_H_
Buffer factory.
Channel mapper writer.
Audio frame.
Definition frame.h:25
Frame writer interface.
Sample specification. Describes sample rate and channels.
Definition sample_spec.h:26
Memory arena interface.
Definition iarena.h:23
Base class for non-copyable objects.
Definition noncopyable.h:23
Shared ownership intrusive pointer.
Definition shared_ptr.h:32
Transcoder sink pipeline.
virtual sndio::DeviceType type() const
Get device type.
TranscoderSink(const TranscoderConfig &config, audio::IFrameWriter *output_writer, core::BufferFactory< audio::sample_t > &buffer_factory, core::IArena &arena)
Initialize.
virtual audio::SampleSpec sample_spec() const
Get sample specification of the sink.
bool is_valid()
Check if the pipeline was successfully constructed.
virtual core::nanoseconds_t latency() const
Get latency of the sink.
virtual void pause()
Pause reading.
virtual bool resume()
Resume paused reading.
virtual bool restart()
Restart reading from the beginning.
virtual void write(audio::Frame &frame)
Write audio frame.
virtual bool has_clock() const
Check if the sink has own clock.
virtual sndio::DeviceState state() const
Get device state.
virtual bool has_latency() const
Check if the sink supports latency reports.
Sink interface.
Definition isink.h:22
Audio resampler interface.
Sink interface.
DeviceType
Device type.
Definition device_type.h:19
DeviceState
Device state.
Root namespace.
Null writer.
Optionally constructed object.
Profiling writer.
Resampler map.
Resampler profile.
Pipeline config.
Unique ownrship pointer.
Converter parameters.
Definition config.h:250