]> git.sesse.net Git - mlt/commitdiff
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 889379b4c494caf38f2d0211e8cf0cc0ef1ccbd5..9a39901c4ac6ebba03ddc8a32b4488fc33f71110 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 5558016c32eb0999295b3a3d4ed3320596329cc6..abb0df9e8e85653039e850806012a3d5b0684bb8 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 f4e8491bad909a26cc922fd130058e8b3f97446d..48279a5eb34ec93f3578fba4ac5bb766ba260a8f 100644 (file)
@@ -1,4 +1,4 @@
-name=CIF NTSC
+description=CIF NTSC
 frame_rate_num=30000
 frame_rate_den=1001
 width=352
index dafa2423ba3e566990dd42a39a22528c4a66c322..a7f66d41efeb8272b301529532c8989091332c94 100644 (file)
@@ -1,4 +1,4 @@
-name=CIF PAL
+description=CIF PAL
 frame_rate_num=25
 frame_rate_den=1
 width=352
index af844c4b1e705c069b55b9d95edc34dab95feb50..508b3cc1414082829b4e9d6e6637f5b83ca020e7 100644 (file)
@@ -1,4 +1,4 @@
-name=CVD NTSC
+description=CVD NTSC
 frame_rate_num=30000
 frame_rate_den=1001
 width=352
index 44cd5bc18758df9c15953408b8c172e31ae1563a..2415c77d90ce55314681417dc9767737fab63bd7 100644 (file)
@@ -1,4 +1,4 @@
-name=CVD PAL
+description=CVD PAL
 frame_rate_num=25
 frame_rate_den=1
 width=352
index 68cf870bc980044157c763d3333cc575ea440713..c5462ddd8433740038c8b478250b43ae0edf7fa9 100644 (file)
@@ -1,4 +1,4 @@
-name=DV NTSC
+description=DV NTSC
 frame_rate_num=30000
 frame_rate_den=1001
 width=720
index cc6879ff247090de449b7944076087f7005fd436..6c98e4f8fb874c23c4b2e704d57d20be707f32fb 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 32f72c389cdc14edcf03da0790dba73f3657fd1a..33e82bc2f8b05eb6d033aeefa75a8430d62053aa 100644 (file)
@@ -1,4 +1,4 @@
-name=DV PAL
+description=DV PAL
 frame_rate_num=25
 frame_rate_den=1
 width=720
index 313f12e6666e96fcf84023d13e94b6c505b66e57..a4b669c5b580257f834305e1e3ad6f85fa363f96 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 61e409b5cfe839a5355be8ac11a2b3769cba7891..334fb50ee29840f342b616ca7934509bd942505a 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 8ecbacd4fc8d88f37133058c188d892411b2dffc..5ccb7201e06eeea511ad776563c1d197300688b7 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 08e17c0b99d7726a197666be5f064c673ee39463..928b557e6f33040af8cb3179071aa446283e09a1 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 c1908b5a031df4a118a0169058c062379b21f180..3e597032b91c5fe0a2c9099c4f1e17af8da5d58e 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 59bd4ffb2f2ba70c8ac04b29f642397c59170373..0e9015770e52ae91af77eaa941e87f279f6672b6 100644 (file)
@@ -1,4 +1,4 @@
-name=QCIF NTSC
+description=QCIF NTSC
 frame_rate_num=30000
 frame_rate_den=1001
 width=176
index c96f62f59ce9002d382892d48ae423c75ee94901..21667ee86266b5599415714cf286a6071bec108c 100644 (file)
@@ -1,4 +1,4 @@
-name=QCIF PAL
+description=QCIF PAL
 frame_rate_num=25
 frame_rate_den=1
 width=176
index 240a814aef2fff55aef884fb6a86648dffbc54d0..fb37cd76f9005309db02116198f4861777e77540 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 bc1cf7d93352d7c37a263495667be251d60c5cc7..8c7be946929ba1fe249a260d856df9e2d5ebf511 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 fd64d66ee95ed2a0723411303a28cde755ec847c..beec20713ac6fbaf478aac48fb4c84f5cb2e660a 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 324a11df5c3c2a38be4c2a79007d2214b4379471..195410aa23fb40d1fe4e1acb6404152225c4c603 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 f668b8289202d7639d4f01b0cbc4a7f5f8cf6089..e139c3e52f17bb5558989c8a62c7c00426ad2467 100644 (file)
@@ -1,4 +1,4 @@
-name=Square NTSC
+description=Square NTSC
 frame_rate_num=30000
 frame_rate_den=1001
 width=640
index 86addae420230f3f59d443c98baeed2dd0bdb1ae..da2de3ef544aacd0edac8677f2ce89fa93f77a8e 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 4ece39ba66aa44462eaac8312365880597df57fe..a69c8d643514764ac35906da4879c39f92555346 100644 (file)
@@ -1,4 +1,4 @@
-name=Square PAL
+description=Square PAL
 frame_rate_num=25
 frame_rate_den=1
 width=768
index 4fbbf05e8582eafa3bebf9633ea285d889a2d831..316a80d7798f6dd14379ce7b8eadb6663c388e5f 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 828cccd76a625c80b812c3882d7a85373faec9e8..fd6f13ae41669533124e8a9ca5bf069b021fa0b2 100644 (file)
@@ -1,4 +1,4 @@
-name=SVCD NTSC
+description=SVCD NTSC
 frame_rate_num=30000
 frame_rate_den=1001
 width=480
index 42f04fcd2f504537f6749d65721b355a8b7bcaa7..174960a624c1273908a126f63e1b19ca2c789a31 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 3c41a681ef30ae7c05b06c8782aa35af74d164ed..204927028d97bf7f1f2506b55b303a69acfc8368 100644 (file)
@@ -1,4 +1,4 @@
-name=SVCD PAL
+description=SVCD PAL
 frame_rate_num=25
 frame_rate_den=1
 width=480
index e634a4af1b3881ba297249ed7eecfa16ce9b6070..3aea87a402f602dc99532c2e55a2ee611a9c4af1 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 ae70cad65bf7acf86259e94d890b9b6ed2fba565..e58f4f2c37545ae92ffc4bca0603ad8cd250d5b0 100644 (file)
@@ -1,4 +1,4 @@
-name=VCD NTSC
+description=VCD NTSC
 frame_rate_num=30000
 frame_rate_den=1001
 width=352
index e5db06c7332ce316978d0e33186284ba328ea873..5f4e03f887f4d3db457235b5818d41c837943a2b 100644 (file)
@@ -1,4 +1,4 @@
-name=VCD PAL
+description=VCD PAL
 frame_rate_num=25
 frame_rate_den=1
 width=352
index 124526575533c3242c31c14734cf2b1f7999243a..709dc5ebfa09d1033e08ee2d92f5e86205a63b9a 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 176559542a0a697f78f2a1ad9bbc1860d35f9e88..749a2011bb9da9445f7c5078060ebefc6bfe3fe0 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 d32146a3d5c40ab743c91b712ae5fc5dd8590bf7..c9c67d26f6b1b7a4b62731bc35cc7dd9315a1112 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 29ee633d4ba47dd824ace2fa6c09f2045c6e186b..0c64e7c02f21da7c0ded81dc4f0ba42c3554e337 100644 (file)
@@ -25,7 +25,7 @@
 
 struct mlt_profile_s
 {
-       char* name;
+       char* description;
        int frame_rate_num;
        int frame_rate_den;
        int width;