]> git.sesse.net Git - mlt/blobdiff - src/modules/avformat/filter_swscale.c
Move the aspect ratio for multi consumer from mlt_frame.
[mlt] / src / modules / avformat / filter_swscale.c
index 5d5853ba49ce5287de757382edf4ff3b98069c12..9a47076962f7894930b15131c885a5bbe6777fbf 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 
-#if LIBAVUTIL_VERSION_INT < (50<<16)
-#define PIX_FMT_RGB32 PIX_FMT_RGBA32
-#define PIX_FMT_YUYV422 PIX_FMT_YUV422
-#endif
-
 static inline int convert_mlt_to_av_cs( mlt_image_format format )
 {
        int value = 0;
@@ -55,7 +50,7 @@ static inline int convert_mlt_to_av_cs( mlt_image_format format )
                case mlt_image_yuv420p:
                        value = PIX_FMT_YUV420P;
                        break;
-               case mlt_image_none:
+               default:
                        fprintf( stderr, "Invalid format...\n" );
                        break;
        }
@@ -142,7 +137,7 @@ static int filter_scale( mlt_frame frame, uint8_t **image, mlt_image_format *for
        if ( context )
        {
                // Perform the scaling
-               sws_scale( context, input.data, input.linesize, 0, iheight, output.data, output.linesize);
+               sws_scale( context, (const uint8_t* const*) input.data, input.linesize, 0, iheight, output.data, output.linesize);
                sws_freeContext( context );
        
                // Now update the frame
@@ -167,7 +162,7 @@ static int filter_scale( mlt_frame frame, uint8_t **image, mlt_image_format *for
                                avpicture_fill( &output, outbuf, avformat, owidth, oheight );
        
                                // Perform the scaling
-                               sws_scale( context, input.data, input.linesize, 0, iheight, output.data, output.linesize);
+                               sws_scale( context, (const uint8_t* const*) input.data, input.linesize, 0, iheight, output.data, output.linesize);
                                sws_freeContext( context );
        
                                // Set it back on the frame
@@ -191,13 +186,15 @@ mlt_filter filter_swscale_init( mlt_profile profile, void *arg )
        // Test to see if swscale accepts the arg as resolution
        if ( arg )
        {
-               int width = (int) arg;
-               struct SwsContext *context = sws_getContext( width, width, PIX_FMT_RGB32, 64, 64, PIX_FMT_RGB32, SWS_BILINEAR, NULL, NULL, NULL);
-               if ( context )
-                       sws_freeContext( context );
-               else
-                       return NULL;
-       }               
+               int *width = (int*) arg;
+               if ( *width > 0 )
+               {
+                       struct SwsContext *context = sws_getContext( *width, *width, PIX_FMT_RGB32, 64, 64, PIX_FMT_RGB32, SWS_BILINEAR, NULL, NULL, NULL);
+                       if ( context )
+                               sws_freeContext( context );
+                       else
+                               return NULL;
+       }       }
 
        // Create a new scaler
        mlt_filter filter = mlt_factory_filter( profile, "rescale", NULL );