[PATCH 1/2] winegstreamer: Implement IMFMediaSource::Stop.
Derek Lesho
dlesho at codeweavers.com
Mon Nov 30 11:00:47 CST 2020
On 11/30/20 11:56 AM, Zebediah Figura (she/her) wrote:
> 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.
Whoops, sorry. It's muscle memory at this point for me to use this
form, so I'll try to create a commit hook to avoid this in the future.
>
>> + {
>> + 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)
>>
More information about the wine-devel
mailing list