Commit 20a604d4 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Don't automatically create the Media's base clip.

parent 3e125b60
......@@ -171,8 +171,10 @@ ImportController::importMedia( const QString &filePath )
++m_nbMediaToLoad;
m_ui->progressBar->setMaximum( m_nbMediaToLoad );
Media* media = m_temporaryMedias->addMedia( filePath );
m_temporaryMedias->addClip( media->baseClip() );
Media* media = m_temporaryMedias->addMedia( filePath );
Clip* clip = new Clip( media );
media->setBaseClip( clip );
m_temporaryMedias->addClip( clip );
if ( media )
connect( media, SIGNAL( metaDataComputed( const Media* ) ),
this, SLOT( metaDataComputed( const Media* ) ) );
......
......@@ -61,6 +61,7 @@ Library::loadProject( const QDomElement& doc )
if ( clips.isNull() == true )
return ;
load( clips, this );
qDebug() << m_clips;
emit projectLoaded();
}
......
......@@ -73,16 +73,12 @@ MediaContainer::addMedia( const QFileInfo& fileInfo, const QString& uuid )
{
if ( QFile::exists( fileInfo.absoluteFilePath() ) == false )
return NULL;
Media* media = new Media( fileInfo.filePath(), uuid );
foreach( Clip* it, m_clips.values() )
{
if ( it->getMedia()->fileInfo()->filePath() == media->fileInfo()->filePath() )
{
delete media;
if ( it->getMedia()->fileInfo()->filePath() == fileInfo.filePath() )
return NULL;
}
}
Media* media = new Media( fileInfo.filePath(), uuid );
MetaDataManager::getInstance()->computeMediaMetadata( media );
return media;
}
......
......@@ -77,7 +77,6 @@ Media::Media( const QString& filePath, const QString& uuid /*= QString()*/ )
m_fileName = m_mrl;
qDebug() << "Loading a stream";
}
m_baseClip = new Clip( this, 0, -1, uuid );
m_audioValueList = new QList<int>();
m_vlcMedia = new LibVLCpp::Media( m_mrl );
}
......@@ -285,3 +284,10 @@ Media::save( QXmlStreamWriter& project )
project.writeAttribute( "mrl", m_fileInfo->absoluteFilePath() );
project.writeEndElement();
}
void
Media::setBaseClip( Clip *clip )
{
Q_ASSERT( m_baseClip == NULL );
m_baseClip = clip;
}
......@@ -139,6 +139,7 @@ public:
Clip* baseClip() { return m_baseClip; }
const Clip* baseClip() const { return m_baseClip; }
void setBaseClip( Clip* clip );
bool isMetadataComputed() const;
......
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