id
int64
0
755k
file_name
stringlengths
3
109
file_path
stringlengths
13
185
content
stringlengths
31
9.38M
size
int64
31
9.38M
language
stringclasses
1 value
extension
stringclasses
11 values
total_lines
int64
1
340k
avg_line_length
float64
2.18
149k
max_line_length
int64
7
2.22M
alphanum_fraction
float64
0
1
repo_name
stringlengths
6
65
repo_stars
int64
100
47.3k
repo_forks
int64
0
12k
repo_open_issues
int64
0
3.4k
repo_license
stringclasses
9 values
repo_extraction_date
stringclasses
92 values
exact_duplicates_redpajama
bool
2 classes
near_duplicates_redpajama
bool
2 classes
exact_duplicates_githubcode
bool
2 classes
exact_duplicates_stackv2
bool
1 class
exact_duplicates_stackv1
bool
2 classes
near_duplicates_githubcode
bool
2 classes
near_duplicates_stackv1
bool
2 classes
near_duplicates_stackv2
bool
1 class
19,336
encoder.h
olive-editor_olive/app/codec/encoder.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 ENCODER_H #define ENCODER_H #include <memory> #include <QRegularExpression> #include <QString> #include <QXmlStreamWriter> #include "codec/exportcodec.h" #include "codec/exportformat.h" #include "codec/frame.h" #include "node/block/subtitle/subtitle.h" #include "render/colortransform.h" #include "render/subtitleparams.h" #include "render/videoparams.h" namespace olive { class Encoder; using EncoderPtr = std::shared_ptr<Encoder>; class EncodingParams { public: enum VideoScalingMethod { kFit, kStretch, kCrop }; EncodingParams(); static QDir GetPresetPath(); static QStringList GetListOfPresets(); bool IsValid() const { return video_enabled_ || audio_enabled_ || subtitles_enabled_; } void SetFilename(const QString& filename) { filename_ = filename; } void EnableVideo(const VideoParams& video_params, const ExportCodec::Codec& vcodec); void EnableAudio(const AudioParams& audio_params, const ExportCodec::Codec &acodec); void EnableSubtitles(const ExportCodec::Codec &scodec); void EnableSidecarSubtitles(const ExportFormat::Format &sfmt, const ExportCodec::Codec &scodec); void DisableVideo(); void DisableAudio(); void DisableSubtitles(); const ExportFormat::Format &format() const { return format_; } void set_format(const ExportFormat::Format &format) { format_ = format; } void set_video_option(const QString& key, const QString& value) { video_opts_.insert(key, value); } void set_video_bit_rate(const int64_t& rate) { video_bit_rate_ = rate; } void set_video_min_bit_rate(const int64_t& rate) { video_min_bit_rate_ = rate; } void set_video_max_bit_rate(const int64_t& rate) { video_max_bit_rate_ = rate; } void set_video_buffer_size(const int64_t& sz) { video_buffer_size_ = sz; } void set_video_threads(const int& threads) { video_threads_ = threads; } void set_video_pix_fmt(const QString& s) { video_pix_fmt_ = s; } void set_video_is_image_sequence(bool s) { video_is_image_sequence_ = s; } void set_color_transform(const ColorTransform& color_transform) { color_transform_ = color_transform; } const QString& filename() const { return filename_; } bool video_enabled() const { return video_enabled_; } const ExportCodec::Codec& video_codec() const { return video_codec_; } const VideoParams& video_params() const { return video_params_; } const QHash<QString, QString>& video_opts() const { return video_opts_; } QString video_option(const QString &key) const { return video_opts_.value(key); } bool has_video_opt(const QString &key) const { return video_opts_.contains(key); } const int64_t& video_bit_rate() const { return video_bit_rate_; } const int64_t& video_min_bit_rate() const { return video_min_bit_rate_; } const int64_t& video_max_bit_rate() const { return video_max_bit_rate_; } const int64_t& video_buffer_size() const { return video_buffer_size_; } const int& video_threads() const { return video_threads_; } const QString& video_pix_fmt() const { return video_pix_fmt_; } bool video_is_image_sequence() const { return video_is_image_sequence_; } const ColorTransform& color_transform() const { return color_transform_; } bool audio_enabled() const { return audio_enabled_; } const ExportCodec::Codec &audio_codec() const { return audio_codec_; } const AudioParams& audio_params() const { return audio_params_; } const int64_t& audio_bit_rate() const { return audio_bit_rate_; } void set_audio_bit_rate(const int64_t& b) { audio_bit_rate_ = b; } bool subtitles_enabled() const { return subtitles_enabled_; } bool subtitles_are_sidecar() const { return subtitles_are_sidecar_; } ExportFormat::Format subtitle_sidecar_fmt() const { return subtitle_sidecar_fmt_; } ExportCodec::Codec subtitles_codec() const { return subtitles_codec_; } const rational& GetExportLength() const { return export_length_; } void SetExportLength(const rational& export_length) { export_length_ = export_length; } bool Load(QIODevice *device); bool Load(QXmlStreamReader *reader); void Save(QIODevice *device) const; void Save(QXmlStreamWriter* writer) const; bool has_custom_range() const { return has_custom_range_; } const TimeRange& custom_range() const { return custom_range_; } void set_custom_range(const TimeRange& custom_range) { has_custom_range_ = true; custom_range_ = custom_range; } const VideoScalingMethod& video_scaling_method() const { return video_scaling_method_; } void set_video_scaling_method(const VideoScalingMethod& video_scaling_method) { video_scaling_method_ = video_scaling_method; } static QMatrix4x4 GenerateMatrix(VideoScalingMethod method, int source_width, int source_height, int dest_width, int dest_height); private: static const int kEncoderParamsVersion = 1; bool LoadV1(QXmlStreamReader *reader); QString filename_; ExportFormat::Format format_; bool video_enabled_; ExportCodec::Codec video_codec_; VideoParams video_params_; QHash<QString, QString> video_opts_; int64_t video_bit_rate_; int64_t video_min_bit_rate_; int64_t video_max_bit_rate_; int64_t video_buffer_size_; int video_threads_; QString video_pix_fmt_; bool video_is_image_sequence_; ColorTransform color_transform_; bool audio_enabled_; ExportCodec::Codec audio_codec_; AudioParams audio_params_; int64_t audio_bit_rate_; bool subtitles_enabled_; bool subtitles_are_sidecar_; ExportFormat::Format subtitle_sidecar_fmt_; ExportCodec::Codec subtitles_codec_; rational export_length_; VideoScalingMethod video_scaling_method_; bool has_custom_range_; TimeRange custom_range_; }; class Encoder : public QObject { Q_OBJECT public: Encoder(const EncodingParams& params); enum Type { kEncoderTypeNone = -1, kEncoderTypeFFmpeg, kEncoderTypeOIIO }; /** * @brief Create a Encoder instance using a Encoder ID * * @return * * A Encoder instance or nullptr if a Decoder with this ID does not exist */ static Encoder *CreateFromID(Type id, const EncodingParams &params); static Type GetTypeFromFormat(ExportFormat::Format f); static Encoder *CreateFromFormat(ExportFormat::Format f, const EncodingParams &params); static Encoder *CreateFromParams(const EncodingParams &params); virtual QStringList GetPixelFormatsForCodec(ExportCodec::Codec c) const; virtual std::vector<SampleFormat> GetSampleFormatsForCodec(ExportCodec::Codec c) const; const EncodingParams& params() const; virtual PixelFormat GetDesiredPixelFormat() const { return PixelFormat::INVALID; } const QString& GetError() const { return error_; } QString GetFilenameForFrame(const rational& frame); static int GetImageSequencePlaceholderDigitCount(const QString& filename); static bool FilenameContainsDigitPlaceholder(const QString &filename); static QString FilenameRemoveDigitPlaceholder(QString filename); static const QRegularExpression kImageSequenceContainsDigits; static const QRegularExpression kImageSequenceRemoveDigits; public slots: virtual bool Open() = 0; virtual bool WriteFrame(olive::FramePtr frame, olive::core::rational time) = 0; virtual bool WriteAudio(const olive::SampleBuffer &audio) = 0; virtual bool WriteSubtitle(const SubtitleBlock *sub_block) = 0; virtual void Close() = 0; protected: void SetError(const QString& err) { error_ = err; } private: EncodingParams params_; QString error_; }; } #endif // ENCODER_H
8,271
C++
.h
191
39.811518
129
0.74682
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,337
planarfiledevice.h
olive-editor_olive/app/codec/planarfiledevice.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 PLANARFILEDEVICE_H #define PLANARFILEDEVICE_H #include <olive/core/core.h> #include <QFile> #include <QObject> namespace olive { using namespace core; class PlanarFileDevice : public QObject { Q_OBJECT public: PlanarFileDevice(QObject *parent = nullptr); virtual ~PlanarFileDevice() override; bool isOpen() const { return !files_.isEmpty(); } bool open(const QVector<QString> &filenames, QIODevice::OpenMode mode); qint64 read(char **data, qint64 bytes_per_channel, qint64 offset = 0); qint64 write(const char **data, qint64 bytes_per_channel, qint64 offset = 0); qint64 size() const; bool seek(qint64 pos); void close(); private: QVector<QFile*> files_; }; } #endif // PLANARFILEDEVICE_H
1,455
C++
.h
42
31.833333
79
0.762042
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,338
exportformat.h
olive-editor_olive/app/codec/exportformat.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 EXPORTFORMAT_H #define EXPORTFORMAT_H #include <QList> #include <QString> #include "common/define.h" #include "exportcodec.h" namespace olive { class ExportFormat : public QObject { Q_OBJECT public: // Only append to this list (never insert) because indexes are used in serialized files enum Format { kFormatDNxHD, kFormatMatroska, kFormatMPEG4Video, kFormatOpenEXR, kFormatQuickTime, kFormatPNG, kFormatTIFF, kFormatWAV, kFormatAIFF, kFormatMP3, kFormatFLAC, kFormatOgg, kFormatWebM, kFormatSRT, kFormatMPEG4Audio, kFormatCount }; static QString GetName(Format f); static QString GetExtension(Format f); static QList<ExportCodec::Codec> GetVideoCodecs(ExportFormat::Format f); static QList<ExportCodec::Codec> GetAudioCodecs(ExportFormat::Format f); static QList<ExportCodec::Codec> GetSubtitleCodecs(ExportFormat::Format f); static QStringList GetPixelFormatsForCodec(Format f, ExportCodec::Codec c); static std::vector<SampleFormat> GetSampleFormatsForCodec(Format f, ExportCodec::Codec c); }; } #endif // EXPORTFORMAT_H
1,840
C++
.h
54
30.740741
92
0.773446
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,339
decoder.h
olive-editor_olive/app/codec/decoder.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 DECODER_H #define DECODER_H extern "C" { #include <libswresample/swresample.h> } #include <QFileInfo> #include <QMutex> #include <QObject> #include <QWaitCondition> #include <stdint.h> #include "node/block/block.h" #include "node/project/footage/footagedescription.h" #include "render/cancelatom.h" #include "render/rendermodes.h" namespace olive { class Decoder; using DecoderPtr = std::shared_ptr<Decoder>; #define DECODER_DEFAULT_DESTRUCTOR(x) virtual ~x() override {CloseInternal();} /** * @brief A decoder's is the main class for bringing external media into Olive * * Its responsibilities are to serve as * abstraction from codecs/decoders and provide complete frames. These frames can be video or audio data and are * provided as Frame objects in shared pointers to alleviate the responsibility of memory handling. * * The main function in a decoder is Retrieve() which should return complete image/audio data. A decoder should * alleviate all the complexities of codec compression from the rest of the application (i.e. a decoder should never * return a partial frame or require other parts of the system to interface directly with the codec). Often this will * necessitate pre-emptively caching, indexing, or even fully transcoding media before using it which can be implemented * through the Analyze() function. * * A decoder does NOT perform any pixel/sample format conversion. Frames should pass through the PixelService * to be utilized in the rest of the rendering pipeline. */ class Decoder : public QObject { Q_OBJECT public: enum RetrieveState { kReady, kFailedToOpen, kIndexUnavailable }; Decoder(); /** * @brief Unique decoder ID */ virtual QString id() const = 0; virtual bool SupportsVideo(){return false;} virtual bool SupportsAudio(){return false;} void IncrementAccessTime(qint64 t); class CodecStream { public: CodecStream() : stream_(-1), block_(nullptr) { } CodecStream(const QString& filename, int stream, Block *block) : filename_(filename), stream_(stream), block_(block) { } bool IsValid() const { return !filename_.isEmpty() && stream_ >= 0; } bool Exists() const { return QFileInfo::exists(filename_); } void Reset() { *this = CodecStream(); } bool operator==(const CodecStream& rhs) const { return filename_ == rhs.filename_ && stream_ == rhs.stream_; } const QString& filename() const { return filename_; } int stream() const { return stream_; } Block *block() const { return block_; } private: QString filename_; int stream_; Block *block_; }; /** * @brief Open stream for decoding * * This function is thread safe. * * Returns TRUE if stream could be opened successfully. Also returns TRUE if the decoder is * already open and the stream == the stream provided. Returns FALSE if the stream couldn't * be opened OR if already open and the stream is NOT the same. */ bool Open(const CodecStream& stream); static const rational kAnyTimecode; struct RetrieveVideoParams { Renderer *renderer = nullptr; rational time; int divider = 1; PixelFormat maximum_format = PixelFormat::INVALID; CancelAtom *cancelled = nullptr; VideoParams::ColorRange force_range = VideoParams::kColorRangeDefault; VideoParams::Interlacing src_interlacing = VideoParams::kInterlaceNone; }; /** * @brief Retrieves a video frame from footage * * This function will always return a valid frame unless a fatal error occurs (in such case, * nullptr will return). If the timecode is before the start of the footage, this function should * return the first frame. Likewise, if it is after the timecode, this function should return the * last frame. * * This function is thread safe and can only run while the decoder is open. \see Open() */ TexturePtr RetrieveVideo(const RetrieveVideoParams& p); enum RetrieveAudioStatus { kInvalid = -1, kOK, kWaitingForConform, kUnknownError }; /** * @brief Retrieve audio data from footage * * This function will always return a sample buffer unless a fatal error occurs (in such case, * nullptr will return). The SampleBuffer should always have enough audio for the range provided. * * This function is thread safe and can only run while the decoder is open. \see Open() */ RetrieveAudioStatus RetrieveAudio(SampleBuffer &dest, const TimeRange& range, const AudioParams& params, const QString &cache_path, LoopMode loop_mode, RenderMode::Mode mode); /** * @brief Determine the last time this decoder instance was used in any way */ qint64 GetLastAccessedTime(); /** * @brief Generate a Footage object from a file * * If this decoder is able to parse this file, it will return a valid FootagePtr. Otherwise, it * will return nullptr. * * For sub-classes, this function should be effectively static. We can't do virtual static * functions in C++, but it should hold and access no state during its run. * * This function is re-entrant. */ virtual FootageDescription Probe(const QString& filename, CancelAtom *cancelled) const = 0; /** * @brief Closes media/deallocates memory * * This function is thread safe and can only run while the decoder is open. \see Open() */ void Close(); /** * @brief Conform audio stream */ bool ConformAudio(const QVector<QString> &output_filenames, const AudioParams &params, CancelAtom *cancelled = nullptr); /** * @brief Create a Decoder instance using a Decoder ID * * @return * * A Decoder instance or nullptr if a Decoder with this ID does not exist */ static DecoderPtr CreateFromID(const QString& id); static QString TransformImageSequenceFileName(const QString& filename, const int64_t& number); static int GetImageSequenceDigitCount(const QString& filename); static int64_t GetImageSequenceIndex(const QString& filename); static QVector<DecoderPtr> ReceiveListOfAllDecoders(); protected: /** * @brief Internal open function * * Sub-classes must override this function. Function will already be mutexed, so there is no need * to worry about thread safety. Also many other sanity checks will be done before this, so * sub-classes only need to worry about their own opening functions. It is guaranteed that the * decoder is not open yet and that the footage stream was from that sub-classes probe function. * * Return TRUE if everything opened successfully and the decoder is ready to work. Otherwise, * return FALSE. If this function returns false, Decoder will call CloseInternal to clean any * memory allocated during OpenInternal. */ virtual bool OpenInternal() = 0; /** * @brief Internal close function * * Sub-classes must override this function. Function should be able to safely clear all allocated * memory. It may be called even if Open() didn't complete or RetrieveVideo() was never called. */ virtual void CloseInternal() = 0; /** * @brief Internal frame retrieval function * * Sub-classes must override this function IF they support video. Function is already mutexed * so sub-classes don't need to worry about thread safety. */ virtual TexturePtr RetrieveVideoInternal(const RetrieveVideoParams& p); virtual bool ConformAudioInternal(const QVector<QString>& filenames, const AudioParams &params, CancelAtom *cancelled); void SignalProcessingProgress(int64_t ts, int64_t duration); /** * @brief Return currently open stream * * This function is NOT thread safe and should therefore only be called by thread safe functions. */ const CodecStream& stream() const { return stream_; } virtual rational GetAudioStartOffset() const { return 0; } signals: /** * @brief While indexing, this signal will provide progress as a percentage (0-100 inclusive) if * available */ void IndexProgress(double); private: void UpdateLastAccessed(); bool RetrieveAudioFromConform(SampleBuffer &sample_buffer, const QVector<QString> &conform_filenames, TimeRange range, LoopMode loop_mode, const AudioParams &params); CodecStream stream_; QMutex mutex_; std::atomic_int64_t last_accessed_; TexturePtr cached_texture_; rational cached_time_; int cached_divider_; }; uint qHash(Decoder::CodecStream stream, uint seed = 0); } Q_DECLARE_METATYPE(olive::Decoder::RetrieveState) #endif // DECODER_H
9,358
C++
.h
257
32.63035
177
0.735642
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,340
conformmanager.h
olive-editor_olive/app/codec/conformmanager.h
#ifndef CONFORMMANAGER_H #define CONFORMMANAGER_H #include <QMutex> #include <QObject> #include "decoder.h" #include "task/conform/conform.h" namespace olive { class ConformManager : public QObject { Q_OBJECT public: static void CreateInstance() { if (!instance_) { instance_ = new ConformManager(); } } static void DestroyInstance() { delete instance_; instance_ = nullptr; } static ConformManager *instance() { return instance_; } enum ConformState { kConformExists, kConformGenerating }; struct Conform { ConformState state; QVector<QString> filenames; ConformTask *task; }; /** * @brief Get conform state, and start conforming if no conform exists * * Thread-safe. */ Conform GetConformState(const QString &decoder_id, const QString &cache_path, const Decoder::CodecStream &stream, const AudioParams &params, bool wait); signals: void ConformReady(); private: ConformManager() = default; static ConformManager *instance_; QMutex mutex_; QWaitCondition conform_done_condition_; struct ConformData { Decoder::CodecStream stream; AudioParams params; ConformTask *task; QVector<QString> working_filename; QVector<QString> finished_filename; }; QVector<ConformData> conforming_; /** * @brief Get the destination filename of an audio stream conformed to a set of parameters */ static QVector<QString> GetConformedFilename(const QString &cache_path, const Decoder::CodecStream &stream, const AudioParams &params); static bool AllConformsExist(const QVector<QString> &filenames); private slots: void ConformTaskFinished(Task *task, bool succeeded); }; } #endif // CONFORMMANAGER_H
1,739
C++
.h
66
22.893939
154
0.74258
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,341
frame.h
olive-editor_olive/app/codec/frame.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 FRAME_H #define FRAME_H #include <memory> #include <olive/core/core.h> #include <QVector> #include "common/define.h" #include "render/videoparams.h" namespace olive { class Frame; using FramePtr = std::shared_ptr<Frame>; /** * @brief Video frame data or audio sample data from a Decoder */ class Frame { public: Frame(); ~Frame(); DISABLE_COPY_MOVE(Frame) static FramePtr Create(); const VideoParams& video_params() const; void set_video_params(const VideoParams& params); static FramePtr Interlace(FramePtr top, FramePtr bottom); static int generate_linesize_bytes(int width, PixelFormat format, int channel_count); int linesize_pixels() const { return linesize_pixels_; } int linesize_bytes() const { return linesize_; } int width() const { return params_.effective_width(); } int height() const { return params_.effective_height(); } PixelFormat format() const { return params_.format(); } int channel_count() const { return params_.channel_count(); } Color get_pixel(int x, int y) const; bool contains_pixel(int x, int y) const; void set_pixel(int x, int y, const Color& c); /** * @brief Get frame's timestamp. * * This timestamp is always a rational that will equate to the time in seconds. */ const rational& timestamp() const { return timestamp_; } void set_timestamp(const rational& timestamp) { timestamp_ = timestamp; } /** * @brief Get the data buffer of this frame */ char* data() { return data_; } /** * @brief Get the const data buffer of this frame */ const char* const_data() const { return data_; } /** * @brief Allocate memory buffer to store data based on parameters * * For video frames, the width(), height(), and format() must be set for this function to work. * * If a memory buffer has been previously allocated without destroying, this function will destroy it. */ bool allocate(); /** * @brief Return whether the frame is allocated or not */ bool is_allocated() const { return data_; } /** * @brief Destroy a memory buffer allocated with allocate() */ void destroy(); /** * @brief Returns the size of the array returned in data() in bytes * * Returns 0 if nothing is allocated. */ int allocated_size() const { return data_size_; } FramePtr convert(PixelFormat format) const; private: VideoParams params_; char* data_; int data_size_; rational timestamp_; int linesize_; int linesize_pixels_; }; } Q_DECLARE_METATYPE(olive::FramePtr) #endif // FRAME_H
3,375
C++
.h
132
22.234848
104
0.706654
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,342
ffmpegdecoder.h
olive-editor_olive/app/codec/ffmpeg/ffmpegdecoder.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 FFMPEGDECODER_H #define FFMPEGDECODER_H // Fixes weird define issue when including <avfilter.h> #include <inttypes.h> extern "C" { #include <libavcodec/avcodec.h> #include <libavfilter/avfilter.h> #include <libavformat/avformat.h> #include <libswscale/swscale.h> #include <libswresample/swresample.h> } #include <QTimer> #include <QVector> #include <QWaitCondition> #include "codec/decoder.h" #include "common/ffmpegutils.h" namespace olive { /** * @brief A Decoder derivative that wraps FFmpeg functions as on Olive decoder */ class FFmpegDecoder : public Decoder { Q_OBJECT public: // Constructor FFmpegDecoder(); // Destructor DECODER_DEFAULT_DESTRUCTOR(FFmpegDecoder) virtual QString id() const override; virtual bool SupportsVideo() override{return true;} virtual bool SupportsAudio() override{return true;} virtual FootageDescription Probe(const QString &filename, CancelAtom *cancelled) const override; protected: virtual bool OpenInternal() override; virtual TexturePtr RetrieveVideoInternal(const RetrieveVideoParams& p) override; virtual bool ConformAudioInternal(const QVector<QString>& filenames, const AudioParams &params, CancelAtom *cancelled) override; virtual void CloseInternal() override; virtual rational GetAudioStartOffset() const override; private: class Instance { public: Instance(); ~Instance() { Close(); } bool Open(const char* filename, int stream_index); bool IsOpen() const { return fmt_ctx_; } void Close(); /** * @brief Uses the FFmpeg API to retrieve a packet (stored in pkt_) and decode it (stored in frame_) * * @return * * An FFmpeg error code, or >= 0 on success */ int GetFrame(AVPacket* pkt, AVFrame* frame); const char *GetSubtitleHeader() const; int GetSubtitle(AVPacket* pkt, AVSubtitle* sub); int GetPacket(AVPacket *pkt); void Seek(int64_t timestamp); AVFormatContext* fmt_ctx() const { return fmt_ctx_; } AVStream* avstream() const { return avstream_; } private: AVFormatContext* fmt_ctx_; AVCodecContext* codec_ctx_; AVStream* avstream_; AVDictionary* opts_; }; /** * @brief Handle an FFmpeg error code * * Uses the FFmpeg API to retrieve a descriptive string for this error code and sends it to Error(). As such, this * function also automatically closes the Decoder. * * @param error_code */ static QString FFmpegError(int error_code); void FreeScaler(); static PixelFormat GetNativePixelFormat(AVPixelFormat pix_fmt); static int GetNativeChannelCount(AVPixelFormat pix_fmt); static uint64_t ValidateChannelLayout(AVStream *stream); static const char* GetInterlacingModeInFFmpeg(VideoParams::Interlacing interlacing); static bool IsPixelFormatGLSLCompatible(AVPixelFormat f); AVFramePtr GetFrameFromCache(const int64_t &t) const; void ClearFrameCache(); AVFramePtr PreProcessFrame(AVFramePtr f, const RetrieveVideoParams &p); TexturePtr ProcessFrameIntoTexture(AVFramePtr f, const RetrieveVideoParams &p, const AVFramePtr original); AVFramePtr RetrieveFrame(const rational &time, CancelAtom *cancelled); void RemoveFirstFrame(); static int MaximumQueueSize(); SwsContext *sws_ctx_; int sws_src_width_; int sws_src_height_; AVPixelFormat sws_src_format_; int sws_dst_width_; int sws_dst_height_; AVPixelFormat sws_dst_format_; AVColorRange sws_colrange_; AVColorSpace sws_colspace_; AVPacket *working_packet_; int64_t second_ts_; std::list<AVFramePtr> cached_frames_; bool cache_at_zero_; bool cache_at_eof_; Instance instance_; }; } #endif // FFMPEGDECODER_H
4,451
C++
.h
133
29.81203
130
0.751173
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,343
ffmpegencoder.h
olive-editor_olive/app/codec/ffmpeg/ffmpegencoder.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 FFMPEGENCODER_H #define FFMPEGENCODER_H extern "C" { #include <libavcodec/avcodec.h> #include <libavfilter/avfilter.h> #include <libavformat/avformat.h> #include <libswresample/swresample.h> #include <libavutil/opt.h> } #include "codec/encoder.h" namespace olive { class FFmpegEncoder : public Encoder { Q_OBJECT public: FFmpegEncoder(const EncodingParams &params); virtual QStringList GetPixelFormatsForCodec(ExportCodec::Codec c) const override; virtual std::vector<SampleFormat> GetSampleFormatsForCodec(ExportCodec::Codec c) const override; virtual bool Open() override; virtual bool WriteFrame(olive::FramePtr frame, olive::core::rational time) override; virtual bool WriteAudio(const olive::SampleBuffer &audio) override; bool WriteAudioData(const AudioParams &audio_params, const uint8_t **data, int input_sample_count); virtual bool WriteSubtitle(const SubtitleBlock *sub_block) override; virtual void Close() override; virtual PixelFormat GetDesiredPixelFormat() const override { return video_conversion_fmt_; } private: /** * @brief Handle an FFmpeg error code * * Uses the FFmpeg API to retrieve a descriptive string for this error code and sends it to Error(). As such, this * function also automatically closes the Decoder. * * @param error_code */ void FFmpegError(const QString &context, int error_code); bool WriteAVFrame(AVFrame* frame, AVCodecContext *codec_ctx, AVStream *stream); bool InitializeStream(enum AVMediaType type, AVStream** stream, AVCodecContext** codec_ctx, const ExportCodec::Codec &codec); bool InitializeCodecContext(AVStream** stream, AVCodecContext** codec_ctx, const AVCodec* codec); bool SetupCodecContext(AVStream *stream, AVCodecContext *codec_ctx, const AVCodec *codec); void FlushEncoders(); void FlushCodecCtx(AVCodecContext* codec_ctx, AVStream *stream); bool InitializeResampleContext(const AudioParams &audio); static const AVCodec *GetEncoder(ExportCodec::Codec c, SampleFormat aformat); AVFormatContext* fmt_ctx_; AVStream* video_stream_; AVCodecContext* video_codec_ctx_; AVFilterGraph *video_scale_ctx_; AVFilterContext *video_buffersrc_ctx_; AVFilterContext *video_buffersink_ctx_; PixelFormat video_conversion_fmt_; AVStream* audio_stream_; AVCodecContext* audio_codec_ctx_; SwrContext* audio_resample_ctx_; AVFrame* audio_frame_; int audio_max_samples_; int audio_frame_offset_; int audio_write_count_; AVStream* subtitle_stream_; AVCodecContext* subtitle_codec_ctx_; bool open_; }; } #endif // FFMPEGENCODER_H
3,319
C++
.h
80
38.4625
127
0.779476
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,344
oiiodecoder.h
olive-editor_olive/app/codec/oiio/oiiodecoder.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 OIIODECODER_H #define OIIODECODER_H #include <OpenImageIO/imageio.h> #include <OpenImageIO/imagebuf.h> #include "codec/decoder.h" namespace olive { class OIIODecoder : public Decoder { Q_OBJECT public: OIIODecoder(); DECODER_DEFAULT_DESTRUCTOR(OIIODecoder) virtual QString id() const override; virtual bool SupportsVideo() override{return true;} virtual FootageDescription Probe(const QString& filename, CancelAtom *cancelled) const override; protected: virtual bool OpenInternal() override; virtual TexturePtr RetrieveVideoInternal(const RetrieveVideoParams& p) override; virtual void CloseInternal() override; private: std::unique_ptr<OIIO::ImageInput> image_; static bool FileTypeIsSupported(const QString& fn); bool OpenImageHandler(const QString& fn, int subimage); void CloseImageHandle(); static VideoParams GetVideoParamsFromImageSpec(const OIIO::ImageSpec &spec); PixelFormat pix_fmt_; OIIO::TypeDesc::BASETYPE oiio_pix_fmt_; Frame buffer_; RetrieveVideoParams last_params_; static QStringList supported_formats_; }; } #endif // OIIODECODER_H
1,830
C++
.h
47
36.06383
98
0.791121
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,345
oiioencoder.h
olive-editor_olive/app/codec/oiio/oiioencoder.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 OIIOENCODER_H #define OIIOENCODER_H #include "codec/encoder.h" namespace olive { class OIIOEncoder : public Encoder { Q_OBJECT public: OIIOEncoder(const EncodingParams &params); public slots: virtual bool Open() override; virtual bool WriteFrame(olive::FramePtr frame, olive::core::rational time) override; virtual bool WriteAudio(const SampleBuffer &audio) override; virtual bool WriteSubtitle(const SubtitleBlock *sub_block) override; virtual void Close() override; }; } #endif // OIIOENCODER_H
1,240
C++
.h
32
36.09375
86
0.7829
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,346
undostack.h
olive-editor_olive/app/undo/undostack.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 UNDOSTACK_H #define UNDOSTACK_H #include <QAction> #include <QAbstractItemModel> #include "common/define.h" #include "undo/undocommand.h" namespace olive { class UndoStack : public QAbstractItemModel { Q_OBJECT public: UndoStack(); virtual ~UndoStack() override; void push(UndoCommand* command, const QString &name); void jump(size_t index); void clear(); bool CanUndo() const; bool CanRedo() const { return !undone_commands_.empty(); } void UpdateActions(); QAction* GetUndoAction() { return undo_action_; } QAction* GetRedoAction() { return redo_action_; } virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override; virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; virtual QModelIndex parent(const QModelIndex &index) const override; virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override; virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const override; signals: void indexChanged(int i); public slots: void undo(); void redo(); private: static const int kMaxUndoCommands; struct CommandEntry { UndoCommand *command; QString name; }; std::list<CommandEntry> commands_; std::list<CommandEntry> undone_commands_; QAction* undo_action_; QAction* redo_action_; }; } #endif // UNDOSTACK_H
2,353
C++
.h
70
30.528571
115
0.761439
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,347
undocommand.h
olive-editor_olive/app/undo/undocommand.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 UNDOCOMMAND_H #define UNDOCOMMAND_H #include <list> #include <QString> #include <vector> #include "common/define.h" namespace olive { class Project; class UndoCommand { public: UndoCommand(); virtual ~UndoCommand(){} DISABLE_COPY_MOVE(UndoCommand) bool has_prepared() const {return prepared_;} void set_prepared(bool e) {prepared_ = true;} void redo_now(); void undo_now(); void redo_and_set_modified(); void undo_and_set_modified(); virtual Project* GetRelevantProject() const = 0; protected: virtual void prepare(){} virtual void redo() = 0; virtual void undo() = 0; private: bool modified_; Project* project_; bool prepared_; bool done_; }; class MultiUndoCommand : public UndoCommand { public: MultiUndoCommand() = default; virtual Project* GetRelevantProject() const override { return nullptr; } void add_child(UndoCommand* command) { children_.push_back(command); } int child_count() const { return children_.size(); } UndoCommand* child(int i) const { return children_[i]; } protected: virtual void redo() override; virtual void undo() override; private: std::vector<UndoCommand*> children_; }; } #endif // UNDOCOMMAND_H
1,957
C++
.h
73
23.90411
71
0.742301
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,348
tool.h
olive-editor_olive/app/tool/tool.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 TOOL_H #define TOOL_H #include <QCoreApplication> #include <QString> #include "common/define.h" namespace olive { class Tool { public: /** * @brief A list of tools that can be used throughout the application */ enum Item { /// No tool. This should never be set as the application tool, its only real purpose is to indicate the lack of /// a tool somewhere similar to nullptr. kNone, /// Pointer tool kPointer, /// Edit tool kEdit, /// Ripple tool kRipple, /// Rolling tool kRolling, /// Razor tool kRazor, /// Slip tool kSlip, /// Slide tool kSlide, /// Hand tool kHand, /// Zoom tool kZoom, /// Transition tool kTransition, /// Record tool kRecord, /// Add tool kAdd, /// Track select tool kTrackSelect, kCount }; /** * @brief Tools that can be added using the kAdd tool */ enum AddableObject { /// An empty clip kAddableEmpty, /// A video clip showing a generic video placeholder kAddableBars, /// A video clip showing a primitive shape kAddableShape, /// A video clip with a solid connected kAddableSolid, /// A video clip with a title connected kAddableTitle, /// An audio clip with a sine connected to it kAddableTone, /// A subtitle clip kAddableSubtitle, kAddableCount }; static QString GetAddableObjectName(const AddableObject& a) { switch (a) { case kAddableEmpty: return QCoreApplication::translate("Tool", "Empty"); case kAddableBars: return QCoreApplication::translate("Tool", "Bars"); case kAddableShape: return QCoreApplication::translate("Tool", "Shape"); case kAddableSolid: return QCoreApplication::translate("Tool", "Solid"); case kAddableTitle: return QCoreApplication::translate("Tool", "Title"); case kAddableTone: return QCoreApplication::translate("Tool", "Tone"); case kAddableSubtitle: return QCoreApplication::translate("Tool", "Subtitle"); case kAddableCount: break; } return QCoreApplication::translate("Tool", "Unknown"); } static QString GetAddableObjectID(const AddableObject& a) { switch (a) { case kAddableEmpty: return QStringLiteral("empty"); case kAddableBars: return QStringLiteral("bars"); case kAddableShape: return QStringLiteral("shape"); case kAddableSolid: return QStringLiteral("solid"); case kAddableTitle: return QStringLiteral("title"); case kAddableTone: return QStringLiteral("tone"); case kAddableSubtitle: return QStringLiteral("subtitle"); case kAddableCount: break; } return QString(); } }; } #endif // TOOL_H
3,516
C++
.h
124
23.620968
115
0.691619
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,349
colorcoding.h
olive-editor_olive/app/ui/colorcoding.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 COLORCODING_H #define COLORCODING_H #include <olive/core/core.h> #include <QObject> namespace olive { using namespace core; class ColorCoding : public QObject { Q_OBJECT public: enum Code { kRed, kMaroon, kOrange, kBrown, kYellow, kOlive, kLime, kGreen, kCyan, kTeal, kBlue, kNavy, kPink, kPurple, kSilver, kGray }; static QString GetColorName(int c); static Color GetColor(int c); static Qt::GlobalColor GetUISelectorColor(const Color& c); static const QVector<Color>& standard_colors() { return colors_; } private: static QVector<Color> colors_; }; } #endif // COLORCODING_H
1,397
C++
.h
54
22.462963
71
0.736604
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,350
humanstrings.h
olive-editor_olive/app/ui/humanstrings.h
#ifndef HUMANSTRINGS_H #define HUMANSTRINGS_H #include <olive/core/core.h> #include <QObject> namespace olive { using namespace core; class HumanStrings : public QObject { Q_OBJECT public: HumanStrings() = default; static QString SampleRateToString(const int &sample_rate); static QString ChannelLayoutToString(const uint64_t &layout); static QString FormatToString(const SampleFormat &f); }; } #endif // HUMANSTRINGS_H
440
C++
.h
17
23.705882
63
0.801453
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,351
icons.h
olive-editor_olive/app/ui/icons/icons.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 ICONS_H #define ICONS_H #include <QIcon> #include "common/define.h" namespace olive { namespace icon { // Playback Icons extern QIcon GoToStart; extern QIcon PrevFrame; extern QIcon Play; extern QIcon Pause; extern QIcon NextFrame; extern QIcon GoToEnd; // Project Management Toolbar Icons extern QIcon New; extern QIcon Open; extern QIcon Save; extern QIcon Undo; extern QIcon Redo; extern QIcon TreeView; extern QIcon ListView; extern QIcon IconView; // Tool Icons extern QIcon ToolPointer; extern QIcon ToolEdit; extern QIcon ToolRipple; extern QIcon ToolRolling; extern QIcon ToolRazor; extern QIcon ToolSlip; extern QIcon ToolSlide; extern QIcon ToolHand; extern QIcon ToolTransition; extern QIcon ToolTrackSelect; // Project Icons extern QIcon Folder; extern QIcon Sequence; extern QIcon Video; extern QIcon Audio; extern QIcon Image; // Node Icons extern QIcon MiniMap; // Triangle Arrows extern QIcon TriUp; extern QIcon TriLeft; extern QIcon TriDown; extern QIcon TriRight; // Text extern QIcon TextBold; extern QIcon TextItalic; extern QIcon TextUnderline; extern QIcon TextStrikethrough; extern QIcon TextSmallCaps; extern QIcon TextAlignLeft; extern QIcon TextAlignRight; extern QIcon TextAlignCenter; extern QIcon TextAlignJustify; extern QIcon TextAlignTop; extern QIcon TextAlignBottom; extern QIcon TextAlignMiddle; // Miscellaneous Icons extern QIcon Snapping; extern QIcon ZoomIn; extern QIcon ZoomOut; extern QIcon Record; extern QIcon Add; extern QIcon Error; extern QIcon DirUp; extern QIcon Clock; extern QIcon Diamond; extern QIcon Plus; extern QIcon Minus; extern QIcon AddEffect; extern QIcon EyeOpened; extern QIcon EyeClosed; extern QIcon LockOpened; extern QIcon LockClosed; extern QIcon Pencil; extern QIcon Subtitles; extern QIcon ColorPicker; /** * @brief Create an icon object loaded from file * * Using `name`, this function will load icon files to create an icon object that can be used throughout the * application. * * Olive's icons are stored in a very specific format. They are all sourced from SVGs, but stored as PNGs of various * sizes. See `app/ui/icons/genicons.sh`, as this script not only generates the multiple sizes but also the QRC file * used to compile the icons into the executable. * * This function is heavily tied into `genicons.sh` and will load all the different sized images (using the same * filename formatting and QRC resource directory) that `genicons.sh` generates into one QIcon file. If you change * either this function or `genicons.sh`, you will very likely have to change the other too. * * There is not much reason to call this outside of LoadAll() (which stores icons globally in memory so they don't * have to be reloaded each time a new object needs an icon). * * @param theme * * Name of the theme (used in the URL as the folder to load PNGs from) * * @param name * * Name of the icon (will correspond to the original SVG's filename with no path or extension) * * @return * * A QIcon object containing the various icon sizes loaded from resource */ QIcon Create(const QString &theme, const QString& name); /** * @brief Methodically load all Olive icons into global variables that can be accessed throughout the application * * It's recommended to load any UI icons here so they're ready at startup and don't need to be re-loaded upon each * use. */ void LoadAll(const QString &theme); } } #endif // ICONS_H
4,149
C++
.h
133
29.593985
116
0.799649
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,352
style.h
olive-editor_olive/app/ui/style/style.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 STYLEMANAGER_H #define STYLEMANAGER_H #include <QSettings> #include <QWidget> #include "common/define.h" namespace olive { class StyleManager : public QObject { public: static void Init(); static const QString& GetStyle(); static void SetStyle(const QString& style_path); static const char* kDefaultStyle; static const QMap<QString, QString>& available_themes() { return available_themes_; } private: static QPalette ParsePalette(const QString& ini_path); static void ParsePaletteGroup(QSettings* ini, QPalette* palette, QPalette::ColorGroup group); static void ParsePaletteColor(QSettings* ini, QPalette* palette, QPalette::ColorGroup group, const QString& role_name); static QString current_style_; static QMap<QString, QString> available_themes_; }; } #endif // STYLEMANAGER_H
1,544
C++
.h
39
36.692308
121
0.776804
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,353
splitvalue.h
olive-editor_olive/app/node/splitvalue.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 SPLITVALUE_H #define SPLITVALUE_H #include <QVariant> #include <QVector> namespace olive { using SplitValue = QVector<QVariant>; } #endif // SPLITVALUE_H
879
C++
.h
22
37.363636
71
0.776596
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,354
globals.h
olive-editor_olive/app/node/globals.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 NODEGLOBALS_H #define NODEGLOBALS_H #include <QVector2D> #include "render/loopmode.h" #include "render/videoparams.h" namespace olive { class NodeGlobals { public: NodeGlobals(){} NodeGlobals(const VideoParams &vparam, const AudioParams &aparam, const TimeRange &time, LoopMode loop_mode) : video_params_(vparam), audio_params_(aparam), time_(time), loop_mode_(loop_mode) { } NodeGlobals(const VideoParams &vparam, const AudioParams &aparam, const rational &time, LoopMode loop_mode) : NodeGlobals(vparam, aparam, TimeRange(time, time + vparam.frame_rate_as_time_base()), loop_mode) { } QVector2D square_resolution() const { return video_params_.square_resolution(); } QVector2D nonsquare_resolution() const { return video_params_.resolution(); } const AudioParams &aparams() const { return audio_params_; } const VideoParams &vparams() const { return video_params_; } const TimeRange &time() const { return time_; } LoopMode loop_mode() const { return loop_mode_; } private: VideoParams video_params_; AudioParams audio_params_; TimeRange time_; LoopMode loop_mode_; }; } #endif // NODEGLOBALS_H
1,882
C++
.h
49
35.469388
112
0.752203
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,355
factory.h
olive-editor_olive/app/node/factory.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 NODEFACTORY_H #define NODEFACTORY_H #include <QList> #include "node.h" #include "widget/menu/menu.h" namespace olive { class NodeFactory { public: enum InternalID { kViewerOutput, kClipBlock, kGapBlock, kPolygonGenerator, kMatrixGenerator, kTransformDistort, kTrackOutput, kAudioVolume, kAudioPanning, kMath, kTime, kTrigonometry, kBlurFilter, kSolidGenerator, kMerge, kStrokeFilter, kTextGeneratorV1, kTextGeneratorV2, kTextGeneratorV3, kCrossDissolveTransition, kDipToColorTransition, kMosaicFilter, kCropDistort, kProjectFootage, kProjectFolder, kProjectSequence, kValueNode, kTimeRemapNode, kSubtitleBlock, kShapeGenerator, kColorDifferenceKeyKeying, kDespillKeying, kGroupNode, kOpacityEffect, kFlipDistort, kNoiseGenerator, kTimeOffsetNode, kCornerPinDistort, kDisplayTransform, kOCIOGradingTransformLinear, kChromaKey, kMaskDistort, kDropShadowFilter, kTimeFormat, kWaveDistort, kRippleDistort, kTileDistort, kSwirlDistort, kMulticamNode, // Count value kInternalNodeCount }; NodeFactory() = default; static void Initialize(); static void Destroy(); static Menu* CreateMenu(QWidget *parent, bool create_none_item = false, Node::CategoryID restrict_to = Node::kCategoryUnknown, uint64_t restrict_flags = 0); static Node* CreateFromMenuAction(QAction* action); static QString GetIDFromMenuAction(QAction* action); static QString GetNameFromID(const QString& id); static Node* CreateFromID(const QString& id); static Node* CreateFromFactoryIndex(const InternalID& id); private: static QList<Node*> library_; }; } #endif // NODEFACTORY_H
2,507
C++
.h
90
23.788889
158
0.757209
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,356
value.h
olive-editor_olive/app/node/value.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 NODEVALUE_H #define NODEVALUE_H #include <QMatrix4x4> #include <QString> #include <QVariant> #include <QVector> #include "common/qtutils.h" #include "node/splitvalue.h" #include "render/texture.h" namespace olive { class Node; class NodeValue; class NodeValueTable; using NodeValueArray = std::map<int, NodeValue>; using NodeValueTableArray = std::map<int, NodeValueTable>; class NodeValue { public: /** * @brief The types of data that can be passed between Nodes */ enum Type { kNone, /** ****************************** SPECIFIC IDENTIFIERS ****************************** */ /** * Integer type * * Resolves to int64_t. */ kInt, /** * Decimal (floating-point) type * * Resolves to `double`. */ kFloat, /** * Decimal (rational) type * * Resolves to `double`. */ kRational, /** * Boolean type * * Resolves to `bool`. */ kBoolean, /** * Floating-point type * * Resolves to `Color`. * * Colors passed around the nodes should always be in reference space and preferably use */ kColor, /** * Matrix type * * Resolves to `QMatrix4x4`. */ kMatrix, /** * Text type * * Resolves to `QString`. */ kText, /** * Font type * * Resolves to `QFont`. */ kFont, /** * File type * * Resolves to a `QString` containing an absolute file path. */ kFile, /** * Image buffer type * * True value type depends on the render engine used. */ kTexture, /** * Audio samples type * * Resolves to `SampleBufferPtr`. */ kSamples, /** * Two-dimensional vector (XY) type * * Resolves to `QVector2D`. */ kVec2, /** * Three-dimensional vector (XYZ) type * * Resolves to `QVector3D`. */ kVec3, /** * Four-dimensional vector (XYZW) type * * Resolves to `QVector4D`. */ kVec4, /** * Cubic bezier type that contains three X/Y coordinates, the main point, and two control points * * Resolves to `Bezier` */ kBezier, /** * ComboBox type * * Resolves to `int` - the index currently selected */ kCombo, /** * Video Parameters type * * Resolves to `VideoParams` */ kVideoParams, /** * Audio Parameters type * * Resolves to `AudioParams` */ kAudioParams, /** * Subtitle Parameters type * * Resolves to `SubtitleParams` */ kSubtitleParams, /** * Binary Data */ kBinary, /** * End of list */ kDataTypeCount }; NodeValue() : type_(kNone), from_(nullptr), array_(false) { } template <typename T> NodeValue(Type type, const T& data, const Node* from = nullptr, bool array = false, const QString& tag = QString()) : type_(type), from_(from), tag_(tag), array_(array) { set_value(data); } template <typename T> NodeValue(Type type, const T& data, const Node* from, const QString& tag) : NodeValue(type, data, from, false, tag) { } Type type() const { return type_; } template <typename T> T value() const { return data_.value<T>(); } template <typename T> void set_value(const T &v) { data_ = QVariant::fromValue(v); } const QVariant &data() const { return data_; } template <typename T> bool canConvert() const { return data_.canConvert<T>(); } const QString& tag() const { return tag_; } void set_tag(const QString& tag) { tag_ = tag; } const Node* source() const { return from_; } bool array() const { return array_; } bool operator==(const NodeValue& rhs) const { return type_ == rhs.type_ && tag_ == rhs.tag_ && data_ == rhs.data_; } operator bool() const { return !data_.isNull(); } static QString GetPrettyDataTypeName(Type type); static QString GetDataTypeName(Type type); static NodeValue::Type GetDataTypeFromName(const QString &n); static QString ValueToString(Type data_type, const QVariant& value, bool value_is_a_key_track); static QString ValueToString(const NodeValue &v, bool value_is_a_key_track) { return ValueToString(v.type_, v.data_, value_is_a_key_track); } static QVariant StringToValue(Type data_type, const QString &string, bool value_is_a_key_track); static QVector<QVariant> split_normal_value_into_track_values(Type type, const QVariant &value); static QVariant combine_track_values_into_normal_value(Type type, const QVector<QVariant>& split); SplitValue to_split_value() const { return split_normal_value_into_track_values(type_, data_); } /** * @brief Returns whether a data type can be interpolated or not */ static bool type_can_be_interpolated(NodeValue::Type type) { return type == kFloat || type == kVec2 || type == kVec3 || type == kVec4 || type == kBezier || type == kColor || type == kRational; } static bool type_is_numeric(NodeValue::Type type) { return type == kFloat || type == kInt || type == kRational; } static bool type_is_vector(NodeValue::Type type) { return type == kVec2 || type == kVec3 || type == kVec4; } static bool type_is_buffer(NodeValue::Type type) { return type == kTexture || type == kSamples; } static int get_number_of_keyframe_tracks(Type type); static void ValidateVectorString(QStringList* list, int count); TexturePtr toTexture() const { return value<TexturePtr>(); } SampleBuffer toSamples() const { return value<SampleBuffer>(); } bool toBool() const { return value<bool>(); } double toDouble() const { return value<double>(); } int64_t toInt() const { return value<int64_t>(); } rational toRational() const { return value<olive::core::rational>(); } QString toString() const { return value<QString>(); } Color toColor() const { return value<olive::core::Color>(); } QMatrix4x4 toMatrix() const { return value<QMatrix4x4>(); } VideoParams toVideoParams() const { return value<VideoParams>(); } AudioParams toAudioParams() const { return value<AudioParams>(); } QVector2D toVec2() const { return value<QVector2D>(); } QVector3D toVec3() const { return value<QVector3D>(); } QVector4D toVec4() const { return value<QVector4D>(); } Bezier toBezier() const { return value<Bezier>(); } NodeValueArray toArray() const { return value<NodeValueArray>(); } private: Type type_; QVariant data_; const Node* from_; QString tag_; bool array_; }; class NodeValueTable { public: NodeValueTable() = default; NodeValue Get(NodeValue::Type type, const QString& tag = QString()) const { QVector<NodeValue::Type> types = {type}; return Get(types, tag); } NodeValue Get(const QVector<NodeValue::Type>& type, const QString& tag = QString()) const; NodeValue Take(NodeValue::Type type, const QString& tag = QString()) { QVector<NodeValue::Type> types = {type}; return Take(types, tag); } NodeValue Take(const QVector<NodeValue::Type>& type, const QString& tag = QString()); void Push(const NodeValue& value) { values_.append(value); } void Push(const NodeValueTable& value) { values_.append(value.values_); } template <typename T> void Push(NodeValue::Type type, const T& data, const Node *from, bool array = false, const QString& tag = QString()) { Push(NodeValue(type, data, from, array, tag)); } template <typename T> void Push(NodeValue::Type type, const T& data, const Node *from, const QString& tag) { Push(NodeValue(type, data, from, false, tag)); } void Prepend(const NodeValue& value) { values_.prepend(value); } template <typename T> void Prepend(NodeValue::Type type, const T& data, const Node *from, bool array = false, const QString& tag = QString()) { Prepend(NodeValue(type, data, from, array, tag)); } template <typename T> void Prepend(NodeValue::Type type, const T& data, const Node *from, const QString& tag) { Prepend(NodeValue(type, data, from, false, tag)); } const NodeValue& at(int index) const { return values_.at(index); } NodeValue TakeAt(int index) { return values_.takeAt(index); } int Count() const { return values_.size(); } bool Has(NodeValue::Type type) const; void Remove(const NodeValue& v); void Clear() { values_.clear(); } bool isEmpty() const { return values_.isEmpty(); } int GetValueIndex(const QVector<NodeValue::Type> &type, const QString& tag) const; static NodeValueTable Merge(QList<NodeValueTable> tables); private: QVector<NodeValue> values_; }; using NodeValueRow = QHash<QString, NodeValue>; } Q_DECLARE_METATYPE(olive::NodeValue) Q_DECLARE_METATYPE(olive::NodeValueTable) #endif // NODEVALUE_H
9,804
C++
.h
379
21.503958
121
0.6491
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,357
keyframe.h
olive-editor_olive/app/node/keyframe.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 NODEKEYFRAME_H #define NODEKEYFRAME_H #include <memory> #include <QPointF> #include <QVariant> #include "node/param.h" namespace olive { class Node; /** * @brief A point of data to be used at a certain time and interpolated with other data */ class NodeKeyframe : public QObject { Q_OBJECT public: /** * @brief Methods of interpolation to use with this keyframe */ enum Type { kInvalid = -1, kLinear, kHold, kBezier }; /** * @brief The two types of bezier handles that are available on bezier keyframes */ enum BezierType { kInHandle, kOutHandle }; static const Type kDefaultType; /** * @brief NodeKeyframe Constructor */ NodeKeyframe(const rational& time, const QVariant& value, Type type, int track, int element, const QString& input, QObject* parent = nullptr); NodeKeyframe(); virtual ~NodeKeyframe() override; NodeKeyframe* copy(int element, QObject* parent = nullptr) const; NodeKeyframe* copy(QObject* parent = nullptr) const; Node* parent() const; const QString& input() const { return input_; } void set_input(const QString& input) { input_ = input; } NodeKeyframeTrackReference key_track_ref() const { return NodeKeyframeTrackReference(NodeInput(parent(), input(), element()), track()); } /** * @brief The time this keyframe is set at */ const rational& time() const; void set_time(const rational& time); /** * @brief The value of this keyframe (i.e. the value to use at this keyframe's time) */ const QVariant& value() const; void set_value(const QVariant &value); /** * @brief The method of interpolation to use with this keyframe */ const Type& type() const; void set_type(const Type& type); void set_type_no_bezier_adj(const Type& type); /** * @brief For bezier interpolation, the control point leading into this keyframe */ const QPointF &bezier_control_in() const; void set_bezier_control_in(const QPointF& control); /** * @brief For bezier interpolation, the control point leading out of this keyframe */ const QPointF& bezier_control_out() const; void set_bezier_control_out(const QPointF& control); /** * @brief Returns a known good bezier that should be used in actual animation * * While users can move the bezier controls wherever they want, we have to limit their usage * internally to prevent a situation where the animation overlaps (i.e. there can only be one Y * value for any given X in the bezier line). This returns a value that is known good. */ QPointF valid_bezier_control_in() const; QPointF valid_bezier_control_out() const; /** * @brief Convenience functions for retrieving/setting bezier handle information with a BezierType */ const QPointF& bezier_control(BezierType type) const; void set_bezier_control(BezierType type, const QPointF& control); /** * @brief The track that this keyframe belongs to * * For the majority of keyfreames, this will be 0, but for some types, such as kVec2, this will be 0 for X keyframes * and 1 for Y keyframes, etc. */ int track() const { return track_; } void set_track(int t) { track_ = t; } int element() const { return element_; } void set_element(int e) { element_ = e; } /** * @brief Convenience function for getting the opposite handle type (e.g. kInHandle <-> kOutHandle) */ static BezierType get_opposing_bezier_type(BezierType type); NodeKeyframe* previous() const { return previous_; } void set_previous(NodeKeyframe* keyframe) { previous_ = keyframe; } NodeKeyframe* next() const { return next_; } void set_next(NodeKeyframe* keyframe) { next_ = keyframe; } bool has_sibling_at_time(const rational &t) const; bool load(QXmlStreamReader *reader, NodeValue::Type data_type); void save(QXmlStreamWriter *writer, NodeValue::Type data_type) const; signals: /** * @brief Signal emitted when this keyframe's time is changed */ void TimeChanged(const rational& time); /** * @brief Signal emitted when this keyframe's value is changed */ void ValueChanged(const QVariant& value); /** * @brief Signal emitted when this keyframe's value is changed */ void TypeChanged(const Type& type); /** * @brief Signal emitted when this keyframe's bezier in control point is changed */ void BezierControlInChanged(const QPointF& d); /** * @brief Signal emitted when this keyframe's bezier out control point is changed */ void BezierControlOutChanged(const QPointF& d); private: rational time_; QVariant value_; Type type_; QPointF bezier_control_in_; QPointF bezier_control_out_; QString input_; int track_; int element_; NodeKeyframe* previous_; NodeKeyframe* next_; }; using NodeKeyframeTrack = QVector<NodeKeyframe*>; } Q_DECLARE_METATYPE(olive::NodeKeyframe::Type) #endif // NODEKEYFRAME_H
5,653
C++
.h
171
29.660819
144
0.725263
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,358
node.h
olive-editor_olive/app/node/node.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 NODE_H #define NODE_H #include <map> #include <QMutex> #include <QObject> #include <QPainter> #include <QPointF> #include <QXmlStreamWriter> #include "codec/frame.h" #include "common/xmlutils.h" #include "node/gizmo/draggable.h" #include "node/globals.h" #include "node/keyframe.h" #include "node/inputimmediate.h" #include "node/param.h" #include "render/audioplaybackcache.h" #include "render/audiowaveformcache.h" #include "render/framehashcache.h" #include "render/job/generatejob.h" #include "render/job/samplejob.h" #include "render/job/shaderjob.h" #include "render/shadercode.h" #include "splitvalue.h" namespace olive { #define NODE_DEFAULT_FUNCTIONS(x) \ NODE_DEFAULT_DESTRUCTOR(x) \ NODE_COPY_FUNCTION(x) #define NODE_DEFAULT_DESTRUCTOR(x) \ virtual ~x() override {DisconnectAll();} #define NODE_COPY_FUNCTION(x) \ virtual Node *copy() const override {return new x();} class Folder; class Project; struct SerializedData; /** * @brief A single processing unit that can be connected with others to create intricate processing systems * * A cornerstone of "visual programming", a node is a single "function" that takes input and returns an output that can * be connected to other nodes. Inputs can be either user-set or retrieved from the output of another node. By joining * several nodes together, intricate, highly customizable, and infinitely extensible systems can be made for processing * data. It can also all be exposed to the user without forcing them to write code or compile anything. * * A major example in Olive is the entire rendering workflow. To render a frame, Olive will work through a node graph * that can be infinitely customized by the user to create images. * * This is a simple base class designed to contain all the functionality for this kind of processing connective unit. * It is an abstract class intended to be subclassed to create nodes with actual functionality. */ class Node : public QObject { Q_OBJECT public: enum CategoryID { kCategoryUnknown = -1, kCategoryOutput, kCategoryGenerator, kCategoryMath, kCategoryKeying, kCategoryFilter, kCategoryColor, kCategoryTime, kCategoryTimeline, kCategoryTransition, kCategoryDistort, kCategoryProject, kCategoryCount }; enum Flag { kNone = 0, kDontShowInParamView = 0x1, kVideoEffect = 0x2, kAudioEffect = 0x4, kDontShowInCreateMenu = 0x8, kIsItem = 0x10 }; struct ContextPair { Node *node; Node *context; }; Node(); virtual ~Node() override; /** * @brief Creates a clone of the Node * * By default, the clone will NOT have the values and connections of the original node. The caller is responsible for * copying that data with functions like CopyInputs() as copies may be done for different reasons. */ virtual Node* copy() const = 0; /** * @brief Convenience function - assumes parent is a NodeGraph */ Project *parent() const; Project* project() const; const uint64_t &GetFlags() const { return flags_; } /** * @brief Return the name of the node * * This is the node's name shown to the user. This must be overridden by subclasses, and preferably run through the * translator. */ virtual QString Name() const = 0; /** * @brief Returns a shortened name of this node if applicable * * Defaults to returning Name() but can be overridden. */ virtual QString ShortName() const; /** * @brief Return the unique identifier of the node * * This is used in save files and any other times a specific node must be picked out at runtime. This must be an ID * completely unique to this node, and preferably in bundle identifier format (e.g. "org.company.Name"). This string * should NOT be translated. */ virtual QString id() const = 0; /** * @brief Return the category this node is in (optional for subclassing, but recommended) * * In any organized node menus, show the node in this category. If this node should be in a subfolder of a subfolder, * use a "/" to separate categories (e.g. "Distort/Noise"). The string should not start with a "/" as this will be * interpreted as an empty string category. This value should be run through a translator as its largely user * oriented. */ virtual QVector<CategoryID> Category() const = 0; /** * @brief Return a description of this node's purpose (optional for subclassing, but recommended) * * A short (1-2 sentence) description of what this node should do to help the user understand its purpose. This should * be run through a translator. */ virtual QString Description() const; Folder* folder() const { return folder_; } bool IsItem() const { return flags_ & kIsItem; } /** * @brief Function called to retranslate parameter names (should be overridden in derivatives) */ virtual void Retranslate(); enum DataType { ICON, DURATION, CREATED_TIME, MODIFIED_TIME, FREQUENCY_RATE, TOOLTIP }; virtual QVariant data(const DataType &d) const; const QVector<QString>& inputs() const { return input_ids_; } virtual QVector<QString> IgnoreInputsForRendering() const { return QVector<QString>(); } class ActiveElements { public: enum Mode { kAllElements, kSpecified, kNoElements }; ActiveElements(Mode m = kAllElements) { mode_ = m; } Mode mode() const { return mode_; } std::list<int> elements() const { return elements_; } void add(int e) { elements_.push_back(e); mode_ = kSpecified; } private: Mode mode_; std::list<int> elements_; }; virtual ActiveElements GetActiveElementsAtTime(const QString &input, const TimeRange &r) const { return ActiveElements::kAllElements; } bool HasInputWithID(const QString& id) const { return input_ids_.contains(id); } bool HasParamWithID(const QString& id) const { return HasInputWithID(id); } FrameHashCache* video_frame_cache() const { return video_cache_; } ThumbnailCache* thumbnail_cache() const { return thumbnail_cache_; } AudioPlaybackCache* audio_playback_cache() const { return audio_cache_; } AudioWaveformCache* waveform_cache() const { return waveform_cache_; } virtual TimeRange GetVideoCacheRange() const { return TimeRange(); } virtual TimeRange GetAudioCacheRange() const { return TimeRange(); } struct Position { Position(const QPointF &p = QPointF(0, 0), bool e = false) { position = p; expanded = e; } bool load(QXmlStreamReader *reader); void save(QXmlStreamWriter *writer) const; QPointF position; bool expanded; inline Position &operator+=(const Position &p) { position += p.position; return *this; } inline Position &operator-=(const Position &p) { position -= p.position; return *this; } friend inline const Position operator+(Position a, const Position &b) { a += b; return a; } friend inline const Position operator-(Position a, const Position &b) { a -= b; return a; } }; using PositionMap = QHash<Node*, Position>; const PositionMap &GetContextPositions() const { return context_positions_; } bool IsNodeExpandedInContext(Node *node) const { return context_positions_.value(node).expanded; } bool ContextContainsNode(Node *node) const { return context_positions_.contains(node); } Position GetNodePositionDataInContext(Node *node) { return context_positions_.value(node); } QPointF GetNodePositionInContext(Node *node) { return GetNodePositionDataInContext(node).position; } bool SetNodePositionInContext(Node *node, const QPointF &pos); bool SetNodePositionInContext(Node *node, const Position &pos); void SetNodeExpandedInContext(Node *node, bool e) { context_positions_[node].expanded = e; } bool RemoveNodeFromContext(Node *node); /** * @brief Retrieve the color of this node */ Color color() const; /** * @brief Same as color() but return a pretty gradient version */ QLinearGradient gradient_color(qreal top, qreal bottom) const; /** * @brief Uses config and returns either color() for flat shading or gradient for gradient */ QBrush brush(qreal top, qreal bottom) const; int GetOverrideColor() const { return override_color_; } /** * @brief Sets the override color. Set to -1 for no override color. */ void SetOverrideColor(int index) { if (override_color_ != index) { override_color_ = index; emit ColorChanged(); } } static void ConnectEdge(Node *output, const NodeInput& input); static void DisconnectEdge(Node *output, const NodeInput& input); void CopyCacheUuidsFrom(Node *n); bool AreCachesEnabled() const { return caches_enabled_; } void SetCachesEnabled(bool e) { caches_enabled_ = e; } virtual QString GetInputName(const QString& id) const; void SetInputName(const QString& id, const QString& name); bool IsInputHidden(const QString& input) const; bool IsInputConnectable(const QString& input) const; bool IsInputKeyframable(const QString& input) const; bool IsInputKeyframing(const QString& input, int element = -1) const; bool IsInputKeyframing(const NodeInput& input) const { return IsInputKeyframing(input.input(), input.element()); } void SetInputIsKeyframing(const QString& input, bool e, int element = -1); void SetInputIsKeyframing(const NodeInput& input, bool e) { SetInputIsKeyframing(input.input(), e, input.element()); } bool IsInputConnected(const QString& input, int element = -1) const; bool IsInputConnected(const NodeInput& input) const { return IsInputConnected(input.input(), input.element()); } virtual bool IsInputConnectedForRender(const QString& input, int element = -1) const { return IsInputConnected(input, element); } bool IsInputConnectedForRender(const NodeInput& input) const { return IsInputConnectedForRender(input.input(), input.element()); } bool IsInputStatic(const QString& input, int element = -1) const { return !IsInputConnected(input, element) && !IsInputKeyframing(input, element); } bool IsInputStatic(const NodeInput& input) const { return IsInputStatic(input.input(), input.element()); } Node *GetConnectedOutput(const QString& input, int element = -1) const; Node *GetConnectedOutput(const NodeInput& input) const { return GetConnectedOutput(input.input(), input.element()); } virtual Node *GetConnectedRenderOutput(const QString& input, int element = -1) const { return GetConnectedOutput(input, element); } Node *GetConnectedRenderOutput(const NodeInput& input) const { return GetConnectedRenderOutput(input.input(), input.element()); } bool IsUsingStandardValue(const QString& input, int track, int element = -1) const; NodeValue::Type GetInputDataType(const QString& id) const; void SetInputDataType(const QString& id, const NodeValue::Type& type); bool HasInputProperty(const QString& id, const QString& name) const; QHash<QString, QVariant> GetInputProperties(const QString& id) const; QVariant GetInputProperty(const QString& id, const QString& name) const; void SetInputProperty(const QString& id, const QString& name, const QVariant& value); QVariant GetValueAtTime(const QString& input, const rational& time, int element = -1) const { NodeValue::Type type = GetInputDataType(input); return NodeValue::combine_track_values_into_normal_value(type, GetSplitValueAtTime(input, time, element)); } QVariant GetValueAtTime(const NodeInput& input, const rational& time) { return GetValueAtTime(input.input(), time, input.element()); } SplitValue GetSplitValueAtTime(const QString& input, const rational& time, int element = -1) const; SplitValue GetSplitValueAtTime(const NodeInput& input, const rational& time) { return GetSplitValueAtTime(input.input(), time, input.element()); } QVariant GetSplitValueAtTimeOnTrack(const QString& input, const rational& time, int track, int element = -1) const; QVariant GetSplitValueAtTimeOnTrack(const NodeInput& input, const rational& time, int track) const { return GetSplitValueAtTimeOnTrack(input.input(), time, track, input.element()); } QVariant GetSplitValueAtTimeOnTrack(const NodeKeyframeTrackReference& input, const rational& time) const { return GetSplitValueAtTimeOnTrack(input.input(), time, input.track()); } QVariant GetDefaultValue(const QString& input) const; SplitValue GetSplitDefaultValue(const QString& input) const; QVariant GetSplitDefaultValueOnTrack(const QString& input, int track) const; void SetDefaultValue(const QString& input, const QVariant &val); void SetSplitDefaultValue(const QString& input, const SplitValue &val); void SetSplitDefaultValueOnTrack(const QString& input, const QVariant &val, int track); const QVector<NodeKeyframeTrack>& GetKeyframeTracks(const QString& input, int element) const; const QVector<NodeKeyframeTrack>& GetKeyframeTracks(const NodeInput& input) const { return GetKeyframeTracks(input.input(), input.element()); } QVector<NodeKeyframe*> GetKeyframesAtTime(const QString& input, const rational& time, int element = -1) const; QVector<NodeKeyframe*> GetKeyframesAtTime(const NodeInput& input, const rational& time) const { return GetKeyframesAtTime(input.input(), time, input.element()); } NodeKeyframe* GetKeyframeAtTimeOnTrack(const QString& input, const rational& time, int track, int element = -1) const; NodeKeyframe* GetKeyframeAtTimeOnTrack(const NodeInput& input, const rational& time, int track) const { return GetKeyframeAtTimeOnTrack(input.input(), time, track, input.element()); } NodeKeyframe* GetKeyframeAtTimeOnTrack(const NodeKeyframeTrackReference& input, const rational& time) const { return GetKeyframeAtTimeOnTrack(input.input(), time, input.track()); } NodeKeyframe::Type GetBestKeyframeTypeForTimeOnTrack(const QString& input, const rational& time, int track, int element = -1) const; NodeKeyframe::Type GetBestKeyframeTypeForTimeOnTrack(const NodeInput& input, const rational& time, int track) const { return GetBestKeyframeTypeForTimeOnTrack(input.input(), time, track, input.element()); } NodeKeyframe::Type GetBestKeyframeTypeForTimeOnTrack(const NodeKeyframeTrackReference& input, const rational& time) const { return GetBestKeyframeTypeForTimeOnTrack(input.input(), time, input.track()); } int GetNumberOfKeyframeTracks(const QString& id) const; int GetNumberOfKeyframeTracks(const NodeInput& id) const { return GetNumberOfKeyframeTracks(id.input()); } NodeKeyframe* GetEarliestKeyframe(const QString& id, int element = -1) const; NodeKeyframe* GetEarliestKeyframe(const NodeInput& id) const { return GetEarliestKeyframe(id.input(), id.element()); } NodeKeyframe* GetLatestKeyframe(const QString& id, int element = -1) const; NodeKeyframe* GetLatestKeyframe(const NodeInput& id) const { return GetLatestKeyframe(id.input(), id.element()); } NodeKeyframe* GetClosestKeyframeBeforeTime(const QString& id, const rational& time, int element = -1) const; NodeKeyframe* GetClosestKeyframeBeforeTime(const NodeInput& id, const rational& time) const { return GetClosestKeyframeBeforeTime(id.input(), time, id.element()); } NodeKeyframe* GetClosestKeyframeAfterTime(const QString& id, const rational& time, int element = -1) const; NodeKeyframe* GetClosestKeyframeAfterTime(const NodeInput& id, const rational& time) const { return GetClosestKeyframeAfterTime(id.input(), time, id.element()); } bool HasKeyframeAtTime(const QString& id, const rational& time, int element = -1) const; bool HasKeyframeAtTime(const NodeInput& id, const rational& time) const { return HasKeyframeAtTime(id.input(), time, id.element()); } QStringList GetComboBoxStrings(const QString& id) const; QVariant GetStandardValue(const QString& id, int element = -1) const; QVariant GetStandardValue(const NodeInput& id) const { return GetStandardValue(id.input(), id.element()); } SplitValue GetSplitStandardValue(const QString& id, int element = -1) const; SplitValue GetSplitStandardValue(const NodeInput& id) const { return GetSplitStandardValue(id.input(), id.element()); } QVariant GetSplitStandardValueOnTrack(const QString& input, int track, int element = -1) const; QVariant GetSplitStandardValueOnTrack(const NodeKeyframeTrackReference& id) const { return GetSplitStandardValueOnTrack(id.input().input(), id.track(), id.input().element()); } void SetStandardValue(const QString& id, const QVariant& value, int element = -1); void SetStandardValue(const NodeInput& id, const QVariant& value) { SetStandardValue(id.input(), value, id.element()); } void SetSplitStandardValue(const QString& id, const SplitValue& value, int element = -1); void SetSplitStandardValue(const NodeInput& id, const SplitValue& value) { SetSplitStandardValue(id.input(), value, id.element()); } void SetSplitStandardValueOnTrack(const QString& id, int track, const QVariant& value, int element = -1); void SetSplitStandardValueOnTrack(const NodeKeyframeTrackReference& id, const QVariant& value) { SetSplitStandardValueOnTrack(id.input().input(), id.track(), value, id.input().element()); } bool InputIsArray(const QString& id) const; void InputArrayInsert(const QString& id, int index); void InputArrayResize(const QString& id, int size); void InputArrayRemove(const QString& id, int index); void InputArrayAppend(const QString& id) { InputArrayResize(id, InputArraySize(id) + 1); } void InputArrayPrepend(const QString& id) { InputArrayInsert(id, 0); } void InputArrayRemoveLast(const QString& id) { InputArrayResize(id, InputArraySize(id) - 1); } int InputArraySize(const QString& id) const; NodeInputImmediate* GetImmediate(const QString& input, int element) const; NodeInput GetEffectInput() { return effect_input_.isEmpty() ? NodeInput() : NodeInput(this, effect_input_); } const QString &GetEffectInputID() const { return effect_input_; } class ValueHint { public: explicit ValueHint(const QVector<NodeValue::Type> &types = QVector<NodeValue::Type>(), int index = -1, const QString &tag = QString()) : type_(types), index_(index), tag_(tag) { } explicit ValueHint(const QVector<NodeValue::Type> &types, const QString &tag) : type_(types), index_(-1), tag_(tag) { } explicit ValueHint(int index) : index_(index) { } explicit ValueHint(const QString &tag) : index_(-1), tag_(tag) { } const QVector<NodeValue::Type> &types() const { return type_; } const int &index() const { return index_; } const QString& tag() const { return tag_; } void set_type(const QVector<NodeValue::Type> &type) { type_ = type; } void set_index(const int &index) { index_ = index; } void set_tag(const QString &tag) { tag_ = tag; } bool load(QXmlStreamReader *reader); void save(QXmlStreamWriter *writer) const; private: QVector<NodeValue::Type> type_; int index_; QString tag_; }; const QMap<InputElementPair, ValueHint> &GetValueHints() const { return value_hints_; } ValueHint GetValueHintForInput(const QString &input, int element = -1) const { return value_hints_.value({input, element}); } void SetValueHintForInput(const QString &input, const ValueHint &hint, int element = -1); const NodeKeyframeTrack& GetTrackFromKeyframe(NodeKeyframe* key) const; using InputConnections = std::map<NodeInput, Node*>; /** * @brief Return map of input connections * * Inputs can only have one connection, so the key is the input connected and the value is the * output that it's connected to. */ const InputConnections& input_connections() const { return input_connections_; } using OutputConnection = std::pair<Node*, NodeInput>; using OutputConnections = std::vector<OutputConnection>; /** * @brief Return list of output connections * * An output can connect an infinite amount of inputs, so in this map, the key is the output and * the value is a vector of inputs. */ const OutputConnections& output_connections() const { return output_connections_; } /** * @brief Return a list of all Nodes that this Node's inputs are connected to (does not include this Node) */ QVector<Node *> GetDependencies() const; /** * @brief Returns a list of Nodes that this Node is dependent on, provided no other Nodes are dependent on them * outside of this hierarchy. * * Similar to GetDependencies(), but excludes any Nodes that are used outside the dependency graph of this Node. */ QVector<Node *> GetExclusiveDependencies() const; /** * @brief Retrieve immediate dependencies (only nodes that are directly connected to the inputs of this one) */ QVector<Node *> GetImmediateDependencies() const; struct ShaderRequest { ShaderRequest(const QString &shader_id) { id = shader_id; } ShaderRequest(const QString &shader_id, const QString &shader_stub) { id = shader_id; stub = shader_stub; } QString id; QString stub; }; /** * @brief Generate hardware accelerated code for this Node */ virtual ShaderCode GetShaderCode(const ShaderRequest &request) const; /** * @brief If Value() pushes a ShaderJob, this is the function that will process them. */ virtual void ProcessSamples(const NodeValueRow &values, const SampleBuffer &input, SampleBuffer &output, int index) const; /** * @brief If Value() pushes a GenerateJob, override this function for the image to create * * @param frame * * The destination buffer. It will already be allocated and ready for writing to. */ virtual void GenerateFrame(FramePtr frame, const GenerateJob &job) const; /** * @brief Returns whether this node ever receives an input from a particular node instance */ bool InputsFrom(Node* n, bool recursively) const; /** * @brief Returns whether this node ever receives an input from a node with a particular ID */ bool InputsFrom(const QString& id, bool recursively) const; /** * @brief Find inputs that `output` outputs to in order to arrive at this node * * Traverse this node's inputs recursively looking for `output`, and return a list of * edges that `output` uses to get to `this` node. */ QVector<NodeInput> FindWaysNodeArrivesHere(const Node *output) const; /** * @brief Severs all input and output connections */ void DisconnectAll(); /** * @brief Get the human-readable name for any category */ static QString GetCategoryName(const CategoryID &c); enum TransformTimeDirection { kTransformTowardsInput, kTransformTowardsOutput }; /** * @brief Transforms time from this node through the connections it takes to get to the specified node */ TimeRange TransformTimeTo(TimeRange time, Node* target, TransformTimeDirection dir, int path_index); /** * @brief Find nodes of a certain type that this Node takes inputs from */ template<class T> QVector<T*> FindInputNodes(int maximum = 0) const; /** * @brief Find nodes of a certain type that this Node takes inputs from */ template<class T> static QVector<T*> FindInputNodesConnectedToInput(const NodeInput &input, int maximum = 0); using InvalidateCacheOptions = QHash<QString, QVariant>; /** * @brief Signal all dependent Nodes that anything cached between start_range and end_range is now invalid and * requires re-rendering * * Override this if your Node subclass keeps a cache, but call this base function at the end of the subclass function. * Default behavior is to relay this signal to all connected outputs, which will need to be done as to not break * the DAG. Even if the time needs to be transformed somehow (e.g. converting media time to sequence time), you can * call this function with transformed time and relay the signal that way. */ virtual void InvalidateCache(const TimeRange& range, const QString& from, int element = -1, InvalidateCacheOptions options = InvalidateCacheOptions()); void InvalidateCache(const TimeRange& range, const NodeInput& from, const InvalidateCacheOptions &options = InvalidateCacheOptions()) { InvalidateCache(range, from.input(), from.element(), options); } /** * @brief Adjusts time that should be sent to nodes connected to certain inputs. * * If this node modifies the `time` (i.e. a clip converting sequence time to media time), this function should be * overridden to do so. Also make sure to override OutputTimeAdjustment() to provide the inverse function. */ virtual TimeRange InputTimeAdjustment(const QString& input, int element, const TimeRange& input_time, bool clamp) const; /** * @brief The inverse of InputTimeAdjustment() */ virtual TimeRange OutputTimeAdjustment(const QString& input, int element, const TimeRange& input_time) const; /** * @brief Copies inputs from from Node to another including connections * * Nodes must be of the same types (i.e. have the same ID) */ static void CopyInputs(const Node *source, Node* destination, bool include_connections = true, MultiUndoCommand *command = nullptr); static void CopyInput(const Node *src, Node* dst, const QString& input, bool include_connections, bool traverse_arrays, MultiUndoCommand *command); static void CopyValuesOfElement(const Node* src, Node* dst, const QString& input, int src_element, int dst_element, MultiUndoCommand *command = nullptr); static void CopyValuesOfElement(const Node* src, Node* dst, const QString& input, int element, MultiUndoCommand *command = nullptr) { return CopyValuesOfElement(src, dst, input, element, element, command); } /** * @brief Clones a set of nodes and connects the new ones the way the old ones were */ static QVector<Node*> CopyDependencyGraph(const QVector<Node*>& nodes, MultiUndoCommand *command); static void CopyDependencyGraph(const QVector<Node*>& src, const QVector<Node*>& dst, MultiUndoCommand *command); static Node* CopyNodeAndDependencyGraphMinusItems(Node* node, MultiUndoCommand* command); static Node* CopyNodeInGraph(Node *node, MultiUndoCommand* command); /** * @brief The main processing function * * The node's main purpose is to take values from inputs to set values in outputs. For whatever subclass node you * create, this is where the code for that goes. * * Note that as a video editor, the node graph has to work across time. Depending on the purpose of your node, it may * output different values depending on the time, and even if not, it will likely be receiving different input * depending on the time. Most of the difficult work here is handled by NodeInput::get_value() which you should pass * the `time` parameter to. It will return its value (at that time, if it's keyframed), or pass the time to a * corresponding output if it's connected to one. If your node doesn't directly deal with time, the default behavior * of the NodeParam objects will handle everything related to it automatically. */ virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const; bool HasGizmos() const { return !gizmos_.isEmpty(); } const QVector<NodeGizmo*> &GetGizmos() const { return gizmos_; } virtual QTransform GizmoTransformation(const NodeValueRow &row, const NodeGlobals &globals) const { return QTransform(); } virtual void UpdateGizmoPositions(const NodeValueRow &row, const NodeGlobals &globals){} const QString& GetLabel() const; void SetLabel(const QString& s); QString GetLabelAndName() const; QString GetLabelOrName() const; void InvalidateAll(const QString& input, int element = -1); bool HasLinks() const { return !links_.isEmpty(); } const QVector<Node*>& links() const { return links_; } static bool Link(Node* a, Node* b); static bool Unlink(Node* a, Node* b); static bool AreLinked(Node* a, Node* b); bool Load(QXmlStreamReader *reader, SerializedData *data); void Save(QXmlStreamWriter *writer) const; virtual bool LoadCustom(QXmlStreamReader *reader, SerializedData *data); virtual void SaveCustom(QXmlStreamWriter *writer) const {} virtual void PostLoadEvent(SerializedData *data); bool LoadInput(QXmlStreamReader *reader, SerializedData *data); void SaveInput(QXmlStreamWriter *writer, const QString &id) const; bool LoadImmediate(QXmlStreamReader *reader, const QString &input, int element, SerializedData *data); void SaveImmediate(QXmlStreamWriter *writer, const QString &input, int element) const; void SetFolder(Folder* folder) { folder_ = folder; } InputFlags GetInputFlags(const QString& input) const; void SetInputFlag(const QString &input, InputFlag f, bool on = true); virtual void LoadFinishedEvent(){} virtual void ConnectedToPreviewEvent(){} static void SetValueAtTime(const NodeInput &input, const rational &time, const QVariant &value, int track, MultiUndoCommand *command, bool insert_on_all_tracks_if_no_key); /** * @brief Find path starting at `from` that outputs to arrive at `to` */ static std::list<NodeInput> FindPath(Node *from, Node *to, int path_index); void ArrayResizeInternal(const QString& id, int size); virtual void AddedToGraphEvent(Project *p){} virtual void RemovedFromGraphEvent(Project *p){} static QString GetConnectCommandString(Node *output, const NodeInput &input); static QString GetDisconnectCommandString(Node *output, const NodeInput &input); static const QString kEnabledInput; protected: void InsertInput(const QString& id, NodeValue::Type type, const QVariant& default_value, InputFlags flags, int index); void PrependInput(const QString& id, NodeValue::Type type, const QVariant& default_value, InputFlags flags = InputFlags(kInputFlagNormal)) { InsertInput(id, type, default_value, flags, 0); } void PrependInput(const QString& id, NodeValue::Type type, InputFlags flags = InputFlags(kInputFlagNormal)) { PrependInput(id, type, QVariant(), flags); } void AddInput(const QString& id, NodeValue::Type type, const QVariant& default_value, InputFlags flags = InputFlags(kInputFlagNormal)) { InsertInput(id, type, default_value, flags, input_ids_.size()); } void AddInput(const QString& id, NodeValue::Type type, InputFlags flags = InputFlags(kInputFlagNormal)) { AddInput(id, type, QVariant(), flags); } void RemoveInput(const QString& id); void SetComboBoxStrings(const QString& id, const QStringList& strings) { SetInputProperty(id, QStringLiteral("combo_str"), strings); } void SendInvalidateCache(const TimeRange &range, const InvalidateCacheOptions &options); enum GizmoScaleHandles { kGizmoScaleTopLeft, kGizmoScaleTopCenter, kGizmoScaleTopRight, kGizmoScaleBottomLeft, kGizmoScaleBottomCenter, kGizmoScaleBottomRight, kGizmoScaleCenterLeft, kGizmoScaleCenterRight, kGizmoScaleCount, }; virtual void LinkChangeEvent(){} virtual void InputValueChangedEvent(const QString& input, int element); virtual void InputConnectedEvent(const QString& input, int element, Node *output); virtual void InputDisconnectedEvent(const QString& input, int element, Node *output); virtual void OutputConnectedEvent(const NodeInput& input); virtual void OutputDisconnectedEvent(const NodeInput& input); virtual void childEvent(QChildEvent *event) override; void SetEffectInput(const QString &input) { effect_input_ = input; } void SetFlag(Flag f, bool on = true) { if (on) { flags_ |= f; } else { flags_ &= ~f; } } template<typename T> T *AddDraggableGizmo(const QVector<NodeKeyframeTrackReference> &inputs = QVector<NodeKeyframeTrackReference>(), DraggableGizmo::DragValueBehavior behavior = DraggableGizmo::kDeltaFromStart) { T *gizmo = new T(this); gizmo->SetDragValueBehavior(behavior); foreach (const NodeKeyframeTrackReference &input, inputs) { gizmo->AddInput(input); } connect(gizmo, &DraggableGizmo::HandleStart, this, &Node::GizmoDragStart); connect(gizmo, &DraggableGizmo::HandleMovement, this, &Node::GizmoDragMove); return gizmo; } template<typename T> T *AddDraggableGizmo(const QStringList &inputs, DraggableGizmo::DragValueBehavior behavior = DraggableGizmo::kDeltaFromStart) { QVector<NodeKeyframeTrackReference> refs(inputs.size()); for (int i=0; i<refs.size(); i++) { refs[i] = NodeInput(this, inputs[i]); } return AddDraggableGizmo<T>(refs, behavior); } protected slots: virtual void GizmoDragStart(const olive::NodeValueRow &row, double x, double y, const olive::core::rational &time){} virtual void GizmoDragMove(double x, double y, const Qt::KeyboardModifiers &modifiers){} signals: /** * @brief Signal emitted when SetLabel() is called */ void LabelChanged(const QString& s); void ColorChanged(); void ValueChanged(const NodeInput& input, const TimeRange& range); void InputConnected(Node *output, const NodeInput& input); void InputDisconnected(Node *output, const NodeInput& input); void OutputConnected(Node *output, const NodeInput& input); void OutputDisconnected(Node *output, const NodeInput& input); void InputValueHintChanged(const NodeInput& input); void InputPropertyChanged(const QString& input, const QString& key, const QVariant& value); void LinksChanged(); void InputArraySizeChanged(const QString& input, int old_size, int new_size); void KeyframeAdded(NodeKeyframe* key); void KeyframeRemoved(NodeKeyframe* key); void KeyframeTimeChanged(NodeKeyframe* key); void KeyframeTypeChanged(NodeKeyframe* key); void KeyframeValueChanged(NodeKeyframe* key); void KeyframeEnableChanged(const NodeInput& input, bool enabled); void InputAdded(const QString& id); void InputRemoved(const QString& id); void InputNameChanged(const QString& id, const QString& name); void InputDataTypeChanged(const QString& id, NodeValue::Type type); void AddedToGraph(Project* graph); void RemovedFromGraph(Project* graph); void NodeAddedToContext(Node *node); void NodePositionInContextChanged(Node *node, const QPointF &pos); void NodeRemovedFromContext(Node *node); void InputFlagsChanged(const QString &input, const InputFlags &flags); private: struct Input { NodeValue::Type type; InputFlags flags; SplitValue default_value; QHash<QString, QVariant> properties; QString human_name; int array_size; }; NodeInputImmediate* CreateImmediate(const QString& input); int GetInternalInputIndex(const QString& input) const { return input_ids_.indexOf(input); } Input* GetInternalInputData(const QString& input) { int i = GetInternalInputIndex(input); if (i == -1) { return nullptr; } else { return &input_data_[i]; } } const Input* GetInternalInputData(const QString& input) const { int i = GetInternalInputIndex(input); if (i == -1) { return nullptr; } else { return &input_data_.at(i); } } void ReportInvalidInput(const char* attempted_action, const QString &id, int element) const; static Node *CopyNodeAndDependencyGraphMinusItemsInternal(QMap<Node *, Node *> &created, Node *node, MultiUndoCommand *command); /** * @brief Immediates aren't deleted, so the actual array size may be larger than ArraySize() */ int GetInternalInputArraySize(const QString& input); /** * @brief Find nodes of a certain type that this Node takes inputs from */ template<class T> static void FindInputNodesConnectedToInputInternal(const NodeInput &input, QVector<T *>& list, int maximum); template<class T> static void FindInputNodeInternal(const Node* n, QVector<T *>& list, int maximum); QVector<Node*> GetDependenciesInternal(bool traverse, bool exclusive_only) const; void ParameterValueChanged(const QString &input, int element, const olive::core::TimeRange &range); void ParameterValueChanged(const NodeInput& input, const olive::core::TimeRange &range) { ParameterValueChanged(input.input(), input.element(), range); } /** * @brief Intelligently determine how what time range is affected by a keyframe */ TimeRange GetRangeAffectedByKeyframe(NodeKeyframe *key) const; /** * @brief Gets a time range between the previous and next keyframes of index */ TimeRange GetRangeAroundIndex(const QString& input, int index, int track, int element) const; void ClearElement(const QString &input, int index); /** * @brief Custom user label for node */ QString label_; /** * @brief -1 if the color should be based on the category, >=0 if the user has set a custom color */ int override_color_; /** * @brief Nodes that are linked with this one */ QVector<Node*> links_; QVector<QString> input_ids_; QVector<Input> input_data_; QMap<QString, NodeInputImmediate*> standard_immediates_; QMap<QString, QVector<NodeInputImmediate*> > array_immediates_; InputConnections input_connections_; OutputConnections output_connections_; Folder* folder_; QMap<InputElementPair, ValueHint> value_hints_; PositionMap context_positions_; uint64_t flags_; QVector<NodeGizmo*> gizmos_; QString effect_input_; FrameHashCache *video_cache_; ThumbnailCache *thumbnail_cache_; AudioPlaybackCache *audio_cache_; AudioWaveformCache *waveform_cache_; bool caches_enabled_; private slots: /** * @brief Slot when a keyframe's time changes to keep the keyframes correctly sorted by time */ void InvalidateFromKeyframeTimeChange(); /** * @brief Slot when a keyframe's value changes to signal that the cache needs updating */ void InvalidateFromKeyframeValueChange(); /** * @brief Slot when a keyframe's type changes to signal that the cache needs updating */ void InvalidateFromKeyframeTypeChanged(); /** * @brief Slot when a keyframe's bezier in value changes to signal that the cache needs updating */ void InvalidateFromKeyframeBezierInChange(); /** * @brief Slot when a keyframe's bezier out value changes to signal that the cache needs updating */ void InvalidateFromKeyframeBezierOutChange(); }; template<class T> void Node::FindInputNodesConnectedToInputInternal(const NodeInput &input, QVector<T *> &list, int maximum) { Node* edge = input.GetConnectedOutput(); if (!edge) { return; } T* cast_test = dynamic_cast<T*>(edge); if (cast_test) { list.append(cast_test); if (maximum != 0 && list.size() == maximum) { return; } } FindInputNodeInternal<T>(edge, list, maximum); } template<class T> QVector<T *> Node::FindInputNodesConnectedToInput(const NodeInput &input, int maximum) { QVector<T *> list; FindInputNodesConnectedToInputInternal<T>(input, list, maximum); return list; } template<class T> void Node::FindInputNodeInternal(const Node* n, QVector<T *> &list, int maximum) { for (auto it=n->input_connections_.cbegin(); it!=n->input_connections_.cend(); it++) { FindInputNodesConnectedToInputInternal(it->first, list, maximum); } } template<class T> QVector<T *> Node::FindInputNodes(int maximum) const { QVector<T *> list; FindInputNodeInternal<T>(this, list, maximum); return list; } } Q_DECLARE_METATYPE(olive::Node::ValueHint) #endif // NODE_H
40,777
C++
.h
1,047
35.088825
191
0.740844
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,359
inputimmediate.h
olive-editor_olive/app/node/inputimmediate.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 NODEINPUTIMMEDIATE_H #define NODEINPUTIMMEDIATE_H #include "common/xmlutils.h" #include "node/keyframe.h" #include "node/value.h" #include "splitvalue.h" namespace olive { class NodeInput; class NodeInputImmediate { public: NodeInputImmediate(NodeValue::Type type, const SplitValue& default_val); /** * @brief Internal insert function, automatically does an insertion sort based on the keyframe's time */ void insert_keyframe(NodeKeyframe* key); void remove_keyframe(NodeKeyframe* key); void delete_all_keyframes(QObject *parent = nullptr); /** * @brief Get non-keyframed value split into components (the way it's stored) */ const SplitValue& get_split_standard_value() const { return standard_value_; } const QVariant& get_split_standard_value_on_track(int track) const { return standard_value_.at(track); } void set_standard_value_on_track(const QVariant &value, int track); void set_split_standard_value(const SplitValue& value); /** * @brief Retrieve a list of keyframe objects for all tracks at a given time * * List may be empty if this input is not keyframing or has no keyframes at this time. */ QVector<NodeKeyframe*> get_keyframe_at_time(const rational& time) const; /** * @brief Retrieve the keyframe object at a given time for a given track * * @return * * The keyframe object at this time or nullptr if there isn't one or if is_keyframing() is false. */ NodeKeyframe* get_keyframe_at_time_on_track(const rational& time, int track) const; /** * @brief Gets the closest keyframe to a time * * If is_keyframing() is false or keyframes_ is empty, this will return nullptr. */ NodeKeyframe* get_closest_keyframe_to_time_on_track(const rational& time, int track) const; /** * @brief Get closest keyframe that's before the time on any track * * If no keyframe is before this time, returns nullptr. */ NodeKeyframe* get_closest_keyframe_before_time(const rational& time) const; /** * @brief Get closest keyframe that's before the time on any track * * If no keyframe is before this time, returns nullptr. */ NodeKeyframe* get_closest_keyframe_after_time(const rational& time) const; /** * @brief A heuristic to determine what type a keyframe should be if it's inserted at a certain time (between keyframes) */ NodeKeyframe::Type get_best_keyframe_type_for_time(const rational& time, int track) const; /** * @brief Return list of keyframes in this parameter */ const QVector<NodeKeyframeTrack> &keyframe_tracks() const { return keyframe_tracks_; } /** * @brief Return whether keyframing is enabled on this input or not */ bool is_keyframing() const { return keyframing_; } /** * @brief Set whether keyframing is enabled on this input or not */ void set_is_keyframing(bool k) { keyframing_ = k; } /** * @brief Gets the earliest keyframe on any track */ NodeKeyframe* get_earliest_keyframe() const; /** * @brief Gets the latest keyframe on any track */ NodeKeyframe* get_latest_keyframe() const; /** * @brief Return whether a keyframe exists at this time * * If is_keyframing() is false, this will always return false. This checks all tracks and will return true if *any* * track has a keyframe. */ bool has_keyframe_at_time(const rational &time) const; bool is_using_standard_value(int track) const { return (!is_keyframing() || keyframe_tracks_.at(track).isEmpty()); } void set_data_type(NodeValue::Type type); private: /** * @brief Non-keyframed value */ SplitValue standard_value_; /** * @brief Default value */ SplitValue default_value_; /** * @brief Internal keyframe array * * If keyframing is enabled, this data is used instead of standard_value. */ QVector<NodeKeyframeTrack> keyframe_tracks_; /** * @brief Internal keyframing enabled setting */ bool keyframing_; }; } #endif // NODEINPUTIMMEDIATE_H
4,758
C++
.h
144
29.5625
122
0.723558
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,360
valuedatabase.h
olive-editor_olive/app/node/valuedatabase.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 NODEVALUEDATABASE_H #define NODEVALUEDATABASE_H #include "param.h" #include "value.h" namespace olive { class NodeValueDatabase { public: NodeValueDatabase() = default; NodeValueTable& operator[](const QString& input_id) { return tables_[input_id]; } void Insert(const QString& key, const NodeValueTable &value) { tables_.insert(key, value); } NodeValueTable Take(const QString &key) { return tables_.take(key); } NodeValueTable Merge() const; using Tables = QHash<QString, NodeValueTable>; using const_iterator = Tables::const_iterator; using iterator = Tables::iterator; inline const_iterator cbegin() const { return tables_.cbegin(); } inline const_iterator cend() const { return tables_.cend(); } inline iterator begin() { return tables_.begin(); } inline iterator end() { return tables_.end(); } inline bool contains(const QString& s) const { return tables_.contains(s); } private: Tables tables_; }; } Q_DECLARE_METATYPE(olive::NodeValueDatabase) #endif // NODEVALUEDATABASE_H
1,813
C++
.h
65
24.738462
71
0.740719
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,361
param.h
olive-editor_olive/app/node/param.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 NODEPARAM_H #define NODEPARAM_H #include <QString> #include "value.h" namespace olive { class Node; class NodeKeyframe; enum InputFlag : uint64_t { /// By default, inputs are keyframable, connectable, and NOT arrays kInputFlagNormal = 0x0, kInputFlagArray = 0x1, kInputFlagNotKeyframable = 0x2, kInputFlagNotConnectable = 0x4, kInputFlagHidden = 0x8, kInputFlagIgnoreInvalidations = 0x10, kInputFlagStatic = kInputFlagNotKeyframable | kInputFlagNotConnectable }; class InputFlags { public: explicit InputFlags() { f_ = kInputFlagNormal; } explicit InputFlags(uint64_t flags) { f_ = flags; } InputFlags operator|(const InputFlags &f) const { InputFlags i = *this; i |= f; return i; } InputFlags operator|(const InputFlag &f) const { InputFlags i = *this; i |= f; return i; } InputFlags operator|(const uint64_t &f) const { InputFlags i = *this; i |= f; return i; } InputFlags &operator|=(const InputFlags &f) { f_ |= f.f_; return *this; } InputFlags &operator|=(const InputFlag &f) { f_ |= f; return *this; } InputFlags &operator|=(const uint64_t &f) { f_ |= f; return *this; } InputFlags operator&(const InputFlags &f) const { InputFlags i = *this; i &= f; return i; } InputFlags operator&(const InputFlag &f) const { InputFlags i = *this; i &= f; return i; } InputFlags operator&(const uint64_t &f) const { InputFlags i = *this; i &= f; return i; } InputFlags &operator&=(const InputFlags &f) { f_ &= f.f_; return *this; } InputFlags &operator&=(const InputFlag &f) { f_ &= f; return *this; } InputFlags &operator&=(const uint64_t &f) { f_ &= f; return *this; } InputFlags operator~() const { InputFlags i = *this; i.f_ = ~i.f_; return i; } inline operator bool() const { return f_; } inline const uint64_t &value() const { return f_; } private: uint64_t f_; }; struct NodeInputPair { bool operator==(const NodeInputPair& rhs) const { return node == rhs.node && input == rhs.input; } Node* node; QString input; }; /** * @brief Defines a Node input */ class NodeInput { public: NodeInput() { node_ = nullptr; element_ = -1; } NodeInput(Node* n, const QString& i, int e = -1) { node_ = n; input_ = i; element_ = e; } bool operator==(const NodeInput& rhs) const { return node_ == rhs.node_ && input_ == rhs.input_ && element_ == rhs.element_; } bool operator!=(const NodeInput& rhs) const { return !(*this == rhs); } bool operator<(const NodeInput& rhs) const { if (node_ != rhs.node_) { return node_ < rhs.node_; } if (input_ != rhs.input_) { return input_ < rhs.input_; } return element_ < rhs.element_; } Node* node() const { return node_; } NodeInputPair input_pair() const { return {node_, input_}; } const QString& input() const { return input_; } const int &element() const { return element_; } void set_node(Node *node) { node_ = node; } void set_input(const QString &input) { input_ = input; } void set_element(int e) { element_ = e; } QString name() const; bool IsValid() const { return node_ && !input_.isEmpty() && element_ >= -1; } bool IsHidden() const; bool IsConnected() const; bool IsKeyframing() const; bool IsArray() const; InputFlags GetFlags() const; QString GetInputName() const; Node *GetConnectedOutput() const; NodeValue::Type GetDataType() const; QVariant GetDefaultValue() const; QStringList GetComboBoxStrings() const; QVariant GetProperty(const QString& key) const; QHash<QString, QVariant> GetProperties() const; QVariant GetValueAtTime(const rational& time) const; NodeKeyframe *GetKeyframeAtTimeOnTrack(const rational& time, int track) const; QVariant GetSplitDefaultValueForTrack(int track) const; int GetArraySize() const; void Reset() { *this = NodeInput(); } private: Node* node_; QString input_; int element_; }; struct InputElementPair { QString input; int element; bool operator<(const InputElementPair &rhs) const { if (input != rhs.input) { return input < rhs.input; } return element < rhs.element; } bool operator==(const InputElementPair &rhs) const { return input == rhs.input && element == rhs.element; } bool operator!=(const InputElementPair &rhs) const { return !(*this == rhs); } }; class NodeKeyframeTrackReference { public: NodeKeyframeTrackReference() { track_ = -1; } NodeKeyframeTrackReference(const NodeInput& input, int track = 0) { input_ = input; track_ = track; } bool operator==(const NodeKeyframeTrackReference& rhs) const { return input_ == rhs.input_ && track_ == rhs.track_; } const NodeInput& input() const { return input_; } int track() const { return track_; } bool IsValid() const { return input_.IsValid() && track_ >= 0; } void Reset() { *this = NodeKeyframeTrackReference(); } private: NodeInput input_; int track_; }; uint qHash(const NodeInputPair& i); uint qHash(const NodeInput& i); uint qHash(const NodeKeyframeTrackReference& i); } Q_DECLARE_METATYPE(olive::NodeInput) Q_DECLARE_METATYPE(olive::NodeKeyframeTrackReference) #endif // NODEPARAM_H
6,249
C++
.h
286
18.265734
82
0.670296
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,362
project.h
olive-editor_olive/app/node/project.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 PROJECT_H #define PROJECT_H #include <memory> #include <QObject> #include <QUuid> #include "node/output/viewer/viewer.h" #include "node/project/footage/footage.h" #include "node/color/colormanager/colormanager.h" #include "window/mainwindow/mainwindowlayoutinfo.h" namespace olive { /** * @brief A project instance containing all the data pertaining to the user's project * * A project instance uses a parent-child hierarchy of Item objects. Projects will usually contain the following: * * * Footage * * Sequences * * Folders * * Project Settings * * Window Layout */ class Project : public QObject { Q_OBJECT public: enum CacheSetting { kCacheUseDefaultLocation, kCacheStoreAlongsideProject, kCacheCustomPath }; Project(); virtual ~Project() override; /** * @brief Destructively destroys all nodes in the graph */ void Clear(); /** * @brief Retrieve a complete list of the nodes belonging to this graph */ const QVector<Node*>& nodes() const { return node_children_; } void Initialize(); SerializedData Load(QXmlStreamReader *reader); void Save(QXmlStreamWriter *writer) const; int GetNumberOfContextsNodeIsIn(Node *node, bool except_itself = false) const; QString name() const; const QString& filename() const; QString pretty_filename() const; void set_filename(const QString& s); Folder *root() const { return root_; } ColorManager *color_manager() const { return color_manager_; } bool is_modified() const { return is_modified_; } void set_modified(bool e); bool has_autorecovery_been_saved() const; void set_autorecovery_saved(bool e); bool is_new() const; QString get_cache_alongside_project_path() const; QString cache_path() const; const QUuid& GetUuid() const { return uuid_; } void SetUuid(const QUuid &uuid) { uuid_ = uuid; } void RegenerateUuid(); /** * @brief Returns the filename the project was saved as, but not necessarily where it is now * * May help for resolving relative paths. */ const QString &GetSavedURL() const { return saved_url_; } void SetSavedURL(const QString &url) { saved_url_ = url; } /** * @brief Find project parent from object * * If an object is expected to be a child of a project, this function will traverse its parent * tree until it finds it. */ static Project *GetProjectFromObject(const QObject *o); static void CopySettings(Project *from, Project *to) { to->settings_ = from->settings_; } static const QString kItemMimeType; static const QString kCacheLocationSettingKey; static const QString kCachePathKey; static const QString kColorConfigFilename; static const QString kColorReferenceSpace; static const QString kDefaultInputColorSpaceKey; static const QString kRootKey; QString GetSetting(const QString &key) const { return settings_.value(key); } void SetSetting(const QString &key, const QString &value); CacheSetting GetCacheLocationSetting() const { return static_cast<CacheSetting>(GetSetting(kCacheLocationSettingKey).toInt()); } void SetCacheLocationSetting(CacheSetting s) { SetSetting(kCacheLocationSettingKey, QString::number(s)); } QString GetCustomCachePath() const { return GetSetting(kCachePathKey); } void SetCustomCachePath(const QString &path) { SetSetting(kCachePathKey, path); } QString GetColorConfigFilename() const { return GetSetting(kColorConfigFilename); } void SetColorConfigFilename(const QString& s) { SetSetting(kColorConfigFilename, s); } QString GetDefaultInputColorSpace() const { return GetSetting(kDefaultInputColorSpaceKey); } void SetDefaultInputColorSpace(const QString& s) { SetSetting(kDefaultInputColorSpaceKey, s); } QString GetColorReferenceSpace() const { return GetSetting(kColorReferenceSpace); } void SetColorReferenceSpace(const QString& s) { SetSetting(kColorReferenceSpace, s); } signals: void NameChanged(); void ModifiedChanged(bool e); /** * @brief Signal emitted when a Node is added to the graph */ void NodeAdded(Node* node); /** * @brief Signal emitted when a Node is removed from the graph */ void NodeRemoved(Node* node); void InputConnected(Node *output, const NodeInput& input); void InputDisconnected(Node *output, const NodeInput& input); void ValueChanged(const NodeInput& input); void InputValueHintChanged(const NodeInput& input); void GroupAddedInputPassthrough(NodeGroup *group, const NodeInput &input); void GroupRemovedInputPassthrough(NodeGroup *group, const NodeInput &input); void GroupChangedOutputPassthrough(NodeGroup *group, Node *output); void SettingChanged(const QString &key, const QString &value); protected: virtual void childEvent(QChildEvent* event) override; private: QUuid uuid_; Folder* root_; QString filename_; QString saved_url_; bool is_modified_; bool autorecovery_saved_; ColorManager *color_manager_; QVector<Node*> node_children_; QMap<QString, QString> settings_; }; } #endif // PROJECT_H
5,783
C++
.h
157
33.56051
130
0.759978
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,363
serializeddata.h
olive-editor_olive/app/node/serializeddata.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2023 Olive Studios LLC 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 SERIALIZEDDATA_H #define SERIALIZEDDATA_H #include <QHash> #include <QVariant> #include "node.h" namespace olive { class NodeGroup; struct SerializedData { struct SerializedConnection { NodeInput input; quintptr output_node; }; struct BlockLink { Node* block; quintptr link; }; struct GroupLink { NodeGroup *group; QString passthrough_id; quintptr input_node; QString input_id; int input_element; QString custom_name; InputFlags custom_flags; NodeValue::Type data_type; QVariant default_val; QHash<QString, QVariant> custom_properties; }; QMap<Node *, QMap<quintptr, Node::Position> > positions; QHash<quintptr, Node*> node_ptrs; QList<SerializedConnection> desired_connections; QList<BlockLink> block_links; QVector<GroupLink> group_input_links; QHash<NodeGroup*, quintptr> group_output_links; }; } #endif // SERIALIZEDDATA_H
1,645
C++
.h
51
28.882353
71
0.7565
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,364
traverser.h
olive-editor_olive/app/node/traverser.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 NODETRAVERSER_H #define NODETRAVERSER_H #include <QVector2D> #include "codec/decoder.h" #include "common/cancelableobject.h" #include "node/output/track/track.h" #include "render/job/cachejob.h" #include "render/cancelatom.h" #include "render/job/footagejob.h" #include "render/job/colortransformjob.h" #include "render/job/footagejob.h" #include "value.h" namespace olive { class NodeTraverser { public: NodeTraverser(); NodeValueTable GenerateTable(const Node *n, const TimeRange &range, const Node *next_node = nullptr); virtual NodeValueDatabase GenerateDatabase(const Node *node, const TimeRange &range); NodeValueRow GenerateRow(NodeValueDatabase *database, const Node *node, const TimeRange &range); NodeValueRow GenerateRow(const Node *node, const TimeRange &range); NodeValue GenerateRowValue(const Node *node, const QString &input, NodeValueTable *table, const TimeRange &time); NodeValue GenerateRowValueElement(const Node *node, const QString &input, int element, NodeValueTable *table, const TimeRange &time); int GenerateRowValueElementIndex(const Node::ValueHint &hint, NodeValue::Type preferred_type, const NodeValueTable *table); int GenerateRowValueElementIndex(const Node *node, const QString &input, int element, const NodeValueTable *table); void Transform(QTransform *transform, const Node *start, const Node *end, const TimeRange &range); const VideoParams& GetCacheVideoParams() const { return video_params_; } void SetCacheVideoParams(const VideoParams& params) { video_params_ = params; } const AudioParams& GetCacheAudioParams() const { return audio_params_; } void SetCacheAudioParams(const AudioParams& params) { audio_params_ = params; } protected: NodeValueTable ProcessInput(const Node *node, const QString &input, const TimeRange &range); void ProcessInputElement(NodeValueTableArray &array_tbl, const Node *node, const QString &input, int element, const TimeRange &range); virtual void ProcessVideoFootage(TexturePtr destination, const FootageJob *stream, const rational &input_time){} virtual void ProcessAudioFootage(SampleBuffer &destination, const FootageJob *stream, const TimeRange &input_time){} virtual void ProcessShader(TexturePtr destination, const Node *node, const ShaderJob *job){} virtual void ProcessColorTransform(TexturePtr destination, const Node *node, const ColorTransformJob *job){} virtual void ProcessSamples(SampleBuffer &destination, const Node *node, const TimeRange &range, const SampleJob &job){} virtual void ProcessFrameGeneration(TexturePtr destination, const Node *node, const GenerateJob *job){} virtual void ConvertToReferenceSpace(TexturePtr destination, TexturePtr source, const QString &input_cs){} virtual TexturePtr ProcessVideoCacheJob(const CacheJob *val); virtual TexturePtr CreateTexture(const VideoParams &p) { return CreateDummyTexture(p); } virtual SampleBuffer CreateSampleBuffer(const AudioParams &params, int sample_count) { // Return dummy by default return SampleBuffer(); } SampleBuffer CreateSampleBuffer(const AudioParams &params, const rational &length) { if (params.is_valid()) { return CreateSampleBuffer(params, params.time_to_samples(length)); } else { return SampleBuffer(); } } QVector2D GenerateResolution() const; bool IsCancelled() { return cancel_ && cancel_->IsCancelled(); } bool HeardCancel() const { return cancel_ && cancel_->HeardCancel(); } CancelAtom *GetCancelPointer() const { return cancel_; } void SetCancelPointer(CancelAtom *cancel) { cancel_ = cancel; } void ResolveJobs(NodeValue &value); void ResolveAudioJobs(NodeValue &value); Block *GetCurrentBlock() const { return block_stack_.empty() ? nullptr : block_stack_.back(); } LoopMode loop_mode() const { return loop_mode_; } virtual bool UseCache() const { return false; } private: TexturePtr CreateDummyTexture(const VideoParams &p); VideoParams video_params_; AudioParams audio_params_; CancelAtom *cancel_; const Node *transform_start_; const Node *transform_now_; QTransform *transform_; std::list<Block*> block_stack_; LoopMode loop_mode_; QHash<const Node*, QHash<TimeRange, NodeValueTable> > value_cache_; QHash<Texture*, TexturePtr> resolved_texture_cache_; }; } #endif // NODETRAVERSER_H
5,129
C++
.h
118
40.135593
136
0.772984
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,365
inputdragger.h
olive-editor_olive/app/node/inputdragger.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 NODEINPUTDRAGGER_H #define NODEINPUTDRAGGER_H #include "node/keyframe.h" #include "node/param.h" #include "undo/undocommand.h" namespace olive { class NodeInputDragger { public: NodeInputDragger(); bool IsStarted() const; void Start(const NodeKeyframeTrackReference& input, const rational& time, bool create_key_on_all_tracks = true); void Drag(QVariant value); void End(MultiUndoCommand *command); static bool IsInputBeingDragged() { return input_being_dragged; } const QVariant &GetStartValue() const { return start_value_; } const NodeKeyframeTrackReference &GetInput() const { return input_; } const rational &GetTime() const { return time_; } private: NodeKeyframeTrackReference input_; rational time_; QVariant start_value_; QVariant end_value_; NodeKeyframe* dragging_key_; QVector<NodeKeyframe*> created_keys_; static int input_being_dragged; }; } #endif // NODEINPUTDRAGGER_H
1,689
C++
.h
55
27.636364
114
0.764925
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,366
nodeundo.h
olive-editor_olive/app/node/nodeundo.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2023 Olive Studios LLC 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 NODEUNDO_H #define NODEUNDO_H #include "node/node.h" #include "node/project.h" #include "undo/undocommand.h" namespace olive { class NodeSetPositionCommand : public UndoCommand { public: NodeSetPositionCommand(Node* node, Node* context, const Node::Position& pos) { node_ = node; context_ = context; pos_ = pos; } virtual Project* GetRelevantProject() const override { return node_->project(); } protected: virtual void redo() override; virtual void undo() override; private: Node* node_; Node* context_; Node::Position pos_; Node::Position old_pos_; bool added_; }; class NodeSetPositionAndDependenciesRecursivelyCommand : public UndoCommand{ public: NodeSetPositionAndDependenciesRecursivelyCommand(Node* node, Node* context, const Node::Position& pos) : node_(node), context_(context), pos_(pos) {} virtual Project* GetRelevantProject() const override { return node_->project(); } protected: virtual void prepare() override; virtual void redo() override; virtual void undo() override; private: void move_recursively(Node *node, const QPointF &diff); Node* node_; Node* context_; Node::Position pos_; QVector<UndoCommand*> commands_; }; class NodeRemovePositionFromContextCommand : public UndoCommand { public: NodeRemovePositionFromContextCommand(Node *node, Node *context) : node_(node), context_(context) { } virtual Project * GetRelevantProject() const override { return node_->project(); } protected: virtual void redo() override; virtual void undo() override; private: Node *node_; Node *context_; Node::Position old_pos_; bool contained_; }; class NodeRemovePositionFromAllContextsCommand : public UndoCommand { public: NodeRemovePositionFromAllContextsCommand(Node *node) : node_(node) { } virtual Project * GetRelevantProject() const override { return node_->project(); } protected: virtual void redo() override; virtual void undo() override; private: Node *node_; std::map<Node *, QPointF> contexts_; }; class NodeArrayInsertCommand : public UndoCommand { public: NodeArrayInsertCommand(Node* node, const QString& input, int index) : node_(node), input_(input), index_(index) { } virtual Project* GetRelevantProject() const override; protected: virtual void redo() override { node_->InputArrayInsert(input_, index_); } virtual void undo() override { node_->InputArrayRemove(input_, index_); } private: Node* node_; QString input_; int index_; }; class NodeArrayResizeCommand : public UndoCommand { public: NodeArrayResizeCommand(Node* node, const QString& input, int size) : node_(node), input_(input), size_(size) {} virtual Project* GetRelevantProject() const override; protected: virtual void redo() override { old_size_ = node_->InputArraySize(input_); if (old_size_ > size_) { // Decreasing in size, disconnect any extraneous edges for (int i=size_; i<old_size_; i++) { try { NodeInput input(node_, input_, i); Node *output = node_->input_connections().at(input); removed_connections_[input] = output; Node::DisconnectEdge(output, input); } catch (std::out_of_range&) {} } } node_->ArrayResizeInternal(input_, size_); } virtual void undo() override { for (auto it=removed_connections_.cbegin(); it!=removed_connections_.cend(); it++) { Node::ConnectEdge(it->second, it->first); } removed_connections_.clear(); node_->ArrayResizeInternal(input_, old_size_); } private: Node* node_; QString input_; int size_; int old_size_; Node::InputConnections removed_connections_; }; class NodeArrayRemoveCommand : public UndoCommand { public: NodeArrayRemoveCommand(Node* node, const QString& input, int index) : node_(node), input_(input), index_(index) { } virtual Project* GetRelevantProject() const override; protected: virtual void redo() override { // Save immediate data if (node_->IsInputKeyframable(input_)) { is_keyframing_ = node_->IsInputKeyframing(input_, index_); } standard_value_ = node_->GetSplitStandardValue(input_, index_); keyframes_ = node_->GetKeyframeTracks(input_, index_); node_->GetImmediate(input_, index_)->delete_all_keyframes(&memory_manager_); node_->InputArrayRemove(input_, index_); } virtual void undo() override { node_->InputArrayInsert(input_, index_); // Restore keyframes foreach (const NodeKeyframeTrack& track, keyframes_) { foreach (NodeKeyframe* key, track) { key->setParent(node_); } } node_->SetSplitStandardValue(input_, standard_value_, index_); if (node_->IsInputKeyframable(input_)) { node_->SetInputIsKeyframing(input_, is_keyframing_, index_); } } private: Node* node_; QString input_; int index_; SplitValue standard_value_; bool is_keyframing_; QVector<NodeKeyframeTrack> keyframes_; QObject memory_manager_; }; /** * @brief An undoable command for disconnecting two NodeParams * * Can be considered a UndoCommand wrapper for NodeParam::DisonnectEdge()/ */ class NodeEdgeRemoveCommand : public UndoCommand { public: NodeEdgeRemoveCommand(Node *output, const NodeInput& input); virtual Project* GetRelevantProject() const override; protected: virtual void redo() override; virtual void undo() override; private: Node *output_; NodeInput input_; }; /** * @brief An undoable command for connecting two NodeParams together * * Can be considered a UndoCommand wrapper for NodeParam::ConnectEdge()/ */ class NodeEdgeAddCommand : public UndoCommand { public: NodeEdgeAddCommand(Node *output, const NodeInput& input); virtual ~NodeEdgeAddCommand() override; virtual Project* GetRelevantProject() const override; protected: virtual void redo() override; virtual void undo() override; private: Node *output_; NodeInput input_; NodeEdgeRemoveCommand* remove_command_; }; class NodeAddCommand : public UndoCommand { public: NodeAddCommand(Project* graph, Node* node); void PushToThread(QThread* thread); virtual Project* GetRelevantProject() const override; protected: virtual void redo() override; virtual void undo() override; private: QObject memory_manager_; Project* graph_; Node* node_; }; class NodeRemoveAndDisconnectCommand : public UndoCommand { public: NodeRemoveAndDisconnectCommand(Node* node) : node_(node), graph_(nullptr), command_(nullptr) { } virtual ~NodeRemoveAndDisconnectCommand() override { delete command_; } virtual Project* GetRelevantProject() const override { return graph_; } protected: virtual void prepare() override; virtual void redo() override { command_->redo_now(); graph_ = node_->parent(); node_->setParent(&memory_manager_); } virtual void undo() override { node_->setParent(graph_); graph_ = nullptr; command_->undo_now(); } private: QObject memory_manager_; Node* node_; Project* graph_; MultiUndoCommand* command_; }; class NodeRemoveWithExclusiveDependenciesAndDisconnect : public UndoCommand { public: NodeRemoveWithExclusiveDependenciesAndDisconnect(Node* node) : node_(node), command_(nullptr) { } virtual ~NodeRemoveWithExclusiveDependenciesAndDisconnect() override { delete command_; } virtual Project* GetRelevantProject() const override { if (command_) { return static_cast<const NodeRemoveAndDisconnectCommand*>(command_->child(0))->GetRelevantProject(); } else { return node_->project(); } } protected: virtual void prepare() override { command_ = new MultiUndoCommand(); command_->add_child(new NodeRemoveAndDisconnectCommand(node_)); // Remove exclusive dependencies QVector<Node*> deps = node_->GetExclusiveDependencies(); foreach (Node* d, deps) { command_->add_child(new NodeRemoveAndDisconnectCommand(d)); } } virtual void redo() override { command_->redo_now(); } virtual void undo() override { command_->undo_now(); } private: Node* node_; MultiUndoCommand* command_; }; class NodeLinkCommand : public UndoCommand { public: NodeLinkCommand(Node* a, Node* b, bool link) : a_(a), b_(b), link_(link) { } virtual Project* GetRelevantProject() const override { return a_->project(); } protected: virtual void redo() override { if (link_) { done_ = Node::Link(a_, b_); } else { done_ = Node::Unlink(a_, b_); } } virtual void undo() override { if (done_) { if (link_) { Node::Unlink(a_, b_); } else { Node::Link(a_, b_); } } } private: Node* a_; Node* b_; bool link_; bool done_; }; class NodeUnlinkAllCommand : public UndoCommand { public: NodeUnlinkAllCommand(Node* node) : node_(node) { } virtual Project* GetRelevantProject() const override { return node_->project(); } protected: virtual void redo() override { unlinked_ = node_->links(); foreach (Node* link, unlinked_) { Node::Unlink(node_, link); } } virtual void undo() override { foreach (Node* link, unlinked_) { Node::Link(node_, link); } unlinked_.clear(); } private: Node* node_; QVector<Node*> unlinked_; }; class NodeLinkManyCommand : public MultiUndoCommand { public: NodeLinkManyCommand(const QVector<Node*> nodes, bool link) : nodes_(nodes) { foreach (Node* a, nodes_) { foreach (Node* b, nodes_) { if (a != b) { add_child(new NodeLinkCommand(a, b, link)); } } } } virtual Project* GetRelevantProject() const override { return nodes_.first()->project(); } private: QVector<Node*> nodes_; }; class NodeRenameCommand : public UndoCommand { public: NodeRenameCommand() = default; NodeRenameCommand(Node* node, const QString& new_name) { AddNode(node, new_name); } void AddNode(Node* node, const QString& new_name); virtual Project * GetRelevantProject() const override; protected: virtual void redo() override; virtual void undo() override; private: QVector<Node*> nodes_; QStringList new_labels_; QStringList old_labels_; }; class NodeOverrideColorCommand : public UndoCommand { public: NodeOverrideColorCommand(Node *node, int index); virtual Project * GetRelevantProject() const override; protected: virtual void redo() override; virtual void undo() override; private: Node *node_; int old_index_; int new_index_; }; class NodeViewDeleteCommand : public UndoCommand { public: NodeViewDeleteCommand(); void AddNode(Node *node, Node *context); void AddEdge(Node *output, const NodeInput &input); bool ContainsNode(Node *node, Node *context); virtual Project * GetRelevantProject() const override; protected: virtual void redo() override; virtual void undo() override; private: QVector<Node::ContextPair> nodes_; QVector<Node::OutputConnection> edges_; struct RemovedNode { Node *node; Node *context; QPointF pos; Project *removed_from_graph; }; QVector<RemovedNode> removed_nodes_; QObject memory_manager_; }; class NodeParamSetKeyframingCommand : public UndoCommand { public: NodeParamSetKeyframingCommand(const NodeInput& input, bool setting); virtual Project* GetRelevantProject() const override; protected: virtual void redo() override; virtual void undo() override; private: NodeInput input_; bool new_setting_; bool old_setting_; }; class NodeParamInsertKeyframeCommand : public UndoCommand { public: NodeParamInsertKeyframeCommand(Node *node, NodeKeyframe* keyframe); virtual Project* GetRelevantProject() const override; protected: virtual void redo() override; virtual void undo() override; private: Node* input_; NodeKeyframe* keyframe_; QObject memory_manager_; }; class NodeParamRemoveKeyframeCommand : public UndoCommand { public: NodeParamRemoveKeyframeCommand(NodeKeyframe* keyframe); virtual Project* GetRelevantProject() const override; protected: virtual void redo() override; virtual void undo() override; private: Node* input_; NodeKeyframe* keyframe_; QObject memory_manager_; }; class NodeParamSetKeyframeTimeCommand : public UndoCommand { public: NodeParamSetKeyframeTimeCommand(NodeKeyframe* key, const rational& time); NodeParamSetKeyframeTimeCommand(NodeKeyframe* key, const rational& new_time, const rational& old_time); virtual Project* GetRelevantProject() const override; protected: virtual void redo() override; virtual void undo() override; private: NodeKeyframe* key_; rational old_time_; rational new_time_; }; class NodeParamSetKeyframeValueCommand : public UndoCommand { public: NodeParamSetKeyframeValueCommand(NodeKeyframe* key, const QVariant& value); NodeParamSetKeyframeValueCommand(NodeKeyframe* key, const QVariant& new_value, const QVariant& old_value); virtual Project* GetRelevantProject() const override; protected: virtual void redo() override; virtual void undo() override; private: NodeKeyframe* key_; QVariant old_value_; QVariant new_value_; }; class NodeParamSetStandardValueCommand : public UndoCommand { public: NodeParamSetStandardValueCommand(const NodeKeyframeTrackReference& input, const QVariant& value); NodeParamSetStandardValueCommand(const NodeKeyframeTrackReference& input, const QVariant& new_value, const QVariant& old_value); virtual Project* GetRelevantProject() const override; protected: virtual void redo() override; virtual void undo() override; private: NodeKeyframeTrackReference ref_; QVariant old_value_; QVariant new_value_; }; class NodeParamSetSplitStandardValueCommand : public UndoCommand { public: NodeParamSetSplitStandardValueCommand(const NodeInput& input, const SplitValue& new_value, const SplitValue& old_value) : ref_(input), old_value_(old_value), new_value_(new_value) {} NodeParamSetSplitStandardValueCommand(const NodeInput& input, const SplitValue& value) : NodeParamSetSplitStandardValueCommand(input, value, input.node()->GetSplitStandardValue(input.input())) {} virtual Project* GetRelevantProject() const override { return ref_.node()->project(); } protected: virtual void redo() override { ref_.node()->SetSplitStandardValue(ref_.input(), new_value_, ref_.element()); } virtual void undo() override { ref_.node()->SetSplitStandardValue(ref_.input(), old_value_, ref_.element()); } private: NodeInput ref_; SplitValue old_value_; SplitValue new_value_; }; class NodeParamArrayAppendCommand : public UndoCommand { public: NodeParamArrayAppendCommand(Node* node, const QString& input); virtual Project* GetRelevantProject() const override; protected: virtual void redo() override; virtual void undo() override; private: Node* node_; QString input_; }; class NodeSetValueHintCommand : public UndoCommand { public: NodeSetValueHintCommand(const NodeInput &input, const Node::ValueHint &hint) : input_(input), new_hint_(hint) { } NodeSetValueHintCommand(Node *node, const QString &input, int element, const Node::ValueHint &hint) : NodeSetValueHintCommand(NodeInput(node, input, element), hint) { } virtual Project* GetRelevantProject() const override { return input_.node()->project(); } protected: virtual void redo() override; virtual void undo() override; private: NodeInput input_; Node::ValueHint new_hint_; Node::ValueHint old_hint_; }; class NodeImmediateRemoveAllKeyframesCommand : public UndoCommand { public: NodeImmediateRemoveAllKeyframesCommand(NodeInputImmediate *immediate) : immediate_(immediate) {} virtual Project* GetRelevantProject() const override { return nullptr; } protected: virtual void prepare() override; virtual void redo() override; virtual void undo() override; private: NodeInputImmediate *immediate_; QObject memory_manager_; QVector<NodeKeyframe*> keys_; }; } #endif // NODEUNDO_H
17,018
C++
.h
643
23.065319
130
0.731191
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,367
valuenode.h
olive-editor_olive/app/node/input/value/valuenode.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 VALUENODE_H #define VALUENODE_H #include "node/node.h" namespace olive { class ValueNode : public Node { Q_OBJECT public: ValueNode(); NODE_DEFAULT_FUNCTIONS(ValueNode) virtual QString Name() const override { return tr("Value"); } virtual QString id() const override { return QStringLiteral("org.olivevideoeditor.Olive.value"); } virtual QVector<CategoryID> Category() const override { return {kCategoryGenerator}; } virtual QString Description() const override { return tr("Create a single value that can be connected to various other inputs."); } static const QString kTypeInput; static const QString kValueInput; virtual void Retranslate() override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; protected: virtual void InputValueChangedEvent(const QString &input, int element) override; private: static const QVector<NodeValue::Type> kSupportedTypes; }; } #endif // VALUENODE_H
1,743
C++
.h
51
31.137255
114
0.771856
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,368
timeinput.h
olive-editor_olive/app/node/input/time/timeinput.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 TIMEINPUT_H #define TIMEINPUT_H #include "node/node.h" namespace olive { class TimeInput : public Node { Q_OBJECT public: TimeInput(); NODE_DEFAULT_FUNCTIONS(TimeInput) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; }; } #endif // TIMEINPUT_H
1,231
C++
.h
32
35.75
114
0.778716
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,369
multicamnode.h
olive-editor_olive/app/node/input/multicam/multicamnode.h
#ifndef MULTICAMNODE_H #define MULTICAMNODE_H #include "node/node.h" #include "node/output/track/tracklist.h" namespace olive { class Sequence; class MultiCamNode : public Node { Q_OBJECT public: MultiCamNode(); NODE_DEFAULT_FUNCTIONS(MultiCamNode) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual ActiveElements GetActiveElementsAtTime(const QString &input, const TimeRange &r) const override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; virtual void Retranslate() override; static const QString kCurrentInput; static const QString kSourcesInput; static const QString kSequenceInput; static const QString kSequenceTypeInput; int GetCurrentSource() const { return GetStandardValue(kCurrentInput).toInt(); } int GetSourceCount() const; static void GetRowsAndColumns(int sources, int *rows, int *cols); void GetRowsAndColumns(int *rows, int *cols) const { return GetRowsAndColumns(GetSourceCount(), rows, cols); } void SetSequenceType(Track::Type t) { SetStandardValue(kSequenceTypeInput, t); } static void IndexToRowCols(int index, int total_rows, int total_cols, int *row, int *col); static int RowsColsToIndex(int row, int col, int total_rows, int total_cols) { return col + row * total_cols; } virtual Node *GetConnectedRenderOutput(const QString& input, int element = -1) const override; virtual bool IsInputConnectedForRender(const QString& input, int element = -1) const override; virtual QVector<QString> IgnoreInputsForRendering() const override; protected: virtual void InputConnectedEvent(const QString &input, int element, Node *output) override; virtual void InputDisconnectedEvent(const QString &input, int element, Node *output) override; private: TrackList *GetTrackList() const; Sequence *sequence_; }; } #endif // MULTICAMNODE_H
2,062
C++
.h
54
35.111111
114
0.784778
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,370
noise.h
olive-editor_olive/app/node/generator/noise/noise.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 NOISEGENERATORNODE_H #define NOISEGENERATORNODE_H #include "node/node.h" namespace olive { class NoiseGeneratorNode : public Node { Q_OBJECT public: NoiseGeneratorNode(); NODE_DEFAULT_FUNCTIONS(NoiseGeneratorNode) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual void Retranslate() override; virtual ShaderCode GetShaderCode(const ShaderRequest &request) const override; virtual void Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const override; static const QString kBaseIn; static const QString kColorInput; static const QString kStrengthInput; }; } // namespace olive #endif // NOISEGENERATORNODE_H
1,536
C++
.h
36
39.777778
114
0.791639
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,371
textv3.h
olive-editor_olive/app/node/generator/text/textv3.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 TEXTGENERATORV3_H #define TEXTGENERATORV3_H #include "node/generator/shape/shapenodebase.h" #include "node/gizmo/text.h" namespace olive { class TextGeneratorV3 : public ShapeNodeBase { Q_OBJECT public: TextGeneratorV3(); NODE_DEFAULT_FUNCTIONS(TextGeneratorV3) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual void Retranslate() override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; virtual void GenerateFrame(FramePtr frame, const GenerateJob &job) const override; virtual void UpdateGizmoPositions(const NodeValueRow &row, const NodeGlobals &globals) override; enum VerticalAlignment { kVAlignTop, kVAlignMiddle, kVAlignBottom }; VerticalAlignment GetVerticalAlignment() const { return static_cast<VerticalAlignment>(GetStandardValue(kVerticalAlignmentInput).toInt()); } static Qt::Alignment GetQtAlignmentFromOurs(VerticalAlignment v); static VerticalAlignment GetOurAlignmentFromQts(Qt::Alignment v); static const QString kTextInput; static const QString kVerticalAlignmentInput; static const QString kUseArgsInput; static const QString kArgsInput; static QString FormatString(const QString &input, const QStringList &args); protected: virtual void InputValueChangedEvent(const QString &input, int element) override; private: TextGizmo *text_gizmo_; bool dont_emit_valign_; private slots: void GizmoActivated(); void GizmoDeactivated(); void SetVerticalAlignmentUndoable(Qt::Alignment a); }; } #endif // TEXTGENERATORV3_H
2,449
C++
.h
62
36.451613
114
0.799153
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,372
textv2.h
olive-editor_olive/app/node/generator/text/textv2.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 TEXTGENERATORV2_H #define TEXTGENERATORV2_H #include "node/generator/shape/shapenodebase.h" namespace olive { class TextGeneratorV2 : public ShapeNodeBase { Q_OBJECT public: TextGeneratorV2(); NODE_DEFAULT_FUNCTIONS(TextGeneratorV2) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual void Retranslate() override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; virtual void GenerateFrame(FramePtr frame, const GenerateJob &job) const override; static const QString kTextInput; static const QString kHtmlInput; static const QString kVAlignInput; static const QString kFontInput; static const QString kFontSizeInput; }; } #endif // TEXTGENERATORV2_H
1,609
C++
.h
39
38.410256
114
0.795747
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,373
textv1.h
olive-editor_olive/app/node/generator/text/textv1.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 TEXTGENERATORV1_H #define TEXTGENERATORV1_H #include "node/node.h" namespace olive { class TextGeneratorV1 : public Node { Q_OBJECT public: TextGeneratorV1(); NODE_DEFAULT_FUNCTIONS(TextGeneratorV1) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual void Retranslate() override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; virtual void GenerateFrame(FramePtr frame, const GenerateJob &job) const override; static const QString kTextInput; static const QString kHtmlInput; static const QString kColorInput; static const QString kVAlignInput; static const QString kFontInput; static const QString kFontSizeInput; }; } #endif // TEXTGENERATORV1_H
1,611
C++
.h
40
37.425
114
0.793303
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,374
polygon.h
olive-editor_olive/app/node/generator/polygon/polygon.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 POLYGONGENERATOR_H #define POLYGONGENERATOR_H #include <QPainterPath> #include "node/generator/shape/generatorwithmerge.h" #include "node/gizmo/line.h" #include "node/gizmo/path.h" #include "node/gizmo/point.h" #include "node/node.h" #include "node/inputdragger.h" namespace olive { class PolygonGenerator : public GeneratorWithMerge { Q_OBJECT public: PolygonGenerator(); NODE_DEFAULT_FUNCTIONS(PolygonGenerator) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual void Retranslate() override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; virtual void GenerateFrame(FramePtr frame, const GenerateJob &job) const override; virtual void UpdateGizmoPositions(const NodeValueRow &row, const NodeGlobals &globals) override; virtual ShaderCode GetShaderCode(const ShaderRequest &request) const override; static const QString kPointsInput; static const QString kColorInput; protected: ShaderJob GetGenerateJob(const NodeValueRow &value, const VideoParams &params) const; protected slots: virtual void GizmoDragMove(double x, double y, const Qt::KeyboardModifiers &modifiers) override; private: static void AddPointToPath(QPainterPath *path, const Bezier &before, const Bezier &after); static QPainterPath GeneratePath(const NodeValueArray &points, int size); template<typename T> void ValidateGizmoVectorSize(QVector<T*> &vec, int new_sz); template<typename T> NodeGizmo *CreateAppropriateGizmo(); PathGizmo *poly_gizmo_; QVector<PointGizmo*> gizmo_position_handles_; QVector<PointGizmo*> gizmo_bezier_handles_; QVector<LineGizmo*> gizmo_bezier_lines_; }; } #endif // POLYGONGENERATOR_H
2,576
C++
.h
59
40.898305
114
0.797911
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,375
solid.h
olive-editor_olive/app/node/generator/solid/solid.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 SOLIDGENERATOR_H #define SOLIDGENERATOR_H #include "node/node.h" namespace olive { class SolidGenerator : public Node { Q_OBJECT public: SolidGenerator(); NODE_DEFAULT_FUNCTIONS(SolidGenerator) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual void Retranslate() override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; virtual ShaderCode GetShaderCode(const ShaderRequest &request) const override; static const QString kColorInput; }; } #endif // SOLIDGENERATOR_H
1,419
C++
.h
35
37.742857
114
0.78932
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,376
matrix.h
olive-editor_olive/app/node/generator/matrix/matrix.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 MATRIXGENERATOR_H #define MATRIXGENERATOR_H #include <QVector2D> #include "node/node.h" #include "node/inputdragger.h" namespace olive { class MatrixGenerator : public Node { Q_OBJECT public: MatrixGenerator(); NODE_DEFAULT_FUNCTIONS(MatrixGenerator) virtual QString Name() const override; virtual QString ShortName() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual void Retranslate() override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; static const QString kPositionInput; static const QString kRotationInput; static const QString kScaleInput; static const QString kUniformScaleInput; static const QString kAnchorInput; protected: QMatrix4x4 GenerateMatrix(const NodeValueRow &value, bool ignore_anchor, bool ignore_position, bool ignore_scale, const QMatrix4x4 &mat) const; static QMatrix4x4 GenerateMatrix(const QVector2D &pos, const float &rot, const QVector2D &scale, bool uniform_scale, const QVector2D &anchor, QMatrix4x4 mat); virtual void InputValueChangedEvent(const QString& input, int element) override; }; } #endif // TRANSFORMDISTORT_H
2,180
C++
.h
50
37.5
145
0.733175
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,377
shapenode.h
olive-editor_olive/app/node/generator/shape/shapenode.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 SHAPENODE_H #define SHAPENODE_H #include "shapenodebase.h" namespace olive { class ShapeNode : public ShapeNodeBase { Q_OBJECT public: ShapeNode(); enum Type { kRectangle, kEllipse, kRoundedRectangle }; NODE_DEFAULT_FUNCTIONS(ShapeNode) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual void Retranslate() override; virtual ShaderCode GetShaderCode(const ShaderRequest &request) const override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; static QString kTypeInput; static QString kRadiusInput; protected: virtual void InputValueChangedEvent(const QString &input, int element) override; }; } #endif // SHAPENODE_H
1,593
C++
.h
43
34.069767
114
0.785108
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,378
generatorwithmerge.h
olive-editor_olive/app/node/generator/shape/generatorwithmerge.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 GENERATORWITHMERGE_H #define GENERATORWITHMERGE_H #include "node/node.h" namespace olive { class GeneratorWithMerge : public Node { Q_OBJECT public: GeneratorWithMerge(); virtual void Retranslate() override; virtual ShaderCode GetShaderCode(const ShaderRequest &request) const override; static const QString kBaseInput; protected: void PushMergableJob(const NodeValueRow &value, TexturePtr job, NodeValueTable *table) const; }; } #endif // GENERATORWITHMERGE_H
1,203
C++
.h
31
36.129032
95
0.791522
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,379
shapenodebase.h
olive-editor_olive/app/node/generator/shape/shapenodebase.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 SHAPENODEBASE_H #define SHAPENODEBASE_H #include "generatorwithmerge.h" #include "node/gizmo/point.h" #include "node/gizmo/polygon.h" #include "node/inputdragger.h" #include "node/node.h" namespace olive { class ShapeNodeBase : public GeneratorWithMerge { Q_OBJECT public: ShapeNodeBase(bool create_color_input = true); virtual void Retranslate() override; virtual void UpdateGizmoPositions(const NodeValueRow &row, const NodeGlobals &globals) override; void SetRect(QRectF rect, const VideoParams &sequence_res, MultiUndoCommand *command); static const QString kPositionInput; static const QString kSizeInput; static const QString kColorInput; protected: PolygonGizmo *poly_gizmo() const { return poly_gizmo_; } protected slots: virtual void GizmoDragMove(double x, double y, const Qt::KeyboardModifiers &modifiers) override; private: QVector2D GenerateGizmoAnchor(const QVector2D &pos, const QVector2D &size, NodeGizmo *gizmo, QVector2D *pt = nullptr) const; bool IsGizmoTop(NodeGizmo *g) const; bool IsGizmoBottom(NodeGizmo *g) const; bool IsGizmoLeft(NodeGizmo *g) const; bool IsGizmoRight(NodeGizmo *g) const; bool IsGizmoHorizontalCenter(NodeGizmo *g) const; bool IsGizmoVerticalCenter(NodeGizmo *g) const; bool IsGizmoCorner(NodeGizmo *g) const; // Gizmo variables static const int kGizmoWholeRect = kGizmoScaleCount; PointGizmo *point_gizmo_[kGizmoScaleCount]; PolygonGizmo *poly_gizmo_; }; } #endif // SHAPENODEBASE_H
2,214
C++
.h
56
36.803571
126
0.788489
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,380
group.h
olive-editor_olive/app/node/group/group.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 NODEGROUP_H #define NODEGROUP_H #include "node/node.h" namespace olive { class NodeGroup : public Node { Q_OBJECT public: NodeGroup(); NODE_DEFAULT_FUNCTIONS(NodeGroup) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual void Retranslate() override; virtual bool LoadCustom(QXmlStreamReader *reader, SerializedData *data) override; virtual void SaveCustom(QXmlStreamWriter *writer) const override; virtual void PostLoadEvent(SerializedData *data) override; QString AddInputPassthrough(const NodeInput &input, const QString &force_id = QString()); void RemoveInputPassthrough(const NodeInput &input); Node *GetOutputPassthrough() const { return output_passthrough_; } void SetOutputPassthrough(Node *node); using InputPassthrough = QPair<QString, NodeInput>; using InputPassthroughs = QVector<InputPassthrough>; const InputPassthroughs &GetInputPassthroughs() const { return input_passthroughs_; } bool ContainsInputPassthrough(const NodeInput &input) const; virtual QString GetInputName(const QString& id) const override; static NodeInput ResolveInput(NodeInput input); static bool GetInner(NodeInput *input); QString GetIDOfPassthrough(const NodeInput &input) const { for (auto it=input_passthroughs_.cbegin(); it!=input_passthroughs_.cend(); it++) { if (it->second == input) { return it->first; } } return QString(); } NodeInput GetInputFromID(const QString &id) const { for (auto it=input_passthroughs_.cbegin(); it!=input_passthroughs_.cend(); it++) { if (it->first == id) { return it->second; } } return NodeInput(); } signals: void InputPassthroughAdded(olive::NodeGroup *group, const olive::NodeInput &input); void InputPassthroughRemoved(olive::NodeGroup *group, const olive::NodeInput &input); void OutputPassthroughChanged(olive::NodeGroup *group, olive::Node *output); private: InputPassthroughs input_passthroughs_; Node *output_passthrough_; }; class NodeGroupAddInputPassthrough : public UndoCommand { public: NodeGroupAddInputPassthrough(NodeGroup *group, const NodeInput &input, const QString &force_id = QString()) : group_(group), input_(input), actually_added_(false) {} virtual Project * GetRelevantProject() const override { return group_->project(); } protected: virtual void redo() override; virtual void undo() override; private: NodeGroup *group_; NodeInput input_; QString force_id_; bool actually_added_; }; class NodeGroupSetOutputPassthrough : public UndoCommand { public: NodeGroupSetOutputPassthrough(NodeGroup *group, Node *output) : group_(group), new_output_(output) {} virtual Project * GetRelevantProject() const override { return group_->project(); } protected: virtual void redo() override; virtual void undo() override; private: NodeGroup *group_; Node *new_output_; Node *old_output_; }; } #endif // NODEGROUP_H
3,862
C++
.h
117
29.555556
111
0.754191
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,381
ociobase.h
olive-editor_olive/app/node/color/ociobase/ociobase.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 OCIOBASENODE_H #define OCIOBASENODE_H #include "node/node.h" #include "render/job/colortransformjob.h" namespace olive { class OCIOBaseNode : public Node { Q_OBJECT public: OCIOBaseNode(); virtual void AddedToGraphEvent(Project *p) override; virtual void RemovedFromGraphEvent(Project *p) override; virtual void Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const override; static const QString kTextureInput; protected slots: virtual void ConfigChanged() = 0; protected: ColorManager *manager() const { return manager_; } ColorProcessorPtr processor() const { return processor_; } void set_processor(ColorProcessorPtr p) { processor_ = p; } private: ColorManager *manager_; ColorProcessorPtr processor_; }; } #endif // OCIOBASENODE_H
1,532
C++
.h
40
35.6
114
0.780571
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,382
displaytransform.h
olive-editor_olive/app/node/color/displaytransform/displaytransform.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 DISPLAYTRANSFORMNODE_H #define DISPLAYTRANSFORMNODE_H #include "node/color/ociobase/ociobase.h" #include "render/colorprocessor.h" namespace olive { class DisplayTransformNode : public OCIOBaseNode { Q_OBJECT public: DisplayTransformNode(); NODE_DEFAULT_FUNCTIONS(DisplayTransformNode) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual void Retranslate() override; virtual void InputValueChangedEvent(const QString &input, int element) override; QString GetDisplay() const; QString GetView() const; ColorProcessor::Direction GetDirection() const; static const QString kDisplayInput; static const QString kViewInput; static const QString kDirectionInput; protected slots: virtual void ConfigChanged() override; private: void GenerateProcessor(); void UpdateDisplays(); void UpdateViews(); }; } // olive #endif // DISPLAYTRANSFORMNODE_H
1,744
C++
.h
46
35.086957
82
0.793679
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,383
ociogradingtransformlinear.h
olive-editor_olive/app/node/color/ociogradingtransformlinear/ociogradingtransformlinear.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 OCIOGRADINGTRANSFORMLINEARNODE_H #define OCIOGRADINGTRANSFORMLINEARNODE_H #include "node/color/ociobase/ociobase.h" #include "render/colorprocessor.h" namespace olive { class OCIOGradingTransformLinearNode : public OCIOBaseNode { Q_OBJECT public: OCIOGradingTransformLinearNode(); NODE_DEFAULT_FUNCTIONS(OCIOGradingTransformLinearNode) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual void Retranslate() override; virtual void InputValueChangedEvent(const QString &input, int element) override; void GenerateProcessor(); virtual void Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const override; static const QString kContrastInput; static const QString kOffsetInput; static const QString kExposureInput; static const QString kSaturationInput; static const QString kPivotInput; static const QString kClampBlackEnableInput; static const QString kClampBlackInput; static const QString kClampWhiteEnableInput; static const QString kClampWhiteInput; protected slots: virtual void ConfigChanged() override; private: void SetVec4InputColors(const QString &input); }; } // olive #endif
2,031
C++
.h
49
38.653061
114
0.810494
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,384
colormanager.h
olive-editor_olive/app/node/color/colormanager/colormanager.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 COLORSERVICE_H #define COLORSERVICE_H #include <memory> #include <QMutex> #include "codec/frame.h" #include "node/node.h" #include "render/colorprocessor.h" namespace olive { class ColorManager : public QObject { Q_OBJECT public: ColorManager(Project *project); void Init(); OCIO::ConstConfigRcPtr GetConfig() const; static OCIO::ConstConfigRcPtr CreateConfigFromFile(const QString& filename); QString GetConfigFilename() const; static OCIO::ConstConfigRcPtr GetDefaultConfig(); static void SetUpDefaultConfig(); void SetConfigFilename(const QString& filename); QStringList ListAvailableDisplays(); QString GetDefaultDisplay(); QStringList ListAvailableViews(QString display); QString GetDefaultView(const QString& display); QStringList ListAvailableLooks(); QStringList ListAvailableColorspaces() const; QString GetDefaultInputColorSpace() const; void SetDefaultInputColorSpace(const QString& s); QString GetReferenceColorSpace() const; QString GetCompliantColorSpace(const QString& s); ColorTransform GetCompliantColorSpace(const ColorTransform& transform, bool force_display = false); static QStringList ListAvailableColorspaces(OCIO::ConstConfigRcPtr config); void GetDefaultLumaCoefs(double *rgb) const; Project *project() const; void UpdateConfigFromFilename(); signals: void ConfigChanged(const QString &s); void ReferenceSpaceChanged(const QString &s); void DefaultInputChanged(const QString &s); private: OCIO::ConstConfigRcPtr config_; static OCIO::ConstConfigRcPtr default_config_; }; } #endif // COLORSERVICE_H
2,335
C++
.h
59
36.508475
101
0.800984
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,385
opacityeffect.h
olive-editor_olive/app/node/effect/opacity/opacityeffect.h
#ifndef OPACITYEFFECT_H #define OPACITYEFFECT_H #include "node/group/group.h" namespace olive { class OpacityEffect : public Node { public: OpacityEffect(); NODE_DEFAULT_FUNCTIONS(OpacityEffect) virtual QString Name() const override { return tr("Opacity"); } virtual QString id() const override { return QStringLiteral("org.olivevideoeditor.Olive.opacity"); } virtual QVector<CategoryID> Category() const override { return {kCategoryFilter}; } virtual QString Description() const override { return tr("Alter a video's opacity.\n\nThis is equivalent to multiplying a video by a number between 0.0 and 1.0."); } virtual void Retranslate() override; virtual ShaderCode GetShaderCode(const ShaderRequest &request) const override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; static const QString kTextureInput; static const QString kValueInput; }; } #endif // OPACITYEFFECT_H
1,008
C++
.h
33
27.484848
120
0.773153
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,386
timeformat.h
olive-editor_olive/app/node/time/timeformat/timeformat.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 TIMEFORMAT_H #define TIMEFORMAT_H #include "node/node.h" namespace olive { class TimeFormatNode : public Node { Q_OBJECT public: TimeFormatNode(); NODE_DEFAULT_FUNCTIONS(TimeFormatNode) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual void Retranslate() override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; static const QString kTimeInput; static const QString kFormatInput; static const QString kLocalTimeInput; }; } #endif // TIMEFORMAT_H
1,402
C++
.h
36
36.138889
114
0.786509
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,387
timeremap.h
olive-editor_olive/app/node/time/timeremap/timeremap.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 TIMEREMAPNODE_H #define TIMEREMAPNODE_H #include "node/node.h" namespace olive { class TimeRemapNode : public Node { Q_OBJECT public: TimeRemapNode(); NODE_DEFAULT_FUNCTIONS(TimeRemapNode) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual TimeRange InputTimeAdjustment(const QString& input, int element, const TimeRange& input_time, bool clamp) const override; virtual TimeRange OutputTimeAdjustment(const QString& input, int element, const TimeRange& input_time) const override; virtual void Retranslate() override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; static const QString kTimeInput; static const QString kInputInput; private: rational GetRemappedTime(const rational& input) const; }; } #endif // TIMEREMAPNODE_H
1,688
C++
.h
39
40.461538
131
0.792638
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,388
timeoffsetnode.h
olive-editor_olive/app/node/time/timeoffset/timeoffsetnode.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 TIMEOFFSETNODE_H #define TIMEOFFSETNODE_H #include "node/node.h" namespace olive { class TimeOffsetNode : public Node { public: TimeOffsetNode(); NODE_DEFAULT_FUNCTIONS(TimeOffsetNode) virtual QString Name() const override { return tr("Time Offset"); } virtual QString id() const override { return QStringLiteral("org.olivevideoeditor.Olive.timeoffset"); } virtual QVector<CategoryID> Category() const override { return {kCategoryTime}; } virtual QString Description() const override { return tr("Offset time passing through the graph."); } virtual TimeRange InputTimeAdjustment(const QString& input, int element, const TimeRange& input_time, bool clamp) const override; virtual TimeRange OutputTimeAdjustment(const QString& input, int element, const TimeRange& input_time) const override; virtual void Retranslate() override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; static const QString kTimeInput; static const QString kInputInput; private: rational GetRemappedTime(const rational& input) const; }; } #endif // TIMEOFFSETNODE_H
1,897
C++
.h
50
34.86
131
0.779178
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,389
volume.h
olive-editor_olive/app/node/audio/volume/volume.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 VOLUMENODE_H #define VOLUMENODE_H #include "node/math/math/mathbase.h" namespace olive { class VolumeNode : public MathNodeBase { Q_OBJECT public: VolumeNode(); NODE_DEFAULT_FUNCTIONS(VolumeNode) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; virtual void ProcessSamples(const NodeValueRow &values, const SampleBuffer &input, SampleBuffer &output, int index) const override; virtual void Retranslate() override; static const QString kSamplesInput; static const QString kVolumeInput; }; } #endif // VOLUMENODE_H
1,510
C++
.h
36
39.111111
133
0.788462
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,390
pan.h
olive-editor_olive/app/node/audio/pan/pan.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 PANNODE_H #define PANNODE_H #include "node/node.h" namespace olive { class PanNode : public Node { Q_OBJECT public: PanNode(); NODE_DEFAULT_FUNCTIONS(PanNode) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; virtual void ProcessSamples(const NodeValueRow &values, const SampleBuffer &input, SampleBuffer &output, int index) const override; virtual void Retranslate() override; static const QString kSamplesInput; static const QString kPanningInput; private: NodeInput* samples_input_; NodeInput* panning_input_; }; } #endif // PANNODE_H
1,539
C++
.h
39
36.641026
133
0.783255
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,391
viewer.h
olive-editor_olive/app/node/output/viewer/viewer.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 VIEWER_H #define VIEWER_H #include "codec/encoder.h" #include "node/node.h" #include "node/output/track/track.h" #include "render/audioplaybackcache.h" #include "render/framehashcache.h" #include "render/subtitleparams.h" #include "render/videoparams.h" #include "timeline/timelinemarker.h" #include "timeline/timelineworkarea.h" namespace olive { class Footage; /** * @brief A bridge between a node system and a ViewerPanel * * Receives update/time change signals from ViewerPanels and responds by sending them a texture of that frame */ class ViewerOutput : public Node { Q_OBJECT public: ViewerOutput(bool create_buffer_inputs = true, bool create_default_streams = true); NODE_DEFAULT_FUNCTIONS(ViewerOutput) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual QVariant data(const DataType &d) const override; void set_default_parameters(); void set_parameters_from_footage(const QVector<ViewerOutput *> footage); virtual void InvalidateCache(const TimeRange& range, const QString& from, int element, InvalidateCacheOptions options) override; VideoParams GetVideoParams(int index = 0) const { // This check isn't strictly necessary (GetStandardValue will return a null VideoParams anyway), // but it does suppress a warning message that we don't need if (index < InputArraySize(kVideoParamsInput)) { return GetStandardValue(kVideoParamsInput, index).value<VideoParams>(); } else { return VideoParams(); } } AudioParams GetAudioParams(int index = 0) const { // This check isn't strictly necessary (GetStandardValue will return a null VideoParams anyway), // but it does suppress a warning message that we don't need if (index < InputArraySize(kAudioParamsInput)) { return GetStandardValue(kAudioParamsInput, index).value<AudioParams>(); } else { return AudioParams(); } } SubtitleParams GetSubtitleParams(int index = 0) const { // This check isn't strictly necessary (GetStandardValue will return a null VideoParams anyway), // but it does suppress a warning message that we don't need if (index < InputArraySize(kSubtitleParamsInput)) { return GetStandardValue(kSubtitleParamsInput, index).value<SubtitleParams>(); } else { return SubtitleParams(); } } const rational &GetPlayhead() { return playhead_; } void SetVideoParams(const VideoParams &video, int index = 0) { SetStandardValue(kVideoParamsInput, QVariant::fromValue(video), index); } void SetAudioParams(const AudioParams &audio, int index = 0) { SetStandardValue(kAudioParamsInput, QVariant::fromValue(audio), index); } void SetSubtitleParams(const SubtitleParams &subs, int index = 0) { SetStandardValue(kSubtitleParamsInput, QVariant::fromValue(subs), index); } int GetVideoStreamCount() const { return InputArraySize(kVideoParamsInput); } int GetAudioStreamCount() const { return InputArraySize(kAudioParamsInput); } int GetSubtitleStreamCount() const { return InputArraySize(kSubtitleParamsInput); } virtual int GetTotalStreamCount() const { return GetVideoStreamCount() + GetAudioStreamCount() + GetSubtitleStreamCount(); } const AudioWaveformCache *GetConnectedWaveform() { if (Node *n = GetConnectedSampleOutput()) { return n->waveform_cache(); } else { return nullptr; } } bool HasEnabledVideoStreams() const; bool HasEnabledAudioStreams() const; bool HasEnabledSubtitleStreams() const; VideoParams GetFirstEnabledVideoStream() const; AudioParams GetFirstEnabledAudioStream() const; SubtitleParams GetFirstEnabledSubtitleStream() const; const rational &GetLength() const { return last_length_; } const rational &GetVideoLength() const { return video_length_; } const rational &GetAudioLength() const { return audio_length_; } TimelineWorkArea *GetWorkArea() const { return workarea_; } TimelineMarkerList *GetMarkers() const { return markers_; } virtual TimeRange GetVideoCacheRange() const override { return TimeRange(0, GetVideoLength()); } virtual TimeRange GetAudioCacheRange() const override { return TimeRange(0, GetAudioLength()); } QVector<Track::Reference> GetEnabledStreamsAsReferences() const; QVector<VideoParams> GetEnabledVideoStreams() const; QVector<AudioParams> GetEnabledAudioStreams() const; virtual void Retranslate() override; virtual Node *GetConnectedTextureOutput(); virtual ValueHint GetConnectedTextureValueHint(); virtual Node *GetConnectedSampleOutput(); virtual ValueHint GetConnectedSampleValueHint(); void SetWaveformEnabled(bool e); bool IsVideoAutoCacheEnabled() const { qDebug() << "sequence ac is a stub"; return false; } void SetVideoAutoCacheEnabled(bool e) { qDebug() << "sequence ac is a stub"; } virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; const EncodingParams &GetLastUsedEncodingParams() const { return last_used_encoding_params_; } void SetLastUsedEncodingParams(const EncodingParams &p) { last_used_encoding_params_ = p; } virtual bool LoadCustom(QXmlStreamReader *reader, SerializedData *data) override; virtual void SaveCustom(QXmlStreamWriter *writer) const override; static const QString kVideoParamsInput; static const QString kAudioParamsInput; static const QString kSubtitleParamsInput; static const QString kTextureInput; static const QString kSamplesInput; static const SampleFormat kDefaultSampleFormat; signals: void FrameRateChanged(const rational&); void LengthChanged(const rational& length); void SizeChanged(int width, int height); void PixelAspectChanged(const rational& pixel_aspect); void InterlacingChanged(VideoParams::Interlacing mode); void VideoParamsChanged(); void AudioParamsChanged(); void TextureInputChanged(); void SampleRateChanged(int sr); void ConnectedWaveformChanged(); void PlayheadChanged(const rational &t); public slots: void VerifyLength(); void SetPlayhead(const rational &t); protected: virtual void InputConnectedEvent(const QString &input, int element, Node *output) override; virtual void InputDisconnectedEvent(const QString &input, int element, Node *output) override; virtual rational VerifyLengthInternal(Track::Type type) const; virtual void InputValueChangedEvent(const QString& input, int element) override; int AddStream(Track::Type type, const QVariant &value); int SetStream(Track::Type type, const QVariant &value, int index); private: rational last_length_; rational video_length_; rational audio_length_; VideoParams cached_video_params_; AudioParams cached_audio_params_; TimelineWorkArea *workarea_; TimelineMarkerList *markers_; bool autocache_input_video_; bool autocache_input_audio_; EncodingParams last_used_encoding_params_; bool waveform_requests_enabled_; rational playhead_; }; } #endif // VIEWER_H
7,867
C++
.h
192
37.411458
130
0.775438
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,392
tracklist.h
olive-editor_olive/app/node/output/track/tracklist.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 TRACKLIST_H #define TRACKLIST_H #include <QObject> #include "node/output/track/track.h" #include "timeline/timelinecommon.h" namespace olive { class Sequence; class TrackList : public QObject { Q_OBJECT public: TrackList(Sequence *parent, const Track::Type& type, const QString& track_input); const Track::Type& type() const { return type_; } const QVector<Track*>& GetTracks() const { return track_cache_; } Track* GetTrackAt(int index) const; const rational& GetTotalLength() const { return total_length_; } int GetTrackCount() const { return track_cache_.size(); } Project* GetParentGraph() const; const QString &track_input() const; NodeInput track_input(int element) const; Sequence* parent() const; int ArraySize() const; void ArrayAppend(); void ArrayRemoveLast(); int GetArrayIndexFromCacheIndex(int index) const { return track_array_indexes_.at(index); } int GetCacheIndexFromArrayIndex(int index) const { return track_array_indexes_.indexOf(index); } public slots: /** * @brief Slot for when the track connection is added */ void TrackConnected(Node* node, int element); /** * @brief Slot for when the track connection is removed */ void TrackDisconnected(Node* node, int element); signals: void TrackListChanged(); void LengthChanged(const rational &length); void TrackAdded(Track* track); void TrackRemoved(Track* track); void TrackHeightChanged(Track *track, int height); private: void UpdateTrackIndexesFrom(int index); /** * @brief A cache of connected Tracks */ QVector<Track*> track_cache_; QVector<int> track_array_indexes_; QString track_input_; rational total_length_; enum Track::Type type_; private slots: /** * @brief Slot for when any of the track's length changes so we can update the length of the tracklist */ void UpdateTotalLength(); }; } #endif // TRACKLIST_H
2,683
C++
.h
91
26.252747
104
0.742656
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,393
track.h
olive-editor_olive/app/node/output/track/track.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 TRACK_H #define TRACK_H #include "node/block/block.h" namespace olive { class Sequence; /** * @brief A time traversal Node for sorting through one channel/track of Blocks */ class Track : public Node { Q_OBJECT public: enum Type { kNone = -1, kVideo, kAudio, kSubtitle, kCount }; Track(); NODE_DEFAULT_FUNCTIONS(Track) const Track::Type& type() const; void set_type(const Track::Type& track_type); virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual ActiveElements GetActiveElementsAtTime(const QString &input, const TimeRange &r) const override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; virtual TimeRange InputTimeAdjustment(const QString& input, int element, const TimeRange& input_time, bool clamp) const override; virtual TimeRange OutputTimeAdjustment(const QString& input, int element, const TimeRange& input_time) const override; static rational TransformTimeForBlock(const Block* block, const rational& time) { if (time == RATIONAL_MAX || time == RATIONAL_MIN) { return time; } return time - block->in(); } static TimeRange TransformRangeForBlock(const Block* block, const TimeRange& range) { return TimeRange(TransformTimeForBlock(block, range.in()), TransformTimeForBlock(block, range.out())); } static rational TransformTimeFromBlock(const Block* block, const rational& time) { if (time == RATIONAL_MAX || time == RATIONAL_MIN) { return time; } return time + block->in(); } static TimeRange TransformRangeFromBlock(const Block* block, const TimeRange& range) { return TimeRange(TransformTimeFromBlock(block, range.in()), TransformTimeFromBlock(block, range.out())); } const double& GetTrackHeight() const; void SetTrackHeight(const double& height); int GetTrackHeightInPixels() const { return InternalHeightToPixelHeight(GetTrackHeight()); } void SetTrackHeightInPixels(int h) { SetTrackHeight(PixelHeightToInternalHeight(h)); } virtual bool LoadCustom(QXmlStreamReader *reader, SerializedData *data) override; virtual void SaveCustom(QXmlStreamWriter *writer) const override; virtual void PostLoadEvent(SerializedData *data) override; static int InternalHeightToPixelHeight(double h) { return qRound(h * QFontMetrics(QFont()).height()); } static double PixelHeightToInternalHeight(int h) { return double(h) / double(QFontMetrics(QFont()).height()); } static int GetDefaultTrackHeightInPixels() { return InternalHeightToPixelHeight(kTrackHeightDefault); } static int GetMinimumTrackHeightInPixels() { return InternalHeightToPixelHeight(kTrackHeightMinimum); } virtual void Retranslate() override; class Reference { public: Reference() : type_(kNone), index_(-1) { } Reference(const Track::Type& type, const int& index) : type_(type), index_(index) { } const Track::Type& type() const { return type_; } const int& index() const { return index_; } bool operator==(const Reference& ref) const { return type_ == ref.type_ && index_ == ref.index_; } bool operator!=(const Reference& ref) const { return !(*this == ref); } bool operator<(const Track::Reference& rhs) const { if (type_ != rhs.type_) { return type_ < rhs.type_; } return index_ < rhs.index_; } QString ToString() const { QString type_string = TypeToString(type_); if (type_string.isEmpty()) { return QString(); } else { return QStringLiteral("%1:%2").arg(type_string, QString::number(index_)); } } /// For IDs that shouldn't change between localizations static QString TypeToString(Type type) { switch (type) { case kVideo: return QStringLiteral("v"); case kAudio: return QStringLiteral("a"); case kSubtitle: return QStringLiteral("s"); case kCount: case kNone: break; } return QString(); } /// For human-facing strings static QString TypeToTranslatedString(Type type) { switch (type) { case kVideo: return tr("V"); case kAudio: return tr("A"); case kSubtitle: return tr("S"); case kCount: case kNone: break; } return QString(); } static Type TypeFromString(const QString& s) { if (s.size() >= 3) { if (s.at(1) == ':') { if (s.at(0) == 'v') { // Video stream return Track::kVideo; } else if (s.at(0) == 'a') { // Audio stream return Track::kAudio; } else if (s.at(0) == 's') { // Subtitle stream return Track::kSubtitle; } } } return Track::kNone; } static Reference FromString(const QString& s) { Reference ref; Type parse_type = TypeFromString(s); if (parse_type != Track::kNone) { bool ok; int parse_index = s.mid(2).toInt(&ok); if (ok) { ref.type_ = parse_type; ref.index_ = parse_index; } } return ref; } bool IsValid() const { return type_ > kNone && type_ < kCount && index_ >= 0; } private: Track::Type type_; int index_; }; Reference ToReference() const { return Reference(type(), Index()); } const int& Index() const { return index_; } void SetIndex(const int& index); /** * @brief Returns the block that starts BEFORE (not AT) and ends AFTER (not AT) a time * * Catches the first block that matches `block.in < time && block.out > time` or nullptr if any * block starts/ends precisely at that time or the time exceeds the track length. */ Block* BlockContainingTime(const rational& time) const; /** * @brief Returns the block that starts BEFORE a given time and ends either AFTER or AT that time * * @return Catches the first block that matches `block.out >= time` or nullptr if this time * exceeds the track length. */ Block* NearestBlockBefore(const rational& time) const; /** * @brief Returns the block that starts BEFORE or AT a given time. * * @return Catches the first block that matches `block.out > time` or nullptr if this time * exceeds the track length. */ Block* NearestBlockBeforeOrAt(const rational& time) const; /** * @brief Returns the block that starts either AT a given time or the soonest block AFTER * * @return Catches the first block that matches `block.in >= time` or nullptr if this time * exceeds the track length. */ Block* NearestBlockAfterOrAt(const rational& time) const; /** * @brief Returns the block that starts AFTER the given time (but never AT the given time) * * @return Catches the first block that matches `block.in > time` or nullptr if this time * exceeds the track length. */ Block* NearestBlockAfter(const rational& time) const; /* * @brief Returns whether a time range is empty or only has a gap */ bool IsRangeFree(const TimeRange &range) const; const QVector<Block *> &Blocks() const { return blocks_; } virtual void InvalidateCache(const TimeRange& range, const QString& from, int element, InvalidateCacheOptions options) override; Block *VisibleBlockAtTime(const rational &t) const { int index = GetBlockIndexAtTime(t); return (index == -1) ? nullptr : blocks_.at(index); } /** * @brief Adds Block `block` at the very beginning of the Sequence before all other clips */ void PrependBlock(Block* block); /** * @brief Inserts Block `block` at a specific index (0 is the start of the timeline) * * If the index == 0, this function does the same as PrependBlock(). If the index >= the current number of blocks, * this function is the same as AppendBlock(). */ void InsertBlockAtIndex(Block* block, int index); /** * @brief Inserts Block after another Block * * Equivalent to calling InsertBlockBetweenBlocks(block, before, before->next()) */ void InsertBlockAfter(Block* block, Block* before); /** * @brief Inserts Block before another Block */ void InsertBlockBefore(Block* block, Block* after); /** * @brief Adds Block `block` at the very end of the Sequence after all other clips */ void AppendBlock(Block* block); /** * @brief Removes a Block pushing all subsequent Blocks earlier to take up the space */ void RippleRemoveBlock(Block* block); /** * @brief Replaces Block `old` with Block `replace` * * Both blocks must have equal lengths. */ void ReplaceBlock(Block* old, Block* replace); rational track_length() const; bool IsMuted() const; bool IsLocked() const; int GetArrayIndexFromBlock(Block* block) const; Sequence *sequence() const { return sequence_; } void set_sequence(Sequence *sequence) { sequence_ = sequence; } static const double kTrackHeightDefault; static const double kTrackHeightMinimum; static const double kTrackHeightInterval; static const QString kBlockInput; static const QString kMutedInput; static const QString kArrayMapInput; public slots: void SetMuted(bool e); void SetLocked(bool e); signals: /** * @brief Signal emitted when a Block is added to this Track */ void BlockAdded(Block* block); /** * @brief Signal emitted when a Block is removed from this Track */ void BlockRemoved(Block* block); /** * @brief Signal emitted when the length of the track has changed */ void TrackLengthChanged(); /** * @brief Signal emitted when the height of the track has changed */ void TrackHeightChanged(qreal virtual_height); /** * @brief Signal emitted when the muted setting changes */ void MutedChanged(bool e); /** * @brief Signal emitted when the index has changed */ void IndexChanged(int old, int now); /** * @brief Emitted when a block changes length and all the subsequent blocks had to update */ void BlocksRefreshed(); protected: virtual void InputConnectedEvent(const QString& input, int element, Node *node) override; virtual void InputValueChangedEvent(const QString& input, int element) override; private: void UpdateInOutFrom(int index); int GetArrayIndexFromCacheIndex(int index) const; int GetCacheIndexFromArrayIndex(int index) const; int GetBlockIndexAtTime(const rational &time) const; void ProcessAudioTrack(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const; int ConnectBlock(Block *b); void UpdateArrayMap(); TimeRangeList block_length_pending_invalidations_; QVector<Block*> blocks_; QVector<uint32_t> block_array_indexes_; std::list<int> empty_inputs_; Track::Type track_type_; double track_height_; int index_; bool locked_; Sequence *sequence_; int ignore_arraymap_; bool arraymap_invalid_; bool ignore_arraymap_set_; private slots: void BlockLengthChanged(); void RefreshBlockCacheFromArrayMap(); }; uint qHash(const Track::Reference& r, uint seed = 0); QDataStream &operator<<(QDataStream &out, const Track::Reference &ref); QDataStream &operator>>(QDataStream &in, Track::Reference &ref); } #endif // TRACK_H
12,341
C++
.h
389
27.059126
131
0.692041
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,394
sequence.h
olive-editor_olive/app/node/project/sequence/sequence.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 SEQUENCE_H #define SEQUENCE_H #include "node/output/track/tracklist.h" #include "node/output/viewer/viewer.h" namespace olive { /** * @brief The main timeline object, an graph of edited clips that forms a complete edit */ class Sequence : public ViewerOutput { Q_OBJECT public: Sequence(); NODE_DEFAULT_FUNCTIONS(Sequence) virtual QString Name() const override { return tr("Sequence"); } virtual QString id() const override { return QStringLiteral("org.olivevideoeditor.Olive.sequence"); } virtual QVector<CategoryID> Category() const override { return {kCategoryProject}; } virtual QString Description() const override { return tr("A series of cuts that result in an edited video. Also called a timeline."); } void add_default_nodes(MultiUndoCommand *command = nullptr); virtual QVariant data(const DataType &d) const override; const QVector<Track *> &GetTracks() const { return track_cache_; } Track* GetTrackFromReference(const Track::Reference& track_ref) const { return track_lists_.at(track_ref.type())->GetTrackAt(track_ref.index()); } /** * @brief Same as GetTracks() but omits tracks that are locked. */ QVector<Track *> GetUnlockedTracks() const; TrackList* track_list(Track::Type type) const { return track_lists_.at(type); } virtual void Retranslate() override; virtual void InvalidateCache(const TimeRange& range, const QString& from, int element, InvalidateCacheOptions options) override; static const QString kTrackInputFormat; protected: virtual void InputConnectedEvent(const QString &input, int element, Node *output) override; virtual void InputDisconnectedEvent(const QString &input, int element, Node *output) override; virtual rational VerifyLengthInternal(Track::Type type) const override; signals: void TrackAdded(Track* track); void TrackRemoved(Track* track); void SubtitlesChanged(const TimeRange &range); private: QVector<TrackList*> track_lists_; QVector<Track*> track_cache_; private slots: void UpdateTrackCache(); }; } #endif // SEQUENCE_H
2,836
C++
.h
81
31.864198
130
0.761117
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,395
typeserializer.h
olive-editor_olive/app/node/project/serializer/typeserializer.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2023 Olive Team 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 TYPESERIALIZER_H #define TYPESERIALIZER_H #include <olive/core/core.h> #include <QXmlStreamReader> #include <QXmlStreamWriter> #include "common/xmlutils.h" namespace olive { using namespace core; class TypeSerializer { public: TypeSerializer() = default; static AudioParams LoadAudioParams(QXmlStreamReader *reader); static void SaveAudioParams(QXmlStreamWriter *writer, const AudioParams &a); }; } #endif // TYPESERIALIZER_H
1,161
C++
.h
31
35
78
0.790135
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,396
serializer230220.h
olive-editor_olive/app/node/project/serializer/serializer230220.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2023 Olive Studios LLC 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 PROJECTSERIALIZER230220_H #define PROJECTSERIALIZER230220_H #include "serializer.h" namespace olive { class ProjectSerializer230220 : public ProjectSerializer { public: ProjectSerializer230220() = default; protected: virtual LoadData Load(Project *project, QXmlStreamReader *reader, LoadType load_type, void *reserved) const override; virtual void Save(QXmlStreamWriter *writer, const SaveData &data, void *reserved) const override; virtual uint Version() const override { return 230220; } private: void PostConnect(const QVector<Node*> &nodes, SerializedData *project_data) const; }; } #endif // PROJECTSERIALIZER230220_H
1,378
C++
.h
34
37.823529
119
0.789157
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,397
serializer.h
olive-editor_olive/app/node/project/serializer/serializer.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 PROJECTSERIALIZER_H #define PROJECTSERIALIZER_H #include <vector> #include "common/define.h" #include "node/project.h" #include "typeserializer.h" namespace olive { /** * @brief An abstract base class for serializing/deserializing project data * * The goal of this is to further abstract serialized project data from their * in-memory representations. */ class ProjectSerializer { public: enum LoadType { kProject, kOnlyNodes, kOnlyClips, kOnlyMarkers, kOnlyKeyframes }; ProjectSerializer() = default; virtual ~ProjectSerializer(){} DISABLE_COPY_MOVE(ProjectSerializer) enum ResultCode { kSuccess, kProjectTooOld, kProjectTooNew, kUnknownVersion, kFileError, kXmlError, kOverwriteError, kNoData }; using SerializedProperties = QHash<Node*, QMap<QString, QString> >; using SerializedKeyframes = QHash<QString, QVector<NodeKeyframe*> >; class LoadData { public: LoadData() = default; SerializedProperties properties; std::vector<TimelineMarker*> markers; SerializedKeyframes keyframes; MainWindowLayoutInfo layout; QVector<Node*> nodes; Node::OutputConnections promised_connections; }; class Result { public: Result(const ResultCode &code) : code_(code) {} bool operator==(const ResultCode &code) { return code_ == code; } bool operator!=(const ResultCode &code) { return code_ != code; } const ResultCode &code() const { return code_; } const QString &GetDetails() const { return details_; } void SetDetails(const QString &s) { details_ = s; } const LoadData &GetLoadData() const { return load_data_; } void SetLoadData(const LoadData &p) { load_data_ = p; } private: ResultCode code_; QString details_; LoadData load_data_; }; class SaveData { public: SaveData(LoadType type, Project *project = nullptr, const QString &filename = QString()) { type_ = type; project_ = project; filename_ = filename; } Project *GetProject() const { return project_; } void SetProject(Project *p) { project_ = p; } const QString &GetFilename() const { return filename_; } void SetFilename(const QString &s) { filename_ = s; } LoadType type() const { return type_; } const MainWindowLayoutInfo &GetLayout() const { return layout_; } void SetLayout(const MainWindowLayoutInfo &layout) { layout_ = layout; } const QVector<Node*> &GetOnlySerializeNodes() const { return only_serialize_nodes_; } void SetOnlySerializeNodes(const QVector<Node*> &only) { only_serialize_nodes_ = only; } void SetOnlySerializeNodesAndResolveGroups(QVector<Node*> only); const std::vector<TimelineMarker*> &GetOnlySerializeMarkers() const { return only_serialize_markers_; } void SetOnlySerializeMarkers(const std::vector<TimelineMarker*> &only) { only_serialize_markers_ = only; } const std::vector<NodeKeyframe*> &GetOnlySerializeKeyframes() const { return only_serialize_keyframes_; } void SetOnlySerializeKeyframes(const std::vector<NodeKeyframe*> &only) { only_serialize_keyframes_ = only; } const SerializedProperties &GetProperties() const { return properties_; } void SetProperties(const SerializedProperties &p) { properties_ = p; } private: LoadType type_; Project *project_; QString filename_; MainWindowLayoutInfo layout_; QVector<Node*> only_serialize_nodes_; SerializedProperties properties_; std::vector<TimelineMarker*> only_serialize_markers_; std::vector<NodeKeyframe*> only_serialize_keyframes_; }; static void Initialize(); static void Destroy(); static Result Load(Project *project, const QString &filename, LoadType load_type); static Result Load(Project *project, QXmlStreamReader *read_device, LoadType load_type); static Result Paste(LoadType load_type, Project *project = nullptr); static Result Save(const SaveData &data, bool compress); static Result Save(QXmlStreamWriter *write_device, const SaveData &data); static Result Copy(const SaveData &data); static bool CheckCompressedID(QFile *file); protected: virtual LoadData Load(Project *project, QXmlStreamReader *reader, LoadType load_type, void *reserved) const = 0; virtual void Save(QXmlStreamWriter *writer, const SaveData &data, void *reserved) const {} virtual uint Version() const = 0; bool IsCancelled() const; private: static Result LoadWithSerializerVersion(uint version, Project *project, QXmlStreamReader *reader, LoadType load_type); static QVector<ProjectSerializer*> instances_; }; } #endif // PROJECTSERIALIZER_H
5,388
C++
.h
137
35.167883
120
0.739055
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,398
serializer220403.h
olive-editor_olive/app/node/project/serializer/serializer220403.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 SERIALIZER220403_H #define SERIALIZER220403_H #include "serializer.h" namespace olive { class ProjectSerializer220403 : public ProjectSerializer { public: ProjectSerializer220403() = default; protected: virtual LoadData Load(Project *project, QXmlStreamReader *reader, LoadType load_type, void *reserved) const override; virtual uint Version() const override { return 220403; } private: struct XMLNodeData { struct SerializedConnection { NodeInput input; quintptr output_node; }; struct BlockLink { Node* block; quintptr link; }; struct GroupLink { NodeGroup *group; QString passthrough_id; quintptr input_node; QString input_id; int input_element; QString custom_name; InputFlags custom_flags; NodeValue::Type data_type; QVariant default_val; QHash<QString, QVariant> custom_properties; }; QHash<quintptr, Node*> node_ptrs; QList<SerializedConnection> desired_connections; QList<BlockLink> block_links; QVector<GroupLink> group_input_links; QHash<NodeGroup*, quintptr> group_output_links; QHash<Node*, QUuid> node_uuids; }; void LoadNode(Node *node, XMLNodeData &xml_node_data, QXmlStreamReader *reader) const; void LoadColorManager(QXmlStreamReader* reader, Project *project) const; void LoadProjectSettings(QXmlStreamReader* reader, Project *project) const; void LoadInput(Node *node, QXmlStreamReader* reader, XMLNodeData &xml_node_data) const; void LoadImmediate(QXmlStreamReader *reader, Node *node, const QString& input, int element, XMLNodeData& xml_node_data) const; void LoadKeyframe(QXmlStreamReader *reader, NodeKeyframe *key, NodeValue::Type data_type) const; bool LoadPosition(QXmlStreamReader *reader, quintptr *node_ptr, Node::Position *pos) const; void PostConnect(const XMLNodeData &xml_node_data) const; void LoadNodeCustom(QXmlStreamReader *reader, Node *node, XMLNodeData &xml_node_data) const; void LoadTimelinePoints(QXmlStreamReader *reader, ViewerOutput *viewer) const; void LoadMarker(QXmlStreamReader *reader, TimelineMarker *marker) const; void LoadWorkArea(QXmlStreamReader *reader, TimelineWorkArea *workarea) const; void LoadMarkerList(QXmlStreamReader *reader, TimelineMarkerList *markers) const; void LoadValueHint(Node::ValueHint *hint, QXmlStreamReader *reader) const; }; } #endif // SERIALIZER220403_H
3,163
C++
.h
74
38.567568
128
0.767016
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,399
serializer190219.h
olive-editor_olive/app/node/project/serializer/serializer190219.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 PROJECTSERIALIZER190219_H #define PROJECTSERIALIZER190219_H #include "serializer.h" namespace olive { class ProjectSerializer190219 : public ProjectSerializer { public: ProjectSerializer190219() = default; protected: virtual LoadData Load(Project *project, QXmlStreamReader *reader, LoadType load_type, void *reserved) const override; virtual uint Version() const override { return 190219; } }; } #endif // SERIALIZER190219_H
1,168
C++
.h
31
35
119
0.786287
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,400
serializer211228.h
olive-editor_olive/app/node/project/serializer/serializer211228.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 SERIALIZER211228_H #define SERIALIZER211228_H #include "serializer.h" namespace olive { class ProjectSerializer211228 : public ProjectSerializer { public: ProjectSerializer211228() = default; protected: virtual LoadData Load(Project *project, QXmlStreamReader *reader, LoadType load_type, void *reserved) const override; virtual uint Version() const override { return 211228; } private: struct XMLNodeData { struct SerializedConnection { NodeInput input; quintptr output_node; }; struct BlockLink { Node* block; quintptr link; }; struct GroupLink { NodeGroup *group; quintptr input_node; QString input_id; int input_element; }; QHash<quintptr, Node*> node_ptrs; QList<SerializedConnection> desired_connections; QList<BlockLink> block_links; QVector<GroupLink> group_input_links; QHash<NodeGroup*, quintptr> group_output_links; QHash<Node*, QUuid> node_uuids; }; void LoadNode(Node *node, XMLNodeData &xml_node_data, QXmlStreamReader *reader) const; void LoadColorManager(QXmlStreamReader* reader, Project *project) const; void LoadProjectSettings(QXmlStreamReader* reader, Project *project) const; void LoadInput(Node *node, QXmlStreamReader* reader, XMLNodeData &xml_node_data) const; void LoadImmediate(QXmlStreamReader *reader, Node *node, const QString& input, int element, XMLNodeData& xml_node_data) const; bool LoadPosition(QXmlStreamReader *reader, quintptr *node_ptr, Node::Position *pos) const; void PostConnect(const XMLNodeData &xml_node_data) const; void LoadNodeCustom(QXmlStreamReader *reader, Node *node, XMLNodeData &xml_node_data) const; void LoadTimelinePoints(QXmlStreamReader *reader, ViewerOutput *points) const; void LoadWorkArea(QXmlStreamReader *reader, TimelineWorkArea *workarea) const; void LoadMarkerList(QXmlStreamReader *reader, TimelineMarkerList *markers) const; void LoadValueHint(Node::ValueHint *hint, QXmlStreamReader *reader) const; }; } #endif // SERIALIZER211228_H
2,788
C++
.h
66
38.318182
128
0.769602
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,401
serializer210528.h
olive-editor_olive/app/node/project/serializer/serializer210528.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 SERIALIZER210528_H #define SERIALIZER210528_H #include "serializer.h" namespace olive { class ProjectSerializer210528 : public ProjectSerializer { public: ProjectSerializer210528() = default; protected: virtual LoadData Load(Project *project, QXmlStreamReader *reader, LoadType load_type, void *reserved) const override; virtual uint Version() const override { return 210528; } private: struct XMLNodeData { struct SerializedConnection { NodeInput input; quintptr output_node; QString output_param; }; struct BlockLink { Node* block; quintptr link; }; struct GroupLink { NodeGroup *group; quintptr input_node; QString input_id; int input_element; }; QHash<quintptr, Node*> node_ptrs; QList<SerializedConnection> desired_connections; QList<BlockLink> block_links; QVector<GroupLink> group_input_links; QHash<NodeGroup*, quintptr> group_output_links; }; void LoadNode(Node *node, XMLNodeData &xml_node_data, QXmlStreamReader *reader) const; void LoadColorManager(QXmlStreamReader* reader, Project *project) const; void LoadProjectSettings(QXmlStreamReader* reader, Project *project) const; void LoadInput(Node *node, QXmlStreamReader* reader, XMLNodeData &xml_node_data) const; void LoadImmediate(QXmlStreamReader *reader, Node *node, const QString& input, int element, XMLNodeData& xml_node_data) const; bool LoadPosition(QXmlStreamReader *reader, quintptr *node_ptr, Node::Position *pos) const; void PostConnect(const XMLNodeData &xml_node_data) const; void LoadNodeCustom(QXmlStreamReader *reader, Node *node, XMLNodeData &xml_node_data) const; void LoadTimelinePoints(QXmlStreamReader *reader, ViewerOutput *points) const; void LoadWorkArea(QXmlStreamReader *reader, TimelineWorkArea *workarea) const; void LoadMarkerList(QXmlStreamReader *reader, TimelineMarkerList *markers) const; void LoadValueHint(Node::ValueHint *hint, QXmlStreamReader *reader) const; }; } #endif // SERIALIZER211228_H
2,780
C++
.h
66
38.166667
128
0.770034
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,402
serializer210907.h
olive-editor_olive/app/node/project/serializer/serializer210907.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 SERIALIZER210907_H #define SERIALIZER210907_H #include "serializer.h" namespace olive { class ProjectSerializer210907 : public ProjectSerializer { public: ProjectSerializer210907() = default; protected: virtual LoadData Load(Project *project, QXmlStreamReader *reader, LoadType load_type, void *reserved) const override; virtual uint Version() const override { return 210907; } private: struct XMLNodeData { struct SerializedConnection { NodeInput input; quintptr output_node; }; struct BlockLink { Node* block; quintptr link; }; struct GroupLink { NodeGroup *group; quintptr input_node; QString input_id; int input_element; }; QHash<quintptr, Node*> node_ptrs; QList<SerializedConnection> desired_connections; QList<BlockLink> block_links; QVector<GroupLink> group_input_links; QHash<NodeGroup*, quintptr> group_output_links; }; void LoadNode(Node *node, XMLNodeData &xml_node_data, QXmlStreamReader *reader) const; void LoadColorManager(QXmlStreamReader* reader, Project *project) const; void LoadProjectSettings(QXmlStreamReader* reader, Project *project) const; void LoadInput(Node *node, QXmlStreamReader* reader, XMLNodeData &xml_node_data) const; void LoadImmediate(QXmlStreamReader *reader, Node *node, const QString& input, int element, XMLNodeData& xml_node_data) const; bool LoadPosition(QXmlStreamReader *reader, quintptr *node_ptr, Node::Position *pos) const; void PostConnect(const XMLNodeData &xml_node_data) const; void LoadNodeCustom(QXmlStreamReader *reader, Node *node, XMLNodeData &xml_node_data) const; void LoadTimelinePoints(QXmlStreamReader *reader, ViewerOutput *points) const; void LoadWorkArea(QXmlStreamReader *reader, TimelineWorkArea *workarea) const; void LoadMarkerList(QXmlStreamReader *reader, TimelineMarkerList *markers) const; void LoadValueHint(Node::ValueHint *hint, QXmlStreamReader *reader) const; }; } #endif // SERIALIZER211228_H
2,752
C++
.h
65
38.430769
128
0.771084
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,403
footage.h
olive-editor_olive/app/node/project/footage/footage.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 FOOTAGE_H #define FOOTAGE_H #include <olive/core/core.h> #include <QList> #include <QDateTime> #include "codec/decoder.h" #include "footagedescription.h" #include "node/output/viewer/viewer.h" #include "render/cancelatom.h" #include "render/videoparams.h" namespace olive { /** * @brief A reference to an external media file with metadata in a project structure * * Footage objects serve two purposes: storing metadata about external media and storing it as a project item. * Footage objects store a list of Stream objects which store the majority of video/audio metadata. These streams * are identical to the stream data in the files. */ class Footage : public ViewerOutput { Q_OBJECT public: /** * @brief Footage Constructor */ Footage(const QString& filename = QString()); NODE_DEFAULT_FUNCTIONS(Footage) virtual QString Name() const override { return tr("Media"); } virtual QString id() const override { return QStringLiteral("org.olivevideoeditor.Olive.footage"); } virtual QVector<CategoryID> Category() const override { return {kCategoryProject}; } virtual QString Description() const override { return tr("Import video, audio, or still image files into the composition."); } virtual void Retranslate() override; /** * @brief Reset Footage state ready for running through Probe() again * * If a Footage object needs to be re-probed (e.g. source file changes or Footage is linked to a new file), its * state needs to be reset so the Decoder::Probe() function can accurately mirror the source file. Clear() will * reset the Footage object's state to being freshly created (keeping the filename). * * In most cases, you'll be using olive::ProbeMedia() for re-probing which already runs Clear(), so you won't need * to worry about this. */ void Clear(); bool IsValid() const { return valid_; } /** * @brief Sets this footage to valid and ready to use */ void SetValid(); /** * @brief Return the current filename of this Footage object */ QString filename() const; /** * @brief Set the filename * * NOTE: This does not automtaically clear the old streams and re-probe for new ones. If the file link has been * changed, this will need to be done manually. * * @param s * * New filename */ void set_filename(const QString& s); /** * @brief Retrieve the last modified time/date * * The file's last modified timestamp is stored for potential organization in the ProjectExplorer. It can be * retrieved here. */ const qint64 &timestamp() const; /** * @brief Set the last modified time/date * * This should probably only be done on import or replace. * * @param t * * New last modified time/date */ void set_timestamp(const qint64 &t); void SetCancelPointer(CancelAtom *c) { cancelled_ = c; } int GetStreamIndex(Track::Type type, int index) const; int GetStreamIndex(const Track::Reference& ref) const { return GetStreamIndex(ref.type(), ref.index()); } Track::Reference GetReferenceFromRealIndex(int real_index) const; /** * @brief Get the Decoder ID set when this Footage was probed * * @return * * A decoder ID */ const QString& decoder() const; static QString DescribeVideoStream(const VideoParams& params); static QString DescribeAudioStream(const AudioParams& params); static QString DescribeSubtitleStream(const SubtitleParams& params); virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; static QString GetStreamTypeName(Track::Type type); virtual Node *GetConnectedTextureOutput() override; virtual Node *GetConnectedSampleOutput() override; static rational AdjustTimeByLoopMode(rational time, LoopMode loop_mode, const rational& length, VideoParams::Type type, const rational &timebase); virtual QVariant data(const DataType &d) const override; virtual int GetTotalStreamCount() const override { return total_stream_count_; } virtual bool LoadCustom(QXmlStreamReader *reader, SerializedData *data) override; virtual void SaveCustom(QXmlStreamWriter *writer) const override; static const QString kFilenameInput; virtual void AddedToGraphEvent(Project *p) override; virtual void RemovedFromGraphEvent(Project *p) override; protected: virtual void InputValueChangedEvent(const QString &input, int element) override; virtual rational VerifyLengthInternal(Track::Type type) const override; private: QString GetColorspaceToUse(const VideoParams& params) const; void Reprobe(); VideoParams MergeVideoStream(const VideoParams &base, const VideoParams &over); /** * @brief Internal timestamp object */ qint64 timestamp_; /** * @brief Internal attached decoder ID */ QString decoder_; bool valid_; CancelAtom *cancelled_; int total_stream_count_; private slots: void CheckFootage(); void DefaultColorSpaceChanged(); }; } #endif // FOOTAGE_H
5,782
C++
.h
166
31.457831
148
0.747438
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,404
footagedescription.h
olive-editor_olive/app/node/project/footage/footagedescription.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 FOOTAGEDESCRIPTION_H #define FOOTAGEDESCRIPTION_H #include "node/output/track/track.h" #include "render/subtitleparams.h" #include "render/videoparams.h" namespace olive { class FootageDescription { public: FootageDescription(const QString& decoder = QString()) : decoder_(decoder), total_stream_count_(0) { } bool IsValid() const { return !decoder_.isEmpty() && (!video_streams_.isEmpty() || !audio_streams_.isEmpty() || !subtitle_streams_.isEmpty()); } const QString& decoder() const { return decoder_; } void AddVideoStream(const VideoParams& video_params) { Q_ASSERT(!HasStreamIndex(video_params.stream_index())); video_streams_.append(video_params); } void AddAudioStream(const AudioParams& audio_params) { Q_ASSERT(!HasStreamIndex(audio_params.stream_index())); audio_streams_.append(audio_params); } void AddSubtitleStream(const SubtitleParams& sub_params) { Q_ASSERT(!HasStreamIndex(sub_params.stream_index())); subtitle_streams_.append(sub_params); } Track::Type GetTypeOfStream(int index) { if (StreamIsVideo(index)) { return Track::kVideo; } else if (StreamIsAudio(index)) { return Track::kAudio; } else if (StreamIsSubtitle(index)) { return Track::kSubtitle; } else { return Track::kNone; } } bool StreamIsVideo(int index) const { foreach (const VideoParams& vp, video_streams_) { if (vp.stream_index() == index) { return true; } } return false; } bool StreamIsAudio(int index) const { foreach (const AudioParams& ap, audio_streams_) { if (ap.stream_index() == index) { return true; } } return false; } bool StreamIsSubtitle(int index) const { foreach (const SubtitleParams& sp, subtitle_streams_) { if (sp.stream_index() == index) { return true; } } return false; } bool HasStreamIndex(int index) const { return StreamIsVideo(index) || StreamIsAudio(index) || StreamIsSubtitle(index); } int GetStreamCount() const { return total_stream_count_; } void SetStreamCount(int s) { total_stream_count_ = s; } bool Load(const QString& filename); bool Save(const QString& filename) const; const QVector<VideoParams>& GetVideoStreams() const { return video_streams_; } QVector<VideoParams>& GetVideoStreams() { return video_streams_; } const QVector<AudioParams>& GetAudioStreams() const { return audio_streams_; } QVector<AudioParams>& GetAudioStreams() { return audio_streams_; } const QVector<SubtitleParams>& GetSubtitleStreams() const { return subtitle_streams_; } QVector<SubtitleParams>& GetSubtitleStreams() { return subtitle_streams_; } private: static constexpr unsigned kFootageMetaVersion = 6; QString decoder_; QVector<VideoParams> video_streams_; QVector<AudioParams> audio_streams_; QVector<SubtitleParams> subtitle_streams_; int total_stream_count_; }; } #endif // FOOTAGEDESCRIPTION_H
3,741
C++
.h
114
28.780702
123
0.71787
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,405
folder.h
olive-editor_olive/app/node/project/folder/folder.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 FOLDER_H #define FOLDER_H #include "node/node.h" namespace olive { /** * @brief The Folder class representing a directory in a project structure * * The Item base class already has support for children, but this functionality is disabled by default * (see CanHaveChildren() override). The Folder is a specific type that enables this functionality. */ class Folder : public Node { Q_OBJECT public: Folder(); NODE_DEFAULT_FUNCTIONS(Folder) virtual QString Name() const override { return tr("Folder"); } virtual QString id() const override { return QStringLiteral("org.olivevideoeditor.Olive.folder"); } virtual QVector<CategoryID> Category() const override { return {kCategoryProject}; } virtual QString Description() const override { return tr("Organize several items into a single collection."); } virtual QVariant data(const DataType &d) const override; virtual void Retranslate() override; Node *GetChildWithName(const QString& s) const; bool ChildExistsWithName(const QString& s) const { return GetChildWithName(s); } bool HasChildRecursive(Node *child) const; int item_child_count() const { return item_children_.size(); } Node* item_child(int i) const { return item_children_.at(i); } const QVector<Node*>& children() const { return item_children_; } int index_of_child(Node* item) const { return item_children_.indexOf(item); } int index_of_child_in_array(Node* item) const; template <typename T> QVector<T*> ListChildrenOfType() const { QVector<T*> list; foreach (Node* node, item_children_) { T* cast_test = dynamic_cast<T*>(node); if (cast_test) { list.append(cast_test); } Folder *folder_test = dynamic_cast<Folder*>(node); if (folder_test) { list.append(folder_test->ListChildrenOfType<T>()); } } return list; } static const QString kChildInput; class RemoveElementCommand : public UndoCommand { public: RemoveElementCommand(Folder *folder, Node *child) : folder_(folder), child_(child), subcommand_(nullptr) { } virtual ~RemoveElementCommand() override { delete subcommand_; } virtual Project *GetRelevantProject() const override { return folder_->project(); } protected: virtual void redo() override; virtual void undo() override { if (subcommand_) { subcommand_->undo_now(); } } private: Folder *folder_; Node *child_; int remove_index_; MultiUndoCommand *subcommand_; }; signals: void BeginInsertItem(Node* n, int index); void EndInsertItem(); void BeginRemoveItem(Node* n, int index); void EndRemoveItem(); protected: virtual void InputConnectedEvent(const QString& input, int element, Node *output) override; virtual void InputDisconnectedEvent(const QString& input, int element, Node *output) override; private: template<typename T> static void ListOutputsOfTypeInternal(const Folder* n, QVector<T*>& list, bool recursive) { foreach (const Node::OutputConnection& c, n->output_connections()) { Node* connected = c.second.node(); T* cast_test = dynamic_cast<T*>(connected); if (cast_test) { // Avoid duplicates if (!list.contains(cast_test)) { list.append(cast_test); } } if (recursive) { Folder* subfolder = dynamic_cast<Folder*>(connected); if (subfolder) { ListOutputsOfTypeInternal(subfolder, list, recursive); } } } } QVector<Node*> item_children_; QVector<int> item_element_index_; }; class FolderAddChild : public UndoCommand { public: FolderAddChild(Folder* folder, Node* child); virtual Project * GetRelevantProject() const override; protected: virtual void redo() override; virtual void undo() override; private: Folder* folder_; Node* child_; }; } #endif // FOLDER_H
4,736
C++
.h
165
24.363636
102
0.701618
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,406
block.h
olive-editor_olive/app/node/block/block.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 BLOCK_H #define BLOCK_H #include "node/node.h" #include "timeline/timelinecommon.h" namespace olive { class TransitionBlock; /** * @brief A Node that represents a block of time, also displayable on a Timeline */ class Block : public Node { Q_OBJECT public: Block(); virtual QVector<CategoryID> Category() const override; const rational& in() const { return in_point_; } const rational& out() const { return out_point_; } void set_in(const rational& in) { in_point_ = in; } void set_out(const rational& out) { out_point_ = out; } rational length() const; virtual void set_length_and_media_out(const rational &length); virtual void set_length_and_media_in(const rational &length); TimeRange range() const { return TimeRange(in(), out()); } Block* previous() const { return previous_; } Block* next() const { return next_; } void set_previous(Block* previous) { previous_ = previous; } void set_next(Block* next) { next_ = next; } Track* track() const { return track_; } void set_track(Track* track) { track_ = track; emit TrackChanged(track_); } bool is_enabled() const; void set_enabled(bool e); virtual void Retranslate() override; virtual void InvalidateCache(const TimeRange& range, const QString& from, int element = -1, InvalidateCacheOptions options = InvalidateCacheOptions()) override; static const QString kLengthInput; static void set_previous_next(Block *previous, Block *next); public slots: signals: void EnabledChanged(); void LengthChanged(); void PreviewChanged(); void TrackChanged(Track *track); protected: virtual void InputValueChangedEvent(const QString& input, int element) override; Block* previous_; Block* next_; private: void set_length_internal(const rational &length); rational in_point_; rational out_point_; Track* track_; rational last_length_; }; } #endif // BLOCK_H
2,717
C++
.h
102
23.392157
162
0.727661
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,407
subtitle.h
olive-editor_olive/app/node/block/subtitle/subtitle.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 SUBTITLEBLOCK_H #define SUBTITLEBLOCK_H #include "node/block/clip/clip.h" namespace olive { class SubtitleBlock : public ClipBlock { Q_OBJECT public: SubtitleBlock(); NODE_DEFAULT_FUNCTIONS(SubtitleBlock) virtual QString Name() const override; virtual QString id() const override; virtual QString Description() const override; virtual void Retranslate() override; static const QString kTextIn; QString GetText() const { return GetStandardValue(kTextIn).toString(); } void SetText(const QString &text) { SetStandardValue(kTextIn, text); } }; } #endif // SUBTITLEBLOCK_H
1,337
C++
.h
40
30.475
71
0.771697
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,408
clip.h
olive-editor_olive/app/node/block/clip/clip.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 CLIPBLOCK_H #define CLIPBLOCK_H #include "audio/audiovisualwaveform.h" #include "codec/decoder.h" #include "node/block/block.h" #include "node/input/multicam/multicamnode.h" #include "node/output/track/track.h" namespace olive { class ViewerOutput; /** * @brief Node that represents a block of Media */ class ClipBlock : public Block { Q_OBJECT public: ClipBlock(); NODE_DEFAULT_FUNCTIONS(ClipBlock) virtual QString Name() const override; virtual QString id() const override; virtual QString Description() const override; virtual void set_length_and_media_out(const rational &length) override; virtual void set_length_and_media_in(const rational &length) override; Track::Type GetTrackType() const { if (track()) { return track()->type(); } else { return Track::kNone; } } rational media_in() const; void set_media_in(const rational& media_in); bool IsAutocaching() const { return GetStandardValue(kAutoCacheInput).toBool(); } void SetAutocache(bool e); void DiscardCache(); virtual void InvalidateCache(const TimeRange& range, const QString& from, int element, InvalidateCacheOptions options) override; virtual TimeRange InputTimeAdjustment(const QString& input, int element, const TimeRange& input_time, bool clamp) const override; virtual TimeRange OutputTimeAdjustment(const QString& input, int element, const TimeRange& input_time) const override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; virtual void Retranslate() override; void RequestInvalidatedFromConnected(bool force_all = false, const TimeRange &intersect = TimeRange()); double speed() const { return GetStandardValue(kSpeedInput).toDouble(); } bool reverse() const { return GetStandardValue(kReverseInput).toBool(); } void set_reverse(bool e) { SetStandardValue(kReverseInput, e); } bool maintain_audio_pitch() const { return GetStandardValue(kMaintainAudioPitchInput).toBool(); } void set_maintain_audio_pitch(bool e) { SetStandardValue(kMaintainAudioPitchInput, e); } TransitionBlock* in_transition() { return in_transition_; } void set_in_transition(TransitionBlock* t) { in_transition_ = t; } TransitionBlock* out_transition() { return out_transition_; } void set_out_transition(TransitionBlock* t) { out_transition_ = t; } const QVector<Block*>& block_links() const { return block_links_; } FrameHashCache *connected_video_cache() const { if (Node *n = GetConnectedOutput(kBufferIn)) { return n->video_frame_cache(); } else { return nullptr; } } AudioPlaybackCache *connected_audio_cache() const { if (Node *n = GetConnectedOutput(kBufferIn)) { return n->audio_playback_cache(); } else { return nullptr; } } FrameHashCache *thumbnails() { if (Node *n = GetConnectedOutput(kBufferIn)) { return n->thumbnail_cache(); } else { return nullptr; } } AudioWaveformCache *waveform() { if (Node *n = GetConnectedOutput(kBufferIn)) { return n->waveform_cache(); } else { return nullptr; } } void AddCachePassthroughFrom(ClipBlock *other); ViewerOutput *connected_viewer() const { return connected_viewer_; } virtual TimeRange GetVideoCacheRange() const override { return TimeRange(0, length()); } virtual TimeRange GetAudioCacheRange() const override { return TimeRange(0, length()); } virtual void ConnectedToPreviewEvent() override; TimeRange media_range() const; /** * @brief Get currently set loop mode */ LoopMode loop_mode() const { return static_cast<LoopMode>(GetStandardValue(kLoopModeInput).toInt()); } void set_loop_mode(LoopMode l) { SetStandardValue(kLoopModeInput, int(l)); } MultiCamNode *FindMulticam(); static const QString kBufferIn; static const QString kMediaInInput; static const QString kSpeedInput; static const QString kReverseInput; static const QString kMaintainAudioPitchInput; static const QString kLoopModeInput; static const QString kAutoCacheInput; protected: virtual void LinkChangeEvent() override; virtual void InputConnectedEvent(const QString& input, int element, Node *output) override; virtual void InputDisconnectedEvent(const QString& input, int element, Node *output) override; virtual void InputValueChangedEvent(const QString& input, int element) override; private: enum SequenceToMediaTimeFlag { kSTMNone = 0x0, kSTMIgnoreReverse = 0x1, kSTMIgnoreSpeed = 0x2, kSTMIgnoreLoop = 0x4 }; rational SequenceToMediaTime(const rational& sequence_time, uint64_t flags = kSTMNone) const; rational MediaToSequenceTime(const rational& media_time) const; void RequestRangeFromConnected(const TimeRange &range); void RequestRangeForCache(PlaybackCache *cache, const TimeRange &max_range, const TimeRange &range, bool invalidate, bool request); void RequestInvalidatedForCache(PlaybackCache *cache, const TimeRange &max_range); bool GetAdjustedThumbnailRange(TimeRange *r) const; QVector<Block*> block_links_; TransitionBlock* in_transition_; TransitionBlock* out_transition_; ViewerOutput *connected_viewer_; private: rational last_media_in_; }; } #endif // TIMELINEBLOCK_H
6,137
C++
.h
190
28.610526
133
0.749065
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,409
transition.h
olive-editor_olive/app/node/block/transition/transition.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 TRANSITIONBLOCK_H #define TRANSITIONBLOCK_H #include "node/block/block.h" namespace olive { class ClipBlock; class TransitionBlock : public Block { Q_OBJECT public: TransitionBlock(); virtual void Retranslate() override; rational in_offset() const; rational out_offset() const; /** * @brief Return the "middle point" of the transition, relative to the transition * * Used to calculate in/out offsets. * * 0 means the center of the transition is right in the middle and the in and out offsets will * be equal. */ rational offset_center() const; void set_offset_center(const rational &r); void set_offsets_and_length(const rational &in_offset, const rational &out_offset); bool is_dual_transition() const { return connected_out_block() && connected_in_block(); } Block* connected_out_block() const; Block* connected_in_block() const; double GetTotalProgress(const double &time) const; double GetOutProgress(const double &time) const; double GetInProgress(const double &time) const; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; virtual void InvalidateCache(const TimeRange& range, const QString& from, int element = -1, InvalidateCacheOptions options = InvalidateCacheOptions()) override; static const QString kOutBlockInput; static const QString kInBlockInput; static const QString kCurveInput; static const QString kCenterInput; protected: virtual void ShaderJobEvent(const NodeValueRow &value, ShaderJob *job) const {} virtual void SampleJobEvent(const SampleBuffer &from_samples, const SampleBuffer &to_samples, SampleBuffer &out_samples, double time_in) const {} double TransformCurve(double linear) const; virtual void InputConnectedEvent(const QString& input, int element, Node *output) override; virtual void InputDisconnectedEvent(const QString& input, int element, Node *output) override; virtual TimeRange InputTimeAdjustment(const QString& input, int element, const TimeRange& input_time, bool clamp) const override; virtual TimeRange OutputTimeAdjustment(const QString& input, int element, const TimeRange& input_time) const override; private: enum CurveType { kLinear, kExponential, kLogarithmic }; double GetInternalTransitionTime(const double &time) const; void InsertTransitionTimes(AcceleratedJob* job, const double& time) const; ClipBlock* connected_out_block_; ClipBlock* connected_in_block_; }; } #endif // TRANSITIONBLOCK_H
3,269
C++
.h
74
40.905405
162
0.778797
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,410
diptocolortransition.h
olive-editor_olive/app/node/block/transition/diptocolor/diptocolortransition.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 DIPTOCOLORTRANSITION_H #define DIPTOCOLORTRANSITION_H #include "node/block/transition/transition.h" namespace olive { class DipToColorTransition : public TransitionBlock { Q_OBJECT public: DipToColorTransition(); NODE_DEFAULT_FUNCTIONS(DipToColorTransition) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual ShaderCode GetShaderCode(const ShaderRequest &request) const override; virtual void Retranslate() override; static const QString kColorInput; protected: virtual void ShaderJobEvent(const NodeValueRow &value, ShaderJob *job) const override; }; } #endif // DIPTOCOLORTRANSITION_H
1,475
C++
.h
36
38.194444
88
0.798733
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,411
crossdissolvetransition.h
olive-editor_olive/app/node/block/transition/crossdissolve/crossdissolvetransition.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 CROSSDISSOLVETRANSITION_H #define CROSSDISSOLVETRANSITION_H #include "node/block/transition/transition.h" namespace olive { class CrossDissolveTransition : public TransitionBlock { Q_OBJECT public: CrossDissolveTransition(); NODE_DEFAULT_FUNCTIONS(CrossDissolveTransition) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; //virtual void Retranslate() override; virtual ShaderCode GetShaderCode(const ShaderRequest &request) const override; protected: virtual void SampleJobEvent(const SampleBuffer &from_samples, const SampleBuffer &to_samples, SampleBuffer &out_samples, double time_in) const override; }; } #endif // CROSSDISSOLVETRANSITION_H
1,524
C++
.h
35
40.8
154
0.800272
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,412
gap.h
olive-editor_olive/app/node/block/gap/gap.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 GAPBLOCK_H #define GAPBLOCK_H #include "node/block/block.h" namespace olive { /** * @brief Node that represents nothing in its respective track for a certain period of time */ class GapBlock : public Block { Q_OBJECT public: GapBlock(); NODE_DEFAULT_FUNCTIONS(GapBlock) virtual QString Name() const override; virtual QString id() const override; virtual QString Description() const override; }; } #endif // TIMELINEBLOCK_H
1,165
C++
.h
33
32.727273
91
0.771914
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,413
trigonometry.h
olive-editor_olive/app/node/math/trigonometry/trigonometry.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 TRIGNODE_H #define TRIGNODE_H #include "node/node.h" namespace olive { class TrigonometryNode : public Node { Q_OBJECT public: TrigonometryNode(); NODE_DEFAULT_FUNCTIONS(TrigonometryNode) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual void Retranslate() override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; static const QString kMethodIn; static const QString kXIn; private: enum Operation { kOpSine, kOpCosine, kOpTangent, kOpArcSine, kOpArcCosine, kOpArcTangent, kOpHypSine, kOpHypCosine, kOpHypTangent }; }; } #endif // TRIGNODE_H
1,536
C++
.h
47
29.468085
114
0.771584
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,414
merge.h
olive-editor_olive/app/node/math/merge/merge.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 MERGENODE_H #define MERGENODE_H #include "node/node.h" namespace olive { class MergeNode : public Node { Q_OBJECT public: MergeNode(); NODE_DEFAULT_FUNCTIONS(MergeNode) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual void Retranslate() override; virtual ShaderCode GetShaderCode(const ShaderRequest &request) const override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; static const QString kBaseIn; static const QString kBlendIn; private: NodeInput* base_in_; NodeInput* blend_in_; }; } #endif // MERGENODE_H
1,476
C++
.h
39
35.025641
114
0.782087
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,415
math.h
olive-editor_olive/app/node/math/math/math.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 MATHNODE_H #define MATHNODE_H #include "mathbase.h" namespace olive { class MathNode : public MathNodeBase { Q_OBJECT public: MathNode(); NODE_DEFAULT_FUNCTIONS(MathNode) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual void Retranslate() override; virtual ShaderCode GetShaderCode(const ShaderRequest &request) const override; Operation GetOperation() const { return static_cast<Operation>(GetStandardValue(kMethodIn).toInt()); } void SetOperation(Operation o) { SetStandardValue(kMethodIn, o); } virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; virtual void ProcessSamples(const NodeValueRow &values, const SampleBuffer &input, SampleBuffer &output, int index) const override; static const QString kMethodIn; static const QString kParamAIn; static const QString kParamBIn; static const QString kParamCIn; }; } #endif // MATHNODE_H
1,818
C++
.h
47
35.659574
133
0.784
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,416
mathbase.h
olive-editor_olive/app/node/math/math/mathbase.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 MATHNODEBASE_H #define MATHNODEBASE_H #include "node/node.h" namespace olive { class MathNodeBase : public Node { public: MathNodeBase() = default; enum Operation { kOpAdd, kOpSubtract, kOpMultiply, kOpDivide, kOpPower }; static QString GetOperationName(Operation o); protected: enum Pairing { kPairNone = -1, kPairNumberNumber, kPairVecVec, kPairMatrixMatrix, kPairColorColor, kPairTextureTexture, kPairVecNumber, kPairMatrixVec, kPairNumberColor, kPairTextureNumber, kPairTextureColor, kPairTextureMatrix, kPairSampleSample, kPairSampleNumber, kPairCount }; class PairingCalculator { public: PairingCalculator(const NodeValueTable &table_a, const NodeValueTable &table_b); bool FoundMostLikelyPairing() const; Pairing GetMostLikelyPairing() const; const NodeValue& GetMostLikelyValueA() const; const NodeValue& GetMostLikelyValueB() const; private: static QVector<int> GetPairLikelihood(const NodeValueTable& table); Pairing most_likely_pairing_; NodeValue most_likely_value_a_; NodeValue most_likely_value_b_; }; template<typename T, typename U> static T PerformAll(Operation operation, T a, U b); template<typename T, typename U> static T PerformMultDiv(Operation operation, T a, U b); template<typename T, typename U> static T PerformAddSub(Operation operation, T a, U b); template<typename T, typename U> static T PerformMult(Operation operation, T a, U b); template<typename T, typename U> static T PerformAddSubMult(Operation operation, T a, U b); template<typename T, typename U> static T PerformAddSubMultDiv(Operation operation, T a, U b); static void PerformAllOnFloatBuffer(Operation operation, float *a, float b, int start, int end); #if defined(Q_PROCESSOR_X86) || defined(Q_PROCESSOR_ARM) static void PerformAllOnFloatBufferSSE(Operation operation, float *a, float b, int start, int end); #endif static QString GetShaderUniformType(const NodeValue::Type& type); static QString GetShaderVariableCall(const QString& input_id, const NodeValue::Type& type, const QString &coord_op = QString()); static QVector4D RetrieveVector(const NodeValue& val); static float RetrieveNumber(const NodeValue& val); static bool NumberIsNoOp(const Operation& op, const float& number); ShaderCode GetShaderCodeInternal(const QString &shader_id, const QString &param_a_in, const QString &param_b_in) const; void PushVector(NodeValueTable* output, NodeValue::Type type, const QVector4D& vec) const; void ValueInternal(Operation operation, Pairing pairing, const QString& param_a_in, const NodeValue &val_a, const QString& param_b_in, const NodeValue& val_b, const NodeGlobals &globals, NodeValueTable *output) const; void ProcessSamplesInternal(const NodeValueRow &values, Operation operation, const QString& param_a_in, const QString& param_b_in, const SampleBuffer &input, SampleBuffer &output, int index) const; }; } #endif // MATHNODEBASE_H
3,777
C++
.h
89
38.640449
219
0.770919
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,417
point.h
olive-editor_olive/app/node/gizmo/point.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 POINTGIZMO_H #define POINTGIZMO_H #include <QPointF> #include "draggable.h" namespace olive { class PointGizmo : public DraggableGizmo { Q_OBJECT public: enum Shape { kSquare, kCircle, kAnchorPoint }; explicit PointGizmo(const Shape &shape, bool smaller, QObject *parent = nullptr); explicit PointGizmo(const Shape &shape, QObject *parent = nullptr); explicit PointGizmo(QObject *parent = nullptr); const Shape &GetShape() const { return shape_; } void SetShape(const Shape &s) { shape_ = s; } const QPointF &GetPoint() const { return point_; } void SetPoint(const QPointF &pt) { point_ = pt; } bool GetSmaller() const { return smaller_; } void SetSmaller(bool e) { smaller_ = e; } virtual void Draw(QPainter *p) const override; QRectF GetClickingRect(const QTransform &t) const; private: static double GetStandardRadius(); QRectF GetDrawingRect(const QTransform &transform, double radius) const; Shape shape_; QPointF point_; bool smaller_; }; } #endif // POINTGIZMO_H
1,758
C++
.h
48
33.583333
83
0.751483
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,418
line.h
olive-editor_olive/app/node/gizmo/line.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 LINEGIZMO_H #define LINEGIZMO_H #include <QLineF> #include "gizmo.h" namespace olive { class LineGizmo : public NodeGizmo { Q_OBJECT public: LineGizmo(QObject *parent = nullptr); const QLineF &GetLine() const { return line_; } void SetLine(const QLineF &line) { line_ = line; } virtual void Draw(QPainter *p) const override; private: QLineF line_; }; } #endif // LINEGIZMO_H
1,117
C++
.h
32
32.28125
71
0.760524
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,419
path.h
olive-editor_olive/app/node/gizmo/path.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 PATHGIZMO_H #define PATHGIZMO_H #include <QPainterPath> #include "draggable.h" namespace olive { class PathGizmo : public DraggableGizmo { Q_OBJECT public: explicit PathGizmo(QObject *parent = nullptr); const QPainterPath &GetPath() const { return path_; } void SetPath(const QPainterPath &path) { path_ = path; } virtual void Draw(QPainter *p) const override; private: QPainterPath path_; }; } #endif // PATHGIZMO_H
1,159
C++
.h
32
33.59375
71
0.768677
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,420
draggable.h
olive-editor_olive/app/node/gizmo/draggable.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 DRAGGABLEGIZMO_H #define DRAGGABLEGIZMO_H #include "gizmo.h" #include "node/inputdragger.h" #include "undo/undocommand.h" namespace olive { class DraggableGizmo : public NodeGizmo { Q_OBJECT public: /// Changes what the X/Y coordinates emitted from HandleMovement specify enum DragValueBehavior { /// X/Y will be the exact mouse coordinates (in sequence pixels) kAbsolute, /// X/Y will be the movement since the last time HandleMovement was called kDeltaFromPrevious, /// X/Y will be the movement from the start of the drag kDeltaFromStart }; explicit DraggableGizmo(QObject *parent = nullptr); void DragStart(const NodeValueRow &row, double abs_x, double abs_y, const olive::core::rational &time); void DragMove(double x, double y, const Qt::KeyboardModifiers &modifiers); void DragEnd(olive::MultiUndoCommand *command); void AddInput(const NodeKeyframeTrackReference &input) { inputs_.append(input); draggers_.append(NodeInputDragger()); } QVector<NodeInputDragger> &GetDraggers() { return draggers_; } DragValueBehavior GetDragValueBehavior() const { return drag_value_behavior_; } void SetDragValueBehavior(DragValueBehavior d) { drag_value_behavior_ = d; } signals: void HandleStart(const olive::NodeValueRow &row, double x, double y, const olive::core::rational &time); void HandleMovement(double x, double y, const Qt::KeyboardModifiers &modifiers); private: QVector<NodeKeyframeTrackReference> inputs_; QVector<NodeInputDragger> draggers_; DragValueBehavior drag_value_behavior_; }; } #endif // DRAGGABLEGIZMO_H
2,338
C++
.h
58
37.103448
106
0.769743
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,421
gizmo.h
olive-editor_olive/app/node/gizmo/gizmo.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 NODEGIZMO_H #define NODEGIZMO_H #include <QObject> #include <QPainter> #include "node/globals.h" namespace olive { class NodeGizmo : public QObject { Q_OBJECT public: explicit NodeGizmo(QObject *parent = nullptr); virtual ~NodeGizmo() override; virtual void Draw(QPainter *p) const {} const NodeGlobals &GetGlobals() const { return globals_; } void SetGlobals(const NodeGlobals &globals) { globals_ = globals; } bool IsVisible() const { return visible_; } void SetVisible(bool e) { visible_ = e; } signals: private: NodeGlobals globals_; bool visible_; }; } #endif // NODEGIZMO_H
1,333
C++
.h
38
32.421053
71
0.759404
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,422
screen.h
olive-editor_olive/app/node/gizmo/screen.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 SCREENGIZMO_H #define SCREENGIZMO_H #include "draggable.h" namespace olive { class ScreenGizmo : public DraggableGizmo { Q_OBJECT public: explicit ScreenGizmo(QObject *parent = nullptr); }; } #endif // SCREENGIZMO_H
946
C++
.h
26
33.846154
71
0.777533
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,423
text.h
olive-editor_olive/app/node/gizmo/text.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 TEXTGIZMO_H #define TEXTGIZMO_H #include "gizmo.h" #include "node/param.h" namespace olive { class TextGizmo : public NodeGizmo { Q_OBJECT public: explicit TextGizmo(QObject *parent = nullptr); const QRectF &GetRect() const { return rect_; } void SetRect(const QRectF &r); const QString &GetHtml() const { return text_; } void SetHtml(const QString &t) { text_ = t; } void SetInput(const NodeKeyframeTrackReference &input) { input_ = input; } void UpdateInputHtml(const QString &s, const rational &time); Qt::Alignment GetVerticalAlignment() const { return valign_; } void SetVerticalAlignment(Qt::Alignment va); signals: void Activated(); void Deactivated(); void VerticalAlignmentChanged(Qt::Alignment va); void RectChanged(const QRectF &r); private: QRectF rect_; QString text_; NodeKeyframeTrackReference input_; Qt::Alignment valign_; }; } #endif // TEXTGIZMO_H
1,639
C++
.h
45
33.6
76
0.759542
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,424
polygon.h
olive-editor_olive/app/node/gizmo/polygon.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 POLYGONGIZMO_H #define POLYGONGIZMO_H #include <QPolygonF> #include "draggable.h" namespace olive { class PolygonGizmo : public DraggableGizmo { Q_OBJECT public: explicit PolygonGizmo(QObject *parent = nullptr); const QPolygonF &GetPolygon() const { return polygon_; } void SetPolygon(const QPolygonF &polygon) { polygon_ = polygon; } virtual void Draw(QPainter *p) const override; private: QPolygonF polygon_; }; } #endif // POLYGONGIZMO_H
1,183
C++
.h
32
34.34375
71
0.773568
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,425
colordifferencekey.h
olive-editor_olive/app/node/keying/colordifferencekey/colordifferencekey.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2019 Olive Team 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 COLORDIFFERENCEKEYNODE_H #define COLORDIFFERENCEKEYNODE_H #include "node/node.h" namespace olive { class ColorDifferenceKeyNode : public Node { public: ColorDifferenceKeyNode(); NODE_DEFAULT_FUNCTIONS(ColorDifferenceKeyNode) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual void Retranslate() override; virtual ShaderCode GetShaderCode(const ShaderRequest &request) const override; virtual void Value(const NodeValueRow& value, const NodeGlobals& globals, NodeValueTable* table) const override; static const QString kTextureInput; static const QString kGarbageMatteInput; static const QString kCoreMatteInput; static const QString kColorInput; static const QString kShadowsInput; static const QString kHighlightsInput; static const QString kMaskOnlyInput; }; } // namespace olive #endif // COLORDIFFERENCEKEYNODE_H
1,712
C++
.h
39
41.128205
114
0.801325
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,426
chromakey.h
olive-editor_olive/app/node/keying/chromakey/chromakey.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2019 Olive Team 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 CHROMAKEYNODE_H #define CHROMAKEYNODE_H #include "node/color/ociobase/ociobase.h" namespace olive { class ChromaKeyNode : public OCIOBaseNode { Q_OBJECT public: ChromaKeyNode(); NODE_DEFAULT_FUNCTIONS(ChromaKeyNode) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual void Retranslate() override; virtual void InputValueChangedEvent(const QString& input, int element) override; virtual ShaderCode GetShaderCode(const ShaderRequest &request) const override; virtual void Value(const NodeValueRow& value, const NodeGlobals& globals, NodeValueTable* table) const override; virtual void ConfigChanged() override; static const QString kColorInput; static const QString kInvertInput; static const QString kMaskOnlyInput; static const QString kUpperToleranceInput; static const QString kLowerToleranceInput; static const QString kGarbageMatteInput; static const QString kCoreMatteInput; static const QString kShadowsInput; static const QString kHighlightsInput; private: void GenerateProcessor(); }; } // namespace olive #endif // CHROMAKEYNODE_H
1,949
C++
.h
46
39.5
114
0.801697
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,427
despill.h
olive-editor_olive/app/node/keying/despill/despill.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2019 Olive Team 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 DESPILLNODE_H #define DESPILLNODE_H #include "node/node.h" #include "node/color/colormanager/colormanager.h" namespace olive { class DespillNode : public Node { public: DespillNode(); NODE_DEFAULT_FUNCTIONS(DespillNode) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual void Retranslate() override; virtual ShaderCode GetShaderCode(const ShaderRequest &request) const override; virtual void Value(const NodeValueRow& value, const NodeGlobals& globals, NodeValueTable* table) const override; static const QString kTextureInput; static const QString kColorInput; static const QString kMethodInput; static const QString kPreserveLuminanceInput; }; } // namespace olive #endif // DESPILLNODE_H
1,581
C++
.h
37
40
114
0.790986
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,428
cornerpindistortnode.h
olive-editor_olive/app/node/distort/cornerpin/cornerpindistortnode.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 CORNERPINDISTORTNODE_H #define CORNERPINDISTORTNODE_H #include <QVector2D> #include "node/gizmo/point.h" #include "node/gizmo/polygon.h" #include "node/inputdragger.h" #include "node/node.h" namespace olive { class CornerPinDistortNode : public Node { Q_OBJECT public: CornerPinDistortNode(); NODE_DEFAULT_FUNCTIONS(CornerPinDistortNode) virtual QString Name() const override { return tr("Corner Pin"); } virtual QString id() const override { return QStringLiteral("org.olivevideoeditor.Olive.cornerpin"); } virtual QVector<CategoryID> Category() const override { return {kCategoryDistort}; } virtual QString Description() const override { return tr("Distort the image by dragging the corners."); } virtual void Retranslate() override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; virtual ShaderCode GetShaderCode(const ShaderRequest &request) const override; virtual void UpdateGizmoPositions(const NodeValueRow &row, const NodeGlobals &globals) override; /** * @brief Convenience function - converts the 2D slider values from being * an offset to the actual pixel value. */ QPointF ValueToPixel(int value, const NodeValueRow &row, const QVector2D &resolution) const; static const QString kTextureInput; static const QString kPerspectiveInput; static const QString kTopLeftInput; static const QString kTopRightInput; static const QString kBottomRightInput; static const QString kBottomLeftInput; protected slots: virtual void GizmoDragMove(double x, double y, const Qt::KeyboardModifiers &modifiers) override; private: // Gizmo variables static const int kGizmoCornerCount = 4; PointGizmo *gizmo_resize_handle_[kGizmoCornerCount]; PolygonGizmo *gizmo_whole_rect_; }; } #endif // CORNERPINDISTORTNODE_H
2,600
C++
.h
69
34.666667
114
0.78483
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,429
rippledistortnode.h
olive-editor_olive/app/node/distort/ripple/rippledistortnode.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 RIPPLEDISTORTNODE_H #define RIPPLEDISTORTNODE_H #include "node/gizmo/point.h" #include "node/node.h" namespace olive { class RippleDistortNode : public Node { Q_OBJECT public: RippleDistortNode(); NODE_DEFAULT_FUNCTIONS(RippleDistortNode) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual void Retranslate() override; virtual ShaderCode GetShaderCode(const ShaderRequest &request) const override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; virtual void UpdateGizmoPositions(const NodeValueRow &row, const NodeGlobals &globals) override; static const QString kTextureInput; static const QString kEvolutionInput; static const QString kIntensityInput; static const QString kFrequencyInput; static const QString kPositionInput; static const QString kStretchInput; protected slots: virtual void GizmoDragMove(double x, double y, const Qt::KeyboardModifiers &modifiers) override; private: PointGizmo *gizmo_; }; } #endif // RIPPLEDISTORTNODE_H
1,915
C++
.h
46
38.847826
114
0.800433
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,430
transformdistortnode.h
olive-editor_olive/app/node/distort/transform/transformdistortnode.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 TRANSFORMDISTORTNODE_H #define TRANSFORMDISTORTNODE_H #include "node/generator/matrix/matrix.h" #include "node/gizmo/point.h" #include "node/gizmo/polygon.h" #include "node/gizmo/screen.h" namespace olive { class TransformDistortNode : public MatrixGenerator { Q_OBJECT public: TransformDistortNode(); NODE_DEFAULT_FUNCTIONS(TransformDistortNode) virtual QString Name() const override { return tr("Transform"); } virtual QString ShortName() const override { // Override MatrixGenerator's short name "Ortho" return Name(); } virtual QString id() const override { return QStringLiteral("org.olivevideoeditor.Olive.transform"); } virtual QVector<CategoryID> Category() const override { return {kCategoryDistort}; } virtual QString Description() const override { return tr("Transform an image in 2D space. Equivalent to multiplying by an orthographic matrix."); } virtual void Retranslate() override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; virtual ShaderCode GetShaderCode(const ShaderRequest &request) const override; enum AutoScaleType { kAutoScaleNone, kAutoScaleFit, kAutoScaleFill, kAutoScaleStretch }; static QMatrix4x4 AdjustMatrixByResolutions(const QMatrix4x4& mat, const QVector2D& sequence_res, const QVector2D& texture_res, const QVector2D& offset, AutoScaleType autoscale_type = kAutoScaleNone); virtual void UpdateGizmoPositions(const NodeValueRow &row, const NodeGlobals &globals) override; virtual QTransform GizmoTransformation(const NodeValueRow &row, const NodeGlobals &globals) const override; static const QString kParentInput; static const QString kTextureInput; static const QString kAutoscaleInput; static const QString kInterpolationInput; protected slots: virtual void GizmoDragStart(const olive::NodeValueRow &row, double x, double y, const olive::rational &time) override; virtual void GizmoDragMove(double x, double y, const Qt::KeyboardModifiers &modifiers) override; private: static QPointF CreateScalePoint(double x, double y, const QPointF& half_res, const QMatrix4x4& mat); QMatrix4x4 GenerateAutoScaledMatrix(const QMatrix4x4 &generated_matrix, const NodeValueRow &db, const NodeGlobals &globals, const VideoParams &texture_params) const; bool IsAScaleGizmo(NodeGizmo *g) const; // Gizmo variables double gizmo_start_angle_; QTransform gizmo_inverted_transform_; QPointF gizmo_anchor_pt_; bool gizmo_scale_uniform_; double gizmo_last_angle_; double gizmo_last_alt_angle_; int gizmo_rotate_wrap_; enum RotationDirection { kDirectionNone, kDirectionPositive, // Clockwise kDirectionNegative // Counter-clockwise }; static RotationDirection GetDirectionFromAngles(double last, double current); RotationDirection gizmo_rotate_last_dir_; RotationDirection gizmo_rotate_last_alt_dir_; enum GizmoScaleType { kGizmoScaleXOnly, kGizmoScaleYOnly, kGizmoScaleBoth }; GizmoScaleType gizmo_scale_axes_; QVector2D gizmo_scale_anchor_; // Gizmo on screen object storage PointGizmo *point_gizmo_[kGizmoScaleCount]; PointGizmo *anchor_gizmo_; PolygonGizmo *poly_gizmo_; ScreenGizmo *rotation_gizmo_; }; } #endif // TRANSFORMDISTORTNODE_H
4,238
C++
.h
106
35
167
0.752686
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,431
tiledistortnode.h
olive-editor_olive/app/node/distort/tile/tiledistortnode.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 TILEDISTORTNODE_H #define TILEDISTORTNODE_H #include "node/gizmo/point.h" #include "node/node.h" namespace olive { class TileDistortNode : public Node { Q_OBJECT public: TileDistortNode(); NODE_DEFAULT_FUNCTIONS(TileDistortNode) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual void Retranslate() override; virtual ShaderCode GetShaderCode(const ShaderRequest &request) const override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; virtual void UpdateGizmoPositions(const NodeValueRow &row, const NodeGlobals &globals) override; static const QString kTextureInput; static const QString kScaleInput; static const QString kPositionInput; static const QString kAnchorInput; static const QString kMirrorXInput; static const QString kMirrorYInput; protected slots: virtual void GizmoDragMove(double x, double y, const Qt::KeyboardModifiers &modifiers) override; private: enum Anchor { kTopLeft, kTopCenter, kTopRight, kMiddleLeft, kMiddleCenter, kMiddleRight, kBottomLeft, kBottomCenter, kBottomRight }; PointGizmo *gizmo_; }; } #endif // TILEDISTORTNODE_H
2,068
C++
.h
57
33.122807
114
0.78794
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,432
cropdistortnode.h
olive-editor_olive/app/node/distort/crop/cropdistortnode.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 CROPDISTORTNODE_H #define CROPDISTORTNODE_H #include <QVector2D> #include "node/gizmo/point.h" #include "node/gizmo/polygon.h" #include "node/inputdragger.h" #include "node/node.h" namespace olive { class CropDistortNode : public Node { Q_OBJECT public: CropDistortNode(); NODE_DEFAULT_FUNCTIONS(CropDistortNode) virtual QString Name() const override { return tr("Crop"); } virtual QString id() const override { return QStringLiteral("org.olivevideoeditor.Olive.crop"); } virtual QVector<CategoryID> Category() const override { return {kCategoryDistort}; } virtual QString Description() const override { return tr("Crop the edges of an image."); } virtual void Retranslate() override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; virtual ShaderCode GetShaderCode(const ShaderRequest &request) const override; virtual void UpdateGizmoPositions(const NodeValueRow &row, const NodeGlobals &globals) override; static const QString kTextureInput; static const QString kLeftInput; static const QString kTopInput; static const QString kRightInput; static const QString kBottomInput; static const QString kFeatherInput; protected slots: virtual void GizmoDragMove(double delta_x, double delta_y, const Qt::KeyboardModifiers &modifiers) override; private: void CreateCropSideInput(const QString& id); // Gizmo variables PointGizmo *point_gizmo_[kGizmoScaleCount]; PolygonGizmo *poly_gizmo_; QVector2D temp_resolution_; }; } #endif // CROPDISTORTNODE_H
2,329
C++
.h
65
32.861538
114
0.782842
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,433
swirldistortnode.h
olive-editor_olive/app/node/distort/swirl/swirldistortnode.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 SWIRLDISTORTNODE_H #define SWIRLDISTORTNODE_H #include "node/gizmo/point.h" #include "node/node.h" namespace olive { class SwirlDistortNode : public Node { Q_OBJECT public: SwirlDistortNode(); NODE_DEFAULT_FUNCTIONS(SwirlDistortNode) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual void Retranslate() override; virtual ShaderCode GetShaderCode(const ShaderRequest &request) const override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; virtual void UpdateGizmoPositions(const NodeValueRow &row, const NodeGlobals &globals) override; static const QString kTextureInput; static const QString kRadiusInput; static const QString kAngleInput; static const QString kPositionInput; protected slots: virtual void GizmoDragMove(double x, double y, const Qt::KeyboardModifiers &modifiers) override; private: PointGizmo *gizmo_; }; } #endif // SWIRLDISTORTNODE_H
1,824
C++
.h
44
38.681818
114
0.797159
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,434
mask.h
olive-editor_olive/app/node/distort/mask/mask.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 MASKDISTORTNODE_H #define MASKDISTORTNODE_H #include "node/generator/polygon/polygon.h" namespace olive { class MaskDistortNode : public PolygonGenerator { Q_OBJECT public: MaskDistortNode(); NODE_DEFAULT_FUNCTIONS(MaskDistortNode) virtual QString Name() const override { return tr("Mask"); } virtual QString id() const override { return QStringLiteral("org.olivevideoeditor.Olive.mask"); } virtual QVector<CategoryID> Category() const override { return {kCategoryDistort}; } virtual QString Description() const override { return tr("Apply a polygonal mask."); } virtual ShaderCode GetShaderCode(const ShaderRequest &request) const override; virtual void Retranslate() override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; static const QString kInvertInput; static const QString kFeatherInput; }; } #endif // MASKDISTORTNODE_H
1,687
C++
.h
48
32.041667
114
0.776885
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19,435
flipdistortnode.h
olive-editor_olive/app/node/distort/flip/flipdistortnode.h
/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team 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 FLIPDISTORTNODE_H #define FLIPDISTORTNODE_H #include "node/node.h" namespace olive { class FlipDistortNode : public Node { Q_OBJECT public: FlipDistortNode(); NODE_DEFAULT_FUNCTIONS(FlipDistortNode) virtual QString Name() const override; virtual QString id() const override; virtual QVector<CategoryID> Category() const override; virtual QString Description() const override; virtual void Retranslate() override; virtual ShaderCode GetShaderCode(const ShaderRequest &request) const override; virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; static const QString kTextureInput; static const QString kHorizontalInput; static const QString kVerticalInput; }; } #endif // FLIPDISTORTNODE_H
1,507
C++
.h
37
37.918919
114
0.793531
olive-editor/olive
8,144
552
131
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false