Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
frame.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 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_audio/frame.h
10//! @brief Audio frame.
11
12#ifndef ROC_AUDIO_FRAME_H_
13#define ROC_AUDIO_FRAME_H_
14
15#include "roc_audio/sample.h"
17
18namespace roc {
19namespace audio {
20
21//! Audio frame.
22class Frame : public core::NonCopyable<> {
23public:
24 //! Construct frame from samples.
25 //! @remarks
26 //! The pointer is saved in the frame, no copying is performed.
28
29 //! Frame flags.
30 enum {
31 //! Set if the frame has at least some samples from packets.
32 //! If this flag is clear, frame is completely zero because of lack of packets.
33 FlagNonblank = (1 << 0),
34
35 //! Set if the frame is not fully filled with samples from packets.
36 //! If this flag is set, frame is partially zero because of lack of packets.
37 FlagIncomplete = (1 << 1),
38
39 //! Set if some late packets were dropped while the frame was being built.
40 //! It's not necessarty that the frame itself is blank or incomplete.
41 FlagDrops = (1 << 2)
42 };
43
44 //! Set flags.
45 void set_flags(unsigned flags);
46
47 //! Get flags.
48 unsigned flags() const;
49
50 //! Get frame data.
51 sample_t* samples() const;
52
53 //! Get frame data size.
54 size_t num_samples() const;
55
56 //! Print frame to stderr.
57 void print() const;
58
59private:
60 sample_t* samples_;
61 size_t num_samples_;
62 unsigned flags_;
63};
64
65} // namespace audio
66} // namespace roc
67
68#endif // ROC_AUDIO_FRAME_H_
Audio frame.
Definition frame.h:22
void set_flags(unsigned flags)
Set flags.
unsigned flags() const
Get flags.
Frame(sample_t *samples, size_t num_samples)
Construct frame from samples.
void print() const
Print frame to stderr.
size_t num_samples() const
Get frame data size.
sample_t * samples() const
Get frame data.
@ FlagNonblank
Set if the frame has at least some samples from packets. If this flag is clear, frame is completely z...
Definition frame.h:33
@ FlagDrops
Set if some late packets were dropped while the frame was being built. It's not necessarty that the f...
Definition frame.h:41
@ FlagIncomplete
Set if the frame is not fully filled with samples from packets. If this flag is set,...
Definition frame.h:37
Base class for non-copyable objects.
Definition noncopyable.h:23
float sample_t
Audio sample.
Definition sample.h:22
Root namespace.
Non-copyable object.
Audio sample.