]> git.sesse.net Git - mlt/commitdiff
Composite distort, fill and titles rework
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Mon, 27 Dec 2004 21:08:13 +0000 (21:08 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Mon, 27 Dec 2004 21:08:13 +0000 (21:08 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@579 d19143bc-622f-0410-bfdd-b5b2a6649095

13 files changed:
demo/mlt_bouncy_ball
demo/mlt_my_name_is
demo/mlt_title_over_gfx
src/framework/mlt_tractor.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/core/transition_region.c
src/modules/data_fx.properties
src/modules/feeds/PAL/data_fx.properties
src/modules/plus/filter_affine.c
src/modules/plus/transition_affine.c

index ff61f6c936c2cbdb8cf2bc9dbe122c2baa6d27ac..1aedb5cd31b886ad64d5874ec12516b1d3e1121c 100644 (file)
@@ -3,12 +3,10 @@ clip3.dv \
 -track \
 clip1.dv \
 -transition \
-region \
-composite.start=10%,10%:20%x20% \
-composite.key[33]=30%,70%:25%x25% \
-composite.key[66]=70%,30%:15%x15% \
-composite.end=70%,70%:20%x20% \
+region:circle \
+composite.geometry="10%,10%:20%x20%;33=30%,70%:25%x25%;66=70%,30%:15%x15%;-1=70%,70%:20%x20%" \
 composite.out=100 \
+composite.softness=0.1 \
 a_track=0 \
 b_track=1 \
 in=0 \
index a0ad96e7d8f9829adf314eb3fe06b89c60768202..bd6bc3f453298c474ec506b1b52e63a216c4fcc2 100644 (file)
@@ -4,7 +4,7 @@ clip3.dv \
 "+My name is Inigo Montoya.txt" out=99 -blank 49 "+Prepare to die!.txt" out=99 \
 -track \
 -blank 74 "+You killed my father.txt" out=74 \
--transition composite:50%,20%:5%x4% end=10%,20%:80%x12% fill=true halign=centre valign=centre in=0 out=99 a_track=0 b_track=1 \
+-transition composite:50%,20%:5%x4% end=10%,20%:80%x12% distort=1 halign=centre valign=centre in=0 out=99 a_track=0 b_track=1 \
 -transition composite:0%,70%:100%x10% end=100%,70%:100%x10% in=75 out=149 a_track=0 b_track=2 \
 -transition composite:25%,25%:50%x50%! in=150 out=249 a_track=0 b_track=1 \
 $*
index d9158a1d3f85bce926c7af66f9eb76fbb4c127f9..72168a9eb3dd368c46000ef7fe76553b01e8c358 100644 (file)
@@ -10,7 +10,7 @@ inigo \
                out=199 \
                a_track=1 \
                b_track=2 \
-               fill=true \
+               distort=1 \
 -transition \
        composite:0%,75%:100%x20%:0 \
                in=50 \
index 968b518adddaacae76f65693c2caf4f4827da7ad..979e39c9d59c574d1cc64e68edecb7a6c8eed1e0 100644 (file)
@@ -206,8 +206,8 @@ static int producer_get_image( mlt_frame this, uint8_t **buffer, mlt_image_forma
        mlt_properties_set_int( frame_properties, "width", mlt_properties_get_int( properties, "width" ) );
        mlt_properties_set_int( frame_properties, "height", mlt_properties_get_int( properties, "height" ) );
        mlt_properties_set( frame_properties, "rescale.interp", mlt_properties_get( properties, "rescale.interp" ) );
-       if ( mlt_properties_get( properties, "distort" ) )
-               mlt_properties_set( frame_properties, "distort", mlt_properties_get( properties, "distort" ) );
+       if ( mlt_properties_get_int( properties, "distort" ) )
+               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_double( properties, "consumer_deinterlace" ) );
        mlt_properties_set_int( frame_properties, "normalised_width", mlt_properties_get_double( properties, "normalised_width" ) );
@@ -218,8 +218,8 @@ static int producer_get_image( mlt_frame this, uint8_t **buffer, mlt_image_forma
        mlt_properties_set_int( properties, "height", *height );
        mlt_properties_set_double( properties, "aspect_ratio", mlt_frame_get_aspect_ratio( frame ) );
        mlt_properties_set_int( properties, "progressive", mlt_properties_get_int( frame_properties, "progressive" ) );
-       if ( mlt_properties_get( frame_properties, "distort" ) )
-               mlt_properties_set( properties, "distort", mlt_properties_get( frame_properties, "distort" ) );
+       if ( mlt_properties_get_int( frame_properties, "distort" ) )
+               mlt_properties_set_int( properties, "distort", mlt_properties_get_int( frame_properties, "distort" ) );
        data = mlt_frame_get_alpha_mask( frame );
        mlt_properties_set_data( properties, "alpha", data, 0, NULL, NULL );
        return 0;
index 164d9cd64b09e6b048ae40557dcfc3632e5e25dc..672b2b60a5dd03ba33d2237510f3376e4c6fc8ad 100644 (file)
@@ -110,9 +110,10 @@ static int filter_scale( mlt_frame this, uint8_t **image, mlt_image_format iform
 
 static void scale_alpha( mlt_frame this, int iwidth, int iheight, int owidth, int oheight )
 {
-       uint8_t *input = mlt_frame_get_alpha_mask( this );
+       int size = 0;
+       uint8_t *input = mlt_properties_get_data( MLT_FRAME_PROPERTIES( this ), "alpha", &size );
        
-       if ( input != NULL )
+       if ( input != NULL && ( size == iwidth * iheight ) || size == ( iwidth * ( iheight + 1 ) ) )
        {
                uint8_t *output = mlt_pool_alloc( owidth * oheight );
 
index 2315f780c354909c1896aca1ce6220dfbd651a32..ba27859b2947d3843594906ff4b4a18039e52980 100644 (file)
@@ -48,7 +48,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *
        if ( rescale != NULL && !strcmp( rescale, "none" ) )
                return mlt_frame_get_image( this, image, format, width, height, writable );
 
-       if ( mlt_properties_get( properties, "distort" ) == NULL )
+       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" );
index f834c121dbe5e86c1252492306957076d05ce432..8bd237a205377c7611b88fa51e42edcc69fdf69c 100644 (file)
@@ -149,9 +149,9 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format
 
                        if ( mlt_properties_get_int( properties, "distort" ) )
                        {
-                               mlt_properties_set( MLT_TRANSITION_PROPERTIES( composite ), "distort", "true" );
-                               mlt_properties_set( a_props, "distort", "true" );
-                               mlt_properties_set( b_props, "distort", "true" );
+                               mlt_properties_set_int( MLT_TRANSITION_PROPERTIES( composite ), "distort", 1 );
+                               mlt_properties_set_int( a_props, "distort", 1 );
+                               mlt_properties_set_int( b_props, "distort", 1 );
                        }
 
                        if ( mlt_properties_get_int( properties, "reverse" ) == 0 )
index dda6c65f9fcfd938cb248b0d0d7568622640afbe..bd224a21dd76a27c954f133f22206924116430dd 100644 (file)
@@ -689,12 +689,18 @@ static int get_b_frame_image( mlt_transition this, mlt_frame b_frame, uint8_t **
                        scaled_height = normalised_height;
                }
 
-               // Now apply the fill
-               // TODO: Should combine fill/distort in one property
-               if ( mlt_properties_get( properties, "fill" ) != NULL )
+               if ( mlt_properties_get_int( properties, "fill" ) )
                {
-                       scaled_width = ( geometry->item.w / scaled_width ) * scaled_width;
-                       scaled_height = ( geometry->item.h / scaled_height ) * scaled_height;
+                       if ( scaled_height < normalised_height && scaled_width * normalised_height / scaled_height < normalised_width )
+                       {
+                               scaled_width = scaled_width * normalised_height / scaled_height;
+                               scaled_height = normalised_height;
+                       }
+                       else if ( scaled_width < normalised_width && scaled_height * normalised_width / scaled_width < normalised_height )
+                       {
+                               scaled_height = scaled_height * normalised_width / scaled_width;
+                               scaled_width = normalised_width;
+                       }
                }
 
                // Save the new scaled dimensions
@@ -708,7 +714,7 @@ static int get_b_frame_image( mlt_transition this, mlt_frame b_frame, uint8_t **
        }
 
        // We want to ensure that we bypass resize now...
-       mlt_properties_set( b_props, "distort", "true" );
+       mlt_properties_set_int( b_props, "distort", 1 );
 
        // Take into consideration alignment for optimisation
        if ( !mlt_properties_get_int( properties, "titles" ) )
@@ -893,7 +899,7 @@ mlt_frame composite_copy_region( mlt_transition this, mlt_frame a_frame, mlt_pos
 
        // Assign this position to the b frame
        mlt_frame_set_position( b_frame, frame_position );
-       mlt_properties_set( b_props, "distort", "true" );
+       mlt_properties_set_int( b_props, "distort", 1 );
 
        // Return the frame
        return b_frame;
@@ -972,7 +978,6 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
                {
                        if ( mlt_properties_get( b_props, "rescale.interp" ) == NULL )
                                mlt_properties_set( b_props, "rescale.interp", "hyper" );
-                       mlt_properties_set( properties, "fill", NULL );
                        width_b = mlt_properties_get_int( a_props, "dest_width" );
                        height_b = mlt_properties_get_int( a_props, "dest_height" );
                }
index 688d51cddaa6ed4098427f80a6e95e73a266ad8b..bfe4a4e1ddab8c6166fa6447726ab43bb4857b8e 100644 (file)
@@ -67,8 +67,8 @@ static int create_instance( mlt_transition this, char *name, char *value, int co
                sprintf( key, "%s.", name );
 
                // Just in case, let's assume that the filter here has a composite
-               mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "composite.start", "0%,0%:100%x100%" );
-               mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "composite.fill", "true" );
+               //mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "composite.geometry", "0%,0%:100%x100%" );
+               //mlt_properties_set_int( MLT_FILTER_PROPERTIES( filter ), "composite.fill", 1 );
 
                // Pass all the key properties on the filter down
                mlt_properties_pass( MLT_FILTER_PROPERTIES( filter ), properties, key );
@@ -106,7 +106,7 @@ static uint8_t *filter_get_alpha_mask( mlt_frame this )
        mlt_image_format format = mlt_image_yuv422;
                                        
        // Get the shape image to trigger alpha creation
-       mlt_properties_set( MLT_FRAME_PROPERTIES( shape_frame ), "distort", "true" );
+       mlt_properties_set_int( MLT_FRAME_PROPERTIES( shape_frame ), "distort", 1 );
        mlt_frame_get_image( shape_frame, &image, &format, &region_width, &region_height, 0 );
 
        alpha = mlt_frame_get_alpha_mask( shape_frame );
@@ -122,9 +122,14 @@ static uint8_t *filter_get_alpha_mask( mlt_frame this )
                        *p ++ = *image ++;
                        image ++;
                }
-               mlt_properties_set_data( MLT_FRAME_PROPERTIES( shape_frame ), "alpha", alpha, 
-                                                                region_width * region_height, mlt_pool_release, NULL );
+               mlt_properties_set_data( MLT_FRAME_PROPERTIES( this ), "alpha", alpha, region_width * region_height, mlt_pool_release, NULL );
        }
+       else
+       {
+               mlt_properties_set_data( MLT_FRAME_PROPERTIES( this ), "alpha", alpha, region_width * region_height, NULL, NULL );
+       }
+
+       this->get_alpha_mask = NULL;
 
        return alpha;
 }
@@ -171,8 +176,8 @@ static int transition_get_image( mlt_frame frame, uint8_t **image, mlt_image_for
                        mlt_properties composite_properties = MLT_TRANSITION_PROPERTIES( composite );
 
                        // We want to ensure that we don't get a wobble...
-                       mlt_properties_set( composite_properties, "distort", "true" );
-                       mlt_properties_set( composite_properties, "progressive", "1" );
+                       mlt_properties_set_int( composite_properties, "distort", 1 );
+                       mlt_properties_set_int( composite_properties, "progressive", 1 );
 
                        // Pass all the composite. properties on the transition down
                        mlt_properties_pass( composite_properties, properties, "composite." );
index 49368abf4dce3a3b71dd8fd55ab52ee30096d9b7..f7dc2e9806be750d434590fa2da019db17740dc3 100644 (file)
@@ -157,8 +157,8 @@ file_shot=region
 .filter[1]=watermark
 .filter[1].resource=pango:
 .filter[1].producer.markup=File Shot
-.filter[1].producer.font=San 20
-.filter[1].composite.geometry=1%,1%:99%x99%:15;25=1%,1%:99%x99%:100
+.filter[1].producer.font=San 18
+.filter[1].composite.geometry=0%,0%:100%x100%:15;25=0%,0%:100%x100%:100
 .filter[1].composite.titles=0
 .filter[1].composite.halign=centre
 .filter[1].composite.valign=centre
index 55547025b41f8aae7c7be37ed037191abef5b0f3..bd55aa21ef848f20367b83e075ce24bcb74e1135 100644 (file)
@@ -158,8 +158,8 @@ file_shot=region
 .filter[1].resource=pango:
 .filter[1].producer.markup=File Shot
 .filter[1].producer.font=San 20
-.filter[1].composite.geometry=1%,1%:99%x99%:15;25=1%,1%:99%x99%:100
-.filter[1].composite.titles=0
+.filter[1].composite.geometry=0%,0%:100%x100%:15;25=0%,0%:100%x100%:100
+.filter[1].composite.titles=1
 .filter[1].composite.halign=centre
 .filter[1].composite.valign=centre
 
index 81fde67858f59a877b31a27473342a5408331be4..a0d39a4787644142764edec726c1fe227c25d504 100644 (file)
@@ -71,7 +71,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *
                        mlt_properties_pass( MLT_TRANSITION_PROPERTIES( transition ), properties, "transition." );
                        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( MLT_FRAME_PROPERTIES( a_frame ), "distort", "true" );
+                       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" ) );
                        mlt_transition_process( transition, a_frame, this );
index 1cfb64b4330157a2a7f81cad8355161c0b6f73fe..806b14084d7883e4211430413b72cc974e97a5e2 100644 (file)
@@ -540,7 +540,7 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
                mlt_properties_set_double( b_props, "consumer_aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) );
        }
 
-       mlt_properties_set( b_props, "distort", mlt_properties_get( properties, "distort" ) );
+       mlt_properties_set_int( b_props, "distort", mlt_properties_get_int( properties, "distort" ) );
        mlt_frame_get_image( b_frame, &b_image, &b_format, &b_width, &b_height, 0 );
        result.w = b_width;
        result.h = b_height;
@@ -698,7 +698,7 @@ mlt_transition transition_affine_init( char *arg )
        {
                mlt_properties_set_int( MLT_TRANSITION_PROPERTIES( transition ), "sx", 1 );
                mlt_properties_set_int( MLT_TRANSITION_PROPERTIES( transition ), "sy", 1 );
-               mlt_properties_set( MLT_TRANSITION_PROPERTIES( transition ), "distort", NULL );
+               mlt_properties_set_int( MLT_TRANSITION_PROPERTIES( transition ), "distort", 0 );
                mlt_properties_set( MLT_TRANSITION_PROPERTIES( transition ), "start", "0,0:100%x100%" );
                transition->process = transition_process;
        }