sd_ass: initialize structs for external tracks properly
[mplayer.git] / libmpdemux / ms_hdr.h
blob3d6bc0754507da713585731c7e119f5c5378a581
1 /*
2 * This file is part of MPlayer.
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.
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.
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.
19 #ifndef MPLAYER_MS_HDR_H
20 #define MPLAYER_MS_HDR_H
22 #include "config.h"
24 #ifndef _WAVEFORMATEX_
25 #define _WAVEFORMATEX_
26 typedef struct __attribute__((__packed__)) _WAVEFORMATEX {
27 unsigned short wFormatTag;
28 unsigned short nChannels;
29 unsigned int nSamplesPerSec;
30 unsigned int nAvgBytesPerSec;
31 unsigned short nBlockAlign;
32 unsigned short wBitsPerSample;
33 unsigned short cbSize;
34 } WAVEFORMATEX, *PWAVEFORMATEX, *NPWAVEFORMATEX, *LPWAVEFORMATEX;
35 #endif /* _WAVEFORMATEX_ */
37 #ifndef _WAVEFORMATEXTENSIBLE_
38 #define _WAVEFORMATEXTENSIBLE_
39 typedef struct __attribute__((__packed__)) _WAVEFORMATEXTENSIBLE {
40 WAVEFORMATEX wf;
41 unsigned short wValidBitsPerSample;
42 unsigned int dwChannelMask;
43 unsigned int SubFormat; // Only interested in first 32 bits of guid
44 unsigned int _guid_remainder[3];
45 } WAVEFORMATEXTENSIBLE;
46 #endif /* _WAVEFORMATEXTENSIBLE_ */
48 #ifndef _MPEGLAYER3WAVEFORMAT_
49 #define _MPEGLAYER3WAVEFORMAT_
50 typedef struct __attribute__((__packed__)) mpeglayer3waveformat_tag {
51 WAVEFORMATEX wf;
52 unsigned short wID;
53 unsigned int fdwFlags;
54 unsigned short nBlockSize;
55 unsigned short nFramesPerBlock;
56 unsigned short nCodecDelay;
57 } MPEGLAYER3WAVEFORMAT;
58 #endif /* _MPEGLAYER3WAVEFORMAT_ */
60 /* windows.h #includes wingdi.h on MinGW. */
61 #if !defined(_BITMAPINFOHEADER_) && !defined(_WINGDI_)
62 #define _BITMAPINFOHEADER_
63 typedef struct __attribute__((__packed__))
65 int biSize;
66 int biWidth;
67 int biHeight;
68 short biPlanes;
69 short biBitCount;
70 int biCompression;
71 int biSizeImage;
72 int biXPelsPerMeter;
73 int biYPelsPerMeter;
74 int biClrUsed;
75 int biClrImportant;
76 } BITMAPINFOHEADER, *PBITMAPINFOHEADER, *LPBITMAPINFOHEADER;
77 typedef struct {
78 BITMAPINFOHEADER bmiHeader;
79 int bmiColors[1];
80 } BITMAPINFO, *LPBITMAPINFO;
81 #endif
83 #ifndef le2me_BITMAPINFOHEADER
84 #if HAVE_BIGENDIAN
85 #define le2me_BITMAPINFOHEADER(h) { \
86 (h)->biSize = le2me_32((h)->biSize); \
87 (h)->biWidth = le2me_32((h)->biWidth); \
88 (h)->biHeight = le2me_32((h)->biHeight); \
89 (h)->biPlanes = le2me_16((h)->biPlanes); \
90 (h)->biBitCount = le2me_16((h)->biBitCount); \
91 (h)->biCompression = le2me_32((h)->biCompression); \
92 (h)->biSizeImage = le2me_32((h)->biSizeImage); \
93 (h)->biXPelsPerMeter = le2me_32((h)->biXPelsPerMeter); \
94 (h)->biYPelsPerMeter = le2me_32((h)->biYPelsPerMeter); \
95 (h)->biClrUsed = le2me_32((h)->biClrUsed); \
96 (h)->biClrImportant = le2me_32((h)->biClrImportant); \
98 #define le2me_WAVEFORMATEX(h) { \
99 (h)->wFormatTag = le2me_16((h)->wFormatTag); \
100 (h)->nChannels = le2me_16((h)->nChannels); \
101 (h)->nSamplesPerSec = le2me_32((h)->nSamplesPerSec); \
102 (h)->nAvgBytesPerSec = le2me_32((h)->nAvgBytesPerSec); \
103 (h)->nBlockAlign = le2me_16((h)->nBlockAlign); \
104 (h)->wBitsPerSample = le2me_16((h)->wBitsPerSample); \
105 (h)->cbSize = le2me_16((h)->cbSize); \
107 #else
108 #define le2me_BITMAPINFOHEADER(h) /**/
109 #define le2me_WAVEFORMATEX(h) /**/
110 #endif
111 #endif
113 #endif /* MPLAYER_MS_HDR_H */