Skip to content

Commit

Permalink
Add consumer-stopping event fired before joining threads.
Browse files Browse the repository at this point in the history
  • Loading branch information
ddennedy committed Jun 22, 2013
1 parent 9852cb3 commit 966d7eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/framework/mlt_consumer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
Expand Down
1 change: 1 addition & 0 deletions src/framework/mlt_consumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 966d7eb

Please sign in to comment.