[vlc-commits] demux: avi: fix negative height handling
Francois Cartegnie
git at videolan.org
Fri Apr 18 17:46:25 CEST 2014
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Apr 18 15:34:20 2014 +0200| [0fb61b223940506da0b29b1fa151d2043d1b39fb] | committer: Francois Cartegnie
demux: avi: fix negative height handling
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0fb61b223940506da0b29b1fa151d2043d1b39fb
---
modules/demux/avi/avi.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 82f2157..e8e2a4d 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -149,6 +149,7 @@ typedef struct
unsigned int i_samplesize;
unsigned int i_width_bytes;
+ bool b_flipped;
es_out_id_t *p_es;
@@ -515,6 +516,10 @@ static int Open( vlc_object_t * p_this )
default:
break;
}
+
+ tk->i_width_bytes = p_vids->p_bih->biWidth * (p_vids->p_bih->biBitCount >> 3);
+ /* RGB DIB are coded from bottom to top */
+ if ( p_vids->p_bih->biHeight >= 0 ) tk->b_flipped = true;
}
else
{
@@ -534,10 +539,10 @@ static int Open( vlc_object_t * p_this )
fmt.video.i_frame_rate = tk->i_rate;
fmt.video.i_frame_rate_base = tk->i_scale;
- if ( p_vids->p_bih->biCompression == BI_RAWRGB )
- tk->i_width_bytes = p_vids->p_bih->biWidth * (p_vids->p_bih->biBitCount >> 3);
- else
- tk->i_width_bytes = 0;
+ /* Uncompresse Bitmap or YUV, YUV being always topdown */
+ if ( fmt.video.i_height < 0 )
+ fmt.video.i_height =
+ (unsigned int)(-(int)p_vids->p_bih->biHeight);
avi_chunk_vprp_t *p_vprp = AVI_ChunkFind( p_strl, AVIFOURCC_vprp, 0 );
if( p_vprp )
@@ -565,13 +570,6 @@ static int Open( vlc_object_t * p_this )
p_vids->p_bih->biBitCount,
(float)tk->i_rate/(float)tk->i_scale );
- if( p_vids->p_bih->biCompression == BI_RAWRGB && fmt.video.i_height <= 0 )
- {
- /* RGB DIB are coded from bottom to top */
- fmt.video.i_height =
- (unsigned int)(-(int)p_vids->p_bih->biHeight);
- }
-
/* Extract palette from extradata if bpp <= 8 */
if( fmt.video.i_bits_per_pixel > 0 && fmt.video.i_bits_per_pixel <= 8 )
{
More information about the vlc-commits
mailing list