profiles/*: name->description
authorddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Fri, 20 Jul 2007 06:26:48 +0000 (06:26 +0000)
committerddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Fri, 20 Jul 2007 06:26:48 +0000 (06:26 +0000)
mlt_factory.{h,cc}: added mlt_environment_set()
mlt_profile.{h,cc}: fix setting legacy MLT_NORMALISATION, set MLT_PROFILE, and change "name" to "description" for clarity

git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@1011 d19143bc-622f-0410-bfdd-b5b2a6649095

34 files changed:
profiles/atsc_wide_1080i
profiles/atsc_wide_720p
profiles/cif_ntsc
profiles/cif_pal
profiles/cvd_ntsc
profiles/cvd_pal
profiles/dv_ntsc
profiles/dv_ntsc_wide
profiles/dv_pal
profiles/dv_pal_wide
profiles/hdv_1080_ntsc
profiles/hdv_1080_pal
profiles/hdv_720_ntsc
profiles/hdv_720_pal
profiles/qcif_ntsc
profiles/qcif_pal
profiles/quarter_ntsc
profiles/quarter_ntsc_wide
profiles/quarter_pal
profiles/quarter_pal_wide
profiles/square_ntsc
profiles/square_ntsc_wide
profiles/square_pal
profiles/square_pal_wide
profiles/svcd_ntsc
profiles/svcd_ntsc_wide
profiles/svcd_pal
profiles/svcd_pal_wide
profiles/vcd_ntsc
profiles/vcd_pal
src/framework/mlt_factory.c
src/framework/mlt_factory.h
src/framework/mlt_profile.c
src/framework/mlt_profile.h

index 889379b..9a39901 100644 (file)
@@ -1,4 +1,4 @@
-name=ATSC Widescreen 1080i
+description=ATSC Widescreen 1080i
 frame_rate_num=30000
 frame_rate_den=1001
 width=1920
index 5558016..abb0df9 100644 (file)
@@ -1,4 +1,4 @@
-name=ATSC Widescreen 720p
+description=ATSC Widescreen 720p
 frame_rate_num=30000
 frame_rate_den=1001
 width=1280
index f4e8491..48279a5 100644 (file)
@@ -1,4 +1,4 @@
-name=CIF NTSC
+description=CIF NTSC
 frame_rate_num=30000
 frame_rate_den=1001
 width=352
index dafa242..a7f66d4 100644 (file)
@@ -1,4 +1,4 @@
-name=CIF PAL
+description=CIF PAL
 frame_rate_num=25
 frame_rate_den=1
 width=352
index af844c4..508b3cc 100644 (file)
@@ -1,4 +1,4 @@
-name=CVD NTSC
+description=CVD NTSC
 frame_rate_num=30000
 frame_rate_den=1001
 width=352
index 44cd5bc..2415c77 100644 (file)
@@ -1,4 +1,4 @@
-name=CVD PAL
+description=CVD PAL
 frame_rate_num=25
 frame_rate_den=1
 width=352
index 68cf870..c5462dd 100644 (file)
@@ -1,4 +1,4 @@
-name=DV NTSC
+description=DV NTSC
 frame_rate_num=30000
 frame_rate_den=1001
 width=720
index cc6879f..6c98e4f 100644 (file)
@@ -1,4 +1,4 @@
-name=DV NTSC Widescreen
+description=DV NTSC Widescreen
 frame_rate_num=30000
 frame_rate_den=1001
 width=720
index 32f72c3..33e82bc 100644 (file)
@@ -1,4 +1,4 @@
-name=DV PAL
+description=DV PAL
 frame_rate_num=25
 frame_rate_den=1
 width=720
index 313f12e..a4b669c 100644 (file)
@@ -1,4 +1,4 @@
-name=DV PAL Widescreen
+description=DV PAL Widescreen
 frame_rate_num=25
 frame_rate_den=1
 width=720
index 61e409b..334fb50 100644 (file)
@@ -1,4 +1,4 @@
-name=HDV 1080i NTSC
+description=HDV 1080i NTSC
 frame_rate_num=30000
 frame_rate_den=1001
 width=1440
index 8ecbacd..5ccb720 100644 (file)
@@ -1,4 +1,4 @@
-name=HDV 1080i PAL
+description=HDV 1080i PAL
 frame_rate_num=25
 frame_rate_den=1
 width=1440
index 08e17c0..928b557 100644 (file)
@@ -1,4 +1,4 @@
-name=HDV 720p NTSC
+description=HDV 720p NTSC
 frame_rate_num=30000
 frame_rate_den=1001
 width=1280
index c1908b5..3e59703 100644 (file)
@@ -1,4 +1,4 @@
-name=HDV 720p PAL
+description=HDV 720p PAL
 frame_rate_num=25
 frame_rate_den=1
 width=1280
index 59bd4ff..0e90157 100644 (file)
@@ -1,4 +1,4 @@
-name=QCIF NTSC
+description=QCIF NTSC
 frame_rate_num=30000
 frame_rate_den=1001
 width=176
index c96f62f..21667ee 100644 (file)
@@ -1,4 +1,4 @@
-name=QCIF PAL
+description=QCIF PAL
 frame_rate_num=25
 frame_rate_den=1
 width=176
index 240a814..fb37cd7 100644 (file)
@@ -1,4 +1,4 @@
-name=Quarter Square NTSC
+description=Quarter Square NTSC
 frame_rate_num=30000
 frame_rate_den=1001
 width=320
index bc1cf7d..8c7be94 100644 (file)
@@ -1,4 +1,4 @@
-name=Quarter Square NTSC Widescreen
+description=Quarter Square NTSC Widescreen
 frame_rate_num=30000
 frame_rate_den=1001
 width=426
index fd64d66..beec207 100644 (file)
@@ -1,4 +1,4 @@
-name=Quarter Square PAL
+description=Quarter Square PAL
 frame_rate_num=25
 frame_rate_den=1
 width=384
index 324a11d..195410a 100644 (file)
@@ -1,4 +1,4 @@
-name=Quarter Square PAL Widescreen
+description=Quarter Square PAL Widescreen
 frame_rate_num=25
 frame_rate_den=1
 width=512
index f668b82..e139c3e 100644 (file)
@@ -1,4 +1,4 @@
-name=Square NTSC
+description=Square NTSC
 frame_rate_num=30000
 frame_rate_den=1001
 width=640
index 86addae..da2de3e 100644 (file)
@@ -1,4 +1,4 @@
-name=Square NTSC Widescreen
+description=Square NTSC Widescreen
 frame_rate_num=30000
 frame_rate_den=1001
 width=854
index 4ece39b..a69c8d6 100644 (file)
@@ -1,4 +1,4 @@
-name=Square PAL
+description=Square PAL
 frame_rate_num=25
 frame_rate_den=1
 width=768
index 4fbbf05..316a80d 100644 (file)
@@ -1,4 +1,4 @@
-name=Square PAL Widescreen
+description=Square PAL Widescreen
 frame_rate_num=25
 frame_rate_den=1
 width=1024
index 828cccd..fd6f13a 100644 (file)
@@ -1,4 +1,4 @@
-name=SVCD NTSC
+description=SVCD NTSC
 frame_rate_num=30000
 frame_rate_den=1001
 width=480
index 42f04fc..174960a 100644 (file)
@@ -1,4 +1,4 @@
-name=SVCD NTSC Widescreen
+description=SVCD NTSC Widescreen
 frame_rate_num=30000
 frame_rate_den=1001
 width=480
index 3c41a68..2049270 100644 (file)
@@ -1,4 +1,4 @@
-name=SVCD PAL
+description=SVCD PAL
 frame_rate_num=25
 frame_rate_den=1
 width=480
index e634a4a..3aea87a 100644 (file)
@@ -1,4 +1,4 @@
-name=SVCD PAL Widescreen
+description=SVCD PAL Widescreen
 frame_rate_num=25
 frame_rate_den=1
 width=480
index ae70cad..e58f4f2 100644 (file)
@@ -1,4 +1,4 @@
-name=VCD NTSC
+description=VCD NTSC
 frame_rate_num=30000
 frame_rate_den=1001
 width=352
index e5db06c..5f4e03f 100644 (file)
@@ -1,4 +1,4 @@
-name=VCD PAL
+description=VCD PAL
 frame_rate_num=25
 frame_rate_den=1
 width=352
index 1245265..709dc5e 100644 (file)
@@ -125,20 +125,6 @@ int mlt_factory_init( const char *prefix )
                        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 );
-               }
        }
 
 
@@ -169,6 +155,14 @@ char *mlt_environment( const char *name )
        return mlt_properties_get( global_properties, name );
 }
 
+/** Set a value in the environment.
+*/
+
+int mlt_environment_set( const char *name, const char *value )
+{
+       return mlt_properties_set( global_properties, name, value );
+}
+
 /** Fetch a producer from the repository.
 */
 
