Commit e7b89116 authored by Derek Lesho's avatar Derek Lesho Committed by Alexandre Julliard

winegstreamer: Implement IMFMediaSource::Shutdown.

parent d832ebf1
...@@ -673,14 +673,14 @@ todo_wine ...@@ -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);
......
...@@ -39,6 +39,12 @@ struct media_source ...@@ -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) ...@@ -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 ...@@ -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 * ...@@ -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 ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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_ ...@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment