]> git.sesse.net Git - mlt/blobdiff - src/framework/mlt_profile.c
src/framework/*: improve the doxygen documentation (work in progress). This also...
[mlt] / src / framework / mlt_profile.c
index 778bb538098dadd26aef839b3f38ded2948c57c3..f90ca3d6a8e8064ab718c3e023da4bb285bbb755 100644 (file)
@@ -1,7 +1,9 @@
-/*
- * mlt_profile.c -- video output definition
- * Copyright (C) 2007 Ushodaya Enterprises Limited
- * Author: Dan Dennedy <dan@dennedy.org>
+/**
+ * \file mlt_profile.c
+ * \brief video output definition
+ *
+ * Copyright (C) 2007-2008 Ushodaya Enterprises Limited
+ * \author Dan Dennedy <dan@dennedy.org>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -37,7 +39,7 @@ static mlt_profile mlt_profile_select( const char *name )
        const char *prefix = getenv( "MLT_PROFILES_PATH" );
        mlt_properties properties = mlt_properties_load( name );
        mlt_profile profile = NULL;
-       
+
        // Try to load from file specification
        if ( properties && mlt_properties_get_int( properties, "width" ) )
        {
@@ -61,7 +63,7 @@ static mlt_profile mlt_profile_select( const char *name )
                if ( filename[ strlen( filename ) - 1 ] != '/' )
                        filename[ strlen( filename ) ] = '/';
        }
-       
+
        // Finish loading
        strcat( filename, name );
        profile = mlt_profile_load_file( filename );
@@ -89,9 +91,9 @@ mlt_profile mlt_profile_init( const char *name )
        {
                // MLT_PROFILE is preferred environment variable
                if ( getenv( "MLT_PROFILE" ) )
-                       profile = mlt_profile_select( mlt_environment( "MLT_PROFILE" ) );
+                       profile = mlt_profile_select( getenv( "MLT_PROFILE" ) );
                // MLT_NORMALISATION backwards compatibility
-               else if ( strcmp( mlt_environment( "MLT_NORMALISATION" ), "PAL" ) )
+               else if ( getenv( "MLT_NORMALISATION" ) && strcmp( getenv( "MLT_NORMALISATION" ), "PAL" ) )
                        profile = mlt_profile_select( "dv_ntsc" );
                else
                        profile = mlt_profile_select( "dv_pal" );
@@ -109,8 +111,8 @@ mlt_profile mlt_profile_init( const char *name )
                                profile->width = 720;
                                profile->height = 576;
                                profile->progressive = 0;
-                               profile->sample_aspect_num = 59;
-                               profile->sample_aspect_den = 54;
+                               profile->sample_aspect_num = 16;
+                               profile->sample_aspect_den = 15;
                                profile->display_aspect_num = 4;
                                profile->display_aspect_den = 3;
                        }
@@ -145,19 +147,21 @@ mlt_profile mlt_profile_load_file( const char *file )
 
        // Set MLT_NORMALISATION to appease legacy modules
        char *profile_name = mlt_environment( "MLT_PROFILE" );
-       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" ) )
+       if ( profile_name )
        {
-               mlt_environment_set( "MLT_NORMALISATION", "PAL" );
+               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" );
+               }
        }
-
        return profile;
 }