return self;
}
+/** Construct a playlist with a profile.
+ *
+ * Sets the resource property to "<playlist>".
+ * Set the mlt_type to property to "mlt_producer".
+ * \public \memberof mlt_playlist_s
+ * \param profile the profile to use with the profile
+ * \return a new playlist
+ */
+
+mlt_playlist mlt_playlist_new( mlt_profile profile )
+{
+ mlt_playlist self = mlt_playlist_init();
+ if ( self )
+ mlt_properties_set_data( MLT_PLAYLIST_PROPERTIES( self ), "_profile", profile, 0, NULL, NULL );
+ return self;
+}
+
/** Get the producer associated to this playlist.
*
* \public \memberof mlt_playlist_s
*
* \public \memberof mlt_playlist_s
* \param self a playlist
- * \param length the ending time of the blank entry, not its duration
+ * \param out the ending time of the blank entry, not its duration
* \return true if there was an error
*/
-int mlt_playlist_blank( mlt_playlist self, mlt_position length )
+int mlt_playlist_blank( mlt_playlist self, mlt_position out )
{
// Append to the virtual list
- if (length >= 0)
- return mlt_playlist_virtual_append( self, &self->blank, 0, length );
+ if ( out >= 0 )
+ return mlt_playlist_virtual_append( self, &self->blank, 0, out );
+ else
+ return 1;
+}
+
+/** Append a blank item to the playlist with duration as a time string.
+ *
+ * \public \memberof mlt_playlist_s
+ * \param self a playlist
+ * \param length the duration of the blank entry as a time string
+ * \return true if there was an error
+ */
+
+int mlt_playlist_blank_time( mlt_playlist self, const char* length )
+{
+ if ( self && length )
+ {
+ mlt_properties properties = MLT_PLAYLIST_PROPERTIES( self );
+ mlt_properties_set( properties , "_blank_time", length );
+ mlt_position duration = mlt_properties_get_position( properties, "_blank_time" );
+ return mlt_playlist_blank( self, duration - 1 );
+ }
else
return 1;
}
if ( error == 0 )
{
int i = clip;
- mlt_playlist new_clip = mlt_playlist_init( );
+ mlt_playlist new_clip = mlt_playlist_new( mlt_service_profile( MLT_PLAYLIST_SERVICE(self) ) );
mlt_events_block( MLT_PLAYLIST_PROPERTIES( self ), self );
if ( clip + count >= self->count )
count = self->count - clip - 1;
#define MLT_PLAYLIST_PROPERTIES( playlist ) MLT_SERVICE_PROPERTIES( MLT_PLAYLIST_SERVICE( playlist ) )
extern mlt_playlist mlt_playlist_init( );
+extern mlt_playlist mlt_playlist_new( mlt_profile profile );
extern mlt_producer mlt_playlist_producer( mlt_playlist self );
extern mlt_service mlt_playlist_service( mlt_playlist self );
extern mlt_properties mlt_playlist_properties( mlt_playlist self );
extern int mlt_playlist_clear( mlt_playlist self );
extern int mlt_playlist_append( mlt_playlist self, mlt_producer producer );
extern int mlt_playlist_append_io( mlt_playlist self, mlt_producer producer, mlt_position in, mlt_position out );
-extern int mlt_playlist_blank( mlt_playlist self, mlt_position length );
+extern int mlt_playlist_blank( mlt_playlist self, mlt_position out );
+extern int mlt_playlist_blank_time( mlt_playlist self, const char *length );
extern mlt_position mlt_playlist_clip( mlt_playlist self, mlt_whence whence, int index );
extern int mlt_playlist_current_clip( mlt_playlist self );
extern mlt_producer mlt_playlist_current( mlt_playlist self );
#include <stdlib.h>
#include "MltPlaylist.h"
#include "MltTransition.h"
+#include "MltProfile.h"
using namespace Mlt;
ClipInfo::ClipInfo( ) :
instance = mlt_playlist_init( );
}
+Playlist::Playlist( Profile& profile ) :
+ instance( NULL )
+{
+ instance = mlt_playlist_new( profile.get_profile() );
+}
+
Playlist::Playlist( Service &producer ) :
instance( NULL )
{
return mlt_playlist_append_io( get_playlist( ), producer.get_producer( ), in, out );
}
-int Playlist::blank( int length )
+int Playlist::blank( int out )
+{
+ return mlt_playlist_blank( get_playlist( ), out );
+}
+
+int Playlist::blank( const char *length )
{
- return mlt_playlist_blank( get_playlist( ), length );
+ return mlt_playlist_blank_time( get_playlist( ), length );
}
int Playlist::clip( mlt_whence whence, int index )
class Service;
class Playlist;
class Transition;
+ class Profile;
class MLTPP_DECLSPEC ClipInfo
{
mlt_playlist instance;
public:
Playlist( );
+ Playlist( Profile& profile );
Playlist( Service &playlist );
Playlist( Playlist &playlist );
Playlist( mlt_playlist playlist );
int count( );
int clear( );
int append( Producer &producer, int in = -1, int out = -1 );
- int blank( int length );
+ int blank( int out );
+ int blank( const char *length );
int clip( mlt_whence whence, int index );
int current_clip( );
Producer *current( );
int track = 0;
mlt_producer producer = NULL;
mlt_tractor mix = NULL;
- mlt_playlist playlist = mlt_playlist_init( );
+ mlt_playlist playlist = mlt_playlist_new( profile );
mlt_properties group = mlt_properties_new( );
mlt_tractor tractor = mlt_tractor_new( );
mlt_properties properties = MLT_TRACTOR_PROPERTIES( tractor );
if ( producer != NULL && !mlt_producer_is_cut( producer ) )
mlt_playlist_append( playlist, producer );
producer = NULL;
- mlt_playlist_blank( playlist, atof( argv[ ++ i ] ) );
+ if ( strchr( argv[ i + 1 ], ':' ) )
+ mlt_playlist_blank_time( playlist, argv[ ++ i ] );
+ else
+ // support for legacy where plain int is an out point instead of length
+ mlt_playlist_blank( playlist, atof( argv[ ++ i ] ) );
}
else if ( !strcmp( argv[ i ], "-track" ) ||
!strcmp( argv[ i ], "-null-track" ) ||
{
mlt_multitrack_connect( multitrack, MLT_PLAYLIST_PRODUCER( playlist ), track ++ );
track_service( field, playlist, ( mlt_destructor )mlt_playlist_close );
- playlist = mlt_playlist_init( );
+ playlist = mlt_playlist_new( profile );
}
if ( playlist != NULL )
{
static void on_start_playlist( deserialise_context context, const xmlChar *name, const xmlChar **atts)
{
- mlt_playlist playlist = mlt_playlist_init( );
+ mlt_playlist playlist = mlt_playlist_new( context->profile );
mlt_service service = MLT_PLAYLIST_SERVICE( playlist );
mlt_properties properties = MLT_SERVICE_PROPERTIES( service );
// Get the playlist from the stack
enum service_type type;
mlt_service service = context_pop_service( context, &type );
- mlt_position length = 0;
if ( type == mlt_playlist_type && service != NULL )
{
{
if ( xmlStrcmp( atts[0], _x("length") ) == 0 )
{
- length = atoll( _s(atts[1]) );
+ // Append a blank to the playlist
+ mlt_playlist_blank_time( MLT_PLAYLIST( service ), _s(atts[1]) );
break;
}
}
- // Append a blank to the playlist
- mlt_playlist_blank( MLT_PLAYLIST( service ), length - 1 );
-
// Push the playlist back onto the stack
context_push_service( context, service, type );
}