[vlc-commits] smem: simplifications

Hugo Beauzée-Luyssen git at videolan.org
Tue Mar 4 12:57:34 CET 2014


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Sun Mar  2 14:20:59 2014 +0000| [beb840becf2b78d3dc94ddefdb00037e0dfd93bb] | committer: Jean-Baptiste Kempf

smem: simplifications

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 at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=beb840becf2b78d3dc94ddefdb00037e0dfd93bb
---

 modules/stream_out/smem.c |   31 ++-----------------------------
 1 file changed, 2 insertions(+), 29 deletions(-)

diff --git a/modules/stream_out/smem.c b/modules/stream_out/smem.c
index c9ca2b4..791f9f8 100644
--- a/modules/stream_out/smem.c
+++ b/modules/stream_out/smem.c
@@ -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,



More information about the vlc-commits mailing list