From: lilo_booter Date: Wed, 6 Oct 2004 19:31:05 +0000 (+0000) Subject: More corrections to frame position and audio/track handling X-Git-Url: http://research.m1stereo.tv/gitweb?a=commitdiff_plain;h=e25076bb729fbb4a35b095bc58f3facbcbe82ef5;p=melted More corrections to frame position and audio/track handling git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@466 d19143bc-622f-0410-bfdd-b5b2a6649095 --- diff --git a/src/framework/mlt_frame.c b/src/framework/mlt_frame.c index 211d5c4..be21562 100644 --- a/src/framework/mlt_frame.c +++ b/src/framework/mlt_frame.c @@ -233,8 +233,6 @@ int mlt_frame_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *for mlt_properties_set_int( properties, "width", *width ); mlt_properties_set_int( properties, "height", *height ); mlt_properties_set_double( properties, "aspect_ratio", mlt_frame_get_aspect_ratio( test_frame ) ); - mlt_properties_set( properties, "rescale.interp", "none" ); - mlt_properties_set( properties, "scale", "off" ); } else { @@ -317,7 +315,9 @@ int mlt_frame_get_audio( mlt_frame this, int16_t **buffer, mlt_audio_format *for if ( hide == 0 && this->get_audio != NULL ) { + mlt_position position = mlt_frame_get_position( this ); this->get_audio( this, buffer, format, frequency, channels, samples ); + mlt_frame_set_position( this, position ); } else if ( mlt_properties_get_data( properties, "audio", NULL ) ) { diff --git a/src/framework/mlt_multitrack.c b/src/framework/mlt_multitrack.c index 6f92484..f2f2f0e 100644 --- a/src/framework/mlt_multitrack.c +++ b/src/framework/mlt_multitrack.c @@ -416,10 +416,7 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int ind mlt_properties properties = mlt_frame_properties( *frame ); mlt_properties_set_double( properties, "_speed", speed ); mlt_properties_set_position( properties, "_position", position ); - 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 ); + mlt_properties_set_int( properties, "hide", hide ); } else { diff --git a/src/framework/mlt_playlist.c b/src/framework/mlt_playlist.c index 191f994..e5875ca 100644 --- a/src/framework/mlt_playlist.c +++ b/src/framework/mlt_playlist.c @@ -100,7 +100,7 @@ mlt_playlist mlt_playlist_init( ) mlt_properties_set( mlt_playlist_properties( this ), "resource", "" ); mlt_properties_set( mlt_playlist_properties( this ), "mlt_type", "mlt_producer" ); mlt_properties_set_position( mlt_playlist_properties( this ), "in", 0 ); - mlt_properties_set_position( mlt_playlist_properties( this ), "out", 0 ); + mlt_properties_set_position( mlt_playlist_properties( this ), "out", -1 ); mlt_properties_set_position( mlt_playlist_properties( this ), "length", 0 ); this->size = 10; diff --git a/src/framework/mlt_producer.c b/src/framework/mlt_producer.c index 89d81cd..ddcda28 100644 --- a/src/framework/mlt_producer.c +++ b/src/framework/mlt_producer.c @@ -442,7 +442,7 @@ static int producer_get_frame( mlt_service service, mlt_frame_ptr frame, int ind char key[ 25 ]; sprintf( key, "_clone.%d", clone_index - 1 ); clone = mlt_properties_get_data( mlt_producer_properties( mlt_producer_cut_parent( this ) ), key, NULL ); - if ( clone == NULL ) fprintf( stderr, "requested clone doesn't exist\n" ); + if ( clone == NULL ) fprintf( stderr, "requested clone doesn't exist %d\n", clone_index ); clone = clone == NULL ? this : clone; } else @@ -525,7 +525,7 @@ static void mlt_producer_set_clones( mlt_producer this, int clones ) int i = 0; char key[ 25 ]; - // If the number of existing clones is different, the create/remove as necessary + // If the number of existing clones is different, then create/remove as necessary if ( existing != clones ) { if ( existing < clones ) @@ -634,7 +634,7 @@ static int on_start_producer( mlt_parser this, mlt_producer object ) mlt_properties properties = mlt_parser_properties( this ); mlt_properties producers = mlt_properties_get_data( properties, "producers", NULL ); mlt_producer parent = mlt_producer_cut_parent( object ); - if ( !mlt_producer_is_mix( mlt_producer_cut_parent( object ) ) && mlt_producer_is_cut( object ) ) + if ( mlt_service_identify( ( mlt_service )mlt_producer_cut_parent( object ) ) == producer_type && mlt_producer_is_cut( object ) ) { int ref_count = 0; clip_references *old_refs = NULL; diff --git a/src/framework/mlt_tractor.c b/src/framework/mlt_tractor.c index 11539cc..537e4c8 100644 --- a/src/framework/mlt_tractor.c +++ b/src/framework/mlt_tractor.c @@ -284,6 +284,9 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra // Determine which data_queue to pass on... void *data_queue = NULL; + // Temporary properties + mlt_properties temp_properties = NULL; + // Get the multitrack's producer mlt_producer target = mlt_multitrack_producer( multitrack ); mlt_producer_seek( target, mlt_producer_frame( parent ) ); @@ -301,21 +304,24 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra // Get a frame from the producer mlt_service_get_frame( this->producer, &temp, i ); + // Get the temporary properties + temp_properties = mlt_frame_properties( temp ); + // Check for last track - done = mlt_properties_get_int( mlt_frame_properties( temp ), "last_track" ); + done = mlt_properties_get_int( temp_properties, "last_track" ); // We store all frames with a destructor on the output frame sprintf( label, "_%s_%d", id, count ++ ); mlt_properties_set_data( frame_properties, label, temp, 0, ( mlt_destructor )mlt_frame_close, NULL ); // We want the last data_queue - if ( mlt_properties_get_data( mlt_frame_properties( temp ), "data_queue", NULL ) != NULL ) + if ( !done && mlt_properties_get_data( temp_properties, "data_queue", NULL ) != NULL ) 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 ) ) + if ( !done && !mlt_frame_is_test_audio( temp ) && !( mlt_properties_get_int( temp_properties, "hide" ) & 2 ) ) audio = temp; - if ( !done && !mlt_frame_is_test_card( temp ) ) + if ( !done && !mlt_frame_is_test_card( temp ) && !( mlt_properties_get_int( temp_properties, "hide" ) & 1 ) ) video = temp; } @@ -340,6 +346,7 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra mlt_properties_set_position( frame_properties, "_position", mlt_properties_get_position( video_properties, "_position" ) ); } + mlt_frame_set_position( *frame, mlt_producer_frame( parent ) ); mlt_properties_set_int( mlt_frame_properties( *frame ), "test_audio", audio == NULL ); mlt_properties_set_int( mlt_frame_properties( *frame ), "test_image", video == NULL ); } diff --git a/src/framework/mlt_transition.c b/src/framework/mlt_transition.c index 21ccfda..1d2d3c3 100644 --- a/src/framework/mlt_transition.c +++ b/src/framework/mlt_transition.c @@ -177,6 +177,7 @@ static int transition_get_frame( mlt_service service, mlt_frame_ptr frame, int i mlt_properties properties = mlt_transition_properties( this ); + int accepts_blanks = mlt_properties_get_int( properties, "_accepts_blanks" ); int a_track = mlt_properties_get_int( properties, "a_track" ); int b_track = mlt_properties_get_int( properties, "b_track" ); mlt_position in = mlt_properties_get_position( properties, "in" ); @@ -197,15 +198,11 @@ static int transition_get_frame( mlt_service service, mlt_frame_ptr frame, int i mlt_position position = mlt_frame_get_position( this->a_frame ); if ( position >= in && position <= out ) { -#if 0 - // TODO: This could is breaking muliple transitions, but it would be nice to have... - // essentially, it allows transitions to run over whole tracks, while ignoring test cards - // (alternative is to put the handling in the transitions themselves :-/) - if ( this->b_frame == NULL || ( mlt_frame_is_test_card( this->b_frame ) && mlt_frame_is_test_audio( this->b_frame ) ) ) + if ( !accepts_blanks && ( this->b_frame == NULL || ( mlt_frame_is_test_card( this->b_frame ) && mlt_frame_is_test_audio( this->b_frame ) ) ) ) { *frame = this->a_frame; } - else if ( this->a_frame == NULL || ( mlt_frame_is_test_card( this->a_frame ) && mlt_frame_is_test_audio( this->a_frame ) ) ) + else if ( !accepts_blanks && ( this->a_frame == NULL || ( mlt_frame_is_test_card( this->a_frame ) && mlt_frame_is_test_audio( this->a_frame ) ) ) ) { mlt_frame t = this->a_frame; this->a_frame = this->b_frame; @@ -213,13 +210,14 @@ static int transition_get_frame( mlt_service service, mlt_frame_ptr frame, int i *frame = this->a_frame; } else -#endif { + int hide = 0; *frame = mlt_transition_process( this, this->a_frame, this->b_frame ); if ( !mlt_properties_get_int( mlt_frame_properties( this->a_frame ), "test_image" ) ) - mlt_properties_set_int( mlt_frame_properties( this->b_frame ), "test_image", 1 ); + hide = 1; if ( !mlt_properties_get_int( mlt_frame_properties( this->a_frame ), "test_audio" ) ) - mlt_properties_set_int( mlt_frame_properties( this->b_frame ), "test_audio", 1 ); + hide |= 2; + mlt_properties_set_int( mlt_frame_properties( this->b_frame ), "hide", hide ); } this->a_held = 0; } diff --git a/src/modules/core/transition_mix.c b/src/modules/core/transition_mix.c index bfc2d5f..43e98f0 100644 --- a/src/modules/core/transition_mix.c +++ b/src/modules/core/transition_mix.c @@ -54,7 +54,6 @@ 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; @@ -106,8 +105,6 @@ 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) @@ -132,6 +129,7 @@ mlt_transition transition_mix_init( char *arg ) this->process = transition_process; if ( arg != NULL ) mlt_properties_set_double( mlt_transition_properties( this ), "start", atof( arg ) ); + mlt_properties_set_int( mlt_transition_properties( this ), "_accepts_blanks", 1 ); } return this; }