/*****************************************************************************
* cinepak.c: cinepak video decoder
*****************************************************************************
- * Copyright (C) 1999-2001 VideoLAN (Centrale Réseaux) and its contributors
+ * Copyright (C) 1999-2001 the VideoLAN team
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <vlc/vlc.h>
-#include <vlc/vout.h>
-#include <vlc/decoder.h>
+#include <vlc_vout.h>
+#include <vlc_codec.h>
/*****************************************************************************
* Module descriptor
msg_Dbg( p_dec, "cinepak decoder stopped" );
for( i = 0; i < 3; i++ )
- {
- if( p_sys->context.p_pix[i] ) free( p_sys->context.p_pix[i] );
- }
+ free( p_sys->context.p_pix[i] );
free( p_sys );
}
#define GET4BYTES( p ) \
GetDWBE( p ); p+= 4;
-#define FREE( p ) \
- if( p ) free( p )
-
static void cinepak_LoadCodebook( cinepak_codebook_t *p_codebook,
uint8_t *p_data, int b_grayscale )
{
static void cinepak_Getv4( cinepak_context_t *p_context,
int i_strip, int i_x, int i_y,
- int i_x2, int i_y2, uint8_t *p_data )
+ uint8_t *p_data )
{
uint8_t i_index[4];
int i,j;
static void cinepak_Getv1( cinepak_context_t *p_context,
int i_strip, int i_x, int i_y,
- int i_x2, int i_y2, uint8_t *p_data )
+ uint8_t *p_data )
{
uint8_t i_index;
int i,j;
i_height = GET2BYTES( p_data );
i_frame_strips = GET2BYTES( p_data );
- if( !i_frame_size || !i_width || !i_height )
+ if( !i_frame_size || !i_width || !i_height ||
+ i_width > 0xffff-3 || i_height > 0xffff-3)
{
/* Broken header */
return( -1 );
int i;
for( i = 0; i < 3; i++ )
{
- FREE( p_context->p_pix[i] );
+ free( p_context->p_pix[i] );
}
p_context->i_width = i_width;
i_strip_id = GET2BYTES( p_data );
i_strip_size = GET2BYTES( p_data );
i_strip_size = __MIN( i_strip_size, i_length );
- /* FIXME I don't really understand how it's work; */
+ /* FIXME I don't really understand how it works; */
i_strip_y1 = i_strip_y2 + GET2BYTES( p_data );
i_strip_x1 = GET2BYTES( p_data );
i_strip_y2 = i_strip_y2 + GET2BYTES( p_data );
i_strip,
i_strip_x1 + i_x,
i_strip_y1 + i_y,
- i_strip_x2, i_strip_y2,
p_data );
p_data += 4;
i_chunk_size -= 4;
i_strip,
i_strip_x1 + i_x,
i_strip_y1 + i_y,
- i_strip_x2, i_strip_y2,
p_data );
p_data++;
i_chunk_size--;
i_strip,
i_strip_x1 + i_x,
i_strip_y1 + i_y,
- i_strip_x2, i_strip_y2,
p_data );
p_data += 4;
i_chunk_size -= 4;
i_strip,
i_strip_x1 + i_x,
i_strip_y1 + i_y,
- i_strip_x2, i_strip_y2,
p_data );
p_data++;
i_chunk_size--;
i_strip,
i_strip_x1 + i_x,
i_strip_y1 + i_y,
- i_strip_x2, i_strip_y2,
p_data );
p_data++;
i_chunk_size--;