From bb3afe8051067b4e688a59b4d5f2a3425b13410f Mon Sep 17 00:00:00 2001 From: Dan Dennedy Date: Thu, 12 Jul 2012 21:19:56 -0700 Subject: [PATCH] accept file:// prefix on MLT XML file --- src/modules/core/producer_loader.c | 7 ++++++- src/modules/xml/producer_xml.c | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/modules/core/producer_loader.c b/src/modules/core/producer_loader.c index d381e3bc..7b43c0c2 100644 --- a/src/modules/core/producer_loader.c +++ b/src/modules/core/producer_loader.c @@ -90,11 +90,16 @@ static mlt_producer create_producer( mlt_profile profile, char *file ) p ++; } + // Strip file:// prefix + p = lookup; + if ( strncmp( lookup, "file://", 7 ) == 0 ) + p += 7; + // Iterate through the dictionary for ( i = 0; result == NULL && i < mlt_properties_count( dictionary ); i ++ ) { char *name = mlt_properties_get_name( dictionary, i ); - if ( fnmatch( name, lookup, 0 ) == 0 ) + if ( fnmatch( name, p, 0 ) == 0 ) result = create_from( profile, file, mlt_properties_get_value( dictionary, i ) ); } diff --git a/src/modules/xml/producer_xml.c b/src/modules/xml/producer_xml.c index 88d7eebc..a9396fe1 100644 --- a/src/modules/xml/producer_xml.c +++ b/src/modules/xml/producer_xml.c @@ -1541,6 +1541,10 @@ mlt_producer producer_xml_init( mlt_profile profile, mlt_service_type servtype, char *filename = NULL; int info = strcmp( id, "xml-string" ) ? 0 : 1; + // Strip file:// prefix + if ( data && strlen( data ) >= 7 && strncmp( data, "file://", 7 ) == 0 ) + data += 7; + if ( data == NULL || !strcmp( data, "" ) || ( info == 0 && !file_exists( data ) ) ) return NULL; -- 2.39.2