Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
3bfbf3cc
Commit
3bfbf3cc
authored
Jul 15, 1999
by
Eric Pouech
Committed by
Alexandre Julliard
Jul 15, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed fixed size array to store specific data (now using
mci(Set|Get)DriverData to store specific data). Fixed mmio chunk lookup on odd size 'fmt ' chunks.
parent
5be17f7b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
40 deletions
+18
-40
mciwave.c
multimedia/mciwave.c
+18
-40
No files found.
multimedia/mciwave.c
View file @
3bfbf3cc
...
@@ -14,23 +14,14 @@
...
@@ -14,23 +14,14 @@
#define DEBUG_MCIWAVE
#define DEBUG_MCIWAVE
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "winuser.h"
#include "winuser.h"
#include "driver.h"
#include "driver.h"
#include "multimedia.h"
#include "multimedia.h"
#include "mmsystem.h"
#include "heap.h"
#include "heap.h"
#include "debugtools.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL
(
mciwave
)
DEFAULT_DEBUG_CHANNEL
(
mciwave
)
#define MAX_MCIWAVEDRV (1)
typedef
struct
{
typedef
struct
{
UINT16
wDevID
;
UINT16
wDevID
;
UINT16
wWavID
;
UINT16
wWavID
;
...
@@ -51,8 +42,6 @@ typedef struct {
...
@@ -51,8 +42,6 @@ typedef struct {
DWORD
dwPosition
;
/* position in bytes in chunk for playing */
DWORD
dwPosition
;
/* position in bytes in chunk for playing */
}
WINE_MCIWAVE
;
}
WINE_MCIWAVE
;
static
WINE_MCIWAVE
MCIWaveDev
[
MAX_MCIWAVEDRV
];
/*======================================================================*
/*======================================================================*
* MCI WAVE implemantation *
* MCI WAVE implemantation *
*======================================================================*/
*======================================================================*/
...
@@ -60,36 +49,20 @@ static WINE_MCIWAVE MCIWaveDev[MAX_MCIWAVEDRV];
...
@@ -60,36 +49,20 @@ static WINE_MCIWAVE MCIWaveDev[MAX_MCIWAVEDRV];
static
DWORD
WAVE_mciResume
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
);
static
DWORD
WAVE_mciResume
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
);
/**************************************************************************
/**************************************************************************
* MCIWAVE_drvGetDrv [internal]
*/
static
WINE_MCIWAVE
*
WAVE_drvGetDrv
(
UINT16
wDevID
)
{
int
i
;
for
(
i
=
0
;
i
<
MAX_MCIWAVEDRV
;
i
++
)
{
if
(
MCIWaveDev
[
i
].
wDevID
==
wDevID
)
{
return
&
MCIWaveDev
[
i
];
}
}
return
0
;
}
/**************************************************************************
* MCIWAVE_drvOpen [internal]
* MCIWAVE_drvOpen [internal]
*/
*/
static
DWORD
WAVE_drvOpen
(
LPSTR
str
,
LPMCI_OPEN_DRIVER_PARMSA
modp
)
static
DWORD
WAVE_drvOpen
(
LPSTR
str
,
LPMCI_OPEN_DRIVER_PARMSA
modp
)
{
{
int
i
;
WINE_MCIWAVE
*
wmw
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
WINE_MCIWAVE
));
if
(
!
wmw
)
return
0
;
for
(
i
=
0
;
i
<
MAX_MCIWAVEDRV
;
i
++
)
{
wmw
->
wDevID
=
modp
->
wDeviceID
;
if
(
MCIWaveDev
[
i
].
wDevID
==
0
)
{
mciSetDriverData
(
wmw
->
wDevID
,
(
DWORD
)
wmw
);
MCIWaveDev
[
i
].
wDevID
=
modp
->
wDeviceID
;
modp
->
wCustomCommandTable
=
-
1
;
modp
->
wCustomCommandTable
=
-
1
;
modp
->
wType
=
MCI_DEVTYPE_WAVEFORM_AUDIO
;
modp
->
wType
=
MCI_DEVTYPE_WAVEFORM_AUDIO
;
return
modp
->
wDeviceID
;
return
modp
->
wDeviceID
;
}
}
return
0
;
}
}
/**************************************************************************
/**************************************************************************
...
@@ -97,10 +70,11 @@ static DWORD WAVE_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp)
...
@@ -97,10 +70,11 @@ static DWORD WAVE_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp)
*/
*/
static
DWORD
WAVE_drvClose
(
DWORD
dwDevID
)
static
DWORD
WAVE_drvClose
(
DWORD
dwDevID
)
{
{
WINE_MCIWAVE
*
wm
cda
=
WAVE_drvGetDrv
(
dwDevID
);
WINE_MCIWAVE
*
wm
w
=
(
WINE_MCIWAVE
*
)
mciGetDriverData
(
dwDevID
);
if
(
wmcda
)
{
if
(
wmw
)
{
wmcda
->
wDevID
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
wmw
);
mciSetDriverData
(
dwDevID
,
0
);
return
1
;
return
1
;
}
}
return
0
;
return
0
;
...
@@ -111,7 +85,7 @@ static DWORD WAVE_drvClose(DWORD dwDevID)
...
@@ -111,7 +85,7 @@ static DWORD WAVE_drvClose(DWORD dwDevID)
*/
*/
static
WINE_MCIWAVE
*
WAVE_mciGetOpenDev
(
UINT16
wDevID
)
static
WINE_MCIWAVE
*
WAVE_mciGetOpenDev
(
UINT16
wDevID
)
{
{
WINE_MCIWAVE
*
wmw
=
WAVE_drvGetDrv
(
wDevID
);
WINE_MCIWAVE
*
wmw
=
(
WINE_MCIWAVE
*
)
mciGetDriverData
(
wDevID
);
if
(
wmw
==
NULL
||
wmw
->
nUseCount
==
0
)
{
if
(
wmw
==
NULL
||
wmw
->
nUseCount
==
0
)
{
WARN
(
"Invalid wDevID=%u
\n
"
,
wDevID
);
WARN
(
"Invalid wDevID=%u
\n
"
,
wDevID
);
...
@@ -181,9 +155,13 @@ static DWORD WAVE_mciReadFmt(WINE_MCIWAVE* wmw, MMCKINFO* pckMainRIFF)
...
@@ -181,9 +155,13 @@ static DWORD WAVE_mciReadFmt(WINE_MCIWAVE* wmw, MMCKINFO* pckMainRIFF)
TRACE
(
"nAvgBytesPerSec=%ld
\n
"
,
wmw
->
WaveFormat
.
wf
.
nAvgBytesPerSec
);
TRACE
(
"nAvgBytesPerSec=%ld
\n
"
,
wmw
->
WaveFormat
.
wf
.
nAvgBytesPerSec
);
TRACE
(
"nBlockAlign=%d
\n
"
,
wmw
->
WaveFormat
.
wf
.
nBlockAlign
);
TRACE
(
"nBlockAlign=%d
\n
"
,
wmw
->
WaveFormat
.
wf
.
nBlockAlign
);
TRACE
(
"wBitsPerSample=%u !
\n
"
,
wmw
->
WaveFormat
.
wBitsPerSample
);
TRACE
(
"wBitsPerSample=%u !
\n
"
,
wmw
->
WaveFormat
.
wBitsPerSample
);
mmckInfo
.
ckid
=
mmioFOURCC
(
'd'
,
'a'
,
't'
,
'a'
);
mmckInfo
.
ckid
=
mmioFOURCC
(
'd'
,
'a'
,
't'
,
'a'
);
if
(
mmioDescend
(
wmw
->
hFile
,
&
mmckInfo
,
pckMainRIFF
,
MMIO_FINDCHUNK
)
!=
0
)
mmioSeek
(
wmw
->
hFile
,
mmckInfo
.
dwDataOffset
+
((
mmckInfo
.
cksize
+
1
)
&
~
1
),
SEEK_SET
);
if
(
mmioDescend
(
wmw
->
hFile
,
&
mmckInfo
,
pckMainRIFF
,
MMIO_FINDCHUNK
)
!=
0
)
{
TRACE
(
"can't find data chunk
\n
"
);
return
MCIERR_INVALID_FILE
;
return
MCIERR_INVALID_FILE
;
}
TRACE
(
"Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX
\n
"
,
TRACE
(
"Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX
\n
"
,
(
LPSTR
)
&
mmckInfo
.
ckid
,
(
LPSTR
)
&
mmckInfo
.
fccType
,
mmckInfo
.
cksize
);
(
LPSTR
)
&
mmckInfo
.
ckid
,
(
LPSTR
)
&
mmckInfo
.
fccType
,
mmckInfo
.
cksize
);
TRACE
(
"nChannels=%d nSamplesPerSec=%ld
\n
"
,
TRACE
(
"nChannels=%d nSamplesPerSec=%ld
\n
"
,
...
@@ -200,7 +178,7 @@ static DWORD WAVE_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_WAVE_OPEN_PARMSA l
...
@@ -200,7 +178,7 @@ static DWORD WAVE_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_WAVE_OPEN_PARMSA l
{
{
DWORD
dwRet
=
0
;
DWORD
dwRet
=
0
;
DWORD
dwDeviceID
;
DWORD
dwDeviceID
;
WINE_MCIWAVE
*
wmw
=
WAVE_drvGetDrv
(
wDevID
);
WINE_MCIWAVE
*
wmw
=
(
WINE_MCIWAVE
*
)
mciGetDriverData
(
wDevID
);
TRACE
(
"(%04X, %08lX, %p)
\n
"
,
wDevID
,
dwFlags
,
lpOpenParms
);
TRACE
(
"(%04X, %08lX, %p)
\n
"
,
wDevID
,
dwFlags
,
lpOpenParms
);
if
(
lpOpenParms
==
NULL
)
return
MCIERR_NULL_PARAMETER_BLOCK
;
if
(
lpOpenParms
==
NULL
)
return
MCIERR_NULL_PARAMETER_BLOCK
;
...
@@ -237,7 +215,7 @@ static DWORD WAVE_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_WAVE_OPEN_PARMSA l
...
@@ -237,7 +215,7 @@ static DWORD WAVE_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_WAVE_OPEN_PARMSA l
TRACE
(
"MCI_OPEN_ELEMENT '%s' !
\n
"
,
lpstrElementName
);
TRACE
(
"MCI_OPEN_ELEMENT '%s' !
\n
"
,
lpstrElementName
);
if
(
lpstrElementName
&&
(
strlen
(
lpstrElementName
)
>
0
))
{
if
(
lpstrElementName
&&
(
strlen
(
lpstrElementName
)
>
0
))
{
wmw
->
hFile
=
mmioOpenA
((
LPSTR
)
lpstrElementName
,
NULL
,
wmw
->
hFile
=
mmioOpenA
((
LPSTR
)
lpstrElementName
,
NULL
,
MMIO_ALLOCBUF
|
MMIO_READ
WRITE
|
MMIO_DENYWRITE
);
MMIO_ALLOCBUF
|
MMIO_READ
|
MMIO_DENYWRITE
);
if
(
wmw
->
hFile
==
0
)
{
if
(
wmw
->
hFile
==
0
)
{
WARN
(
"can't find file='%s' !
\n
"
,
lpstrElementName
);
WARN
(
"can't find file='%s' !
\n
"
,
lpstrElementName
);
dwRet
=
MCIERR_FILE_NOT_FOUND
;
dwRet
=
MCIERR_FILE_NOT_FOUND
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment