summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2002-06-03 16:20:35 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2002-06-03 16:20:35 +0000
commit07edb89ff5d2484e0549992dc9d3e4ea7727dc89 (patch)
tree4c40cfe6079fd0874e48893f896b951505bb7f9e /src
parent4849b574232233c801f244406b7cd16a0e52add3 (diff)
downloadxine-lib-07edb89ff5d2484e0549992dc9d3e4ea7727dc89.tar.gz
xine-lib-07edb89ff5d2484e0549992dc9d3e4ea7727dc89.tar.bz2
provide function to convert endianess of BITMAPINFOHEADER (when reading data from
win32/MS format files) CVS patchset: 1998 CVS date: 2002/06/03 16:20:35
Diffstat (limited to 'src')
-rw-r--r--src/demuxers/demux_asf.c3
-rw-r--r--src/demuxers/demux_avi.c8
-rw-r--r--src/xine-engine/buffer.h11
-rw-r--r--src/xine-engine/buffer_types.c20
4 files changed, 34 insertions, 8 deletions
diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c
index ca28d2037..2625eb02b 100644
--- a/src/demuxers/demux_asf.c
+++ b/src/demuxers/demux_asf.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: demux_asf.c,v 1.41 2002/06/03 13:31:13 miguelfreitas Exp $
+ * $Id: demux_asf.c,v 1.42 2002/06/03 16:20:35 miguelfreitas Exp $
*
* demultiplexer for asf streams
*
@@ -529,6 +529,7 @@ static int asf_read_header (demux_asf_t *this) {
this->bih_size = get_le16(this); /* size */
this->input->read (this->input, (uint8_t *) this->bih, this->bih_size);
+ xine_bmiheader_le2me( (xine_bmiheader *) this->bih );
asf_send_video_header (this, stream_id);
#ifdef LOG
diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c
index a217e84f2..68c45da3c 100644
--- a/src/demuxers/demux_avi.c
+++ b/src/demuxers/demux_avi.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: demux_avi.c,v 1.91 2002/06/03 13:31:13 miguelfreitas Exp $
+ * $Id: demux_avi.c,v 1.92 2002/06/03 16:20:36 miguelfreitas Exp $
*
* demultiplexer for avi streams
*
@@ -729,9 +729,11 @@ static avi_t *AVI_init(demux_avi_t *this) {
if(lasttag == 1) {
/* printf ("size : %d\n",sizeof(AVI->bih)); */
memcpy (&AVI->bih, hdrl_data+i, sizeof(AVI->bih));
+ xine_bmiheader_le2me( &AVI->bih );
+
/* stream_read(demuxer->stream,(char*) &avi_header.bih,MIN(size2,sizeof(avi_header.bih))); */
- AVI->width = str2ulong(hdrl_data+i+4);
- AVI->height = str2ulong(hdrl_data+i+8);
+ AVI->width = AVI->bih.biWidth;
+ AVI->height = AVI->bih.biHeight;
/*
printf ("size : %d x %d (%d x %d)\n", AVI->width, AVI->height, AVI->bih.biWidth, AVI->bih.biHeight);
diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h
index e893a41ff..5a49f02db 100644
--- a/src/xine-engine/buffer.h
+++ b/src/xine-engine/buffer.h
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: buffer.h,v 1.46 2002/06/03 13:31:12 miguelfreitas Exp $
+ * $Id: buffer.h,v 1.47 2002/06/03 16:20:36 miguelfreitas Exp $
*
*
* contents:
@@ -259,7 +259,11 @@ uint32_t formattag_to_buf_audio( uint32_t formattag );
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;
@@ -274,6 +278,9 @@ typedef struct {
int32_t biClrImportant;
} xine_bmiheader;
+/* convert xine_bmiheader struct from little endian */
+void xine_bmiheader_le2me( xine_bmiheader *bih );
+
#ifdef __cplusplus
}
diff --git a/src/xine-engine/buffer_types.c b/src/xine-engine/buffer_types.c
index f487d64fc..e5a5b91c2 100644
--- a/src/xine-engine/buffer_types.c
+++ b/src/xine-engine/buffer_types.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: buffer_types.c,v 1.19 2002/06/03 13:31:13 miguelfreitas Exp $
+ * $Id: buffer_types.c,v 1.20 2002/06/03 16:20:36 miguelfreitas Exp $
*
*
* contents:
@@ -36,7 +36,7 @@
#include <stdlib.h>
#include <inttypes.h>
#include "buffer.h"
-
+#include "bswap.h"
#ifndef mmioFOURCC
#define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
@@ -631,3 +631,19 @@ int i;
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);
+}