]> git.sesse.net Git - mlt/commitdiff
Fix swscale to take init size arg as pointer.
authorDan Dennedy <dan@dennedy.org>
Sun, 24 Mar 2013 06:06:28 +0000 (23:06 -0700)
committerDan Dennedy <dan@dennedy.org>
Sun, 24 Mar 2013 06:06:28 +0000 (23:06 -0700)
src/modules/avformat/filter_swscale.c

index e70a37dad56a0375553d3dbd7c0562f909b16867..9a47076962f7894930b15131c885a5bbe6777fbf 100644 (file)
@@ -186,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 );