X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fframework%2Fmlt_factory.c;h=124526575533c3242c31c14734cf2b1f7999243a;hb=40b169c095486ba1b868486eb98a47c41f36ce8c;hp=1272a8e794400fef5fffab95d8230a04d1ea704e;hpb=b79a3f74f655a4ab8bb087454624d11eca6d9b34;p=melted diff --git a/src/framework/mlt_factory.c b/src/framework/mlt_factory.c index 1272a8e..1245265 100644 --- a/src/framework/mlt_factory.c +++ b/src/framework/mlt_factory.c @@ -3,19 +3,19 @@ * Copyright (C) 2003-2004 Ushodaya Enterprises Limited * Author: Charles Yates * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "config.h" @@ -90,10 +90,6 @@ int mlt_factory_init( const char *prefix ) // Create the global properties global_properties = mlt_properties_new( ); - mlt_properties_set_or_default( global_properties, "MLT_NORMALISATION", getenv( "MLT_NORMALISATION" ), "PAL" ); - mlt_properties_set_or_default( global_properties, "MLT_PRODUCER", getenv( "MLT_PRODUCER" ), "fezzik" ); - mlt_properties_set_or_default( global_properties, "MLT_CONSUMER", getenv( "MLT_CONSUMER" ), "sdl" ); - mlt_properties_set( global_properties, "MLT_TEST_CARD", getenv( "MLT_TEST_CARD" ) ); // Create the object list. object_list = mlt_properties_new( ); @@ -108,6 +104,44 @@ int mlt_factory_init( const char *prefix ) atexit( mlt_factory_close ); } + // Allow property refresh on a subsequent initialisation + if ( global_properties != NULL ) + { + mlt_properties_set_or_default( global_properties, "MLT_NORMALISATION", getenv( "MLT_NORMALISATION" ), "PAL" ); + mlt_properties_set_or_default( global_properties, "MLT_PRODUCER", getenv( "MLT_PRODUCER" ), "fezzik" ); + mlt_properties_set_or_default( global_properties, "MLT_CONSUMER", getenv( "MLT_CONSUMER" ), "sdl" ); + mlt_properties_set( global_properties, "MLT_TEST_CARD", getenv( "MLT_TEST_CARD" ) ); + mlt_properties_set_or_default( global_properties, "MLT_PROFILE", getenv( "MLT_PROFILE" ), "dv_pal" ); + + // Load the most appropriate profile + // MLT_PROFILE preferred + if ( getenv( "MLT_PROFILE" ) ) + { + if ( !mlt_profile_select( mlt_environment( "MLT_PROFILE" ) ) ) + mlt_profile_load_file( mlt_environment( "MLT_PROFILE" ) ); + } + // MLT_NORMALISATION backwards compatibility + else if ( strcmp( mlt_environment( "MLT_NORMALISATION" ), "PAL" ) ) + mlt_profile_select( "dv_ntsc" ); + else + mlt_profile_select( "dv_pal" ); + + // destroy an invalid profile so it can be constructed from hard defauls + if ( mlt_profile_get()->width == 0 ) + mlt_profile_close(); + + // Set MLT_NORMALISATION to appease legacy modules + if ( !getenv( "MLT_NORMALISATION" ) ) + { + const char *profile = mlt_profile_get()->name; + if ( strstr( profile, "_ntsc" ) || strstr( profile, "_atsc" ) ) + setenv( "MLT_NORMALISATION", "NTSC", 1 ); + else if ( strstr( profile, "_pal" ) ) + setenv( "MLT_NORMALISATION", "PAL", 1 ); + } + } + + return 0; } @@ -239,13 +273,10 @@ mlt_consumer mlt_factory_consumer( const char *service, void *input ) if ( obj != NULL ) { - mlt_filter filter = mlt_factory_filter( "data_show", NULL ); mlt_properties properties = MLT_CONSUMER_PROPERTIES( obj ); mlt_properties_set_int( properties, "_unique_id", ++ unique_id ); mlt_properties_set( properties, "mlt_type", "consumer" ); mlt_properties_set( properties, "mlt_service", service ); - mlt_service_attach( MLT_CONSUMER_SERVICE( obj ), filter ); - mlt_filter_close( filter ); } return obj; } @@ -277,6 +308,6 @@ void mlt_factory_close( ) free( mlt_prefix ); mlt_prefix = NULL; mlt_pool_close( ); + mlt_profile_close(); } } -