Krita Source Code Documentation
Loading...
Searching...
No Matches
KisPlaybackEngineMLT::Private Struct Reference

Public Member Functions

KisCanvas2activeCanvas ()
 
PlaybackMode activePlaybackMode ()
 
QSharedPointer< Mlt::Producer > activeProducer ()
 
void cleanupConsumers ()
 
bool dropFrames () const
 
void initializeConsumers ()
 
 Private (KisPlaybackEngineMLT *p_self)
 
void pushAudio (int frame)
 
 ~Private ()
 

Public Attributes

QMap< KisCanvas2 *, QSharedPointer< Mlt::Producer > > canvasProducers
 
FrameRenderingStats frameStats
 
FrameWaitingInterface frameWaitingInterface
 
bool mute
 
double playbackSpeed
 
QScopedPointer< Mlt::Profile > profile
 
QScopedPointer< Mlt::Consumer > pullConsumer
 
QScopedPointer< Mlt::Event > pullConsumerConnection
 
QScopedPointer< Mlt::PushConsumer > pushConsumer
 
QScopedPointer< Mlt::Repository > repository
 
QScopedPointer< KisSignalCompressorWithParam< int > > sigPushAudioCompressor
 
QScopedPointer< KisSignalCompressorWithParam< double > > sigSetPlaybackSpeed
 

Private Attributes

KisPlaybackEngineMLTm_self
 

Detailed Description

Definition at line 148 of file KisPlaybackEngineMLT.cpp.

Constructor & Destructor Documentation

◆ Private()

KisPlaybackEngineMLT::Private::Private ( KisPlaybackEngineMLT * p_self)
inline

Definition at line 150 of file KisPlaybackEngineMLT.cpp.

151 : m_self(p_self)
152 , playbackSpeed(1.0)
153 , mute(false)
154 {
155 qDebug() << "Initializing MLT Animation Playback Engine. MLT ver: " << QString(mlt_version_get_string());
156
157 // Initialize MLT...
158 repository.reset(Mlt::Factory::init());
159
160#ifdef MLT_LOG_REDIRECTION
161 mlt_log_set_level(MLT_LOG_VERBOSE);
162 mlt_log_set_callback(&qt_redirection_callback);
163#endif /* MLT_LOG_REDIRECTION */
164
165 // Register our backend plugin
167
168 profile.reset(new Mlt::Profile());
169 profile->set_frame_rate(24, 1);
170
171 {
172 std::function<void (int)> callback(std::bind(&Private::pushAudio, this, std::placeholders::_1));
175 );
176 }
177
178 {
179 std::function<void (const double)> callback(std::bind(&KisPlaybackEngineMLT::throttledSetSpeed, m_self, std::placeholders::_1));
182 );
183 }
184
186 }
void registerKritaMLTProducer(Mlt::Repository *repository)
const float SCRUB_AUDIO_SECONDS
void throttledSetSpeed(const double speed)
throttledSetSpeed
typedef void(QOPENGLF_APIENTRYP PFNGLINVALIDATEBUFFERDATAPROC)(GLuint buffer)
QScopedPointer< KisSignalCompressorWithParam< double > > sigSetPlaybackSpeed
QScopedPointer< KisSignalCompressorWithParam< int > > sigPushAudioCompressor
QScopedPointer< Mlt::Profile > profile
QScopedPointer< Mlt::Repository > repository

References KisSignalCompressor::FIRST_ACTIVE, initializeConsumers(), m_self, KisSignalCompressor::POSTPONE, profile, pushAudio(), registerKritaMLTProducer(), repository, SCRUB_AUDIO_SECONDS, sigPushAudioCompressor, sigSetPlaybackSpeed, KisPlaybackEngineMLT::throttledSetSpeed(), and void().

◆ ~Private()

KisPlaybackEngineMLT::Private::~Private ( )
inline

Definition at line 188 of file KisPlaybackEngineMLT.cpp.

188 {
190 repository.reset();
191 Mlt::Factory::close();
192 }

References cleanupConsumers(), and repository.

Member Function Documentation

◆ activeCanvas()

KisCanvas2 * KisPlaybackEngineMLT::Private::activeCanvas ( )
inline

Definition at line 237 of file KisPlaybackEngineMLT.cpp.

237 {
238 return m_self->activeCanvas();
239 }
class KisCanvas2 * activeCanvas() const

References KisPlaybackEngine::activeCanvas(), and m_self.

◆ activePlaybackMode()

PlaybackMode KisPlaybackEngineMLT::Private::activePlaybackMode ( )
inline

◆ activeProducer()

QSharedPointer< Mlt::Producer > KisPlaybackEngineMLT::Private::activeProducer ( )
inline

Definition at line 247 of file KisPlaybackEngineMLT.cpp.

247 {
251 }
QMap< KisCanvas2 *, QSharedPointer< Mlt::Producer > > canvasProducers

References activeCanvas(), canvasProducers, and KIS_ASSERT_RECOVER_RETURN_VALUE.

◆ cleanupConsumers()

void KisPlaybackEngineMLT::Private::cleanupConsumers ( )
inline

Definition at line 223 of file KisPlaybackEngineMLT.cpp.

