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 )
{
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 )