Commit beb840be authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen Committed by 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's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 12f3ef00
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment