Commit Graph

75 Commits

Author SHA1 Message Date
Zebediah Figura ce9a42e8bd winegstreamer: Enable wg_parser streams on creation.
This patch is motivated by Obduction, which creates a Media Foundation source
and leaves it open arbitrarily long before actually reading samples from it.
Without this patch, we unnecessarily waste CPU, and may reduce graphical
performance by taking CPU time that would otherwise be used on
performance-critical threads.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-11 10:12:22 +02:00
Zebediah Figura 90dc7f5b94 winegstreamer: Use WG_MAJOR_TYPE_UNKNOWN to mark a stream that should not be forced into a certain format.
Instead of checking the enabled state.

The reasoning here is that we would like to keep the stream enabled—that is,
buffer samples instead of discarding them—even when the client is not yet
reading samples from it, so that we can avoid wasting CPU power in decoding.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-11 10:12:15 +02:00
Zebediah Figura bcd39c5061 winegstreamer: Unblock waits in sink_chain_cb() when disabling a stream.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-04 19:52:45 +02:00
Zebediah Figura 5861379d6d winegstreamer: Protect access to the "enabled" field.
It is accessed from multiple threads.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-04 19:52:45 +02:00
Rémi Bernon 651e4002ce winegstreamer: Introduce new wg_transform_(push|read)_data functions.
And use it to implement WMA decoder Process(Input|Output).

The test output is different because ffmpeg WMA decoder outputs data in
a different way as native. The data seems valid audio nonetheless, and
it shouldn't matter too much.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51931
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52391
Signed-off-by: Rémi Bernon <rbernon@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-03-15 18:05:27 +01:00
Zebediah Figura d2f653a854 winegstreamer: Don't unlink pads before dereferencing them.
GStreamer pads are automatically unlinked when destroyed.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-25 19:02:18 +01: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 0c59cfc14e winegstreamer: Get rid of the queue_stream_event() helper.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-24 08:49:50 +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
Rémi Bernon 0052ffbfa0 winegstreamer: Append audioconvert and audioresample elements.
So that we can decode WMA to something else than the default avdec_wmav2
F32LE / non-interleaved format.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51931
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52391
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-22 20:04:42 +01:00
Rémi Bernon 4d929972c3 winegstreamer: Remove \n at the end of GST log messages.
GStreamer already adds one.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51931
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52391
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-22 20:04:31 +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
Rémi Bernon 51a262d368 winegstreamer: Introduce new wg_transform struct.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51931
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52391
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-17 09:07:07 +01:00
Rémi Bernon a288b94831 winegstreamer: Move format helpers to a dedicated source.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51931
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52391
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-17 09:07:07 +01:00
Zebediah Figura 4d2a628dfe winegstreamer: Use the size of the data read when allocating the read buffer.
Instead of the size of the data requested, which may be e.g. UINT_MAX.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52277
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-30 23:09:45 +01:00
Zebediah Figura c5a9373dbe winegstreamer: Allow specifying flipped video via negative height.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50668
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-23 09:58:38 +01:00
Zebediah Figura 009c1d66fa winegstreamer: Translate GST_AUDIO_CHANNEL_POSITION_MONO to SPEAKER_FRONT_CENTER.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-07 19:37:43 +02:00
Zebediah Figura fd6315eb8f winegstreamer: Trace the unfiltered caps in sink_query_cb().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:54 +02:00
Zebediah Figura 8e9d7b031f winegstreamer: Handle zero-length reads in src_getrange_cb().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:44 +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 494039d0d0 winegstreamer: Return void from wg_parser_stream_seek().
We do not expect this to fail.

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 84b870bb1f winegstreamer: Move Unix library definitions into a separate header.
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 3643f73ab6 winegstreamer: Initialize GStreamer in wg_parser_create().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51086
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-02 00:42:29 +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
Zebediah Figura 959bc42892 winegstreamer: Move the GstAutoplugSelectResult definition to wg_parser.c.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-02 00:41:55 +02:00
Zebediah Figura 176654fa29 Revert "winegstreamer: Replace source pad interface with GstAppSrc.".
This reverts commit 1aa359a100.

appsrc suffers from a rather problematic race condition surrounding flushes [1].
Essentially, it's possible for a flushing seek to begin and end between
wg_parser_get_next_read_request and wg_parser_push_data. The race condition is
not easy to fix, and in light of it it's not clear if we want to use appsrc.

