From: lilo_booter Date: Wed, 16 Mar 2005 13:28:29 +0000 (+0000) Subject: Frame rendering event X-Git-Url: http://research.m1stereo.tv/gitweb?a=commitdiff_plain;h=d611d9a6dac62501464e2b9c3d7ab6299ce072fe;p=melted Frame rendering event git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@686 d19143bc-622f-0410-bfdd-b5b2a6649095 --- diff --git a/src/framework/mlt_consumer.c b/src/framework/mlt_consumer.c index f1fbdd5..44f9452 100644 --- a/src/framework/mlt_consumer.c +++ b/src/framework/mlt_consumer.c @@ -28,6 +28,7 @@ #include #include +static void mlt_consumer_frame_render( mlt_listener listener, mlt_properties owner, mlt_service this, void **args ); static void mlt_consumer_frame_show( mlt_listener listener, mlt_properties owner, mlt_service this, void **args ); /** Public final methods @@ -87,6 +88,7 @@ int mlt_consumer_init( mlt_consumer this, void *child ) this->format = mlt_image_yuv422; 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-stopped", NULL ); // Create the push mutex and condition @@ -103,6 +105,12 @@ static void mlt_consumer_frame_show( mlt_listener listener, mlt_properties owner listener( owner, this, ( mlt_frame )args[ 0 ] ); } +static void mlt_consumer_frame_render( mlt_listener listener, mlt_properties owner, mlt_service this, void **args ) +{ + if ( listener != NULL ) + listener( owner, this, ( mlt_frame )args[ 0 ] ); +} + /** Create a new consumer. */ @@ -371,7 +379,10 @@ static void *consumer_read_ahead_thread( void *arg ) // Get the image of the first frame if ( !video_off ) + { + mlt_events_fire( MLT_CONSUMER_PROPERTIES( this ), "consumer-frame-render", frame, NULL ); mlt_frame_get_image( frame, &image, &this->format, &width, &height, 0 ); + } if ( !audio_off ) { @@ -434,7 +445,10 @@ static void *consumer_read_ahead_thread( void *arg ) { // Get the image, mark as rendered and time it if ( !video_off ) + { + mlt_events_fire( MLT_CONSUMER_PROPERTIES( this ), "consumer-frame-render", frame, NULL ); mlt_frame_get_image( frame, &image, &this->format, &width, &height, 0 ); + } mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "rendered", 1 ); } else diff --git a/src/framework/mlt_producer.c b/src/framework/mlt_producer.c index b8bd2c6..d6c27e3 100644 --- a/src/framework/mlt_producer.c +++ b/src/framework/mlt_producer.c @@ -244,7 +244,7 @@ int mlt_producer_seek( mlt_producer this, mlt_position position ) mlt_producer_seek( mlt_producer_cut_parent( this ), position + mlt_producer_get_in( this ) ); // Check bounds - if ( position < 0 ) + if ( position < 0 || mlt_producer_get_playtime( this ) == 0 ) { position = 0; }