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

Images can now be user again in workflow

parent a96d1d70
......@@ -28,11 +28,11 @@
#include "LightVideoFrame.h"
ClipWorkflow::ClipWorkflow( Clip::Clip* clip ) :
m_clip( clip ),
m_mediaPlayer(NULL),
m_requiredState( ClipWorkflow::None ),
m_rendering( false ),
m_initFlag( false ),
m_clip( clip ),
m_state( ClipWorkflow::Stopped ),
m_fullSpeedRender( false )
{
......@@ -73,7 +73,10 @@ void ClipWorkflow::checkStateChange()
void ClipWorkflow::initialize( bool preloading /*= false*/ )
{
setState( Initializing );
m_vlcMedia = new LibVLCpp::Media( "file://" + m_clip->getParent()->getFileInfo()->absoluteFilePath() );
if ( m_clip->getParent()->getFileType() == Media::Image )
m_vlcMedia = new LibVLCpp::Media( "fake://" + m_clip->getParent()->getFileInfo()->absoluteFilePath() );
else
m_vlcMedia = new LibVLCpp::Media( "file://" + m_clip->getParent()->getFileInfo()->absoluteFilePath() );
initVlcOutput();
m_mediaPlayer = Pool<LibVLCpp::MediaPlayer>::getInstance()->get();
m_mediaPlayer->setMedia( m_vlcMedia );
......@@ -110,7 +113,8 @@ void ClipWorkflow::initializedMediaPlayer()
void ClipWorkflow::adjustBegin()
{
m_mediaPlayer->setTime( m_clip->getBegin() / m_clip->getParent()->getFps() * 1000 );
if ( m_clip->getParent()->getFileType() == Media::Video || m_clip->getParent()->getFileType() == Media::Audio )
m_mediaPlayer->setTime( m_clip->getBegin() / m_clip->getParent()->getFps() * 1000 );
}
bool ClipWorkflow::isReady() const
......
......@@ -169,8 +169,6 @@ class ClipWorkflow : public QObject
void adjustBegin();
private:
Clip* m_clip;
LibVLCpp::MediaPlayer* m_mediaPlayer;
State m_requiredState;
......@@ -192,6 +190,7 @@ class ClipWorkflow : public QObject
bool m_initFlag;
protected:
Clip* m_clip;
QMutex* m_renderLock;
QReadWriteLock* m_stateLock;
QMutex* m_condMutex;
......
......@@ -90,7 +90,6 @@ void MainWorkflow::addClip( Clip* clip, unsigned int trackId,
{
m_tracks[trackType]->addClip( clip, trackId, start );
computeLength();
//Inform the GUI
emit clipAdded( clip, trackId, start, trackType );
}
......
......@@ -22,6 +22,8 @@
#include "VideoClipWorkflow.h"
#define IMAGE_DURATION 10000
VideoClipWorkflow::VideoClipWorkflow( Clip* clip ) : ClipWorkflow( clip )
{
m_buffer = new LightVideoFrame( VIDEOHEIGHT * VIDEOWIDTH * Pixel::NbComposantes );
......@@ -44,6 +46,12 @@ void VideoClipWorkflow::initVlcOutput()
m_vlcMedia->setVideoUnlockCallback( reinterpret_cast<void*>( getUnlockCallback() ) );
m_vlcMedia->addOption( ":sout-transcode-vcodec=RV24" );
m_vlcMedia->addOption( ":sout-transcode-acodec=s16l" );
if ( m_clip->getParent()->getFileType() == Media::Image )
{
sprintf( buffer, ":fake-duration=%d", IMAGE_DURATION );
m_vlcMedia->addOption( buffer );
sprintf( buffer, ":fake-fps=%f", m_clip->getParent()->getFps() );
}
// m_vlcMedia->addOption( ":no-sout-keep" );
if ( m_fullSpeedRender == true )
......@@ -59,6 +67,7 @@ void VideoClipWorkflow::initVlcOutput()
sprintf( buffer, ":sout-transcode-height=%i", VIDEOHEIGHT );
m_vlcMedia->addOption( buffer );
//Forced output fps
sprintf( buffer, ":sout-transcode-fps=%f", (float)FPS );
m_vlcMedia->addOption( buffer );
......@@ -90,7 +99,6 @@ void VideoClipWorkflow::lock( VideoClipWorkflow* cw, void** pp_ret, int size
Q_UNUSED( size );
cw->m_renderLock->lock();
*pp_ret = (*(cw->m_buffer))->frame.pixels;
// qDebug() << '[' << (void*)cw << "] ClipWorkflow::lock";
}
void VideoClipWorkflow::unlock( VideoClipWorkflow* cw, void* buffer, int width, int height, int bpp, int size )
......
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