]> git.sesse.net Git - mlt/commitdiff
remove usage of normalised_width and _height properties from services
authorDan Dennedy <dan@dennedy.org>
Thu, 1 Mar 2012 04:06:20 +0000 (20:06 -0800)
committerDan Dennedy <dan@dennedy.org>
Mon, 5 Mar 2012 07:08:07 +0000 (23:08 -0800)
src/modules/core/filter_crop.c
src/modules/core/filter_obscure.c
src/modules/core/filter_rescale.c
src/modules/core/filter_resize.c
src/modules/core/filter_watermark.c
src/modules/core/transition_composite.c
src/modules/plus/filter_affine.c
src/modules/plus/transition_affine.c

index 93cf3cde83a7827850310c68f4f01ada09664151..e61ac906b1c73784a91ac683df65a354c2b22994 100644 (file)
@@ -49,6 +49,7 @@ static void crop( uint8_t *src, uint8_t *dest, int bpp, int width, int height, i
 static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable )
 {
        int error = 0;
+       mlt_profile profile = mlt_frame_pop_service( frame );
 
        // Get the properties from the frame
        mlt_properties properties = MLT_FRAME_PROPERTIES( frame );
@@ -56,8 +57,8 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format
        // Correct Width/height if necessary
        if ( *width == 0 || *height == 0 )
        {
-               *width  = mlt_properties_get_int( properties, "normalised_width" );
-               *height = mlt_properties_get_int( properties, "normalised_height" );
+               *width  = profile->width;
+               *height = profile->height;
        }
 
        int left    = mlt_properties_get_int( properties, "crop.left" );
@@ -146,6 +147,7 @@ static mlt_frame filter_process( mlt_filter filter, mlt_frame frame )
        if ( mlt_properties_get_int( MLT_FILTER_PROPERTIES( filter ), "active" ) )
        {
                // Push the get_image method on to the stack
+               mlt_frame_push_service( frame, mlt_service_profile( MLT_FILTER_SERVICE( filter ) ) );
                mlt_frame_push_get_image( frame, filter_get_image );
        }
        else
index 5ae5b7a45be8019414bc79d33d6f11e2ed3138da..eeff9b6a3a27de607717f2aec0c20e48b3e335e3 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <framework/mlt_filter.h>
 #include <framework/mlt_frame.h>
+#include <framework/mlt_profile.h>
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -213,9 +214,6 @@ static void obscure_render( uint8_t *image, int width, int height, struct geomet
 
 static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable )
 {
-       // Get the frame properties
-       mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame );
-
        // Pop the top of stack now
        mlt_filter filter = mlt_frame_pop_service( frame );
 
@@ -230,10 +228,7 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format
                {
                        // Get the filter properties
                        mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
-
-                       // Obtain the normalised width and height from the frame
-                       int normalised_width = mlt_properties_get_int( frame_properties, "normalised_width" );
-                       int normalised_height = mlt_properties_get_int( frame_properties, "normalised_height" );
+                       mlt_profile profile = mlt_service_profile( MLT_FILTER_SERVICE( filter ) );
 
                        // Structures for geometry
                        struct geometry_s result;
@@ -244,8 +239,8 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format
                        float position = mlt_filter_get_progress( filter, frame );
 
                        // Now parse the geometries
-                       geometry_parse( &start, NULL, mlt_properties_get( properties, "start" ), normalised_width, normalised_height );
-                       geometry_parse( &end, &start, mlt_properties_get( properties, "end" ), normalised_width, normalised_height );
+                       geometry_parse( &start, NULL, mlt_properties_get( properties, "start" ), profile->width, profile->height );
+                       geometry_parse( &end, &start, mlt_properties_get( properties, "end" ), profile->width, profile->height );
 
                        // Do the calculation
                        geometry_calculate( &result, &start, &end, position, *width, *height );
index c1e8b6cb513674a43106b075986128c038700783..0f9bb9701770f4e1b58feffeef200c93c03e4888 100644 (file)
@@ -21,6 +21,7 @@
 #include <framework/mlt_filter.h>
 #include <framework/mlt_frame.h>
 #include <framework/mlt_log.h>
+#include <framework/mlt_profile.h>
 
 #include <stdio.h>
 #include <string.h>
@@ -160,8 +161,9 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format
        // Correct Width/height if necessary
        if ( *width == 0 || *height == 0 )
        {
-               *width = mlt_properties_get_int( properties, "normalised_width" );
-               *height = mlt_properties_get_int( properties, "normalised_height" );
+               mlt_profile profile = mlt_service_profile( MLT_FILTER_SERVICE( filter ) );
+               *width = profile->width;
+               *height = profile->height;
        }
 
        // There can be problems with small images - avoid them (by hacking - gah)
index fbbac56dc00520fd765b926dfc5b19ff5d627a6e..84c91f74f8e9f5d2ceef95c95b9ffe36c44f27bd 100644 (file)
@@ -178,6 +178,7 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format
 
        // Pop the top of stack now
        mlt_filter filter = mlt_frame_pop_service( frame );
+       mlt_profile profile = mlt_service_profile( MLT_FILTER_SERVICE( filter ) );
 
        // Retrieve the aspect ratio
        double aspect_ratio = mlt_deque_pop_back_double( MLT_FRAME_IMAGE_STACK( frame ) );
@@ -186,8 +187,8 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format
        // Correct Width/height if necessary
        if ( *width == 0 || *height == 0 )
        {
-               *width = mlt_properties_get_int( properties, "normalised_width" );
-               *height = mlt_properties_get_int( properties, "normalised_height" );
+               *width = profile->width;
+               *height = profile->height;
        }
 
        // Assign requested width/height from our subordinate
@@ -209,8 +210,8 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format
        if ( mlt_properties_get_int( properties, "distort" ) == 0 )
        {
                // Normalise the input and out display aspect
-               int normalised_width = mlt_properties_get_int( properties, "normalised_width" );
-               int normalised_height = mlt_properties_get_int( properties, "normalised_height" );
+               int normalised_width = profile->width;
+               int normalised_height = profile->height;
                int real_width = mlt_properties_get_int( properties, "real_width" );
                int real_height = mlt_properties_get_int( properties, "real_height" );
                if ( real_width == 0 )
index 54a4693c8921eb92377945bcd3c414a9ed756978..217a3bec3b9dba45e99f9ef54c9d6ce4b7761a3a 100644 (file)
@@ -156,9 +156,6 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format
                        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" ) );
-
                        if ( mlt_properties_get_int( properties, "distort" ) )
                        {
                                mlt_properties_set_int( MLT_TRANSITION_PROPERTIES( composite ), "distort", 1 );
index 222ce002d9e59f0793ad7486d16025a590b41c55..aa3b2360e88302d023faa9fc83a88c80da98a5a0 100644 (file)
@@ -925,8 +925,9 @@ static mlt_geometry composite_calculate( mlt_transition self, struct geometry_s
        mlt_geometry start = mlt_properties_get_data( properties, "geometries", NULL );
 
        // Obtain the normalised width and height from the a_frame
-       int normalised_width = mlt_properties_get_int( a_props, "normalised_width" );
-       int normalised_height = mlt_properties_get_int( a_props, "normalised_height" );
+       mlt_profile profile = mlt_service_profile( MLT_TRANSITION_SERVICE( self ) );
+       int normalised_width = profile->width;
+       int normalised_height = profile->height;
 
        char *name = mlt_properties_get( properties, "_unique_id" );
        char key[ 256 ];
@@ -1140,8 +1141,9 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
 
                // Get the image from the b frame
                uint8_t *image_b = NULL;
-               int width_b = *width > 0 ? *width : mlt_properties_get_int( a_props, "normalised_width" );
-               int height_b = *height > 0 ? *height : mlt_properties_get_int( a_props, "normalised_height" );
+               mlt_profile profile = mlt_service_profile( MLT_TRANSITION_SERVICE( self ) );
+               int width_b = *width > 0 ? *width : profile->width;
+               int height_b = *height > 0 ? *height : profile->height;
        
                // Vars for alphas
                uint8_t *alpha_a = NULL;
index 0b55ff0464404ff39ccc6767150ba6d9449686a1..a21b3d24b3ba9e761cb16e204480b1acc91734ca 100644 (file)
@@ -95,11 +95,12 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *
                        mlt_service_unlock( MLT_FILTER_SERVICE( filter ) );
                        mlt_transition_process( transition, a_frame, this );
 
-                       if (mlt_properties_get_int( properties, "use_normalised" ))
+                       if ( mlt_properties_get_int( properties, "use_normalised" ) )
                        {
-                               // Use the normalised width & height from the a_frame
-                               *width = mlt_properties_get_int( MLT_FRAME_PROPERTIES( a_frame ), "normalised_width" );
-                               *height = mlt_properties_get_int( MLT_FRAME_PROPERTIES( a_frame ), "normalised_height" );
+                               // Use the normalised width & height
+                               mlt_profile profile = mlt_service_profile( MLT_FILTER_SERVICE( filter ) );
+                               *width = profile->width;
+                               *height = profile->height;
                        }
                        
                        mlt_frame_get_image( a_frame, image, format, width, height, writable );
index 50eb47cac701fb2e6858314da60530d6bfd5d338..80ae6e7cf86c9c876b2dea40db5dbd4185347155 100644 (file)
@@ -393,8 +393,9 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
        }
 
        // Obtain the normalised width and height from the a_frame
-       int normalised_width = mlt_properties_get_int( a_props, "normalised_width" );
-       int normalised_height = mlt_properties_get_int( a_props, "normalised_height" );
+       mlt_profile profile = mlt_service_profile( MLT_TRANSITION_SERVICE( transition ) );
+       int normalised_width = profile->width;
+       int normalised_height = profile->height;
 
        double consumer_ar = mlt_properties_get_double( a_props, "consumer_aspect_ratio" );