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 );
- }
}
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.
*/
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;
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;
}
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" );
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
{
if ( profile )
{
- if ( profile->name )
- free( profile->name );
- profile->name = NULL;
+ if ( profile->description )
+ free( profile->description );
+ profile->description = NULL;
free( profile );
profile = NULL;
}