]> git.sesse.net Git - mlt/commitdiff
remove consumer_aspect_ratio property - use profile instead
authorDan Dennedy <dan@dennedy.org>
Thu, 1 Mar 2012 05:54:44 +0000 (21:54 -0800)
committerDan Dennedy <dan@dennedy.org>
Mon, 5 Mar 2012 07:08:07 +0000 (23:08 -0800)
12 files changed:
src/framework/mlt_consumer.c
src/framework/mlt_frame.c
src/framework/mlt_profile.c
src/framework/mlt_tractor.c
src/framework/mlt_transition.c
src/modules/core/filter_crop.c
src/modules/core/filter_watermark.c
src/modules/kdenlive/filter_freeze.c
src/modules/kdenlive/producer_framebuffer.c
src/modules/oldfilm/filter_dust.c
src/modules/plus/filter_affine.c
src/modules/plus/transition_affine.c

index a45ce47288d086ccbbb1930fafa97d8d9a476a62..9de633231da5f92169d220c7498712985305164e 100644 (file)
@@ -581,11 +581,9 @@ mlt_frame mlt_consumer_get_frame( mlt_consumer self )
                if ( test_card != NULL )
                        mlt_properties_set_data( frame_properties, "test_card_producer", test_card, 0, NULL, NULL );
 
-               // Attach the rescale property
+               // Pass along the interpolation and deinterlace options
+               // TODO: get rid of consumer_deinterlace and use profile.progressive
                mlt_properties_set( frame_properties, "rescale.interp", mlt_properties_get( properties, "rescale" ) );
-
-               // Aspect ratio and other jiggery pokery
-               mlt_properties_set_double( frame_properties, "consumer_aspect_ratio", mlt_properties_get_double( properties, "aspect_ratio" ) );
                mlt_properties_set_int( frame_properties, "consumer_deinterlace", mlt_properties_get_int( properties, "progressive" ) | mlt_properties_get_int( properties, "deinterlace" ) );
                mlt_properties_set( frame_properties, "deinterlace_method", mlt_properties_get( properties, "deinterlace_method" ) );
                mlt_properties_set_int( frame_properties, "consumer_tff", mlt_properties_get_int( properties, "top_field_first" ) );
