From: lilo_booter Date: Thu, 4 Mar 2004 20:45:22 +0000 (+0000) Subject: experimental tuning X-Git-Url: http://research.m1stereo.tv/gitweb?a=commitdiff_plain;h=a01e64529a0e9d097bce26715a45fd4bb3de3538;p=melted experimental tuning git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@195 d19143bc-622f-0410-bfdd-b5b2a6649095 --- diff --git a/src/framework/mlt_consumer.c b/src/framework/mlt_consumer.c index aadbb07..a04863d 100644 --- a/src/framework/mlt_consumer.c +++ b/src/framework/mlt_consumer.c @@ -228,14 +228,14 @@ static void *consumer_read_ahead_thread( void *arg ) int64_t time_image = 0; // Get the first frame - gettimeofday( &ante, NULL ); frame = mlt_consumer_get_frame( this ); - time_frame = time_difference( &ante ); // Get the image of the first frame mlt_frame_get_image( frame, &image, &this->format, &width, &height, 0 ); mlt_properties_set_int( mlt_frame_properties( frame ), "rendered", 1 ); - time_image = time_difference( &ante ); + + // Get the starting time (can ignore the times above) + gettimeofday( &ante, NULL ); // Continue to read ahead while ( this->ahead ) @@ -257,19 +257,13 @@ static void *consumer_read_ahead_thread( void *arg ) count ++; // Get the image - if ( ( time_frame + time_image + time_wait ) / count < 40000 ) + if ( ( time_frame + time_image ) / count < ( 40000 - ( time_wait / count ) ) ) { // Get the image, mark as rendered and time it mlt_frame_get_image( frame, &image, &this->format, &width, &height, 0 ); mlt_properties_set_int( mlt_frame_properties( frame ), "rendered", 1 ); time_image += time_difference( &ante ); } - else - { - // This is wrong, but it avoids slower machines getting starved - // It is, after all, impossible to go back in time :-/ - time_image -= ( time_image / count / 8 ); - } } // Remove the last frame diff --git a/src/modules/dv/consumer_libdv.c b/src/modules/dv/consumer_libdv.c index 5883abc..1ca825f 100644 --- a/src/modules/dv/consumer_libdv.c +++ b/src/modules/dv/consumer_libdv.c @@ -369,11 +369,15 @@ static void *consumer_thread( void *arg ) // Allocate a single PAL frame for encoding uint8_t *dv_frame = malloc( frame_size_625_50 ); + // Frame and size + mlt_frame frame = NULL; + int size = 0; + // Loop while running while( mlt_properties_get_int( properties, "running" ) ) { // Get the frame - mlt_frame frame = mlt_consumer_rt_frame( this ); + frame = mlt_consumer_rt_frame( this ); // Check that we have a frame to work with if ( frame != NULL ) @@ -382,7 +386,7 @@ static void *consumer_thread( void *arg ) if ( libdv_get_encoder( this, frame ) != NULL ) { // Encode the image - int size = video( this, dv_frame, frame ); + size = video( this, dv_frame, frame ); // Encode the audio if ( size > 0 )