[vlmc-devel] MLTBackend: Negate the return value if mlt returns true if there was an error

Yikai Lu git at videolan.org
Thu Jun 30 08:35:10 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Thu Jun 30 15:33:35 2016 +0900| [297275bb5875d81086ea528c27c221ba55406d09] | committer: Yikai Lu

MLTBackend: Negate the return value if mlt returns true if there was an error

> https://code.videolan.org/videolan/vlmc/commit/297275bb5875d81086ea528c27c221ba55406d09
---

 src/Backend/MLT/MLTFilter.cpp     |  8 +++-----
 src/Backend/MLT/MLTInput.cpp      |  8 ++++----
 src/Backend/MLT/MLTMultiTrack.cpp |  8 ++++----
 src/Backend/MLT/MLTOutput.cpp     |  2 +-
 src/Backend/MLT/MLTTrack.cpp      | 10 +++++-----
 5 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/src/Backend/MLT/MLTFilter.cpp b/src/Backend/MLT/MLTFilter.cpp
index 17615f5..afa02b4 100644
--- a/src/Backend/MLT/MLTFilter.cpp
+++ b/src/Backend/MLT/MLTFilter.cpp
@@ -24,6 +24,7 @@
 #include <mlt++/MltFilter.h>
 #include <mlt++/MltProducer.h>
 
+#include <cassert>
 #include <cstring>
 #include "Backend/IBackend.h"
 #include "MLTProfile.h"
@@ -213,13 +214,10 @@ bool
 MLTFilter::connect( Backend::IInput& input, int index )
 {
     MLTInput* mltInput = dynamic_cast<MLTInput*>( &input );
-
-    if ( mltInput == nullptr )
-        return true;
-
+    assert( mltInput );
     m_connectedProducer.reset( new Mlt::Producer( mltInput->producer()->get_producer() ) );
 
-    return filter()->connect( *mltInput->producer(), index );
+    return !filter()->connect( *mltInput->producer(), index );
 }
 
 void
diff --git a/src/Backend/MLT/MLTInput.cpp b/src/Backend/MLT/MLTInput.cpp
index c74bc96..31e4849 100644
--- a/src/Backend/MLT/MLTInput.cpp
+++ b/src/Backend/MLT/MLTInput.cpp
@@ -361,7 +361,7 @@ MLTInput::attach( Backend::IFilter& filter )
     assert( mltFilter );
     auto ret = producer()->attach( *mltFilter->filter() );
     mltFilter->connect( *this );
-    return ret;
+    return !ret;
 }
 
 bool
@@ -369,7 +369,7 @@ MLTInput::detach( Backend::IFilter& filter )
 {
     MLTFilter* mltFilter = dynamic_cast<MLTFilter*>( &filter );
     assert( mltFilter );
-    return producer()->detach( *mltFilter->filter() );
+    return !producer()->detach( *mltFilter->filter() );
 }
 
 bool
@@ -378,7 +378,7 @@ MLTInput::detach( int index )
     auto filter = producer()->filter( index );
     auto ret = producer()->detach( *filter );
     delete filter;
-    return ret;
+    return !ret;
 }
 
 int
@@ -390,7 +390,7 @@ MLTInput::filterCount() const
 bool
 MLTInput::moveFilter( int from, int to )
 {
-    return producer()->move_filter( from, to );
+    return !producer()->move_filter( from, to );
 }
 
 std::shared_ptr<Backend::IFilter>
diff --git a/src/Backend/MLT/MLTMultiTrack.cpp b/src/Backend/MLT/MLTMultiTrack.cpp
index f9c5bee..7b06d87 100644
--- a/src/Backend/MLT/MLTMultiTrack.cpp
+++ b/src/Backend/MLT/MLTMultiTrack.cpp
@@ -85,7 +85,7 @@ MLTMultiTrack::setTrack( Backend::IInput& input, int index )
 {
     MLTInput* mltInput = dynamic_cast<MLTInput*>( &input );
     assert( mltInput );
-    return tractor()->set_track( *mltInput->producer(), index );
+    return !tractor()->set_track( *mltInput->producer(), index );
 }
 
 bool
@@ -93,13 +93,13 @@ MLTMultiTrack::insertTrack( Backend::IInput& input, int index )
 {
     MLTInput* mltInput = dynamic_cast<MLTInput*>( &input );
     assert( mltInput );
-    return tractor()->insert_track( *mltInput->producer(), index );
+    return !tractor()->insert_track( *mltInput->producer(), index );
 }
 
 bool
 MLTMultiTrack::removeTrack( int index )
 {
-    return tractor()->remove_track( index );
+    return !tractor()->remove_track( index );
 }
 
 Backend::IInput*
@@ -133,5 +133,5 @@ MLTMultiTrack::connect( Backend::IInput& input )
 {
     MLTInput* mltInput = dynamic_cast<MLTInput*>( &input );
     assert( mltInput );
-    return tractor()->connect( *mltInput->producer() );
+    return !tractor()->connect( *mltInput->producer() );
 }
diff --git a/src/Backend/MLT/MLTOutput.cpp b/src/Backend/MLT/MLTOutput.cpp
index 102b61e..c99e850 100644
--- a/src/Backend/MLT/MLTOutput.cpp
+++ b/src/Backend/MLT/MLTOutput.cpp
@@ -147,7 +147,7 @@ MLTOutput::connect( Backend::IInput& input )
     MLTInput* mltInput = dynamic_cast<MLTInput*>( &input );
     assert( mltInput );
     m_input = mltInput;
-    return consumer()->connect( *(mltInput->producer()) );
+    return !consumer()->connect( *(mltInput->producer()) );
 }
 
 bool
diff --git a/src/Backend/MLT/MLTTrack.cpp b/src/Backend/MLT/MLTTrack.cpp
index 98b4b8c..a7db197 100644
--- a/src/Backend/MLT/MLTTrack.cpp
+++ b/src/Backend/MLT/MLTTrack.cpp
@@ -85,7 +85,7 @@ MLTTrack::insertAt( Backend::IInput& input, int64_t startFrame )
 {
     auto mltInput = dynamic_cast<MLTInput*>( &input );
     assert( mltInput );
-    return playlist()->insert_at( (int)startFrame, mltInput->producer(), 1 );
+    return !playlist()->insert_at( (int)startFrame, mltInput->producer(), 1 );
 }
 
 bool
@@ -93,7 +93,7 @@ MLTTrack::append( Backend::IInput& input )
 {
     auto mltInput = dynamic_cast<MLTInput*>( &input );
     assert( mltInput );
-    return playlist()->append( *mltInput->producer() );
+    return !playlist()->append( *mltInput->producer() );
 }
 
 bool
@@ -110,13 +110,13 @@ MLTTrack::remove( int index )
             break;
     }
 
-    return ret;
+    return !ret;
 }
 
 bool
 MLTTrack::move( int src, int dist )
 {
-    return playlist()->move( src, dist );
+    return !playlist()->move( src, dist );
 }
 
 Backend::IInput*
@@ -134,7 +134,7 @@ MLTTrack::clipAt( int64_t position ) const
 bool
 MLTTrack::resizeClip( int clip, int64_t begin, int64_t end )
 {
-    return playlist()->resize_clip( clip, (int)begin, (int)end );
+    return !playlist()->resize_clip( clip, (int)begin, (int)end );
 }
 
 int



More information about the Vlmc-devel mailing list