[vlmc-devel] Search Clip by UUID

Yikai Lu git at videolan.org
Sat Apr 9 22:18:10 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Sat Apr  9 11:44:08 2016 +0900| [fea4e542dd43c3c4e56619e2c271dc2f7ea162e2] | committer: Hugo Beauzée-Luyssen

Search Clip by UUID

Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

> https://code.videolan.org/videolan/vlmc/commit/fea4e542dd43c3c4e56619e2c271dc2f7ea162e2
---

 src/Library/MediaContainer.cpp | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/Library/MediaContainer.cpp b/src/Library/MediaContainer.cpp
index 6eacaa8..5473abc 100644
--- a/src/Library/MediaContainer.cpp
+++ b/src/Library/MediaContainer.cpp
@@ -56,18 +56,16 @@ MediaContainer::clip( const QUuid& uuid )
 Clip*
 MediaContainer::clip( const QString &uuid )
 {
-    MediaContainer      *mc = this;
-    Clip                *clip = nullptr;
-    QStringList         ids = uuid.split( '/' );
-
-    foreach ( QString id, ids )
-    {
-        clip = mc->clip( QUuid( id ) );
-        if ( clip == nullptr )
-            return nullptr;
-        mc = clip->getChilds();
-    }
-    return clip;
+    for ( const auto& clip : m_clips )
+        if ( clip->uuid().toString() == uuid )
+            return clip;
+        else
+        {
+            auto c = clip->getChilds()->clip( uuid );
+            if ( c != nullptr )
+                return c;
+        }
+    return nullptr;
 }
 
 void



More information about the Vlmc-devel mailing list