index 1765595..749a201 100644 (file)
@@ -26,6 +26,7 @@
 extern int mlt_factory_init( const char *prefix );
 extern const char *mlt_factory_prefix( );
 extern char *mlt_environment( const char *name );
+extern int mlt_environment_set( const char *name, const char *value );
 extern mlt_properties mlt_factory_event_object( );
 extern mlt_producer mlt_factory_producer( const char *name, void *input );
 extern mlt_filter mlt_factory_filter( const char *name, void *input );
index d32146a..c9c67d2 100644 (file)
@@ -41,7 +41,8 @@ mlt_profile mlt_profile_get( )
                profile = calloc( 1, sizeof( struct mlt_profile_s ) );
                if ( profile )
                {
-                       profile->name = strdup( "DV PAL" );
+                       mlt_environment_set( "MLT_PROFILE", "dv_pal" );
+                       profile->description = strdup( "PAL 4:3 DV or DVD" );
                        profile->frame_rate_num = 25;
                        profile->frame_rate_den = 1;
                        profile->width = 720;
@@ -82,18 +83,38 @@ mlt_profile mlt_profile_load_file( const char *file )
        if ( properties && mlt_properties_get_int( properties, "width" ) )
        {
                mlt_profile_load_properties( properties );
-               if ( !profile->name )
-               {
-                       char *filename = strdup( file );
-                       profile->name = strdup( basename( filename ) );
-                       free( filename );
-               }
+               mlt_properties_close( properties );
+
+               // Set MLT_PROFILE to basename
+               char *filename = strdup( file );
+               mlt_environment_set( "MLT_PROFILE", basename( filename ) );
+               free( filename );
        }
        else
        {
+               // Cleanup
                mlt_properties_close( properties );
                mlt_profile_close();
+               // Failover
+               mlt_profile_get();
        }
+
+       // Set MLT_NORMALISATION to appease legacy modules
+       char *profile_name = mlt_environment( "MLT_PROFILE" );
+       if ( strstr( profile_name, "_ntsc" ) ||
+            strstr( profile_name, "_atsc" ) ||
+            strstr( profile_name, "_60i" ) ||
+            strstr( profile_name, "_30p" ) )
+       {
+               mlt_environment_set( "MLT_NORMALISATION", "NTSC" );
+       }
+       else if ( strstr( profile_name, "_pal" ) ||
+                 strstr( profile_name, "_50i" ) ||
+                 strstr( profile_name, "_25p" ) )
+       {
+               mlt_environment_set( "MLT_NORMALISATION", "PAL" );
+       }
+
        return profile;
 }
 
