[vlmc-devel] Media: Regenerate a source when relocating the file.
Hugo Beauzée-Luyssen
git at videolan.org
Mon Feb 24 20:09:41 CET 2014
vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Feb 24 14:55:11 2014 +0200| [2267cd8007d53b07b2089af78669d5b97b24f65a] | committer: Hugo Beauzée-Luyssen
Media: Regenerate a source when relocating the file.
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=2267cd8007d53b07b2089af78669d5b97b24f65a
---
src/Media/Media.cpp | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/src/Media/Media.cpp b/src/Media/Media.cpp
index 6e44caf..ef91342 100644
--- a/src/Media/Media.cpp
+++ b/src/Media/Media.cpp
@@ -55,24 +55,20 @@ const QString Media::streamPrefix = "stream://";
QPixmap* Media::defaultSnapshot = NULL;
Media::Media(const QString &path )
- : m_fileInfo( NULL )
+ : m_source( NULL )
+ , m_fileInfo( NULL )
, m_nbFrames( 0 )
, m_baseClip( NULL )
, m_inWorkspace( false )
, m_snapshotImage( NULL )
{
setFilePath( path );
- Backend::IBackend* backend = Backend::getBackend();
- m_source = backend->createSource( qPrintable( path ) );
- MetaDataManager::getInstance()->computeMediaMetadata( this );
}
Media::~Media()
{
- if ( m_source )
- delete m_source;
- if ( m_fileInfo )
- delete m_fileInfo;
+ delete m_source;
+ delete m_fileInfo;
}
void
@@ -187,9 +183,12 @@ Media::setFilePath( const QString &filePath )
m_fileName = m_fileInfo->fileName();
computeFileType();
m_mrl = "file:///" + QUrl::toPercentEncoding( filePath, "/" );
-// if ( m_vlcMedia )
-// delete m_vlcMedia;
-// m_vlcMedia = new LibVLCpp::Media( m_mrl );
+
+ Backend::IBackend* backend = Backend::getBackend();
+ delete m_source;
+ m_source = backend->createSource( qPrintable( path ) );
+ MetaDataManager::getInstance()->computeMediaMetadata( this );
+
//Don't call this before setting all the internals, as it relies on Media::fileInfo.
if ( Workspace::isInProjectDir( this ) == true )
{
More information about the Vlmc-devel
mailing list