From: lilo_booter Date: Wed, 17 Nov 2004 10:42:06 +0000 (+0000) Subject: Ref count and event firing method on properties; locate_cut on tractor X-Git-Url: http://research.m1stereo.tv/gitweb?a=commitdiff_plain;h=abc4d14957a257a91fcab8177d91d5a067450afd;hp=cdf2dbd4142d046054baf2f675ff5bec30bb449a;p=melted Ref count and event firing method on properties; locate_cut on tractor git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt++@528 d19143bc-622f-0410-bfdd-b5b2a6649095 --- diff --git a/mlt++/src/MltProperties.cpp b/mlt++/src/MltProperties.cpp index 98e87f9..fdda0e6 100644 --- a/mlt++/src/MltProperties.cpp +++ b/mlt++/src/MltProperties.cpp @@ -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; diff --git a/mlt++/src/MltProperties.h b/mlt++/src/MltProperties.h index 7952da0..c8bb199 100644 --- a/mlt++/src/MltProperties.h +++ b/mlt++/src/MltProperties.h @@ -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 ); diff --git a/mlt++/src/MltTractor.cpp b/mlt++/src/MltTractor.cpp index d7bd8d6..461b33d 100644 --- a/mlt++/src/MltTractor.cpp +++ b/mlt++/src/MltTractor.cpp @@ -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; +} diff --git a/mlt++/src/MltTractor.h b/mlt++/src/MltTractor.h index 6638d7e..29a7e22 100644 --- a/mlt++/src/MltTractor.h +++ b/mlt++/src/MltTractor.h @@ -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 ); }; }