]> git.sesse.net Git - mlt/commitdiff
Make maximum consecutive-dropped frames configurable.
authorDan Dennedy <dan@dennedy.org>
Sun, 10 Jul 2011 19:23:54 +0000 (12:23 -0700)
committerDan Dennedy <dan@dennedy.org>
Sun, 10 Jul 2011 19:23:54 +0000 (12:23 -0700)
Defaults to old value of 5 that seems more preferable for video editing.

src/framework/mlt_consumer.c
src/framework/mlt_consumer.h
src/modules/sdl/consumer_sdl_preview.c

index 2bb11caa92e7c85533682d069d55c1de17b97389..31da9f7723fbac4e5e0f6336bc814ac68860a9a8 100644 (file)
@@ -86,6 +86,7 @@ int mlt_consumer_init( mlt_consumer self, void *child, mlt_profile profile )
 
                // Default read ahead buffer size
                mlt_properties_set_int( properties, "buffer", 25 );
+               mlt_properties_set_int( properties, "drop_max", 5 );
 
                // Default audio frequency and channels
                mlt_properties_set_int( properties, "frequency", 48000 );
@@ -646,6 +647,7 @@ static void *consumer_read_ahead_thread( void *arg )
        mlt_position start_pos = 0;
        mlt_position last_pos = 0;
        int frame_duration = mlt_properties_get_int( properties, "frame_duration" );
+       int drop_max = mlt_properties_get_int( properties, "drop_max" );
 
        if ( preview_off && preview_format != 0 )
                self->format = preview_format;
@@ -734,7 +736,7 @@ static void *consumer_read_ahead_thread( void *arg )
                        skipped++;
 
                        // If too many (1 sec) consecutively-skipped frames
-                       if ( skipped > fps )
+                       if ( skipped > drop_max )
                        {
                                // Reset cost tracker
                                time_process = 0;
@@ -1246,7 +1248,7 @@ static mlt_frame worker_get_frame( mlt_consumer self, mlt_properties properties
 //                     self->consecutive_dropped, self->consecutive_rendered, self->process_head );
 
                // Check for too many consecutively dropped frames
-               if ( self->consecutive_dropped > fps )
+               if ( self->consecutive_dropped > mlt_properties_get_int( properties, "drop_max" ) )
                {
                        int orig_buffer = mlt_properties_get_int( properties, "buffer" );
                        int prefill = mlt_properties_get_int( properties, "prefill" );
index e6e27aa8307fa8c3190bcdf9f1c769f0562f041a..06c63502a787e58cc8d6f47da0011daeb379402d 100644 (file)
@@ -40,6 +40,9 @@
  * filters, defaults to "bilinear"
  * \properties \em buffer the number of frames to use in the asynchronous
  * render thread, defaults to 25
+ * \properties \em prefill the number of frames to render before commencing
+ * output when real_time <> 0, defaults to the size of buffer
+ * \properties \em drop_max the maximum number of consecutively dropped frames, defaults to 5
  * \properties \em frequency the audio sample rate to use in Hertz, defaults to 48000
  * \properties \em channels the number of audio channels to use, defaults to 2
  * \properties \em real_time the asynchronous behavior: 1 (default) for asynchronous
index ced12060704fc5671c631a54a3937e2c0108c0b8..fed76523acbc733f7fea1ce477a9eb50367e6e4f 100644 (file)
@@ -199,7 +199,7 @@ static int consumer_start( mlt_consumer parent )
 
                mlt_properties_pass_list( play, properties,
                        "deinterlace_method,resize,rescale,width,height,aspect_ratio,display_ratio,preview_off,preview_format,window_background"
-                       ",volume,real_time,buffer,prefill,audio_off,frequency" );
+                       ",volume,real_time,buffer,prefill,audio_off,frequency,drop_max" );
                mlt_properties_pass_list( still, properties,
                        "deinterlace_method,resize,rescale,width,height,aspect_ratio,display_ratio,preview_off,preview_format,window_background" );