]> git.sesse.net Git - vlc/commitdiff
smem: simplifications
authorHugo Beauzée-Luyssen <hugo@beauzee.fr>
Sun, 2 Mar 2014 14:20:59 +0000 (14:20 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Tue, 4 Mar 2014 11:57:32 +0000 (12:57 +0100)
This patch removes a calculation which seems not to be required.
It also "fixes" potential issues when i_visible_width/height != i_width/height.

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/stream_out/smem.c

index c9ca2b433c56ff4b82560081b07f6d3a05fc7517..791f9f86aa20e2d080cdcf0b7d047c40f9f41a23 100644 (file)
@@ -312,21 +312,9 @@ static int SendVideo( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
                       block_t *p_buffer )
 {
     sout_stream_sys_t *p_sys = p_stream->p_sys;
-    int i_line, i_line_size, i_pixel_pitch;
-    size_t i_size;
+    size_t i_size = p_buffer->i_buffer;
     uint8_t* p_pixels = NULL;
 
-    if( id->format->video.i_bits_per_pixel > 0 )
-    {
-        i_line = id->format->video.i_height;
-        i_pixel_pitch = id->format->video.i_bits_per_pixel / 8;
-        i_line_size = i_pixel_pitch * id->format->video.i_width;
-        i_size = i_line * i_line_size;
-    }
-    else
-    {
-        i_size = p_buffer->i_buffer;
-    }
     /* Calling the prerender callback to get user buffer */
     p_sys->pf_video_prerender_callback( id->p_data, &p_pixels, i_size );
 
@@ -338,22 +326,7 @@ static int SendVideo( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
     }
 
     /* Copying data into user buffer */
-    if( id->format->video.i_bits_per_pixel > 0 )
-    {
-        uint8_t *p_in = p_buffer->p_buffer;
-        uint8_t *p_out = p_pixels;
-
-        for ( int line = 0; line < i_line; line++ )
-        {
-            memcpy( p_out, p_in, i_line_size );
-            p_out += i_line_size;
-            p_in += i_line_size;
-        }
-    }
-    else
-    {
-        memcpy( p_pixels, p_buffer->p_buffer, i_size );
-    }
+    memcpy( p_pixels, p_buffer->p_buffer, i_size );
     /* Calling the postrender callback to tell the user his buffer is ready */
     p_sys->pf_video_postrender_callback( id->p_data, p_pixels,
                                          id->format->video.i_width, id->format->video.i_height,