1 /*
2  * This file is part of MPlayer.
3  *
4  * MPlayer is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * MPlayer is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef MPLAYER_MS_HDR_H
20 #define MPLAYER_MS_HDR_H
21 
22 #include "config.h"
23 #include "mppacked.h"
24 
25 #ifndef _WAVEFORMATEX_
26 #define _WAVEFORMATEX_
27 MP_PACKED(
28 typedef struct, _WAVEFORMATEX {
29   unsigned short  wFormatTag;
30   unsigned short  nChannels;
31   unsigned int    nSamplesPerSec;
32   unsigned int    nAvgBytesPerSec;
33   unsigned short  nBlockAlign;
34   unsigned short  wBitsPerSample;
35   unsigned short  cbSize;
36 } WAVEFORMATEX;
37 )
38 typedef WAVEFORMATEX *PWAVEFORMATEX, *NPWAVEFORMATEX, *LPWAVEFORMATEX;
39 #endif /* _WAVEFORMATEX_ */
40 
41 #ifndef _WAVEFORMATEXTENSIBLE_
42 #define _WAVEFORMATEXTENSIBLE_
43 MP_PACKED(
44 typedef struct, _WAVEFORMATEXTENSIBLE {
45     WAVEFORMATEX   wf;
46     unsigned short wValidBitsPerSample;
47     unsigned int   dwChannelMask;
48     unsigned int   SubFormat; // Only interested in first 32 bits of guid
49     unsigned int   _guid_remainder[3];
50 } WAVEFORMATEXTENSIBLE;
51 )
52 #endif /* _WAVEFORMATEXTENSIBLE_ */
53 
54 #ifndef _MPEGLAYER3WAVEFORMAT_
55 #define _MPEGLAYER3WAVEFORMAT_
56 MP_PACKED(
57 typedef struct, mpeglayer3waveformat_tag {
58   WAVEFORMATEX wf;
59   unsigned short wID;
60   unsigned int   fdwFlags;
61   unsigned short nBlockSize;
62   unsigned short nFramesPerBlock;
63   unsigned short nCodecDelay;
64 } MPEGLAYER3WAVEFORMAT;
65 )
66 #endif /* _MPEGLAYER3WAVEFORMAT_ */
67 
68 /* windows.h #includes wingdi.h on MinGW. */
69 #if !defined(_BITMAPINFOHEADER_) && !defined(_WINGDI_)
70 #define _BITMAPINFOHEADER_
71 MP_PACKED(
72 typedef struct,
73 {
74     int 	biSize;
75     int  	biWidth;
76     int  	biHeight;
77     short 	biPlanes;
78     short 	biBitCount;
79     int 	biCompression;
80     int 	biSizeImage;
81     int  	biXPelsPerMeter;
82     int  	biYPelsPerMeter;
83     int 	biClrUsed;
84     int 	biClrImportant;
85 } BITMAPINFOHEADER;
86 )
87 typedef BITMAPINFOHEADER *PBITMAPINFOHEADER, *LPBITMAPINFOHEADER;
88 typedef struct {
89 	BITMAPINFOHEADER bmiHeader;
90 	int	bmiColors[1];
91 } BITMAPINFO, *LPBITMAPINFO;
92 #endif
93 
94 #ifndef le2me_BITMAPINFOHEADER
95 #if HAVE_BIGENDIAN
96 #define le2me_BITMAPINFOHEADER(h) {					\
97     (h)->biSize = le2me_32((h)->biSize);				\
98     (h)->biWidth = le2me_32((h)->biWidth);				\
99     (h)->biHeight = le2me_32((h)->biHeight);				\
100     (h)->biPlanes = le2me_16((h)->biPlanes);				\
101     (h)->biBitCount = le2me_16((h)->biBitCount);			\
102     (h)->biCompression = le2me_32((h)->biCompression);			\
103     (h)->biSizeImage = le2me_32((h)->biSizeImage);			\
104     (h)->biXPelsPerMeter = le2me_32((h)->biXPelsPerMeter);		\
105     (h)->biYPelsPerMeter = le2me_32((h)->biYPelsPerMeter);		\
106     (h)->biClrUsed = le2me_32((h)->biClrUsed);				\
107     (h)->biClrImportant = le2me_32((h)->biClrImportant);		\
108 }
109 #define le2me_WAVEFORMATEX(h) {						\
110     (h)->wFormatTag = le2me_16((h)->wFormatTag);			\
111     (h)->nChannels = le2me_16((h)->nChannels);				\
112     (h)->nSamplesPerSec = le2me_32((h)->nSamplesPerSec);		\
113     (h)->nAvgBytesPerSec = le2me_32((h)->nAvgBytesPerSec);		\
114     (h)->nBlockAlign = le2me_16((h)->nBlockAlign);			\
115     (h)->wBitsPerSample = le2me_16((h)->wBitsPerSample);		\
116     (h)->cbSize = le2me_16((h)->cbSize);				\
117 }
118 #else
119 #define le2me_BITMAPINFOHEADER(h)   /**/
120 #define le2me_WAVEFORMATEX(h)	    /**/
121 #endif
122 #endif
123 
124 #endif /* MPLAYER_MS_HDR_H */
125