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
228b8b98
Commit
228b8b98
authored
Jan 22, 2020
by
Zebediah Figura
Committed by
Alexandre Julliard
Jan 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quartz: Simplify FilterGraph2_AddFilter().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7daf0304
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
49 deletions
+45
-49
filtergraph.c
dlls/quartz/filtergraph.c
+45
-49
No files found.
dlls/quartz/filtergraph.c
View file @
228b8b98
...
...
@@ -184,7 +184,9 @@ typedef struct _IFilterGraphImpl {
LONG
ref
;
IUnknown
*
punkFilterMapper2
;
struct
list
filters
;
LONG
nameIndex
;
unsigned
int
name_index
;
IReferenceClock
*
refClock
;
IBaseFilter
*
refClockProvider
;
EventsQueue
evqueue
;
...
...
@@ -554,74 +556,68 @@ static IBaseFilter *find_filter_by_name(IFilterGraphImpl *graph, const WCHAR *na
}
/*** IFilterGraph methods ***/
static
HRESULT
WINAPI
FilterGraph2_AddFilter
(
IFilterGraph2
*
iface
,
IBaseFilter
*
pFilter
,
LPCWSTR
pN
ame
)
static
HRESULT
WINAPI
FilterGraph2_AddFilter
(
IFilterGraph2
*
iface
,
IBaseFilter
*
filter
,
const
WCHAR
*
n
ame
)
{
IFilterGraphImpl
*
This
=
impl_from_IFilterGraph2
(
iface
);
IFilterGraphImpl
*
graph
=
impl_from_IFilterGraph2
(
iface
);
BOOL
duplicate_name
=
FALSE
;
struct
filter
*
entry
;
unsigned
int
i
;
HRESULT
hr
;
int
j
;
WCHAR
*
wszFilterName
=
NULL
;
BOOL
duplicate_name
=
FALSE
;
TRACE
(
"
(%p/%p)->(%p, %s (%p))
\n
"
,
This
,
iface
,
pFilter
,
debugstr_w
(
pName
),
pName
);
TRACE
(
"
graph %p, filter %p, name %s.
\n
"
,
graph
,
filter
,
debugstr_w
(
name
)
);
if
(
!
pF
ilter
)
if
(
!
f
ilter
)
return
E_POINTER
;
wszFilterName
=
CoTaskMemAlloc
(
(
pName
?
lstrlenW
(
pName
)
+
6
:
5
)
*
sizeof
(
WCHAR
)
);
if
(
!
(
entry
=
heap_alloc
(
sizeof
(
*
entry
))))
return
E_OUTOFMEMORY
;
if
(
pName
&&
find_filter_by_name
(
This
,
pName
))
if
(
!
(
entry
->
name
=
CoTaskMemAlloc
((
name
?
wcslen
(
name
)
+
6
:
5
)
*
sizeof
(
WCHAR
))))
{
heap_free
(
entry
);
return
E_OUTOFMEMORY
;
}
if
(
name
&&
find_filter_by_name
(
graph
,
name
))
duplicate_name
=
TRUE
;
/* If no name given or name already existing, generate one */
if
(
!
pName
||
duplicate_name
)
if
(
!
name
||
duplicate_name
)
{
static
const
WCHAR
wszFmt1
[]
=
{
'%'
,
's'
,
' '
,
'%'
,
'0'
,
'4'
,
'd'
,
0
};
static
const
WCHAR
wszFmt2
[]
=
{
'%'
,
'0'
,
'4'
,
'd'
,
0
};
for
(
j
=
0
;
j
<
10000
;
j
++
)
{
/* Create name */
if
(
pName
)
swprintf
(
wszFilterName
,
pName
?
lstrlenW
(
pName
)
+
6
:
5
,
wszFmt1
,
pName
,
This
->
nameIndex
);
else
swprintf
(
wszFilterName
,
pName
?
lstrlenW
(
pName
)
+
6
:
5
,
wszFmt2
,
This
->
nameIndex
);
TRACE
(
"Generated name %s
\n
"
,
debugstr_w
(
wszFilterName
));
for
(
i
=
0
;
i
<
10000
;
++
i
)
{
if
(
name
)
swprintf
(
entry
->
name
,
name
?
wcslen
(
name
)
+
6
:
5
,
L"%s %04u"
,
name
,
graph
->
name_index
);
else
swprintf
(
entry
->
name
,
name
?
wcslen
(
name
)
+
6
:
5
,
L"%04u"
,
graph
->
name_index
);
if
(
This
->
nameIndex
++
==
10000
)
This
->
nameIndex
=
1
;
graph
->
name_index
=
(
graph
->
name_index
+
1
)
%
10000
;
if
(
!
find_filter_by_name
(
This
,
wszFilterN
ame
))
if
(
!
find_filter_by_name
(
graph
,
entry
->
n
ame
))
break
;
}
/* Unable to find a suitable name */
if
(
j
==
10000
)
{
CoTaskMemFree
(
wszFilterName
);
return
VFW_E_DUPLICATE_NAME
;
}
}
if
(
i
==
10000
)
{
CoTaskMemFree
(
entry
->
name
);
heap_free
(
entry
);
return
VFW_E_DUPLICATE_NAME
;
}
}
else
memcpy
(
wszFilterName
,
pName
,
(
lstrlenW
(
pName
)
+
1
)
*
sizeof
(
WCHAR
)
);
wcscpy
(
entry
->
name
,
name
);
hr
=
IBaseFilter_JoinFilterGraph
(
pFilter
,
(
IFilterGraph
*
)
&
This
->
IFilterGraph2_iface
,
wszFilterName
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
=
IBaseFilter_JoinFilterGraph
(
filter
,
(
IFilterGraph
*
)
&
graph
->
IFilterGraph2_iface
,
entry
->
name
)
))
{
CoTaskMemFree
(
wszFilterName
);
CoTaskMemFree
(
entry
->
name
);
heap_free
(
entry
);
return
hr
;
}
if
(
!
(
entry
=
heap_alloc
(
sizeof
(
*
entry
))))
{
CoTaskMemFree
(
wszFilterName
);
return
E_OUTOFMEMORY
;
}
IBaseFilter_AddRef
(
entry
->
filter
=
pFilter
);
entry
->
name
=
wszFilterName
;
list_add_head
(
&
This
->
filters
,
&
entry
->
entry
);
This
->
version
++
;
IBaseFilter_AddRef
(
entry
->
filter
=
filter
);
list_add_head
(
&
graph
->
filters
,
&
entry
->
entry
);
++
graph
->
version
;
return
duplicate_name
?
VFW_S_DUPLICATE_NAME
:
hr
;
}
...
...
@@ -5706,7 +5702,7 @@ static HRESULT filter_graph_common_create(IUnknown *outer, void **out, BOOL thre
fimpl
->
IGraphVersion_iface
.
lpVtbl
=
&
IGraphVersion_VTable
;
fimpl
->
ref
=
1
;
list_init
(
&
fimpl
->
filters
);
fimpl
->
name
I
ndex
=
1
;
fimpl
->
name
_i
ndex
=
1
;
fimpl
->
refClock
=
NULL
;
fimpl
->
hEventCompletion
=
CreateEventW
(
0
,
TRUE
,
FALSE
,
0
);
fimpl
->
HandleEcComplete
=
TRUE
;
...
...
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