]> git.sesse.net Git - mlt/commitdiff
More corrections to frame position and audio/track handling
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 6 Oct 2004 19:31:05 +0000 (19:31 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 6 Oct 2004 19:31:05 +0000 (19:31 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@466 d19143bc-622f-0410-bfdd-b5b2a6649095

src/framework/mlt_frame.c
src/framework/mlt_multitrack.c
src/framework/mlt_playlist.c
src/framework/mlt_producer.c
src/framework/mlt_tractor.c
src/framework/mlt_transition.c
src/modules/core/transition_mix.c

index 211d5c4afafb8804fd64f5057272a3bbc10da686..be21562d595f507b6f6ba91d4e8be9e2c23ecf91 100644 (file)
@@ -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 ) )
        {
index 6f924843b326ac96ff521f28336e0143f808bf6e..f2f2f0e87a6317c749e318ed41111abdc2a1a0dd 100644 (file)
@@ -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
        {
index 191f9948b7b17bbb69eafef5f6e08e8a6da4fa40..e5875cab4838153a46a476720c653f66e9978b50 100644 (file)
@@ -100,7 +100,7 @@ mlt_playlist mlt_playlist_init( )
                mlt_properties_set( mlt_playlist_properties( this ), "resource", "<playlist>" );
                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;
index 89d81cd12586720af3142f3329dad9e93ba176d6..ddcda2855f66c7373925015f97702528ad694a00 100644 (file)
@@ -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;
index 11539cc3f745bdf35581ae5a7f908a81f5ba03cd..537e4c88615899ea03059213a86b2ff5a70a683a 100644 (file)
@@ -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 );
                }
index 21ccfdabb0b1af38a2178028b550988d5f64e738..1d2d3c3a84c6c90acaf37630b6579084c5f59f58 100644 (file)
@@ -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;
                }
index bfc2d5f2c863eb3f99497f9ade446ea56de2454c..43e98f0cbb7ea11ca6f4854d825c653ee30051ae 100644 (file)
@@ -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;
 }