mlt_events_register( properties, "consumer-frame-show", ( mlt_transmitter )mlt_consumer_frame_show );
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-stopped", NULL );
mlt_events_listen( properties, self, "consumer-frame-show", ( mlt_listener )on_consumer_frame_show );
self->format = mlt_image_yuv420p;
else if ( !strcmp( format, "none" ) )
self->format = mlt_image_none;
+ else if ( !strcmp( format, "glsl" ) )
+ self->format = mlt_image_glsl_texture;
else
self->format = mlt_image_yuv422;
}
if ( preview_off && preview_format != 0 )
self->format = preview_format;
+ mlt_events_fire( properties, "consumer-thread-started", NULL );
+
// Get the first frame
frame = mlt_consumer_get_frame( self );
// Remove the last frame
mlt_frame_close( frame );
+ mlt_events_fire( properties, "consumer-thread-stopped" );
return NULL;
}
if ( preview_off && preview_format != 0 )
format = preview_format;
+ mlt_events_fire( properties, "consumer-thread-started", NULL );
+
// Continue to read ahead
while ( self->ahead )
{
pthread_cond_broadcast( &self->done_cond );
pthread_mutex_unlock( &self->done_mutex );
}
+ mlt_events_fire( properties, "consumer-thread-stopped" );
return NULL;
}
{
if ( self && self->ahead )
{
- pthread_mutex_lock( &self->queue_mutex );
+ if ( self->ahead && self->real_time )
+ pthread_mutex_lock( &self->queue_mutex );
while ( mlt_deque_count( self->queue ) )
mlt_frame_close( mlt_deque_pop_back( self->queue ) );
- pthread_cond_broadcast( &self->queue_cond );
- pthread_mutex_unlock( &self->queue_mutex );
+ if ( self->ahead && self->real_time ) {
+ pthread_cond_broadcast( &self->queue_cond );
+ pthread_mutex_unlock( &self->queue_mutex );
+ }
}
}
}
else // real_time == 0
{
+ if ( !self->ahead )
+ {
+ self->ahead = 1;
+ mlt_events_fire( properties, "consumer-thread-started", NULL );
+ }
// Get the frame in non real time
frame = mlt_consumer_get_frame( self );
* \properties \em test_card the name of a resource to use as the test card, defaults to
* environment variable MLT_TEST_CARD. If undefined, the hard-coded default test card is
* white silence. A test card is what appears when nothing is produced.
- * \event \em consumer-frame-show Subclass implementations should fire this.
- * \event \em consumer-frame-render The abstract class fires this.
- * \event \em consumer-stopped
+ * \event \em consumer-frame-show Subclass implementations fire this immediately after showing a frame
+ * or when a frame should be shown (if audio-only consumer).
+ * \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-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
* \properties \em frame_rate_den the denominator of the video frame rate, overrides \p mlt_profile_s