Adding the mix part 1
[melted] / src / framework / mlt_field.c
index 05a41e5..2439fe9 100644 (file)
@@ -73,6 +73,31 @@ mlt_field mlt_field_init( )
        return this;
 }
 
+mlt_field mlt_field_new( mlt_multitrack multitrack, mlt_tractor tractor )
+{
+       // Initialise the field
+       mlt_field this = calloc( sizeof( struct mlt_field_s ), 1 );
+
+       // Initialise it
+       if ( this != NULL )
+       {
+               // Construct a multitrack
+               this->multitrack = multitrack;
+
+               // Construct a tractor
+               this->tractor = tractor;
+
+               // The first plant will be connected to the mulitrack
+               this->producer = mlt_multitrack_service( this->multitrack );
+
+               // Connect the tractor to the multitrack
+               mlt_tractor_connect( this->tractor, this->producer );
+       }
+
+       // Return this
+       return this;
+}
+
 /** Get the service associated to this field.
 */
 
@@ -121,6 +146,9 @@ int mlt_field_plant_filter( mlt_field this, mlt_filter that, int track )
 
                // Reconnect tractor to new producer
                mlt_tractor_connect( this->tractor, this->producer );
+
+               // Fire an event
+               mlt_events_fire( mlt_field_properties( this ), "service-changed", NULL );
        }
 
        return result;
@@ -142,6 +170,9 @@ int mlt_field_plant_transition( mlt_field this, mlt_transition that, int a_track
 
                // Reconnect tractor to new producer
                mlt_tractor_connect( this->tractor, this->producer );
+
+               // Fire an event
+               mlt_events_fire( mlt_field_properties( this ), "service-changed", NULL );
        }
 
        return 0;