Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
d8bce981
Commit
d8bce981
authored
Sep 04, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Sep 12, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmime: Rewrite IDirectMusicGraph tools iteration.
parent
1e70dbcf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
70 deletions
+76
-70
dmime_private.h
dlls/dmime/dmime_private.h
+0
-6
graph.c
dlls/dmime/graph.c
+65
-53
dmime.c
dlls/dmime/tests/dmime.c
+11
-11
No files found.
dlls/dmime/dmime_private.h
View file @
d8bce981
...
...
@@ -86,12 +86,6 @@ typedef struct _DMUS_PRIVATE_TEMPO_ITEM {
DMUS_IO_TEMPO_ITEM
item
;
}
DMUS_PRIVATE_TEMPO_ITEM
,
*
LPDMUS_PRIVATE_TEMPO_ITEM
;
typedef
struct
_DMUS_PRIVATE_GRAPH_TOOL
{
struct
list
entry
;
/* for listing elements */
DWORD
dwIndex
;
IDirectMusicTool
*
pTool
;
}
DMUS_PRIVATE_GRAPH_TOOL
,
*
LPDMUS_PRIVATE_GRAPH_TOOL
;
typedef
struct
_DMUS_PRIVATE_TEMPO_PLAY_STATE
{
DWORD
dummy
;
}
DMUS_PRIVATE_TEMPO_PLAY_STATE
,
*
LPDMUS_PRIVATE_TEMPO_PLAY_STATE
;
...
...
dlls/dmime/graph.c
View file @
d8bce981
...
...
@@ -22,12 +22,18 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
dmime
);
struct
tool_entry
{
struct
list
entry
;
IDirectMusicTool
*
tool
;
};
struct
IDirectMusicGraphImpl
{
IDirectMusicGraph
IDirectMusicGraph_iface
;
struct
dmobject
dmobj
;
LONG
ref
;
WORD
num_tools
;
struct
list
T
ools
;
struct
list
t
ools
;
};
static
inline
IDirectMusicGraphImpl
*
impl_from_IDirectMusicGraph
(
IDirectMusicGraph
*
iface
)
...
...
@@ -85,7 +91,19 @@ static ULONG WINAPI DirectMusicGraph_Release(IDirectMusicGraph *iface)
TRACE
(
"(%p): %ld
\n
"
,
This
,
ref
);
if
(
!
ref
)
free
(
This
);
if
(
!
ref
)
{
struct
tool_entry
*
entry
,
*
next
;
LIST_FOR_EACH_ENTRY_SAFE
(
entry
,
next
,
&
This
->
tools
,
struct
tool_entry
,
entry
)
{
list_remove
(
&
entry
->
entry
);
IDirectMusicTool_Release
(
entry
->
tool
);
free
(
entry
);
}
free
(
This
);
}
return
ref
;
}
...
...
@@ -97,80 +115,74 @@ static HRESULT WINAPI DirectMusicGraph_StampPMsg(IDirectMusicGraph *iface, DMUS_
return
S_OK
;
}
static
HRESULT
WINAPI
DirectMusicGraph_InsertTool
(
IDirectMusicGraph
*
iface
,
IDirectMusicTool
*
pTool
,
DWORD
*
pdwPChannels
,
DWORD
cPChannels
,
LONG
lIndex
)
static
HRESULT
WINAPI
DirectMusicGraph_InsertTool
(
IDirectMusicGraph
*
iface
,
IDirectMusicTool
*
tool
,
DWORD
*
channels
,
DWORD
channel_count
,
LONG
index
)
{
IDirectMusicGraphImpl
*
This
=
impl_from_IDirectMusicGraph
(
iface
);
struct
list
*
pEntry
=
NULL
;
struct
list
*
pPrevEntry
=
NULL
;
LPDMUS_PRIVATE_GRAPH_TOOL
pIt
=
NULL
;
LPDMUS_PRIVATE_GRAPH_TOOL
pNewTool
=
NULL
;
FIXME
(
"(%p, %p, %p, %ld, %li): use of pdwPChannels
\n
"
,
This
,
pTool
,
pdwPChannels
,
cPChannels
,
lIndex
);
if
(
!
pTool
)
return
E_POINTER
;
struct
tool_entry
*
entry
,
*
next
;
if
(
lIndex
<
0
)
lIndex
=
This
->
num_tools
+
lIndex
;
TRACE
(
"(%p, %p, %p, %ld, %li)
\n
"
,
This
,
tool
,
channels
,
channel_count
,
index
);
pPrevEntry
=
&
This
->
Tools
;
LIST_FOR_EACH
(
pEntry
,
&
This
->
Tools
)
{
pIt
=
LIST_ENTRY
(
pEntry
,
DMUS_PRIVATE_GRAPH_TOOL
,
entry
);
if
(
pIt
->
dwIndex
==
lIndex
)
return
DMUS_E_ALREADY_EXISTS
;
if
(
!
tool
)
return
E_POINTER
;
if
(
pIt
->
dwIndex
>
lIndex
)
break
;
pPrevEntry
=
pEntry
;
LIST_FOR_EACH_ENTRY
(
next
,
&
This
->
tools
,
struct
tool_entry
,
entry
)
{
if
(
next
->
tool
==
tool
)
return
DMUS_E_ALREADY_EXISTS
;
if
(
index
--
<=
0
)
break
;
}
++
This
->
num_tools
;
pNewTool
=
calloc
(
1
,
sizeof
(
*
pNewTool
));
pNewTool
->
pTool
=
pTool
;
pNewTool
->
dwIndex
=
lIndex
;
IDirectMusicTool_AddRef
(
pTool
);
IDirectMusicTool_Init
(
pTool
,
iface
);
list_add_tail
(
pPrevEntry
->
next
,
&
pNewTool
->
entry
);
#if 0
DWORD dwNum = 0;
IDirectMusicTool8_GetMediaTypes(pTool, &dwNum);
#endif
if
(
!
(
entry
=
calloc
(
1
,
sizeof
(
*
entry
))))
return
E_OUTOFMEMORY
;
entry
->
tool
=
tool
;
IDirectMusicTool_AddRef
(
tool
);
IDirectMusicTool_Init
(
tool
,
iface
);
list_add_before
(
&
next
->
entry
,
&
entry
->
entry
);
return
D
S_OK
;
return
S_OK
;
}
static
HRESULT
WINAPI
DirectMusicGraph_GetTool
(
IDirectMusicGraph
*
iface
,
DWORD
dwIndex
,
IDirectMusicTool
**
ppT
ool
)
static
HRESULT
WINAPI
DirectMusicGraph_GetTool
(
IDirectMusicGraph
*
iface
,
DWORD
index
,
IDirectMusicTool
**
ret_t
ool
)
{
IDirectMusicGraphImpl
*
This
=
impl_from_IDirectMusicGraph
(
iface
);
struct
list
*
pEntry
=
NULL
;
LPDMUS_PRIVATE_GRAPH_TOOL
pIt
=
NULL
;
struct
tool_entry
*
entry
;
TRACE
(
"(%p, %ld, %p)
\n
"
,
This
,
index
,
ret_tool
);
TRACE
(
"(%p, %ld, %p)
\n
"
,
This
,
dwIndex
,
ppTool
)
;
if
(
!
ret_tool
)
return
E_POINTER
;
LIST_FOR_EACH
(
pEntry
,
&
This
->
Tools
)
LIST_FOR_EACH
_ENTRY
(
entry
,
&
This
->
tools
,
struct
tool_entry
,
entry
)
{
pIt
=
LIST_ENTRY
(
pEntry
,
DMUS_PRIVATE_GRAPH_TOOL
,
entry
);
if
(
pIt
->
dwIndex
==
dwIndex
)
if
(
!
index
--
)
{
*
ppTool
=
pIt
->
pTool
;
if
(
*
ppTool
)
IDirectMusicTool_AddRef
(
*
ppTool
);
*
ret_tool
=
entry
->
tool
;
IDirectMusicTool_AddRef
(
entry
->
tool
);
return
S_OK
;
}
if
(
pIt
->
dwIndex
>
dwIndex
)
break
;
}
return
DMUS_E_NOT_FOUND
;
}
static
HRESULT
WINAPI
DirectMusicGraph_RemoveTool
(
IDirectMusicGraph
*
iface
,
IDirectMusicTool
*
pT
ool
)
static
HRESULT
WINAPI
DirectMusicGraph_RemoveTool
(
IDirectMusicGraph
*
iface
,
IDirectMusicTool
*
t
ool
)
{
IDirectMusicGraphImpl
*
This
=
impl_from_IDirectMusicGraph
(
iface
);
FIXME
(
"(%p, %p): stub
\n
"
,
This
,
pTool
);
return
S_OK
;
struct
tool_entry
*
entry
;
TRACE
(
"(%p, %p)
\n
"
,
This
,
tool
);
if
(
!
tool
)
return
E_POINTER
;
LIST_FOR_EACH_ENTRY
(
entry
,
&
This
->
tools
,
struct
tool_entry
,
entry
)
{
if
(
entry
->
tool
==
tool
)
{
list_remove
(
&
entry
->
entry
);
IDirectMusicTool_Release
(
entry
->
tool
);
free
(
entry
);
return
S_OK
;
}
}
return
DMUS_E_NOT_FOUND
;
}
static
const
IDirectMusicGraphVtbl
DirectMusicGraphVtbl
=
...
...
@@ -260,7 +272,7 @@ HRESULT create_dmgraph(REFIID riid, void **ret_iface)
dmobject_init
(
&
obj
->
dmobj
,
&
CLSID_DirectMusicGraph
,
(
IUnknown
*
)
&
obj
->
IDirectMusicGraph_iface
);
obj
->
dmobj
.
IDirectMusicObject_iface
.
lpVtbl
=
&
dmobject_vtbl
;
obj
->
dmobj
.
IPersistStream_iface
.
lpVtbl
=
&
persiststream_vtbl
;
list_init
(
&
obj
->
T
ools
);
list_init
(
&
obj
->
t
ools
);
hr
=
IDirectMusicGraph_QueryInterface
(
&
obj
->
IDirectMusicGraph_iface
,
riid
,
ret_iface
);
IDirectMusicGraph_Release
(
&
obj
->
IDirectMusicGraph_iface
);
...
...
dlls/dmime/tests/dmime.c
View file @
d8bce981
...
...
@@ -705,10 +705,10 @@ static void test_graph(void)
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
hr
=
IDirectMusicGraph_GetTool
(
graph
,
0
,
NULL
);
todo_wine
ok
(
hr
==
E_POINTER
,
"got %#lx
\n
"
,
hr
);
ok
(
hr
==
E_POINTER
,
"got %#lx
\n
"
,
hr
);
hr
=
IDirectMusicGraph_GetTool
(
graph
,
0
,
&
tmp_tool
);
todo_wine
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
todo_wine
ok
(
tool1
==
tmp_tool
,
"got %p
\n
"
,
tmp_tool
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
ok
(
tool1
==
tmp_tool
,
"got %p
\n
"
,
tmp_tool
);
if
(
hr
==
S_OK
)
IDirectMusicTool_Release
(
tmp_tool
);
hr
=
IDirectMusicGraph_GetTool
(
graph
,
1
,
&
tmp_tool
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
...
...
@@ -723,24 +723,24 @@ static void test_graph(void)
/* test removing the first tool */
hr
=
IDirectMusicGraph_RemoveTool
(
graph
,
NULL
);
todo_wine
ok
(
hr
==
E_POINTER
,
"got %#lx
\n
"
,
hr
);
ok
(
hr
==
E_POINTER
,
"got %#lx
\n
"
,
hr
);
hr
=
IDirectMusicGraph_RemoveTool
(
graph
,
tool1
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
hr
=
IDirectMusicGraph_RemoveTool
(
graph
,
tool1
);
todo_wine
ok
(
hr
==
DMUS_E_NOT_FOUND
,
"got %#lx
\n
"
,
hr
);
ok
(
hr
==
DMUS_E_NOT_FOUND
,
"got %#lx
\n
"
,
hr
);
hr
=
IDirectMusicGraph_GetTool
(
graph
,
0
,
&
tmp_tool
);
todo_wine
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
ok
(
tool2
==
tmp_tool
,
"got %p
\n
"
,
tmp_tool
);
if
(
hr
==
S_OK
)
IDirectMusicTool_Release
(
tmp_tool
);
hr
=
IDirectMusicGraph_GetTool
(
graph
,
1
,
&
tmp_tool
);
todo_wine
ok
(
hr
==
DMUS_E_NOT_FOUND
,
"got %#lx
\n
"
,
hr
);
ok
(
hr
==
DMUS_E_NOT_FOUND
,
"got %#lx
\n
"
,
hr
);
hr
=
IDirectMusicGraph_InsertTool
(
graph
,
tool1
,
NULL
,
0
,
-
1
);
todo_wine
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
hr
=
IDirectMusicGraph_GetTool
(
graph
,
0
,
&
tmp_tool
);
todo_wine
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
todo_wine
ok
(
tool1
==
tmp_tool
,
"got %p
\n
"
,
tmp_tool
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
ok
(
tool1
==
tmp_tool
,
"got %p
\n
"
,
tmp_tool
);
if
(
hr
==
S_OK
)
IDirectMusicTool_Release
(
tmp_tool
);
...
...
@@ -810,7 +810,7 @@ static void test_graph(void)
hr
=
IDirectMusicGraph_InsertTool
(
tmp_graph
,
tool1
,
NULL
,
0
,
0
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
hr
=
IDirectMusicGraph_InsertTool
(
tmp_graph
,
tool2
,
NULL
,
0
,
0
);
todo_wine
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
hr
=
IDirectMusicGraph_StampPMsg
(
tmp_graph
,
&
msg
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
ok
(
msg
.
pGraph
==
graph
,
"got %p
\n
"
,
msg
.
pGraph
);
...
...
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