Commit 1ea522ad authored by luyikei's avatar luyikei

Backend: Implement transitionInfo

parent 9008b431
......@@ -51,7 +51,9 @@ class IBackend
virtual ~IBackend() = default;
virtual IProfile& profile() = 0;
virtual const std::map<std::string, IInfo*>& availableFilters() const = 0;
virtual const std::map<std::string, IInfo*>& availableTransitions() const = 0;
virtual IInfo* filterInfo( const std::string& id ) const = 0;
virtual IInfo* transitionInfo( const std::string& id ) const = 0;
virtual void setLogHandler( LogHandler logHandler ) = 0;
};
......
......@@ -72,6 +72,19 @@ MLTBackend::MLTBackend()
}
m_availableFilters[ filterInfo->identifier() ] = filterInfo;
}
for ( int i = 0; i < m_mltRepo->transitions()->count(); ++i )
{
auto pro = std::unique_ptr<Mlt::Properties>( m_mltRepo->metadata( transition_type, m_mltRepo->transitions()->get_name( i ) ) );
auto transitionInfo = new MLTServiceInfo;
transitionInfo->setProperties( pro.get() );
if ( transitionInfo->identifier().empty() == true )
{
delete transitionInfo;
continue;
}
m_availableTransitions[ transitionInfo->identifier() ] = transitionInfo;
}
}
MLTBackend::~MLTBackend()
......@@ -94,6 +107,12 @@ MLTBackend::availableFilters() const
return m_availableFilters;
}
const std::map<std::string, IInfo *>&
MLTBackend::availableTransitions() const
{
return m_availableTransitions;
}
IInfo*
MLTBackend::filterInfo( const std::string& id ) const
{
......@@ -103,6 +122,15 @@ MLTBackend::filterInfo( const std::string& id ) const
return nullptr;
}
IInfo*
MLTBackend::transitionInfo( const std::string& id ) const
{
auto it = m_availableTransitions.find( id );
if ( it != m_availableTransitions.end() )
return (*it).second;
return nullptr;
}
void
MLTBackend::setLogHandler( IBackend::LogHandler logHandler )
{
......
......@@ -54,7 +54,9 @@ class MLTBackend : public IBackend, public Singleton<MLTBackend>
virtual const std::map<std::string, IInfo*>& availableFilters() const override;
virtual const std::map<std::string, IInfo*>& availableTransitions() const override;
virtual IInfo* filterInfo( const std::string& id ) const override;
virtual IInfo* transitionInfo( const std::string& id ) const override;
virtual void setLogHandler( LogHandler logHandler ) override;
......@@ -65,6 +67,7 @@ class MLTBackend : public IBackend, public Singleton<MLTBackend>
MLTProfile m_profile;
std::map<std::string, IInfo*> m_availableFilters;
std::map<std::string, IInfo*> m_availableTransitions;
friend Singleton_t::AllowInstantiation;
};
......
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