]> git.sesse.net Git - mlt/commitdiff
Rescaler and fezzik rework (to allow inclusion of mc scaler)
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sun, 18 Apr 2004 14:13:32 +0000 (14:13 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sun, 18 Apr 2004 14:13:32 +0000 (14:13 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@290 d19143bc-622f-0410-bfdd-b5b2a6649095

15 files changed:
src/modules/configure
src/modules/core/Makefile
src/modules/core/configure
src/modules/core/factory.c
src/modules/core/filter_rescale.c [new file with mode: 0644]
src/modules/core/filter_rescale.h [new file with mode: 0644]
src/modules/fezzik.ini [new file with mode: 0644]
src/modules/fezzik/Makefile
src/modules/fezzik/producer_fezzik.c
src/modules/gtk2/configure
src/modules/gtk2/factory.c
src/modules/gtk2/filter_rescale.c
src/modules/normalize/gpl [new file with mode: 0644]
src/modules/resample/gpl [new file with mode: 0644]
src/modules/xine/gpl [new file with mode: 0644]

index 1a7b7492202cd2dfa846f3c5df767fc99fedd93a..b10101ba323f2bb5c9714b4eae950c1567fffc28 100755 (executable)
@@ -19,11 +19,17 @@ for i in *
 do
        if [ -x $i/configure -a \( "$help" = "1" -o ! -f disable-$i \) ]
        then
-               [ "$help" = "0" ] && echo "Configuring modules/$i:"
-               pushd $i > /dev/null
-               ./configure $@
-               [ $? != 0 ] && exit 1
-               popd > /dev/null
+               if [ "$gpl" = "true" -o ! -f $i/gpl ]
+               then
+                       [ "$help" = "0" ] && echo "Configuring modules/$i:"
+                       pushd $i > /dev/null
+                       ./configure $@
+                       [ $? != 0 ] && exit 1
+                       popd > /dev/null
+               elif [ "$help" = "0" ]
+               then
+                       touch disable-$i
+               fi
        fi
 done
 
index 355cbe2dbf46f4440c062e62cf08c0a481b1d13e..841d4e89660d02daff679cbf840d827de11aa3bb 100644 (file)
@@ -14,6 +14,7 @@ OBJS = factory.o \
           filter_mirror.o \
           filter_obscure.o \
           filter_region.o \
+          filter_rescale.o \
           filter_resize.o \
           filter_watermark.o \
           transition_composite.o \
index 5a2898306a27cd26135b5ff5488860a3b8170a4e..b3b3a2b3e979ae7eede1a58131d1739d7a75917d 100755 (executable)
@@ -18,6 +18,7 @@ luma                  libmltcore.so
 mirror                 libmltcore.so
 obscure                        libmltcore.so
 region                 libmltcore.so
+rescale                        libmltcore.so
 resize                 libmltcore.so
 watermark              libmltcore.so
 EOF
index 43bad21c1c5be4431579c422bba8bb324f660f84..c832a9cc9a95015e7d338a3efab0eb6b1af97eed 100644 (file)
@@ -30,6 +30,7 @@
 #include "filter_luma.h"
 #include "filter_mirror.h"
 #include "filter_obscure.h"
+#include "filter_rescale.h"
 #include "filter_resize.h"
 #include "filter_region.h"
 #include "filter_watermark.h"
@@ -67,6 +68,8 @@ void *mlt_create_filter( char *id, void *arg )
                return filter_obscure_init( arg );
        if ( !strcmp( id, "region" ) )
                return filter_region_init( arg );
+       if ( !strcmp( id, "rescale" ) )
+               return filter_rescale_init( arg );
        if ( !strcmp( id, "resize" ) )
                return filter_resize_init( arg );
        if ( !strcmp( id, "watermark" ) )
diff --git a/src/modules/core/filter_rescale.c b/src/modules/core/filter_rescale.c
new file mode 100644 (file)
index 0000000..a028f6c
--- /dev/null
@@ -0,0 +1,284 @@
+/*
+ * filter_rescale.c -- scale the producer video frame size to match the consumer
+ * Copyright (C) 2003-2004 Ushodaya Enterprises Limited
+ * Author: Dan Dennedy <dan@dennedy.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "filter_rescale.h"
+
+#include <framework/mlt_frame.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+typedef int ( *image_scaler )( mlt_frame this, uint8_t **image, mlt_image_format iformat, mlt_image_format oformat, int iwidth, int iheight, int owidth, int oheight );
+
+static int filter_scale( mlt_frame this, uint8_t **image, mlt_image_format iformat, mlt_image_format oformat, int iwidth, int iheight, int owidth, int oheight )
+{
+       // Get the properties
+       mlt_properties properties = mlt_frame_properties( this );
+
+       // Get the rescaling interpolsation
+       char *interps = mlt_properties_get( properties, "rescale.interp" );
+
+       // Carry out the rescaling
+       if ( iformat == mlt_image_yuv422 && oformat == mlt_image_yuv422 )
+       {
+               // Scale the frame
+               mlt_frame_rescale_yuv422( this, owidth, oheight );
+               
+               // Return the output
+               *image = mlt_properties_get_data( properties, "image", NULL );
+       }
+       else if ( iformat == mlt_image_rgb24 || iformat == mlt_image_rgb24a )
+       {
+               int bpp = (iformat == mlt_image_rgb24a ? 4 : 3 );
+                       
+               // Create the yuv image
+               uint8_t *output = mlt_pool_alloc( iwidth * ( iheight + 1 ) * 2 );
+
+               if ( strcmp( interps, "none" ) && ( iwidth != owidth || iheight != oheight ) )
+               {
+                       // Extract YUV422 and alpha
+                       if ( bpp == 4 )
+                       {
+                               // Allocate the alpha mask
+                               uint8_t *alpha = mlt_pool_alloc( iwidth * ( iheight + 1 ) );
+
+                               // Convert the image and extract alpha
+                               mlt_convert_rgb24a_to_yuv422( *image, iwidth, iheight, iwidth * 2, output, alpha );
+
+                               mlt_properties_set_data( properties, "alpha", alpha, iwidth * ( iheight + 1 ), ( mlt_destructor )mlt_pool_release, NULL );
+                       }
+                       else
+                       {
+                               // No alpha to extract
+                               mlt_convert_rgb24_to_yuv422( *image, iwidth, iheight, iwidth * 2, output );
+                       }
+
+                       // Scale the frame
+                       mlt_frame_rescale_yuv422( this, owidth, oheight );
+               
+                       // Return the output
+                       *image = mlt_properties_get_data( properties, "image", NULL );
+               }
+               else
+               {
+                       // Extract YUV422 and alpha
+                       if ( bpp == 4 )
+                       {
+                               // Allocate the alpha mask
+                               uint8_t *alpha = mlt_pool_alloc( owidth * ( oheight + 1 ) );
+
+                               // Convert the image and extract alpha
+                               mlt_convert_rgb24a_to_yuv422( *image, owidth, oheight, owidth * 4, output, alpha );
+
+                               mlt_properties_set_data( properties, "alpha", alpha, owidth * ( oheight + 1 ), ( mlt_destructor )mlt_pool_release, NULL );
+                       }
+                       else
+                       {
+                               // No alpha to extract
+                               mlt_convert_rgb24_to_yuv422( *image, owidth, oheight, owidth * 3, output );
+                       }
+               }
+
+               // Now update the frame
+               mlt_properties_set_data( properties, "image", output, owidth * ( oheight + 1 ) * 2, ( mlt_destructor )mlt_pool_release, NULL );
+               mlt_properties_set_int( properties, "width", owidth );
+               mlt_properties_set_int( properties, "height", oheight );
+
+               *image = output;
+       }
+
+       return 0;
+}
+
+/** Do it :-).
+*/
+
+static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable )
+{
+       // Get the frame properties
+       mlt_properties properties = mlt_frame_properties( this );
+
+       // Get the filter from the stack
+       mlt_filter filter = mlt_frame_pop_service( this );
+
+       // Get the filter properties
+       mlt_properties filter_properties = mlt_filter_properties( filter );
+
+       // Get the image scaler method
+       image_scaler scaler_method = mlt_properties_get_data( filter_properties, "method", NULL );
+
+       // 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" );
+       }
+
+       // There can be problems with small images - avoid them (by hacking - gah)
+       if ( *width >= 2 && *height >= 6 )
+       {
+               int iwidth = *width;
+               int iheight = *height;
+               int owidth = *width;
+               int oheight = *height;
+               char *interps = mlt_properties_get( properties, "rescale.interp" );
+
+               // Default from the scaler if not specifed on the frame
+               if ( interps == NULL )
+               {
+                       interps = mlt_properties_get( mlt_filter_properties( filter ), "interpolation" );
+                       mlt_properties_set( properties, "rescale.interp", interps );
+               }
+       
+               // If real_width/height exist, we want that as minimum information
+               if ( mlt_properties_get_int( properties, "real_width" ) )
+               {
+                       iwidth = mlt_properties_get_int( properties, "real_width" );
+                       iheight = mlt_properties_get_int( properties, "real_height" );
+               }
+       
+               // Let the producer know what we are actually requested to obtain
+               if ( *format == mlt_image_yuv422 && strcmp( interps, "none" ) )
+               {
+                       mlt_properties_set_int( properties, "rescale_width", *width );
+                       mlt_properties_set_int( properties, "rescale_height", *height );
+               }
+               else
+               {
+                       // When no scaling is requested, revert the requested dimensions if possible
+                       mlt_properties_set_int( properties, "rescale_width", ( iwidth / 2 ) * 2 );
+                       mlt_properties_set_int( properties, "rescale_height", ( iheight / 2 ) * 2 );
+               }
+       
+               // Get the image as requested
+               mlt_frame_get_image( this, image, format, &iwidth, &iheight, writable );
+       
+               // Get rescale interpretation again, in case the producer wishes to override scaling
+               interps = mlt_properties_get( properties, "rescale.interp" );
+       
+               if ( *image != NULL && ( *format != mlt_image_yuv422 || ( iwidth != owidth || iheight != oheight ) ) )
+               {
+                       // If the colour space is correct and scaling is off, do nothing
+                       if ( *format == mlt_image_yuv422 && !strcmp( interps, "none" ) )
+                       {
+                               *width = iwidth;
+                               *height = iheight;
+                       }
+                       else if ( *format == mlt_image_yuv422 )
+                       {
+                               // Call the local scaler
+                               scaler_method( this, image, *format, mlt_image_yuv422, iwidth, iheight, owidth, oheight );
+                               *width = owidth;
+                               *height = oheight;
+                       }
+                       else if ( *format == mlt_image_rgb24 || *format == mlt_image_rgb24a )
+                       {
+                               // Call the local scaler
+                               scaler_method( this, image, *format, mlt_image_yuv422, iwidth, iheight, owidth, oheight );
+
+                               // Return the output
+                               *format = mlt_image_yuv422;
+                               *width = owidth;
+                               *height = oheight;
+                       }
+                       else
+                       {
+                               *width = iwidth;
+                               *height = iheight;
+                       }
+               }
+               else
+               {
+                       *width = iwidth;
+                       *height = iheight;
+               }
+       }
+       else
+       {
+               // Store the requested width/height
+               int iwidth = *width;
+               int iheight = *height;
+
+               // Get the image as requested
+               mlt_frame_get_image( this, image, format, &iwidth, &iheight, writable );
+
+               // Too small - for now just assign as though we got what we wanted
+               *width = iwidth;
+               *height = iheight;
+       }
+
+
+       return 0;
+}
+
+static uint8_t *producer_get_alpha_mask( mlt_frame this )
+{
+       // Obtain properties of frame
+       mlt_properties properties = mlt_frame_properties( this );
+
+       // Return the alpha mask
+       return mlt_properties_get_data( properties, "alpha", NULL );
+}
+
+/** Filter processing.
+*/
+
+static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
+{
+       // Push the filter
+       mlt_frame_push_service( frame, this );
+
+       // Push the get image method
+       mlt_frame_push_service( frame, filter_get_image );
+
+       // Set alpha call back
+       frame->get_alpha_mask = producer_get_alpha_mask;
+
+       return frame;
+}
+
+/** Constructor for the filter.
+*/
+
+mlt_filter filter_rescale_init( char *arg )
+{
+       // Create a new scaler
+       mlt_filter this = mlt_filter_new( );
+
+       // If successful, then initialise it
+       if ( this != NULL )
+       {
+               // Get the properties
+               mlt_properties properties = mlt_filter_properties( this );
+
+               // Set the process method
+               this->process = filter_process;
+
+               // Set the inerpolation
+               mlt_properties_set( properties, "interpolation", arg == NULL ? "bilinear" : arg );
+
+               // Set the method
+               mlt_properties_set_data( properties, "method", filter_scale, 0, NULL, NULL );
+       }
+
+       return this;
+}
+
diff --git a/src/modules/core/filter_rescale.h b/src/modules/core/filter_rescale.h
new file mode 100644 (file)
index 0000000..58340ff
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * filter_rescale.h -- scale the producer video frame size to match the consumer
+ * Copyright (C) 2003-2004 Ushodaya Enterprises Limited
+ * Author: Dan Dennedy <dan@dennedy.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _FILTER_RESCALE_H_
+#define _FILTER_RESCALE_H_
+
+#include <framework/mlt_filter.h>
+
+extern mlt_filter filter_rescale_init( char *arg );
+
+#endif
diff --git a/src/modules/fezzik.ini b/src/modules/fezzik.ini
new file mode 100644 (file)
index 0000000..9e7caaa
--- /dev/null
@@ -0,0 +1,12 @@
+# This file defines the normalisers, their fallbacks and the order they're attached
+#
+# The names on the left are arbitrary, but the order in which they occur is the
+# order in which they're applied.
+# 
+# The names of the services on the right dictate the preference used (if unavailable
+# the second and third are applied as applicable).
+
+deinterlace=deinterlace,avdeinterlace
+rescaler=mcrescale,gtkrescale,rescale
+resizer=resize
+resampler=resample,soxresample,avresample
index 2b02e5885c7aee8085747184e410138f8d8d104d..e965ac937ac99d9cb347fc6a5241bfe964016960 100644 (file)
@@ -27,6 +27,7 @@ clean:
 install: all
        install -m 755 $(TARGET) "$(prefix)/share/mlt/modules"
        install -m 644 ../fezzik.dict "$(prefix)/share/mlt/modules"
