From 381a460ef57540a8d2f8c4d5498c53385318b3ce Mon Sep 17 00:00:00 2001 From: Dan Dennedy Date: Sun, 6 Mar 2011 23:45:08 -0800 Subject: [PATCH] Add mlt_transition_get_length(). --- src/framework/mlt_transition.c | 15 +++++++++++++++ src/framework/mlt_transition.h | 1 + src/mlt++/MltTransition.cpp | 5 +++++ src/mlt++/MltTransition.h | 1 + 4 files changed, 22 insertions(+) diff --git a/src/framework/mlt_transition.c b/src/framework/mlt_transition.c index 01fc2d83..afa9fc2c 100644 --- a/src/framework/mlt_transition.c +++ b/src/framework/mlt_transition.c @@ -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. diff --git a/src/framework/mlt_transition.h b/src/framework/mlt_transition.h index 0f9879a3..8bf89200 100644 --- a/src/framework/mlt_transition.h +++ b/src/framework/mlt_transition.h @@ -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 ); diff --git a/src/mlt++/MltTransition.cpp b/src/mlt++/MltTransition.cpp index 01079291..4e0575fc 100644 --- a/src/mlt++/MltTransition.cpp +++ b/src/mlt++/MltTransition.cpp @@ -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( ) ); +} diff --git a/src/mlt++/MltTransition.h b/src/mlt++/MltTransition.h index fb736344..b547c048 100644 --- a/src/mlt++/MltTransition.h +++ b/src/mlt++/MltTransition.h @@ -49,6 +49,7 @@ namespace Mlt int get_b_track( ); int get_in( ); int get_out( ); + int get_length( ); }; } -- 2.39.5