let QTDIR also define location of qt include dir
[melted] / src / modules / sdl / consumer_sdl.c
index 2d2d8ac..5879187 100644 (file)
@@ -246,7 +246,12 @@ int consumer_stop( mlt_consumer parent )
                this->sdl_overlay = NULL;
 
                if ( !mlt_properties_get_int( MLT_CONSUMER_PROPERTIES( parent ), "audio_off" ) )
+               {
+                       pthread_mutex_lock( &this->audio_mutex );
+                       pthread_cond_broadcast( &this->audio_cond );
+                       pthread_mutex_unlock( &this->audio_mutex );
                        SDL_QuitSubSystem( SDL_INIT_AUDIO );
+               }
 
                if ( mlt_properties_get_int( MLT_CONSUMER_PROPERTIES( parent ), "sdl_started" ) == 0 )
                        SDL_Quit( );
@@ -678,6 +683,10 @@ static void *consumer_thread( void *arg )
        // Get the consumer
        mlt_consumer consumer = &this->parent;
 
+       // Convenience functionality
+       int terminate_on_pause = mlt_properties_get_int( MLT_CONSUMER_PROPERTIES( consumer ), "terminate_on_pause" );
+       int terminated = 0;
+
        // Video thread
        pthread_t thread;
 
@@ -691,11 +700,15 @@ static void *consumer_thread( void *arg )
        struct timespec tm = { 0, 100000 };
 
        // Loop until told not to
-       while( this->running )
+       while( !terminated && this->running )
        {
                // Get a frame from the attached producer
                frame = mlt_consumer_rt_frame( consumer );
 
+               // Check for termination
+               if ( terminate_on_pause && frame != NULL )
+                       terminated = mlt_properties_get_double( MLT_FRAME_PROPERTIES( frame ), "_speed" ) == 0.0;
+
                // Ensure that we have a frame
                if ( frame != NULL )
                {
@@ -732,6 +745,8 @@ static void *consumer_thread( void *arg )
                }
        }
 
+       this->running = 0;
+
        // Kill the video thread
        if ( init_video == 0 )
        {