223 {
224 if (pullConsumer && !pullConsumer->is_stopped()) {
225 pullConsumer->stop();
226 }
227
228 if (pushConsumer && !pushConsumer->is_stopped()) {
229 pushConsumer->stop();
230 }
231
232 pullConsumer.reset();
233 pushConsumer.reset();
235 }
QScopedPointer< Mlt::Event > pullConsumerConnection
QScopedPointer< Mlt::PushConsumer > pushConsumer
QScopedPointer< Mlt::Consumer > pullConsumer

References pullConsumer, pullConsumerConnection, and pushConsumer.

◆ dropFrames()

bool KisPlaybackEngineMLT::Private::dropFrames ( ) const
inline

Definition at line 253 of file KisPlaybackEngineMLT.cpp.

253 {
254 return m_self->dropFrames();
255 }

References KisPlaybackEngine::dropFrames(), and m_self.

◆ initializeConsumers()

void KisPlaybackEngineMLT::Private::initializeConsumers ( )
inline

Definition at line 217 of file KisPlaybackEngineMLT.cpp.

217 {
218 pushConsumer.reset(new Mlt::PushConsumer(*profile, "sdl2_audio"));
219 pullConsumer.reset(new Mlt::Consumer(*profile, "sdl2_audio"));
220 pullConsumerConnection.reset(pullConsumer->listen("consumer-frame-show", m_self, (mlt_listener)mltOnConsumerFrameShow));
221 }
static void mltOnConsumerFrameShow(mlt_consumer c, void *p_self, mlt_frame p_frame)

References m_self, mltOnConsumerFrameShow(), profile, pullConsumer, pullConsumerConnection, and pushConsumer.

◆ pushAudio()

void KisPlaybackEngineMLT::Private::pushAudio ( int frame)
inline

Definition at line 194 of file KisPlaybackEngineMLT.cpp.

194 {
195
196 if (pushConsumer->is_stopped() || !m_self->activeCanvas()) {
197 return;
198 }
199
202 const int SCRUB_AUDIO_WINDOW = qMax(1, qRound(profile->frame_rate_num() * SCRUB_AUDIO_SECONDS));
203 activeProducer->seek(frame);
204 for (int i = 0; i < SCRUB_AUDIO_WINDOW; i++ ) {
205 Mlt::Frame* f = activeProducer->get_frame();
206 pushConsumer->push(*f);
207 delete f;
208 }
209
210 // It turns out that get_frame actually seeks to the frame too,
211 // Not having this last seek will cause unexpected "jumps" at
212 // the beginning of playback...
213 activeProducer->seek(frame);
214 }
215 }
QSharedPointer< Mlt::Producer > activeProducer()

References KisPlaybackEngine::activeCanvas(), activePlaybackMode(), activeProducer(), canvasProducers, m_self, PLAYBACK_PUSH, profile, pushConsumer, and SCRUB_AUDIO_SECONDS.

Member Data Documentation

◆ canvasProducers

QMap<KisCanvas2*, QSharedPointer<Mlt::Producer> > KisPlaybackEngineMLT::Private::canvasProducers

Definition at line 272 of file KisPlaybackEngineMLT.cpp.

◆ frameStats

FrameRenderingStats KisPlaybackEngineMLT::Private::frameStats

Definition at line 281 of file KisPlaybackEngineMLT.cpp.

◆ frameWaitingInterface

FrameWaitingInterface KisPlaybackEngineMLT::Private::frameWaitingInterface

Definition at line 280 of file KisPlaybackEngineMLT.cpp.

◆ m_self

KisPlaybackEngineMLT* KisPlaybackEngineMLT::Private::m_self
private

Definition at line 258 of file KisPlaybackEngineMLT.cpp.

◆ mute

bool KisPlaybackEngineMLT::Private::mute

Definition at line 278 of file KisPlaybackEngineMLT.cpp.

◆ playbackSpeed

double KisPlaybackEngineMLT::Private::playbackSpeed

Definition at line 277 of file KisPlaybackEngineMLT.cpp.

◆ profile

QScopedPointer<Mlt::Profile> KisPlaybackEngineMLT::Private::profile

Definition at line 262 of file KisPlaybackEngineMLT.cpp.

◆ pullConsumer

QScopedPointer<Mlt::Consumer> KisPlaybackEngineMLT::Private::pullConsumer

Definition at line 265 of file KisPlaybackEngineMLT.cpp.

◆ pullConsumerConnection

QScopedPointer<Mlt::Event> KisPlaybackEngineMLT::Private::pullConsumerConnection

Definition at line 266 of file KisPlaybackEngineMLT.cpp.

◆ pushConsumer

QScopedPointer<Mlt::PushConsumer> KisPlaybackEngineMLT::Private::pushConsumer

Definition at line 269 of file KisPlaybackEngineMLT.cpp.

◆ repository

QScopedPointer<Mlt::Repository> KisPlaybackEngineMLT::Private::repository

Definition at line 261 of file KisPlaybackEngineMLT.cpp.

◆ sigPushAudioCompressor

QScopedPointer<KisSignalCompressorWithParam<int> > KisPlaybackEngineMLT::Private::sigPushAudioCompressor

Definition at line 274 of file KisPlaybackEngineMLT.cpp.

◆ sigSetPlaybackSpeed

QScopedPointer<KisSignalCompressorWithParam<double> > KisPlaybackEngineMLT::Private::sigSetPlaybackSpeed

Definition at line 275 of file KisPlaybackEngineMLT.cpp.


The documentation for this struct was generated from the following file: