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 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/units.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 is fully filled with zeros instead of data from packets.
32 FlagBlank = (1 << 0),
33
34 //! Set if the frame is partially filled with zeros instead of data from packets.
35 FlagIncomplete = (1 << 1),
36
37 //! Set if some late packets were dropped while the frame was being built.
38 FlagDrops = (1 << 2)
39 };
40
41 //! Set flags.
42 void set_flags(unsigned flags);
43
44 //! Get flags.
45 unsigned flags() const;
46
47 //! Get frame data.
48 sample_t* data() const;
49
50 //! Get frame data size.
51 size_t size() const;
52
53private:
54 sample_t* data_;
55 size_t size_;
56 unsigned flags_;
57};
58
59} // namespace audio
60} // namespace roc
61
62#endif // ROC_AUDIO_FRAME_H_
Audio frame.
Definition: frame.h:22
void set_flags(unsigned flags)
Set flags.
sample_t * data() const
Get frame data.
unsigned flags() const
Get flags.
@ FlagBlank
Set if the frame is fully filled with zeros instead of data from packets.
Definition: frame.h:32
@ FlagDrops
Set if some late packets were dropped while the frame was being built.
Definition: frame.h:38
@ FlagIncomplete
Set if the frame is partially filled with zeros instead of data from packets.
Definition: frame.h:35
size_t size() const
Get frame data size.
Frame(sample_t *data, size_t size)
Construct frame from samples.
Base class for non-copyable objects.
Definition: noncopyable.h:23
float sample_t
Audio sample.
Definition: units.h:21
Root namespace.
Non-copyable object.
Various units used in audio processing.