Ref count and event firing method on properties; locate_cut on tractor
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 17 Nov 2004 10:42:06 +0000 (10:42 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 17 Nov 2004 10:42:06 +0000 (10:42 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt++@528 d19143bc-622f-0410-bfdd-b5b2a6649095

mlt++/src/MltProperties.cpp
mlt++/src/MltProperties.h
mlt++/src/MltTractor.cpp
mlt++/src/MltTractor.h

index 98e87f9..fdda0e6 100644 (file)
@@ -36,14 +36,12 @@ Properties::Properties( bool dummy ) :
 Properties::Properties( Properties &properties ) :
        instance( properties.get_properties( ) )
 {
-       fprintf( stderr, "Incrementing ref count on properties #1\n" );
        inc_ref( );
 }
 
 Properties::Properties( mlt_properties properties ) :
        instance( properties )
 {
-       fprintf( stderr, "Incrementing ref count on properties #2\n" );
        inc_ref( );
 }
 
@@ -73,6 +71,11 @@ int Properties::dec_ref( )
        return mlt_properties_dec_ref( get_properties( ) );
 }
 
+int Properties::ref_count( )
+{
+       return mlt_properties_ref_count( get_properties( ) );
+}
+
 void Properties::block( void *object )
 {
        mlt_events_block( get_properties( ), object );
@@ -83,6 +86,11 @@ void Properties::unblock( void *object )
        mlt_events_unblock( get_properties( ), object );
 }
 
+void Properties::fire_event( const char *event )
+{
+       mlt_events_fire( get_properties( ), ( char * )event, NULL );
+}
+
 bool Properties::is_valid( )
 {
        return get_properties( ) != NULL;
index 7952da0..c8bb199 100644 (file)
@@ -46,8 +46,10 @@ namespace Mlt
                        virtual ~Properties( );
                        int inc_ref( );
                        int dec_ref( );
+                       int ref_count( );
                        void block( void *object = NULL );
                        void unblock( void *object = NULL );
+                       void fire_event( const char *event );
                        bool is_valid( );
                        int count( );
                        char *get( char *name );
index d7bd8d6..461b33d 100644 (file)
@@ -23,6 +23,7 @@
 #include "MltField.h"
 #include "MltTransition.h"
 #include "MltFilter.h"
+#include "MltPlaylist.h"
 using namespace Mlt;
 
 Tractor::Tractor( ) :
@@ -119,3 +120,23 @@ void Tractor::plant_filter( Filter *filter, int track )
        mlt_field_plant_filter( mlt_tractor_field( get_tractor( ) ), filter->get_filter( ), track );
 }
 
+bool Tractor::locate_cut( Producer *producer, int &track, int &cut )
+{
+       bool found = false;
+
+       for ( track = 0; producer != NULL && !found && track < count( ); track ++ )
+       {
+               Playlist playlist( ( mlt_playlist )mlt_tractor_get_track( get_tractor( ), track ) );
+               for ( cut = 0; !found && cut < playlist.count( ); cut ++ )
+               {
+                       Producer *clip = playlist.get_clip( cut );
+                       found = producer->get_producer( ) == clip->get_producer( );
+                       delete clip;
+               }
+       }
+
+       track --;
+       cut --;
+
+       return found;
+}
index 6638d7e..29a7e22 100644 (file)
@@ -55,6 +55,7 @@ namespace Mlt
                        void plant_transition( Transition *transition, int a_track = 0, int b_track = 1 );
                        void plant_filter( Filter &filter, int track = 0 );
                        void plant_filter( Filter *filter, int track = 0 );
+                       bool locate_cut( Producer *producer, int &track, int &cut );
        };
 }