Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Toggle main menu visibility
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
15
#include "
roc_audio/channel_mapper_writer.h
"
16
#include "
roc_audio/frame_factory.h
"
17
#include "
roc_audio/iresampler.h
"
18
#include "
roc_audio/null_writer.h
"
19
#include "
roc_audio/profiling_writer.h
"
20
#include "
roc_audio/resampler_writer.h
"
21
#include "
roc_core/ipool.h
"
22
#include "
roc_core/optional.h
"
23
#include "
roc_core/scoped_ptr.h
"
24
#include "
roc_pipeline/config.h
"
25
#include "
roc_sndio/isink.h
"
26
27
namespace
roc
{
28
namespace
pipeline
{
29
30
//! Transcoder sink pipeline.
31
//! @remarks
32
//! - input: frames
33
//! - output: frames
34
class
TranscoderSink
:
public
sndio::ISink
,
public
core::NonCopyable
<> {
35
public
:
36
//! Initialize.
37
TranscoderSink
(
const
TranscoderConfig
& config,
38
audio::IFrameWriter
* output_writer,
39
core::IPool
& buffer_pool,
40
core::IArena
& arena);
41
42
//! Check if the pipeline was successfully constructed.
43
bool
is_valid
();
44
45
//! Cast IDevice to ISink.
46
virtual
sndio::ISink
*
to_sink
();
47
48
//! Cast IDevice to ISink.
49
virtual
sndio::ISource
*
to_source
();
50
51
//! Get device type.
52
virtual
sndio::DeviceType
type
()
const
;
53
54
//! Get device state.
55
virtual
sndio::DeviceState
state
()
const
;
56
57
//! Pause reading.
58
virtual
void
pause
();
59
60
//! Resume paused reading.
61
virtual
bool
resume
();
62
63
//! Restart reading from the beginning.
64
virtual
bool
restart
();
65
66
//! Get sample specification of the sink.
67
virtual
audio::SampleSpec
sample_spec
()
const
;
68
69
//! Get latency of the sink.
70
virtual
core::nanoseconds_t
latency
()
const
;
71
72
//! Check if the sink supports latency reports.
73
virtual
bool
has_latency
()
const
;
74
75
//! Check if the sink has own clock.
76
virtual
bool
has_clock
()
const
;
77
78
//! Write audio frame.
79
virtual
void
write
(
audio::Frame
& frame);
80
81
private
:
82
audio::FrameFactory
frame_factory_;
83
84
audio::NullWriter
null_writer_;
85
86
core::Optional<audio::ChannelMapperWriter>
channel_mapper_writer_;
87
88
core::Optional<audio::ResamplerWriter>
resampler_writer_;
89
core::SharedPtr<audio::IResampler>
resampler_;
90
91
core::Optional<audio::ProfilingWriter>
profiler_;
92
93
audio::IFrameWriter
* frame_writer_;
94
95
TranscoderConfig
config_;
96
97
bool
valid_;
98
};
99
100
}
// namespace pipeline
101
}
// namespace roc
102
103
#endif
// ROC_PIPELINE_TRANSCODER_SINK_H_
channel_mapper_writer.h
Channel mapper writer.
roc::audio::FrameFactory
Frame factory.
Definition
frame_factory.h:38
roc::audio::Frame
Audio frame.
Definition
frame.h:25
roc::audio::IFrameWriter
Frame writer interface.
Definition
iframe_writer.h:22
roc::audio::NullWriter
Null writer.
Definition
null_writer.h:22
roc::audio::SampleSpec
Sample specification. Describes sample rate and channels.
Definition
sample_spec.h:30
roc::core::IArena
Memory arena interface.
Definition
iarena.h:23
roc::core::IPool
Memory pool interface.
Definition
ipool.h:23
roc::core::NonCopyable
Base class for non-copyable objects.
Definition
noncopyable.h:23
roc::core::Optional
Optionally constructed object.
Definition
optional.h:25
roc::core::SharedPtr
Shared ownership intrusive pointer.
Definition
shared_ptr.h:32
roc::pipeline::TranscoderSink::type
virtual sndio::DeviceType type() const
Get device type.
roc::pipeline::TranscoderSink::sample_spec
virtual audio::SampleSpec sample_spec() const
Get sample specification of the sink.
roc::pipeline::TranscoderSink::is_valid
bool is_valid()
Check if the pipeline was successfully constructed.
roc::pipeline::TranscoderSink::to_sink
virtual sndio::ISink * to_sink()
Cast IDevice to ISink.
roc::pipeline::TranscoderSink::latency
virtual core::nanoseconds_t latency() const
Get latency of the sink.
roc::pipeline::TranscoderSink::pause
virtual void pause()
Pause reading.
roc::pipeline::TranscoderSink::resume
virtual bool resume()
Resume paused reading.
roc::pipeline::TranscoderSink::restart
virtual bool restart()
Restart reading from the beginning.
roc::pipeline::TranscoderSink::write
virtual void write(audio::Frame &frame)
Write audio frame.
roc::pipeline::TranscoderSink::has_clock
virtual bool has_clock() const
Check if the sink has own clock.
roc::pipeline::TranscoderSink::state
virtual sndio::DeviceState state() const
Get device state.
roc::pipeline::TranscoderSink::TranscoderSink
TranscoderSink(const TranscoderConfig &config, audio::IFrameWriter *output_writer, core::IPool &buffer_pool, core::IArena &arena)
Initialize.
roc::pipeline::TranscoderSink::to_source
virtual sndio::ISource * to_source()
Cast IDevice to ISink.
roc::pipeline::TranscoderSink::has_latency
virtual bool has_latency() const
Check if the sink supports latency reports.
roc::sndio::ISink
Sink interface.
Definition
isink.h:22
roc::sndio::ISource
Source interface.
Definition
isource.h:23
frame_factory.h
Frame factory.
ipool.h
Memory pool interface.
iresampler.h
Audio resampler interface.
isink.h
Sink interface.
roc::core::nanoseconds_t
int64_t nanoseconds_t
Nanoseconds.
Definition
time.h:58
roc::pipeline
Sender and receiver processing pipelines.
roc::sndio::DeviceType
DeviceType
Device type.
Definition
device_type.h:19
roc::sndio::DeviceState
DeviceState
Device state.
Definition
device_state.h:19
roc
Root namespace.
null_writer.h
Null writer.
optional.h
Optionally constructed object.
profiling_writer.h
Profiling writer.
resampler_writer.h
Resampler.
config.h
Pipeline config.
scoped_ptr.h
Unique ownrship pointer.
roc::pipeline::TranscoderConfig
Converter parameters.
Definition
config.h:214
roc_pipeline
transcoder_sink.h
Generated by
1.17.0