+/** Determine the clip point.
+
+ Special case here: a 'producer' has no concept of multiple clips - only the
+ playlist and multitrack producers have clip functionality. Further to that a
+ multitrack determines clip information from any connected tracks that happen
+ to be playlists.
+
+ Additionally, it must locate clips in the correct order, for example, consider
+ the following track arrangement:
+
+ playlist1 |0.0 |b0.0 |0.1 |0.1 |0.2 |
+ playlist2 |b1.0 |1.0 |b1.1 |1.1 |
+
+ Note - b clips represent blanks. They are also reported as clip positions.
+
+ When extracting clip positions from these playlists, we should get a sequence of:
+
+ 0.0, 1.0, b0.0, 0.1, b1.1, 1.1, 0.1, 0.2, [out of playlist2], [out of playlist1]
+*/
+
+mlt_position mlt_multitrack_clip( mlt_multitrack this, mlt_whence whence, int index )
+{
+ int first = 1;
+ mlt_position position = 0;
+ int i = 0;
+
+ // Loop through each of the tracks
+ for ( i = 0; i < this->count; i ++ )
+ {
+ // Get the producer for this track
+ mlt_producer producer = this->list[ i ];
+
+ // If it's assigned...
+ 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 position
+ 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_position position2 = mlt_playlist_clip( playlist, whence, index );
+
+ // If this position is prior to the first, then use it
+ //if ( position2 < position )
+ //position = position2;
+ }
+ }
+ else
+ {
+ fprintf( stderr, "track %d isn't a playlist\n", index );
+ }
+ }
+ }
+
+ return position;
+}
+