forked from mltframework/shotcut
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsharedframe.h
More file actions
76 lines (65 loc) · 2.51 KB
/
sharedframe.h
File metadata and controls
76 lines (65 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
* Copyright (c) 2015 Meltytech, LLC
* Author: Brian Matherly <code@brianmatherly.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SHAREDFRAME_H
#define SHAREDFRAME_H
#include <QObject>
#include <QExplicitlySharedDataPointer>
#include <MltFrame.h>
#include <stdint.h>
class FrameData;
/*!
\class SharedFrame
\brief The SharedFrame provides thread safe access to Mlt::Frame data.
\threadsafe
SharedFrame is a wrapper around Mlt::Frame that provides read-only access to
the frame data. SharedFrame is a reference counted object having only const
functions. Therefore, it is suitable for concurrent access.
A SharedFrame can be safely copied. However, all copies will be accessing the
same wrapped Mlt::Frame. Therefore, SharedFrame can not provide non-const
access to any of the frame data. If it is necessary for an object to modify
the frame data (e.g. to resize the image), then the object must call clone()
to receive it's own non-const copy of the frame.
TODO: Consider providing a similar class in Mlt++.
*/
class SharedFrame
{
public:
SharedFrame();
SharedFrame(Mlt::Frame& frame);
SharedFrame(const SharedFrame& other);
~SharedFrame();
SharedFrame& operator=(const SharedFrame& other);
bool is_valid() const;
Mlt::Frame clone(bool audio = false, bool image = false, bool alpha = false) const;
int get_int(const char *name) const;
int64_t get_int64(const char *name) const;
double get_double(const char *name) const;
int get_position() const;
mlt_image_format get_image_format() const;
int get_image_width() const;
int get_image_height() const;
const uint8_t* get_image() const;
mlt_audio_format get_audio_format() const;
int get_audio_channels() const;
int get_audio_frequency() const;
int get_audio_samples() const;
const int16_t* get_audio() const;
private:
QExplicitlySharedDataPointer<FrameData> d;
};
#endif // SHAREDFRAME_H