From 347a40b8498698136bcfa3a5fc33c2367dff1e33 Mon Sep 17 00:00:00 2001 From: Dan Dennedy Date: Wed, 29 Feb 2012 20:06:20 -0800 Subject: [PATCH] remove usage of normalised_width and _height properties from services --- src/modules/core/filter_crop.c | 6 ++++-- src/modules/core/filter_obscure.c | 13 ++++--------- src/modules/core/filter_rescale.c | 6 ++++-- src/modules/core/filter_resize.c | 9 +++++---- src/modules/core/filter_watermark.c | 3 --- src/modules/core/transition_composite.c | 10 ++++++---- src/modules/plus/filter_affine.c | 9 +++++---- src/modules/plus/transition_affine.c | 5 +++-- 8 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/modules/core/filter_crop.c b/src/modules/core/filter_crop.c index 93cf3cde..e61ac906 100644 --- a/src/modules/core/filter_crop.c +++ b/src/modules/core/filter_crop.c @@ -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 diff --git a/src/modules/core/filter_obscure.c b/src/modules/core/filter_obscure.c index 5ae5b7a4..eeff9b6a 100644 --- a/src/modules/core/filter_obscure.c +++ b/src/modules/core/filter_obscure.c @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -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 ); diff --git a/src/modules/core/filter_rescale.c b/src/modules/core/filter_rescale.c index c1e8b6cb..0f9bb970 100644 --- a/src/modules/core/filter_rescale.c +++ b/src/modules/core/filter_rescale.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -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) diff --git a/src/modules/core/filter_resize.c b/src/modules/core/filter_resize.c index fbbac56d..84c91f74 100644 --- a/src/modules/core/filter_resize.c +++ b/src/modules/core/filter_resize.c @@ -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 ) diff --git a/src/modules/core/filter_watermark.c b/src/modules/core/filter_watermark.c index 54a4693c..217a3bec 100644 --- a/src/modules/core/filter_watermark.c +++ b/src/modules/core/filter_watermark.c @@ -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 ); diff --git a/src/modules/core/transition_composite.c b/src/modules/core/transition_composite.c index 222ce002..aa3b2360 100644 --- a/src/modules/core/transition_composite.c +++ b/src/modules/core/transition_composite.c @@ -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; diff --git a/src/modules/plus/filter_affine.c b/src/modules/plus/filter_affine.c index 0b55ff04..a21b3d24 100644 --- a/src/modules/plus/filter_affine.c +++ b/src/modules/plus/filter_affine.c @@ -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 ); diff --git a/src/modules/plus/transition_affine.c b/src/modules/plus/transition_affine.c index 50eb47ca..80ae6e7c 100644 --- a/src/modules/plus/transition_affine.c +++ b/src/modules/plus/transition_affine.c @@ -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" ); -- 2.39.2