File indexing completed on 2024-04-28 04:52:05
0001 /* 0002 SPDX-FileCopyrightText: 2015 Meltytech LLC 0003 SPDX-FileCopyrightText: 2015 Brian Matherly <code@brianmatherly.com> 0004 0005 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0006 */ 0007 0008 #pragma once 0009 0010 #include <QExplicitlySharedDataPointer> 0011 #include <cstdint> 0012 #include <mlt++/MltFrame.h> 0013 0014 class FrameData; 0015 0016 /** 0017 @class SharedFrame 0018 @brief The SharedFrame provides thread safe access to Mlt::Frame data. 0019 0020 threadsafe 0021 0022 SharedFrame is a wrapper around Mlt::Frame that provides read-only access to 0023 the frame data. SharedFrame is a reference counted object having only const 0024 functions. Therefore, it is suitable for concurrent access. 0025 0026 A SharedFrame can be safely copied. However, all copies will be accessing the 0027 same wrapped Mlt::Frame. Therefore, SharedFrame can not provide non-const 0028 access to any of the frame data. If it is necessary for an object to modify 0029 the frame data (e.g. to resize the image), then the object must call clone() 0030 to receive it's own non-const copy of the frame. 0031 0032 TODO: Consider providing a similar class in Mlt++. 0033 */ 0034 class SharedFrame 0035 { 0036 public: 0037 SharedFrame(); 0038 explicit SharedFrame(Mlt::Frame &frame); 0039 SharedFrame(const SharedFrame &other); 0040 ~SharedFrame(); 0041 SharedFrame &operator=(const SharedFrame &other); 0042 0043 bool is_valid() const; 0044 Mlt::Frame clone(bool audio = false, bool image = false, bool alpha = false) const; 0045 int get_int(const char *name) const; 0046 int64_t get_int64(const char *name) const; 0047 double get_double(const char *name) const; 0048 char *get(const char *name) const; 0049 int get_position() const; 0050 mlt_image_format get_image_format() const; 0051 int get_image_width() const; 0052 int get_image_height() const; 0053 const uint8_t *get_image(mlt_image_format format) const; 0054 mlt_audio_format get_audio_format() const; 0055 int get_audio_channels() const; 0056 int get_audio_frequency() const; 0057 int get_audio_samples() const; 0058 const int16_t *get_audio() const; 0059 0060 private: 0061 QExplicitlySharedDataPointer<FrameData> d; // NOLINT 0062 };