Krita Source Code Documentation
Loading...
Searching...
No Matches
KisPlaybackEngine.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 SPDX-FileCopyrightText: 2022 Emmet O'Neill <emmetoneill.pdx@gmail.com>
3 SPDX-FileCopyrightText: 2022 Eoin O'Neill <eoinoneill1991@gmail.com>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef KISPLAYBACKENGINE_H
9#define KISPLAYBACKENGINE_H
10
12#include <QObject>
13
14#include <kritaui_export.h>
15
23 SEEK_PUSH_AUDIO = 1, // Whether we should be pushing audio or not. Used to prevent double-takes on scrubbing.
24 SEEK_FINALIZE = 1 << 1 // Force reload of KisImage to specific frame, ignore caching ability.
25};
26
27Q_DECLARE_FLAGS(SeekOptionFlags, SeekOption)
28Q_DECLARE_OPERATORS_FOR_FLAGS(SeekOptionFlags)
29
30
31
42class KRITAUI_EXPORT KisPlaybackEngine : public QObject, public KoCanvasObserverBase
43{
44 Q_OBJECT
45public:
46 KisPlaybackEngine(QObject* parent = nullptr);
48
50 qreal expectedFps {0.0};
51 qreal realFps {0.0};
52 qreal droppedFramesPortion {0.0};
53 };
54
55public Q_SLOTS:
56 // Basic transport controls...
57 virtual void play();
58 virtual void pause();
59 virtual void playPause();
60 virtual void stop();
61
62 virtual void seek( int frameIndex, SeekOptionFlags options = SEEK_FINALIZE | SEEK_PUSH_AUDIO ) = 0;
63 virtual void previousFrame();
64 virtual void nextFrame();
65 virtual void previousKeyframe();
66 virtual void nextKeyframe();
67 virtual void firstFrame();
68 virtual void lastFrame();
69
77 virtual void previousMatchingKeyframe();
78 virtual void nextMatchingKeyframe();
79
86 virtual void previousUnfilteredKeyframe();
87 virtual void nextUnfilteredKeyframe();
88
89 // Audio controls...
90 virtual void setMute(bool val) = 0;
91 virtual bool isMute() = 0;
92
93 virtual void setDropFramesMode(bool value);
94 bool dropFrames() const;
95
96 virtual bool supportsAudio() = 0;
98
99 virtual PlaybackStats playbackStatistics() const = 0;
100
101Q_SIGNALS:
103
104protected:
105 class KisCanvas2* activeCanvas() const;
106 int frameWrap(int frame, int startFrame, int endFrame);
107
108protected Q_SLOTS:
109 virtual void setCanvas(KoCanvasBase* p_canvas) override;
110 virtual void unsetCanvas() override;
111
112private:
117 void moveActiveFrameBy(int frames);
118
119 // Used by previous/next unfiltered keyframe functions...
120 void nextKeyframeWithColor(int color);
121 void nextKeyframeWithColor(const QSet<int> &validColors);
122 void previousKeyframeWithColor(int color);
123 void previousKeyframeWithColor(const QSet<int> &validColors);
124
125private:
126 struct Private;
127 QScopedPointer<Private> m_d;
128};
129
130#endif // KISPLAYBACKENGINE_H
float value(const T *src, size_t ch)
SeekOption
The SeekOption enum represents additional behaviors associated with seeking to a new frame....
@ SEEK_NONE
@ SEEK_PUSH_AUDIO
@ SEEK_FINALIZE
Q_DECLARE_FLAGS(KisUpdaterContextSnapshotEx, KisUpdaterContextSnapshotExTag)
Krita's base animation playback engine for producing image frame changes and associated audio.
virtual bool isMute()=0
virtual bool supportsAudio()=0
void sigDropFramesModeChanged(bool value)
virtual bool supportsVariablePlaybackSpeed()=0
QScopedPointer< Private > m_d
virtual PlaybackStats playbackStatistics() const =0
virtual void seek(int frameIndex, SeekOptionFlags options=SEEK_FINALIZE|SEEK_PUSH_AUDIO)=0
virtual void setMute(bool val)=0
Q_DECLARE_OPERATORS_FOR_FLAGS(KisBaseRectsWalker::SubtreeVisitFlags)