Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Toggle main menu visibility
Loading...
Searching...
No Matches
transcoder_source.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2020 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_source.h
10
//! @brief Transcoder source pipeline.
11
12
#ifndef ROC_PIPELINE_TRANSCODER_SOURCE_H_
13
#define ROC_PIPELINE_TRANSCODER_SOURCE_H_
14
15
#include "
roc_audio/channel_mapper_reader.h
"
16
#include "
roc_audio/frame_factory.h
"
17
#include "
roc_audio/iresampler.h
"
18
#include "
roc_audio/profiling_reader.h
"
19
#include "
roc_audio/resampler_reader.h
"
20
#include "
roc_core/ipool.h
"
21
#include "
roc_core/optional.h
"
22
#include "
roc_core/scoped_ptr.h
"
23
#include "
roc_pipeline/config.h
"
24
#include "
roc_sndio/isource.h
"
25
26
namespace
roc
{
27
namespace
pipeline
{
28
29
//! Transcoder source pipeline.
30
//! @remarks
31
//! - input: frames
32
//! - output: frames
33
class
TranscoderSource
:
public
sndio::ISource
,
public
core::NonCopyable
<> {
34
public
:
35
//! Initialize.
36
TranscoderSource
(
const
TranscoderConfig
& config,
37
sndio::ISource
& input_source,
38
core::IPool
& buffer_pool,
39
core::IArena
& arena);
40
41
//! Check if the pipeline was successfully constructed.
42
bool
is_valid
();
43
44
//! Cast IDevice to ISink.
45
virtual
sndio::ISink
*
to_sink
();
46
47
//! Cast IDevice to ISink.
48
virtual
sndio::ISource
*
to_source
();
49
50
//! Get device type.
51
virtual
sndio::DeviceType
type
()
const
;
52
53
//! Get device state.
54
virtual
sndio::DeviceState
state
()
const
;
55
56
//! Pause reading.
57
virtual
void
pause
();
58
59
//! Resume paused reading.
60
virtual
bool
resume
();
61
62
//! Restart reading from the beginning.
63
virtual
bool
restart
();
64
65
//! Get sample specification of the source.
66
virtual
audio::SampleSpec
sample_spec
()
const
;
67
68
//! Get latency of the source.
69
virtual
core::nanoseconds_t
latency
()
const
;
70
71
//! Check if the source supports latency reports.
72
virtual
bool
has_latency
()
const
;
73
74
//! Check if the sink has own clock.
75
virtual
bool
has_clock
()
const
;
76
77
//! Adjust source clock to match consumer clock.
78
virtual
void
reclock
(
core::nanoseconds_t
timestamp);
79
80
//! Read frame.
81
virtual
bool
read
(
audio::Frame
&);
82
83
private
:
84
audio::FrameFactory
frame_factory_;
85
86
core::Optional<audio::ChannelMapperReader>
channel_mapper_reader_;
87
88
core::Optional<audio::ResamplerReader>
resampler_reader_;
89
core::SharedPtr<audio::IResampler>
resampler_;
90
91
core::Optional<audio::ProfilingReader>
profiler_;
92
93
sndio::ISource
& input_source_;
94
audio::IFrameReader
* frame_reader_;
95
96
TranscoderConfig
config_;
97
98
bool
valid_;
99
};
100
101
}
// namespace pipeline
102
}
// namespace roc
103
104
#endif
// ROC_PIPELINE_TRANSCODER_SOURCE_H_
channel_mapper_reader.h
Channel mapper reader.
roc::audio::FrameFactory
Frame factory.
Definition
frame_factory.h:38
roc::audio::Frame
Audio frame.
Definition
frame.h:25
roc::audio::IFrameReader
Frame reader interface.
Definition
iframe_reader.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::TranscoderSource::to_sink
virtual sndio::ISink * to_sink()
Cast IDevice to ISink.
roc::pipeline::TranscoderSource::state
virtual sndio::DeviceState state() const
Get device state.
roc::pipeline::TranscoderSource::pause
virtual void pause()
Pause reading.
roc::pipeline::TranscoderSource::type
virtual sndio::DeviceType type() const
Get device type.
roc::pipeline::TranscoderSource::sample_spec
virtual audio::SampleSpec sample_spec() const
Get sample specification of the source.
roc::pipeline::TranscoderSource::resume
virtual bool resume()
Resume paused reading.
roc::pipeline::TranscoderSource::is_valid
bool is_valid()
Check if the pipeline was successfully constructed.
roc::pipeline::TranscoderSource::latency
virtual core::nanoseconds_t latency() const
Get latency of the source.
roc::pipeline::TranscoderSource::reclock
virtual void reclock(core::nanoseconds_t timestamp)
Adjust source clock to match consumer clock.
roc::pipeline::TranscoderSource::read
virtual bool read(audio::Frame &)
Read frame.
roc::pipeline::TranscoderSource::has_clock
virtual bool has_clock() const
Check if the sink has own clock.
roc::pipeline::TranscoderSource::restart
virtual bool restart()
Restart reading from the beginning.
roc::pipeline::TranscoderSource::to_source
virtual sndio::ISource * to_source()
Cast IDevice to ISink.
roc::pipeline::TranscoderSource::has_latency
virtual bool has_latency() const
Check if the source supports latency reports.
roc::pipeline::TranscoderSource::TranscoderSource
TranscoderSource(const TranscoderConfig &config, sndio::ISource &input_source, core::IPool &buffer_pool, core::IArena &arena)
Initialize.
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.
isource.h
Source 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.
optional.h
Optionally constructed object.
profiling_reader.h
Profiling reader.
resampler_reader.h
Resampler.
config.h
Pipeline config.
scoped_ptr.h
Unique ownrship pointer.
roc::pipeline::TranscoderConfig
Converter parameters.
Definition
config.h:214
roc_pipeline
transcoder_source.h
Generated by
1.17.0