+       install -m 644 ../fezzik.ini "$(prefix)/share/mlt/modules"
 
 ifneq ($(wildcard .depend),)
 include .depend
index 1fd6037b28bc6ff3c432c6310bd0ff4c7bd0c63e..429cf802b4588cf2773db2842db97482393da88c 100644 (file)
@@ -29,6 +29,7 @@
 #include <framework/mlt.h>
 
 static mlt_properties dictionary = NULL;
+static mlt_properties normalisers = NULL;
 
 static void track_service( mlt_tractor tractor, void *service, mlt_destructor destructor )
 {
@@ -116,7 +117,7 @@ static mlt_producer create_producer( char *file )
        return result;
 }
 
-static mlt_service create_filter( mlt_tractor tractor, mlt_service last, char *effect )
+static mlt_service create_filter( mlt_tractor tractor, mlt_service last, char *effect, int *created )
 {
        char *id = strdup( effect );
        char *arg = strchr( id, ':' );
@@ -128,11 +129,46 @@ static mlt_service create_filter( mlt_tractor tractor, mlt_service last, char *e
                mlt_filter_connect( filter, last, 0 );
                track_service( tractor, filter, ( mlt_destructor )mlt_filter_close );
                last = mlt_filter_service( filter );
+               *created = 1;
        }
        free( id );
        return last;
 }
 
