[PATCH 1/2] winegstreamer: Implement IMFMediaSource::Stop.
Zebediah Figura (she/her)
zfigura at codeweavers.com
Mon Nov 30 10:56:08 CST 2020
On 11/30/20 10:45 AM, Derek Lesho wrote:
> Signed-off-by: Derek Lesho <dlesho at codeweavers.com>
> ---
> dlls/winegstreamer/media_source.c | 29 +++++++++++++++++++++++++++--
> 1 file changed, 27 insertions(+), 2 deletions(-)
>
> diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c
> index 5c502cf3ed5..7d677e39feb 100644
> --- a/dlls/winegstreamer/media_source.c
> +++ b/dlls/winegstreamer/media_source.c
> @@ -64,6 +64,7 @@ struct media_stream
> enum source_async_op
> {
> SOURCE_ASYNC_START,
> + SOURCE_ASYNC_STOP,
> SOURCE_ASYNC_REQUEST_SAMPLE,
> };
>
> @@ -343,6 +344,22 @@ static void start_pipeline(struct media_source *source, struct source_async_comm
> gst_element_set_state(source->container, GST_STATE_PLAYING);
> }
>
> +static void stop_pipeline(struct media_source *source)
> +{
> + gst_element_set_state(source->container, GST_STATE_PAUSED);
> +
> + for (unsigned int i = 0; i < source->stream_count; i++)
Another misplaced variable initializer here. Please try harder to watch
for these.
> + {
> + struct media_stream *stream = source->streams[i];
> + if (stream->state != STREAM_INACTIVE)
> + IMFMediaEventQueue_QueueEventParamVar(stream->event_queue, MEStreamStopped, &GUID_NULL, S_OK, NULL);
> + }
> +
> + IMFMediaEventQueue_QueueEventParamVar(source->event_queue, MESourceStopped, &GUID_NULL, S_OK, NULL);
> +
> + source->state = SOURCE_STOPPED;
> +}
> +
> static void dispatch_end_of_presentation(struct media_source *source)
> {
> PROPVARIANT empty = {.vt = VT_EMPTY};
> @@ -417,6 +434,9 @@ static HRESULT WINAPI source_async_commands_Invoke(IMFAsyncCallback *iface, IMFA
> case SOURCE_ASYNC_START:
> start_pipeline(source, command);
> break;
> + case SOURCE_ASYNC_STOP:
> + stop_pipeline(source);
> + break;
> case SOURCE_ASYNC_REQUEST_SAMPLE:
> wait_on_sample(command->u.request_sample.stream, command->u.request_sample.token);
> break;
> @@ -1087,13 +1107,18 @@ static HRESULT WINAPI media_source_Start(IMFMediaSource *iface, IMFPresentationD
> static HRESULT WINAPI media_source_Stop(IMFMediaSource *iface)
> {
> struct media_source *source = impl_from_IMFMediaSource(iface);
> + struct source_async_command *command;
> + HRESULT hr;
>
> - FIXME("(%p): stub\n", source);
> + TRACE("(%p)\n", source);
>
> if (source->state == SOURCE_SHUTDOWN)
> return MF_E_SHUTDOWN;
>
> - return E_NOTIMPL;
> + if (SUCCEEDED(hr = source_create_async_op(SOURCE_ASYNC_STOP, &command)))
> + hr = MFPutWorkItem(source->async_commands_queue, &source->async_commands_callback, &command->IUnknown_iface);
> +
> + return hr;
> }
>
> static HRESULT WINAPI media_source_Pause(IMFMediaSource *iface)
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x0D9D358A07A17840.asc
Type: application/pgp-keys
Size: 1769 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20201130/c87493b6/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20201130/c87493b6/attachment.sig>
More information about the wine-devel
mailing list