Commit 0fb61b22 authored by Francois Cartegnie's avatar Francois Cartegnie

demux: avi: fix negative height handling

parent 214add2f
...@@ -149,6 +149,7 @@ typedef struct ...@@ -149,6 +149,7 @@ typedef struct
unsigned int i_samplesize; unsigned int i_samplesize;
unsigned int i_width_bytes; unsigned int i_width_bytes;
bool b_flipped;
es_out_id_t *p_es; es_out_id_t *p_es;
...@@ -515,6 +516,10 @@ static int Open( vlc_object_t * p_this ) ...@@ -515,6 +516,10 @@ static int Open( vlc_object_t * p_this )
default: default:
break; 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 else
{ {
...@@ -534,10 +539,10 @@ static int Open( vlc_object_t * p_this ) ...@@ -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 = tk->i_rate;
fmt.video.i_frame_rate_base = tk->i_scale; fmt.video.i_frame_rate_base = tk->i_scale;
if ( p_vids->p_bih->biCompression == BI_RAWRGB ) /* Uncompresse Bitmap or YUV, YUV being always topdown */
tk->i_width_bytes = p_vids->p_bih->biWidth * (p_vids->p_bih->biBitCount >> 3); if ( fmt.video.i_height < 0 )
else fmt.video.i_height =
tk->i_width_bytes = 0; (unsigned int)(-(int)p_vids->p_bih->biHeight);
avi_chunk_vprp_t *p_vprp = AVI_ChunkFind( p_strl, AVIFOURCC_vprp, 0 ); avi_chunk_vprp_t *p_vprp = AVI_ChunkFind( p_strl, AVIFOURCC_vprp, 0 );
if( p_vprp ) if( p_vprp )
...@@ -565,13 +570,6 @@ static int Open( vlc_object_t * p_this ) ...@@ -565,13 +570,6 @@ static int Open( vlc_object_t * p_this )
p_vids->p_bih->biBitCount, p_vids->p_bih->biBitCount,
(float)tk->i_rate/(float)tk->i_scale ); (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 */ /* Extract palette from extradata if bpp <= 8 */
if( fmt.video.i_bits_per_pixel > 0 && fmt.video.i_bits_per_pixel <= 8 ) if( fmt.video.i_bits_per_pixel > 0 && fmt.video.i_bits_per_pixel <= 8 )
{ {
......
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