#include "MltTransition.h"
using namespace Mlt;
+ClipInfo::ClipInfo( ) :
+ clip( 0 ),
+ producer( NULL ),
+ cut( NULL ),
+ start( 0 ),
+ resource( NULL ),
+ frame_in( 0 ),
+ frame_out( 0 ),
+ frame_count( 0 ),
+ length( 0 ),
+ fps( 0 ),
+ repeat( 0 )
+{
+}
+
ClipInfo::ClipInfo( mlt_playlist_clip_info *info ) :
clip( info->clip ),
producer( new Producer( info->producer ) ),
free( resource );
}
+void ClipInfo::update( mlt_playlist_clip_info *info )
+{
+ delete producer;
+ delete cut;
+ free( resource );
+ clip = info->clip;
+ producer = new Producer( info->producer );
+ cut = new Producer( info->cut );
+ start = info->start;
+ resource = strdup( info->resource );
+ frame_in = info->frame_in;
+ frame_out = info->frame_out;
+ frame_count = info->frame_count;
+ length = info->length;
+ fps = info->fps;
+ repeat = info->repeat;
+}
+
Playlist::Playlist( ) :
instance( NULL )
{
return new Producer( mlt_playlist_current( get_playlist( ) ) );
}
-ClipInfo *Playlist::clip_info( int index )
+ClipInfo *Playlist::clip_info( int index, ClipInfo *info )
{
- mlt_playlist_clip_info info;
- mlt_playlist_get_clip_info( get_playlist( ), &info, index );
- return new ClipInfo( &info );
+ mlt_playlist_clip_info clip_info;
+ mlt_playlist_get_clip_info( get_playlist( ), &clip_info, index );
+ if ( info == NULL )
+ return new ClipInfo( &clip_info );
+ info->update( &clip_info );
+ return info;
}
int Playlist::insert( Producer &producer, int where, int in, int out )
Producer *Playlist::get_clip( int clip )
{
- return new Producer( mlt_playlist_get_clip( get_playlist( ), clip ) );
+ mlt_producer producer = mlt_playlist_get_clip( get_playlist( ), clip );
+ return producer != NULL ? new Producer( producer ) : NULL;
}
Producer *Playlist::get_clip_at( int position )
{
- return new Producer( mlt_playlist_get_clip_at( get_playlist( ), position ) );
+ mlt_producer producer = mlt_playlist_get_clip_at( get_playlist( ), position );
+ return producer != NULL ? new Producer( producer ) : NULL;
}
int Playlist::get_clip_index_at( int position )
return mlt_playlist_clip_is_mix( get_playlist( ), clip ) != 0;
}
+bool Playlist::is_blank( int clip )
+{
+ return mlt_playlist_is_blank( get_playlist( ), clip );
+}
+
+Producer *Playlist::replace_with_blank( int clip )
+{
+ mlt_producer producer = mlt_playlist_replace_with_blank( get_playlist( ), clip );
+ Producer *object = producer != NULL ? new Producer( producer ) : NULL;
+ mlt_producer_close( producer );
+ return object;
+}
+
+void Playlist::consolidate_blanks( int keep_length )
+{
+ return mlt_playlist_consolidate_blanks( get_playlist( ), keep_length );
+}
class ClipInfo
{
public:
+ ClipInfo( );
ClipInfo( mlt_playlist_clip_info *info );
~ClipInfo( );
+ void update( mlt_playlist_clip_info *info );
int clip;
Producer *producer;
Producer *cut;
int clip( mlt_whence whence, int index );
int current_clip( );
Producer *current( );
- ClipInfo *clip_info( int index );
+ ClipInfo *clip_info( int index, ClipInfo *info = NULL );
int insert( Producer &producer, int where, int in = -1, int out = -1 );
int remove( int where );
int move( int from, int to );
Producer *get_clip_at( int position );
int get_clip_index_at( int position );
bool is_mix( int clip );
+ bool is_blank( int clip );
+ void consolidate_blanks( int keep_length = 0 );
+ Producer *replace_with_blank( int clip );
};
}
return mlt_producer_is_cut( get_producer( ) );
}
+bool Producer::is_blank( )
+{
+ return mlt_producer_is_blank( get_producer( ) );
+}
+
bool Producer::same_clip( Producer &that )
{
return mlt_producer_cut_parent( get_producer( ) ) == mlt_producer_cut_parent( that.get_producer( ) );
{
return same_clip( that ) && get_out( ) == ( that.get_in( ) - 1 );
}
+
+void Producer::optimise( )
+{
+ mlt_producer_optimise( get_producer( ) );
+}
int get_playtime( );
Producer *cut( int in = 0, int out = -1 );
bool is_cut( );
+ bool is_blank( );
bool same_clip( Producer &that );
bool runs_into( Producer &that );
+ void optimise( );
};
}
return mlt_properties_dec_ref( get_properties( ) );
}
+void Properties::block( void *object )
+{
+ mlt_events_block( get_properties( ), object );
+}
+
+void Properties::unblock( void *object )
+{
+ mlt_events_unblock( get_properties( ), object );
+}
+
bool Properties::is_valid( )
{
return get_properties( ) != NULL;
virtual ~Properties( );
int inc_ref( );
int dec_ref( );
+ void block( void *object = NULL );
+ void unblock( void *object = NULL );
bool is_valid( );
int count( );
char *get( char *name );
#include "MltTractor.h"
#include "MltMultitrack.h"
#include "MltField.h"
+#include "MltTransition.h"
+#include "MltFilter.h"
using namespace Mlt;
Tractor::Tractor( ) :
{
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 );
+}
+
class Producer;
class Field;
class Multitrack;
+ class Transition;
+ class Filter;
class Tractor : public Producer
{
int set_track( Producer &producer, int index );
Producer *track( int index );
int count( );
+ void plant_transition( Transition &transition, int a_track = 0, int b_track = 1 );
+ 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 );
};
}