]> git.sesse.net Git - mlt/commitdiff
Add mlt_transition_get_length().
authorDan Dennedy <dan@dennedy.org>
Mon, 7 Mar 2011 07:45:08 +0000 (23:45 -0800)
committerDan Dennedy <dan@dennedy.org>
Mon, 7 Mar 2011 07:45:08 +0000 (23:45 -0800)
src/framework/mlt_transition.c
src/framework/mlt_transition.h
src/mlt++/MltTransition.cpp
src/mlt++/MltTransition.h

index 01fc2d831c7849361197766a66ead64920bac6f7..afa9fc2c867c8e2cb73e4865ed7e58edc171680f 100644 (file)
@@ -190,6 +190,21 @@ mlt_position mlt_transition_get_out( mlt_transition self )
        return mlt_properties_get_position( MLT_TRANSITION_PROPERTIES( self ), "out" );
 }
 
+/** Get the duration.
+ *
+ * \public \memberof mlt_transition_s
+ * \param self a transition
+ * \return the duration or zero if unlimited
+ */
+
+mlt_position mlt_transition_get_length( mlt_transition self )
+{
+       mlt_properties properties = MLT_SERVICE_PROPERTIES( &self->parent );
+       mlt_position in = mlt_properties_get_position( properties, "in" );
+       mlt_position out = mlt_properties_get_position( properties, "out" );
+       return ( out > 0 ) ? ( out - in + 1 ) : 0;
+}
+
 /** Process the frame.
  *
  * If we have no process method (unlikely), we simply return the a_frame unmolested.
index 0f9879a3087c8c389dabcf47fd7b616dbae17e41..8bf892000074ef90b954377e40cc19c5bad6d125 100644 (file)
@@ -73,6 +73,7 @@ extern int mlt_transition_get_a_track( mlt_transition self );
 extern int mlt_transition_get_b_track( mlt_transition self );
 extern mlt_position mlt_transition_get_in( mlt_transition self );
 extern mlt_position mlt_transition_get_out( mlt_transition self );
+extern mlt_position mlt_transition_get_length( mlt_transition self );
 extern mlt_frame mlt_transition_process( mlt_transition self, mlt_frame a_frame, mlt_frame b_frame );
 extern void mlt_transition_close( mlt_transition self );
 
index 01079291b6cbb398bed5c72d34c8faec3c3a67b3..4e0575fcea36468b09cb39abe7a0b78e446bdad5 100644 (file)
@@ -116,3 +116,8 @@ int Transition::get_out( )
 {
        return mlt_transition_get_out( get_transition() );
 }
+
+int Transition::get_length( )
+{
+       return mlt_transition_get_length( get_transition( ) );
+}
index fb736344e8364bd2ed227bfe81af65be0ee24920..b547c048efb4ba91bd1eeeb93e924efabb990ba6 100644 (file)
@@ -49,6 +49,7 @@ namespace Mlt
                        int get_b_track( );
                        int get_in( );
                        int get_out( );
+                       int get_length( );
        };
 }