Commit a8f3c4ca authored by Laurent Aimar's avatar Laurent Aimar

* all: a little compil fix and more sanity checks (needed for wma).

parent a48ec614
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* audio.c: audio decoder using ffmpeg library * audio.c: audio decoder using ffmpeg library
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2003 VideoLAN * Copyright (C) 1999-2003 VideoLAN
* $Id: audio.c,v 1.22 2003/11/16 21:07:30 gbazin Exp $ * $Id: audio.c,v 1.23 2003/11/17 02:52:39 fenrir Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com> * Gildas Bazin <gbazin@netcourrier.com>
...@@ -160,7 +160,7 @@ aout_buffer_t *E_( DecodeAudio )( decoder_t *p_dec, block_t **pp_block ) ...@@ -160,7 +160,7 @@ aout_buffer_t *E_( DecodeAudio )( decoder_t *p_dec, block_t **pp_block )
return NULL; return NULL;
} }
if( !p_block->i_buffer ) if( p_block->i_buffer <= 0 )
{ {
block_Release( p_block ); block_Release( p_block );
return NULL; return NULL;
...@@ -179,6 +179,10 @@ aout_buffer_t *E_( DecodeAudio )( decoder_t *p_dec, block_t **pp_block ) ...@@ -179,6 +179,10 @@ aout_buffer_t *E_( DecodeAudio )( decoder_t *p_dec, block_t **pp_block )
block_Release( p_block ); block_Release( p_block );
return NULL; return NULL;
} }
else if( i_used > p_block->i_buffer )
{
i_used = p_block->i_buffer;
}
p_block->i_buffer -= i_used; p_block->i_buffer -= i_used;
p_block->p_buffer += i_used; p_block->p_buffer += i_used;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* video.c: video decoder using the ffmpeg library * video.c: video decoder using the ffmpeg library
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: video.c,v 1.45 2003/11/16 22:23:47 gbazin Exp $ * $Id: video.c,v 1.46 2003/11/17 02:52:39 fenrir Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com> * Gildas Bazin <gbazin@netcourrier.com>
...@@ -392,7 +392,7 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block ) ...@@ -392,7 +392,7 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
return VLC_SUCCESS; return VLC_SUCCESS;
} }
if( !p_sys->p_context->width || !p_sys->p_context->height ) if( p_sys->p_context->width <= 0 || p_sys->p_context->height <= 0 )
{ {
p_sys->p_context->hurry_up = 5; p_sys->p_context->hurry_up = 5;
} }
...@@ -403,7 +403,7 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block ) ...@@ -403,7 +403,7 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
/* Don't forget that ffmpeg requires a little more bytes /* Don't forget that ffmpeg requires a little more bytes
* that the real frame size */ * that the real frame size */
if( p_block->i_buffer ) if( p_block->i_buffer > 0 )
{ {
p_sys->i_buffer = p_block->i_buffer; p_sys->i_buffer = p_block->i_buffer;
if( p_sys->i_buffer + FF_INPUT_BUFFER_PADDING_SIZE > if( p_sys->i_buffer + FF_INPUT_BUFFER_PADDING_SIZE >
...@@ -424,7 +424,7 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block ) ...@@ -424,7 +424,7 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
p_block->i_buffer = 0; p_block->i_buffer = 0;
} }
while( p_sys->i_buffer ) while( p_sys->i_buffer > 0 )
{ {
int i_used, b_gotpicture; int i_used, b_gotpicture;
picture_t *p_pic; picture_t *p_pic;
...@@ -439,6 +439,10 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block ) ...@@ -439,6 +439,10 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
block_Release( p_block ); block_Release( p_block );
return NULL; return NULL;
} }
else if( i_used > p_sys->i_buffer )
{
i_used = p_sys->i_buffer;
}
/* Consumed bytes */ /* Consumed bytes */
p_sys->i_buffer -= i_used; p_sys->i_buffer -= i_used;
......
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