[vlmc-devel] ClipWorkflow: Use a boolean instead of yet another state for 'Muted'
Hugo Beauzée-Luyssen
git at videolan.org
Sun Jan 26 22:48:58 CET 2014
vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Sun Jan 26 23:45:08 2014 +0200| [2ce359b9fffafab687bd404089948cc81022c06e] | committer: Hugo Beauzée-Luyssen
ClipWorkflow: Use a boolean instead of yet another state for 'Muted'
This removes the duplicate & confusing handling for mutex & stop
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=2ce359b9fffafab687bd404089948cc81022c06e
---
src/Workflow/ClipWorkflow.cpp | 10 ++++++++--
src/Workflow/ClipWorkflow.h | 6 +++---
src/Workflow/TrackWorkflow.cpp | 6 +++---
3 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/src/Workflow/ClipWorkflow.cpp b/src/Workflow/ClipWorkflow.cpp
index d1536da..5f13beb 100644
--- a/src/Workflow/ClipWorkflow.cpp
+++ b/src/Workflow/ClipWorkflow.cpp
@@ -249,13 +249,19 @@ void
ClipWorkflow::mute()
{
stop();
- m_state = Muted;
+ m_muted = true;
}
void
ClipWorkflow::unmute()
{
- m_state = Stopped;
+ m_muted = false;
+}
+
+bool
+ClipWorkflow::isMuted() const
+{
+ return m_muted;
}
void
diff --git a/src/Workflow/ClipWorkflow.h b/src/Workflow/ClipWorkflow.h
index b3d52e6..66d957e 100644
--- a/src/Workflow/ClipWorkflow.h
+++ b/src/Workflow/ClipWorkflow.h
@@ -82,10 +82,8 @@ class ClipWorkflow : public EffectUser
/// \brief This state will be used when the media player is paused,
/// because of a sufficient number of computed buffers
Paused, //6
- /// \brief This state means a clip is mutted and must not be restarted
- Muted, //7
/// \brief An error was encountered, this ClipWorkflow must not be used anymore.
- Error, //8
+ Error, //7
};
/**
@@ -182,6 +180,7 @@ class ClipWorkflow : public EffectUser
void mute();
void unmute();
+ bool isMuted() const;
void requireResync();
/**
@@ -264,6 +263,7 @@ class ClipWorkflow : public EffectUser
qint64 m_beginPausePts;
qint64 m_pauseDuration;
bool m_fullSpeedRender;
+ bool m_muted;
private slots:
void loadingComplete();
diff --git a/src/Workflow/TrackWorkflow.cpp b/src/Workflow/TrackWorkflow.cpp
index a271fff..22c752b 100644
--- a/src/Workflow/TrackWorkflow.cpp
+++ b/src/Workflow/TrackWorkflow.cpp
@@ -173,6 +173,9 @@ TrackWorkflow::renderClip( ClipWorkflow* cw, qint64 currentFrame,
qint64 start , bool needRepositioning,
bool renderOneFrame, bool paused )
{
+ if ( cw->isMuted() == true )
+ return NULL;
+
ClipWorkflow::GetMode mode = ( paused == false || renderOneFrame == true ?
ClipWorkflow::Pop : ClipWorkflow::Get );
@@ -201,7 +204,6 @@ TrackWorkflow::renderClip( ClipWorkflow* cw, qint64 currentFrame,
return cw->getOutput( mode, currentFrame - start );
}
else if ( state == ClipWorkflow::EndReached ||
- state == ClipWorkflow::Muted ||
state == ClipWorkflow::Error )
{
//The stopClipWorkflow() method will take care of that.
@@ -226,7 +228,6 @@ TrackWorkflow::stopClipWorkflow( ClipWorkflow* cw )
// qDebug() << "Stopping clip workflow";
ClipWorkflow::State state = cw->getState();
if ( state == ClipWorkflow::Stopped ||
- state == ClipWorkflow::Muted ||
state == ClipWorkflow::Error )
return ;
cw->stop();
@@ -614,7 +615,6 @@ TrackWorkflow::stopFrameComputing()
ClipWorkflow::State state = cw->getState();
if ( state == ClipWorkflow::Stopped ||
- state == ClipWorkflow::Muted ||
state == ClipWorkflow::Error )
{
return ;
More information about the Vlmc-devel
mailing list