]> git.sesse.net Git - mlt/commitdiff
Add a consumer-sdl-paused event.
authorDan Dennedy <dan@dennedy.org>
Thu, 9 Dec 2010 05:18:36 +0000 (21:18 -0800)
committerDan Dennedy <dan@dennedy.org>
Thu, 9 Dec 2010 05:18:36 +0000 (21:18 -0800)
src/modules/sdl/consumer_sdl_preview.c

index 69fe2cdb6011ebd669482fe98492826ab39a0c38..97542d9b6b0fd2511f4976e1610f6d9fca5ee2dc 100644 (file)
@@ -104,6 +104,7 @@ mlt_consumer consumer_sdl_preview_init( mlt_profile profile, mlt_service_type ty
                pthread_cond_init( &this->refresh_cond, NULL );
                pthread_mutex_init( &this->refresh_mutex, NULL );
                mlt_events_listen( MLT_CONSUMER_PROPERTIES( parent ), this, "property-changed", ( mlt_listener )consumer_refresh_cb );
+               mlt_events_register( properties, "consumer-sdl-paused", NULL );
                return parent;
        }
        free( this );
@@ -388,6 +389,14 @@ static void *consumer_thread( void *arg )
                                // Send the frame to the active child
                                if ( frame && !eos )
                                        mlt_consumer_put_frame( this->active, frame );
+                               if ( paused && speed == 0.0 )
+                               {
+                                       // Wait for last frame to be shown and then fire paused event
+                                       mlt_event event = mlt_events_setup_wait_for( properties, "consumer-frame-show" );
+                                       mlt_events_wait_for( properties, event );
+                                       mlt_events_close_wait_for( properties, event );
+                                       mlt_events_fire( properties, "consumer-sdl-paused", NULL );
+                               }
                        }
                        // Allow a little grace time before switching consumers on speed changes
                        else if ( this->ignore_change -- > 0 && this->active != NULL && !mlt_consumer_is_stopped( this->active ) )