* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#include <string.h>
+#include <stdlib.h>
#include "MltPlaylist.h"
using namespace Mlt;
+ClipInfo::ClipInfo( mlt_playlist_clip_info *info ) :
+ clip( info->clip ),
+ producer( new ProducerInstance( info->producer ) ),
+ service( new ServiceInstance( 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;
+ free( resource );
+}
+
+PlaylistInstance::PlaylistInstance( ) :
+ destroy( true ),
+ instance( NULL )
+{
+ instance = mlt_playlist_init( );
+}
+
+PlaylistInstance::PlaylistInstance( Playlist &playlist ) :
+ destroy( false ),
+ instance( playlist.get_playlist( ) )
+{
+}
+
+PlaylistInstance::PlaylistInstance( mlt_playlist playlist ) :
+ destroy( false ),
+ instance( playlist )
+{
+}
+
+PlaylistInstance::~PlaylistInstance( )
+{
+ if ( destroy )
+ mlt_playlist_close( instance );
+}
+
+mlt_playlist PlaylistInstance::get_playlist( )
+{
+ return instance;
+}
+
mlt_producer Playlist::get_producer( )
{
return mlt_playlist_producer( get_playlist( ) );
return mlt_playlist_blank( get_playlist( ), length );
}
-mlt_playlist PlaylistInstance::get_playlist( )
+mlt_position Playlist::clip( mlt_whence whence, int index )
{
- return instance;
+ return mlt_playlist_clip( get_playlist( ), whence, index );
}
-PlaylistInstance::PlaylistInstance( ) :
- destroy( true ),
- instance( NULL )
+int Playlist::current_clip( )
{
- instance = mlt_playlist_init( );
+ return mlt_playlist_current_clip( get_playlist( ) );
}
-PlaylistInstance::PlaylistInstance( Playlist &playlist ) :
- destroy( false ),
- instance( playlist.get_playlist( ) )
+Producer *Playlist::current( )
{
+ return new ProducerInstance( mlt_playlist_current( get_playlist( ) ) );
}
-PlaylistInstance::PlaylistInstance( mlt_playlist playlist ) :
- destroy( false ),
- instance( playlist )
+ClipInfo *Playlist::clip_info( int index )
{
+ mlt_playlist_clip_info info;
+ mlt_playlist_get_clip_info( get_playlist( ), &info, index );
+ return new ClipInfo( &info );
}
-PlaylistInstance::~PlaylistInstance( )
+int Playlist::insert( Producer &producer, int where, mlt_position in, mlt_position out )
{
- if ( destroy )
- mlt_playlist_close( instance );
+ return mlt_playlist_insert( get_playlist( ), producer.get_producer( ), where, in, out );
+}
+
+int Playlist::remove( int where )
+{
+ return mlt_playlist_remove( get_playlist( ), where );
}
+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 )
+{
+ return mlt_playlist_resize_clip( get_playlist( ), clip, in, out );
+}
+
+
namespace Mlt
{
+ class ClipInfo
+ {
+ public:
+ ClipInfo( mlt_playlist_clip_info *info );
+ ~ClipInfo( );
+ int clip;
+ Producer *producer;
+ Service *service;
+ mlt_position start;
+ char *resource;
+ mlt_position frame_in;
+ mlt_position frame_out;
+ mlt_position frame_count;
+ mlt_position length;
+ float fps;
+ };
+
class Playlist : public Producer
{
public:
int clear( );
int append( Producer &producer, mlt_position in = -1, mlt_position out = -1 );
int blank( mlt_position length );
+ mlt_position clip( mlt_whence whence, int index );
+ int current_clip( );
+ Producer *current( );
+ ClipInfo *clip_info( int index );
+ int insert( Producer &producer, int where, mlt_position in = -1, mlt_position out = -1 );
+ int remove( int where );
+ int move( int from, int to );
+ int resize_clip( int clip, mlt_position in, mlt_position out );
};
class PlaylistInstance : public Playlist
{
}
+PropertiesInstance::PropertiesInstance( char *file ) :
+ destroy( true ),
+ instance( NULL )
+{
+ instance = mlt_properties_load( file );
+}
+
PropertiesInstance::~PropertiesInstance( )
{
if ( destroy )
mlt_properties_close( instance );
}
+mlt_properties PropertiesInstance::get_properties( )
+{
+ return instance;
+}
+
bool Properties::is_valid( )
{
return get_properties( ) != NULL;
return mlt_properties_set_data( get_properties( ), name, value, size, destructor, serialiser );
}
-mlt_properties PropertiesInstance::get_properties( )
+int Properties::pass( Properties &that, char *prefix )
{
- return instance;
+ return mlt_properties_pass( get_properties( ), that.get_properties( ), prefix );
+}
+
+int Properties::parse( char *namevalue )
+{
+ return mlt_properties_parse( get_properties( ), namevalue );
+}
+
+char *Properties::get_name( int index )
+{
+ return mlt_properties_get_name( get_properties( ), index );
}
+char *Properties::get( int index )
+{
+ return mlt_properties_get_value( get_properties( ), index );
+}
+
+void *Properties::get_data( int index, int &size )
+{
+ return mlt_properties_get_data_at( get_properties( ), index, &size );
+}
+
+void Properties::mirror( Properties &that )
+{
+ mlt_properties_mirror( get_properties( ), that.get_properties( ) );
+}
+int Properties::inherit( Properties &that )
+{
+ return mlt_properties_inherit( get_properties( ), that.get_properties( ) );
+}
+
+int Properties::rename( char *source, char *dest )
+{
+ return mlt_properties_rename( get_properties( ), source, dest );
+}
+
+void Properties::dump( FILE *output )
+{
+ mlt_properties_dump( get_properties( ), output );
+}
#ifndef _MLTPP_PROPERTIES_H_
#define _MLTPP_PROPERTIES_H_
+#include <stdio.h>
#include <framework/mlt.h>
namespace Mlt
int set( char *name, int value );
int set( char *name, double value );
int set( char *name, void *value, int size, mlt_destructor destroy = NULL, mlt_serialiser serial = NULL );
-
+ int pass( Properties &that, char *prefix );
+ int parse( char *namevalue );
+ char *get_name( int index );
+ char *get( int index );
+ void *get_data( int index, int &size );
+ void mirror( Properties &that );
+ int inherit( Properties &that );
+ int rename( char *source, char *dest );
+ void dump( FILE *output = stderr );
};
/** Instance class.
PropertiesInstance( );
PropertiesInstance( Properties &properties );
PropertiesInstance( mlt_properties properties );
+ PropertiesInstance( char *file );
virtual ~PropertiesInstance( );
};
}
Service *Service::producer( )
{
- if ( get_service( ) != NULL )
- return new ServiceInstance( mlt_service_producer( get_service( ) ) );
- else
- return NULL;
+ return new ServiceInstance( mlt_service_producer( get_service( ) ) );
}
Service *Service::consumer( )
{
- if ( get_service( ) != NULL )
- return new ServiceInstance( mlt_service_consumer( get_service( ) ) );
- else
- return NULL;
+ return new ServiceInstance( mlt_service_consumer( get_service( ) ) );
}
Frame *Service::get_frame( int index )