Commit 68bf2757 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Started new track workflow...

This is breaking compilation, you can blame me, ho yeah you can !
parent 30f92f8f
......@@ -32,13 +32,13 @@ MainWorkflow::MainWorkflow()
m_tracks[i] = new TrackWorkflow;
}
void MainWorkflow::addClip( Clip* clip, unsigned int trackId )
void MainWorkflow::addClip( Clip* clip, unsigned int trackId, qint64 start )
{
Q_ASSERT_X( trackId < NB_TRACKS, "MainWorkflow::addClip",
"The specified trackId isn't valid, for it's higher than the number of tracks");
qDebug() << "MainWorkflow: Adding clip" << clip->getUuid() << "to track" << trackId;
m_tracks[trackId]->addClip( clip );
m_tracks[trackId]->addClip( clip, start );
}
void MainWorkflow::startRender()
......
......@@ -38,7 +38,7 @@ class MainWorkflow : public QObject
public:
MainWorkflow();
void addClip( Clip* clip, unsigned int trackId );
void addClip( Clip* clip, unsigned int trackId, qint64 start );
void startRender();
unsigned char* getOutput();
private:
......
......@@ -24,16 +24,17 @@
#include "TrackWorkflow.h"
TrackWorkflow::TrackWorkflow()
TrackWorkflow::TrackWorkflow() : m_currentFrame( 0 )
{
m_condMutex = new QMutex;
m_waitCondition = new QWaitCondition;
m_mediaPlayer = new LibVLCpp::MediaPlayer();
}
void TrackWorkflow::addClip( Clip* clip )
void TrackWorkflow::addClip( Clip* clip, qint64 start )
{
m_currentClipWorkflow = new ClipWorkflow( clip, m_condMutex, m_waitCondition );
ClipWorkflow* cw = new ClipWorkflow( clip, m_condMutex, m_waitCondition );
m_clips.insert( start, cw );
}
void TrackWorkflow::startRender()
......@@ -46,14 +47,13 @@ void TrackWorkflow::startRender()
unsigned char* TrackWorkflow::getOutput()
{
// qDebug() << "Awaking all renderers";
m_waitCondition->wakeAll();
while ( m_currentClipWorkflow->renderComplete() == false )
{
//qDebug() << "Frame is not ready yet... waiting";
// usleep( 1000 );
//usleep( 1000 );
}
// qDebug() << "Frame rendered";
++m_currentFrame;
if ( m_currentClipWorkflow->isEndReached() == true )
return NULL;
return m_currentClipWorkflow->getOutput();
......
......@@ -26,11 +26,12 @@
#include <QObject>
#include <QMutex>
#include <QWaitCondition>
#include <QMap>
#include "ClipWorkflow.h"
#include "VLCMediaPlayer.h"
//THIS IS A JUNK FOR TESTING CLIP WORKFLOW
#define FPS 30
class TrackWorkflow : public QObject
{
......@@ -42,13 +43,17 @@ class TrackWorkflow : public QObject
void startRender();
unsigned char* getOutput();
private:
ClipWorkflow* m_currentClipWorkflow;
QMutex* m_condMutex;
QWaitCondition* m_waitCondition;
LibVLCpp::MediaPlayer* m_mediaPlayer;
QMap<qint64, ClipWorkflow*> m_clips;
QMap<qint64, ClipWorkflow*>::iterator m_current;
qint64 m_currentFrame;
QMutex* m_condMutex;
QWaitCondition* m_waitCondition;
LibVLCpp::MediaPlayer* m_mediaPlayer;
//When a video is about to be used, we pre-load it with this second media player.
LibVLCpp::MediaPlayer* m_nextMediaPlayer;
public slots:
void addClip( Clip* );
public:
void addClip( Clip*, qint64 start );
};
#endif // TRACKWORKFLOW_H
......@@ -187,7 +187,7 @@ void TracksView::addClip( Media* clip, const QPoint& point )
if ( track + 1 > m_tracksCount ) return;
//mappedXPos: 1 pixel = 1 frame
int mappedXPos = ( int )( mapToScene( point ).x() + 0.5 );
qreal mappedXPos = ( mapToScene( point ).x() + 0.5 );
GraphicsMovieItem* item = new GraphicsMovieItem( clip );
item->setPos( mappedXPos, track * tracksHeight() );
......@@ -205,7 +205,7 @@ void TracksView::addClip( Media* clip, const QPoint& point )
qDebug() << "TracksView::addClip: Adding a new clip to track" << track;
//FIXME: this leaks, but it will be corrected once we really use Clip instead
// of Media
m_mainWorkflow->addClip( new Clip( clip ), track );
m_mainWorkflow->addClip( new Clip( clip ), track, (qint64)mappedXPos );
}
void TracksView::setScale( double scaleFactor )
......
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