]> git.sesse.net Git - mlt/commitdiff
Corrects position and test_audio handling
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 6 Oct 2004 11:40:42 +0000 (11:40 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 6 Oct 2004 11:40:42 +0000 (11:40 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@465 d19143bc-622f-0410-bfdd-b5b2a6649095

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

index 4fb656c1e83c0ab3c440d708001fd123e5a226f9..211d5c4afafb8804fd64f5057272a3bbc10da686 100644 (file)
@@ -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 );
        }
index 50a9426d9c1c507df26566ea71a12fcf1f3e7207..6f924843b326ac96ff521f28336e0143f808bf6e 100644 (file)
@@ -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
        {
index 222d5bf6a4a5cb1a852b02077d372a125cbccd12..191f9948b7b17bbb69eafef5f6e08e8a6da4fa40 100644 (file)
@@ -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 );
index b5ee3a96843d4a2e7c103cc7b9b5ecc66cc8d3ad..11539cc3f745bdf35581ae5a7f908a81f5ba03cd 100644 (file)
@@ -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 );
index d6f8b2a70bf44ec998c12e450eaad383cc6370c5..bfc2d5f2c863eb3f99497f9ade446ea56de2454c 100644 (file)
@@ -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)