#include "config.h"
#include "mlt_multitrack.h"
+#include "mlt_playlist.h"
#include "mlt_frame.h"
#include <stdio.h>
mlt_producer producer = &this->parent;
if ( mlt_producer_init( producer, this ) == 0 )
{
+ mlt_properties properties = mlt_multitrack_properties( this );
producer->get_frame = producer_get_frame;
+ mlt_properties_set_data( properties, "multitrack", this, 0, NULL, NULL );
}
else
{
/** Initialise timecode related information.
*/
-static void mlt_multitrack_refresh( mlt_multitrack this )
+void mlt_multitrack_refresh( mlt_multitrack this )
{
int i = 0;
// Update multitrack properties now - we'll not destroy the in point here
mlt_properties_set_timecode( properties, "length", length );
mlt_properties_set_timecode( properties, "out", length );
- mlt_properties_set_timecode( properties, "playtime", length - mlt_properties_get_timecode( properties, "in" ) );
+ mlt_properties_set_double( properties, "fps", fps );
}
/** Connect a producer to a given track.
// Get the frame from the producer
mlt_service_get_frame( mlt_producer_service( producer ), frame, 0 );
+
+ // Indicate speed of this producer
+ mlt_properties producer_properties = mlt_producer_properties( parent );
+ double speed = mlt_properties_get_double( producer_properties, "speed" );
+ mlt_properties properties = mlt_frame_properties( *frame );
+ mlt_properties_set_double( properties, "speed", speed );
}
else
{
// Move on to the next frame
if ( index >= this->count )
mlt_producer_prepare_next( parent );
+
+ // Refresh our stats
+ mlt_multitrack_refresh( this );
}
return 0;
}
+/** Determine the clip point.
+*/
+
+mlt_timecode mlt_multitrack_clip( mlt_multitrack this, mlt_whence whence, int index )
+{
+ int first = 1;
+ mlt_timecode position = 0;
+ int i = 0;
+
+ for ( i = 0; i < this->count; i ++ )
+ {
+ // Get the producer
+ mlt_producer producer = this->list[ i ];
+
+ if ( producer != NULL )
+ {
+ // Get the properties of this producer
+ mlt_properties properties = mlt_producer_properties( producer );
+
+ // Determine if it's a playlist
+ mlt_playlist playlist = mlt_properties_get_data( properties, "playlist", NULL );
+
+ // We only consider playlists
+ if ( playlist != NULL )
+ {
+ // Locate the smallest timecode
+ if ( first )
+ {
+ // First position found
+ position = mlt_playlist_clip( playlist, whence, index );
+
+ // We're no longer first
+ first = 0;
+ }
+ else
+ {
+ // Obtain the clip position in this playlist
+ mlt_timecode position2 = mlt_playlist_clip( playlist, whence, index );
+
+ // If this position is prior to the first, then use it
+ if ( position2 < position )
+ position = position2;
+ }
+ }
+ }
+ }
+
+ return position;
+}
+
/** Close this instance.
*/