source: trunk/src/gui/kernel/qsound_pm.cpp@ 599

Last change on this file since 599 was 564, checked in by Dmitry A. Kuminov, 16 years ago

general: Updated headers of OS/2 sources.

File size: 28.0 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** Copyright (C) 2009 netlabs.org. OS/2 parts.
8**
9** This file is part of the QtGui module of the Qt Toolkit.
10**
11** $QT_BEGIN_LICENSE:LGPL$
12** Commercial Usage
13** Licensees holding valid Qt Commercial licenses may use this file in
14** accordance with the Qt Commercial License Agreement provided with the
15** Software or, alternatively, in accordance with the terms contained in
16** a written agreement between you and Nokia.
17**
18** GNU Lesser General Public License Usage
19** Alternatively, this file may be used under the terms of the GNU Lesser
20** General Public License version 2.1 as published by the Free Software
21** Foundation and appearing in the file LICENSE.LGPL included in the
22** packaging of this file. Please review the following information to
23** ensure the GNU Lesser General Public License version 2.1 requirements
24** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25**
26** In addition, as a special exception, Nokia gives you certain additional
27** rights. These rights are described in the Nokia Qt LGPL Exception
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29**
30** GNU General Public License Usage
31** Alternatively, this file may be used under the terms of the GNU
32** General Public License version 3.0 as published by the Free Software
33** Foundation and appearing in the file LICENSE.GPL included in the
34** packaging of this file. Please review the following information to
35** ensure the GNU General Public License version 3.0 requirements will be
36** met: http://www.gnu.org/copyleft/gpl.html.
37**
38** If you have questions regarding the use of this file, please contact
39** Nokia at [email protected].
40** $QT_END_LICENSE$
41**
42****************************************************************************/
43
44#include "qsound.h"
45
46#ifndef QT_NO_SOUND
47
48#include "qapplication.h"
49#include "qapplication_p.h"
50#include <qfile.h>
51#include "qsound_p.h"
52
53#include "qlist.h"
54#include "qhash.h"
55#include "qlibrary.h"
56
57#include <qt_os2.h>
58
59#include <stdlib.h> // for getenv()
60
61//#define QT_QSOUND_DEBUG
62
63// local QT_DEBUG override, must be placed *after* all includes
64#if defined(QT_QSOUND_DEBUG) && !defined(QT_DEBUG)
65# define QT_DEBUG
66#endif
67
68QT_BEGIN_NAMESPACE
69
70////////////////////////////////////////////////////////////////////////////////
71
72//#define INCL_MCIOS2
73//#define INCL_MMIOOS2
74//#include <os2me.h>
75
76// The below definitions are stolen from the OS/2 Toolkit 4.5 headers
77// to avoid the requirement of having the Toolkit installed when building Qt
78// and let it directly link to mdm.dll and mmio.dll.
79
80typedef ULONG HMMIO; /* Handle to an MMIO object*/
81
82typedef ULONG FOURCC;
83
84typedef LONG (APIENTRY MMIOPROC) /* Format must */
85 (PVOID pmmioinfo, /* appear this */
86 USHORT usMsg, /* way for h2inc */
87 LONG lParam1, /* to work properly. */
88 LONG lParam2);
89
90typedef MMIOPROC FAR *PMMIOPROC;
91
92typedef struct _MMIOINFO { /* mmioinfo */
93 ULONG ulFlags; /* Open flags */
94 FOURCC fccIOProc; /* FOURCC of the IOProc to use */
95 PMMIOPROC pIOProc; /* Function Pointer to IOProc to use */
96 ULONG ulErrorRet; /* Extended Error return code */
97 LONG cchBuffer; /* I/O buff size (if used), Fsize if MEM */
98 PCHAR pchBuffer; /* Start of I/O buff */
99 PCHAR pchNext; /* Next char to read or write in buff */
100 PCHAR pchEndRead; /* Last char in buff can be read + 1 */
101 PCHAR pchEndWrite; /* Last char in buff can be written + 1 */
102 LONG lBufOffset; /* Offset in buff to pchNext */
103 LONG lDiskOffset; /* Disk offset in file */
104 ULONG aulInfo[4]; /* IOProc specific fields */
105 LONG lLogicalFilePos; /* Actual file position, buffered or not */
106 ULONG ulTranslate; /* Translation field */
107 FOURCC fccChildIOProc; /* FOURCC of Child IOProc */
108 PVOID pExtraInfoStruct; /* Pointer to a structure of related data */
109 HMMIO hmmio; /* Handle to media element */
110 } MMIOINFO;
111
112typedef MMIOINFO FAR *PMMIOINFO;
113
114typedef struct _WAVE_HEADER { /* waveheader */
115 USHORT usFormatTag; /* Type of wave format */
116 USHORT usChannels; /* Number of channels */
117 ULONG ulSamplesPerSec; /* Sampling rate */
118 ULONG ulAvgBytesPerSec; /* Avg bytes per sec */
119 USHORT usBlockAlign; /* Block Alignment in bytes */
120 USHORT usBitsPerSample; /* Bits per sample */
121 } WAVE_HEADER;
122
123typedef struct _XWAV_HEADERINFO { /* xwaveheader info */
124 ULONG ulAudioLengthInMS; /* Audio data in millisecs */
125 ULONG ulAudioLengthInBytes; /* Audio data in bytes */
126 PVOID pAdditionalInformation;
127 } XWAV_HEADERINFO;
128
129typedef struct _MMXWAV_HEADER { /* mmxwaveheader */
130 WAVE_HEADER WAVEHeader; /* Per RIFF WAVE Definition */
131 XWAV_HEADERINFO XWAVHeaderInfo; /* Extended wave definition */
132 } MMXWAV_HEADER;
133
134typedef struct _MMAUDIOHEADER { /* mmaudioheader */
135 ULONG ulHeaderLength; /* Length in Bytes */