amstream: Implement IAudioStreamSample::GetMediaStream().

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:35 +02:00 committed by Alexandre Julliard
parent 1b3121c2ed
commit 67b7d597c9
2 changed files with 62 additions and 2 deletions

View File

@ -213,9 +213,17 @@ static ULONG WINAPI IAudioStreamSampleImpl_Release(IAudioStreamSample *iface)
/*** IStreamSample methods ***/
static HRESULT WINAPI IAudioStreamSampleImpl_GetMediaStream(IAudioStreamSample *iface, IMediaStream **media_stream)
{
FIXME("(%p)->(%p): stub\n", iface, media_stream);
IAudioStreamSampleImpl *sample = impl_from_IAudioStreamSample(iface);
return E_NOTIMPL;
TRACE("sample %p, media_stream %p.\n", iface, media_stream);
if (!media_stream)
return E_POINTER;
IAMMediaStream_AddRef(&sample->parent->IAMMediaStream_iface);
*media_stream = (IMediaStream *)&sample->parent->IAMMediaStream_iface;
return S_OK;
}
static HRESULT WINAPI IAudioStreamSampleImpl_GetSampleTimes(IAudioStreamSample *iface, STREAM_TIME *start_time,

View File

@ -5629,6 +5629,57 @@ static void test_ddrawstream_getsetdirectdraw(void)
ok(!ref, "Got outstanding refcount %d.\n", ref);
}
static void test_audiostreamsample_get_media_stream(void)
{
IAMMultiMediaStream *mmstream = create_ammultimediastream();
IAudioStreamSample *audio_sample;
IAudioMediaStream *audio_stream;
IMediaStream *stream, *stream2;
IAudioData *audio_data;
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);
/* Crashes on native. */
if (0)
{
hr = IAudioStreamSample_GetMediaStream(audio_sample, NULL);
ok(hr == E_POINTER, "Got hr %#x.\n", hr);
}
EXPECT_REF(stream, 4);
hr = IAudioStreamSample_GetMediaStream(audio_sample, &stream2);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(stream2 == stream, "Expected stream %p, got %p.\n", stream, stream2);
EXPECT_REF(stream, 5);
IMediaStream_Release(stream2);
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;
@ -5675,6 +5726,7 @@ START_TEST(amstream)
test_audiostreamsample_update();
test_audiostreamsample_completion_status();
test_audiostreamsample_get_sample_times();
test_audiostreamsample_get_media_stream();
test_ddrawstream_initialize();
test_ddrawstream_getsetdirectdraw();