From: lilo_booter Date: Wed, 14 Jan 2004 19:32:35 +0000 (+0000) Subject: some temporary fixes X-Git-Url: http://research.m1stereo.tv/gitweb?a=commitdiff_plain;h=6336039a203c6496691784682f9ad56eb13abcc3;p=melted some temporary fixes git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@78 d19143bc-622f-0410-bfdd-b5b2a6649095 --- diff --git a/mlt/src/framework/mlt_frame.c b/mlt/src/framework/mlt_frame.c index f2fad14..1c36cf0 100644 --- a/mlt/src/framework/mlt_frame.c +++ b/mlt/src/framework/mlt_frame.c @@ -77,7 +77,15 @@ mlt_properties mlt_frame_properties( mlt_frame this ) int mlt_frame_is_test_card( mlt_frame this ) { - return this->stack_get_image_size == 0; + return ( this->stack_get_image_size == 0 && mlt_properties_get_data( mlt_frame_properties( this ), "image", NULL ) == NULL ); +} + +/** Check if we have a way to derive something than test audio. +*/ + +int mlt_frame_is_test_audio( mlt_frame this ) +{ + return this->get_audio == NULL; } /** Get the aspect ratio of the frame. diff --git a/mlt/src/framework/mlt_frame.h b/mlt/src/framework/mlt_frame.h index 58476d5..5ece49c 100644 --- a/mlt/src/framework/mlt_frame.h +++ b/mlt/src/framework/mlt_frame.h @@ -68,6 +68,7 @@ struct mlt_frame_s extern mlt_frame mlt_frame_init( ); extern mlt_properties mlt_frame_properties( mlt_frame this ); extern int mlt_frame_is_test_card( mlt_frame this ); +extern int mlt_frame_is_test_audio( mlt_frame this ); extern double mlt_frame_get_aspect_ratio( mlt_frame this ); extern int mlt_frame_set_aspect_ratio( mlt_frame this, double value ); extern mlt_position mlt_frame_get_position( mlt_frame this ); diff --git a/mlt/src/framework/mlt_tractor.c b/mlt/src/framework/mlt_tractor.c index 6c02230..8d6247d 100644 --- a/mlt/src/framework/mlt_tractor.c +++ b/mlt/src/framework/mlt_tractor.c @@ -118,7 +118,7 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra int i = 0; int looking = 1; int done = 0; - mlt_frame temp; + mlt_frame temp = NULL; // Get the properties of the parent producer mlt_properties properties = mlt_producer_properties( parent ); @@ -154,7 +154,13 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra // Use this as output if we don't have one already *frame = temp; } - else if ( !mlt_frame_is_test_card( temp ) && looking ) + else if ( ( !mlt_frame_is_test_card( temp ) || !mlt_frame_is_test_audio( temp ) ) && + mlt_producer_frame( parent ) == mlt_properties_get_position( mlt_frame_properties( temp ), "position" ) ) + { + *frame = temp; + looking = 0; + } + else if ( ( !mlt_frame_is_test_card( temp ) || !mlt_frame_is_test_audio( temp ) ) && looking ) { // This is the one we want and we can stop looking *frame = temp; diff --git a/mlt/src/modules/core/transition_luma.c b/mlt/src/modules/core/transition_luma.c index 71c8238..fc712ea 100644 --- a/mlt/src/modules/core/transition_luma.c +++ b/mlt/src/modules/core/transition_luma.c @@ -342,7 +342,7 @@ static mlt_frame transition_process( mlt_transition transition, mlt_frame a_fram mlt_position in = mlt_transition_get_in( transition ); mlt_position out = mlt_transition_get_out( transition ); mlt_position time = mlt_frame_get_position( b_frame ); - double pos = ( time - in ) / ( out - in ); + double pos = ( (double)time - (double)in ) / ( (double)out - (double)in + 1 ); // Set the b frame properties mlt_properties_set_double( b_props, "mix", pos ); diff --git a/mlt/src/modules/dv/consumer_libdv.c b/mlt/src/modules/dv/consumer_libdv.c index fa1a326..8735ed8 100644 --- a/mlt/src/modules/dv/consumer_libdv.c +++ b/mlt/src/modules/dv/consumer_libdv.c @@ -140,6 +140,9 @@ static int consumer_encode_video( mlt_consumer this, uint8_t *dv_frame, mlt_fram // This will hold the size of the dv frame int size = 0; + // determine if this a test card + int is_test = mlt_frame_is_test_card( frame ); + // If we get an encoder, then encode the image if ( encoder != NULL ) { @@ -168,10 +171,13 @@ static int consumer_encode_video( mlt_consumer this, uint8_t *dv_frame, mlt_fram } // Process the frame - if ( size != 0 ) + if ( size != 0 && !( mlt_properties_get_int( this_properties, "was_test_card" ) && is_test ) ) { // Encode the image dv_encode_full_frame( encoder, &image, e_dv_color_yuv, dv_frame ); + + // Note test card status + mlt_properties_set_int( this_properties, "was_test_card", is_test ); } } diff --git a/mlt/src/modules/ffmpeg/producer_ffmpeg.c b/mlt/src/modules/ffmpeg/producer_ffmpeg.c index 43b8a2e..15b1c89 100644 --- a/mlt/src/modules/ffmpeg/producer_ffmpeg.c +++ b/mlt/src/modules/ffmpeg/producer_ffmpeg.c @@ -489,7 +489,6 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i // Push the image callback mlt_frame_push_get_image( *frame, producer_get_image ); - } else { @@ -505,28 +504,24 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i } // Push the image callback - mlt_frame_push_get_image( *frame, producer_get_image ); + if ( !this->end_of_video ) + mlt_frame_push_get_image( *frame, producer_get_image ); } // Set the audio pipe mlt_properties_set_data( properties, "producer_ffmpeg", this, 0, NULL, NULL ); // Hmm - register audio callback - ( *frame )->get_audio = producer_get_audio; + if ( !this->end_of_audio ) + ( *frame )->get_audio = producer_get_audio; // Get the additional properties double aspect_ratio = mlt_properties_get_double( producer_properties, "aspect_ratio" ); double speed = mlt_properties_get_double( producer_properties, "speed" ); - char *video_file = mlt_properties_get( producer_properties, "video_file" ); // Set them on the frame mlt_properties_set_double( properties, "aspect_ratio", aspect_ratio ); mlt_properties_set_double( properties, "speed", speed ); - if ( strchr( video_file, '/' ) != NULL ) - mlt_properties_set( properties, "file", strrchr( video_file, '/' ) + 1 ); - else - mlt_properties_set( properties, "file", video_file ); - // Set the out point on the producer if ( this->end_of_video && this->end_of_audio ) diff --git a/src/framework/mlt_frame.c b/src/framework/mlt_frame.c index f2fad14..1c36cf0 100644 --- a/src/framework/mlt_frame.c +++ b/src/framework/mlt_frame.c @@ -77,7 +77,15 @@ mlt_properties mlt_frame_properties( mlt_frame this ) int mlt_frame_is_test_card( mlt_frame this ) { - return this->stack_get_image_size == 0; + return ( this->stack_get_image_size == 0 && mlt_properties_get_data( mlt_frame_properties( this ), "image", NULL ) == NULL ); +} + +/** Check if we have a way to derive something than test audio. +*/ + +int mlt_frame_is_test_audio( mlt_frame this ) +{ + return this->get_audio == NULL; } /** Get the aspect ratio of the frame. diff --git a/src/framework/mlt_frame.h b/src/framework/mlt_frame.h index 58476d5..5ece49c 100644 --- a/src/framework/mlt_frame.h +++ b/src/framework/mlt_frame.h @@ -68,6 +68,7 @@ struct mlt_frame_s extern mlt_frame mlt_frame_init( ); extern mlt_properties mlt_frame_properties( mlt_frame this ); extern int mlt_frame_is_test_card( mlt_frame this ); +extern int mlt_frame_is_test_audio( mlt_frame this ); extern double mlt_frame_get_aspect_ratio( mlt_frame this ); extern int mlt_frame_set_aspect_ratio( mlt_frame this, double value ); extern mlt_position mlt_frame_get_position( mlt_frame this ); diff --git a/src/framework/mlt_tractor.c b/src/framework/mlt_tractor.c index 6c02230..8d6247d 100644 --- a/src/framework/mlt_tractor.c +++ b/src/framework/mlt_tractor.c @@ -118,7 +118,7 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra int i = 0; int looking = 1; int done = 0; - mlt_frame temp; + mlt_frame temp = NULL; // Get the properties of the parent producer mlt_properties properties = mlt_producer_properties( parent ); @@ -154,7 +154,13 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra // Use this as output if we don't have one already *frame = temp; } - else if ( !mlt_frame_is_test_card( temp ) && looking ) + else if ( ( !mlt_frame_is_test_card( temp ) || !mlt_frame_is_test_audio( temp ) ) && + mlt_producer_frame( parent ) == mlt_properties_get_position( mlt_frame_properties( temp ), "position" ) ) + { + *frame = temp; + looking = 0; + } + else if ( ( !mlt_frame_is_test_card( temp ) || !mlt_frame_is_test_audio( temp ) ) && looking ) { // This is the one we want and we can stop looking *frame = temp; diff --git a/src/modules/core/transition_luma.c b/src/modules/core/transition_luma.c index 71c8238..fc712ea 100644 --- a/src/modules/core/transition_luma.c +++ b/src/modules/core/transition_luma.c @@ -342,7 +342,7 @@ static mlt_frame transition_process( mlt_transition transition, mlt_frame a_fram mlt_position in = mlt_transition_get_in( transition ); mlt_position out = mlt_transition_get_out( transition ); mlt_position time = mlt_frame_get_position( b_frame ); - double pos = ( time - in ) / ( out - in ); + double pos = ( (double)time - (double)in ) / ( (double)out - (double)in + 1 ); // Set the b frame properties mlt_properties_set_double( b_props, "mix", pos ); diff --git a/src/modules/dv/consumer_libdv.c b/src/modules/dv/consumer_libdv.c index fa1a326..8735ed8 100644 --- a/src/modules/dv/consumer_libdv.c +++ b/src/modules/dv/consumer_libdv.c @@ -140,6 +140,9 @@ static int consumer_encode_video( mlt_consumer this, uint8_t *dv_frame, mlt_fram // This will hold the size of the dv frame int size = 0; + // determine if this a test card + int is_test = mlt_frame_is_test_card( frame ); + // If we get an encoder, then encode the image if ( encoder != NULL ) { @@ -168,10 +171,13 @@ static int consumer_encode_video( mlt_consumer this, uint8_t *dv_frame, mlt_fram } // Process the frame - if ( size != 0 ) + if ( size != 0 && !( mlt_properties_get_int( this_properties, "was_test_card" ) && is_test ) ) { // Encode the image dv_encode_full_frame( encoder, &image, e_dv_color_yuv, dv_frame ); + + // Note test card status + mlt_properties_set_int( this_properties, "was_test_card", is_test ); } } diff --git a/src/modules/ffmpeg/producer_ffmpeg.c b/src/modules/ffmpeg/producer_ffmpeg.c index 43b8a2e..15b1c89 100644 --- a/src/modules/ffmpeg/producer_ffmpeg.c +++ b/src/modules/ffmpeg/producer_ffmpeg.c @@ -489,7 +489,6 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i // Push the image callback mlt_frame_push_get_image( *frame, producer_get_image ); - } else { @@ -505,28 +504,24 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i } // Push the image callback - mlt_frame_push_get_image( *frame, producer_get_image ); + if ( !this->end_of_video ) + mlt_frame_push_get_image( *frame, producer_get_image ); } // Set the audio pipe mlt_properties_set_data( properties, "producer_ffmpeg", this, 0, NULL, NULL ); // Hmm - register audio callback - ( *frame )->get_audio = producer_get_audio; + if ( !this->end_of_audio ) + ( *frame )->get_audio = producer_get_audio; // Get the additional properties double aspect_ratio = mlt_properties_get_double( producer_properties, "aspect_ratio" ); double speed = mlt_properties_get_double( producer_properties, "speed" ); - char *video_file = mlt_properties_get( producer_properties, "video_file" ); // Set them on the frame mlt_properties_set_double( properties, "aspect_ratio", aspect_ratio ); mlt_properties_set_double( properties, "speed", speed ); - if ( strchr( video_file, '/' ) != NULL ) - mlt_properties_set( properties, "file", strrchr( video_file, '/' ) + 1 ); - else - mlt_properties_set( properties, "file", video_file ); - // Set the out point on the producer if ( this->end_of_video && this->end_of_audio )