]> git.sesse.net Git - mlt/commitdiff
Add consumer-stopping event fired before joining threads.
authorDan Dennedy <dan@dennedy.org>
Sat, 22 Jun 2013 04:41:03 +0000 (21:41 -0700)
committerDan Dennedy <dan@dennedy.org>
Sat, 22 Jun 2013 04:41:03 +0000 (21:41 -0700)
src/framework/mlt_consumer.c
src/framework/mlt_consumer.h

index 2791a0171b18148c5b2b49c13072e4d87ce545e3..175d355f298b85fa3dcc71eacc316bfc46ec4113 100644 (file)
@@ -140,6 +140,7 @@ int mlt_consumer_init( mlt_consumer self, void *child, mlt_profile profile )
                mlt_events_register( properties, "consumer-frame-render", ( mlt_transmitter )mlt_consumer_frame_render );
                mlt_events_register( properties, "consumer-thread-started", NULL );
                mlt_events_register( properties, "consumer-thread-stopped", NULL );
+               mlt_events_register( properties, "consumer-stopping", NULL );
                mlt_events_register( properties, "consumer-stopped", NULL );
                mlt_events_listen( properties, self, "consumer-frame-show", ( mlt_listener )on_consumer_frame_show );
 
@@ -1168,6 +1169,7 @@ static void consumer_read_ahead_stop( mlt_consumer self )
 #endif
                // Inform thread to stop
                priv->ahead = 0;
+               mlt_events_fire( MLT_CONSUMER_PROPERTIES(self), "consumer-stopping", NULL );
 
                // Broadcast to the condition in case it's waiting
                pthread_mutex_lock( &priv->queue_mutex );
@@ -1218,6 +1220,7 @@ static void consumer_work_stop( mlt_consumer self )
 #endif
                // Inform thread to stop
                priv->ahead = 0;
+               mlt_events_fire( MLT_CONSUMER_PROPERTIES(self), "consumer-stopping", NULL );
 
                // Broadcast to the queue condition in case it's waiting
                pthread_mutex_lock( &priv->queue_mutex );
index 526f3f70feaad49d83a06179e2de867457227d57..a1946c43f2b6ab5251162ec3dfbfb50af938e8f2 100644 (file)
@@ -55,6 +55,7 @@
  * \event \em consumer-frame-render The base class fires this immediately before rendering a frame.
  * \event \em consumer-thread-started The base class fires when beginning execution of a rendering thread.
  * \event \em consumer-thread-stopped The base class fires when a rendering thread has ended.
+ * \event \em consumer-stopping This is fired when stop was requested, but before render threads are joined.
  * \event \em consumer-stopped This is fired when the subclass implementation calls mlt_consumer_stopped().
  * \properties \em fps video frames per second as floating point (read only)
  * \properties \em frame_rate_num the numerator of the video frame rate, overrides \p mlt_profile_s