Commit fa94ffd5 authored by Laurent Aimar's avatar Laurent Aimar

all: Use BITMAPINFOHEADER everywhere (Needed because of endian issue).

parent 4961a874
......@@ -2,7 +2,7 @@
* asf.c : ASFv01 file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: asf.c,v 1.6 2002/11/15 18:10:26 fenrir Exp $
* $Id: asf.c,v 1.7 2002/11/19 17:23:21 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -266,11 +266,34 @@ static int Activate( vlc_object_t * p_this )
}
if( p_sp->i_type_specific_data_length > 11 )
{
p_stream->p_es->p_demux_data =
malloc( p_sp->i_type_specific_data_length - 11);
memcpy( p_stream->p_es->p_demux_data,
p_sp->p_type_specific_data + 11,
p_sp->i_type_specific_data_length - 11 );
BITMAPINFOHEADER *p_bih;
int i_size;
uint8_t *p_data;
i_size = p_sp->i_type_specific_data_length - 11;
p_bih = malloc( i_size );
p_stream->p_es->p_demux_data = (void*)p_bih;
p_data = p_sp->p_type_specific_data + 11;
p_bih->biSize = GetDWLE( p_data );
p_bih->biWidth = GetDWLE( p_data + 4 );
p_bih->biHeight = GetDWLE( p_data + 8 );
p_bih->biPlanes = GetDWLE( p_data + 12 );
p_bih->biBitCount = GetDWLE( p_data + 14 );
p_bih->biCompression= GetDWLE( p_data + 16 );
p_bih->biSizeImage = GetDWLE( p_data + 20 );
p_bih->biXPelsPerMeter = GetDWLE( p_data + 24 );
p_bih->biYPelsPerMeter = GetDWLE( p_data + 28 );
p_bih->biClrUsed = GetDWLE( p_data + 32 );
p_bih->biClrImportant = GetDWLE( p_data + 36 );
if( i_size > sizeof( BITMAPINFOHEADER ) )
{
memcpy( (uint8_t*)p_stream->p_es->p_demux_data + sizeof( BITMAPINFOHEADER ),
p_data + sizeof( BITMAPINFOHEADER ),
i_size - sizeof( BITMAPINFOHEADER ) );
}
}
}
......
......@@ -2,7 +2,7 @@
* mp4.c : MP4 file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: mp4.c,v 1.5 2002/11/17 06:46:56 fenrir Exp $
* $Id: mp4.c,v 1.6 2002/11/19 17:23:21 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -30,7 +30,7 @@
#include <vlc/vlc.h>
#include <vlc/input.h>
#include "codecs.h"
#include "libmp4.h"
#include "mp4.h"
......@@ -901,8 +901,9 @@ static void MP4_StartDecoder( input_thread_t *p_input,
int i_decoder_specific_info_len;
uint8_t *p_decoder_specific_info;
uint8_t *p_init;
uint8_t *p_init;
BITMAPINFOHEADER *p_bih;
MP4_Box_t *p_esds;
......@@ -1047,31 +1048,35 @@ static void MP4_StartDecoder( input_thread_t *p_input,
case( VIDEO_ES ):
/* now create a bitmapinfoheader_t for decoder and
add information found in p_esds */
p_init = malloc( 40 + i_decoder_specific_info_len);
memset( p_init, 0, 40 + i_decoder_specific_info_len);
MP4_Set4BytesLE( p_init, 40 + i_decoder_specific_info_len );
if( p_sample->data.p_sample_vide->i_width )
{
MP4_Set4BytesLE( p_init + 4,
p_sample->data.p_sample_vide->i_width );
}
else
p_init = malloc( sizeof( BITMAPINFOHEADER ) + i_decoder_specific_info_len );
p_bih = (BITMAPINFOHEADER*)p_init;
p_bih->biSize = sizeof( BITMAPINFOHEADER ) + i_decoder_specific_info_len;
p_bih->biWidth = p_sample->data.p_sample_vide->i_width;
p_bih->biHeight = p_sample->data.p_sample_vide->i_height;
p_bih->biPlanes = 1; // FIXME
p_bih->biBitCount = 0; // FIXME
p_bih->biCompression = 0; // FIXME
p_bih->biSizeImage = 0; // FIXME
p_bih->biXPelsPerMeter = 0; // FIXME
p_bih->biYPelsPerMeter = 0; // FIXME
p_bih->biClrUsed = 0; // FIXME
p_bih->biClrImportant = 0; // FIXME
if( p_bih->biWidth == 0 )
{
/* use display size */
MP4_Set4BytesLE( p_init + 4, p_demux_track->i_width );
// fall on display size
p_bih->biWidth = p_demux_track->i_width;
}
if( p_sample->data.p_sample_vide->i_height )
if( p_bih->biHeight == 0 )
{
MP4_Set4BytesLE( p_init + 8,
p_sample->data.p_sample_vide->i_height );
}
else
{
MP4_Set4BytesLE( p_init + 8, p_demux_track->i_height );
// fall on display size
p_bih->biHeight = p_demux_track->i_height;
}
if( i_decoder_specific_info_len )
{
memcpy( p_init + 40,
memcpy( p_init + sizeof( BITMAPINFOHEADER ),
p_decoder_specific_info,
i_decoder_specific_info_len);
}
......
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