]> git.sesse.net Git - mlt/commitdiff
Multitrack rearrangement and tractor cleanup
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Tue, 5 Oct 2004 19:54:14 +0000 (19:54 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Tue, 5 Oct 2004 19:54:14 +0000 (19:54 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@464 d19143bc-622f-0410-bfdd-b5b2a6649095

src/framework/mlt_multitrack.c
src/framework/mlt_playlist.c
src/framework/mlt_producer.c
src/framework/mlt_tractor.c
src/inigo/inigo.c

index 5d99b3fa63832ecd6525c7f04ba68ad91173318d..50a9426d9c1c507df26566ea71a12fcf1f3e7207 100644 (file)
@@ -381,8 +381,6 @@ mlt_position mlt_multitrack_clip( mlt_multitrack this, mlt_whence whence, int in
        out of sync.
 
        See playlist logic too.
-
-       This is not as clean as it should be... 
 */
 
 static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int index )
@@ -393,28 +391,14 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int ind
        // Check if we have a track for this index
        if ( index < this->count && this->list[ index ] != NULL )
        {
-               // Determine the in point
-               int in = mlt_producer_is_cut( this->list[ index ]->producer ) ? mlt_producer_get_in( this->list[ index ]->producer ) : 0;
-
                // Get the producer for this track
-               mlt_producer producer = mlt_producer_cut_parent( this->list[ index ]->producer );
+               mlt_producer producer = this->list[ index ]->producer;
 
                // Obtain the current position
                mlt_position position = mlt_producer_frame( parent );
 
-               // Get the clone index
-               int clone_index = mlt_properties_get_int( mlt_producer_properties( this->list[ index ]->producer ), "_clone" );
-
-               // Additionally, check if we're supposed to use a clone here
-               if ( clone_index > 0 )
-               {
-                       char key[ 25 ];
-                       sprintf( key, "_clone.%d", clone_index - 1 );
-                       producer = mlt_properties_get_data( mlt_producer_properties( producer ), key, NULL );
-               }
-
                // Make sure we're at the same point
-               mlt_producer_seek( producer, in + position );
+               mlt_producer_seek( producer, position );
 
                // Get the frame from the producer
                mlt_service_get_frame( mlt_producer_service( producer ), frame, 0 );
index b59ee0d8639d74120bbfec03cd20934ace15f481..222d5bf6a4a5cb1a852b02077d372a125cbccd12 100644 (file)
@@ -765,7 +765,8 @@ int mlt_playlist_split( mlt_playlist this, int clip, mlt_position position )
        if ( error == 0 )
        {
                playlist_entry *entry = this->list[ clip ];
-               if ( position >= 0 && position < entry->frame_count )
+               position = position < 0 ? entry->frame_count + position - 1 : position;
+               if ( position >= 0 && position <= entry->frame_count )
                {
                        mlt_producer split = NULL;
                        int in = entry->frame_in;
@@ -804,6 +805,8 @@ 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 );
                }
index 98498c459214fa9ba778a2fa0c577f54a71660bb..89d81cd12586720af3142f3329dad9e93ba176d6 100644 (file)
@@ -442,10 +442,15 @@ 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" );
                        clone = clone == NULL ? this : clone;
                }
-               mlt_producer_seek( clone, mlt_properties_get_int( properties, "_position" ) );
-               result = producer_get_frame( mlt_producer_service( mlt_producer_cut_parent( clone ) ), frame, index );
+               else
+               {
+                       clone = mlt_producer_cut_parent( this );
+               }
+               mlt_producer_seek( clone, mlt_producer_get_in( this ) + mlt_properties_get_int( properties, "_position" ) );
+               result = producer_get_frame( mlt_producer_service( clone ), frame, index );
                double speed = mlt_producer_get_speed( this );
                mlt_properties_set_double( mlt_frame_properties( *frame ), "_speed", speed );
                mlt_producer_prepare_next( clone );
@@ -503,6 +508,9 @@ static mlt_producer mlt_producer_clone( mlt_producer this )
        if ( clone == NULL && resource != NULL )
                clone = mlt_factory_producer( "fezzik", resource );
 
+       if ( clone != NULL )
+               mlt_properties_inherit( mlt_producer_properties( clone ), properties );
+
        return clone;
 }
 
index 83f82f9771507dc6a1a688f9b8f34fbab47315f0..b5ee3a96843d4a2e7c103cc7b9b5ecc66cc8d3ad 100644 (file)
@@ -211,7 +211,14 @@ static int producer_get_image( mlt_frame this, uint8_t **buffer, mlt_image_forma
        uint8_t *data = NULL;
        mlt_properties properties = mlt_frame_properties( this );
        mlt_frame frame = mlt_frame_pop_service( this );
-       mlt_properties_inherit( mlt_frame_properties( frame ), properties );
+       mlt_properties frame_properties = mlt_frame_properties( frame );
+       mlt_properties_set_int( frame_properties, "width", mlt_properties_get_int( properties, "width" ) );
+       mlt_properties_set_int( frame_properties, "height", mlt_properties_get_int( properties, "height" ) );
+       mlt_properties_set( frame_properties, "rescale.interp", mlt_properties_get( properties, "rescale.interp" ) );
+       mlt_properties_set_double( frame_properties, "aspect_ratio", mlt_properties_get_double( properties, "aspect_ratio" ) );
+       mlt_properties_set_double( frame_properties, "consumer_aspect_ratio", mlt_properties_get_double( properties, "consumer_aspect_ratio" ) );
+       mlt_properties_set_int( frame_properties, "consumer_progressive", mlt_properties_get_double( properties, "consumer_progressive" ) );
+       mlt_properties_set_int( frame_properties, "consumer_deinterlace", mlt_properties_get_double( properties, "consumer_deinterlace" ) );
        mlt_frame_get_image( frame, buffer, format, width, height, writable );
        mlt_properties_set_data( properties, "image", *buffer, *width * *height * 2, NULL, NULL );
        mlt_properties_set_int( properties, "width", *width );
@@ -227,7 +234,6 @@ static int producer_get_audio( mlt_frame this, int16_t **buffer, mlt_audio_forma
 {
        mlt_properties properties = mlt_frame_properties( this );
        mlt_frame frame = mlt_frame_pop_audio( this );
-       mlt_properties_inherit( mlt_frame_properties( frame ), properties );
        mlt_frame_get_audio( frame, buffer, format, frequency, channels, samples );
        mlt_properties_set_data( properties, "audio", *buffer, 0, NULL, NULL );
        mlt_properties_set_int( properties, "frequency", *frequency );
@@ -318,15 +324,17 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra
                        {
                                mlt_frame_push_audio( *frame, audio );
                                ( *frame )->get_audio = producer_get_audio;
-                               mlt_properties_inherit( mlt_frame_properties( *frame ), mlt_frame_properties( audio ) );
                        }
 
                        if ( video != NULL )
                        {
-                               mlt_properties_set_data( mlt_frame_properties( *frame ), "data_queue", data_queue, 0, NULL, NULL );
+                               mlt_properties video_properties = mlt_frame_properties( video );
                                mlt_frame_push_service( *frame, video );
                                mlt_frame_push_service( *frame, producer_get_image );
-                               mlt_properties_inherit( mlt_frame_properties( *frame ), mlt_frame_properties( video ) );
+                               mlt_properties_set_data( frame_properties, "data_queue", data_queue, 0, NULL, NULL );
+                               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_int( mlt_frame_properties( *frame ), "test_audio", audio == NULL );
index b29df7030da9f7924c0a70bdb4f3534accf34dcd..e39b21d48080346f10ce5e5879170ed77a10e9ce 100644 (file)
@@ -144,33 +144,38 @@ static mlt_consumer create_consumer( char *id, mlt_producer producer )
 static void transport( mlt_producer producer, mlt_consumer consumer )
 {
        mlt_properties properties = mlt_producer_properties( producer );
+       int silent = mlt_properties_get_int( mlt_consumer_properties( consumer ), "silent" );
 
        term_init( );
 
        if ( mlt_properties_get_int( properties, "done" ) == 0 && !mlt_consumer_is_stopped( consumer ) )
        {
-               fprintf( stderr, "+-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+\n" );
-               fprintf( stderr, "|1=-10| |2= -5| |3= -2| |4= -1| |5=  0| |6=  1| |7=  2| |8=  5| |9= 10|\n" );
-               fprintf( stderr, "+-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+\n" );
-
-               fprintf( stderr, "+---------------------------------------------------------------------+\n" );
-               fprintf( stderr, "|               H = back 1 minute,  L = forward 1 minute              |\n" );
-               fprintf( stderr, "|                 h = previous frame,  l = next frame                 |\n" );
-               fprintf( stderr, "|           g = start of clip, j = next clip, k = previous clip       |\n" );
-               fprintf( stderr, "|                0 = restart, q = quit, space = play                  |\n" );
-               fprintf( stderr, "+---------------------------------------------------------------------+\n" );
+               if ( !silent )
+               {
+                       fprintf( stderr, "+-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+\n" );
+                       fprintf( stderr, "|1=-10| |2= -5| |3= -2| |4= -1| |5=  0| |6=  1| |7=  2| |8=  5| |9= 10|\n" );
+                       fprintf( stderr, "+-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+\n" );
+
+                       fprintf( stderr, "+---------------------------------------------------------------------+\n" );
+                       fprintf( stderr, "|               H = back 1 minute,  L = forward 1 minute              |\n" );
+                       fprintf( stderr, "|                 h = previous frame,  l = next frame                 |\n" );
+                       fprintf( stderr, "|           g = start of clip, j = next clip, k = previous clip       |\n" );
+                       fprintf( stderr, "|                0 = restart, q = quit, space = play                  |\n" );
+                       fprintf( stderr, "+---------------------------------------------------------------------+\n" );
+               }
 
                while( mlt_properties_get_int( properties, "done" ) == 0 && !mlt_consumer_is_stopped( consumer ) )
                {
                        int value = term_read( );
                        if ( value != -1 )
                                transport_action( producer, ( char * )&value );
-       
-                       if ( mlt_properties_get_int( properties, "stats_off" ) == 0 )
+
+                       if ( !silent && mlt_properties_get_int( properties, "stats_off" ) == 0 )
                                fprintf( stderr, "Current Position: %10d\r", mlt_producer_position( producer ) );
                }
 
-               fprintf( stderr, "\n" );
+               if ( !silent )
+                       fprintf( stderr, "\n" );
        }
 }