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
d67a211c
Commit
d67a211c
authored
Apr 11, 2023
by
Davide Beatrici
Committed by
Alexandre Julliard
Apr 11, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winealsa: Move common mmdevdrv structs into mmdevapi.
parent
061dc3a4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
76 deletions
+92
-76
mmdevdrv.h
dlls/mmdevapi/mmdevdrv.h
+79
-0
mmdevdrv.c
dlls/winealsa.drv/mmdevdrv.c
+13
-76
No files found.
dlls/mmdevapi/mmdevdrv.h
0 → 100644
View file @
d67a211c
/*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
typedef
struct
audio_client
ACImpl
;
typedef
struct
audio_session
{
GUID
guid
;
struct
list
clients
;
IMMDevice
*
device
;
float
master_vol
;
UINT32
channel_count
;
float
*
channel_vols
;
BOOL
mute
;
struct
list
entry
;
}
AudioSession
;
typedef
struct
audio_session_wrapper
{
IAudioSessionControl2
IAudioSessionControl2_iface
;
IChannelAudioVolume
IChannelAudioVolume_iface
;
ISimpleAudioVolume
ISimpleAudioVolume_iface
;
LONG
ref
;
struct
audio_client
*
client
;
struct
audio_session
*
session
;
}
AudioSessionWrapper
;
typedef
struct
session_mgr
{
IAudioSessionManager2
IAudioSessionManager2_iface
;
LONG
ref
;
IMMDevice
*
device
;
}
SessionMgr
;
struct
audio_client
{
IAudioClient3
IAudioClient3_iface
;
IAudioRenderClient
IAudioRenderClient_iface
;
IAudioCaptureClient
IAudioCaptureClient_iface
;
IAudioClock
IAudioClock_iface
;
IAudioClock2
IAudioClock2_iface
;
IAudioStreamVolume
IAudioStreamVolume_iface
;
LONG
ref
;
IMMDevice
*
parent
;
IUnknown
*
marshal
;
EDataFlow
dataflow
;
float
*
vols
;
UINT32
channel_count
;
stream_handle
stream
;
HANDLE
timer_thread
;
struct
audio_session
*
session
;
struct
audio_session_wrapper
*
session_wrapper
;
struct
list
entry
;
/* Keep at end */
char
device_name
[
0
];
};
dlls/winealsa.drv/mmdevdrv.c
View file @
d67a211c
...
...
@@ -47,6 +47,8 @@
#include "unixlib.h"
#include "../mmdevapi/mmdevdrv.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
alsa
);
#define NULL_PTR_ERR MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, RPC_X_NULL_REF_POINTER)
...
...
@@ -54,71 +56,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(alsa);
static
const
REFERENCE_TIME
DefaultPeriod
=
100000
;
static
const
REFERENCE_TIME
MinimumPeriod
=
50000
;
struct
ACImpl
;
typedef
struct
ACImpl
ACImpl
;
typedef
struct
_AudioSession
{
GUID
guid
;
struct
list
clients
;
IMMDevice
*
device
;
float
master_vol
;
UINT32
channel_count
;
float
*
channel_vols
;
BOOL
mute
;
struct
list
entry
;
}
AudioSession
;
typedef
struct
_AudioSessionWrapper
{
IAudioSessionControl2
IAudioSessionControl2_iface
;
IChannelAudioVolume
IChannelAudioVolume_iface
;
ISimpleAudioVolume
ISimpleAudioVolume_iface
;
LONG
ref
;
ACImpl
*
client
;
AudioSession
*
session
;
}
AudioSessionWrapper
;
struct
ACImpl
{
IAudioClient3
IAudioClient3_iface
;
IAudioRenderClient
IAudioRenderClient_iface
;
IAudioCaptureClient
IAudioCaptureClient_iface
;
IAudioClock
IAudioClock_iface
;
IAudioClock2
IAudioClock2_iface
;
IAudioStreamVolume
IAudioStreamVolume_iface
;
LONG
ref
;
IMMDevice
*
parent
;
IUnknown
*
pUnkFTMarshal
;
EDataFlow
dataflow
;
float
*
vols
;
UINT32
channel_count
;
stream_handle
stream
;
HANDLE
timer_thread
;
AudioSession
*
session
;
AudioSessionWrapper
*
session_wrapper
;
struct
list
entry
;
/* Keep at end */
char
alsa_name
[
1
];
};
typedef
struct
_SessionMgr
{
IAudioSessionManager2
IAudioSessionManager2_iface
;
LONG
ref
;
IMMDevice
*
device
;
}
SessionMgr
;
static
CRITICAL_SECTION
g_sessions_lock
;
static
CRITICAL_SECTION_DEBUG
g_sessions_lock_debug
=
{
...
...
@@ -239,7 +176,7 @@ static HRESULT alsa_stream_release(stream_handle stream, HANDLE timer_thread)
static
DWORD
WINAPI
alsa_timer_thread
(
void
*
user
)
{
struct
timer_loop_params
params
;
struct
ACImpl
*
This
=
user
;
ACImpl
*
This
=
user
;
SetThreadDescription
(
GetCurrentThread
(),
L"winealsa_timer"
);
...
...
@@ -474,7 +411,7 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient
return
E_UNEXPECTED
;
len
=
strlen
(
alsa_name
);
This
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
offsetof
(
ACImpl
,
alsa
_name
[
len
+
1
]));
This
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
offsetof
(
ACImpl
,
device
_name
[
len
+
1
]));
if
(
!
This
)
return
E_OUTOFMEMORY
;
...
...
@@ -485,14 +422,14 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient
This
->
IAudioClock2_iface
.
lpVtbl
=
&
AudioClock2_Vtbl
;
This
->
IAudioStreamVolume_iface
.
lpVtbl
=
&
AudioStreamVolume_Vtbl
;
hr
=
CoCreateFreeThreadedMarshaler
((
IUnknown
*
)
&
This
->
IAudioClient3_iface
,
&
This
->
pUnkFTM
arshal
);
hr
=
CoCreateFreeThreadedMarshaler
((
IUnknown
*
)
&
This
->
IAudioClient3_iface
,
&
This
->
m
arshal
);
if
(
FAILED
(
hr
))
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
return
hr
;
}
This
->
dataflow
=
dataflow
;
memcpy
(
This
->
alsa
_name
,
alsa_name
,
len
+
1
);
memcpy
(
This
->
device
_name
,
alsa_name
,
len
+
1
);
This
->
parent
=
dev
;
IMMDevice_AddRef
(
This
->
parent
);
...
...
@@ -518,7 +455,7 @@ static HRESULT WINAPI AudioClient_QueryInterface(IAudioClient3 *iface,
IsEqualIID
(
riid
,
&
IID_IAudioClient3
))
*
ppv
=
iface
;
else
if
(
IsEqualIID
(
riid
,
&
IID_IMarshal
))
return
IUnknown_QueryInterface
(
This
->
pUnkFTM
arshal
,
riid
,
ppv
);
return
IUnknown_QueryInterface
(
This
->
m
arshal
,
riid
,
ppv
);
if
(
*
ppv
){
IUnknown_AddRef
((
IUnknown
*
)
*
ppv
);
...
...
@@ -547,7 +484,7 @@ static ULONG WINAPI AudioClient_Release(IAudioClient3 *iface)
if
(
!
ref
){
IAudioClient3_Stop
(
iface
);
IMMDevice_Release
(
This
->
parent
);
IUnknown_Release
(
This
->
pUnkFTM
arshal
);
IUnknown_Release
(
This
->
m
arshal
);
if
(
This
->
session
){
EnterCriticalSection
(
&
g_sessions_lock
);
list_remove
(
&
This
->
entry
);
...
...
@@ -745,7 +682,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface,
dump_fmt
(
fmt
);
params
.
name
=
NULL
;
params
.
device
=
This
->
alsa
_name
;
params
.
device
=
This
->
device
_name
;
params
.
flow
=
This
->
dataflow
;
params
.
share
=
mode
;
params
.
flags
=
flags
;
...
...
@@ -870,7 +807,7 @@ static HRESULT WINAPI AudioClient_IsFormatSupported(IAudioClient3 *iface,
TRACE
(
"(%p)->(%x, %p, %p)
\n
"
,
This
,
mode
,
fmt
,
out
);
if
(
fmt
)
dump_fmt
(
fmt
);
params
.
device
=
This
->
alsa
_name
;
params
.
device
=
This
->
device
_name
;
params
.
flow
=
This
->
dataflow
;
params
.
share
=
mode
;
params
.
fmt_in
=
fmt
;
...
...
@@ -903,7 +840,7 @@ static HRESULT WINAPI AudioClient_GetMixFormat(IAudioClient3 *iface,
return
E_POINTER
;
*
pwfx
=
NULL
;
params
.
device
=
This
->
alsa
_name
;
params
.
device
=
This
->
device
_name
;
params
.
flow
=
This
->
dataflow
;
params
.
fmt
=
CoTaskMemAlloc
(
sizeof
(
WAVEFORMATEXTENSIBLE
));
if
(
!
params
.
fmt
)
...
...
@@ -1236,7 +1173,7 @@ static HRESULT WINAPI AudioRenderClient_QueryInterface(
IsEqualIID
(
riid
,
&
IID_IAudioRenderClient
))
*
ppv
=
iface
;
else
if
(
IsEqualIID
(
riid
,
&
IID_IMarshal
))
return
IUnknown_QueryInterface
(
This
->
pUnkFTM
arshal
,
riid
,
ppv
);
return
IUnknown_QueryInterface
(
This
->
m
arshal
,
riid
,
ppv
);
if
(
*
ppv
){
IUnknown_AddRef
((
IUnknown
*
)
*
ppv
);
...
...
@@ -1319,7 +1256,7 @@ static HRESULT WINAPI AudioCaptureClient_QueryInterface(
IsEqualIID
(
riid
,
&
IID_IAudioCaptureClient
))
*
ppv
=
iface
;
else
if
(
IsEqualIID
(
riid
,
&
IID_IMarshal
))
return
IUnknown_QueryInterface
(
This
->
pUnkFTM
arshal
,
riid
,
ppv
);
return
IUnknown_QueryInterface
(
This
->
m
arshal
,
riid
,
ppv
);
if
(
*
ppv
){
IUnknown_AddRef
((
IUnknown
*
)
*
ppv
);
...
...
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