[vlmc-devel] Media: Fix saving/loading sub clips

Yikai Lu git at videolan.org
Wed Jun 21 12:56:43 CEST 2017


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Wed Jun 21 19:55:18 2017 +0900| [3f797e4d2a15a70f60c717b75bd32d403c5eacf4] | committer: Yikai Lu

Media: Fix saving/loading sub clips

Somehow we changed the saving format and didn't update it

> https://code.videolan.org/videolan/vlmc/commit/3f797e4d2a15a70f60c717b75bd32d403c5eacf4
---

 src/Library/Library.cpp | 9 ++++++---
 src/Media/Media.cpp     | 4 ++--
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/Library/Library.cpp b/src/Library/Library.cpp
index 5b50220d..8430d08a 100644
--- a/src/Library/Library.cpp
+++ b/src/Library/Library.cpp
@@ -83,11 +83,14 @@ Library::postLoad()
     for ( const auto& var : m_settings->value( "medias" )->get().toList() )
     {
         auto map = var.toMap();
-        auto subClipsMap = map["clips"].toMap();
-        map["clips"] = QVariant();
         auto m = Media::fromVariant( map );
         addMedia( m );
-        m->loadSubclip( subClipsMap );
+        if ( map.contains( "clips" ) == true )
+        {
+            const auto& subClipsList = map["clips"].toList();
+            for ( const auto& subClip : subClipsList )
+                m->loadSubclip( subClip.toMap() );
+        }
     }
 }
 
diff --git a/src/Media/Media.cpp b/src/Media/Media.cpp
index fdf7e55d..c5a28b90 100644
--- a/src/Media/Media.cpp
+++ b/src/Media/Media.cpp
@@ -211,12 +211,12 @@ Media::snapshot()
 QSharedPointer<Clip>
 Media::loadSubclip( const QVariantMap& m )
 {
-    if ( m.contains( "uuid" ) == false || m.contains( "begin" ) == false || m.contains( "end" ) == false )
+    if ( m.contains( "libraryUuid" ) == false || m.contains( "begin" ) == false || m.contains( "end" ) == false )
     {
         vlmcWarning() << "Invalid clip provided:" << m;
         return {};
     }
-    const auto& uuid = m["uuid"].toUuid();
+    const auto& uuid = m["libraryUuid"].toUuid();
     const auto  begin = m["begin"].toLongLong();
     const auto  end = m["end"].toLongLong();
     auto clip = QSharedPointer<Clip>::create( sharedFromThis(), begin, end, uuid );



More information about the Vlmc-devel mailing list