mlt_deque vpackets;
pthread_mutex_t packets_mutex;
pthread_mutex_t open_mutex;
+ int is_mutex_init;
#ifdef VDPAU
struct
{
// Clean up
mlt_producer_close( producer );
producer = NULL;
+ producer_avformat_close( self );
}
else if ( self->seekable )
{
// Lock the service
if ( take_lock )
{
- pthread_mutex_init( &self->audio_mutex, NULL );
- pthread_mutex_init( &self->video_mutex, NULL );
- pthread_mutex_init( &self->packets_mutex, NULL );
- pthread_mutex_init( &self->open_mutex, NULL );
+ if ( !self->is_mutex_init )
+ {
+ pthread_mutex_init( &self->audio_mutex, NULL );
+ pthread_mutex_init( &self->video_mutex, NULL );
+ pthread_mutex_init( &self->packets_mutex, NULL );
+ pthread_mutex_init( &self->open_mutex, NULL );
+ self->is_mutex_init = 1;
+ }
pthread_mutex_lock( &self->audio_mutex );
pthread_mutex_lock( &self->video_mutex );
}
mlt_cache_close( self->image_cache );
// Cleanup the mutexes
- pthread_mutex_destroy( &self->audio_mutex );
- pthread_mutex_destroy( &self->video_mutex );
- pthread_mutex_destroy( &self->packets_mutex );
- pthread_mutex_destroy( &self->open_mutex );
+ if ( self->is_mutex_init )
+ {
+ pthread_mutex_destroy( &self->audio_mutex );
+ pthread_mutex_destroy( &self->video_mutex );
+ pthread_mutex_destroy( &self->packets_mutex );
+ pthread_mutex_destroy( &self->open_mutex );
+ }
// Cleanup the packet queues
AVPacket *pkt;