]> git.sesse.net Git - mlt/commitdiff
src/framework/mlt_consumer.c
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 22 Jun 2005 07:29:27 +0000 (07:29 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 22 Jun 2005 07:29:27 +0000 (07:29 +0000)
+ Attempt to make all frames have the correct aspect_ratio (works in many but not all cases)

src/framework/mlt_frame.h
+ Provide macro access to the video and image RPN queues

src/framework/mlt_tractor.c
+ Provides orphaned filters

src/modules/core/producer_noise.c
- remove specification of aspect ratio

src/modules/core/filter_watermark.c
src/modules/core/transition_composite.c
src/modules/core/transition_luma.c
src/modules/plus/filter_affine.c
src/modules/plus/transition_affine.c
+ Corrections for frames with an aspect ratio = 0 (supplement to mlt_consumer mod)

git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@737 d19143bc-622f-0410-bfdd-b5b2a6649095

src/framework/mlt_frame.h
src/framework/mlt_tractor.c
src/modules/core/filter_watermark.c
src/modules/core/producer_noise.c
src/modules/core/transition_composite.c
src/modules/core/transition_luma.c
src/modules/plus/filter_affine.c
src/modules/plus/transition_affine.c

index 77ca012c1012ec93d680360baf2f144e07d57044..f81a453a1e0d3b99f40013494bc639373d545453 100644 (file)
@@ -43,6 +43,8 @@ struct mlt_frame_s
 
 #define MLT_FRAME_PROPERTIES( frame )          ( &( frame )->parent )
 #define MLT_FRAME_SERVICE_STACK( frame )       ( ( frame )->stack_service )
+#define MLT_FRAME_IMAGE_STACK( frame )         ( ( frame )->stack_image )
+#define MLT_FRAME_AUDIO_STACK( frame )         ( ( frame )->stack_audio )
 
 extern mlt_frame mlt_frame_init( );
 extern mlt_properties mlt_frame_properties( mlt_frame self );
index 9a1f32e11b092a5107281350f27c2200f9ebe439..8de038be735459d537cdc92493a1e3f3137a26ba 100644 (file)
@@ -323,6 +323,29 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra
                                // Check for last track
                                done = mlt_properties_get_int( temp_properties, "last_track" );
 
+                               // Handle fx only tracks
+                               if ( mlt_properties_get_int( temp_properties, "meta.fx_cut" ) )
+                               {
+                                       // Take all but the first placeholding producer and dump on to the image stack
+                                       if ( video )
+                                       {
+                                               void *p = mlt_deque_pop_front( MLT_FRAME_IMAGE_STACK( temp ) );
+                                               while ( ( p = mlt_deque_pop_front( MLT_FRAME_IMAGE_STACK( temp ) ) ) != NULL )
+                                                       mlt_deque_push_back( MLT_FRAME_IMAGE_STACK( video ), p );
+                                       }
+
+                                       // Take all but the first placeholding producer and dump on to the audio stack
+                                       if ( audio )
+                                       {
+                                               void *p = mlt_deque_pop_front( MLT_FRAME_AUDIO_STACK( temp ) );
+                                               while ( ( p = mlt_deque_pop_front( MLT_FRAME_AUDIO_STACK( temp ) ) ) != NULL )
+                                                       mlt_deque_push_back( MLT_FRAME_AUDIO_STACK( audio ), p );
+                                       }
+
+                                       // Ensure everything is hidden
+                                       mlt_properties_set_int( temp_properties, "hide", 3 );
+                               }
+
                                // 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 );
index bfd491ee64f9225af40a3e52ec5e4d82b1f045b6..51181d71eb76142c72489f1f995e48f378ab3cb8 100644 (file)
@@ -144,6 +144,12 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format
                        mlt_properties_set_double( b_props, "consumer_aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) );
                        mlt_properties_set_int( b_props, "consumer_deinterlace", mlt_properties_get_double( a_props, "consumer_deinterlace" ) );
 
+                       // Check for the special case - no aspect ratio means no problem :-)
+                       if ( mlt_frame_get_aspect_ratio( b_frame ) == 0 )
+                               mlt_properties_set_double( b_props, "aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) );
+                       if ( mlt_frame_get_aspect_ratio( frame ) == 0 )
+                               mlt_properties_set_double( a_props, "aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) );
+
                        mlt_properties_set_int( b_props, "normalised_width", mlt_properties_get_int( a_props, "normalised_width" ) );
                        mlt_properties_set_int( b_props, "normalised_height", mlt_properties_get_int( a_props, "normalised_height" ) );
 
index 1b71cda49638c967fb1d07712447c872107e812c..257f0a2c7db20b05e200df739e58c06b762a73e1 100644 (file)
@@ -55,11 +55,6 @@ mlt_producer producer_noise_init( void *arg )
        // Initialise the producer
        if ( this != NULL )
        {
-               int is_pal = mlt_properties_get_int( MLT_PRODUCER_PROPERTIES( this ), "normalised_height" ) == 576;
-
-               // Synthetic - aspect ratio of 1
-               mlt_properties_set_double( MLT_PRODUCER_PROPERTIES( this ), "aspect_ratio", is_pal ? 59.0/54.0 : 10.0/11.0 );
-
                // Callback registration
                this->get_frame = producer_get_frame;
                this->close = ( mlt_destructor )producer_close;
index 5c3e7afd1a3b1b16819ea08c557a4cacc7d146c4..5e5118b05aad1aecd341d13670f22b97c99f83ab 100644 (file)
@@ -710,6 +710,7 @@ static int get_b_frame_image( mlt_transition this, mlt_frame b_frame, uint8_t **
                int real_height = get_value( b_props, "real_height", "height" );
                double input_ar = mlt_frame_get_aspect_ratio( b_frame );
                double output_ar = mlt_properties_get_double( b_props, "consumer_aspect_ratio" );
+               if ( input_ar == 0.0 ) input_ar = output_ar;
                int scaled_width = input_ar / output_ar * real_width;
                int scaled_height = real_height;
                        
index 11c334c087169586c46142bf64463d7dfc0fae0c..ebdc82cf15a159607acd858e9dd8ebce69aad619 100644 (file)
@@ -486,6 +486,10 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
 
        // Since we are the consumer of the b_frame, we must pass along this
        // consumer property from the a_frame
+       if ( mlt_properties_get_double( a_props, "aspect_ratio" ) == 0.0 )
+               mlt_properties_set_double( a_props, "aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) );
+       if ( mlt_properties_get_double( b_props, "aspect_ratio" ) == 0.0 )
+               mlt_properties_set_double( b_props, "aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) );
        if ( !strcmp( mlt_properties_get( a_props, "rescale.interp" ), "none" ) )
                mlt_properties_set_double( b_props, "consumer_aspect_ratio", mlt_properties_get_double( a_props, "aspect_ratio" ) );
        else
index e465a35165f7f61cabd7b47c5ed2cf1dc7c5bc8d..0fa4a86c5a99babf2db8dd7904bd24bd782e011f 100644 (file)
@@ -65,6 +65,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *
                        char *name = mlt_properties_get( properties, "_unique_id" );
                        mlt_position position = mlt_properties_get_position( MLT_FRAME_PROPERTIES( this ), name );
                        mlt_properties frame_properties = MLT_FRAME_PROPERTIES( this );
+                       double consumer_ar = mlt_properties_get_double( frame_properties, "consumer_aspect_ratio" );
                        mlt_properties_set_position( MLT_TRANSITION_PROPERTIES( transition ), "in", mlt_filter_get_in( filter ) );
                        mlt_properties_set_position( MLT_TRANSITION_PROPERTIES( transition ), "out", mlt_filter_get_out( filter ) );
                        mlt_producer_seek( producer, position );
@@ -74,8 +75,14 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *
                        mlt_service_get_frame( MLT_PRODUCER_SERVICE( producer ), &a_frame, 0 );
                        mlt_properties_set( MLT_FRAME_PROPERTIES( a_frame ), "rescale.interp", "nearest" );
                        mlt_properties_set_int( MLT_FRAME_PROPERTIES( a_frame ), "distort", 1 );
-                       mlt_properties_set_double( MLT_FRAME_PROPERTIES( a_frame ), "consumer_aspect_ratio", 
-                                                                          mlt_properties_get_double( frame_properties, "consumer_aspect_ratio" ) );
+
+                       // Special case - aspect_ratio = 0
+                       if ( mlt_properties_get_double( frame_properties, "aspect_ratio" ) == 0 )
+                               mlt_properties_set_double( frame_properties, "aspect_ratio", consumer_ar );
+                       if ( mlt_properties_get_double( MLT_FRAME_PROPERTIES( a_frame ), "aspect_ratio" ) == 0 )
+                               mlt_properties_set_double( MLT_FRAME_PROPERTIES( a_frame ), "aspect_ratio", consumer_ar );
+                       mlt_properties_set_double( MLT_FRAME_PROPERTIES( a_frame ), "consumer_aspect_ratio", consumer_ar );
+
                        mlt_transition_process( transition, a_frame, this );
                        mlt_frame_get_image( a_frame, image, format, width, height, writable );
                        mlt_properties_set_data( frame_properties, "affine_frame", a_frame, 0, (mlt_destructor)mlt_frame_close, NULL );
index 186ad8b29afc5641e4c3188565f2fadc4f7850e2..83d1cdefece7ce324e25f5632985f135541be3fd 100644 (file)
@@ -392,6 +392,8 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
        int normalised_width = mlt_properties_get_int( a_props, "normalised_width" );
        int normalised_height = mlt_properties_get_int( a_props, "normalised_height" );
 
+       double consumer_ar = mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) ;
+
        // Structures for geometry
        struct mlt_geometry_item_s result;
 
@@ -414,15 +416,18 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
        b_width = result.w;
        b_height = result.h;
 
+       if ( mlt_properties_get_double( b_props, "aspect_ratio" ) == 0.0 )
+               mlt_properties_set_double( b_props, "aspect_ratio", consumer_ar );
+
        if ( !strcmp( mlt_properties_get( a_props, "rescale.interp" ), "none" ) )
        {
                mlt_properties_set( b_props, "rescale.interp", "nearest" );
-               mlt_properties_set_double( b_props, "consumer_aspect_ratio", mlt_properties_get_double( a_props, "aspect_ratio" ) );
+               mlt_properties_set_double( b_props, "consumer_aspect_ratio", consumer_ar );
        }
        else
        {
                mlt_properties_set( b_props, "rescale.interp", mlt_properties_get( a_props, "rescale.interp" ) );
-               mlt_properties_set_double( b_props, "consumer_aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) );
+               mlt_properties_set_double( b_props, "consumer_aspect_ratio", consumer_ar );
        }
 
        mlt_properties_set_int( b_props, "distort", mlt_properties_get_int( properties, "distort" ) );