More corrections to frame position and audio/track handling
[melted] / src / framework / mlt_frame.c
index 4837360..be21562 100644 (file)
@@ -205,7 +205,11 @@ int mlt_frame_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *for
        
        if ( get_image != NULL )
        {
-               return get_image( this, buffer, format, width, height, writable );
+               int error = 0;
+               mlt_position position = mlt_frame_get_position( this );
+               error = get_image( this, buffer, format, width, height, writable );
+               mlt_frame_set_position( this, position );
+               return error;
        }
        else if ( mlt_properties_get_data( properties, "image", NULL ) != NULL )
        {
@@ -228,8 +232,7 @@ int mlt_frame_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *for
                        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( properties, "rescale.interp", "none" );
-                       mlt_properties_set( properties, "scale", "off" );
+                       mlt_properties_set_double( properties, "aspect_ratio", mlt_frame_get_aspect_ratio( test_frame ) );
                }
                else
                {
@@ -308,10 +311,13 @@ uint8_t *mlt_frame_get_alpha_mask( mlt_frame this )
 int mlt_frame_get_audio( mlt_frame this, int16_t **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples )
 {
        mlt_properties properties = mlt_frame_properties( this );
+       int hide = mlt_properties_get_int( properties, "test_audio" );
 
-       if ( this->get_audio != NULL )
+       if ( hide == 0 && this->get_audio != NULL )
        {
+               mlt_position position = mlt_frame_get_position( this );
                this->get_audio( this, buffer, format, frequency, channels, samples );
+               mlt_frame_set_position( this, position );
        }
        else if ( mlt_properties_get_data( properties, "audio", NULL ) )
        {
@@ -395,6 +401,12 @@ unsigned char *mlt_frame_get_waveform( mlt_frame this, int w, int h )
        return bitmap;
 }
 
+mlt_producer mlt_frame_get_original_producer( mlt_frame this )
+{
+       if ( this != NULL )
+               return mlt_properties_get_data( mlt_frame_properties( this ), "_producer", NULL );
+       return NULL;
+}
 
 void mlt_frame_close( mlt_frame this )
 {