[vlc-devel] [PATCH] invmem - fix pitch problem

Robert Paciorek robert at opcode.eu.org
Tue Dec 2 16:18:52 CET 2008


now images with (width%4 != 0) will be shown corectly
---
 modules/codec/invmem.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/codec/invmem.c b/modules/codec/invmem.c
index 848a84b..a02bdbb 100644
--- a/modules/codec/invmem.c
+++ b/modules/codec/invmem.c
@@ -93,8 +93,9 @@ struct decoder_sys_t
 
     int i_width;
     int i_height;
+    int i_pitch;
 
-     picture_t *p_pic
+    picture_t *p_pic
 };
 
 
@@ -157,6 +158,8 @@ static int OpenDecoder( vlc_object_t *p_this )
     p_dec->fmt_out.video.i_bmask = 0x0000ff;
     p_dec->fmt_out.i_cat = VIDEO_ES;
 
+    p_dec->p_sys->i_pitch = p_dec->p_sys->i_width*3 + p_dec->p_sys->i_width%4;
+
     // create new picture
     p_dec->p_sys->p_pic = p_dec->pf_vout_buffer_new( p_dec );
 
@@ -181,7 +184,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     picture_Release( p_dec->p_sys->p_pic );
     p_dec->p_sys->p_pic = p_dec->pf_vout_buffer_new( p_dec );
     p_dec->p_sys->p_pic->b_force = true;
-    p_dec->p_sys->p_pic->p->i_pitch = p_dec->p_sys->i_width*3;
+    p_dec->p_sys->p_pic->p->i_pitch = p_dec->p_sys->i_pitch;
 
    // lock input and copy to picture
     p_dec->p_sys->p_pic->p->p_pixels = p_dec->p_sys->pf_lock( p_dec->p_sys->p_data );
-- 
1.5.6.5




More information about the vlc-devel mailing list