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 // Initialize MLT...
156 repository.reset(Mlt::Factory::init());
157
158#ifdef MLT_LOG_REDIRECTION
159 mlt_log_set_level(MLT_LOG_VERBOSE);
160 mlt_log_set_callback(&qt_redirection_callback);
161#endif /* MLT_LOG_REDIRECTION */
162
163 // Register our backend plugin
165
166 profile.reset(new Mlt::Profile());
167 profile->set_frame_rate(24, 1);
168
169 {
170 std::function<void (int)> callback(std::bind(&Private::pushAudio, this, std::placeholders::_1));
173 );
174 }
175
176 {
177 std::function<void (const double)> callback(std::bind(&KisPlaybackEngineMLT::throttledSetSpeed, m_self, std::placeholders::_1));
180 );
181 }
182
184 }
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 186 of file KisPlaybackEngineMLT.cpp.

186 {
188 repository.reset();
189 Mlt::Factory::close();
190 }

References cleanupConsumers(), and repository.

Member Function Documentation

◆ activeCanvas()

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

Definition at line 235 of file KisPlaybackEngineMLT.cpp.

235 {
236 return m_self->activeCanvas();
237 }
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 245 of file KisPlaybackEngineMLT.cpp.

245 {
249 }
QMap< KisCanvas2 *, QSharedPointer< Mlt::Producer > > canvasProducers

References activeCanvas(), canvasProducers, and KIS_ASSERT_RECOVER_RETURN_VALUE.

◆ cleanupConsumers()

void KisPlaybackEngineMLT::Private::cleanupConsumers ( )
inline

Definition at line 221 of file KisPlaybackEngineMLT.cpp.

221 {
222 if (pullConsumer && !pullConsumer->is_stopped()) {
223 pullConsumer->stop();
224 }
225
226 if (pushConsumer && !pushConsumer->is_stopped()) {
227 pushConsumer->stop();
228 }
229
230 pullConsumer.reset();
231 pushConsumer.reset();
233 }
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 251 of file KisPlaybackEngineMLT.cpp.

251 {
252 return m_self->dropFrames();
253 }

References KisPlaybackEngine::dropFrames(), and m_self.

◆ initializeConsumers()

void KisPlaybackEngineMLT::Private::initializeConsumers ( )
inline

Definition at line 215 of file KisPlaybackEngineMLT.cpp.

215 {
216 pushConsumer.reset(new Mlt::PushConsumer(*profile, "sdl2_audio"));
217 pullConsumer.reset(new Mlt::Consumer(*profile, "sdl2_audio"));
218 pullConsumerConnection.reset(pullConsumer->listen("consumer-frame-show", m_self, (mlt_listener)mltOnConsumerFrameShow));
219 }
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 192 of file KisPlaybackEngineMLT.cpp.

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

◆ frameStats

FrameRenderingStats KisPlaybackEngineMLT::Private::frameStats

Definition at line 279 of file KisPlaybackEngineMLT.cpp.

◆ frameWaitingInterface

FrameWaitingInterface KisPlaybackEngineMLT::Private::frameWaitingInterface

Definition at line 278 of file KisPlaybackEngineMLT.cpp.

◆ m_self

KisPlaybackEngineMLT* KisPlaybackEngineMLT::Private::m_self
private

Definition at line 256 of file KisPlaybackEngineMLT.cpp.

◆ mute

bool KisPlaybackEngineMLT::Private::mute

Definition at line 276 of file KisPlaybackEngineMLT.cpp.

◆ playbackSpeed

double KisPlaybackEngineMLT::Private::playbackSpeed

Definition at line 275 of file KisPlaybackEngineMLT.cpp.

◆ profile

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

Definition at line 260 of file KisPlaybackEngineMLT.cpp.

◆ pullConsumer

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

Definition at line 263 of file KisPlaybackEngineMLT.cpp.

◆ pullConsumerConnection

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

Definition at line 264 of file KisPlaybackEngineMLT.cpp.

◆ pushConsumer

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

Definition at line 267 of file KisPlaybackEngineMLT.cpp.

◆ repository

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

Definition at line 259 of file KisPlaybackEngineMLT.cpp.

◆ sigPushAudioCompressor

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

Definition at line 272 of file KisPlaybackEngineMLT.cpp.

◆ sigSetPlaybackSpeed

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

Definition at line 273 of file KisPlaybackEngineMLT.cpp.


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