@@ -107,7 +128,9 @@ mlt_profile mlt_profile_load_properties( mlt_properties properties )
        if ( profile )
        {
                if ( mlt_properties_get( properties, "name" ) )
-                       profile->name = mlt_properties_get( properties, "name" );
+                       mlt_environment_set( "MLT_PROFILE", mlt_properties_get( properties, "name" ) );
+               if ( mlt_properties_get( properties, "description" ) )
+                       profile->description = strdup( mlt_properties_get( properties, "description" ) );
                profile->frame_rate_num = mlt_properties_get_int( properties, "frame_rate_num" );
                profile->frame_rate_den = mlt_properties_get_int( properties, "frame_rate_den" );
                profile->width = mlt_properties_get_int( properties, "width" );
@@ -138,10 +161,7 @@ mlt_profile mlt_profile_load_string( const char *string )
                        if ( p ) p++;
                }
        }
-       mlt_profile_load_properties( properties );
-       if ( profile && !profile->name )
-               profile->name = strdup( "untitled" );
-       return profile;
+       return mlt_profile_load_properties( properties );
 }
 
 /** Get the framerate as float
@@ -184,9 +204,9 @@ void mlt_profile_close( )
 {
        if ( profile )
        {
-               if ( profile->name )
-                       free( profile->name );
-               profile->name = NULL;
+               if ( profile->description )
+                       free( profile->description );
+               profile->description = NULL;
                free( profile );
                profile = NULL;
        }
index 29ee633..0c64e7c 100644 (file)
@@ -25,7 +25,7 @@
 
 struct mlt_profile_s
 {
-       char* name;
+       char* description;
        int frame_rate_num;
        int frame_rate_den;
        int width;