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
c71ac523
Commit
c71ac523
authored
Mar 26, 2022
by
Zebediah Figura
Committed by
Alexandre Julliard
Mar 28, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
amstream: Use CRT memory allocators.
Signed-off-by:
Zebediah Figura
<
zfigura@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ed8cf75a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
54 deletions
+45
-54
amstream_private.h
dlls/amstream/amstream_private.h
+0
-1
audiodata.c
dlls/amstream/audiodata.c
+9
-13
audiostream.c
dlls/amstream/audiostream.c
+11
-13
ddrawstream.c
dlls/amstream/ddrawstream.c
+7
-9
filter.c
dlls/amstream/filter.c
+12
-12
main.c
dlls/amstream/main.c
+3
-3
multimedia.c
dlls/amstream/multimedia.c
+3
-3
No files found.
dlls/amstream/amstream_private.h
View file @
c71ac523
...
...
@@ -32,7 +32,6 @@
#include "mmstream.h"
#include "austream.h"
#include "amstream.h"
#include "wine/heap.h"
HRESULT
multimedia_stream_create
(
IUnknown
*
outer
,
void
**
out
)
DECLSPEC_HIDDEN
;
HRESULT
AMAudioData_create
(
IUnknown
*
pUnkOuter
,
LPVOID
*
ppObj
)
DECLSPEC_HIDDEN
;
...
...
dlls/amstream/audiodata.c
View file @
c71ac523
...
...
@@ -71,19 +71,16 @@ static ULONG WINAPI IAudioDataImpl_AddRef(IAudioData* iface)
static
ULONG
WINAPI
IAudioDataImpl_Release
(
IAudioData
*
iface
)
{
AMAudioDataImpl
*
This
=
impl_from_IAudioData
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
AMAudioDataImpl
*
audiodata
=
impl_from_IAudioData
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
audiodata
->
ref
);
TRACE
(
"
(%p)->(): new ref = %lu
\n
"
,
iface
,
This
->
ref
);
TRACE
(
"
%p decreasing refcount to %lu.
\n
"
,
audiodata
,
ref
);
if
(
!
ref
)
{
if
(
This
->
data_owned
)
{
CoTaskMemFree
(
This
->
data
);
}
HeapFree
(
GetProcessHeap
(),
0
,
This
);
if
(
audiodata
->
data_owned
)
free
(
audiodata
->
data
);
free
(
audiodata
);
}
return
ref
;
...
...
@@ -103,7 +100,7 @@ static HRESULT WINAPI IAudioDataImpl_SetBuffer(IAudioData* iface, DWORD size, BY
if
(
This
->
data_owned
)
{
CoTaskMemF
ree
(
This
->
data
);
f
ree
(
This
->
data
);
This
->
data_owned
=
FALSE
;
}
...
...
@@ -112,7 +109,7 @@ static HRESULT WINAPI IAudioDataImpl_SetBuffer(IAudioData* iface, DWORD size, BY
if
(
!
This
->
data
)
{
This
->
data
=
CoTaskMemA
lloc
(
This
->
size
);
This
->
data
=
ma
lloc
(
This
->
size
);
This
->
data_owned
=
TRUE
;
if
(
!
This
->
data
)
{
...
...
@@ -228,8 +225,7 @@ HRESULT AMAudioData_create(IUnknown *pUnkOuter, LPVOID *ppObj)
if
(
pUnkOuter
)
return
CLASS_E_NOAGGREGATION
;
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
AMAudioDataImpl
));
if
(
!
object
)
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
object
->
IAudioData_iface
.
lpVtbl
=
&
AudioData_Vtbl
;
...
...
dlls/amstream/audiostream.c
View file @
c71ac523
...
...
@@ -202,7 +202,7 @@ static ULONG WINAPI audio_sample_Release(IAudioStreamSample *iface)
IAMMediaStream_Release
(
&
sample
->
parent
->
IAMMediaStream_iface
);
IAudioData_Release
(
sample
->
audio_data
);
CloseHandle
(
sample
->
update_event
);
HeapFree
(
GetProcessHeap
(),
0
,
sample
);
free
(
sample
);
}
return
refcount
;
}
...
...
@@ -383,8 +383,7 @@ static HRESULT audiostreamsample_create(struct audio_stream *parent, IAudioData
TRACE
(
"(%p)
\n
"
,
audio_stream_sample
);
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
if
(
!
object
)
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
object
->
IAudioStreamSample_iface
.
lpVtbl
=
&
AudioStreamSample_Vtbl
;
...
...
@@ -456,15 +455,15 @@ static ULONG WINAPI audio_IAMMediaStream_AddRef(IAMMediaStream *iface)
static
ULONG
WINAPI
audio_IAMMediaStream_Release
(
IAMMediaStream
*
iface
)
{
struct
audio_stream
*
This
=
impl_from_IAMMediaStream
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
struct
audio_stream
*
stream
=
impl_from_IAMMediaStream
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
stream
->
ref
);
TRACE
(
"
(%p/%p)->(): new ref = %lu
\n
"
,
iface
,
This
,
ref
);
TRACE
(
"
%p decreasing refcount to %lu.
\n
"
,
stream
,
ref
);
if
(
!
ref
)
{
DeleteCriticalSection
(
&
This
->
cs
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
DeleteCriticalSection
(
&
stream
->
cs
);
free
(
stream
);
}
return
ref
;
...
...
@@ -830,7 +829,7 @@ static ULONG WINAPI enum_media_types_Release(IEnumMediaTypes *iface)
ULONG
refcount
=
InterlockedDecrement
(
&
enum_media_types
->
refcount
);
TRACE
(
"%p decreasing refcount to %lu.
\n
"
,
enum_media_types
,
refcount
);
if
(
!
refcount
)
heap_
free
(
enum_media_types
);
free
(
enum_media_types
);
return
refcount
;
}
...
...
@@ -904,7 +903,7 @@ static HRESULT WINAPI enum_media_types_Clone(IEnumMediaTypes *iface, IEnumMediaT
TRACE
(
"iface %p, out %p.
\n
"
,
iface
,
out
);
if
(
!
(
object
=
heap_alloc
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
object
->
IEnumMediaTypes_iface
.
lpVtbl
=
&
enum_media_types_vtbl
;
...
...
@@ -1121,7 +1120,7 @@ static HRESULT WINAPI audio_sink_EnumMediaTypes(IPin *iface, IEnumMediaTypes **e
if
(
!
enum_media_types
)
return
E_POINTER
;
if
(
!
(
object
=
heap_alloc
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
object
->
IEnumMediaTypes_iface
.
lpVtbl
=
&
enum_media_types_vtbl
;
...
...
@@ -1394,8 +1393,7 @@ HRESULT audio_stream_create(IUnknown *outer, void **out)
if
(
outer
)
return
CLASS_E_NOAGGREGATION
;
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
if
(
!
object
)
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
object
->
IAMMediaStream_iface
.
lpVtbl
=
&
audio_IAMMediaStream_vtbl
;
...
...
dlls/amstream/ddrawstream.c
View file @
c71ac523
...
...
@@ -229,7 +229,7 @@ static ULONG WINAPI ddraw_IAMMediaStream_Release(IAMMediaStream *iface)
DeleteCriticalSection
(
&
stream
->
cs
);
if
(
stream
->
ddraw
)
IDirectDraw_Release
(
stream
->
ddraw
);
HeapFree
(
GetProcessHeap
(),
0
,
stream
);
free
(
stream
);
}
return
ref
;
...
...
@@ -815,7 +815,7 @@ static ULONG WINAPI enum_media_types_Release(IEnumMediaTypes *iface)
ULONG
refcount
=
InterlockedDecrement
(
&
enum_media_types
->
refcount
);
TRACE
(
"%p decreasing refcount to %lu.
\n
"
,
enum_media_types
,
refcount
);
if
(
!
refcount
)
heap_
free
(
enum_media_types
);
free
(
enum_media_types
);
return
refcount
;
}
...
...
@@ -873,7 +873,7 @@ static HRESULT WINAPI enum_media_types_Clone(IEnumMediaTypes *iface, IEnumMediaT
TRACE
(
"iface %p, out %p.
\n
"
,
iface
,
out
);
if
(
!
(
object
=
heap_alloc
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
object
->
IEnumMediaTypes_iface
.
lpVtbl
=
&
enum_media_types_vtbl
;
...
...
@@ -1148,7 +1148,7 @@ static HRESULT WINAPI ddraw_sink_EnumMediaTypes(IPin *iface, IEnumMediaTypes **e
if
(
!
enum_media_types
)
return
E_POINTER
;
if
(
!
(
object
=
heap_alloc
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
object
->
IEnumMediaTypes_iface
.
lpVtbl
=
&
enum_media_types_vtbl
;
...
...
@@ -1460,8 +1460,7 @@ HRESULT ddraw_stream_create(IUnknown *outer, void **out)
if
(
outer
)
return
CLASS_E_NOAGGREGATION
;
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
if
(
!
object
)
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
object
->
IAMMediaStream_iface
.
lpVtbl
=
&
ddraw_IAMMediaStream_vtbl
;
...
...
@@ -1539,7 +1538,7 @@ static ULONG WINAPI ddraw_sample_Release(IDirectDrawStreamSample *iface)
if
(
sample
->
surface
)
IDirectDrawSurface_Release
(
sample
->
surface
);
HeapFree
(
GetProcessHeap
(),
0
,
sample
);
free
(
sample
);
}
return
ref
;
...
...
@@ -1736,8 +1735,7 @@ static HRESULT ddrawstreamsample_create(struct ddraw_stream *parent, IDirectDraw
TRACE
(
"(%p)
\n
"
,
ddraw_stream_sample
);
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
if
(
!
object
)
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
object
->
IDirectDrawStreamSample_iface
.
lpVtbl
=
&
DirectDrawStreamSample_Vtbl
;
...
...
dlls/amstream/filter.c
View file @
c71ac523
...
...
@@ -76,8 +76,8 @@ static ULONG WINAPI enum_pins_Release(IEnumPins *iface)
{
for
(
i
=
0
;
i
<
enum_pins
->
count
;
++
i
)
IPin_Release
(
enum_pins
->
pins
[
i
]);
heap_
free
(
enum_pins
->
pins
);
heap_
free
(
enum_pins
);
free
(
enum_pins
->
pins
);
free
(
enum_pins
);
}
return
refcount
;
}
...
...
@@ -131,16 +131,16 @@ static HRESULT WINAPI enum_pins_Clone(IEnumPins *iface, IEnumPins **out)
TRACE
(
"iface %p, out %p.
\n
"
,
iface
,
out
);
if
(
!
(
object
=
heap_alloc
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
object
->
IEnumPins_iface
.
lpVtbl
=
&
enum_pins_vtbl
;
object
->
refcount
=
1
;
object
->
count
=
enum_pins
->
count
;
object
->
index
=
enum_pins
->
index
;
if
(
!
(
object
->
pins
=
heap_
alloc
(
enum_pins
->
count
*
sizeof
(
*
object
->
pins
))))
if
(
!
(
object
->
pins
=
m
alloc
(
enum_pins
->
count
*
sizeof
(
*
object
->
pins
))))
{
heap_
free
(
object
);
free
(
object
);
return
E_OUTOFMEMORY
;
}
for
(
i
=
0
;
i
<
enum_pins
->
count
;
++
i
)
...
...
@@ -251,11 +251,11 @@ static ULONG WINAPI filter_Release(IMediaStreamFilter *iface)
IAMMediaStream_JoinFilter
(
filter
->
streams
[
i
],
NULL
);
IAMMediaStream_Release
(
filter
->
streams
[
i
]);
}
heap_
free
(
filter
->
streams
);
free
(
filter
->
streams
);
if
(
filter
->
clock
)
IReferenceClock_Release
(
filter
->
clock
);
DeleteCriticalSection
(
&
filter
->
cs
);
heap_
free
(
filter
);
free
(
filter
);
}
return
refcount
;
...
...
@@ -424,7 +424,7 @@ static HRESULT WINAPI filter_EnumPins(IMediaStreamFilter *iface, IEnumPins **enu
if
(
!
enum_pins
)
return
E_POINTER
;
if
(
!
(
object
=
heap_alloc
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
EnterCriticalSection
(
&
filter
->
cs
);
...
...
@@ -433,9 +433,9 @@ static HRESULT WINAPI filter_EnumPins(IMediaStreamFilter *iface, IEnumPins **enu
object
->
refcount
=
1
;
object
->
count
=
filter
->
nb_streams
;
object
->
index
=
0
;
if
(
!
(
object
->
pins
=
heap_
alloc
(
filter
->
nb_streams
*
sizeof
(
*
object
->
pins
))))
if
(
!
(
object
->
pins
=
m
alloc
(
filter
->
nb_streams
*
sizeof
(
*
object
->
pins
))))
{
heap_
free
(
object
);
free
(
object
);
LeaveCriticalSection
(
&
filter
->
cs
);
return
E_OUTOFMEMORY
;
}
...
...
@@ -543,7 +543,7 @@ static HRESULT WINAPI filter_AddMediaStream(IMediaStreamFilter *iface, IAMMediaS
TRACE
(
"(%p)->(%p)
\n
"
,
iface
,
pAMMediaStream
);
streams
=
CoTaskMemRealloc
(
This
->
streams
,
(
This
->
nb_streams
+
1
)
*
sizeof
(
IAMMediaStream
*
));
streams
=
realloc
(
This
->
streams
,
(
This
->
nb_streams
+
1
)
*
sizeof
(
*
streams
));
if
(
!
streams
)
return
E_OUTOFMEMORY
;
This
->
streams
=
streams
;
...
...
@@ -1092,7 +1092,7 @@ HRESULT filter_create(IUnknown *outer, void **out)
if
(
outer
)
return
CLASS_E_NOAGGREGATION
;
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
object
->
IMediaStreamFilter_iface
.
lpVtbl
=
&
filter_vtbl
;
...
...
dlls/amstream/main.c
View file @
c71ac523
...
...
@@ -93,7 +93,7 @@ static ULONG WINAPI AMCF_Release(IClassFactory *iface)
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
if
(
ref
==
0
)
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
return
ref
;
}
...
...
@@ -173,8 +173,8 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
return
CLASS_E_CLASSNOTAVAILABLE
;
}
factory
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
factory
));
if
(
factory
==
NULL
)
return
E_OUTOFMEMORY
;
if
(
!
(
factory
=
calloc
(
1
,
sizeof
(
*
factory
))))
return
E_OUTOFMEMORY
;
factory
->
IClassFactory_iface
.
lpVtbl
=
&
DSCF_Vtbl
;
factory
->
ref
=
1
;
...
...
dlls/amstream/multimedia.c
View file @
c71ac523
...
...
@@ -100,7 +100,7 @@ static ULONG WINAPI multimedia_stream_Release(IAMMultiMediaStream *iface)
IMediaControl_Release
(
This
->
media_control
);
if
(
This
->
graph
)
IGraphBuilder_Release
(
This
->
graph
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -562,7 +562,7 @@ HRESULT multimedia_stream_create(IUnknown *outer, void **out)
if
(
outer
)
return
CLASS_E_NOAGGREGATION
;
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
object
->
IAMMultiMediaStream_iface
.
lpVtbl
=
&
multimedia_stream_vtbl
;
...
...
@@ -572,7 +572,7 @@ HRESULT multimedia_stream_create(IUnknown *outer, void **out)
CLSCTX_INPROC_SERVER
,
&
IID_IMediaStreamFilter
,
(
void
**
)
&
object
->
filter
)))
{
ERR
(
"Failed to create stream filter, hr %#lx.
\n
"
,
hr
);
heap_
free
(
object
);
free
(
object
);
return
hr
;
}
...
...
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