Commit Graph

62 Commits

Author SHA1 Message Date
Zebediah Figura 6f1b3cf975 winegstreamer: Explicitly disable streams in start_pipeline().
Allow the initial state of a stream to be enabled.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-11 10:12:17 +02:00
Zebediah Figura a4be9e8568 winegstreamer: Flatten wg_parser_event into a wg_parser_buffer structure.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-24 08:49:56 +01:00
Zebediah Figura 28c9c138d2 winegstreamer: Return S_FALSE from wg_parser_stream_get_event() if the stream is EOS.
Instead of using WG_PARSER_EVENT_EOS.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-24 08:49:46 +01:00
Zebediah Figura 5144b27661 winegstreamer: Remove support for flushing the wg_parser object.
Aside from EOS logic, which is now handled entirely on the client side,
wg_parser_stream_get_event() now only waits for data processing—that is,
demuxing, decoding, and format conversion. While unblocking waits in
wg_parser_stream_get_event() does allow that function to return immediately, a
subsequent seek request in GStreamer will still have to wait for that data
processing to complete and for the stream thread to return to the demuxer's main
loop. In essence, wg_parser_begin_flush() is only moving costs around.

In theory we could force the GStreamer pipeline to complete faster by actually
flushing it. In practice this isn't really true. Individual elements do check
whether they are flushing before processing, but even elements which take a
relatively long time (i.e. multiple milliseconds) to process data don't
periodically check whether they are flushing while doing so. Although there is
arguably a benefit to skipping some elements by flushing the GStreamer pipeline,
it does not seem worth the added code complexity in Wine.

The real point of flushing in DirectShow or GStreamer is to unblock long or
unbounded waits in sink elements (i.e. waits for PTS, or waits for running state
while rendering preroll frames). None of these waits apply here. Waits for
actual sample processing complete in bounded time, and should ideally take less
than the sample DTS to complete (or we are already in trouble).

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-24 08:49:38 +01:00
Giovanni Mascellani 4853f65c84 winegstreamer: Do not block forever if EOS races with command queue.
Currently, the winegstreamer media source checks for EOS when
RequestSample() is called, but doesn't handle the cases when EOS
is detected between the RequestSample() call and the moment when
the request is popped from the command queue and serviced. This
can result in the media source waiting forever for a sample and
get stuck.

This commit fixes the bug by adding a check for EOS in
wait_for_event().

This commit fixes Medieval Dynasty hanging on developer logos on
the Steam Deck.

Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-22 22:42:12 +01:00
Zebediah Figura f51b2ca8f7 winegstreamer: No longer queue WG_PARSER_EVENT_SEGMENT.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-22 18:20:23 +01:00
Nikolay Sivov decfb2b2ab winegstreamer: Maintain playback rate value for the media source.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-16 22:05:33 +01:00
Nikolay Sivov a1e125e4fb winegstreamer: Raise MESourceRateChanged on SetRate().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-15 22:59:53 +01:00
Zebediah Figura 91c993bb78 winegstreamer: Build without -DWINE_NO_LONG_TYPES.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-04 09:48:31 +01:00
Zebediah Figura 3efb72de5a winegstreamer: Avoid seeking past the end of an IMFByteStream.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51837
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:51 +02:00
Zebediah Figura 585acfa041 winegstreamer: Avoid passing a NULL buffer to wg_parser_push_data() in the case of a zero-length read.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:49 +02:00
Zebediah Figura 59997c355f winegstreamer: Use array_reserve() to reallocate read buffers.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:46 +02:00
Zebediah Figura 4ba31162c3 winegstreamer: Convert the Unix library to the __wine_unix_call interface.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-05 11:31:47 +02:00
Zebediah Figura 45690320f9 winegstreamer: Set unlimited buffering using a flag for wg_parser_create().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-02 00:42:55 +02:00
Zebediah Figura eab189810d winegstreamer: Use a single wg_parser_create() entry point.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-02 00:42:13 +02:00
Giovanni Mascellani d869f4a8bc winegstreamer/media_source: Implement paused state.
For asynchronous elements like a media source the paused state is rather
similar to the playing state. The most revelant difference is that
RequestSample commands are not immediately executed, but are scheduled
in an internal queue. As soon as playback is restarted, all pending
operations are submitted again (or they are discarded if playback is
stopped).

This patch implements such a queue, together with proper event emitting
when the media source is paused. Also, the characteristic
MFMEDIASOURCE_CAN_PAUSE is announced.

This patch is required for correct playback of some videos in Deep Rock
Galactic.

Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-27 20:37:52 +02:00
Giovanni Mascellani f45c8fd2b8 winegstreamer/media_source: Only seek if it was requested by the caller.
When starting a media source, the caller can specify a timestamp to seek
to by mean of a PROPVARIANT argument. If the PROPVARIANT is empty, then
no seek operation has to take place: playback has to either restart from
the beginning (if the media source was previously in stopped state) or
from where it was left (if the media source was in paused state).

Also, when a PROPVARIANT is empty it is a bug to use its content, because
there is no guarantee that it is initialized to a sensible value.

This patch fixes both bugs by gating the seek operation with the check
that the PROPVARIANT has the right type.

Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-27 20:37:48 +02:00
Giovanni Mascellani c9f0a3ce5c winegstreamer/media_source: Emit absolute presentation timestamp.
Currently the media source emit a presentation timestamp relative to
when the playback was last restarted. I.e., the frame that sits two
seconds inside a media file will get timestamp 2 if playback was
started at the beginning of the file, but will get timestamp 1 if
playback was last restarted at second 1.

