]> git.sesse.net Git - mlt/commitdiff
Frame rendering event
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 16 Mar 2005 13:28:29 +0000 (13:28 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 16 Mar 2005 13:28:29 +0000 (13:28 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@686 d19143bc-622f-0410-bfdd-b5b2a6649095

src/framework/mlt_consumer.c
src/framework/mlt_producer.c

index f1fbdd549f3b27c58a3a92d37a72b037c4c6ec0c..44f94525d6f917a75412989b33382287d367d167 100644 (file)
@@ -28,6 +28,7 @@
 #include <stdlib.h>
 #include <sys/time.h>
 
+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
index b8bd2c601b10b3adf65c84f1ab883c9dc1fabaf1..d6c27e3c146b7bdd16b0f3b106ebf926ea086944 100644 (file)
@@ -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;
        }