]> git.sesse.net Git - mlt/commitdiff
mlt_profile.c, mlt_factory.c: bugfix loading profile by file specification and remove...
authorddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sat, 13 Oct 2007 06:53:31 +0000 (06:53 +0000)
committerddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sat, 13 Oct 2007 06:53:31 +0000 (06:53 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@1029 d19143bc-622f-0410-bfdd-b5b2a6649095

src/framework/mlt_factory.c
src/framework/mlt_profile.c

index 709dc5ebfa09d1033e08ee2d92f5e86205a63b9a..3d7759c5c22deccaeeeb576f54e1d332d50326d8 100644 (file)
@@ -116,10 +116,7 @@ int mlt_factory_init( const char *prefix )
                // 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_profile_select( mlt_environment( "MLT_PROFILE" ) );
                // MLT_NORMALISATION backwards compatibility
                else if ( strcmp( mlt_environment( "MLT_NORMALISATION" ), "PAL" ) )
                        mlt_profile_select( "dv_ntsc" );
index 607af04c686899f34fbc568d0c832d7ca690991c..e9565ecfed9a9060f3528a699487f7cce32dab20 100644 (file)
@@ -65,11 +65,16 @@ mlt_profile mlt_profile_select( const char *name )
 {
        char *filename = NULL;
        const char *prefix = getenv( "MLT_PROFILES_PATH" );
+       mlt_properties properties = mlt_properties_load( name );
        
-       // Allow environment to override default behavior
-       if ( prefix == NULL )
+       // Try to load from file specification
+       if ( properties && mlt_properties_get_int( properties, "width" ) )
+       {
+               filename = calloc( 1, strlen( name ) + 1 );
+       }
+       // Load from $prefix/share/mlt/profiles
+       else if ( prefix == NULL )
        {
-               // default behavior is to use $prefix/share/mlt/profiles
                prefix = PREFIX;
                filename = calloc( 1, strlen( prefix ) + strlen( PROFILES_DIR ) + strlen( name ) + 2 );
                strcpy( filename, prefix );
@@ -77,16 +82,24 @@ mlt_profile mlt_profile_select( const char *name )
                        filename[ strlen( filename ) ] = '/';
                strcat( filename, PROFILES_DIR );
        }
+       // Use environment variable instead
        else
        {
-               // just use environment variable
                filename = calloc( 1, strlen( prefix ) + strlen( name ) + 2 );
                strcpy( filename, prefix );
                if ( filename[ strlen( filename ) - 1 ] != '/' )
                        filename[ strlen( filename ) ] = '/';
        }
+       
+       // Finish loading
        strcat( filename, name );
-       return mlt_profile_load_file( filename );
+       mlt_profile_load_file( filename );
+
+       // Cleanup
+       mlt_properties_close( properties );
+       free( filename );
+
+       return profile;
 }
 
 /** Load a profile from specific file