ppm ffmpeg
[melted] / src / modules / sdl / consumer_sdl.c
index c685296..cf02c73 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 = 512;
                                request.callback = sdl_fill_audio;
                                request.userdata = (void *)this;
                                if ( SDL_OpenAudio( &request, NULL ) < 0 )
@@ -269,6 +272,14 @@ 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;
                                        }
                                }
                        }
@@ -309,7 +320,7 @@ static void *consumer_thread( void *arg )
                                        if ( sdl_overlay != NULL )
                                                SDL_FreeYUVOverlay( sdl_overlay );
                                        sdl_lock_display();
-                                       sdl_overlay = SDL_CreateYUVOverlay( width, height, SDL_YUY2_OVERLAY, sdl_screen );
+                                       sdl_overlay = SDL_CreateYUVOverlay( this->width, this->height, SDL_YUY2_OVERLAY, sdl_screen );
                                        sdl_unlock_display();
                                }
                        }
@@ -321,7 +332,7 @@ static void *consumer_thread( void *arg )
                                {
                                        if ( SDL_LockYUVOverlay( sdl_overlay ) >= 0 )
                                        {
-                                               memcpy( buffer, image, width * height * 2 );
+                                               mlt_resize_yuv422( buffer, this->width, this->height, image, width, height );
                                                SDL_UnlockYUVOverlay( sdl_overlay );
                                                SDL_DisplayYUVOverlay( sdl_overlay, &sdl_screen->clip_rect );
                                        }