[MPlayer-dev-eng] [PATCH] loader - platform independent structures

Dominik Mierzejewski dominik at rangers.eu.org
Sat Dec 28 20:23:46 CET 2002


Not so long ago we discussed one of my warning patches with A'rpi and he
suggested fixing some structures in the loader to use platform independent
int types. Here's a patch that does this, following the definitions in
avifile's headers.

-- 
MPlayer RPMs maintainer: http://www.piorunek.pl/~dominik/linux/pkgs/mplayer/
"The Universe doesn't give you any points for doing things that are easy."
        -- Sheridan to Garibaldi in Babylon 5:"The Geometry of Shadows"
-------------- next part --------------
--- MPlayer-20021216/loader/wine/mmreg.h.loader	Fri Sep 13 21:43:17 2002
+++ MPlayer-20021216/loader/wine/mmreg.h	Mon Dec 16 15:26:39 2002
@@ -12,6 +12,7 @@
 #ifndef _ACM_WAVEFILTER
 #define _ACM_WAVEFILTER
 
+#include <inttypes.h>
 #include "windef.h"
 
 #define WAVE_FILTER_UNKNOWN     0x0000
@@ -47,13 +48,13 @@
 #ifndef _WAVEFORMATEX_
 #define _WAVEFORMATEX_
 typedef struct __attribute__((__packed__)) _WAVEFORMATEX {
-  WORD   wFormatTag;
-  WORD   nChannels;
-  DWORD  nSamplesPerSec;
-  DWORD  nAvgBytesPerSec;
-  WORD   nBlockAlign;
-  WORD   wBitsPerSample;
-  WORD   cbSize;
+  uint16_t wFormatTag;
+  uint16_t nChannels;
+  uint32_t nSamplesPerSec;
+  uint32_t nAvgBytesPerSec;
+  uint16_t nBlockAlign;
+  uint16_t wBitsPerSample;
+  uint16_t cbSize;
 } WAVEFORMATEX, *PWAVEFORMATEX, *NPWAVEFORMATEX, *LPWAVEFORMATEX;
 #endif /* _WAVEFORMATEX_ */
 
@@ -61,10 +62,10 @@
 #define GUID_TYPE
 typedef struct
 {
-    unsigned long f1;
-    unsigned short f2;
-    unsigned short f3;
-    unsigned char f4[8];
+    uint32_t f1;
+    uint16_t f2;
+    uint16_t f3;
+    uint8_t  f4[8];
 } GUID;
 #endif
 
@@ -73,29 +74,29 @@
 typedef struct {
     WAVEFORMATEX    Format;
     union {
-        WORD wValidBitsPerSample;       /* bits of precision  */
-        WORD wSamplesPerBlock;          /* valid if wBitsPerSample==0 */
-        WORD wReserved;                 /* If neither applies, set to zero. */
+        uint16_t wValidBitsPerSample;       /* bits of precision  */
+        uint16_t wSamplesPerBlock;          /* valid if wBitsPerSample==0 */
+        uint16_t wReserved;                 /* If neither applies, set to zero. */
     } Samples;
-    DWORD           dwChannelMask;      /* which channels are */
+    uint32_t        dwChannelMask;      /* which channels are */
                                         /* present in stream  */
     GUID            SubFormat;
 } WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE;
 #endif // !_WAVEFORMATEXTENSIBLE_
 
 typedef struct mpeglayer3waveformat_tag {
-  WORD   wFormatTag WINE_PACKED;
-  WORD   nChannels WINE_PACKED;
-  DWORD  nSamplesPerSec WINE_PACKED;
-  DWORD  nAvgBytesPerSec WINE_PACKED;
-  WORD   nBlockAlign WINE_PACKED;
-  WORD   wBitsPerSample WINE_PACKED;
-  WORD   cbSize WINE_PACKED;
-  WORD          wID WINE_PACKED;
-  DWORD         fdwFlags WINE_PACKED;
-  WORD          nBlockSize WINE_PACKED;
-  WORD          nFramesPerBlock WINE_PACKED;
-  WORD          nCodecDelay WINE_PACKED;
+  uint16_t wFormatTag WINE_PACKED;
+  uint16_t nChannels WINE_PACKED;
+  uint32_t nSamplesPerSec WINE_PACKED;
+  uint32_t nAvgBytesPerSec WINE_PACKED;
+  uint16_t nBlockAlign WINE_PACKED;
+  uint16_t wBitsPerSample WINE_PACKED;
+  uint16_t cbSize WINE_PACKED;
+  uint16_t      wID WINE_PACKED;
+  uint32_t      fdwFlags WINE_PACKED;
+  uint16_t      nBlockSize WINE_PACKED;
+  uint16_t      nFramesPerBlock WINE_PACKED;
+  uint16_t      nCodecDelay WINE_PACKED;
 } MPEGLAYER3WAVEFORMAT;
 
 /* WAVE form wFormatTag IDs */
--- MPlayer-20021216/loader/wine/vfw.h.loader	Wed Oct  9 15:16:27 2002
+++ MPlayer-20021216/loader/wine/vfw.h	Mon Dec 16 15:26:39 2002
@@ -1,6 +1,7 @@
 #ifndef __WINE_VFW_H
 #define __WINE_VFW_H
 //#include "pshpack1.h"
+#include <inttypes.h>
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -19,21 +20,21 @@
 #define _BITMAPINFOHEADER_
 typedef struct __attribute__((__packed__))
 {
-    int 	biSize;
-    int  	biWidth;
-    int  	biHeight;
-    short 	biPlanes;
-    short 	biBitCount;
-    int 	biCompression;
-    int 	biSizeImage;
-    int  	biXPelsPerMeter;
-    int  	biYPelsPerMeter;
-    int 	biClrUsed;
-    int 	biClrImportant;
+    uint32_t	biSize;
+    uint32_t	biWidth;
+    int32_t	biHeight;
+    uint16_t	biPlanes;
+    uint16_t	biBitCount;
+    uint32_t	biCompression;
+    uint32_t	biSizeImage;
+    uint32_t	biXPelsPerMeter;
+    uint32_t	biYPelsPerMeter;
+    uint32_t	biClrUsed;
+    uint32_t	biClrImportant;
 } BITMAPINFOHEADER, *PBITMAPINFOHEADER, *LPBITMAPINFOHEADER;
 typedef struct {
 	BITMAPINFOHEADER bmiHeader;
-	int	bmiColors[1];
+	uint32_t bmiColors[1];
 } BITMAPINFO, *LPBITMAPINFO;
 #endif
 


More information about the MPlayer-dev-eng mailing list