Commit a893c052 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Kind of working version.

It misses some frames, it also crash, but it's good enough for now.
I'll debug it as it goes.
parent a0193d54
......@@ -80,16 +80,28 @@ RenderPreviewWidget::~RenderPreviewWidget()
void* RenderPreviewWidget::lock( void* datas )
{
qDebug() << "\nQuerying new picture";
RenderPreviewWidget* self = reinterpret_cast<RenderPreviewWidget*>( datas );
void* ret = self->m_mainWorkflow->getOutput();
return ret;
if ( self->m_oneFrameOnly < 2 )
{
qDebug() << "\nQuerying new picture";
void* ret = self->m_mainWorkflow->getOutput();
self->m_lastFrame = static_cast<unsigned char*>( ret );
return ret;
}
else
return self->m_lastFrame;
}
void RenderPreviewWidget::unlock( void* datas )
{
RenderPreviewWidget* self = reinterpret_cast<RenderPreviewWidget*>( datas );
self->m_framePlayed = 1;
if ( self->m_oneFrameOnly == 1 )
{
self->m_mediaPlayer->pause();
self->m_oneFrameOnly = 2;
qDebug() << "Pausing RenderPreviewWidget";
}
}
void RenderPreviewWidget::stopPreview()
......@@ -121,15 +133,16 @@ void RenderPreviewWidget::setPosition( float newPos )
void RenderPreviewWidget::nextFrame()
{
qDebug() << "Next frame :";
m_oneFrameOnly = 1;
m_mainWorkflow->nextFrame();
qDebug() << "Activatign one frame only";
m_mainWorkflow->activateOneFrameOnly();
//Both media players should be stopped now... restauring playback
m_framePlayed = 0;
m_mediaPlayer->pause();
while ( m_framePlayed == 0 )
SleepMS( 1 );
// m_framePlayed = 0;
m_mediaPlayer->pause();
// while ( m_framePlayed == 0 )
// SleepMS( 1 );
// m_mediaPlayer->pause();
}
void RenderPreviewWidget::previousFrame()
......@@ -197,6 +210,10 @@ void RenderPreviewWidget::__positionChanged( float pos )
void RenderPreviewWidget::__videoPaused()
{
if ( m_oneFrameOnly != 0 )
{
m_oneFrameOnly = 0;
}
emit paused();
}
......
......@@ -60,7 +60,8 @@ class RenderPreviewWidget : public GenericPreviewWidget
private:
MainWorkflow* m_mainWorkflow;
LibVLCpp::Media* m_media;
QAtomicInt m_framePlayed;
QAtomicInt m_oneFrameOnly;
unsigned char* m_lastFrame;
public slots:
void __positionChanged();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment