コード例 #1
0
ファイル: mlt_producer.c プロジェクト: jliljebl/mlt
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 );
		}
	}
}
コード例 #2
0
ファイル: filter_frei0r.c プロジェクト: mltframework/mlt
void filter_close( mlt_filter filter )
{
	destruct( MLT_FILTER_PROPERTIES ( filter ) );
	filter->close = NULL;
	filter->parent.close = NULL;
	mlt_service_close( &filter->parent );
}
コード例 #3
0
ファイル: mlt_service.c プロジェクト: bmatherly/mlt
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 );
		}
	}
}
コード例 #4
0
ファイル: mlt_consumer.c プロジェクト: MarcAntoine-Arnaud/mlt
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 );
		}
	}
}
コード例 #5
0
static void filter_close( mlt_filter filter )
{
	private_data* self = (private_data*)filter->child;

	free( self );
	filter->child = NULL;
	filter->close = NULL;
	filter->parent.close = NULL;
	mlt_service_close( &filter->parent );
}
コード例 #6
0
ファイル: mlt_frame.c プロジェクト: agpanarin/mlt
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 );
	}
}
コード例 #7
0
ファイル: filter_vidstab.cpp プロジェクト: jjcare/mlt
static void filter_close( mlt_filter filter )
{
	vs_data* data = (vs_data*)filter->child;
	if ( data )
	{
		if ( data->analyze_data ) destory_analyze_data( data->analyze_data );
		if ( data->apply_data ) destory_apply_data( data->apply_data );
		free( data );
	}
	filter->close = NULL;
	filter->child = NULL;
	filter->parent.close = NULL;
	mlt_service_close( &filter->parent );
}
コード例 #8
0
ファイル: filter_audiospectrum.cpp プロジェクト: j-b-m/mlt
static void filter_close( mlt_filter filter )
{
	private_data* pdata = (private_data*)filter->child;

	if ( pdata )
	{
		mlt_filter_close( pdata->fft );
		free( pdata->fft_prop_name );
		free( pdata );
	}
	filter->child = NULL;
	filter->close = NULL;
	filter->parent.close = NULL;
	mlt_service_close( &filter->parent );
}
コード例 #9
0
ファイル: mlt_filter.c プロジェクト: mcfrisk/mlt
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 );
	}
}
コード例 #10
0
ファイル: filter_loudness_meter.c プロジェクト: bmatherly/mlt
static void filter_close( mlt_filter filter )
{
	private_data* pdata = (private_data*)filter->child;

	if( pdata )
	{
		if( pdata->r128 )
		{
			ebur128_destroy( &pdata->r128 );
		}
		free( pdata );
	}
	filter->child = NULL;
	filter->close = NULL;
	filter->parent.close = NULL;
	mlt_service_close( &filter->parent );
}
コード例 #11
0
ファイル: mlt_transition.c プロジェクト: jjcare/mlt
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 );
		}
	}
}
コード例 #12
0
ファイル: mlt_service.c プロジェクト: bmatherly/mlt
int mlt_service_disconnect_all_producers( mlt_service self)
{
	int disconnected = 0, i = 0;
	mlt_service_base *base = self->local;

	if ( base->in )
	{
		for ( i = 0 ; i < base->count ; i ++ )
		{
			mlt_service current = base->in[ i ];
			if ( current )
			{
				mlt_service_close( current );
				disconnected ++;
			}
			base->in[ i ] = NULL;
		}
		base->count = 0;
	}

	return disconnected;
}
コード例 #13
0
ファイル: mlt_service.c プロジェクト: bmatherly/mlt
int mlt_service_disconnect_producer( mlt_service self, int index )
{
	mlt_service_base *base = self->local;

	if ( base->in && index >= 0 && index < base->count )
	{
		mlt_service current = base->in[ index ];

		if ( current )
		{
			// Close the current producer.
			mlt_service_disconnect( current );
			mlt_service_close( current );
			base->in[ index ] = NULL;

			// Contract the list of producers.
			for ( ; index + 1 < base->count; index ++ )
				base->in[ index ] = base->in[ index + 1 ];
			base->count --;
			return 0;
		}
	}
	return -1;
}
コード例 #14
0
ファイル: mlt_service.c プロジェクト: bmatherly/mlt
int mlt_service_connect_producer( mlt_service self, mlt_service producer, int index )
{
	int i = 0;

	// Get the service base
	mlt_service_base *base = self->local;

	// Special case 'track' index - only works for last filter(s) in a particular chain
	// but allows a filter to apply to the output frame regardless of which track it comes from
	if ( index == -1 )
		index = 0;

	// Check if the producer is already registered with this service
	for ( i = 0; i < base->count; i ++ )
		if ( base->in[ i ] == producer )
			return 3;

	// Allocate space
	if ( index >= base->size )
	{
		int new_size = base->size + index + 10;
		base->in = realloc( base->in, new_size * sizeof( mlt_service ) );
		if ( base->in != NULL )
		{
			for ( i = base->size; i < new_size; i ++ )
				base->in[ i ] = NULL;
			base->size = new_size;
		}
	}

	// If we have space, assign the input
	if ( base->in != NULL && index >= 0 && index < base->size )
	{
		// Get the current service
		mlt_service current = ( index < base->count )? base->in[ index ] : NULL;

		// Increment the reference count on this producer
		if ( producer != NULL )
			mlt_properties_inc_ref( MLT_SERVICE_PROPERTIES( producer ) );

		// Now we disconnect the producer service from its consumer
		mlt_service_disconnect( producer );

		// Add the service to index specified
		base->in[ index ] = producer;

		// Determine the number of active tracks
		if ( index >= base->count )
			base->count = index + 1;

		// Now we connect the producer to its connected consumer
		mlt_service_connect( producer, self );

		// Close the current service
		mlt_service_close( current );

		// Inform caller that all went well
		return 0;
	}
	else
	{
		return -1;
	}
}