winegstreamer: Implement IMFMediaSource::Shutdown.

Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Derek Lesho 2020-09-02 14:26:02 -05:00 committed by Alexandre Julliard
parent d832ebf1b0
commit e7b8911695
2 changed files with 36 additions and 4 deletions

View File

@ -673,14 +673,14 @@ todo_wine
IMFMediaTypeHandler_Release(handler); IMFMediaTypeHandler_Release(handler);
IMFPresentationDescriptor_Release(descriptor); IMFPresentationDescriptor_Release(descriptor);
skip_source_tests:
hr = IMFMediaSource_Shutdown(mediasource); hr = IMFMediaSource_Shutdown(mediasource);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMFMediaSource_CreatePresentationDescriptor(mediasource, NULL); hr = IMFMediaSource_CreatePresentationDescriptor(mediasource, NULL);
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
skip_source_tests:
IMFMediaSource_Release(mediasource); IMFMediaSource_Release(mediasource);
IMFByteStream_Release(stream); IMFByteStream_Release(stream);

View File

@ -39,6 +39,12 @@ struct media_source
IMFMediaSource IMFMediaSource_iface; IMFMediaSource IMFMediaSource_iface;
LONG ref; LONG ref;
IMFMediaEventQueue *event_queue; IMFMediaEventQueue *event_queue;
enum
{
SOURCE_OPENING,
SOURCE_STOPPED,
SOURCE_SHUTDOWN,
} state;
}; };
static inline struct media_source *impl_from_IMFMediaSource(IMFMediaSource *iface) static inline struct media_source *impl_from_IMFMediaSource(IMFMediaSource *iface)
@ -88,6 +94,7 @@ static ULONG WINAPI media_source_Release(IMFMediaSource *iface)
if (!ref) if (!ref)
{ {
IMFMediaSource_Shutdown(&source->IMFMediaSource_iface);
IMFMediaEventQueue_Release(source->event_queue); IMFMediaEventQueue_Release(source->event_queue);
heap_free(source); heap_free(source);
} }
@ -138,6 +145,9 @@ static HRESULT WINAPI media_source_GetCharacteristics(IMFMediaSource *iface, DWO
FIXME("(%p)->(%p): stub\n", source, characteristics); FIXME("(%p)->(%p): stub\n", source, characteristics);
if (source->state == SOURCE_SHUTDOWN)
return MF_E_SHUTDOWN;
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -147,6 +157,9 @@ static HRESULT WINAPI media_source_CreatePresentationDescriptor(IMFMediaSource *
FIXME("(%p)->(%p): stub\n", source, descriptor); FIXME("(%p)->(%p): stub\n", source, descriptor);
if (source->state == SOURCE_SHUTDOWN)
return MF_E_SHUTDOWN;
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -157,6 +170,9 @@ static HRESULT WINAPI media_source_Start(IMFMediaSource *iface, IMFPresentationD
FIXME("(%p)->(%p, %p, %p): stub\n", source, descriptor, time_format, start_position); FIXME("(%p)->(%p, %p, %p): stub\n", source, descriptor, time_format, start_position);
if (source->state == SOURCE_SHUTDOWN)
return MF_E_SHUTDOWN;
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -166,6 +182,9 @@ static HRESULT WINAPI media_source_Stop(IMFMediaSource *iface)
FIXME("(%p): stub\n", source); FIXME("(%p): stub\n", source);
if (source->state == SOURCE_SHUTDOWN)
return MF_E_SHUTDOWN;
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -175,6 +194,9 @@ static HRESULT WINAPI media_source_Pause(IMFMediaSource *iface)
FIXME("(%p): stub\n", source); FIXME("(%p): stub\n", source);
if (source->state == SOURCE_SHUTDOWN)
return MF_E_SHUTDOWN;
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -182,9 +204,17 @@ static HRESULT WINAPI media_source_Shutdown(IMFMediaSource *iface)
{ {
struct media_source *source = impl_from_IMFMediaSource(iface); struct media_source *source = impl_from_IMFMediaSource(iface);
FIXME("(%p): stub\n", source); TRACE("(%p)\n", source);
return E_NOTIMPL; if (source->state == SOURCE_SHUTDOWN)
return MF_E_SHUTDOWN;
source->state = SOURCE_SHUTDOWN;
if (source->event_queue)
IMFMediaEventQueue_Shutdown(source->event_queue);
return S_OK;
} }
static const IMFMediaSourceVtbl IMFMediaSource_vtbl = static const IMFMediaSourceVtbl IMFMediaSource_vtbl =
@ -215,6 +245,8 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
if (FAILED(hr = MFCreateEventQueue(&object->event_queue))) if (FAILED(hr = MFCreateEventQueue(&object->event_queue)))
goto fail; goto fail;
object->state = SOURCE_STOPPED;
object->IMFMediaSource_iface.lpVtbl = &IMFMediaSource_vtbl; object->IMFMediaSource_iface.lpVtbl = &IMFMediaSource_vtbl;
object->ref = 1; object->ref = 1;