if ( type != NULL )
*type = context->stack_types[ context->stack_service_size ];
// Set the service's profile and locale so mlt_property time-to-position conversions can get fps
- mlt_properties_set_data( MLT_SERVICE_PROPERTIES( result ), "_profile", context->profile, 0, NULL, NULL );
- mlt_properties_set_lcnumeric( MLT_SERVICE_PROPERTIES( result ), context->lc_numeric );
+ if ( result )
+ {
+ mlt_properties_set_data( MLT_SERVICE_PROPERTIES( result ), "_profile", context->profile, 0, NULL, NULL );
+ mlt_properties_set_lcnumeric( MLT_SERVICE_PROPERTIES( result ), context->lc_numeric );
+ }
}
return result;
}
mlt_producer producer_xml_init( mlt_profile profile, mlt_service_type servtype, const char *id, char *data )
{
- xmlSAXHandler *sax;
+ xmlSAXHandler *sax, *sax_orig;
struct deserialise_context_s *context;
mlt_properties properties = NULL;
int i = 0;
}
// Parse
+ sax_orig = xmlcontext->sax;
xmlcontext->sax = sax;
xmlcontext->_private = ( void* )context;
xmlParseDocument( xmlcontext );
well_formed = xmlcontext->wellFormed;
// Cleanup after parsing
- xmlcontext->sax = NULL;
+ xmlcontext->sax = sax_orig;
xmlcontext->_private = NULL;
+ if ( xmlcontext->myDoc )
+ xmlFreeDoc( xmlcontext->myDoc );
xmlFreeParserCtxt( xmlcontext );
context->stack_node_size = 0;
context->stack_service_size = 0;
sax->getEntity = on_get_entity;
// Parse
+ sax_orig = xmlcontext->sax;
xmlcontext->sax = sax;
xmlcontext->_private = ( void* )context;
xmlParseDocument( xmlcontext );
xmlFreeDoc( context->entity_doc );
free( sax );
xmlMemoryDump( ); // for debugging
+ xmlcontext->sax = sax_orig;
+ xmlcontext->_private = NULL;
+ if ( xmlcontext->myDoc )
+ xmlFreeDoc( xmlcontext->myDoc );
+ xmlFreeParserCtxt( xmlcontext );
// Get the last producer on the stack
enum service_type type;
if ( getenv( "MLT_XML_DEEP" ) == NULL )
{
// Now assign additional properties
- if ( is_filename && mlt_service_identify( service ) == tractor_type )
+ if ( is_filename && (
+ mlt_service_identify( service ) == tractor_type ||
+ mlt_service_identify( service ) == playlist_type ||
+ mlt_service_identify( service ) == multitrack_type ) )
+ {
+ mlt_properties_set_int( properties, "_original_type",
+ mlt_service_identify( service ) );
+ mlt_properties_set( properties, "_original_resource",
+ mlt_properties_get( properties, "resource" ) );
mlt_properties_set( properties, "resource", data );
+ }
// This tells consumer_xml not to deep copy
mlt_properties_set( properties, "xml", "was here" );