[1] https://www.winehq.org/pipermail/wine-devel/2021-September/196043.html

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51774
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-24 07:51:34 +02:00
Derek Lesho 1aa359a100 winegstreamer: Replace source pad interface with GstAppSrc.
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 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
Zebediah Figura 721b1eb2eb winegstreamer: Properly clean up from failure in wg_parser_connect().
In particular, unset the sink_connected value, and make sure that subsequent
wg_parser_get_read_request calls don't hang.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-16 22:22:44 +02:00
Zebediah Figura 830efe873a winegstreamer: Factor out more of the init_gst callback into wg_parser_connect().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-16 22:22:44 +02:00
Zebediah Figura ddf3b93ac1 winegstreamer: Don't try to convert duration from byte length.
This effectively reverts 613446d018.

Duration and convert queries, in general, appear to be handled by the first
upstream element that knows how. If two different elements respond to each
query, we may treat the byte duration of the whole file as if it were the
duration of a single stream, or treat an undecoded byte duration as if it were a
decoded byte duration.

The aforementioned commit was written in order to ensure that we receive a valid
duration for test.mp3 in quartz_test.exe, and is obviated by the previous
patches which retry duration queries until successful (or EOS).

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51126
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-22 13:16:47 +02:00
Anton Baskanov e0a281102b winegstreamer: Continue polling if duration is unavailable after duration-changed.
Signed-off-by: Anton Baskanov <baskanov@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-22 13:16:44 +02:00
Anton Baskanov 8efac25a0a winegstreamer: Always wait for duration-changed when querying for duration.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51126
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-22 13:16:42 +02:00
Anton Baskanov 08041f9cb4 winegstreamer: Inline query_duration() into wg_parser_connect().
Signed-off-by: Anton Baskanov <baskanov@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-22 13:16:39 +02:00
Zebediah Figura e36e384cb4 winegstreamer: Avoid using Wine debugging functions at all in the Unix library.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-19 12:16:10 +02:00
Zebediah Figura 4d2c94e1dd winegstreamer: Factor out create_element().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-19 12:16:06 +02:00
Zebediah Figura bcc19e88fb winegstreamer: Avoid using WARN_ON from a GStreamer callback.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-19 12:16:03 +02:00
Zebediah Figura 5b156eecba winegstreamer: Change the formatting of error and warning messages a bit.
The TestBot treats anything containing the string ": error: " as a compiler
error. It may be possible for the TestBot to be smarter, but it seems easier
just to tweak winegstreamer.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-29 22:43:21 +02:00
Connor McAdams 2c5314d007 winegstreamer: Delay duration query until caps have been acquired.
Signed-off-by: Connor McAdams <cmcadams@codeweavers.com>
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-30 10:34:18 +02:00
Anton Baskanov d57d8bbc35 winegstreamer: Add missing RGB16 format to wg_video_format_from_gst.
Signed-off-by: Anton Baskanov <baskanov@gmail.com>
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-12 19:33:51 +02:00
Andrew Eikum 9152bdcef3 winegstreamer: Set specific large buffer sizes for decodebin.
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-18 22:04:01 +01:00
Zebediah Figura 5e222064ab winegstreamer: Convert timestamps to running time in wg_parser_stream_notify_qos().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50733
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-17 10:12:38 +01:00
Zebediah Figura 11612cd3a8 winegstreamer: Don't invert the proportion twice in wg_parser_stream_notify_qos().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-17 10:12:36 +01:00
Zebediah Figura 1649389edc winegstreamer: Rename gst_base_src_perform_seek() to src_perform_seek().
Avoid polluting the GStreamer namespace.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-24 22:01:42 +01:00
Zebediah Figura 2492bda6e1 winegstreamer: Don't make the pad caps writable in pad_added_cb().
There is no need.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-24 22:01:42 +01:00
Zebediah Figura e4922b930b winegstreamer: Inline init_new_decoded_pad() into pad_added_cb().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-24 22:01:42 +01:00
Zebediah Figura 2741b6ca33 winegstreamer: Rename some callbacks to explicitly show they are callbacks.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-24 22:01:42 +01:00
Zebediah Figura 39c97f4c29 winegstreamer: Rename some callbacks to more closely match GStreamer terminology.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-24 22:01:42 +01:00