Minor corrections, rescale=nearest for sdl
[melted] / src / modules / sdl / consumer_sdl.c
index dbd4ff3..3d4f531 100644 (file)
@@ -101,6 +101,9 @@ mlt_consumer consumer_sdl_init( char *arg )
                // Default fps
                mlt_properties_set_double( this->properties, "fps", 25 );
 
+               // Default scaler (for now we'll use nearest)
+               mlt_properties_set( this->properties, "rescale", "nearest" );
+
                // process actual param
                if ( arg == NULL || !strcmp( arg, "PAL" ) )
                {
@@ -251,6 +254,9 @@ static int consumer_play_audio( consumer_sdl this, mlt_frame frame, int init_aud
        int channels = 2;
        int frequency = 48000;
        static int counter = 0;
+       if ( mlt_properties_get_int( properties, "frequency" ) != 0 )
+               frequency =  mlt_properties_get_int( properties, "frequency" );
+
        int samples = mlt_sample_calculator( mlt_properties_get_double( this->properties, "fps" ), frequency, counter++ );
        
        int16_t *pcm;
@@ -300,7 +306,7 @@ static int consumer_play_audio( consumer_sdl this, mlt_frame frame, int init_aud
                while ( bytes > ( sizeof( this->audio_buffer) - this->audio_avail ) )
                        pthread_cond_wait( &this->audio_cond, &this->audio_mutex );
                mlt_properties properties = mlt_frame_properties( frame );
-               if ( mlt_properties_get_double( properties, "speed" ) == 1 )
+               if ( mlt_properties_get_double( properties, "_speed" ) == 1 )
                        memcpy( &this->audio_buffer[ this->audio_avail ], pcm, bytes );
                else
                        memset( &this->audio_buffer[ this->audio_avail ], 0, bytes );
@@ -339,6 +345,9 @@ static int consumer_play_video( consumer_sdl this, mlt_frame frame )
        }
        this->queue[ this->count ++ ] = frame;
 
+       if ( mlt_properties_get( properties, "rescale" ) != NULL )
+               mlt_properties_set( mlt_frame_properties( frame ), "rescale.interp", mlt_properties_get( properties, "rescale" ) );
+
        if ( this->playing )
        {
                // We're working on the oldest frame now