]> git.sesse.net Git - mlt/commitdiff
Revert "change sdl consumer to use yuv420p"
authorDan Dennedy <dan@dennedy.org>
Fri, 14 Sep 2012 15:55:02 +0000 (08:55 -0700)
committerDan Dennedy <dan@dennedy.org>
Fri, 14 Sep 2012 15:55:02 +0000 (08:55 -0700)
This reverts commit ac034ef73a340fe3402968a7b3a3f69de4a3c53a.

Conflicts:
src/modules/sdl/consumer_sdl.c

src/modules/sdl/consumer_sdl.c

index 3f92a3094ce105038460210a0952ca68fc6f2c1f..4ff9c582b95abd0e0075c74974e2d02814b7b306 100644 (file)
@@ -65,6 +65,7 @@ struct consumer_sdl_s
        SDL_Surface *sdl_screen;
        SDL_Overlay *sdl_overlay;
        SDL_Rect rect;
+       uint8_t *buffer;
        int bpp;
 };
 
@@ -116,6 +117,7 @@ mlt_consumer consumer_sdl_init( mlt_profile profile, mlt_service_type type, cons
                // Default scaler (for now we'll use nearest)
                mlt_properties_set( this->properties, "rescale", "nearest" );
                mlt_properties_set( this->properties, "deinterlace_method", "onefield" );
+               mlt_properties_set_int( this->properties, "top_field_first", -1 );
 
                // Default buffer for low latency
                mlt_properties_set_int( this->properties, "buffer", 1 );
@@ -123,10 +125,6 @@ mlt_consumer consumer_sdl_init( mlt_profile profile, mlt_service_type type, cons
                // Default audio buffer
                mlt_properties_set_int( this->properties, "audio_buffer", 2048 );
 
-               // Tell render thread we prefer yuv420p
-               mlt_properties_set( this->properties, "mlt_image_format", "yuv420p" );
-               mlt_properties_set_int( this->properties, "top_field_first", -1 );
-
                // Ensure we don't join on a non-running object
                this->joined = 1;
                
@@ -500,7 +498,7 @@ static int consumer_play_video( consumer_sdl this, mlt_frame frame )
        // Get the properties of this consumer
        mlt_properties properties = this->properties;
 
-       mlt_image_format vfmt = mlt_image_yuv420p;
+       mlt_image_format vfmt = mlt_image_yuv422;
        int width = this->width, height = this->height;
        uint8_t *image;
        int changed = 0;
@@ -648,21 +646,16 @@ static int consumer_play_video( consumer_sdl this, mlt_frame frame )
                if ( this->running && this->sdl_screen != NULL && this->sdl_overlay == NULL )
                {
                        SDL_SetClipRect( this->sdl_screen, &this->rect );
-                       this->sdl_overlay = SDL_CreateYUVOverlay( width, height, SDL_YV12_OVERLAY, this->sdl_screen );
+                       this->sdl_overlay = SDL_CreateYUVOverlay( width, height, SDL_YUY2_OVERLAY, this->sdl_screen );
                }
 
                if ( this->running && this->sdl_screen != NULL && this->sdl_overlay != NULL )
                {
+                       this->buffer = this->sdl_overlay->pixels[ 0 ];
                        if ( SDL_LockYUVOverlay( this->sdl_overlay ) >= 0 )
                        {
                                if ( image != NULL )
-                               {
-                                       int img_sz = width * height;
-                                       int quarter_img_sz = width * height / 4;
-                                       memcpy( this->sdl_overlay->pixels[ 0 ], image, img_sz );
-                                       memcpy( this->sdl_overlay->pixels[ 2 ], image + img_sz, quarter_img_sz );
-                                       memcpy( this->sdl_overlay->pixels[ 1 ], image + img_sz + quarter_img_sz, quarter_img_sz );
-                               }
+                                       memcpy( this->buffer, image, width * height * 2 );
                                SDL_UnlockYUVOverlay( this->sdl_overlay );
                                SDL_DisplayYUVOverlay( this->sdl_overlay, &this->sdl_screen->clip_rect );
                        }