More corrections to frame position and audio/track handling
[melted] / src / modules / core / producer_colour.c
index 415b595..2cc6779 100644 (file)
@@ -45,7 +45,7 @@ mlt_producer producer_colour_init( char *colour )
        
                // Callback registration
                producer->get_frame = producer_get_frame;
-               producer->close = producer_close;
+               producer->close = ( mlt_destructor )producer_close;
 
                // Set the default properties
                mlt_properties_set( properties, "resource", colour == NULL ? "0x000000ff" : colour );
@@ -60,6 +60,9 @@ rgba_color parse_color( char *color )
 {
        rgba_color result = { 0xff, 0xff, 0xff, 0xff };
 
+       if ( strchr( color, '/' ) )
+               color = strrchr( color, '/' ) + 1;
+
        if ( !strncmp( color, "0x", 2 ) )
        {
                unsigned int temp = 0;
@@ -185,6 +188,9 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i
                // Obtain properties of producer
                mlt_properties producer_props = mlt_producer_properties( producer );
 
+               // Determine if we're producing PAL or NTSC
+               int is_pal = mlt_properties_get_double( producer_props, "fps" ) == 25.0;
+
                // Set the producer on the frame properties
                mlt_properties_set_data( properties, "producer_colour", producer, 0, NULL, NULL );
 
@@ -193,10 +199,9 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i
 
                // Set producer-specific frame properties
                mlt_properties_set_int( properties, "progressive", 1 );
-               mlt_properties_set_int( properties, "aspect_ratio", 1 );
+               mlt_properties_set_double( properties, "aspect_ratio", is_pal ? 128.0/117.0 : 72.0/79.0 );
 
                // colour is an alias for resource
-               // CY: Do we really need this?
                if ( mlt_properties_get( producer_props, "colour" ) != NULL )
                        mlt_properties_set( producer_props, "resource", mlt_properties_get( producer_props, "colour" ) );
                
@@ -216,4 +221,3 @@ static void producer_close( mlt_producer producer )
        mlt_producer_close( producer );
        free( producer );
 }
-