amstream: Implement IAudioStreamSample::GetAudioData().

Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gijs Vermeulen 2020-07-29 12:30:36 +02:00 committed by Alexandre Julliard
parent 67b7d597c9
commit b8a39aaf75
2 changed files with 58 additions and 2 deletions

View File

@ -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 =

View File

@ -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();