X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fframework%2Fmlt_consumer.c;h=2a05df19658ea364558f57c3bf11af68b4059e56;hb=fd99b3c0f3cf93b743953d9178ca82d19c0abf20;hp=a04863de8da909f66741fbdb88e889e45b4ad5f7;hpb=a01e64529a0e9d097bce26715a45fd4bb3de3538;p=melted diff --git a/src/framework/mlt_consumer.c b/src/framework/mlt_consumer.c index a04863d..2a05df1 100644 --- a/src/framework/mlt_consumer.c +++ b/src/framework/mlt_consumer.c @@ -53,6 +53,7 @@ int mlt_consumer_init( mlt_consumer this, void *child ) mlt_properties_set_int( properties, "width", 720 ); mlt_properties_set_int( properties, "height", 576 ); mlt_properties_set_int( properties, "progressive", 0 ); + mlt_properties_set_double( properties, "aspect_ratio", 128.0 / 117.0 ); } else { @@ -61,11 +62,9 @@ int mlt_consumer_init( mlt_consumer this, void *child ) mlt_properties_set_int( properties, "width", 720 ); mlt_properties_set_int( properties, "height", 480 ); mlt_properties_set_int( properties, "progressive", 0 ); + mlt_properties_set_double( properties, "aspect_ratio", 72.0 / 79.0 ); } - // Default aspect ratio - mlt_properties_set_double( properties, "aspect_ratio", 4.0 / 3.0 ); - // Default rescaler for all consumers mlt_properties_set( properties, "rescale", "bilinear" ); @@ -78,6 +77,22 @@ int mlt_consumer_init( mlt_consumer this, void *child ) return error; } +/** Create a new consumer. +*/ + +mlt_consumer mlt_consumer_new( ) +{ + // Create the memory for the structure + mlt_consumer this = malloc( sizeof( struct mlt_consumer_s ) ); + + // Initialise it + if ( this != NULL ) + mlt_consumer_init( this, NULL ); + + // Return it + return this; +} + /** Get the parent service object. */ @@ -223,6 +238,7 @@ static void *consumer_read_ahead_thread( void *arg ) // Average time for get_frame and get_image int count = 1; + int skipped = 0; int64_t time_wait = 0; int64_t time_frame = 0; int64_t time_image = 0; @@ -263,6 +279,24 @@ static void *consumer_read_ahead_thread( void *arg ) 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 ); + + // Reset the skipped count + skipped = 0; + } + else + { + // Increment the number of sequentially skipped frames + skipped ++; + + // If we've reached an unacceptable level, reset everything + if ( skipped > 10 ) + { + skipped = 0; + time_frame = 0; + time_image = 0; + time_wait = 0; + count = 0; + } } } @@ -399,4 +433,3 @@ void mlt_consumer_close( mlt_consumer this ) else mlt_service_close( &this->parent ); } -