]> git.sesse.net Git - mlt/blobdiff - src/modules/core/producer_loader.c
Fix regressions playing all frames at end (kdenlive-1207).
[mlt] / src / modules / core / producer_loader.c
index 8d84ce0ef16e98b87a53591233f612b1eb99a793..a6c8fc2b4f9ba65e49ea6a0a76d4ef6b9917363d 100644 (file)
@@ -106,17 +106,15 @@ static mlt_producer create_producer( mlt_profile profile, char *file )
 
 static void create_filter( mlt_profile profile, mlt_producer producer, char *effect, int *created )
 {
-       // The swscale filter can not handle images with a width > 2048 and the
-       // sdl_image producer does not scale on its own
-       if ( strncmp( effect, "swscale", 7 ) == 0 &&
-            mlt_properties_get_int( MLT_PRODUCER_PROPERTIES( producer ), "_real_width" ) > 2048 &&
-            strcmp( mlt_properties_get( MLT_PRODUCER_PROPERTIES( producer ), "mlt_service" ), "sdl_image" ) == 0 )
-               return;
-
        char *id = strdup( effect );
        char *arg = strchr( id, ':' );
        if ( arg != NULL )
                *arg ++ = '\0';
+
+       // The swscale and avcolor_space filters require resolution as arg to test compatibility
+       if ( strncmp( effect, "swscale", 7 ) == 0 || strncmp( effect, "avcolo", 6 ) == 0 )
+               arg = (char*) mlt_properties_get_int( MLT_PRODUCER_PROPERTIES( producer ), "_real_width" );
+
        mlt_filter filter = mlt_factory_filter( profile, id, arg );
        if ( filter != NULL )
        {
@@ -173,10 +171,23 @@ 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 );
+       
+       if ( producer )
+       {
+               // Always let the image and audio be converted
+               int created = 0;
+#ifndef __DARWIN__
+               create_filter( profile, producer, "avcolor_space", &created );
+               if ( !created )
+#endif
+                       create_filter( profile, producer, "imageconvert", &created );
+               create_filter( profile, producer, "audioconvert", &created );
+       }
 
        // Now make sure we don't lose our identity
        if ( properties != NULL )