void track_service( mlt_field field, void *service, mlt_destructor destructor ) { mlt_properties properties = mlt_field_properties( field ); int registered = mlt_properties_get_int( properties, "registered" ); char *key = mlt_properties_get( properties, "registered" ); mlt_properties_set_data( properties, key, service, 0, destructor, NULL ); mlt_properties_set_int( properties, "registered", ++ registered ); }
void mlt_field_close( mlt_field self ) { if ( self != NULL && mlt_properties_dec_ref( mlt_field_properties( self ) ) <= 0 ) { //mlt_tractor_close( self->tractor ); //mlt_multitrack_close( self->multitrack ); free( self ); } }
int mlt_field_plant_transition( mlt_field self, mlt_transition that, int a_track, int b_track ) { // Connect the transition to the last producer int result = mlt_transition_connect( that, self->producer, a_track, b_track ); // If successful, then we'll use self for connecting in the future if ( result == 0 ) { // This is now the new producer self->producer = MLT_TRANSITION_SERVICE( that ); // Reconnect tractor to new producer mlt_tractor_connect( self->tractor, self->producer ); // Fire an event mlt_events_fire( mlt_field_properties( self ), "service-changed", NULL ); } return result; }
int mlt_field_plant_filter( mlt_field self, mlt_filter that, int track ) { // Connect the filter to the last producer int result = mlt_filter_connect( that, self->producer, track ); // If successful, then we'll use this for connecting in the future if ( result == 0 ) { // This is now the new producer self->producer = MLT_FILTER_SERVICE( that ); // Reconnect tractor to new producer mlt_tractor_connect( self->tractor, self->producer ); // Fire an event mlt_events_fire( mlt_field_properties( self ), "service-changed", NULL ); } return result; }
void mlt_field_disconnect_service( mlt_field self, mlt_service service ) { mlt_service p = mlt_service_producer( service ); mlt_service c = mlt_service_consumer( service); int i; switch ( mlt_service_identify(c) ) { case filter_type: i = mlt_filter_get_track( MLT_FILTER(c) ); mlt_service_connect_producer( c, p, i ); break; case transition_type: i = mlt_transition_get_a_track ( MLT_TRANSITION(c) ); mlt_service_connect_producer( c, p, i ); MLT_TRANSITION(c)->producer = p; break; case tractor_type: self->producer = p; mlt_tractor_connect( MLT_TRACTOR(c), p ); default: break; } mlt_events_fire( mlt_field_properties( self ), "service-changed", NULL ); }