+static mlt_service attach_normalisers( mlt_tractor tractor, mlt_service last )
+{
+       // Loop variable
+       int i;
+
+       // Tokeniser
+       mlt_tokeniser tokeniser = mlt_tokeniser_init( );
+
+       // We only need to load the normalising properties once
+       if ( normalisers == NULL )
+       {
+               char temp[ 1024 ];
+               sprintf( temp, "%s/fezzik.ini", mlt_factory_prefix( ) );
+               normalisers = mlt_properties_load( temp );
+               mlt_factory_register_for_clean_up( normalisers, ( mlt_destructor )mlt_properties_close );
+       }
+
+       // Apply normalisers
+       for ( i = 0; i < mlt_properties_count( normalisers ); i ++ )
+       {
+               int j = 0;
+               int created = 0;
+               char *value = mlt_properties_get_value( normalisers, i );
+               mlt_tokeniser_parse_new( tokeniser, value, "," );
+               for ( j = 0; !created && j < mlt_tokeniser_count( tokeniser ); j ++ )
+                       last = create_filter( tractor, last, mlt_tokeniser_get_string( tokeniser, j ), &created );
+       }
+
+       // Close the tokeniser
+       mlt_tokeniser_close( tokeniser );
+
+       return last;
+}
+
 mlt_producer producer_fezzik_init( char *arg )
 {
        // Create the producer that the tractor will contain
@@ -163,10 +199,7 @@ mlt_producer producer_fezzik_init( char *arg )
                        mlt_properties_set_data( properties, "producer", producer, 0, ( mlt_destructor )mlt_producer_close, NULL );
 
                        // Now attach normalising filters
-                       last = create_filter( tractor, last, "avdeinterlace" );
-                       last = create_filter( tractor, last, "rescale" );
-                       last = create_filter( tractor, last, "resize" );
-                       last = create_filter( tractor, last, "avresample" );
+                       last = attach_normalisers( tractor, last );
 
                        // Connect the tractor to the last
                        mlt_tractor_connect( tractor, last );
index 34f55153fe444a8bc3a0de7c8346c23d4ce14987..c0d1688b343d6568eeb83c09b4645557291b9dc7 100755 (executable)
@@ -9,7 +9,7 @@ pango                   libmltgtk2.so
 EOF
 
 cat << EOF >> ../filters.dat
-rescale                        libmltgtk2.so
+gtkrescale             libmltgtk2.so
 EOF
 
 fi
index bbddaa25f6b0507d6ce28584b76ad4c4fbf594d4..d846e64160e02c39884ab9ec50a1dfa3715f448d 100644 (file)
@@ -35,7 +35,7 @@ void *mlt_create_producer( char *id, void *arg )
 
 void *mlt_create_filter( char *id, void *arg )
 {
-       if ( !strcmp( id, "rescale" ) )
+       if ( !strcmp( id, "gtkrescale" ) )
                return filter_rescale_init( arg );
        return NULL;
 }
index f9789a6efc254c4d16b37286da2d4b401a2e702f..e1ebb7a41b8006b576bf7e6a2af3f41fda93160e 100644 (file)
 #include "pixops.h"
 
 #include <framework/mlt_frame.h>
+#include <framework/mlt_factory.h>
 
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
 
-
-/** Do it :-).
-*/
-
-static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable )
+static int filter_scale( mlt_frame this, uint8_t **image, mlt_image_format iformat, mlt_image_format oformat, int iwidth, int iheight, int owidth, int oheight )
 {
-       if ( *width == 0 )
-               *width = 720;
-       if ( *height == 0 )
-               *height = 576;
-       if ( *width < 2 || *height < 6 )
-               return 1;
-
+       // Get the properties
        mlt_properties properties = mlt_frame_properties( this );
-       int iwidth = *width;
-       int iheight = *height;
-       int owidth = *width;
-       int oheight = *height;
-       uint8_t *input = NULL;
-       char *interps = mlt_properties_get( properties, "rescale.interp" );
-       int interp = PIXOPS_INTERP_BILINEAR;
-       
-       // If real_width/height exist, we want that as minimum information
-       if ( mlt_properties_get_int( properties, "real_width" ) )
-       {
-               iwidth = mlt_properties_get_int( properties, "real_width" );
-               iheight = mlt_properties_get_int( properties, "real_height" );
-       }
 
-       // Let the producer know what we are actually requested to obtain
-       if ( *format == mlt_image_yuv422 && strcmp( interps, "none" ) )
-       {
-               mlt_properties_set_int( properties, "rescale_width", *width );
-               mlt_properties_set_int( properties, "rescale_height", *height );
-       }
-       else
-       {
-               // When no scaling is requested, revert the requested dimensions if possible
-               mlt_properties_set_int( properties, "rescale_width", ( iwidth / 2 ) * 2 );
-               mlt_properties_set_int( properties, "rescale_height", ( iheight / 2 ) * 2 );
-       }
-
-       // Get the image as requested
-       mlt_frame_get_image( this, &input, format, &iwidth, &iheight, writable );
+       // Get the requested interpolation method
+       char *interps = mlt_properties_get( properties, "rescale.interp" );
 
-       // Get rescale interpretation again, in case the producer wishes to override scaling
-       interps = mlt_properties_get( properties, "rescale.interp" );
+       // Convert to the GTK flag
+       int interp = PIXOPS_INTERP_BILINEAR;
 
        if ( strcmp( interps, "nearest" ) == 0 )
                interp = PIXOPS_INTERP_NEAREST;
@@ -83,142 +47,89 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *
        else if ( strcmp( interps, "hyper" ) == 0 )
                interp = PIXOPS_INTERP_HYPER;
 
-       if ( input != NULL )
+       // Carry out the rescaling
+       if ( iformat == mlt_image_yuv422 && oformat == mlt_image_yuv422 )
        {
-               // If width and height are correct, don't do anything
-               if ( *format == mlt_image_yuv422 && strcmp( interps, "none" ) && ( iwidth != owidth || iheight != oheight ) )
-               {
-                       // Create the output image
-                       uint8_t *output = mlt_pool_alloc( owidth * ( oheight + 1 ) * 2 );
+               // Create the output image
+               uint8_t *output = mlt_pool_alloc( owidth * ( oheight + 1 ) * 2 );
 
-                       // Calculate strides
-                       int istride = iwidth * 2;
-                       int ostride = owidth * 2;
+               // Calculate strides
+               int istride = iwidth * 2;
+               int ostride = owidth * 2;
 
-                       yuv422_scale_simple( output, owidth, oheight, ostride, input, iwidth, iheight, istride, interp );
+               yuv422_scale_simple( output, owidth, oheight, ostride, *image, iwidth, iheight, istride, interp );
                
-                       // Now update the frame
-                       mlt_properties_set_data( properties, "image", output, owidth * ( oheight + 1 ) * 2, ( mlt_destructor )mlt_pool_release, NULL );
-                       mlt_properties_set_int( properties, "width", owidth );
-                       mlt_properties_set_int( properties, "height", oheight );
+               // Now update the frame
+               mlt_properties_set_data( properties, "image", output, owidth * ( oheight + 1 ) * 2, ( mlt_destructor )mlt_pool_release, NULL );
+               mlt_properties_set_int( properties, "width", owidth );
+               mlt_properties_set_int( properties, "height", oheight );
 
-                       // Return the output
-                       *image = output;
-               }
-               else if ( *format == mlt_image_yuv422 && !strcmp( interps, "none" ) )
-               {
-                       // Do nothing
-                       *width = iwidth;
-                       *height = iheight;
-                       *image = input;
-               }
-               else if ( *format == mlt_image_rgb24 || *format == mlt_image_rgb24a )
-               {
-                       int bpp = (*format == mlt_image_rgb24a ? 4 : 3 );
+               // Return the output
+               *image = output;
+       }
+       else if ( iformat == mlt_image_rgb24 || iformat == mlt_image_rgb24a )
+       {
+               int bpp = (iformat == mlt_image_rgb24a ? 4 : 3 );
                        
-                       // Create the yuv image
-                       uint8_t *output = mlt_pool_alloc( owidth * ( oheight + 1 ) * 2 );
+               // Create the yuv image
+               uint8_t *output = mlt_pool_alloc( owidth * ( oheight + 1 ) * 2 );
+
+               if ( strcmp( interps, "none" ) && ( iwidth != owidth || iheight != oheight ) )
+               {
+                       GdkPixbuf *pixbuf = gdk_pixbuf_new_from_data( *image, GDK_COLORSPACE_RGB,
+                               ( iformat == mlt_image_rgb24a ), 8, iwidth, iheight,
+                               iwidth * bpp, NULL, NULL );
 
-                       if ( strcmp( interps, "none" ) && ( iwidth != owidth || iheight != oheight ) )
+                       GdkPixbuf *scaled = gdk_pixbuf_scale_simple( pixbuf, owidth, oheight, interp );
+                       g_object_unref( pixbuf );
+                       
+                       // Extract YUV422 and alpha
+                       if ( bpp == 4 )
                        {
-                               GdkPixbuf *pixbuf = gdk_pixbuf_new_from_data( input, GDK_COLORSPACE_RGB,
-                                       ( *format == mlt_image_rgb24a ), 8, iwidth, iheight,
-                                       iwidth * bpp, NULL, NULL );
-
-                               GdkPixbuf *scaled = gdk_pixbuf_scale_simple( pixbuf, owidth, oheight, interp );
-                               g_object_unref( pixbuf );
-                               
-                               // Extract YUV422 and alpha
-                               if ( bpp == 4 )
-                               {
-                                       // Allocate the alpha mask
-                                       uint8_t *alpha = mlt_pool_alloc( owidth * ( oheight + 1 ) );
-
-                                       // Convert the image and extract alpha
-                                       mlt_convert_rgb24a_to_yuv422( gdk_pixbuf_get_pixels( scaled ),
-                                                                                 owidth, oheight,
-                                                                                 gdk_pixbuf_get_rowstride( scaled ),
-                                                                                 output, alpha );
-
-                                       mlt_properties_set_data( properties, "alpha", alpha, owidth * ( oheight + 1 ), ( mlt_destructor )mlt_pool_release, NULL );
-                               }
-                               else
-                               {
-                                       // No alpha to extract
-                                       mlt_convert_rgb24_to_yuv422( gdk_pixbuf_get_pixels( scaled ),
-                                                                                owidth, oheight,
-                                                                                gdk_pixbuf_get_rowstride( scaled ),
-                                                                                output );
-                               }
-                               g_object_unref( scaled );
+                               // Allocate the alpha mask
+                               uint8_t *alpha = mlt_pool_alloc( owidth * ( oheight + 1 ) );
+
+                               // Convert the image and extract alpha
+                               mlt_convert_rgb24a_to_yuv422( gdk_pixbuf_get_pixels( scaled ), owidth, oheight, gdk_pixbuf_get_rowstride( scaled ), output, alpha );
+
+                               mlt_properties_set_data( properties, "alpha", alpha, owidth * ( oheight + 1 ), ( mlt_destructor )mlt_pool_release, NULL );
                        }
                        else
                        {
-                               // Extract YUV422 and alpha
-                               if ( bpp == 4 )
-                               {
-                                       // Allocate the alpha mask
-                                       uint8_t *alpha = mlt_pool_alloc( owidth * ( oheight + 1 ) );
-
-                                       // Convert the image and extract alpha
-                                       mlt_convert_rgb24a_to_yuv422( input,
-                                                                                 owidth, oheight,
-                                                                                 owidth * 4,
-                                                                                 output, alpha );
-
-                                       mlt_properties_set_data( properties, "alpha", alpha, owidth * ( oheight + 1 ), ( mlt_destructor )mlt_pool_release, NULL );
-                               }
-                               else
-                               {
-                                       // No alpha to extract
-                                       mlt_convert_rgb24_to_yuv422( input,
-                                                                                owidth, oheight,
-                                                                                owidth * 3,
-                                                                                output );
-                               }
+                               // No alpha to extract
+                               mlt_convert_rgb24_to_yuv422( gdk_pixbuf_get_pixels( scaled ), owidth, oheight, gdk_pixbuf_get_rowstride( scaled ), output );
                        }
-
-                       // Now update the frame
-                       mlt_properties_set_data( properties, "image", output, owidth * ( oheight + 1 ) * 2, ( mlt_destructor )mlt_pool_release, NULL );
-                       mlt_properties_set_int( properties, "width", owidth );
-                       mlt_properties_set_int( properties, "height", oheight );
-
-                       // Return the output
-                       *format = mlt_image_yuv422;
-                       *width = owidth;
-                       *height = oheight;
-                       *image = output;
+                       g_object_unref( scaled );
                }
                else
-                       *image = input;
-       }
-       else
-               *image = input;
-               
-       return 0;
-}
+               {
+                       // Extract YUV422 and alpha
+                       if ( bpp == 4 )
+                       {
+                               // Allocate the alpha mask
+                               uint8_t *alpha = mlt_pool_alloc( owidth * ( oheight + 1 ) );
 
-static uint8_t *producer_get_alpha_mask( mlt_frame this )
-{
-       // Obtain properties of frame
-       mlt_properties properties = mlt_frame_properties( this );
+                               // Convert the image and extract alpha
+                               mlt_convert_rgb24a_to_yuv422( *image, owidth, oheight, owidth * 4, output, alpha );
 
-       // Return the alpha mask
-       return mlt_properties_get_data( properties, "alpha", NULL );
-}
+                               mlt_properties_set_data( properties, "alpha", alpha, owidth * ( oheight + 1 ), ( mlt_destructor )mlt_pool_release, NULL );
+                       }
+                       else
+                       {
+                               // No alpha to extract
+                               mlt_convert_rgb24_to_yuv422( *image, owidth, oheight, owidth * 3, output );
+                       }
+               }
 
-/** Filter processing.
-*/
+               // Now update the frame
+               mlt_properties_set_data( properties, "image", output, owidth * ( oheight + 1 ) * 2, ( mlt_destructor )mlt_pool_release, NULL );
+               mlt_properties_set_int( properties, "width", owidth );
+               mlt_properties_set_int( properties, "height", oheight );
 
-static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
-{
-       mlt_frame_push_get_image( frame, filter_get_image );
-       mlt_properties_set( mlt_frame_properties( frame ), "rescale.interp",
-               mlt_properties_get( mlt_filter_properties( this ), "interpolation" ) );
-               
-       // Set alpha call back
-       frame->get_alpha_mask = producer_get_alpha_mask;
-       return frame;
+               *image = output;
+       }
+
+       return 0;
 }
 
 /** Constructor for the filter.
@@ -226,11 +137,22 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
 
 mlt_filter filter_rescale_init( char *arg )
 {
-       mlt_filter this = mlt_filter_new( );
+       // Create a new scaler
+       mlt_filter this = mlt_factory_filter( "rescale", arg );
+
+       // If successful, then initialise it
        if ( this != NULL )
        {
-               this->process = filter_process;
-               mlt_properties_set( mlt_filter_properties( this ), "interpolation", arg == NULL ? "bilinear" : arg );
+               // Get the properties
+               mlt_properties properties = mlt_filter_properties( this );
+
+               // Set the inerpolation
+               mlt_properties_set( properties, "interpolation", arg == NULL ? "bilinear" : arg );
+
+               // Set the method
+               mlt_properties_set_data( properties, "method", filter_scale, 0, NULL, NULL );
        }
+
        return this;
 }
+
diff --git a/src/modules/normalize/gpl b/src/modules/normalize/gpl
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/modules/resample/gpl b/src/modules/resample/gpl
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/modules/xine/gpl b/src/modules/xine/gpl
new file mode 100644 (file)
index 0000000..e69de29