{
consumer_stop( parent );
- this->running = 1;
- this->joined = 0;
-
-
pthread_mutex_lock( &mlt_sdl_mutex );
int ret = SDL_Init( SDL_INIT_AUDIO | SDL_INIT_NOPARACHUTE );
pthread_mutex_unlock( &mlt_sdl_mutex );
return -1;
}
+ this->running = 1;
+ this->joined = 0;
pthread_create( &this->thread, NULL, consumer_thread, this );
}
// Get the actual object
consumer_sdl this = parent->child;
- if ( this->joined == 0 )
+ if ( this->running && !this->joined )
{
// Kill the thread and clean up
this->joined = 1;
#endif
pthread_join( this->thread, NULL );
+ // Unlatch the video thread
+ pthread_mutex_lock( &this->video_mutex );
+ pthread_cond_broadcast( &this->video_cond );
+ pthread_mutex_unlock( &this->video_mutex );
+
// Unlatch the audio callback
pthread_mutex_lock( &this->audio_mutex );
pthread_cond_broadcast( &this->audio_cond );
pthread_mutex_unlock( &this->audio_mutex );
- SDL_QuitSubSystem( SDL_INIT_AUDIO );
+ if ( this->playing )
+ SDL_QuitSubSystem( SDL_INIT_AUDIO );
}
return 0;