Loading...
Searching...
No Matches
score-plugin-gfx/Gfx/Video/Process.hpp
1#pragma once
2#include <Process/Drop/ProcessDropHandler.hpp>
3#include <Process/GenericProcessFactory.hpp>
4#include <Process/Process.hpp>
5
6#include <Gfx/CommandFactory.hpp>
7#include <Gfx/Graph/Scale.hpp>
8#include <Gfx/Video/Metadata.hpp>
9#include <Library/LibraryInterface.hpp>
10#include <Video/VideoEnums.hpp>
11#include <Video/VideoDecoder.hpp>
12
13#include <score/command/PropertyCommand.hpp>
14
15#include <score_plugin_gfx_export.h>
16namespace Gfx::Video
17{
18using video_decoder = ::Video::VideoDecoder;
19class SCORE_PLUGIN_GFX_EXPORT Model final : public Process::ProcessModel
20{
21 SCORE_SERIALIZE_FRIENDS
22 PROCESS_METADATA_IMPL(Gfx::Video::Model)
23 W_OBJECT(Model)
24
25public:
26 Model(
27 const TimeVal& duration, const QString& path, const Id<Process::ProcessModel>& id,
28 QObject* parent);
29
30 template <typename Impl>
31 Model(Impl& vis, QObject* parent)
32 : Process::ProcessModel{vis, parent}
33 {
34 vis.writeTo(*this);
35 }
36
37 ~Model() override;
38
39 std::shared_ptr<video_decoder> makeDecoder() const noexcept;
40
41 QString absolutePath() const noexcept;
42 QString path() const noexcept { return m_path; }
43 void setPath(const QString& f);
44 void pathChanged(const QString& f) W_SIGNAL(pathChanged, f);
45
46 void mapExternalFiles(Process::ExternalFileMap& map) override;
47
48 double nativeTempo() const noexcept;
49 void setNativeTempo(double);
50 void nativeTempoChanged(double t) W_SIGNAL(nativeTempoChanged, t);
51
52 score::gfx::ScaleMode scaleMode() const noexcept;
53 void setScaleMode(score::gfx::ScaleMode);
54 void scaleModeChanged(score::gfx::ScaleMode t) W_SIGNAL(scaleModeChanged, t);
55
56 score::gfx::PlaybackMode playbackMode() const noexcept;
57 void setPlaybackMode(score::gfx::PlaybackMode);
58 void playbackModeChanged(score::gfx::PlaybackMode t) W_SIGNAL(playbackModeChanged, t);
59
60 ::Video::OutputFormat outputFormat() const noexcept;
61 void setOutputFormat(::Video::OutputFormat);
62 void outputFormatChanged(::Video::OutputFormat t) W_SIGNAL(outputFormatChanged, t);
63
64 ::Video::Tonemap tonemap() const noexcept;
65 void setTonemap(::Video::Tonemap);
66 void tonemapChanged(::Video::Tonemap t) W_SIGNAL(tonemapChanged, t);
67
68 bool ignoreTempo() const noexcept;
69 void setIgnoreTempo(bool);
70 void ignoreTempoChanged(bool t) W_SIGNAL(ignoreTempoChanged, t);
71
72 PROPERTY(
74 scaleMode READ scaleMode WRITE setScaleMode NOTIFY scaleModeChanged)
75 PROPERTY(
77 playbackMode READ playbackMode WRITE setPlaybackMode NOTIFY playbackModeChanged)
78 PROPERTY(
79 ::Video::OutputFormat,
80 outputFormat READ outputFormat WRITE setOutputFormat NOTIFY outputFormatChanged)
81 PROPERTY(
82 ::Video::Tonemap,
83 tonemap READ tonemap WRITE setTonemap NOTIFY tonemapChanged)
84
85 PROPERTY(QString, path READ path WRITE setPath NOTIFY pathChanged)
86 PROPERTY(
87 double,
88 nativeTempo READ nativeTempo WRITE setNativeTempo NOTIFY nativeTempoChanged,
89 W_Final)
90 PROPERTY(
91 bool, ignoreTempo READ ignoreTempo WRITE setIgnoreTempo NOTIFY ignoreTempoChanged,
92 W_Final)
93
94private:
95 QString m_path;
96 score::gfx::ScaleMode m_scaleMode{};
97 score::gfx::PlaybackMode m_playbackMode{};
98 ::Video::OutputFormat m_outputFormat{};
99 ::Video::Tonemap m_tonemap{};
100 double m_nativeTempo{};
101 bool m_ignoreTempo{};
102};
103
105
107{
108 SCORE_CONCRETE("be66d573-571f-4c33-9f60-0791f53c7266")
109
110 QSet<QString> acceptedFiles() const noexcept override;
111};
112
114{
115 SCORE_CONCRETE("12d1ed39-0fac-43da-8520-b7e32f9fad7d")
116
117public:
118 QSet<QString> mimeTypes() const noexcept override;
119 QSet<QString> fileExtensions() const noexcept override;
120 void dropPath(
121 std::vector<ProcessDrop>& vec, const score::FilePath& filename,
122 const score::DocumentContext& ctx) const noexcept override;
123};
124
125}
126
127PROPERTY_COMMAND_T(Gfx, ChangeVideo, Video::Model::p_path, "Change video")
128SCORE_COMMAND_DECL_T(Gfx::ChangeVideo)
129PROPERTY_COMMAND_T(Gfx, ChangeTempo, Video::Model::p_nativeTempo, "Change video tempo")
130SCORE_COMMAND_DECL_T(Gfx::ChangeTempo)
131PROPERTY_COMMAND_T(
132 Gfx, ChangeIgnoreTempo, Video::Model::p_ignoreTempo, "Ignore video tempo")
133SCORE_COMMAND_DECL_T(Gfx::ChangeIgnoreTempo)
134PROPERTY_COMMAND_T(
135 Gfx, ChangeVideoScaleMode, Video::Model::p_scaleMode, "Video scale mode")
136SCORE_COMMAND_DECL_T(Gfx::ChangeVideoScaleMode)
137PROPERTY_COMMAND_T(
138 Gfx, ChangePlaybackMode, Video::Model::p_playbackMode, "Video playback mode")
139SCORE_COMMAND_DECL_T(Gfx::ChangePlaybackMode)
140PROPERTY_COMMAND_T(
141 Gfx, ChangeOutputFormat, Video::Model::p_outputFormat, "Video output format")
142SCORE_COMMAND_DECL_T(Gfx::ChangeOutputFormat)
143PROPERTY_COMMAND_T(
144 Gfx, ChangeTonemap, Video::Model::p_tonemap, "Video tonemap")
145SCORE_COMMAND_DECL_T(Gfx::ChangeTonemap)
146
147W_REGISTER_ARGTYPE(score::gfx::ScaleMode)
148W_REGISTER_ARGTYPE(score::gfx::PlaybackMode)
149W_REGISTER_ARGTYPE(::Video::OutputFormat)
150W_REGISTER_ARGTYPE(::Video::Tonemap)
Definition score-plugin-gfx/Gfx/Video/Process.hpp:114
Definition score-plugin-gfx/Gfx/Video/Process.hpp:107
Definition score-plugin-gfx/Gfx/Video/Process.hpp:20
Definition LibraryInterface.hpp:26
Collects — and in the same pass rewrites — the files a document references.
Definition ExternalFiles.hpp:80
Definition ProcessDropHandler.hpp:25
Definition GenericProcessFactory.hpp:15
The Process class.
Definition score-lib-process/Process/Process.hpp:75
Definition VideoDecoder.hpp:28
The id_base_t class.
Definition Identifier.hpp:59
Binds the rendering pipeline to ossia processes.
Definition AssetTable.cpp:7
PlaybackMode
How to choose the video renderer.
Definition Scale.hpp:21
ScaleMode
How to resize a texture to adapt it to a viewport.
Definition Scale.hpp:10
Base toolkit upon which the software is built.
Definition Application.cpp:116
Definition TimeValue.hpp:21
Definition DocumentContext.hpp:18
Definition FilePath.hpp:43