[vlmc-devel] MLTBackend: Workaround a bug of mlt++ that mlt_service owned by mlt_consumer could be deleted in mlt_vlog

Yikai Lu git at videolan.org
Tue Apr 4 04:03:29 CEST 2017


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Mon Apr  3 21:00:34 2017 -0500| [ea7243d2cd79133d172c00ddf53a5fb0099fda4f] | committer: Yikai Lu

MLTBackend: Workaround a bug of mlt++ that mlt_service owned by mlt_consumer could be deleted in mlt_vlog

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

 src/Backend/MLT/MLTBackend.cpp | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/Backend/MLT/MLTBackend.cpp b/src/Backend/MLT/MLTBackend.cpp
index 3cd0a2a..0a599bb 100644
--- a/src/Backend/MLT/MLTBackend.cpp
+++ b/src/Backend/MLT/MLTBackend.cpp
@@ -111,19 +111,17 @@ MLTBackend::setLogHandler( IBackend::LogHandler logHandler )
     {
         std::string msg_str;
 
-        Mlt::Service service( ( mlt_service )ptr );
-
-        if ( service.is_valid() )
+        if ( ptr != nullptr )
         {
-            const char *mlt_type = service.get( "mlt_type" );
-            const char *mlt_service = service.get( "mlt_service" );
+            auto mltType = mlt_properties_get( MLT_SERVICE_PROPERTIES( ( mlt_service )ptr ), "mlt_type" );
+            auto mltService = mlt_properties_get( MLT_SERVICE_PROPERTIES( ( mlt_service )ptr ), "mlt_service" );
             std::ostringstream os;
 
-            if ( mlt_service && mlt_type )
-                os << "[" << mlt_type << " " << mlt_service << "] ";
-            else if ( mlt_type )
+            if ( mltService && mltType )
+                os << "[" << mltType << " " << mltService << "] ";
+            else if ( mltType )
             {
-                os << "[" << mlt_type << " " << ptr << "] ";
+                os << "[" << mltType << " " << ptr << "] ";
             }
 
             msg_str = os.str();



More information about the Vlmc-devel mailing list