index 6a3b6b36aa13b13f68f84e76a6b62fc47902f304..7d38d44e9f704fdf4db962cfaa0b0ac409cf924e 100644 (file)
@@ -483,7 +483,6 @@ int mlt_frame_get_image( mlt_frame self, uint8_t **buffer, mlt_image_format *for
                if ( test_frame )
                {
                        mlt_properties test_properties = MLT_FRAME_PROPERTIES( test_frame );
-                       mlt_properties_set_double( test_properties, "consumer_aspect_ratio", mlt_properties_get_double( properties, "consumer_aspect_ratio" ) );
                        mlt_properties_set( test_properties, "rescale.interp", mlt_properties_get( properties, "rescale.interp" ) );
                        mlt_frame_get_image( test_frame, buffer, format, width, height, writable );
                        mlt_properties_set_data( properties, "test_card_frame", test_frame, 0, ( mlt_destructor )mlt_frame_close, NULL );
index 66f76012aee88f0d89807078e78114230dc7247b..8766349f56cff877f3373ea2b04c6a2ad7ab1dc6 100644 (file)
@@ -406,7 +406,6 @@ void mlt_profile_from_producer( mlt_profile profile, mlt_producer producer )
 
        if ( ! mlt_service_get_frame( MLT_PRODUCER_SERVICE(producer), &fr, 0 ) && fr )
        {
-               mlt_properties_set_double( MLT_FRAME_PROPERTIES( fr ), "consumer_aspect_ratio", mlt_profile_sar( profile ) );
                if ( ! mlt_frame_get_image( fr, &buffer, &fmt, &w, &h, 0 ) )
                {
                        // Some source properties are not exposed until after the first get_image call.
index e2164586392e7dfa2dd016609b4c95fb37c19e65..97c6a172e604893859032936d4a20596a112791f 100644 (file)
@@ -267,7 +267,6 @@ static int producer_get_image( mlt_frame self, uint8_t **buffer, mlt_image_forma
        mlt_properties_set( frame_properties, "rescale.interp", mlt_properties_get( properties, "rescale.interp" ) );
        mlt_properties_set_int( frame_properties, "resize_alpha", mlt_properties_get_int( properties, "resize_alpha" ) );
        mlt_properties_set_int( frame_properties, "distort", mlt_properties_get_int( properties, "distort" ) );
-       mlt_properties_set_double( frame_properties, "consumer_aspect_ratio", mlt_properties_get_double( properties, "consumer_aspect_ratio" ) );
        mlt_properties_set_int( frame_properties, "consumer_deinterlace", mlt_properties_get_int( properties, "consumer_deinterlace" ) );
        mlt_properties_set( frame_properties, "deinterlace_method", mlt_properties_get( properties, "deinterlace_method" ) );
        mlt_properties_set_int( frame_properties, "consumer_tff", mlt_properties_get_int( properties, "consumer_tff" ) );
index 7657d6ec743fd1d736cc1be7abc5b052cd56795a..90eb774ef2389c584f27c624b8dc2e84e3865040 100644 (file)
@@ -311,6 +311,7 @@ mlt_frame mlt_transition_process( mlt_transition self, mlt_frame a_frame, mlt_fr
 
 static int get_image_a( mlt_frame a_frame, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable )
 {
+       mlt_transition self = mlt_frame_pop_service( a_frame );
        mlt_properties a_props = MLT_FRAME_PROPERTIES( a_frame );
 
        // All transitions get scaling
@@ -319,14 +320,15 @@ static int get_image_a( mlt_frame a_frame, uint8_t **image, mlt_image_format *fo
                mlt_properties_set( a_props, "rescale.interp", "nearest" );
 
        // Ensure sane aspect ratio
-       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_frame_get_aspect_ratio( a_frame ) == 0.0 )
+               mlt_frame_set_aspect_ratio( a_frame, mlt_profile_sar( mlt_service_profile( MLT_TRANSITION_SERVICE(self) ) ) );
 
        return mlt_frame_get_image( a_frame, image, format, width, height, writable );
 }
 
 static int get_image_b( mlt_frame b_frame, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable )
 {
+       mlt_transition self = mlt_frame_pop_service( b_frame );
        mlt_frame a_frame = mlt_frame_pop_frame( b_frame );
        mlt_properties a_props = MLT_FRAME_PROPERTIES( a_frame );
        mlt_properties b_props = MLT_FRAME_PROPERTIES( b_frame );
@@ -341,11 +343,11 @@ static int get_image_b( mlt_frame b_frame, uint8_t **image, mlt_image_format *fo
        }
 
        // Ensure sane 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 ( mlt_frame_get_aspect_ratio( b_frame ) == 0.0 )
+               mlt_frame_set_aspect_ratio( b_frame, mlt_profile_sar( mlt_service_profile( MLT_TRANSITION_SERVICE(self) ) ) );
 
        mlt_properties_pass_list( b_props, a_props,
-               "consumer_deinterlace, deinterlace_method, consumer_aspect_ratio, consumer_tff" );
+               "consumer_deinterlace, deinterlace_method, consumer_tff" );
 
        return mlt_frame_get_image( b_frame, image, format, width, height, writable );
 }
@@ -478,8 +480,10 @@ static int transition_get_frame( mlt_service service, mlt_frame_ptr frame, int i
                        if ( !( a_hide & type ) && !( b_hide & type ) )
                        {
                                // Add hooks for pre-processing frames
+                               mlt_frame_push_service( a_frame_ptr, self );
                                mlt_frame_push_get_image( a_frame_ptr, get_image_a );
                                mlt_frame_push_frame( b_frame_ptr, a_frame_ptr );
+                               mlt_frame_push_service( b_frame_ptr, self );
                                mlt_frame_push_get_image( b_frame_ptr, get_image_b );
 
                                // Process the transition
index e61ac906b1c73784a91ac683df65a354c2b22994..168f687b9b0d0ed80a1b7d7e0ae4d3c257569aaf 100644 (file)
@@ -174,7 +174,7 @@ static mlt_frame filter_process( mlt_filter filter, mlt_frame frame )
                {
                        double aspect_ratio = mlt_frame_get_aspect_ratio( frame );
                        if ( aspect_ratio == 0.0 )
-                               aspect_ratio = mlt_properties_get_double( frame_props, "consumer_aspect_ratio" );
+                               aspect_ratio = mlt_profile_sar( profile );
                        double input_ar = aspect_ratio * width / height;
                        double output_ar = mlt_profile_dar( mlt_service_profile( MLT_FILTER_SERVICE(filter) ) );
                        int bias = mlt_properties_get_int( filter_props, "center_bias" );
index 31e8e06933826a952fb2a370d346619391d894fe..b5adba315b159e22ad61d41b3d2a89167cc50f31 100644 (file)
@@ -143,17 +143,17 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format
                        // Get the a and b frame properties
                        mlt_properties a_props = MLT_FRAME_PROPERTIES( frame );
                        mlt_properties b_props = MLT_FRAME_PROPERTIES( b_frame );
+                       mlt_profile profile = mlt_service_profile( service );
 
                        // Set the b frame to be in the same position and have same consumer requirements
                        mlt_frame_set_position( b_frame, position );
-                       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_int( a_props, "consumer_deinterlace" ) || mlt_properties_get_int( properties, "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" ) );
+                               mlt_frame_set_aspect_ratio( b_frame, mlt_profile_sar( profile ) );
                        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_frame_set_aspect_ratio( frame, mlt_profile_sar( profile ) );
 
                        if ( mlt_properties_get_int( properties, "distort" ) )
                        {
index ceede0f9de71cd50e77aa9fdbc50418dd508fb9d..c040604d3173b1494ecf52cbad81d00c6ff62cee 100755 (executable)
@@ -68,7 +68,6 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format
                        mlt_service_get_frame( mlt_producer_service(producer), &freeze_frame, 0 );
 
                        mlt_properties freeze_properties = MLT_FRAME_PROPERTIES( freeze_frame );
-                       mlt_properties_set_double( freeze_properties, "consumer_aspect_ratio", mlt_properties_get_double( props, "consumer_aspect_ratio" ) );
                        mlt_properties_set( freeze_properties, "rescale.interp", mlt_properties_get( props, "rescale.interp" ) );
                        mlt_properties_set_double( freeze_properties, "aspect_ratio", mlt_frame_get_aspect_ratio( frame ) );
                        mlt_properties_set_int( freeze_properties, "progressive", mlt_properties_get_int( props, "progressive" ) );
index d41148ecaa50eff5fc413ff152ee83c08a0c9981..7df00cc5a8095d152cb7f4c4cc9706c45c34cca4 100644 (file)
@@ -152,7 +152,6 @@ static int framebuffer_get_image( mlt_frame frame, uint8_t **image, mlt_image_fo
         uint8_t *first_alpha = mlt_properties_get_data( first_frame_properties, "alpha", NULL );
        if ( !first_image )
        {
-               mlt_properties_set_double( first_frame_properties, "consumer_aspect_ratio", mlt_properties_get_double( frame_properties, "consumer_aspect_ratio" ) );
                mlt_properties_set( first_frame_properties, "rescale.interp", mlt_properties_get( frame_properties, "rescale.interp" ) );
 
                int error = mlt_frame_get_image( first_frame, &first_image, format, width, height, writable );
index b20f4391b990031d22db570895b23fea697df909..5a9673175eaa5c1a657bc094b86a899a23da4407 100644 (file)
@@ -123,7 +123,6 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *
                                
                                if ( mlt_service_get_frame( MLT_PRODUCER_SERVICE( producer ), &luma_frame, 0 ) == 0 ){
                
-                                       mlt_properties_set_double ( MLT_FRAME_PROPERTIES ( luma_frame ) , "consumer_aspect_ratio" , 1.0 );
                                        mlt_image_format luma_format = mlt_image_yuv422;
                                        luma_width = dx;
                                        luma_height = luma_width * mlt_properties_get_int( MLT_FRAME_PROPERTIES ( luma_frame ) , "height" ) / mlt_properties_get_int( MLT_FRAME_PROPERTIES ( luma_frame ) , "width" );
index a21b3d24b3ba9e761cb16e204480b1acc91734ca..d53bdd3cc61cb675039beb8c961681ed8744dca6 100644 (file)
@@ -48,18 +48,17 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *
                mlt_producer producer = mlt_properties_get_data( properties, "producer", NULL );
                mlt_transition transition = mlt_properties_get_data( properties, "transition", NULL );
                mlt_frame a_frame = NULL;
+               mlt_profile profile = mlt_service_profile( MLT_FILTER_SERVICE( filter ) );
 
                if ( producer == NULL )
                {
                        char *background = mlt_properties_get( properties, "background" );
-                       mlt_profile profile = mlt_service_profile( MLT_FILTER_SERVICE( filter ) );
                        producer = mlt_factory_producer( profile, NULL, background );
                        mlt_properties_set_data( properties, "producer", producer, 0, (mlt_destructor)mlt_producer_close, NULL );
                }
 
                if ( transition == NULL )
                {
-                       mlt_profile profile = mlt_service_profile( MLT_FILTER_SERVICE( filter ) );
                        transition = mlt_factory_transition( profile, "affine", NULL );
                        mlt_properties_set_data( properties, "transition", transition, 0, (mlt_destructor)mlt_transition_close, NULL );
                }
@@ -70,7 +69,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *
                        mlt_properties frame_properties = MLT_FRAME_PROPERTIES( this );
                        mlt_position in = mlt_filter_get_in( filter );
                        mlt_position out = mlt_filter_get_out( filter );
-                       double consumer_ar = mlt_properties_get_double( frame_properties, "consumer_aspect_ratio" );
+                       double consumer_ar = mlt_profile_sar( profile );
                        mlt_transition_set_in_and_out( transition, in, out );
                        if ( out > 0 ) {
                                mlt_properties_set_position( MLT_PRODUCER_PROPERTIES( producer ), "length", out - in + 1 );
@@ -85,11 +84,10 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *
 //                     mlt_properties_set_int( MLT_FRAME_PROPERTIES( a_frame ), "distort", 1 );
 
                        // 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 );
+                       if ( mlt_frame_get_aspect_ratio( this ) == 0 )
+                               mlt_frame_set_aspect_ratio( this, consumer_ar );
+                       if ( mlt_frame_get_aspect_ratio( a_frame ) == 0 )
+                               mlt_frame_set_aspect_ratio( a_frame, consumer_ar );
 
                        // Add the affine transition onto the frame stack
                        mlt_service_unlock( MLT_FILTER_SERVICE( filter ) );
index 80ae6e7cf86c9c876b2dea40db5dbd4185347155..cbac275889122e41f78b1b4d547e9a4bb57364c2 100644 (file)
@@ -397,7 +397,7 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
        int normalised_width = profile->width;
        int normalised_height = profile->height;
 
-       double consumer_ar = mlt_properties_get_double( a_props, "consumer_aspect_ratio" );
+       double consumer_ar = mlt_profile_sar( mlt_service_profile( MLT_TRANSITION_SERVICE(transition) ) );
 
        // Structures for geometry
        struct mlt_geometry_item_s result;