]> git.sesse.net Git - mlt/commitdiff
Slightly improve auto-setting MLT_NORMALISATION.
authorDan Dennedy <dan@dennedy.org>
Fri, 3 Jul 2009 21:50:14 +0000 (14:50 -0700)
committerDan Dennedy <dan@dennedy.org>
Fri, 3 Jul 2009 21:50:14 +0000 (14:50 -0700)
Signed-off-by: Dan Dennedy <dan@dennedy.org>
src/framework/mlt_profile.c

index 3c016263e881353545caa3d8be2fa133df197d93..ec757eb01035211e3c497e174e6d2ff80f947f58 100644 (file)
@@ -138,6 +138,26 @@ mlt_profile mlt_profile_init( const char *name )
        return profile;
 }
 
+static void set_mlt_normalisation( const char *profile_name )
+{
+       if ( profile_name )
+       {
+               if ( strstr( profile_name, "_ntsc" ) ||
+                    strstr( profile_name, "_60" ) ||
+                    strstr( profile_name, "_2997" ) ||
+                    strstr( profile_name, "_30" ) )
+               {
+                       mlt_environment_set( "MLT_NORMALISATION", "NTSC" );
+               }
+               else if ( strstr( profile_name, "_pal" ) ||
+                         strstr( profile_name, "_50" ) ||
+                         strstr( profile_name, "_25" ) )
+               {
+                       mlt_environment_set( "MLT_NORMALISATION", "PAL" );
+               }
+       }
+}
+
 /** Load a profile from specific file.
  *
  * \public \memberof mlt_profile_s
@@ -161,6 +181,7 @@ mlt_profile mlt_profile_load_file( const char *file )
                        // Set MLT_PROFILE to basename
                        char *filename = strdup( file );
                        mlt_environment_set( "MLT_PROFILE", basename( filename ) );
+                       set_mlt_normalisation( basename( filename ) );
                        free( filename );
                }
                mlt_properties_close( properties );
@@ -168,21 +189,7 @@ mlt_profile mlt_profile_load_file( const char *file )
 
        // Set MLT_NORMALISATION to appease legacy modules
        char *profile_name = mlt_environment( "MLT_PROFILE" );
-       if ( profile_name )
-       {
-               if ( strstr( profile_name, "_ntsc" ) ||
-                       strstr( profile_name, "_60" ) ||
-                       strstr( profile_name, "_30" ) )
-               {
-                       mlt_environment_set( "MLT_NORMALISATION", "NTSC" );
-               }
-               else if ( strstr( profile_name, "_pal" ) ||
-                               strstr( profile_name, "_50" ) ||
-                               strstr( profile_name, "_25" ) )
-               {
-                       mlt_environment_set( "MLT_NORMALISATION", "PAL" );
-               }
-       }
+       set_mlt_normalisation( profile_name );
        return profile;
 }