Commit e7b875f2 authored by luyikei's avatar luyikei

ITrack: Implement a hide function to replace setMute and setVideoEnabled

parent f9fcbd05
...@@ -28,6 +28,14 @@ ...@@ -28,6 +28,14 @@
namespace Backend namespace Backend
{ {
enum class HideType
{
None,
Video,
Audio,
VideoAndAudio
};
class ITrack : virtual public IInput class ITrack : virtual public IInput
{ {
public: public:
...@@ -45,8 +53,7 @@ namespace Backend ...@@ -45,8 +53,7 @@ namespace Backend
virtual int count() const = 0; virtual int count() const = 0;
virtual void clear() = 0; virtual void clear() = 0;
virtual void setMute( bool muted ) = 0; virtual void hide( HideType hideType ) = 0;
virtual void setVideoEnabled( bool enabled ) = 0;
}; };
} }
......
...@@ -35,14 +35,6 @@ ...@@ -35,14 +35,6 @@
using namespace Backend::MLT; using namespace Backend::MLT;
enum HideType
{
None,
Video,
Audio,
VideoAndAudio
};
MLTTrack::MLTTrack() MLTTrack::MLTTrack()
: MLTTrack( Backend::instance()->profile() ) : MLTTrack( Backend::instance()->profile() )
{ {
...@@ -161,31 +153,7 @@ MLTTrack::clear() ...@@ -161,31 +153,7 @@ MLTTrack::clear()
} }
void void
MLTTrack::setMute( bool muted ) MLTTrack::hide( Backend::HideType hydeType )
{ {
if ( muted == false ) playlist()->set( "hide", static_cast<int>( hydeType ) );
if ( playlist()->get_int( "hide" ) == HideType::VideoAndAudio )
playlist()->set( "hide", HideType::Video );
else
playlist()->set( "hide", HideType::None );
else
if ( playlist()->get_int( "hide" ) == HideType::Video )
playlist()->set( "hide", HideType::VideoAndAudio );
else
playlist()->set( "hide", HideType::Audio );
}
void
MLTTrack::setVideoEnabled( bool enabled )
{
if ( enabled == true )
if ( playlist()->get_int( "hide" ) == HideType::VideoAndAudio )
playlist()->set( "hide", HideType::Audio );
else
playlist()->set( "hide", HideType::None );
else
if ( playlist()->get_int( "hide" ) == HideType::Audio )
playlist()->set( "hide", HideType::VideoAndAudio );
else
playlist()->set( "hide", HideType::Video );
} }
...@@ -61,9 +61,7 @@ class MLTTrack : public ITrack, public MLTInput ...@@ -61,9 +61,7 @@ class MLTTrack : public ITrack, public MLTInput
virtual int clipIndexAt( int64_t position ) override; virtual int clipIndexAt( int64_t position ) override;
virtual int count() const override; virtual int count() const override;
virtual void clear() override; virtual void clear() override;
virtual void hide( HideType hideType ) override;
virtual void setMute( bool muted ) override;
virtual void setVideoEnabled( bool enabled ) override;
private: private:
Mlt::Playlist* m_playlist; Mlt::Playlist* m_playlist;
......
...@@ -42,11 +42,11 @@ SequenceWorkflow::SequenceWorkflow( size_t trackCount ) ...@@ -42,11 +42,11 @@ SequenceWorkflow::SequenceWorkflow( size_t trackCount )
for ( int i = 0; i < trackCount; ++i ) for ( int i = 0; i < trackCount; ++i )
{ {
auto audioTrack = std::shared_ptr<Backend::ITrack>( new Backend::MLT::MLTTrack ); auto audioTrack = std::shared_ptr<Backend::ITrack>( new Backend::MLT::MLTTrack );
audioTrack->setVideoEnabled( false ); audioTrack->hide( Backend::HideType::Video );
m_tracks[Workflow::AudioTrack] << audioTrack; m_tracks[Workflow::AudioTrack] << audioTrack;
auto videoTrack = std::shared_ptr<Backend::ITrack>( new Backend::MLT::MLTTrack ); auto videoTrack = std::shared_ptr<Backend::ITrack>( new Backend::MLT::MLTTrack );
videoTrack->setMute( true ); videoTrack->hide( Backend::HideType::Audio );
m_tracks[Workflow::VideoTrack] << videoTrack; m_tracks[Workflow::VideoTrack] << videoTrack;
auto multitrack = std::shared_ptr<Backend::IMultiTrack>( new Backend::MLT::MLTMultiTrack ); auto multitrack = std::shared_ptr<Backend::IMultiTrack>( new Backend::MLT::MLTMultiTrack );
......
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