Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
delayed_reader.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015 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_packet/delayed_reader.h
10
//! @brief Delayed reader.
11
12
#ifndef ROC_PACKET_DELAYED_READER_H_
13
#define ROC_PACKET_DELAYED_READER_H_
14
15
#include "
roc_audio/sample_spec.h
"
16
#include "
roc_core/noncopyable.h
"
17
#include "
roc_core/time.h
"
18
#include "
roc_packet/ireader.h
"
19
#include "
roc_packet/sorted_queue.h
"
20
#include "
roc_packet/units.h
"
21
22
namespace
roc
{
23
namespace
packet {
24
25
//! Delayed reader.
26
//! @remarks
27
//! Delays audio packet reader for given amount of samples.
28
class
DelayedReader
:
public
IReader
,
public
core::NonCopyable
<> {
29
public
:
30
//! Initialize.
31
//!
32
//! @b Parameters
33
//! - @p reader is used to read packets
34
//! - @p delay is the delay to insert before first packet
35
//! - @p sample_spec is the specifications of incoming packets
36
DelayedReader
(
IReader
& reader,
37
core::nanoseconds_t
delay,
38
const
audio::SampleSpec
& sample_spec);
39
40
//! Read packet.
41
virtual
PacketPtr
read
();
42
43
private
:
44
bool
fetch_packets_();
45
PacketPtr
read_queued_packet_();
46
47
timestamp_t
queue_size_()
const
;
48
49
IReader
& reader_;
50
SortedQueue
queue_;
51
52
const
timestamp_t
delay_;
53
bool
started_;
54
};
55
56
}
// namespace packet
57
}
// namespace roc
58
59
#endif
// ROC_PACKET_DELAYED_READER_H_
roc::audio::SampleSpec
Sample stream specification. Defines sample rate and channel layout.
Definition
sample_spec.h:24
roc::core::NonCopyable
Base class for non-copyable objects.
Definition
noncopyable.h:23
roc::core::SharedPtr< Packet >
roc::packet::DelayedReader
Delayed reader.
Definition
delayed_reader.h:28
roc::packet::DelayedReader::DelayedReader
DelayedReader(IReader &reader, core::nanoseconds_t delay, const audio::SampleSpec &sample_spec)
Initialize.
roc::packet::DelayedReader::read
virtual PacketPtr read()
Read packet.
roc::packet::IReader
Packet reader interface.
Definition
ireader.h:21
roc::packet::SortedQueue
Sorted packet queue.
Definition
sorted_queue.h:27
ireader.h
Packet reader interface.
roc::core::nanoseconds_t
int64_t nanoseconds_t
Nanoseconds.
Definition
time.h:58
roc::packet::timestamp_t
uint32_t timestamp_t
Audio packet timestamp.
Definition
units.h:25
roc
Root namespace.
noncopyable.h
Non-copyable object.
sample_spec.h
Sample specifications.
sorted_queue.h
Sorted packet queue.
time.h
Time definitions.
units.h
Various units used in packets.
roc_packet
delayed_reader.h
Generated by
1.9.7