[vlmc-devel] Workflow: Implement mute and unmute tracks
Yikai Lu
git at videolan.org
Wed Jun 29 14:44:02 CEST 2016
vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Wed Jun 29 21:41:55 2016 +0900| [2f4073eaa7a0ee76d433834e8fbe35c47c42eadb] | committer: Yikai Lu
Workflow: Implement mute and unmute tracks
> https://code.videolan.org/videolan/vlmc/commit/2f4073eaa7a0ee76d433834e8fbe35c47c42eadb
---
src/Backend/ITrack.h | 3 +++
src/Backend/MLT/MLTTrack.cpp | 6 +++---
src/Backend/MLT/MLTTrack.h | 4 ++--
src/Gui/timeline/GraphicsTrack.cpp | 4 ++--
src/Workflow/MainWorkflow.cpp | 6 ++++--
src/Workflow/MainWorkflow.h | 4 ++--
src/Workflow/TrackWorkflow.cpp | 13 +++++++++++--
src/Workflow/TrackWorkflow.h | 2 ++
8 files changed, 29 insertions(+), 13 deletions(-)
diff --git a/src/Backend/ITrack.h b/src/Backend/ITrack.h
index 0228984..9e2b836 100644
--- a/src/Backend/ITrack.h
+++ b/src/Backend/ITrack.h
@@ -44,6 +44,9 @@ namespace Backend
virtual int clipIndexAt( int64_t position ) = 0;
virtual int count() const = 0;
virtual void clear() = 0;
+
+ virtual void setMute( bool muted ) = 0;
+ virtual void setVideoEnabled( bool enabled ) = 0;
};
}
diff --git a/src/Backend/MLT/MLTTrack.cpp b/src/Backend/MLT/MLTTrack.cpp
index d1ab737..98b4b8c 100644
--- a/src/Backend/MLT/MLTTrack.cpp
+++ b/src/Backend/MLT/MLTTrack.cpp
@@ -156,9 +156,9 @@ MLTTrack::clear()
}
void
-MLTTrack::setAudioOutput( bool enabled )
+MLTTrack::setMute( bool muted )
{
- if ( enabled == true )
+ if ( muted == false )
if ( playlist()->get_int( "hide" ) == HideType::VideoAndAudio )
playlist()->set( "hide", HideType::Video );
else
@@ -171,7 +171,7 @@ MLTTrack::setAudioOutput( bool enabled )
}
void
-MLTTrack::setVideoOutput( bool enabled )
+MLTTrack::setVideoEnabled( bool enabled )
{
if ( enabled == true )
if ( playlist()->get_int( "hide" ) == HideType::VideoAndAudio )
diff --git a/src/Backend/MLT/MLTTrack.h b/src/Backend/MLT/MLTTrack.h
index e104b0e..1e77c7b 100644
--- a/src/Backend/MLT/MLTTrack.h
+++ b/src/Backend/MLT/MLTTrack.h
@@ -62,8 +62,8 @@ class MLTTrack : public ITrack, public MLTInput
virtual int count() const override;
virtual void clear();
- virtual void setAudioOutput( bool enabled );
- virtual void setVideoOutput( bool enabled );
+ virtual void setMute( bool muted ) override;
+ virtual void setVideoEnabled( bool enabled ) override;
private:
Mlt::Playlist* m_playlist;
diff --git a/src/Gui/timeline/GraphicsTrack.cpp b/src/Gui/timeline/GraphicsTrack.cpp
index b8a85ea..9ac15b5 100644
--- a/src/Gui/timeline/GraphicsTrack.cpp
+++ b/src/Gui/timeline/GraphicsTrack.cpp
@@ -65,9 +65,9 @@ GraphicsTrack::setTrackEnabled( bool enabled )
m_enabled = enabled;
if( enabled )
- Core::instance()->workflow()->unmuteTrack( m_trackNumber );
+ Core::instance()->workflow()->unmuteTrack( m_trackNumber, m_type );
else
- Core::instance()->workflow()->muteTrack( m_trackNumber );
+ Core::instance()->workflow()->muteTrack( m_trackNumber, m_type );
}
bool
diff --git a/src/Workflow/MainWorkflow.cpp b/src/Workflow/MainWorkflow.cpp
index 93e974e..efa3800 100644
--- a/src/Workflow/MainWorkflow.cpp
+++ b/src/Workflow/MainWorkflow.cpp
@@ -87,17 +87,19 @@ MainWorkflow::getClipPosition( const QUuid& uuid, unsigned int trackId ) const
}
void
-MainWorkflow::muteTrack( unsigned int trackId )
+MainWorkflow::muteTrack( unsigned int trackId, Workflow::TrackType trackType )
{
Q_ASSERT( trackId < m_trackCount );
m_tracks[trackId].deactivate();
+ m_tracks[trackId]->mute( true, trackType );
}
void
-MainWorkflow::unmuteTrack( unsigned int trackId )
+MainWorkflow::unmuteTrack( unsigned int trackId, Workflow::TrackType trackType )
{
Q_ASSERT( trackId < m_trackCount );
m_tracks[trackId].activate();
+ m_tracks[trackId]->mute( false, trackType );
}
void
diff --git a/src/Workflow/MainWorkflow.h b/src/Workflow/MainWorkflow.h
index ec0b79d..5a9129b 100644
--- a/src/Workflow/MainWorkflow.h
+++ b/src/Workflow/MainWorkflow.h
@@ -79,7 +79,7 @@ class MainWorkflow : public QObject
* \param trackType The type of the track to mute.
* \sa unmuteTrack( unsigned int, Workflow::TrackType );
*/
- void muteTrack( unsigned int trackId );
+ void muteTrack( unsigned int trackId, Workflow::TrackType trackType );
/**
* \brief Unmute a track.
*
@@ -87,7 +87,7 @@ class MainWorkflow : public QObject
* \param trackType The type of the track to unmute.
* \sa muteTrack( unsigned int, Workflow::TrackType );
*/
- void unmuteTrack( unsigned int trackId );
+ void unmuteTrack( unsigned int trackId, Workflow::TrackType trackType );
/**
* \brief Mute a clip.
diff --git a/src/Workflow/TrackWorkflow.cpp b/src/Workflow/TrackWorkflow.cpp
index 2074efa..fabd3fd 100644
--- a/src/Workflow/TrackWorkflow.cpp
+++ b/src/Workflow/TrackWorkflow.cpp
@@ -47,11 +47,11 @@ TrackWorkflow::TrackWorkflow( quint32 trackId, Backend::IMultiTrack* multitrack
m_clipsLock = new QReadWriteLock;
auto audioTrack = new Backend::MLT::MLTTrack;
- audioTrack->setVideoOutput( false );
+ audioTrack->setVideoEnabled( false );
m_audioTrack = audioTrack;
auto videoTrack = new Backend::MLT::MLTTrack;
- videoTrack->setAudioOutput( false );
+ videoTrack->setMute( true );
m_videoTrack = videoTrack;
m_multitrack = new Backend::MLT::MLTMultiTrack;
@@ -253,6 +253,15 @@ TrackWorkflow::clear()
}
void
+TrackWorkflow::mute( bool muted, Workflow::TrackType trackType )
+{
+ if ( trackType == Workflow::AudioTrack )
+ m_audioTrack->setMute( muted );
+ else
+ m_videoTrack->setVideoEnabled( !muted );
+}
+
+void
TrackWorkflow::muteClip( const QUuid &uuid )
{
/* TODO
diff --git a/src/Workflow/TrackWorkflow.h b/src/Workflow/TrackWorkflow.h
index c010265..ec00cf3 100644
--- a/src/Workflow/TrackWorkflow.h
+++ b/src/Workflow/TrackWorkflow.h
@@ -75,6 +75,8 @@ class TrackWorkflow : public QObject
void loadFromVariant( const QVariant& variant );
void clear();
+ void mute( bool muted, Workflow::TrackType trackType );
+
/**
* \brief Mute a clip
*
More information about the Vlmc-devel
mailing list