#include <string.h>
#include <stdlib.h>
#include "MltPlaylist.h"
+#include "MltTransition.h"
using namespace Mlt;
ClipInfo::ClipInfo( mlt_playlist_clip_info *info ) :
clip( info->clip ),
producer( new Producer( info->producer ) ),
- service( new Service( info->service ) ),
+ 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 )
+ fps( info->fps ),
+ repeat( info->repeat )
{
}
-ClipInfo::ClipInfo( Playlist &playlist, int index )
-{
- mlt_playlist_clip_info info;
- mlt_playlist_get_clip_info( playlist.get_playlist( ), &info, index );
- clip = info.clip;
- producer = new Producer( info.producer );
- service = new Service( info.service );
- 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;
-}
-
ClipInfo::~ClipInfo( )
{
delete producer;
- delete service;
+ delete cut;
free( resource );
}
Playlist::Playlist( ) :
- destroy( true ),
instance( NULL )
{
instance = mlt_playlist_init( );
}
+Playlist::Playlist( Service &producer ) :
+ instance( NULL )
+{
+ if ( producer.type( ) == playlist_type )
+ {
+ instance = ( mlt_playlist )producer.get_service( );
+ inc_ref( );
+ }
+}
+
Playlist::Playlist( Playlist &playlist ) :
- destroy( false ),
instance( playlist.get_playlist( ) )
{
+ inc_ref( );
}
Playlist::Playlist( mlt_playlist playlist ) :
- destroy( false ),
instance( playlist )
{
+ inc_ref( );
}
Playlist::~Playlist( )
{
- if ( destroy )
- mlt_playlist_close( instance );
+ mlt_playlist_close( instance );
}
mlt_playlist Playlist::get_playlist( )
return mlt_playlist_clear( get_playlist( ) );
}
-int Playlist::append( Producer &producer, mlt_position in, mlt_position out )
+int Playlist::append( Producer &producer, int in, int out )
{
return mlt_playlist_append_io( get_playlist( ), producer.get_producer( ), in, out );
}
-int Playlist::blank( mlt_position length )
+int Playlist::blank( int length )
{
return mlt_playlist_blank( get_playlist( ), length );
}
-mlt_position Playlist::clip( mlt_whence whence, int index )
+int Playlist::clip( mlt_whence whence, int index )
{
return mlt_playlist_clip( get_playlist( ), whence, index );
}
return new ClipInfo( &info );
}
-int Playlist::insert( Producer &producer, int where, mlt_position in, mlt_position out )
+int Playlist::insert( Producer &producer, int where, int in, int out )
{
return mlt_playlist_insert( get_playlist( ), producer.get_producer( ), where, in, out );
}
return mlt_playlist_move( get_playlist( ), from, to );
}
-int Playlist::resize_clip( int clip, mlt_position in, mlt_position out )
+int Playlist::resize_clip( int clip, int in, int out )
{
return mlt_playlist_resize_clip( get_playlist( ), clip, in, out );
}
+int Playlist::split( int clip, int position )
+{
+ return mlt_playlist_split( get_playlist( ), clip, position );
+}
+
+int Playlist::join( int clip, int count, int merge )
+{
+ return mlt_playlist_join( get_playlist( ), clip, count, merge );
+}
+
+int Playlist::mix( int clip, int length, Transition *transition )
+{
+ return mlt_playlist_mix( get_playlist( ), clip, length, transition == NULL ? NULL : transition->get_transition( ) );
+}
+
+int Playlist::mix_add( int clip, Transition *transition )
+{
+ return mlt_playlist_mix_add( get_playlist( ), clip, transition == NULL ? NULL : transition->get_transition( ) );
+}
+
+int Playlist::repeat( int clip, int count )
+{
+ return mlt_playlist_repeat_clip( get_playlist( ), clip, count );
+}
+
+Producer *Playlist::get_clip( int clip )
+{
+ return new Producer( mlt_playlist_get_clip( get_playlist( ), clip ) );
+}
+
+Producer *Playlist::get_clip_at( int position )
+{
+ return new Producer( mlt_playlist_get_clip_at( get_playlist( ), position ) );
+}
+
+int Playlist::get_clip_index_at( int position )
+{
+ return mlt_playlist_get_clip_index_at( get_playlist( ), position );
+}
+
+bool Playlist::is_mix( int clip )
+{
+ return mlt_playlist_clip_is_mix( get_playlist( ), clip ) != 0;
+}