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

Reworked blackoutput/nulloutput.

This causes a bug that has to be solved, and not worked around (c), in the effect engine.
parent b4175f3e
......@@ -142,8 +142,6 @@ void ClipWorkflow::stop()
void
ClipWorkflow::setTime( qint64 time )
{
// qDebug() << m_mediaPlayer << "setting clipworkflow time:" << time << "debugType:" << debugType <<
// "theorical position:" << (double)time / (double)((double)m_clip->getLengthSecond() * 1000.0);
connect( m_mediaPlayer, SIGNAL( timeChanged(qint64) ),
this, SLOT( resyncClipWorkflow() ), Qt::DirectConnection );
m_mediaPlayer->setTime( time );
......@@ -282,3 +280,16 @@ ClipWorkflow::setFullSpeedRender( bool val )
{
m_fullSpeedRender = val;
}
void
ClipWorkflow::mute()
{
stop();
setState( Muted );
}
void
ClipWorkflow::unmute()
{
setState( Stopped );
}
......@@ -72,6 +72,8 @@ class ClipWorkflow : public QObject
/// \brief This state will be used when the media player is paused,
/// because of a sufficient number of computed buffers
Paused, //7
/// \brief This state means a clip is mutted and must not be restarted
Muted,
};
/**
......@@ -169,6 +171,9 @@ class ClipWorkflow : public QObject
*/
void setFullSpeedRender( bool val );
void mute();
void unmute();
private:
void setState( State state );
void adjustBegin();
......
......@@ -267,14 +267,14 @@ void
MainWorkflow::muteClip( const QUuid& uuid, unsigned int trackId,
MainWorkflow::TrackType trackType )
{
qDebug() << "Mute" << uuid ;
m_tracks[trackType]->muteClip( uuid, trackId );
}
void
MainWorkflow::unmuteClip( const QUuid& uuid, unsigned int trackId,
MainWorkflow::TrackType trackType )
{
qDebug() << "Unmute" << uuid;
m_tracks[trackType]->unmuteClip( uuid, trackId );
}
void toggleBreakPoint()
......
......@@ -119,16 +119,13 @@ TrackHandler::getOutput( qint64 currentFrame, qint64 subFrame )
{
if ( m_tracks[i].activated() == false )
{
if ( m_tracks[i].hardDeactivated() == true )
m_effectEngine->setVideoInput( i + 1, *MainWorkflow::blackOutput );
else
m_effectEngine->setVideoInput( i + 1, *TrackHandler::nullOutput );
m_effectEngine->setVideoInput( i + 1, *TrackHandler::nullOutput );
}
else
{
void* ret = m_tracks[i]->getOutput( currentFrame, subFrame );
if ( ret == NULL )
m_effectEngine->setVideoInput( i + 1, *MainWorkflow::blackOutput );
m_effectEngine->setVideoInput( i + 1, *TrackHandler::nullOutput );
else
{
StackedBuffer<LightVideoFrame*>* stackedBuffer =
......@@ -342,3 +339,15 @@ TrackHandler::setFullSpeedRender( bool val )
for ( unsigned int i = 0; i < m_trackCount; ++i)
m_tracks[i]->setFullSpeedRender( val );
}
void
TrackHandler::muteClip( const QUuid &uuid, quint32 trackId )
{
m_tracks[trackId]->muteClip( uuid );
}
void
TrackHandler::unmuteClip( const QUuid &uuid, quint32 trackId )
{
m_tracks[trackId]->unmuteClip( uuid );
}
......@@ -89,6 +89,15 @@ class TrackHandler : public QObject
*/
void setFullSpeedRender( bool val );
/**
* \brief Will mute a clip in the given track.
*
* \param uuid The uuid of the clip to mute.
* \param trackId The id of the track holding the clip.
*/
void muteClip( const QUuid& uuid, quint32 trackId );
void unmuteClip( const QUuid& uuid, quint32 trackId );
private:
void computeLength();
void activateTrack( unsigned int tracKId );
......
......@@ -158,10 +158,13 @@ void* TrackWorkflow::renderClip( ClipWorkflow* cw, qint64 currentFrame,
cw->initialize();
cw->waitForCompleteInit();
if ( start != currentFrame || cw->getClip()->getBegin() != 0 ) //Clip was not started as its real begining
{
adjustClipTime( currentFrame, start, cw );
}
return cw->getOutput( mode );
}
else if ( cw->getState() == ClipWorkflow::EndReached )
else if ( cw->getState() == ClipWorkflow::EndReached ||
cw->getState() == ClipWorkflow::Muted )
{
cw->getStateLock()->unlock();
//The stopClipWorkflow() method will take care of that.
......@@ -192,23 +195,14 @@ void TrackWorkflow::stopClipWorkflow( ClipWorkflow* cw )
// qDebug() << "Stopping clip workflow";
cw->getStateLock()->lockForRead();
if ( cw->getState() == ClipWorkflow::Stopped )
if ( cw->getState() == ClipWorkflow::Stopped ||
cw->getState() == ClipWorkflow::Muted )
{
cw->getStateLock()->unlock();
return ;
}
if ( cw->getState() == ClipWorkflow::EndReached ||
cw->getState() == ClipWorkflow::Rendering ||
cw->getState() == ClipWorkflow::Paused )
{
cw->getStateLock()->unlock();
cw->stop();
}
else
{
qCritical() << "Unexpected ClipWorkflow::State when stopping :" << cw->getState();
cw->getStateLock()->unlock();
}
cw->getStateLock()->unlock();
cw->stop();
}
bool TrackWorkflow::checkEnd( qint64 currentFrame ) const
......@@ -505,3 +499,45 @@ TrackWorkflow::setFullSpeedRender( bool val )
cw->setFullSpeedRender( val );
}
}
void
TrackWorkflow::muteClip( const QUuid &uuid )
{
QWriteLocker lock( m_clipsLock );
QMap<qint64, ClipWorkflow*>::iterator it = m_clips.begin();
QMap<qint64, ClipWorkflow*>::iterator end = m_clips.end();
while ( it != end )
{
if ( it.value()->getClip()->getUuid() == uuid )
{
it.value()->mute();
return ;
}
++it;
}
qWarning() << "Failed to mute clip" << uuid << "it probably doesn't exist "
"in this track";
}
void
TrackWorkflow::unmuteClip( const QUuid &uuid )
{
QWriteLocker lock( m_clipsLock );
QMap<qint64, ClipWorkflow*>::iterator it = m_clips.begin();
QMap<qint64, ClipWorkflow*>::iterator end = m_clips.end();
while ( it != end )
{
if ( it.value()->getClip()->getUuid() == uuid )
{
it.value()->unmute();
return ;
}
++it;
}
qWarning() << "Failed to unmute clip" << uuid << "it probably doesn't exist "
"in this track";
}
......@@ -86,6 +86,15 @@ class TrackWorkflow : public QObject
*/
void setFullSpeedRender( bool val );
/**
* \brief Mute a clip
*
* Mutting a clip will prevent it to be rendered.
* \param uuid The uuid of the clip to mute.
*/
void muteClip( const QUuid& uuid );
void unmuteClip( const QUuid& uuid );
private:
void computeLength();
void* renderClip( ClipWorkflow* cw, qint64 currentFrame,
......
......@@ -25,6 +25,7 @@
#include "StackedBuffer.hpp"
#include "LightVideoFrame.h"
#include "Clip.h"
#include <QReadWriteLock>
VideoClipWorkflow::VideoClipWorkflow( Clip *clip ) :
ClipWorkflow( clip ),
......
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