This does not match Windows behavior, where each frame always gets
the same timestamp independently from where playback was started.

Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-27 20:37:44 +02:00
Derek Lesho 8b7390f80d winegstreamer: Allocate source media buffers in the PE components.
This necessitates an extra blit for the input data, but this is necessary for
both WoW64 support and an internal rework of the source path in wg_parser to use
GstAppSrc. Since source data is usually compressed and not a bottleneck, we
don't expect this to affect performance.

Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-16 22:22:44 +02:00
Derek Lesho 67734bfce3 winegstreamer: Duplicate source shutdown path into constructor with leak fixes.
Instead of having mixing together IMFMediaSource::Shutdown() and the
constructors' failure paths, creating confusion about what should be released
where, designate ::Shutdown/::Release to shutting down fully initialized objects
without checks, and keep the partially-created object cleanup code in the
constructor.

Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-16 22:22:44 +02:00
Paul Gofman f49b8602e3 winegstreamer: Create media source read thread after initializing wg_parser.
Fixes race condition as wg_parser is used right away in the created
thread.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-25 18:27:42 +02:00
Nikolay Sivov 04ebeff225 winegstreamer: Use consistent trace format for MF objects.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-19 12:30:19 +02:00
Nikolay Sivov 457258e7df winegstreamer: Let async command handle request token.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-15 20:42:25 +02:00
Giovanni Mascellani 8a506ea9b2 winegstreamer: Improve reported supported rates values for the media source.
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-04 20:00:30 +02:00
Nikolay Sivov 0393a0e2b5 winegstreamer: Fix assert condition.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-04 20:00:30 +02:00
Zebediah Figura 2e26556643 winegstreamer: Shut down the read thread before releasing the IMFByteStream.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-18 09:56:31 +02:00
Giovanni Mascellani 02325ccb67 winegstreamer: Advertise support for thinned or reverse playback.
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-17 18:49:09 +02:00
Zebediah Figura cf02b0bdfa winegstreamer: Use a static buffer to enumerate stream types in media_stream_init_desc().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-17 18:49:09 +02:00
Derek Lesho 865bbff0d9 winegstreamer: Ensure that the source reports both PCM and floating point audio formats.
The patch is originally by Derek Lesho, with some changes by
Giovanni Mascellani and Nikolay Sivov.

Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-14 20:56:02 +02:00
Giovanni Mascellani 767c200f47 winegstreamer: Implement a stub IMFRateControl for the media source.
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-26 16:48:30 +01:00
Giovanni Mascellani 6e4c7d4dba winegstreamer: Implement a stub IMFRateSupport for the media source.
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-26 16:48:30 +01:00
Giovanni Mascellani 0a0bf3cf21 winegstreamer: Implement a stub IMFGetService for the media source.
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-26 16:48:30 +01:00
Jacek Caban ab044d1b9f winegstreamer: Use nameless unions.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-24 20:48:21 +01:00
Zebediah Figura 18b6115d53 winegstreamer: Remove some redundant includes.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-23 09:56:47 +01:00
Zebediah Figura 672272e95a winegstreamer: Use malloc() instead of HeapAlloc().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-23 09:56:31 +01:00
Nikolay Sivov e162e7ea7f winegstreamer: Fully initialize MF object creation context.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-22 19:59:20 +01:00
Zebediah Figura 8abcae5475 winegstreamer: Build with msvcrt.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-22 09:08:10 +01:00
Zebediah Figura f9c43fc9fa winegstreamer: Reimplement the media source on top of the wg_parser object.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-19 09:24:44 +01:00
Derek Lesho 6f785fa7ce winegstreamer: Implement IMFMediaSource::Stop.
Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-19 09:24:41 +01:00
Zebediah Figura b44d3a3908 winegstreamer: Manage our own thread for read requests in the media source.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-19 09:24:33 +01:00
Zebediah Figura 38330678a0 winegstreamer: Manually track read offsets in the media source.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-19 09:24:30 +01:00
Zebediah Figura 43a5234bd9 winegstreamer: Clean up a newly allocated buffer on error in bytestream_wrapper_pull().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-07 22:35:29 +01:00
Nikolay Sivov 8315486d64 winegstreamer: Fix possible leak on error path (Coverity).
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-26 23:25:24 +01:00
Gijs Vermeulen 3bcabb2422 winegstreamer: Initialise type_handler to NULL in media_stream_init_desc().
Otherwise it is used uninitialised if a failure occurs.

Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-25 21:39:18 +01:00
Derek Lesho 59c55e96f5 winegstreamer: Set MF_PD_DURATION on source's presentation descriptor.
Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-09 21:38:06 +01:00
Derek Lesho e12b7d2104 winegstreamer: Implement IMFMediaSource::GetCharacteristics.
Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-09 21:38:06 +01:00
Derek Lesho 964cf9cfce winegstreamer: Require media source's IMFByteStream to be seekable.
Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-09 21:38:06 +01:00
Derek Lesho 96097c072b winegstreamer: Implement IMFMediaStream::GetMediaSource.
Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-06 12:00:17 +01:00
Derek Lesho 03eaa2cc93 winegstreamer: Implement IMFMediaStream::RequestSample.
Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-30 22:14:11 +01:00
Derek Lesho 12f1afbffe winegstreamer: Implement IMFMediaSource::Start.
Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-30 22:14:11 +01:00