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
00d19159
Commit
00d19159
authored
Jan 17, 2011
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Jan 17, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mmdevapi: Use ifaces instead of vtbl pointers in MMDevice.
parent
f0b20ad4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
25 deletions
+30
-25
devenum.c
dlls/mmdevapi/devenum.c
+28
-23
mmdevapi.h
dlls/mmdevapi/mmdevapi.h
+2
-2
No files found.
dlls/mmdevapi/devenum.c
View file @
00d19159
...
...
@@ -171,8 +171,8 @@ static void MMDevice_Create(MMDevice **dev, WCHAR *name, GUID *id, EDataFlow flo
return
;
}
lstrcpyW
(
cur
->
alname
,
name
);
cur
->
lpVtbl
=
&
MMDeviceVtbl
;
cur
->
lpEndpoint
Vtbl
=
&
MMEndpointVtbl
;
cur
->
IMMDevice_iface
.
lpVtbl
=
&
MMDeviceVtbl
;
cur
->
IMMEndpoint_iface
.
lp
Vtbl
=
&
MMEndpointVtbl
;
cur
->
ref
=
0
;
InitializeCriticalSection
(
&
cur
->
crst
);
cur
->
crst
.
DebugInfo
->
Spare
[
0
]
=
(
DWORD_PTR
)(
__FILE__
": MMDevice.crst"
);
...
...
@@ -246,9 +246,14 @@ static void MMDevice_Destroy(MMDevice *This)
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
static
inline
MMDevice
*
impl_from_IMMDevice
(
IMMDevice
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
MMDevice
,
IMMDevice_iface
);
}
static
HRESULT
WINAPI
MMDevice_QueryInterface
(
IMMDevice
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
MMDevice
*
This
=
(
MMDevice
*
)
iface
;
MMDevice
*
This
=
impl_from_IMMDevice
(
iface
)
;
TRACE
(
"(%p)->(%s,%p)
\n
"
,
iface
,
debugstr_guid
(
riid
),
ppv
);
if
(
!
ppv
)
...
...
@@ -258,7 +263,7 @@ static HRESULT WINAPI MMDevice_QueryInterface(IMMDevice *iface, REFIID riid, voi
||
IsEqualIID
(
riid
,
&
IID_IMMDevice
))
*
ppv
=
This
;
else
if
(
IsEqualIID
(
riid
,
&
IID_IMMEndpoint
))
*
ppv
=
&
This
->
lpEndpointVtbl
;
*
ppv
=
&
This
->
IMMEndpoint_iface
;
if
(
*
ppv
)
{
IUnknown_AddRef
((
IUnknown
*
)
*
ppv
);
...
...
@@ -270,7 +275,7 @@ static HRESULT WINAPI MMDevice_QueryInterface(IMMDevice *iface, REFIID riid, voi
static
ULONG
WINAPI
MMDevice_AddRef
(
IMMDevice
*
iface
)
{
MMDevice
*
This
=
(
MMDevice
*
)
iface
;
MMDevice
*
This
=
impl_from_IMMDevice
(
iface
)
;
LONG
ref
;
ref
=
InterlockedIncrement
(
&
This
->
ref
);
...
...
@@ -280,7 +285,7 @@ static ULONG WINAPI MMDevice_AddRef(IMMDevice *iface)
static
ULONG
WINAPI
MMDevice_Release
(
IMMDevice
*
iface
)
{
MMDevice
*
This
=
(
MMDevice
*
)
iface
;
MMDevice
*
This
=
impl_from_IMMDevice
(
iface
)
;
LONG
ref
;
ref
=
InterlockedDecrement
(
&
This
->
ref
);
...
...
@@ -293,7 +298,7 @@ static HRESULT WINAPI MMDevice_Activate(IMMDevice *iface, REFIID riid, DWORD cls
HRESULT
hr
=
E_NOINTERFACE
;
#ifdef HAVE_OPENAL
MMDevice
*
This
=
(
MMDevice
*
)
iface
;
MMDevice
*
This
=
impl_from_IMMDevice
(
iface
)
;
TRACE
(
"(%p)->(%p,%x,%p,%p)
\n
"
,
iface
,
riid
,
clsctx
,
params
,
ppv
);
...
...
@@ -385,7 +390,7 @@ static HRESULT WINAPI MMDevice_Activate(IMMDevice *iface, REFIID riid, DWORD cls
static
HRESULT
WINAPI
MMDevice_OpenPropertyStore
(
IMMDevice
*
iface
,
DWORD
access
,
IPropertyStore
**
ppv
)
{
MMDevice
*
This
=
(
MMDevice
*
)
iface
;
MMDevice
*
This
=
impl_from_IMMDevice
(
iface
)
;
TRACE
(
"(%p)->(%x,%p)
\n
"
,
This
,
access
,
ppv
);
if
(
!
ppv
)
...
...
@@ -395,7 +400,7 @@ static HRESULT WINAPI MMDevice_OpenPropertyStore(IMMDevice *iface, DWORD access,
static
HRESULT
WINAPI
MMDevice_GetId
(
IMMDevice
*
iface
,
WCHAR
**
itemid
)
{
MMDevice
*
This
=
(
MMDevice
*
)
iface
;
MMDevice
*
This
=
impl_from_IMMDevice
(
iface
)
;
WCHAR
*
str
;
GUID
*
id
=
&
This
->
devguid
;
static
const
WCHAR
formatW
[]
=
{
'{'
,
'0'
,
'.'
,
'0'
,
'.'
,
'0'
,
'.'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'}'
,
'.'
,
...
...
@@ -418,7 +423,7 @@ static HRESULT WINAPI MMDevice_GetId(IMMDevice *iface, WCHAR **itemid)
static
HRESULT
WINAPI
MMDevice_GetState
(
IMMDevice
*
iface
,
DWORD
*
state
)
{
MMDevice
*
This
=
(
MMDevice
*
)
iface
;
MMDevice
*
This
=
impl_from_IMMDevice
(
iface
)
;
TRACE
(
"(%p)->(%p)
\n
"
,
iface
,
state
);
if
(
!
state
)
...
...
@@ -438,32 +443,32 @@ static const IMMDeviceVtbl MMDeviceVtbl =
MMDevice_GetState
};
static
MMDevice
*
get_this_from_e
ndpoint
(
IMMEndpoint
*
iface
)
static
inline
MMDevice
*
impl_from_IMME
ndpoint
(
IMMEndpoint
*
iface
)
{
return
(
MMDevice
*
)((
char
*
)
iface
-
offsetof
(
MMDevice
,
lpEndpointVtbl
)
);
return
CONTAINING_RECORD
(
iface
,
MMDevice
,
IMMEndpoint_iface
);
}
static
HRESULT
WINAPI
MMEndpoint_QueryInterface
(
IMMEndpoint
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
MMDevice
*
This
=
get_this_from_e
ndpoint
(
iface
);
return
IMMDevice_QueryInterface
(
(
IMMDevice
*
)
This
,
riid
,
ppv
);
MMDevice
*
This
=
impl_from_IMME
ndpoint
(
iface
);
return
IMMDevice_QueryInterface
(
&
This
->
IMMDevice_iface
,
riid
,
ppv
);
}
static
ULONG
WINAPI
MMEndpoint_AddRef
(
IMMEndpoint
*
iface
)
{
MMDevice
*
This
=
get_this_from_e
ndpoint
(
iface
);
return
IMMDevice_AddRef
(
(
IMMDevice
*
)
This
);
MMDevice
*
This
=
impl_from_IMME
ndpoint
(
iface
);
return
IMMDevice_AddRef
(
&
This
->
IMMDevice_iface
);
}
static
ULONG
WINAPI
MMEndpoint_Release
(
IMMEndpoint
*
iface
)
{
MMDevice
*
This
=
get_this_from_e
ndpoint
(
iface
);
return
IMMDevice_Release
(
(
IMMDevice
*
)
This
);
MMDevice
*
This
=
impl_from_IMME
ndpoint
(
iface
);
return
IMMDevice_Release
(
&
This
->
IMMDevice_iface
);
}
static
HRESULT
WINAPI
MMEndpoint_GetDataFlow
(
IMMEndpoint
*
iface
,
EDataFlow
*
flow
)
{
MMDevice
*
This
=
get_this_from_e
ndpoint
(
iface
);
MMDevice
*
This
=
impl_from_IMME
ndpoint
(
iface
);
if
(
!
flow
)
return
E_POINTER
;
*
flow
=
This
->
flow
;
...
...
@@ -570,7 +575,7 @@ static HRESULT WINAPI MMDevCol_Item(IMMDeviceCollection *iface, UINT n, IMMDevic
&&
(
cur
->
state
&
This
->
state
)
&&
i
++
==
n
)
{
*
dev
=
(
IMMDevice
*
)
cur
;
*
dev
=
&
cur
->
IMMDevice_iface
;
IMMDevice_AddRef
(
*
dev
);
return
S_OK
;
}
...
...
@@ -1059,9 +1064,9 @@ static HRESULT WINAPI MMDevEnum_GetDefaultAudioEndpoint(IMMDeviceEnumerator *ifa
*
device
=
NULL
;
if
(
flow
==
eRender
)
*
device
=
(
IMMDevice
*
)
MMDevice_def_play
;
*
device
=
&
MMDevice_def_play
->
IMMDevice_iface
;
else
if
(
flow
==
eCapture
)
*
device
=
(
IMMDevice
*
)
MMDevice_def_rec
;
*
device
=
&
MMDevice_def_rec
->
IMMDevice_iface
;
else
{
WARN
(
"Unknown flow %u
\n
"
,
flow
);
...
...
@@ -1084,7 +1089,7 @@ static HRESULT WINAPI MMDevEnum_GetDevice(IMMDeviceEnumerator *iface, const WCHA
for
(
i
=
0
;
i
<
MMDevice_count
;
++
i
)
{
WCHAR
*
str
;
dev
=
(
IMMDevice
*
)
MMDevice_head
[
i
]
;
dev
=
&
MMDevice_head
[
i
]
->
IMMDevice_iface
;
IMMDevice_GetId
(
dev
,
&
str
);
if
(
str
&&
!
lstrcmpW
(
str
,
name
))
...
...
dlls/mmdevapi/mmdevapi.h
View file @
00d19159
...
...
@@ -27,8 +27,8 @@ extern HRESULT MMDevice_GetPropValue(const GUID *devguid, DWORD flow, REFPROPERT
extern
HRESULT
MMDevice_SetPropValue
(
const
GUID
*
devguid
,
DWORD
flow
,
REFPROPERTYKEY
key
,
REFPROPVARIANT
pv
);
typedef
struct
MMDevice
{
const
IMMDeviceVtbl
*
lpVtbl
;
const
IMMEndpointVtbl
*
lpEndpointVtbl
;
IMMDevice
IMMDevice_iface
;
IMMEndpoint
IMMEndpoint_iface
;
LONG
ref
;
CRITICAL_SECTION
crst
;
...
...
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