Extendable factories; general producer related modifications; westley storage; sdl_st...
[melted] / src / modules / dv / consumer_libdv.c
index 132cb6d..cc3542f 100644 (file)
@@ -220,6 +220,7 @@ static int consumer_encode_video( mlt_consumer this, uint8_t *dv_frame, mlt_fram
                uint8_t *image = NULL;
 
                // Get the image
+               mlt_events_fire( this_properties, "consumer-frame-show", frame, NULL );
                mlt_frame_get_image( frame, &image, &fmt, &width, &height, 0 );
 
                // Check that we get what we expected
@@ -372,6 +373,9 @@ static void *consumer_thread( void *arg )
        // Get the properties
        mlt_properties properties = mlt_consumer_properties( this );
 
+       // Get the terminate_on_pause property
+       int top = mlt_properties_get_int( properties, "terminate_on_pause" );
+
        // Get the handling methods
        int ( *video )( mlt_consumer, uint8_t *, mlt_frame ) = mlt_properties_get_data( properties, "video", NULL );
        int ( *audio )( mlt_consumer, uint8_t *, mlt_frame ) = mlt_properties_get_data( properties, "audio", NULL );
@@ -393,6 +397,13 @@ static void *consumer_thread( void *arg )
                // Check that we have a frame to work with
                if ( frame != NULL )
                {
+                       // Terminate on pause
+                       if ( top && mlt_properties_get_double( mlt_frame_properties( frame ), "_speed" ) == 0 )
+                       {
+                               mlt_frame_close( frame );
+                               break;
+                       }
+
                        // Obtain the dv_encoder
                        if ( libdv_get_encoder( this, frame ) != NULL )
                        {
@@ -419,6 +430,8 @@ static void *consumer_thread( void *arg )
        // Tidy up
        mlt_pool_release( dv_frame );
 
+       mlt_consumer_stopped( this );
+
        return NULL;
 }