From: lilo_booter Date: Wed, 6 Oct 2004 11:40:42 +0000 (+0000) Subject: Corrects position and test_audio handling X-Git-Url: http://research.m1stereo.tv/gitweb?a=commitdiff_plain;h=1da06dddd4f117c21c07b3682fab5abab014d995;p=melted Corrects position and test_audio handling git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@465 d19143bc-622f-0410-bfdd-b5b2a6649095 --- diff --git a/src/framework/mlt_frame.c b/src/framework/mlt_frame.c index 4fb656c..211d5c4 100644 --- a/src/framework/mlt_frame.c +++ b/src/framework/mlt_frame.c @@ -313,8 +313,9 @@ uint8_t *mlt_frame_get_alpha_mask( mlt_frame this ) int mlt_frame_get_audio( mlt_frame this, int16_t **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples ) { mlt_properties properties = mlt_frame_properties( this ); + int hide = mlt_properties_get_int( properties, "test_audio" ); - if ( this->get_audio != NULL ) + if ( hide == 0 && this->get_audio != NULL ) { this->get_audio( this, buffer, format, frequency, channels, samples ); } diff --git a/src/framework/mlt_multitrack.c b/src/framework/mlt_multitrack.c index 50a9426..6f92484 100644 --- a/src/framework/mlt_multitrack.c +++ b/src/framework/mlt_multitrack.c @@ -394,9 +394,18 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int ind // Get the producer for this track mlt_producer producer = this->list[ index ]->producer; + // Get the track hide property + int hide = mlt_properties_get_int( mlt_producer_properties( mlt_producer_cut_parent( producer ) ), "hide" ); + // Obtain the current position mlt_position position = mlt_producer_frame( parent ); + // Get the parent properties + mlt_properties producer_properties = mlt_producer_properties( parent ); + + // Get the speed + double speed = mlt_properties_get_double( producer_properties, "_speed" ); + // Make sure we're at the same point mlt_producer_seek( producer, position ); @@ -404,12 +413,13 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int ind mlt_service_get_frame( mlt_producer_service( producer ), frame, 0 ); // Indicate speed of this producer - mlt_properties producer_properties = mlt_producer_properties( parent ); - double speed = mlt_properties_get_double( producer_properties, "_speed" ); mlt_properties properties = mlt_frame_properties( *frame ); mlt_properties_set_double( properties, "_speed", speed ); mlt_properties_set_position( properties, "_position", position ); - mlt_properties_set_int( properties, "hide", mlt_properties_get_int( mlt_producer_properties( producer ), "hide" ) ); + if ( mlt_properties_get_int( properties, "test_image" ) == 0 ) + mlt_properties_set_int( properties, "test_image", hide & 1 ); + if ( mlt_properties_get_int( properties, "test_audio" ) == 0 ) + mlt_properties_set_int( properties, "test_audio", hide & 2 ); } else { diff --git a/src/framework/mlt_playlist.c b/src/framework/mlt_playlist.c index 222d5bf..191f994 100644 --- a/src/framework/mlt_playlist.c +++ b/src/framework/mlt_playlist.c @@ -289,7 +289,7 @@ static int mlt_playlist_virtual_append( mlt_playlist this, mlt_producer source, /** Seek in the virtual playlist. */ -static mlt_service mlt_playlist_virtual_seek( mlt_playlist this ) +static mlt_service mlt_playlist_virtual_seek( mlt_playlist this, int *progressive ) { // Default producer to blank mlt_producer producer = NULL; @@ -336,17 +336,20 @@ static mlt_service mlt_playlist_virtual_seek( mlt_playlist this ) if ( producer != NULL ) { int count = this->list[ i ]->frame_count / this->list[ i ]->repeat; + *progressive = count == 1; mlt_producer_seek( producer, position % count ); } else if ( !strcmp( eof, "pause" ) && total > 0 ) { playlist_entry *entry = this->list[ this->count - 1 ]; + int count = entry->frame_count / entry->repeat; mlt_producer this_producer = mlt_playlist_producer( this ); mlt_producer_seek( this_producer, original - 1 ); producer = entry->producer; - mlt_producer_seek( producer, entry->frame_out ); + mlt_producer_seek( producer, entry->frame_out % count ); mlt_producer_set_speed( this_producer, 0 ); mlt_producer_set_speed( producer, 0 ); + *progressive = count == 1; } else if ( !strcmp( eof, "loop" ) && total > 0 ) { @@ -805,8 +808,6 @@ int mlt_playlist_join( mlt_playlist this, int clip, int count, int merge ) playlist_entry *entry = this->list[ clip ]; mlt_playlist_append( new_clip, entry->producer ); mlt_playlist_repeat_clip( new_clip, i, entry->repeat ); - if ( entry->frame_count == entry->repeat ) - mlt_properties_set_int( mlt_playlist_properties( new_clip ), "hide", 2 ); entry->preservation_hack = 1; mlt_playlist_remove( this, clip ); } @@ -881,7 +882,7 @@ int mlt_playlist_mix( mlt_playlist this, int clip, int length, mlt_transition tr } mlt_events_unblock( mlt_playlist_properties( this ), this ); - mlt_events_fire( mlt_playlist_properties( this ), "producer-changed", NULL ); + mlt_playlist_virtual_refresh( this ); mlt_producer_close( track_a ); mlt_producer_close( track_b ); mlt_tractor_close( tractor ); @@ -941,7 +942,8 @@ static int mlt_playlist_unmix( mlt_playlist this, int clip ) { mlt_producer producer = mlt_producer_cut_parent( this->list[ clip ]->producer ); mlt_properties properties = mlt_producer_properties( producer ); - error = mlt_properties_get_data( properties, "mlt_mix", NULL ) == NULL; + error = mlt_properties_get_data( properties, "mlt_mix", NULL ) == NULL || + this->list[ clip ]->preservation_hack; } if ( error == 0 ) @@ -1035,8 +1037,11 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i // Get this mlt_playlist mlt_playlist this = producer->child; + // Need to ensure the frame is deinterlaced when repeating 1 frame + int progressive = 0; + // Get the real producer - mlt_service real = mlt_playlist_virtual_seek( this ); + mlt_service real = mlt_playlist_virtual_seek( this, &progressive ); // Get the frame mlt_service_get_frame( real, frame, index ); @@ -1046,6 +1051,13 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i if ( mlt_properties_get_int( properties, "end_of_clip" ) ) mlt_playlist_virtual_set_out( this ); + // Set the consumer progressive property + if ( progressive ) + { + mlt_properties_set_int( properties, "consumer_progressive", progressive ); + mlt_properties_set_int( properties, "test_audio", 1 ); + } + // Check for notifier and call with appropriate argument mlt_properties playlist_properties = mlt_producer_properties( producer ); void ( *notifier )( void * ) = mlt_properties_get_data( playlist_properties, "notifier", NULL ); diff --git a/src/framework/mlt_tractor.c b/src/framework/mlt_tractor.c index b5ee3a9..11539cc 100644 --- a/src/framework/mlt_tractor.c +++ b/src/framework/mlt_tractor.c @@ -313,17 +313,19 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra data_queue = mlt_properties_get_data( mlt_frame_properties( temp ), "data_queue", NULL ); // Pick up first video and audio frames - if ( !done && !mlt_frame_is_test_audio( temp ) && !( mlt_properties_get_int( mlt_frame_properties( temp ), "hide" ) & 2 ) ) + if ( !done && !mlt_frame_is_test_audio( temp ) ) audio = temp; - if ( !done && !mlt_frame_is_test_card( temp ) && !( mlt_properties_get_int( mlt_frame_properties( temp ), "hide" ) & 1 ) ) + if ( !done && !mlt_frame_is_test_card( temp ) ) video = temp; } // Now stack callbacks if ( audio != NULL ) { + mlt_properties audio_properties = mlt_frame_properties( audio ); mlt_frame_push_audio( *frame, audio ); ( *frame )->get_audio = producer_get_audio; + mlt_properties_set_position( frame_properties, "_position", mlt_properties_get_position( audio_properties, "_position" ) ); } if ( video != NULL ) @@ -335,6 +337,7 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra mlt_properties_set_int( frame_properties, "width", mlt_properties_get_int( video_properties, "width" ) ); mlt_properties_set_int( frame_properties, "height", mlt_properties_get_int( video_properties, "height" ) ); mlt_properties_set_double( frame_properties, "aspect_ratio", mlt_properties_get_double( video_properties, "aspect_ratio" ) ); + mlt_properties_set_position( frame_properties, "_position", mlt_properties_get_position( video_properties, "_position" ) ); } mlt_properties_set_int( mlt_frame_properties( *frame ), "test_audio", audio == NULL ); diff --git a/src/modules/core/transition_mix.c b/src/modules/core/transition_mix.c index d6f8b2a..bfc2d5f 100644 --- a/src/modules/core/transition_mix.c +++ b/src/modules/core/transition_mix.c @@ -54,6 +54,7 @@ static int transition_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_fo } //fprintf( stderr, "transition_mix: previous %f current %f\n", mix_start, mix_end ); + mlt_properties_set_int( b_props, "test_audio", mlt_properties_get_int( b_props, "original_test_audio" ) ); mlt_frame_mix_audio( frame, b_frame, mix_start, mix_end, buffer, format, frequency, channels, samples ); return 0; @@ -105,6 +106,8 @@ static mlt_frame transition_process( mlt_transition this, mlt_frame a_frame, mlt mlt_properties_set_double( properties, "previous_mix", mlt_properties_get_double( b_props, "audio.mix" ) ); mlt_properties_set_double( b_props, "audio.reverse", mlt_properties_get_double( properties, "reverse" ) ); + + mlt_properties_set_int( b_props, "original_test_audio", mlt_properties_get_int( b_props, "test_audio" ) ); } // Backup the original get_audio (it's still needed)