Added ffmpeg producer
[melted] / src / modules / sdl / consumer_sdl.c
index f438d26..59a9b02 100644 (file)
@@ -188,6 +188,9 @@ static void *consumer_thread( void *arg )
        // Get the service assoicated to the consumer
        mlt_service service = mlt_consumer_service( consumer );
 
+       // Get the properties of this consumer
+       mlt_properties properties = this->properties;
+
        // Define a frame pointer
        mlt_frame frame;
 
@@ -231,7 +234,7 @@ static void *consumer_thread( void *arg )
                                request.freq = frequency;
                                request.format = AUDIO_S16;
                                request.channels = channels;
-                               request.samples = 1024;
+                               request.samples = 2048;
                                request.callback = sdl_fill_audio;
                                request.userdata = (void *)this;
                                if ( SDL_OpenAudio( &request, NULL ) < 0 )
@@ -269,14 +272,32 @@ static void *consumer_thread( void *arg )
                                                        this->window_height = event.resize.h;
                                                        changed = 1;
                                                        break;
+                                               case SDL_KEYDOWN:
+                                                       {
+                                                               mlt_producer producer = mlt_properties_get_data( properties, "transport_producer", NULL );
+                                                               void (*callback)( mlt_producer, char * ) = mlt_properties_get_data( properties, "transport_callback", NULL );
+                                                               if ( callback != NULL && producer != NULL )
+                                                                       callback( producer, SDL_GetKeyName(event.key.keysym.sym) );
+                                                       }
+                                                       break;
                                        }
                                }
+
+                               if ( width != this->width || height != this->height )
+                               {
+                                       this->width = width;
+                                       this->height = height;
+                                       changed = 1;
+                               }
                        }
 
                        if ( sdl_screen == NULL || changed )
                        {
                                double aspect_ratio = mlt_frame_get_aspect_ratio( frame );
 
+                               if ( mlt_properties_get_double( properties, "aspect_ratio" ) )
+                                       aspect_ratio = mlt_properties_get_double( properties, "aspect_ratio" );
+
                                if ( this->window_width == 0 || this->window_height == 0 )
                                {
                                        this->window_width = width;