X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=mlt%2B%2B%2Fsrc%2FMltTractor.cpp;h=43bbceda4462bda05721b7b0751b967a97ba8a5f;hb=f4963a6aa07644399b273b5d2b1f9299c9047414;hp=19c8a244ec16462449b6403581306fdfce676dff;hpb=6d06b0de2cb66cf093bf24d9ed02fac18756105e;p=melted diff --git a/mlt++/src/MltTractor.cpp b/mlt++/src/MltTractor.cpp index 19c8a24..43bbced 100644 --- a/mlt++/src/MltTractor.cpp +++ b/mlt++/src/MltTractor.cpp @@ -21,6 +21,9 @@ #include "MltTractor.h" #include "MltMultitrack.h" #include "MltField.h" +#include "MltTransition.h" +#include "MltFilter.h" +#include "MltPlaylist.h" using namespace Mlt; Tractor::Tractor( ) : @@ -45,11 +48,28 @@ Tractor::Tractor( mlt_tractor tractor ) : } Tractor::Tractor( Tractor &tractor ) : + Mlt::Producer( tractor ), instance( tractor.get_tractor( ) ) { inc_ref( ); } +Tractor::Tractor( Profile& profile, char *id, char *resource ) : + instance( NULL ) +{ + Producer producer( profile, id, resource ); + if ( producer.is_valid( ) && producer.type( ) == tractor_type ) + { + instance = ( mlt_tractor )producer.get_producer( ); + inc_ref( ); + } + else if ( producer.is_valid( ) ) + { + instance = mlt_tractor_new( ); + set_track( producer, 0 ); + } +} + Tractor::~Tractor( ) { mlt_tractor_close( instance ); @@ -95,3 +115,45 @@ int Tractor::count( ) { return mlt_multitrack_count( mlt_tractor_multitrack( get_tractor( ) ) ); } + +void Tractor::plant_transition( Transition &transition, int a_track, int b_track ) +{ + mlt_field_plant_transition( mlt_tractor_field( get_tractor( ) ), transition.get_transition( ), a_track, b_track ); +} + +void Tractor::plant_transition( Transition *transition, int a_track, int b_track ) +{ + if ( transition != NULL ) + mlt_field_plant_transition( mlt_tractor_field( get_tractor( ) ), transition->get_transition( ), a_track, b_track ); +} + +void Tractor::plant_filter( Filter &filter, int track ) +{ + mlt_field_plant_filter( mlt_tractor_field( get_tractor( ) ), filter.get_filter( ), track ); +} + +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; +}