]> git.sesse.net Git - mlt/blobdiff - mlt++/src/MltPlaylist.cpp
Added the response object
[mlt] / mlt++ / src / MltPlaylist.cpp
index 42fe74a3d74c5c5d166b988858d724bc6c8ffd09..d85012f80720ae63e991c0c24af861edccee1a9f 100644 (file)
@@ -21,6 +21,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include "MltPlaylist.h"
+#include "MltTransition.h"
 using namespace Mlt;
 
 ClipInfo::ClipInfo( mlt_playlist_clip_info *info ) :
@@ -37,22 +38,6 @@ ClipInfo::ClipInfo( mlt_playlist_clip_info *info ) :
 {
 }
 
-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;
@@ -61,28 +46,36 @@ ClipInfo::~ClipInfo( )
 }
 
 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( )
@@ -105,17 +98,17 @@ int Playlist::clear( )
        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 );
 }
@@ -137,7 +130,7 @@ ClipInfo *Playlist::clip_info( int 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 );
 }
@@ -152,9 +145,22 @@ int Playlist::move( int from, int to )
        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( ) );
+}