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>
14namespace Gfx::Video
15{
16using video_decoder = ::Video::VideoDecoder;
17class Model final : public Process::ProcessModel
18{
19 SCORE_SERIALIZE_FRIENDS
20 PROCESS_METADATA_IMPL(Gfx::Video::Model)
21 W_OBJECT(Model)
22
23public:
24 Model(
25 const TimeVal& duration, const QString& path, const Id<Process::ProcessModel>& id,
26 QObject* parent);
27
28 template <typename Impl>
29 Model(Impl& vis, QObject* parent)
30 : Process::ProcessModel{vis, parent}
31 {
32 vis.writeTo(*this);
33 }
34
35 ~Model() override;
36
37 std::shared_ptr<video_decoder> makeDecoder() const noexcept;
38
39 QString absolutePath() const noexcept;
40 QString path() const noexcept { return m_path; }
41 void setPath(const QString& f);
42 void pathChanged(const QString& f) W_SIGNAL(pathChanged, f);
43
44 double nativeTempo() const noexcept;
45 void setNativeTempo(double);
46 void nativeTempoChanged(double t) W_SIGNAL(nativeTempoChanged, t);
47
48 score::gfx::ScaleMode scaleMode() const noexcept;
49 void setScaleMode(score::gfx::ScaleMode);
50 void scaleModeChanged(score::gfx::ScaleMode t) W_SIGNAL(scaleModeChanged, t);
51
52 score::gfx::PlaybackMode playbackMode() const noexcept;
53 void setPlaybackMode(score::gfx::PlaybackMode);
54 void playbackModeChanged(score::gfx::PlaybackMode t) W_SIGNAL(playbackModeChanged, t);
55
56 ::Video::OutputFormat outputFormat() const noexcept;
57 void setOutputFormat(::Video::OutputFormat);
58 void outputFormatChanged(::Video::OutputFormat t) W_SIGNAL(outputFormatChanged, t);
59
60 ::Video::Tonemap tonemap() const noexcept;
61 void setTonemap(::Video::Tonemap);
62 void tonemapChanged(::Video::Tonemap t) W_SIGNAL(tonemapChanged, t);
63
64 bool ignoreTempo() const noexcept;
65 void setIgnoreTempo(bool);
66 void ignoreTempoChanged(bool t) W_SIGNAL(ignoreTempoChanged, t);
67
68 PROPERTY(
70 scaleMode READ scaleMode WRITE setScaleMode NOTIFY scaleModeChanged)
71 PROPERTY(
73 playbackMode READ playbackMode WRITE setPlaybackMode NOTIFY playbackModeChanged)
74 PROPERTY(
75 ::Video::OutputFormat,
76 outputFormat READ outputFormat WRITE setOutputFormat NOTIFY outputFormatChanged)
77 PROPERTY(
78 ::Video::Tonemap,
79 tonemap READ tonemap WRITE setTonemap NOTIFY tonemapChanged)
80
81 PROPERTY(QString, path READ path WRITE setPath NOTIFY pathChanged)
82 PROPERTY(
83 double,
84 nativeTempo READ nativeTempo WRITE setNativeTempo NOTIFY nativeTempoChanged,
85 W_Final)
86 PROPERTY(
87 bool, ignoreTempo READ ignoreTempo WRITE setIgnoreTempo NOTIFY ignoreTempoChanged,
88 W_Final)
89
90private:
91 QString m_path;
92 score::gfx::ScaleMode m_scaleMode{};
93 score::gfx::PlaybackMode m_playbackMode{};
94 ::Video::OutputFormat m_outputFormat{};
95 ::Video::Tonemap m_tonemap{};
96 double m_nativeTempo{};
97 bool m_ignoreTempo{};
98};
99
101
103{
104 SCORE_CONCRETE("be66d573-571f-4c33-9f60-0791f53c7266")
105
106 QSet<QString> acceptedFiles() const noexcept override;
107};
108
110{
111 SCORE_CONCRETE("12d1ed39-0fac-43da-8520-b7e32f9fad7d")
112
113public:
114 QSet<QString> mimeTypes() const noexcept override;
115 QSet<QString> fileExtensions() const noexcept override;
116 void dropPath(
117 std::vector<ProcessDrop>& vec, const score::FilePath& filename,
118 const score::DocumentContext& ctx) const noexcept override;
119};
120
121}
122
123PROPERTY_COMMAND_T(Gfx, ChangeVideo, Video::Model::p_path, "Change video")
124SCORE_COMMAND_DECL_T(Gfx::ChangeVideo)
125PROPERTY_COMMAND_T(Gfx, ChangeTempo, Video::Model::p_nativeTempo, "Change video tempo")
126SCORE_COMMAND_DECL_T(Gfx::ChangeTempo)
127PROPERTY_COMMAND_T(
128 Gfx, ChangeIgnoreTempo, Video::Model::p_ignoreTempo, "Ignore video tempo")
129SCORE_COMMAND_DECL_T(Gfx::ChangeIgnoreTempo)
130PROPERTY_COMMAND_T(
131 Gfx, ChangeVideoScaleMode, Video::Model::p_scaleMode, "Video scale mode")
132SCORE_COMMAND_DECL_T(Gfx::ChangeVideoScaleMode)
133PROPERTY_COMMAND_T(
134 Gfx, ChangePlaybackMode, Video::Model::p_playbackMode, "Video playback mode")
135SCORE_COMMAND_DECL_T(Gfx::ChangePlaybackMode)
136PROPERTY_COMMAND_T(
137 Gfx, ChangeOutputFormat, Video::Model::p_outputFormat, "Video output format")
138SCORE_COMMAND_DECL_T(Gfx::ChangeOutputFormat)
139PROPERTY_COMMAND_T(
140 Gfx, ChangeTonemap, Video::Model::p_tonemap, "Video tonemap")
141SCORE_COMMAND_DECL_T(Gfx::ChangeTonemap)
142
143W_REGISTER_ARGTYPE(score::gfx::ScaleMode)
144W_REGISTER_ARGTYPE(score::gfx::PlaybackMode)
145W_REGISTER_ARGTYPE(::Video::OutputFormat)
146W_REGISTER_ARGTYPE(::Video::Tonemap)
Definition score-plugin-gfx/Gfx/Video/Process.hpp:110
Definition score-plugin-gfx/Gfx/Video/Process.hpp:103
Definition score-plugin-gfx/Gfx/Video/Process.hpp:18
Definition LibraryInterface.hpp:22
Definition ProcessDropHandler.hpp:25
Definition GenericProcessFactory.hpp:15
The Process class.
Definition score-lib-process/Process/Process.hpp:62
Definition VideoDecoder.hpp:28
The id_base_t class.
Definition Identifier.hpp:59
Binds the rendering pipeline to ossia processes.
Definition CameraDevice.cpp:30
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:112
Definition TimeValue.hpp:21
Definition DocumentContext.hpp:18
Definition FilePath.hpp:25