Exemple #1
0
void mlt_multitrack_close( mlt_multitrack self )
{
	if ( self != NULL && mlt_properties_dec_ref( MLT_MULTITRACK_PROPERTIES( self ) ) <= 0 )
	{
		int i = 0;
		for ( i = 0; i < self->count; i ++ )
		{
			if ( self->list[ i ] != NULL )
			{
				mlt_event_close( self->list[ i ]->event );
				mlt_producer_close( self->list[ i ]->producer );
				free( self->list[ i ] );
			}
		}

		// Close the producer
		self->parent.close = NULL;
		mlt_producer_close( &self->parent );

		// Free the list
		free( self->list );

		// Free the object
		free( self );
	}
}
Exemple #2
0
void mlt_producer_close( mlt_producer self )
{
	if ( self != NULL && mlt_properties_dec_ref( MLT_PRODUCER_PROPERTIES( self ) ) <= 0 )
	{
		self->parent.close = NULL;

		if ( self->close != NULL )
		{
			self->close( self->close_object );
		}
		else
		{
			int destroy = mlt_producer_is_cut( self );

#if _MLT_PRODUCER_CHECKS_ == 1
			// Show debug info
			mlt_properties_debug( MLT_PRODUCER_PROPERTIES( self ), "Producer closing", stderr );
#endif

#ifdef _MLT_PRODUCER_CHECKS_
			// Show current stats - these should match when the app is closed
			mlt_log( MLT_PRODUCER_SERVICE( self ), MLT_LOG_DEBUG, "Producers created %d, destroyed %d\n", producers_created, ++producers_destroyed );
#endif

			mlt_service_close( &self->parent );

			if ( destroy )
				free( self );
		}
	}
}
Exemple #3
0
void mlt_service_close( mlt_service self )
{
	if ( self != NULL && mlt_properties_dec_ref( MLT_SERVICE_PROPERTIES( self ) ) <= 0 )
	{
		if ( self->close != NULL )
		{
			self->close( self->close_object );
		}
		else
		{
			mlt_service_base *base = self->local;
			int i = 0;
			int count = base->filter_count;
			mlt_events_block( MLT_SERVICE_PROPERTIES( self ), self );
			while( count -- )
				mlt_service_detach( self, base->filters[ 0 ] );
			free( base->filters );
			for ( i = 0; i < base->count; i ++ )
				if ( base->in[ i ] != NULL )
					mlt_service_close( base->in[ i ] );
			self->parent.close = NULL;
			free( base->in );
			pthread_mutex_destroy( &base->mutex );
			free( base );
			mlt_properties_close( &self->parent );
		}
	}
}
void mlt_consumer_close( mlt_consumer self )
{
	if ( self != NULL && mlt_properties_dec_ref( MLT_CONSUMER_PROPERTIES( self ) ) <= 0 )
	{
		// Get the childs close function
		void ( *consumer_close )( ) = self->close;

		if ( consumer_close )
		{
			// Just in case...
			//mlt_consumer_stop( self );

			self->close = NULL;
			consumer_close( self );
		}
		else
		{
			// Make sure it only gets called once
			self->parent.close = NULL;

			// Destroy the push mutex and condition
			pthread_mutex_destroy( &self->put_mutex );
			pthread_cond_destroy( &self->put_cond );

			mlt_service_close( &self->parent );
		}
	}
}
Exemple #5
0
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 );
	}
}
Exemple #6
0
void mlt_tractor_close( mlt_tractor self )
{
	if ( self != NULL && mlt_properties_dec_ref( MLT_TRACTOR_PROPERTIES( self ) ) <= 0 )
	{
		self->parent.close = NULL;
		mlt_producer_close( &self->parent );
		free( self );
	}
}
Exemple #7
0
void mlt_frame_close( mlt_frame self )
{
	if ( self != NULL && mlt_properties_dec_ref( MLT_FRAME_PROPERTIES( self ) ) <= 0 )
	{
		mlt_deque_close( self->stack_image );
		mlt_deque_close( self->stack_audio );
		while( mlt_deque_peek_back( self->stack_service ) )
			mlt_service_close( mlt_deque_pop_back( self->stack_service ) );
		mlt_deque_close( self->stack_service );
		mlt_properties_close( &self->parent );
		free( self );
	}
}
Exemple #8
0
void mlt_filter_close( mlt_filter self )
{
	if ( self != NULL && mlt_properties_dec_ref( MLT_FILTER_PROPERTIES( self ) ) <= 0 )
	{
		if ( self->close != NULL )
		{
			self->close( self );
		}
		else
		{
			self->parent.close = NULL;
			mlt_service_close( &self->parent );
		}
		free( self );
	}
}
Exemple #9
0
void mlt_transition_close( mlt_transition self )
{
	if ( self != NULL && mlt_properties_dec_ref( MLT_TRANSITION_PROPERTIES( self ) ) <= 0 )
	{
		self->parent.close = NULL;
		if ( self->close != NULL )
		{
			self->close( self );
		}
		else
		{
			mlt_service_close( &self->parent );
			free( self->frames );
			free( self );
		}
	}
}