Gijs Vermeulen : amstream: Implement IAudioStreamSample::GetAudioData().
Alexandre Julliard
julliard at winehq.org
Wed Jul 29 15:47:01 CDT 2020
Module: wine
Branch: master
Commit: b8a39aaf759e20ee738bdee7cbcef2119d524f6e
URL: https://source.winehq.org/git/wine.git/?a=commit;h=b8a39aaf759e20ee738bdee7cbcef2119d524f6e
Author: Gijs Vermeulen <gijsvrm at gmail.com>
Date: Wed Jul 29 12:30:36 2020 +0200
amstream: Implement IAudioStreamSample::GetAudioData().
Signed-off-by: Gijs Vermeulen <gijsvrm at gmail.com>
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/amstream/audiostream.c | 12 +++++++++--
dlls/amstream/tests/amstream.c | 48 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 58 insertions(+), 2 deletions(-)
diff --git a/dlls/amstream/audiostream.c b/dlls/amstream/audiostream.c
index 0761050a65..41f225d022 100644
--- a/dlls/amstream/audiostream.c
+++ b/dlls/amstream/audiostream.c
@@ -351,9 +351,17 @@ static HRESULT WINAPI IAudioStreamSampleImpl_CompletionStatus(IAudioStreamSample
/*** IAudioStreamSample methods ***/
static HRESULT WINAPI IAudioStreamSampleImpl_GetAudioData(IAudioStreamSample *iface, IAudioData **audio_data)
{
- FIXME("(%p)->(%p): stub\n", iface, audio_data);
+ IAudioStreamSampleImpl *sample = impl_from_IAudioStreamSample(iface);
- return E_NOTIMPL;
+ TRACE("sample %p, audio_data %p.\n", sample, audio_data);
+
+ if (!audio_data)
+ return E_POINTER;
+
+ IAudioData_AddRef(sample->audio_data);
+ *audio_data = sample->audio_data;
+
+ return S_OK;
}
static const struct IAudioStreamSampleVtbl AudioStreamSample_Vtbl =
diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c
index d1c3992585..130f9f0e0e 100644
--- a/dlls/amstream/tests/amstream.c
+++ b/dlls/amstream/tests/amstream.c
@@ -5680,6 +5680,53 @@ static void test_audiostreamsample_get_media_stream(void)
ok(!ref, "Got outstanding refcount %d.\n", ref);
}
+static void test_audiostreamsample_get_audio_data(void)
+{
+ IAMMultiMediaStream *mmstream = create_ammultimediastream();
+ IAudioData *audio_data, *audio_data2;
+ IAudioStreamSample *audio_sample;
+ IAudioMediaStream *audio_stream;
+ IMediaStream *stream;
+ HRESULT hr;
+ ULONG ref;
+
+ hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_READ, 0, NULL);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryAudio, 0, &stream);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = IMediaStream_QueryInterface(stream, &IID_IAudioMediaStream, (void **)&audio_stream);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = CoCreateInstance(&CLSID_AMAudioData, NULL, CLSCTX_INPROC_SERVER, &IID_IAudioData, (void **)&audio_data);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = IAudioMediaStream_CreateSample(audio_stream, audio_data, 0, &audio_sample);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = IAudioStreamSample_GetAudioData(audio_sample, NULL);
+ ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+
+ EXPECT_REF(audio_data, 2);
+ hr = IAudioStreamSample_GetAudioData(audio_sample, &audio_data2);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(audio_data2 == audio_data, "Expected audio data %p, got %p.\n", audio_data, audio_data2);
+ EXPECT_REF(audio_data, 3);
+
+ IAudioData_Release(audio_data2);
+
+ IAudioMediaStream_Release(audio_stream);
+ ref = IAudioStreamSample_Release(audio_sample);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
+ ref = IAudioData_Release(audio_data);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
+ ref = IAMMultiMediaStream_Release(mmstream);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
+ ref = IMediaStream_Release(stream);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
+}
+
START_TEST(amstream)
{
const WCHAR *test_avi_path;
@@ -5727,6 +5774,7 @@ START_TEST(amstream)
test_audiostreamsample_completion_status();
test_audiostreamsample_get_sample_times();
test_audiostreamsample_get_media_stream();
+ test_audiostreamsample_get_audio_data();
test_ddrawstream_initialize();
test_ddrawstream_getsetdirectdraw();
More information about the wine-cvs
mailing list