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

Merge new version with Workflow

parent 215ca118
......@@ -46,7 +46,7 @@ void EffectsEngine::render( void )
// return ;
// }
void EffectsEngine::setInputFrame( VideoFrame& frame, quint32 tracknumber )
void EffectsEngine::setInputFrame( LightVideoFrame& frame, quint32 tracknumber )
{
QWriteLocker lock( m_inputLock );
......@@ -56,9 +56,9 @@ void EffectsEngine::setInputFrame( VideoFrame& frame, quint32 tracknumber )
// TO REPLACE BY A REF
VideoFrame const & EffectsEngine::getOutputFrame( quint32 tracknumber ) const
LightVideoFrame const & EffectsEngine::getOutputFrame( quint32 tracknumber ) const
{
return ( ( VideoFrame const & )( ( LightVideoFrame const & ) (m_videoOutputs[tracknumber] ) ) );
return m_videoOutputs[tracknumber];
}
//
......
......@@ -32,8 +32,8 @@ class EffectsEngine
// INPUTS & OUTPUTS METHODS
/* void setClock( Parameter currentframenumber ); */
void setInputFrame( VideoFrame& frame, quint32 tracknumber );
VideoFrame const & getOutputFrame( quint32 tracknumber ) const;
void setInputFrame( LightVideoFrame& frame, quint32 tracknumber );
LightVideoFrame const & getOutputFrame( quint32 tracknumber ) const;
private:
......
......@@ -51,48 +51,49 @@ LightVideoFrame::LightVideoFrame(LightVideoFrame const & tocopy) : m_videoFrame(
LightVideoFrame& LightVideoFrame::operator=(LightVideoFrame const & tocopy)
{
if ( m_videoFrame->frame.octets == NULL )
{
if ( tocopy.m_videoFrame->frame.octets != NULL )
{
m_videoFrame->frame.octets = new quint8[tocopy.m_videoFrame->nboctets];
m_videoFrame->nboctets = tocopy.m_videoFrame->nboctets;
m_videoFrame->nbpixels = tocopy.m_videoFrame->nboctets / Pixel::NbComposantes;
quint32 i;
for ( i = 0; i < m_videoFrame->nboctets; ++i )
m_videoFrame->frame.octets[i] = tocopy.m_videoFrame->frame.octets[i];
}
}
else
{
if ( tocopy.m_videoFrame->frame.octets != NULL )
{
if ( m_videoFrame->nboctets != tocopy.m_videoFrame->nboctets )
{
qDebug() << __LINE__ << "\n"
<< "this pixels = " << m_videoFrame->nbpixels
<< "tocopy.m_videoFrame pixels = " << tocopy.m_videoFrame->nbpixels;
delete [] m_videoFrame->frame.octets;
m_videoFrame->frame.octets = new quint8[tocopy.m_videoFrame->nboctets];
m_videoFrame->nboctets = tocopy.m_videoFrame->nboctets;
m_videoFrame->nbpixels = tocopy.m_videoFrame->nboctets / Pixel::NbComposantes;
}
quint32 i;
for ( i = 0; i < m_videoFrame->nboctets; ++i )
m_videoFrame->frame.octets[i] = tocopy.m_videoFrame->frame.octets[i];
}
else
{
delete [] m_videoFrame->frame.octets;
m_videoFrame->frame.octets = NULL;
m_videoFrame->nboctets = 0;
m_videoFrame->nbpixels = 0;
}
}
return ( *this );
// if ( m_videoFrame->frame.octets == NULL )
// {
// if ( tocopy.m_videoFrame->frame.octets != NULL )
// {
// m_videoFrame->frame.octets = new quint8[tocopy.m_videoFrame->nboctets];
// m_videoFrame->nboctets = tocopy.m_videoFrame->nboctets;
// m_videoFrame->nbpixels = tocopy.m_videoFrame->nboctets / Pixel::NbComposantes;
// quint32 i;
//
// for ( i = 0; i < m_videoFrame->nboctets; ++i )
// m_videoFrame->frame.octets[i] = tocopy.m_videoFrame->frame.octets[i];
// }
// }
// else
// {
// if ( tocopy.m_videoFrame->frame.octets != NULL )
// {
// if ( m_videoFrame->nboctets != tocopy.m_videoFrame->nboctets )
// {
// qDebug() << __LINE__ << "\n"
// << "this pixels = " << m_videoFrame->nbpixels
// << "tocopy.m_videoFrame pixels = " << tocopy.m_videoFrame->nbpixels;
// delete [] m_videoFrame->frame.octets;
// m_videoFrame->frame.octets = new quint8[tocopy.m_videoFrame->nboctets];
// m_videoFrame->nboctets = tocopy.m_videoFrame->nboctets;
// m_videoFrame->nbpixels = tocopy.m_videoFrame->nboctets / Pixel::NbComposantes;
// }
// quint32 i;
//
// for ( i = 0; i < m_videoFrame->nboctets; ++i )
// m_videoFrame->frame.octets[i] = tocopy.m_videoFrame->frame.octets[i];
// }
// else
// {
// delete [] m_videoFrame->frame.octets;
// m_videoFrame->frame.octets = NULL;
// m_videoFrame->nboctets = 0;
// m_videoFrame->nbpixels = 0;
// }
// }
//
m_videoFrame = tocopy.m_videoFrame;
return ( *this );
};
LightVideoFrame::LightVideoFrame(quint32 nboctets)
......
......@@ -83,15 +83,14 @@ MixerEffect::~MixerEffect()
void MixerEffect::render( void )
{
quint32 i;
QHash< QString, InSlot<LightVideoFrame> >::iterator it = m_videoInputs.begin();
QHash< QString, InSlot<LightVideoFrame> >::iterator end = m_videoInputs.end();
while ( it != end )
{
const VideoFrame& lvf = static_cast<VideoFrame>( static_cast<LightVideoFrame>( ( it.value() ) ) );
if ( lvf.rvf.raw != NULL )
const LightVideoFrame& lvf = it.value();
if ( lvf->frame.octets != NULL )
{
m_videoOutputs["out"] << lvf;
return ;
......
......@@ -22,12 +22,12 @@ void PouetEffect::render( void )
LightVideoFrame tmp;
( m_videoInputs["in"] ) >> tmp;
if (tmp.rvf.raw != NULL)
if (tmp->frame.octets != NULL)
{
for ( i = 0; i < tmp.nbpixels; ++i )
for ( i = 0; i < tmp->nbpixels; ++i )
{
tmp.rvf.pixel[i].Red = 0;
tmp.rvf.pixel[i].Blue = 0;
tmp->frame.pixels[i].Red = 0;
tmp->frame.pixels[i].Blue = 0;
}
(m_videoOutputs["out"]) << tmp;
}
......
......@@ -92,11 +92,11 @@ void* WorkflowRenderer::lock( void* datas )
if ( self->m_stopping == false )
{
const VideoFrame* ret = self->m_mainWorkflow->getSynchroneOutput();
const LightVideoFrame* ret = self->m_mainWorkflow->getSynchroneOutput();
self->m_lastFrame = ret;
}
//A kitten just died here too :'(
return self->m_lastFrame->rvf.raw;
return (*(self->m_lastFrame))->frame.octets;
}
void WorkflowRenderer::unlock( void* datas )
......
......@@ -72,7 +72,7 @@ class WorkflowRenderer : public GenericRenderer
bool m_stopping;
private:
const VideoFrame* m_lastFrame;
const LightVideoFrame* m_lastFrame;
QStack<Actions> m_actions;
QReadWriteLock* m_actionsLock;
bool m_pauseAsked;
......
......@@ -25,7 +25,7 @@
#include "vlmc.h"
#include "ClipWorkflow.h"
#include "Pool.hpp"
#include "VideoFrame.h"
#include "LightVideoFrame.h"
ClipWorkflow::ClipWorkflow( Clip::Clip* clip ) :
m_clip( clip ),
......@@ -36,7 +36,7 @@ ClipWorkflow::ClipWorkflow( Clip::Clip* clip ) :
m_initFlag( false ),
m_fullSpeedRender( false )
{
m_frame = new VideoFrame( VIDEOHEIGHT * VIDEOWIDTH * 4 );
m_frame = new LightVideoFrame( VIDEOHEIGHT * VIDEOWIDTH * 4 );
// m_backBuffer = new unsigned char[VIDEOHEIGHT * VIDEOWIDTH * 4];
m_stateLock = new QReadWriteLock;
m_requiredStateLock = new QMutex;
......@@ -60,7 +60,7 @@ ClipWorkflow::~ClipWorkflow()
delete m_frame;
}
VideoFrame* ClipWorkflow::getOutput()
LightVideoFrame* ClipWorkflow::getOutput()
{
QMutexLocker lock( m_renderLock );
......@@ -86,7 +86,7 @@ void ClipWorkflow::lock( ClipWorkflow* cw, void** pp_ret, int size )
{
Q_UNUSED( size );
cw->m_renderLock->lock();
*pp_ret = cw->m_frame->rvf.raw;
*pp_ret = (*(cw->m_frame))->frame.octets;
// qDebug() << '[' << (void*)cw << "] ClipWorkflow::lock";
}
......
......@@ -66,7 +66,7 @@ class ClipWorkflow : public QObject
* therefore, you can call this method blindly, without taking care
* of the rendering process advancement.
*/
VideoFrame* getOutput();
LightVideoFrame* getOutput();
void initialize( bool preloading = false );
/**
* Return true ONLY if the state is equal to Ready.
......@@ -179,7 +179,7 @@ class ClipWorkflow : public QObject
QMutex* m_renderLock;
// unsigned char* m_buffer;
VideoFrame* m_frame;
LightVideoFrame* m_frame;
//unsigned char* m_backBuffer;
LibVLCpp::MediaPlayer* m_mediaPlayer;
......
......@@ -25,8 +25,8 @@
#include "MainWorkflow.h"
VideoFrame* MainWorkflow::nullOutput = NULL;
VideoFrame* MainWorkflow::blackOutput = NULL;
LightVideoFrame* MainWorkflow::nullOutput = NULL;
LightVideoFrame* MainWorkflow::blackOutput = NULL;
MainWorkflow* MainWorkflow::m_instance = NULL;
MainWorkflow::MainWorkflow( int trackCount ) :
......@@ -39,9 +39,9 @@ MainWorkflow::MainWorkflow( int trackCount ) :
"MainWorkflow constructor", "Can't have more than one MainWorkflow instance" );
m_instance = this;
MainWorkflow::nullOutput = new VideoFrame();
MainWorkflow::blackOutput = new VideoFrame( VIDEOWIDTH * VIDEOHEIGHT * 3 );
memset(MainWorkflow::blackOutput->rvf.raw, 0, (VIDEOWIDTH * VIDEOHEIGHT * 3) );
MainWorkflow::nullOutput = new LightVideoFrame();
MainWorkflow::blackOutput = new LightVideoFrame( VIDEOWIDTH * VIDEOHEIGHT * Pixel::NbComposantes );
memset( (*MainWorkflow::blackOutput)->frame.octets, 0, ( VIDEOWIDTH * VIDEOHEIGHT * Pixel::NbComposantes ) );
m_tracks = new Toggleable<TrackWorkflow*>[trackCount];
for ( int i = 0; i < trackCount; ++i )
......@@ -330,7 +330,7 @@ void MainWorkflow::tracksRenderCompleted( unsigned int trackId )
--m_nbTracksToRender;
{
VideoFrame* buff = m_tracks[trackId]->getSynchroneOutput();
LightVideoFrame* buff = m_tracks[trackId]->getSynchroneOutput();
if ( buff == NULL )
m_effectEngine->setInputFrame( *MainWorkflow::nullOutput, trackId );
else
......@@ -350,7 +350,7 @@ void MainWorkflow::tracksRenderCompleted( unsigned int trackId )
}
}
const VideoFrame* MainWorkflow::getSynchroneOutput()
const LightVideoFrame* MainWorkflow::getSynchroneOutput()
{
m_synchroneRenderWaitConditionMutex->lock();
getOutput();
......@@ -361,7 +361,7 @@ const VideoFrame* MainWorkflow::getSynchroneOutput()
m_synchroneRenderingBuffer = &( m_effectEngine->getOutputFrame( 0 ) );
m_synchroneRenderWaitConditionMutex->unlock();
if ( m_synchroneRenderingBuffer->rvf.raw == NULL )
if ( (*m_synchroneRenderingBuffer)->frame.octets == NULL )
return MainWorkflow::blackOutput;
return m_synchroneRenderingBuffer;
......
......@@ -32,7 +32,7 @@
#include "Toggleable.hpp"
#include "TrackWorkflow.h"
#include "Singleton.hpp"
#include "VideoFrame.h"
#include "LightVideoFrame.h"
#include "EffectsEngine.h"
class MainWorkflow : public QObject, public Singleton<MainWorkflow>
......@@ -46,7 +46,7 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
void addClip( Clip* clip, unsigned int trackId, qint64 start );
void startRender();
void getOutput();
const VideoFrame* getSynchroneOutput();
const LightVideoFrame* getSynchroneOutput();
/**
* \brief Set the workflow position
......@@ -82,8 +82,6 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
void pause();
void unpause();
static VideoFrame* nullOutput;
static VideoFrame* blackOutput;
void nextFrame();
void previousFrame();
......@@ -118,7 +116,8 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
private:
static MainWorkflow* m_instance;
static unsigned char* blackOutput;
static LightVideoFrame* nullOutput;
static LightVideoFrame* blackOutput;
private:
void computeLength();
......@@ -138,7 +137,7 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
QMutex* m_renderMutex;
QAtomicInt m_nbTracksToPause;
QAtomicInt m_nbTracksToUnpause;
const VideoFrame* m_synchroneRenderingBuffer;
const LightVideoFrame* m_synchroneRenderingBuffer;
unsigned int m_nbTracksToRender;
QMutex* m_nbTracksToRenderMutex;
QMutex* m_highestTrackNumberMutex;
......
......@@ -470,7 +470,7 @@ void TrackWorkflow::clipWorkflowRenderCompleted( ClipWorkflow* cw )
// qDebug() << "Track render not completed yet";
}
VideoFrame* TrackWorkflow::getSynchroneOutput()
LightVideoFrame* TrackWorkflow::getSynchroneOutput()
{
return m_synchroneRenderBuffer;
}
......
......@@ -32,7 +32,7 @@
#include <QDomElement>
#include "ClipWorkflow.h"
#include "VideoFrame.h"
#include "LightVideoFrame.h"
//TODO: REMOVE THIS
#ifndef FPS
......@@ -67,7 +67,7 @@ class TrackWorkflow : public QObject
/**
* Returns the output that has been computed in synchrone mode.
*/
VideoFrame* getSynchroneOutput();
LightVideoFrame* getSynchroneOutput();
//FIXME: this won't be reliable as soon as we change the fps from the configuration
static const unsigned int nbFrameBeforePreload = 60;
......@@ -114,7 +114,7 @@ class TrackWorkflow : public QObject
QAtomicInt m_nbClipToUnpause;
QAtomicInt m_nbClipToRender;
VideoFrame* m_synchroneRenderBuffer;
LightVideoFrame* m_synchroneRenderBuffer;
private slots:
void clipWorkflowPaused();
......
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