From: Miguel F. <mig...@us...> - 2002-06-03 16:20:39
|
Update of /cvsroot/xine/xine-lib/src/xine-engine In directory usw-pr-cvs1:/tmp/cvs-serv16408/xine-engine Modified Files: buffer.h buffer_types.c Log Message: provide function to convert endianess of BITMAPINFOHEADER (when reading data from win32/MS format files) Index: buffer.h =================================================================== RCS file: /cvsroot/xine/xine-lib/src/xine-engine/buffer.h,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- buffer.h 3 Jun 2002 13:31:12 -0000 1.46 +++ buffer.h 3 Jun 2002 16:20:36 -0000 1.47 @@ -259,7 +259,11 @@ char * buf_audio_name( uint32_t buf_type ); -/* this version of BITMAPINFOHEADER should be safe to compile on 64bits machines */ +/* this is xine version of BITMAPINFOHEADER + * - should be safe to compile on 64bits machines + * - will always use machine endian format, so demuxers reading + * stuff from win32 formats must use the function below. + */ typedef struct { int32_t biSize; int32_t biWidth; @@ -273,6 +277,9 @@ int32_t biClrUsed; int32_t biClrImportant; } xine_bmiheader; + +/* convert xine_bmiheader struct from little endian */ +void xine_bmiheader_le2me( xine_bmiheader *bih ); #ifdef __cplusplus Index: buffer_types.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/xine-engine/buffer_types.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- buffer_types.c 3 Jun 2002 13:31:13 -0000 1.19 +++ buffer_types.c 3 Jun 2002 16:20:36 -0000 1.20 @@ -36,7 +36,7 @@ #include <stdlib.h> #include <inttypes.h> #include "buffer.h" - +#include "bswap.h" #ifndef mmioFOURCC #define mmioFOURCC( ch0, ch1, ch2, ch3 ) \ @@ -630,4 +630,20 @@ } return "unknow"; +} + +void xine_bmiheader_le2me( xine_bmiheader *bih ) { + + bih->biSize = le2me_32(bih->biSize); + bih->biWidth = le2me_32(bih->biWidth); + bih->biHeight = le2me_32(bih->biHeight); + bih->biPlanes = le2me_16(bih->biPlanes); + bih->biBitCount = le2me_16(bih->biBitCount); + /* do not change byte order of fourcc */ + /* bih->biCompression = le2me_32(bih->biCompression); */ + bih->biSizeImage = le2me_32(bih->biSizeImage); + bih->biXPelsPerMeter = le2me_32(bih->biXPelsPerMeter); + bih->biYPelsPerMeter = le2me_32(bih->biYPelsPerMeter); + bih->biClrUsed = le2me_32(bih->biClrUsed); + bih->biClrImportant = le2me_32(bih->biClrImportant); } |