]> git.sesse.net Git - mlt/commitdiff
some temporary fixes
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 14 Jan 2004 19:32:35 +0000 (19:32 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 14 Jan 2004 19:32:35 +0000 (19:32 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@78 d19143bc-622f-0410-bfdd-b5b2a6649095

12 files changed:
mlt/src/framework/mlt_frame.c
mlt/src/framework/mlt_frame.h
mlt/src/framework/mlt_tractor.c
mlt/src/modules/core/transition_luma.c
mlt/src/modules/dv/consumer_libdv.c
mlt/src/modules/ffmpeg/producer_ffmpeg.c
src/framework/mlt_frame.c
src/framework/mlt_frame.h
src/framework/mlt_tractor.c
src/modules/core/transition_luma.c
src/modules/dv/consumer_libdv.c
src/modules/ffmpeg/producer_ffmpeg.c

index f2fad14caaca6f9cde5849f2e7a0949e962a3579..1c36cf0d66f3df84d3a810e88d6bb54494eff10c 100644 (file)
@@ -77,7 +77,15 @@ mlt_properties mlt_frame_properties( mlt_frame this )
 
 int mlt_frame_is_test_card( mlt_frame this )
 {
-       return this->stack_get_image_size == 0;
+       return ( this->stack_get_image_size == 0 && mlt_properties_get_data( mlt_frame_properties( this ), "image", NULL ) == NULL );
+}
+
+/** Check if we have a way to derive something than test audio.
+*/
+
+int mlt_frame_is_test_audio( mlt_frame this )
+{
+       return this->get_audio == NULL;
 }
 
 /** Get the aspect ratio of the frame.
index 58476d546d1816c621a7152a44575b567ca582d2..5ece49c92a55e24cd446ffd79fb95a7e5ec85cbc 100644 (file)
@@ -68,6 +68,7 @@ struct mlt_frame_s
 extern mlt_frame mlt_frame_init( );
 extern mlt_properties mlt_frame_properties( mlt_frame this );
 extern int mlt_frame_is_test_card( mlt_frame this );
+extern int mlt_frame_is_test_audio( mlt_frame this );
 extern double mlt_frame_get_aspect_ratio( mlt_frame this );
 extern int mlt_frame_set_aspect_ratio( mlt_frame this, double value );
 extern mlt_position mlt_frame_get_position( mlt_frame this );
index 6c02230f2548e5a9d4cf79ae141f3086ba0b112e..8d6247d40d1ca2c76ee1f33586bb0c104d3444a2 100644 (file)
@@ -118,7 +118,7 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra
                int i = 0;
                int looking = 1;
                int done = 0;
-               mlt_frame temp;
+               mlt_frame temp = NULL;
 
                // Get the properties of the parent producer
                mlt_properties properties = mlt_producer_properties( parent );
@@ -154,7 +154,13 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra
                                // Use this as output if we don't have one already
                                *frame = temp;
                        }
-                       else if ( !mlt_frame_is_test_card( temp ) && looking )
+                       else if ( ( !mlt_frame_is_test_card( temp ) || !mlt_frame_is_test_audio( temp ) ) && 
+                                           mlt_producer_frame( parent ) == mlt_properties_get_position( mlt_frame_properties( temp ), "position" ) )
+                       {
+                               *frame = temp;
+                               looking = 0;
+                       }
+                       else if ( ( !mlt_frame_is_test_card( temp ) || !mlt_frame_is_test_audio( temp ) ) && looking )
                        {
                                // This is the one we want and we can stop looking
                                *frame = temp;
index 71c823805092b1b6d77fb49c951bf1ee2e80eeff..fc712eaa0c15f22839536cb605b3cd0e0a203dce 100644 (file)
@@ -342,7 +342,7 @@ static mlt_frame transition_process( mlt_transition transition, mlt_frame a_fram
        mlt_position in = mlt_transition_get_in( transition );
        mlt_position out = mlt_transition_get_out( transition );
        mlt_position time = mlt_frame_get_position( b_frame );
-       double pos = ( time - in ) / ( out - in );
+       double pos = ( (double)time - (double)in ) / ( (double)out - (double)in + 1 );
        
        // Set the b frame properties
        mlt_properties_set_double( b_props, "mix", pos );
index fa1a3260fb41759ab1b768c59736de8a307c8ddc..8735ed8c7f31bc0bc055567ff7f1ee22e607243d 100644 (file)
@@ -140,6 +140,9 @@ static int consumer_encode_video( mlt_consumer this, uint8_t *dv_frame, mlt_fram
        // This will hold the size of the dv frame
        int size = 0;
 
+       // determine if this a test card
+       int is_test = mlt_frame_is_test_card( frame );
+
        // If we get an encoder, then encode the image
        if ( encoder != NULL )
        {
@@ -168,10 +171,13 @@ static int consumer_encode_video( mlt_consumer this, uint8_t *dv_frame, mlt_fram
                }
 
                // Process the frame
-               if ( size != 0 )
+               if ( size != 0 && !( mlt_properties_get_int( this_properties, "was_test_card" ) && is_test ) )
                {
                        // Encode the image
                        dv_encode_full_frame( encoder, &image, e_dv_color_yuv, dv_frame );
+
+                       // Note test card status
+                       mlt_properties_set_int( this_properties, "was_test_card", is_test );
                }
        }
        
index 43b8a2e2ec3b18c787a1077381c8435b811b2d3c..15b1c89ec5c0698f67e2304e507f8c6d75c30a69 100644 (file)
@@ -489,7 +489,6 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i
 
                // Push the image callback
                mlt_frame_push_get_image( *frame, producer_get_image );
-
        }
        else
        {
@@ -505,28 +504,24 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i
                }
 
                // Push the image callback
-               mlt_frame_push_get_image( *frame, producer_get_image );
+               if ( !this->end_of_video )
+                       mlt_frame_push_get_image( *frame, producer_get_image );
        }
 
        // Set the audio pipe
        mlt_properties_set_data( properties, "producer_ffmpeg", this, 0, NULL, NULL );
 
        // Hmm - register audio callback
-       ( *frame )->get_audio = producer_get_audio;
+       if ( !this->end_of_audio )
+               ( *frame )->get_audio = producer_get_audio;
 
        // Get the additional properties
        double aspect_ratio = mlt_properties_get_double( producer_properties, "aspect_ratio" );
        double speed = mlt_properties_get_double( producer_properties, "speed" );
-       char *video_file = mlt_properties_get( producer_properties, "video_file" );
 
        // Set them on the frame
        mlt_properties_set_double( properties, "aspect_ratio", aspect_ratio );
        mlt_properties_set_double( properties, "speed", speed );
-       if ( strchr( video_file, '/' ) != NULL )
-               mlt_properties_set( properties, "file", strrchr( video_file, '/' ) + 1 );
-       else
-               mlt_properties_set( properties, "file", video_file );
-
 
        // Set the out point on the producer
        if ( this->end_of_video && this->end_of_audio )
index f2fad14caaca6f9cde5849f2e7a0949e962a3579..1c36cf0d66f3df84d3a810e88d6bb54494eff10c 100644 (file)
@@ -77,7 +77,15 @@ mlt_properties mlt_frame_properties( mlt_frame this )
 
 int mlt_frame_is_test_card( mlt_frame this )
 {
-       return this->stack_get_image_size == 0;
+       return ( this->stack_get_image_size == 0 && mlt_properties_get_data( mlt_frame_properties( this ), "image", NULL ) == NULL );
+}
+
+/** Check if we have a way to derive something than test audio.
+*/
+
+int mlt_frame_is_test_audio( mlt_frame this )
+{
+       return this->get_audio == NULL;
 }
 
 /** Get the aspect ratio of the frame.
index 58476d546d1816c621a7152a44575b567ca582d2..5ece49c92a55e24cd446ffd79fb95a7e5ec85cbc 100644 (file)
@@ -68,6 +68,7 @@ struct mlt_frame_s
 extern mlt_frame mlt_frame_init( );
 extern mlt_properties mlt_frame_properties( mlt_frame this );
 extern int mlt_frame_is_test_card( mlt_frame this );
+extern int mlt_frame_is_test_audio( mlt_frame this );
 extern double mlt_frame_get_aspect_ratio( mlt_frame this );
 extern int mlt_frame_set_aspect_ratio( mlt_frame this, double value );
 extern mlt_position mlt_frame_get_position( mlt_frame this );
index 6c02230f2548e5a9d4cf79ae141f3086ba0b112e..8d6247d40d1ca2c76ee1f33586bb0c104d3444a2 100644 (file)
@@ -118,7 +118,7 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra
                int i = 0;
                int looking = 1;
                int done = 0;
-               mlt_frame temp;
+               mlt_frame temp = NULL;
 
                // Get the properties of the parent producer
                mlt_properties properties = mlt_producer_properties( parent );
@@ -154,7 +154,13 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra
                                // Use this as output if we don't have one already
                                *frame = temp;
                        }
-                       else if ( !mlt_frame_is_test_card( temp ) && looking )
+                       else if ( ( !mlt_frame_is_test_card( temp ) || !mlt_frame_is_test_audio( temp ) ) && 
+                                           mlt_producer_frame( parent ) == mlt_properties_get_position( mlt_frame_properties( temp ), "position" ) )
+                       {
+                               *frame = temp;
+                               looking = 0;
+                       }
+                       else if ( ( !mlt_frame_is_test_card( temp ) || !mlt_frame_is_test_audio( temp ) ) && looking )
                        {
                                // This is the one we want and we can stop looking
                                *frame = temp;
index 71c823805092b1b6d77fb49c951bf1ee2e80eeff..fc712eaa0c15f22839536cb605b3cd0e0a203dce 100644 (file)
@@ -342,7 +342,7 @@ static mlt_frame transition_process( mlt_transition transition, mlt_frame a_fram
        mlt_position in = mlt_transition_get_in( transition );
        mlt_position out = mlt_transition_get_out( transition );
        mlt_position time = mlt_frame_get_position( b_frame );
-       double pos = ( time - in ) / ( out - in );
+       double pos = ( (double)time - (double)in ) / ( (double)out - (double)in + 1 );
        
        // Set the b frame properties
        mlt_properties_set_double( b_props, "mix", pos );
index fa1a3260fb41759ab1b768c59736de8a307c8ddc..8735ed8c7f31bc0bc055567ff7f1ee22e607243d 100644 (file)
@@ -140,6 +140,9 @@ static int consumer_encode_video( mlt_consumer this, uint8_t *dv_frame, mlt_fram
        // This will hold the size of the dv frame
        int size = 0;
 
+       // determine if this a test card
+       int is_test = mlt_frame_is_test_card( frame );
+
        // If we get an encoder, then encode the image
        if ( encoder != NULL )
        {
@@ -168,10 +171,13 @@ static int consumer_encode_video( mlt_consumer this, uint8_t *dv_frame, mlt_fram
                }
 
                // Process the frame
-               if ( size != 0 )
+               if ( size != 0 && !( mlt_properties_get_int( this_properties, "was_test_card" ) && is_test ) )
                {
                        // Encode the image
                        dv_encode_full_frame( encoder, &image, e_dv_color_yuv, dv_frame );
+
+                       // Note test card status
+                       mlt_properties_set_int( this_properties, "was_test_card", is_test );
                }
        }
        
index 43b8a2e2ec3b18c787a1077381c8435b811b2d3c..15b1c89ec5c0698f67e2304e507f8c6d75c30a69 100644 (file)
@@ -489,7 +489,6 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i
 
                // Push the image callback
                mlt_frame_push_get_image( *frame, producer_get_image );
-
        }
        else
        {
@@ -505,28 +504,24 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i
                }
 
                // Push the image callback
-               mlt_frame_push_get_image( *frame, producer_get_image );
+               if ( !this->end_of_video )
+                       mlt_frame_push_get_image( *frame, producer_get_image );
        }
 
        // Set the audio pipe
        mlt_properties_set_data( properties, "producer_ffmpeg", this, 0, NULL, NULL );
 
        // Hmm - register audio callback
-       ( *frame )->get_audio = producer_get_audio;
+       if ( !this->end_of_audio )
+               ( *frame )->get_audio = producer_get_audio;
 
        // Get the additional properties
        double aspect_ratio = mlt_properties_get_double( producer_properties, "aspect_ratio" );
        double speed = mlt_properties_get_double( producer_properties, "speed" );
-       char *video_file = mlt_properties_get( producer_properties, "video_file" );
 
        // Set them on the frame
        mlt_properties_set_double( properties, "aspect_ratio", aspect_ratio );
        mlt_properties_set_double( properties, "speed", speed );
-       if ( strchr( video_file, '/' ) != NULL )
-               mlt_properties_set( properties, "file", strrchr( video_file, '/' ) + 1 );
-       else
-               mlt_properties_set( properties, "file", video_file );
-
 
        // Set the out point on the producer
        if ( this->end_of_video && this->end_of_audio )