]> git.sesse.net Git - mlt/commitdiff
Invert position of normalization filters with framebuffer producer.
authorDan Dennedy <dan@dennedy.org>
Sun, 13 Sep 2009 20:07:04 +0000 (13:07 -0700)
committerDan Dennedy <dan@dennedy.org>
Sun, 13 Sep 2009 20:07:04 +0000 (13:07 -0700)
Previously, the framebuffer producer loaded a normalized producer, which
can give undesired results with things like crop and really any time you
want to filter the unpadded images of the speed-altered video. Now, the
framebuffer uses the new "abnormal" producer to load the clip without
normalization filters and sets appropriate frame properties to allow the
normalizing filters attached to the framebuffer to act appropriately.
This new abnormal filter is simply an alias to the existing loader
filter, which uses the name by which it is invoked to toggle the
behaviour of whether to attach normalizing filters.

src/modules/core/factory.c
src/modules/core/producer_loader.c
src/modules/kdenlive/producer_framebuffer.c

index b0aecb9e2a87352423d087b47740be54996281c0..2be9dc03fd9844dafb574823554792a19d00ef52 100644 (file)
@@ -73,6 +73,7 @@ MLT_REPOSITORY
        MLT_REGISTER( filter_type, "resize", filter_resize_init );
        MLT_REGISTER( filter_type, "transition", filter_transition_init );
        MLT_REGISTER( filter_type, "watermark", filter_watermark_init );
+       MLT_REGISTER( producer_type, "abnormal", producer_loader_init );
        MLT_REGISTER( producer_type, "color", producer_colour_init );
        MLT_REGISTER( producer_type, "colour", producer_colour_init );
        MLT_REGISTER( producer_type, "consumer", producer_consumer_init );
index 8d84ce0ef16e98b87a53591233f612b1eb99a793..19ed732dd68e68f63fdffb02acd36218fa8ff703 100644 (file)
@@ -173,8 +173,9 @@ mlt_producer producer_loader_init( mlt_profile profile, mlt_service_type type, c
                properties = MLT_PRODUCER_PROPERTIES( producer );
 
        // Attach filters if we have a producer and it isn't already xml'd :-)
-       if ( producer != NULL && mlt_properties_get( properties, "xml" ) == NULL && \
-               mlt_properties_get( properties, "_xml" ) == NULL && \
+       if ( producer && strcmp( id, "abnormal" ) &&
+               mlt_properties_get( properties, "xml" ) == NULL &&
+               mlt_properties_get( properties, "_xml" ) == NULL &&
                mlt_properties_get( properties, "loader_normalised" ) == NULL )
                attach_normalisers( profile, producer );
 
index 6097243a039728b6a73ffc44b01434cce5579340..c6b03a08125e746018de8ea83ff0838147d56e10 100644 (file)
@@ -132,9 +132,10 @@ static int framebuffer_get_image( mlt_frame this, uint8_t **image, mlt_image_for
                *image = image_copy;
                mlt_properties_set_data( frame_properties, "image", image_copy, size, ( mlt_destructor )mlt_pool_release, NULL );
 
-               // Make sure that no further scaling is done
-               mlt_properties_set( frame_properties, "rescale.interps", "none" );
-               mlt_properties_set( frame_properties, "scale", "off" );
+               *width = mlt_properties_get_int( properties, "_output_width" );
+               *height = mlt_properties_get_int( properties, "_output_height" );
+               *format = mlt_properties_get_int( properties, "_output_format" );
+
                return 0;
        }
 
@@ -173,6 +174,9 @@ static int framebuffer_get_image( mlt_frame this, uint8_t **image, mlt_image_for
                memcpy( output, first_image, size );
                // Let someone else clean up
                mlt_properties_set_data( properties, "output_buffer", output, size, mlt_pool_release, NULL ); 
+               mlt_properties_set_int( properties, "_output_width", *width );
+               mlt_properties_set_int( properties, "_output_height", *height );
+               mlt_properties_set_int( properties, "_output_format", *format );
        
        }
 
@@ -184,10 +188,6 @@ static int framebuffer_get_image( mlt_frame this, uint8_t **image, mlt_image_for
        *image = image_copy;
        mlt_properties_set_data( frame_properties, "image", *image, size, ( mlt_destructor )mlt_pool_release, NULL );
 
-       // Make sure that no further scaling is done
-       mlt_properties_set( frame_properties, "rescale.interps", "none" );
-       mlt_properties_set( frame_properties, "scale", "off" );
-
        return 0;
 }
 
@@ -204,6 +204,10 @@ static int producer_get_frame( mlt_producer this, mlt_frame_ptr frame, int index
 
                // Give the returned frame temporal identity
                mlt_frame_set_position( *frame, mlt_producer_position( this ) );
+
+               mlt_properties_set_int( MLT_FRAME_PROPERTIES(*frame), "real_width", mlt_properties_get_int( MLT_PRODUCER_PROPERTIES(this), "width" ) );
+               mlt_properties_set_int( MLT_FRAME_PROPERTIES(*frame), "real_height", mlt_properties_get_int( MLT_PRODUCER_PROPERTIES(this), "height" ) );
+               mlt_properties_pass_list( MLT_FRAME_PROPERTIES(*frame), MLT_PRODUCER_PROPERTIES(this), "width, height, aspect_ratio" );
        }
 
        return 0;
@@ -249,7 +253,7 @@ mlt_producer producer_framebuffer_init( mlt_profile profile, mlt_service_type ty
                        *ptr = '\0';
        }
                
-       real_producer = mlt_factory_producer( profile, NULL, props );
+       real_producer = mlt_factory_producer( profile, "abnormal", props );
        free( props );
 
        if (speed == 0.0) speed = 1.0;
@@ -265,7 +269,7 @@ mlt_producer producer_framebuffer_init( mlt_profile profile, mlt_service_type ty
                mlt_properties_set_data( properties, "producer", real_producer, 0, ( mlt_destructor )mlt_producer_close, NULL );
 
                // Grab some stuff from the real_producer
-               mlt_properties_pass_list( properties, MLT_PRODUCER_PROPERTIES( real_producer ), "length, width,height" );
+               mlt_properties_pass_list( properties, MLT_PRODUCER_PROPERTIES( real_producer ), "length, width, height, aspect_ratio" );
 
                if ( speed < 0 )
                {