src/framework/mlt_frame.c
[melted] / src / framework / mlt_tractor.c
index 120d4fb..094352e 100644 (file)
@@ -215,6 +215,7 @@ static int producer_get_image( mlt_frame this, uint8_t **buffer, mlt_image_forma
        mlt_properties_set_data( properties, "image", *buffer, *width * *height * 2, NULL, NULL );
        mlt_properties_set_int( properties, "width", *width );
        mlt_properties_set_int( properties, "height", *height );
+       mlt_properties_set_int( properties, "format", *format );
        mlt_properties_set_double( properties, "aspect_ratio", mlt_frame_get_aspect_ratio( frame ) );
        mlt_properties_set_int( properties, "progressive", mlt_properties_get_int( frame_properties, "progressive" ) );
        mlt_properties_set_int( properties, "distort", mlt_properties_get_int( frame_properties, "distort" ) );
@@ -298,6 +299,7 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra
                        // We'll store audio and video frames to use here
                        mlt_frame audio = NULL;
                        mlt_frame video = NULL;
+                       mlt_frame first_video = NULL;
 
                        // Temporary properties
                        mlt_properties temp_properties = NULL;
@@ -385,6 +387,13 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra
                                                mlt_deque_push_front( MLT_FRAME_IMAGE_STACK( temp ), video );
                                        }
                                        video = temp;
+                                       if ( first_video == NULL )
+                                               first_video = temp;
+
+                                       // Ensure that all frames know the aspect ratio of the background
+                                       mlt_properties_set_double( temp_properties, "output_ratio", 
+                                                                                          mlt_properties_get_double( MLT_FRAME_PROPERTIES( first_video ), "aspect_ratio" ) );
+
                                        mlt_properties_set_int( MLT_FRAME_PROPERTIES( temp ), "image_count", ++ image_count );
                                        image_count = 1;
                                }
@@ -399,7 +408,7 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra
 
                        if ( video != NULL )
                        {
-                               mlt_properties video_properties = MLT_FRAME_PROPERTIES( video );
+                               mlt_properties video_properties = MLT_FRAME_PROPERTIES( first_video );
                                mlt_frame_push_service( *frame, video );
                                mlt_frame_push_service( *frame, producer_get_image );
                                if ( global_feed )