From 966d7eb9b54789062e00314442f755eeff8b978d Mon Sep 17 00:00:00 2001 From: Dan Dennedy Date: Fri, 21 Jun 2013 21:41:03 -0700 Subject: [PATCH] Add consumer-stopping event fired before joining threads. --- src/framework/mlt_consumer.c | 3 +++ src/framework/mlt_consumer.h | 1 + 2 files changed, 4 insertions(+) diff --git a/src/framework/mlt_consumer.c b/src/framework/mlt_consumer.c index 2791a017..175d355f 100644 --- a/src/framework/mlt_consumer.c +++ b/src/framework/mlt_consumer.c @@ -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 ); diff --git a/src/framework/mlt_consumer.h b/src/framework/mlt_consumer.h index 526f3f70..a1946c43 100644 --- a/src/framework/mlt_consumer.h +++ b/src/framework/mlt_consumer.h @@ -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 -- 2.39.2