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
d4db4bfd
Commit
d4db4bfd
authored
Jul 28, 2016
by
Anton Baskanov
Committed by
Alexandre Julliard
Aug 02, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
amstream: Implement AMAudioData::SetBuffer.
Signed-off-by:
Anton Baskanov
<
baskanov@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6010ebb2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
2 deletions
+84
-2
audiodata.c
dlls/amstream/audiodata.c
+36
-2
amstream.c
dlls/amstream/tests/amstream.c
+48
-0
No files found.
dlls/amstream/audiodata.c
View file @
d4db4bfd
...
...
@@ -32,6 +32,7 @@ typedef struct {
LONG
ref
;
DWORD
size
;
BYTE
*
data
;
BOOL
data_owned
;
DWORD
actual_data
;
}
AMAudioDataImpl
;
...
...
@@ -75,7 +76,14 @@ static ULONG WINAPI IAudioDataImpl_Release(IAudioData* iface)
TRACE
(
"(%p)->(): new ref = %u
\n
"
,
iface
,
This
->
ref
);
if
(
!
ref
)
{
if
(
This
->
data_owned
)
{
CoTaskMemFree
(
This
->
data
);
}
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
return
ref
;
}
...
...
@@ -83,9 +91,35 @@ static ULONG WINAPI IAudioDataImpl_Release(IAudioData* iface)
/*** IMemoryData methods ***/
static
HRESULT
WINAPI
IAudioDataImpl_SetBuffer
(
IAudioData
*
iface
,
DWORD
size
,
BYTE
*
data
,
DWORD
flags
)
{
FIXME
(
"(%p)->(%u,%p,%x): stub
\n
"
,
iface
,
size
,
data
,
flags
);
AMAudioDataImpl
*
This
=
impl_from_IAudioData
(
iface
);
return
E_NOTIMPL
;
TRACE
(
"(%p)->(%u,%p,%x)
\n
"
,
iface
,
size
,
data
,
flags
);
if
(
!
size
)
{
return
E_INVALIDARG
;
}
if
(
This
->
data_owned
)
{
CoTaskMemFree
(
This
->
data
);
This
->
data_owned
=
FALSE
;
}
This
->
size
=
size
;
This
->
data
=
data
;
if
(
!
This
->
data
)
{
This
->
data
=
CoTaskMemAlloc
(
This
->
size
);
This
->
data_owned
=
TRUE
;
if
(
!
This
->
data
)
{
return
E_OUTOFMEMORY
;
}
}
return
S_OK
;
}
static
HRESULT
WINAPI
IAudioDataImpl_GetInfo
(
IAudioData
*
iface
,
DWORD
*
length
,
BYTE
**
data
,
DWORD
*
actual_data
)
...
...
dlls/amstream/tests/amstream.c
View file @
d4db4bfd
...
...
@@ -650,6 +650,53 @@ out_unknown:
IUnknown_Release
(
unknown
);
}
static
void
test_audiodata_set_buffer
(
void
)
{
IUnknown
*
unknown
=
create_audio_data
();
IAudioData
*
audio_data
=
NULL
;
BYTE
buffer
[
100
]
=
{
0
};
DWORD
length
=
0
;
BYTE
*
data
=
NULL
;
HRESULT
result
;
result
=
IUnknown_QueryInterface
(
unknown
,
&
IID_IAudioData
,
(
void
**
)
&
audio_data
);
if
(
FAILED
(
result
))
{
/* test_audiodata_query_interface handles this case */
skip
(
"No IAudioData
\n
"
);
goto
out_unknown
;
}
result
=
IAudioData_SetBuffer
(
audio_data
,
100
,
NULL
,
0
);
ok
(
S_OK
==
result
,
"got 0x%08x
\n
"
,
result
);
data
=
(
BYTE
*
)
0xdeadbeef
;
length
=
0xdeadbeef
;
result
=
IAudioData_GetInfo
(
audio_data
,
&
length
,
&
data
,
NULL
);
ok
(
S_OK
==
result
,
"got 0x%08x
\n
"
,
result
);
ok
(
100
==
length
,
"got %u
\n
"
,
length
);
ok
(
NULL
!=
data
,
"got %p
\n
"
,
data
);
result
=
IAudioData_SetBuffer
(
audio_data
,
0
,
buffer
,
0
);
ok
(
E_INVALIDARG
==
result
,
"got 0x%08x
\n
"
,
result
);
result
=
IAudioData_SetBuffer
(
audio_data
,
sizeof
(
buffer
),
buffer
,
0
);
ok
(
S_OK
==
result
,
"got 0x%08x
\n
"
,
result
);
data
=
(
BYTE
*
)
0xdeadbeef
;
length
=
0xdeadbeef
;
result
=
IAudioData_GetInfo
(
audio_data
,
&
length
,
&
data
,
NULL
);
ok
(
S_OK
==
result
,
"got 0x%08x
\n
"
,
result
);
ok
(
sizeof
(
buffer
)
==
length
,
"got %u
\n
"
,
length
);
ok
(
buffer
==
data
,
"got %p
\n
"
,
data
);
IAudioData_Release
(
audio_data
);
out_unknown:
IUnknown_Release
(
unknown
);
}
START_TEST
(
amstream
)
{
HANDLE
file
;
...
...
@@ -670,6 +717,7 @@ START_TEST(amstream)
test_audiodata_query_interface
();
test_audiodata_get_info
();
test_audiodata_set_buffer
();
CoUninitialize
();
}
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