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