[vlmc-devel] Media: Construct the base/root clip when constructing the media

Hugo Beauzée-Luyssen git at videolan.org
Fri Aug 19 02:41:40 CEST 2016


vlmc | branch: medialibrary | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Aug 19 00:27:38 2016 +0200| [0fdf57f4e5e81d0cf334ce7af4703980c506c45b] | committer: Hugo Beauzée-Luyssen

Media: Construct the base/root clip when constructing the media

> https://code.videolan.org/videolan/vlmc/commit/0fdf57f4e5e81d0cf334ce7af4703980c506c45b
---

 src/Media/Media.cpp | 2 +-
 src/Media/Media.h   | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/Media/Media.cpp b/src/Media/Media.cpp
index c6ad9eb..da8231d 100644
--- a/src/Media/Media.cpp
+++ b/src/Media/Media.cpp
@@ -66,7 +66,6 @@ QPixmap*        Media::defaultSnapshot = nullptr;
 Media::Media( medialibrary::MediaPtr media )
     : m_input( nullptr )
     , m_mlMedia( media )
-    , m_baseClip( nullptr )
 {
     auto files = media->files();
     Q_ASSERT( files.size() > 0 );
@@ -81,6 +80,7 @@ Media::Media( medialibrary::MediaPtr media )
     if ( m_mlFile == nullptr )
         vlmcFatal( "No file representing media %s", media->title().c_str(), "was found" );
     m_input.reset( new Backend::MLT::MLTInput( m_mlFile->mrl().c_str() ) );
+    m_baseClip = new Clip( sharedFromThis() );
 }
 
 QString
diff --git a/src/Media/Media.h b/src/Media/Media.h
index f22c35d..d204fb7 100644
--- a/src/Media/Media.h
+++ b/src/Media/Media.h
@@ -34,6 +34,7 @@
 
 #include <memory>
 
+#include <QEnableSharedFromThis>
 #include <QString>
 #include <QObject>
 #include <QXmlStreamWriter>
@@ -61,7 +62,7 @@ class Clip;
 /**
   * Represents a basic container for media informations.
   */
-class       Media : public QObject
+class       Media : public QObject, public QEnableSharedFromThis<Media>
 {
     Q_OBJECT
 



More information about the Vlmc-devel mailing list