@@ -83,7 +83,7 @@ static int filter_get_image(mlt_frame frame,
8383 double opacity = 1.0 ;
8484
8585 // If the _qtblend_scaled property is defined, a qtblend filter was already applied
86- int qtblendRescaled = mlt_properties_get_int ( frame_properties, " qtblend_scaled " );
86+ double qtblendScaleX = qMin ( 1 ., mlt_properties_get_double ( frame_properties, " qtblend_scalingx " ) );
8787 if (mlt_properties_get (properties, " rect" )) {
8888 rect = mlt_properties_anim_get_rect (properties, " rect" , position, length);
8989 if (::strchr (mlt_properties_get (properties, " rect" ), ' %' )) {
@@ -93,15 +93,13 @@ static int filter_get_image(mlt_frame frame,
9393 rect.h *= normalized_height;
9494 }
9595 }
96- if (qtblendRescaled ) {
96+ if (qtblendScaleX > 0 . ) {
9797 // Another qtblend filter was already applied
9898 // In this case, the *width and *height are set to the source resolution to ensure we don't lose too much details on multiple scaling operations
9999 // We requested a image with full media resolution, adjust rect to profile
100100 // Check if we have consumer scaling enabled since we cannot use *width and *height
101- double consumerScaleX = MIN (1 ., mlt_properties_get_double (frame_properties,
102- " qtblend_preview_scalingx" ));
103- double consumerScaleY = MIN (1 ., mlt_properties_get_double (frame_properties,
104- " qtblend_preview_scalingy" ));
101+ double qtblendScaleY = qMin (1 ., mlt_properties_get_double (frame_properties,
102+ " qtblend_scalingy" ));
105103 // Consumer scaling was already applied to b_width/b_height
106104 // Always request an image that follows the consumer aspect ratio
107105 double consumer_dar = normalized_width * consumer_ar / normalized_height;
@@ -114,12 +112,12 @@ static int filter_get_image(mlt_frame frame,
114112 tmpHeight *= scaleFactor;
115113 }
116114 if (consumer_dar > b_dar) {
117- *width = qBound (qRound (normalized_width * MIN ( 1 ., consumerScaleX) ),
115+ *width = qBound (qRound (normalized_width * qtblendScaleX ),
118116 tmpWidth,
119117 MLT_QTBLEND_MAX_DIMENSION);
120118 *height = qRound (*width * consumer_ar * normalized_height / normalized_width);
121119 } else {
122- *height = qBound (qRound (normalized_height * MIN ( 1 ., consumerScaleY) ),
120+ *height = qBound (qRound (normalized_height * qtblendScaleY ),
123121 tmpHeight,
124122 MLT_QTBLEND_MAX_DIMENSION);
125123 *width = qRound (*height * normalized_width / normalized_height / consumer_ar);
@@ -137,14 +135,13 @@ static int filter_get_image(mlt_frame frame,
137135 }
138136 } else {
139137 // First instance of a qtblend filter
140- // Check if frame size is scaled)
138+ // Check if requested frame size is scaled
141139 double scalex = mlt_profile_scale_width (profile, *width);
142140 double scaley = mlt_profile_scale_height (profile, *height);
143141
144142 // Store consumer scaling for further uses
145- mlt_properties_set_int (frame_properties, " qtblend_scaled" , 1 );
146- mlt_properties_set_double (frame_properties, " qtblend_preview_scalingx" , scalex);
147- mlt_properties_set_double (frame_properties, " qtblend_preview_scalingy" , scaley);
143+ mlt_properties_set_double (frame_properties, " qtblend_scalingx" , scalex);
144+ mlt_properties_set_double (frame_properties, " qtblend_scalingy" , scaley);
148145 // Apply scaling
149146 if (scalex != 1.0 ) {
150147 rect.x *= scalex;
0 commit comments