]> git.sesse.net Git - mlt/commitdiff
Add mlt_filter_get_length().
authorDan Dennedy <dan@dennedy.org>
Mon, 7 Mar 2011 07:10:36 +0000 (23:10 -0800)
committerDan Dennedy <dan@dennedy.org>
Mon, 7 Mar 2011 07:10:36 +0000 (23:10 -0800)
src/framework/mlt_filter.c
src/framework/mlt_filter.h
src/mlt++/MltFilter.cpp
src/mlt++/MltFilter.h

index e3de41e654bffc234abf1988a67831edaa90b08c..f9a256a92c4c77280c81d9cb5708686ba4c8a9c0 100644 (file)
@@ -187,6 +187,21 @@ mlt_position mlt_filter_get_out( mlt_filter self )
        return mlt_properties_get_position( properties, "out" );
 }
 
+/** Get the duration.
+ *
+ * \public \memberof mlt_filter_s
+ * \param self a filter
+ * \return the duration or zero if unlimited
+ */
+
+mlt_position mlt_filter_get_length( mlt_filter 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.
  *
  * \public \memberof mlt_filter_s
index 5f43e570d9a544d48a1a32e1a66619af7b72f795..fee1cc91ea041edd5353e98f5248d0f321252789 100644 (file)
@@ -64,6 +64,7 @@ extern void mlt_filter_set_in_and_out( mlt_filter self, mlt_position in, mlt_pos
 extern int mlt_filter_get_track( mlt_filter self );
 extern mlt_position mlt_filter_get_in( mlt_filter self );
 extern mlt_position mlt_filter_get_out( mlt_filter self );
+extern mlt_position mlt_filter_get_length( mlt_filter self );
 extern void mlt_filter_close( mlt_filter );
 
 #endif
index 971571b48bdafb1a499dcd66f7f40ea8e680beca..ce1b1773877816621b7009a254dce6f12bd7225d 100644 (file)
@@ -106,6 +106,11 @@ int Filter::get_out( )
        return mlt_filter_get_out( get_filter( ) );
 }
 
+int Filter::get_length( )
+{
+       return mlt_filter_get_length( get_filter( ) );
+}
+
 int Filter::get_track( )
 {
        return mlt_filter_get_track( get_filter( ) );
index 828b27d412a9d5de0db85fc94629f90b8d99cd2d..a572b934f7cc3b464db6c2e565a01a6a823b1eb0 100644 (file)
@@ -48,6 +48,7 @@ namespace Mlt
                        void set_in_and_out( int in, int out );
                        int get_in( );
                        int get_out( );
+                       int get_length( );
                        int get_track( );
        };
 }