Commit 1450ed17 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Corrected screwed up parts when merging master with sound_workflow

parent 7f53a87a
......@@ -62,7 +62,7 @@ WorkflowRenderer::WorkflowRenderer() :
m_condMutex = new QMutex;
m_waitCond = new QWaitCondition;
m_renderFrame = new unsigned char[VIDEOHEIGHT * VIDEOWIDTH * Pixel::NbComposantes];
m_renderVideoFrame = new unsigned char[VIDEOHEIGHT * VIDEOWIDTH * Pixel::NbComposantes];
//Workflow part
connect( m_mainWorkflow, SIGNAL( frameChanged(qint64) ),
......@@ -97,7 +97,7 @@ void* WorkflowRenderer::lockAudio( void* datas )
WorkflowRenderer* self = reinterpret_cast<WorkflowRenderer*>( datas );
qDebug() << "Injecting audio data";
return self->m_lastFrame->audio;
return self->m_renderAudioSample;
}
void* WorkflowRenderer::lock( void* datas )
......@@ -106,10 +106,11 @@ void* WorkflowRenderer::lock( void* datas )
if ( self->m_stopping == false )
{
void* ret = self->m_mainWorkflow->getSynchroneOutput();
self->m_lastFrame = static_cast<MainWorkflow::OutputBuffers*>( ret );
MainWorkflow::OutputBuffers* ret = self->m_mainWorkflow->getSynchroneOutput();
memcpy( self->m_renderVideoFrame, (*(ret->video))->frame.octets, (*(ret->video))->nboctets );
self->m_renderAudioSample = ret->audio;
}
return self->m_lastFrame->video->rvf.raw;
return self->m_renderVideoFrame;
}
void WorkflowRenderer::unlock( void* datas )
......
......@@ -73,7 +73,8 @@ class WorkflowRenderer : public GenericRenderer
bool m_stopping;
private:
MainWorkflow::OutputBuffers* m_lastFrame;
unsigned char* m_renderVideoFrame;
unsigned char* m_renderAudioSample;
QStack<Actions> m_actions;
QReadWriteLock* m_actionsLock;
bool m_pauseAsked;
......
......@@ -30,16 +30,11 @@
//FIXME: remove this !
#include "ClipWorkflow.h"
unsigned char* MainWorkflow::blackOutput = NULL;
MainWorkflow::MainWorkflow( int trackCount ) :
m_currentFrame( 0 ),
m_length( 0 ),
m_renderStarted( false )
{
MainWorkflow::blackOutput = new unsigned char[VIDEOHEIGHT * VIDEOWIDTH * 3];
memset( MainWorkflow::blackOutput, 0, VIDEOHEIGHT * VIDEOWIDTH * 3 );
m_renderStartedLock = new QReadWriteLock;
m_renderMutex = new QMutex;
m_synchroneRenderWaitCondition = new QWaitCondition;
......@@ -55,7 +50,6 @@ MainWorkflow::MainWorkflow( int trackCount ) :
m_outputBuffers = new OutputBuffers;
m_effectEngine = new EffectsEngine;
m_effectEngine->disable();
m_nbTracksToRenderMutex = new QMutex;
}
MainWorkflow::~MainWorkflow()
......@@ -64,7 +58,6 @@ MainWorkflow::~MainWorkflow()
stop();
delete m_effectEngine;
delete m_nbTracksToRenderMutex;
delete m_synchroneRenderWaitConditionMutex;
delete m_synchroneRenderWaitCondition;
delete m_renderMutex;
......@@ -72,8 +65,6 @@ MainWorkflow::~MainWorkflow()
for ( unsigned int i = 0; i < TrackWorkflow::NbType; ++i )
delete m_tracks[i];
delete[] m_tracks;
delete nullOutput;
delete blackOutput;
}
EffectsEngine* MainWorkflow::getEffectsEngine(void)
......@@ -218,10 +209,9 @@ MainWorkflow::OutputBuffers* MainWorkflow::getSynchroneOutput()
m_synchroneRenderWaitCondition->wait( m_synchroneRenderWaitConditionMutex );
// qDebug() << "Got it";
m_effectEngine->render();
m_synchroneRenderingBuffer = &( m_effectEngine->getOutputFrame( 0 ) );
m_synchroneRenderWaitConditionMutex->unlock();
m_outputBuffers->video = m_tracks[TrackWorkflow::Video]->getSynchroneOutput();
m_outputBuffers->audio = m_tracks[TrackWorkflow::Audio]->getSynchroneOutput();
m_outputBuffers->video = reinterpret_cast<LightVideoFrame*>( m_tracks[TrackWorkflow::Video]->getSynchroneOutput() );
m_outputBuffers->audio = reinterpret_cast<unsigned char*>( m_tracks[TrackWorkflow::Audio]->getSynchroneOutput() );
return m_outputBuffers;
}
......
......@@ -44,7 +44,7 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
public:
struct OutputBuffers
{
VideoFrame* video;
LightVideoFrame* video;
unsigned char* audio;
};
void addClip( Clip* clip, unsigned int trackId, qint64 start, TrackWorkflow::TrackType type );
......@@ -116,9 +116,6 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
void setFullSpeedRender( bool value );
int getTrackCount( TrackWorkflow::TrackType trackType ) const;
private:
static unsigned char* blackOutput;
private:
MainWorkflow( int trackCount = 64 );
~MainWorkflow();
......@@ -126,8 +123,6 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
void activateTrack( unsigned int trackId );
private:
static unsigned char* blackOutput;
qint64 m_currentFrame;
qint64 m_length;
/**
......@@ -143,10 +138,10 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
TrackHandler** m_tracks;
OutputBuffers* m_outputBuffers;
friend class Singleton<MainWorkflow>;
EffectsEngine* m_effectEngine;
friend class Singleton<MainWorkflow>;
private slots:
void tracksPaused();
void tracksRenderCompleted();
......
......@@ -311,7 +311,7 @@ unsigned int TrackHandler::getTrackCount() const
return m_trackCount;
}
unsigned char* TrackHandler::getSynchroneOutput()
void* TrackHandler::getSynchroneOutput()
{
return m_synchroneRenderingBuffer;
}
......@@ -56,7 +56,7 @@ class TrackHandler : public QObject
Clip* getClip( const QUuid& uuid, unsigned int trackId );
void clear();
void setFullSpeedRender( bool value );
unsigned char* getSynchroneOutput();
void* getSynchroneOutput();
bool isPaused() const;
bool allTracksRendered() const;
......@@ -76,7 +76,7 @@ class TrackHandler : public QObject
unsigned int m_highestTrackNumber;
unsigned int m_nbTracksToRender;
QMutex* m_nbTracksToRenderMutex;
unsigned char* m_synchroneRenderingBuffer;
void* m_synchroneRenderingBuffer;
bool m_paused;
/**
* \brief This flag is used to know if all tracks handled
......
......@@ -479,7 +479,7 @@ void TrackWorkflow::clipWorkflowRenderCompleted( ClipWorkflow* cw )
// qDebug() << "Track render not completed yet";
}
LightVideoFrame* TrackWorkflow::getSynchroneOutput()
unsigned char* TrackWorkflow::getSynchroneOutput()
{
return m_synchroneRenderBuffer;
}
......
......@@ -73,7 +73,7 @@ class TrackWorkflow : public QObject
/**
* Returns the output that has been computed in synchrone mode.
*/
LightVideoFrame* getSynchroneOutput();
unsigned char* getSynchroneOutput();
//FIXME: this won't be reliable as soon as we change the fps from the configuration
static const unsigned int nbFrameBeforePreload = 60;
......@@ -120,7 +120,7 @@ class TrackWorkflow : public QObject
QAtomicInt m_nbClipToUnpause;
QAtomicInt m_nbClipToRender;
LightVideoFrame* m_synchroneRenderBuffer;
unsigned char* m_synchroneRenderBuffer;
TrackType m_trackType;
......
......@@ -24,12 +24,12 @@
VideoClipWorkflow::VideoClipWorkflow( Clip* clip ) : ClipWorkflow( clip )
{
m_buffer = new unsigned char[VIDEOHEIGHT * VIDEOWIDTH * 4];
m_buffer = new LightVideoFrame( VIDEOHEIGHT * VIDEOWIDTH * Pixel::NbComposantes );
}
VideoClipWorkflow::~VideoClipWorkflow()
{
delete[] m_buffer;
delete m_buffer;
}
void VideoClipWorkflow::initVlcOutput()
......@@ -89,7 +89,7 @@ void VideoClipWorkflow::lock( VideoClipWorkflow* cw, void** pp_ret, int size
{
Q_UNUSED( size );
cw->m_renderLock->lock();
*pp_ret = cw->m_buffer;
*pp_ret = (*(cw->m_buffer))->frame.pixels;
// qDebug() << '[' << (void*)cw << "] ClipWorkflow::lock";
}
......
......@@ -36,7 +36,7 @@ class VideoClipWorkflow : public ClipWorkflow
virtual void* getOutput();
private:
unsigned char* m_buffer;
LightVideoFrame* m_buffer;
virtual void initVlcOutput();
static void lock( VideoClipWorkflow* clipWorkflow, void** pp_ret, int size );
static void unlock( VideoClipWorkflow* clipWorkflow, void* buffer, int width, int height, int bpp, int size );
......
......@@ -63,15 +63,12 @@ SOURCES += src/main.cpp \
src/GUI/VLMCPreferences.cpp \
src/GUI/VideoProjectPreferences.cpp \
src/Project/ProjectManager.cpp \
src/Configuration/SettingsManager.cpp \
src/Workflow/VideoClipWorkflow.cpp \
src/Workflow/TrackHandler.cpp \
src/Workflow/AudioClipWorkflow.cpp \
src/EffectsEngine/EffectsEngine.cpp \
src/EffectsEngine/LightVideoFrame.cpp \
src/EffectsEngine/GenericEffect.cpp \
src/EffectsEngine/PouetEffect.cpp \
src/EffectsEngine/MixerEffect.cpp \
src/EffectsEngine/GreenFilterEffect.cpp \
src/EffectsEngine/MixerEffect.cpp \
src/Configuration/SettingsManager.cpp
......@@ -131,7 +128,6 @@ HEADERS += src/GUI/MainWindow.h \
src/GUI/AudioProjectPreferences.h \
src/GUI/VideoProjectPreferences.h \
src/Project/ProjectManager.h \
src/Configuration/SettingsManager.h \
src/Workflow/VideoClipWorkflow.h \
src/Workflow/TrackHandler.h \
src/Workflow/AudioClipWorkflow.h \
......@@ -140,8 +136,6 @@ HEADERS += src/GUI/MainWindow.h \
src/EffectsEngine/OutSlot.hpp \
src/EffectsEngine/LightVideoFrame.h \
src/EffectsEngine/GenericEffect.h \
src/EffectsEngine/PouetEffect.h \
src/EffectsEngine/MixerEffect.h \
src/EffectsEngine/GreenFilterEffect.h \
src/EffectsEngine/MixerEffect.h \
src/Configuration/SettingsManager.h
......
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