Commit e7b875f2 by luyikei

ITrack: Implement a hide function to replace setMute and setVideoEnabled

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