Commit graph

250 commits

Author SHA1 Message Date
Seungha Yang 4571fac946 vp8decoder: Port to GstCodecPicture struct
... and remove unused "pts" variable from GstVp8Picture struct

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5285>
2023-09-08 11:51:23 +00:00
Seungha Yang a5ddf7af3b mpeg2decoder: Port to GstCodecPicture struct
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5285>
2023-09-08 11:51:23 +00:00
Seungha Yang 6e7cab43be h265decoder: Port to GstCodecPicture struct
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5285>
2023-09-08 11:51:23 +00:00
Seungha Yang ea3dfadbed h264decoder: Port to GstCodecPicture struct
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5285>
2023-09-08 11:51:23 +00:00
Seungha Yang 560faa38c5 d3d11: Update plugin docs
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5258>
2023-08-30 15:45:12 +00:00
Seungha Yang 1e381dc1cc d3d11convert: Passthrough allocation query on same caps
Since d3d11convert and its variant elements does not enable basetransform's
passthrough, passthrough allocation query needs to be handled
manually in order to respect downstream element's min/max buffer
requirement.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5255>
2023-08-29 19:46:00 +09:00
Seungha Yang ff435c80a2 d3d11videosink: Use premultiplied-alpha swapchain
Don't ignore alpha component if it's present

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5242>
2023-08-25 16:54:29 +00:00
L. E. Segovia b1a5707fcb windows: Fix mutexes leaking into the exports table
Translation unit-local variables must be marked static on Windows,
otherwise they're made available to the whole binary.

See:

https://learn.microsoft.com/en-us/cpp/cpp/program-and-linkage-cpp?view=msvc-170#external-vs-internal-linkage

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5185>
2023-08-16 08:17:05 +00:00
Seungha Yang 6429f04692 meson: d3d11: Add d3d11-wgc option for Windows Graphics Capture feature
Make the feature requirement explicitly controllable via build option

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4939>
2023-07-06 21:20:50 +00:00
Seungha Yang 8325623051 d3d11decoder: Reduce DPB size
Now all codec baseclasses can inform subclasses of correct max DPB size,
and exception handling (e.g., emergency bumping in h.264) has been
improved as well. Smaller number of additional DPB frame allocation
seems to be safe.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4878>
2023-06-18 18:21:03 +00:00
Seungha Yang c40f6dac57 d3d11overlaycompositor: Fix resource leak
Fixing regression since 94eadc9810

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4885>
2023-06-19 00:13:00 +09:00
Seungha Yang 01edbf6c6b d3d11overlaycompositor: Add support for d3d11 memory
If overlay buffer is d3d11 memory, use it directly

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4826>
2023-06-15 12:53:02 +00:00
Seungha Yang 94eadc9810 d3d11videosink: Fixing unexpected overlay composition meta drops
A buffer can hold multiple GstVideoOverlayCompositionMeta objects.
Should scan all metas on a buffer and render all overlay rectangles
if any.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4862>
2023-06-15 00:35:09 +00:00
Seungha Yang ebd5ff73be d3d11convert: Add support for premultiplied alpha conversion
Adding "src-alpha-mode" and "dest-alpha-mode" properties
to support alpha mode conversion

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4825>
2023-06-10 18:12:58 +00:00
Seungha Yang 80878a6ea4 d3d11testsrc: Add "alpha" and "alpha-mode" properties
Adding global alpha and alpha mode options

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4825>
2023-06-10 18:12:58 +00:00
Seungha Yang cb28a16007 d3d11overlaycompositor: Handle premultiplied alpha in pixel shader
Do premultiplied -> straight alpha conversion using GPU

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4825>
2023-06-10 18:12:58 +00:00
Seungha Yang 3c5684e085 d3d11: Use gst_util_get_timestamp()
instead of duplicating the same code

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4794>
2023-06-08 01:02:45 +00:00
Seungha Yang 4d6a2dea89 d3d11ipcsrc: Stop asynchronously in case of io-mode=import
In case of import mode, d3d11ipcsrc does not know when outputted
memories will be released.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4774>
2023-06-06 17:54:44 +00:00
Seungha Yang ef1853aa8d d3d11ipc: Use unnamed shareable handle
Exchanging HANDLE would have smaller overhead than string

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4774>
2023-06-06 17:54:44 +00:00
Seungha Yang aada49c6a6 d3d11ipcsink: Don't clear prepared sample on render
render() can be called multiple times for the same prepared sample

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4774>
2023-06-06 17:54:44 +00:00
Seungha Yang e4c43db5d5 d3d11basefilter: Forward video related metas if needed
The same as in GstVideoFilter

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4751>
2023-06-02 00:33:52 +00:00
Seungha Yang 8e1677bd6a d3d11videosink: Fix error on pause and play
The show_frame() can be called without prepare() call on paused to
playing state change. Thus the prepared buffer should not be cleared
on show_frame()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4700>
2023-05-25 13:24:43 +00:00
Seungha Yang f435d192e1 d3d11videosink: Don't use CS_OWNDC style
It's completely unnecessary since we never use
the device context (e.g., BeginPaint() or GetDC() never called).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4684>
2023-05-20 03:16:47 +00:00
Seungha Yang ad70dd64f9 d3d11videosink: Add render-rectangle property
... and resize HWND on GstVideoOverlay::set_render_rectangle even when
we are rendering without external HWND

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2563
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4653>
2023-05-17 23:06:05 +00:00
Seungha Yang d335eb8c7c d3d11convert: Fix for runtime property update
Every setup happens in set_caps() method but basetransform will not
call the set_caps() if in/out caps were not changed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4646>
2023-05-16 16:03:35 +00:00
Seungha Yang e34397ab09 d3d11: Update element meta
Make them consistent, update outdated description and fix some typos

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4619>
2023-05-12 20:13:58 +00:00
Seungha Yang ebcebe548d d3d11videosink: Don't clear prepared buffer on unlock_stop()
That can be called between prepare() and render() which results in
unexpected error flow return

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4583>
2023-05-10 16:20:41 +00:00
Seungha Yang 4449881b08 d3d11: Add support for IPC
Adding d3d11ipcsrc and d3d11ipcsink elements so that Direct3D11 textures
can be shared between processes

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4514>
2023-05-06 03:19:09 +09:00
Seungha Yang 4710f45e65 d3d11videosink: Fix for ignored initial render rectangle
Application can set target render rect before internal HWND
configuration

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2518
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4480>
2023-04-26 19:39:09 +00:00
Seungha Yang 3811894d9c d3d11overlay: Enhance documentation and fix typo
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4455>
2023-04-20 18:05:27 +00:00
Thibault Saunier 03ac969240 d3d11: Fix typo in interlace mode name in enum
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4414>
2023-04-18 14:56:41 +00:00
Seungha Yang 53dc1b96e2 d3d11compositor: Reconfigure resource only when output caps is changed
GstD3D11Converter setup is heavy operation since it requires
shader compile, GPU resource allocation, some math, mutex, etc.
We can avoid it if negotiated caps is not changed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4439>
2023-04-17 17:30:26 +00:00
Seungha Yang c883ab593c d3d11: Add d3d11overlay element
Similar to cairooverlay element but this element emits "draw"
signal with Direct3D11 render target view, so that an application
can render/overlay/blend on the given render target view
without any copy operation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4415>
2023-04-17 23:22:57 +09:00
Seungha Yang 3d6a609590 d3d11compositor: Add "ignore-inactive-pads" property
Same as compositor element

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4438>
2023-04-17 13:19:15 +00:00
Seungha Yang 7eefdd1b95 d3d11compositor: Skip zero alpha input
Blending such input is a waste of resource since nothing will
be rendered

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4438>
2023-04-17 13:19:15 +00:00
Seungha Yang af86c4b80e d3d11videosink: Remove pointless GetDC call
We don't use the Win32 device context handle at all.
Removing code which was copied from GL code blindly
in early d3d11 implementation stage a long time ago

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4407>
2023-04-12 19:54:31 +00:00
Wang Chuan d7d0c969df gstd3d11window: fix memory leak
GstStructure may leak when using external HWND

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4373>
2023-04-10 12:12:27 +00:00
Seungha Yang 47fda2c51c d3d11screencapturesrc: Add "window-capture-mode" property
... to support capturing only window's client area

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2425
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4324>
2023-04-03 15:06:47 +00:00
Aleksandr Slobodeniuk e683000573 d3d11videosink: fix race conditions in win32 window
One race condition is the fact that the window object
can be destroyed while running some routine in the UI
thread (such as resizing). To avoid that situation we make
UI thread hold a reference on the window object while it's
running.
Other probpematic case is when the window handle is reused:
if we stop and start the pipeline very fast,
so the sink creates a new window object that is going to use
the same window handle as the previous one.
And finally the case when the pipeline is stopped immediatelly
right after starting, this one is also handled in this commit.

NOTE: a unit test that reproduces this cases have been added
in the previous commit.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4260>
2023-04-03 11:19:11 +00:00
Seungha Yang 7755cd2f7a d3d11videosink: Enhancement for initial window size decision
Use AdjustWindowRect() method to calculate window size so that
video scene can be rendered on client area without black borders

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4323>
2023-04-02 00:31:58 +09:00
Aleksandr Slobodeniuk 1f834eaacb d3d11convert: add "method" property
It allows to select the sampling method, same
as "method" property of videoconvert.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4205>
2023-03-21 12:08:54 +00:00
Aleksandr Slobodeniuk 4c9d4d30cb d3d11convert: protect 'add-borders' with mutex
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4205>
2023-03-21 12:08:54 +00:00
Seungha Yang e47f08395f d3d11videosink: Fix tearing in case of fullscreen mode
DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING and DXGI_PRESENT_ALLOW_TEARING should
be used only if required, when user wants Vsync off for example.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2376
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4178>
2023-03-15 22:56:02 +00:00
Seungha Yang a1bd4afb8a d3d11compositor: Fix composition error on release_pad()
Composition might be still in progress while it's being released

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4169>
2023-03-15 04:50:49 +00:00
Seungha Yang 95ca40c4ab d3d11screencapturesrc: Use keyed mutex instead of fence
D3D11 runtime might not support ID3D11Fence, and if so GstD3D11Fence
abstraction will use ID3D11Query instead. However, since the ID3D11Query
requires busy waiting, keyed mutex is better approach.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4094>
2023-03-02 03:03:58 +09:00
Seungha Yang ac869214ad d3d11testsrc: Use keyed mutex for rendering patterns
D2D operations would not flush D3D commands. Use keyed mutex
to synchronize between them. Note that previous code was wrong
(Flush should be called inside of BeginDraw/EndDraw calls)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4081>
2023-03-01 14:13:14 +00:00
Seungha Yang 025adaff4b bad: Update indent
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4023>
2023-02-28 10:12:31 +00:00
Seungha Yang 464c51a78a d3d11testsrc: Add circular, blink and ball patterns
Note that circular and ball patterns will be rendered via
Direct2D (and Direct3D11 interop)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4070>
2023-02-26 22:38:03 +09:00
Célestin Marot 81f121f244 d3d11overlaycompositor: fix texture width and height
The dimension of the overlay texture directly corresponds to the size of the overlay **buffer** which is given by its video meta.
The dimension at which the overlay should be displayed directly correspond to the overlay `render_width`and `render_height`.

This match the behavior of glimagesink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4046>
2023-02-22 15:18:12 +01:00
Seungha Yang fd77f088a1 d3d11mpeg2dec: Promote rank to PRIMARY + 1
Make its rank higher than avdec_mpeg2video

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4014>
2023-02-21 17:32:20 +00:00
Seungha Yang 26dd6c5c26 d3d11videosink: Fix rendering on external handle
Partial revert of the commit 068a5c1053.
That introduced size mismatch between internal and external HWND

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4006>
2023-02-20 22:35:27 +00:00
Seungha Yang 2e574a80d9 d3d11: Don't use g_alloca()
_alloca CRT function is deprecated. Moreover, stack allocation
for string is not a good idea. We can use _malloca inline
function instead, but all use of _alloca in d3d11 library/plugin
are not performance critical path at all.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3652>
2023-01-24 20:27:43 +00:00
Seungha Yang 467a2408a1 d3d11compositor: Workaround blending artifacts on Intel platform
Disable vendor implemented converter in d3d11compositor to workaround
artifacts

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3770>
2023-01-23 23:34:04 +09:00
Seungha Yang 7c92ed0bd0 d3d11videosink: Fixing focus lost on desktop layout change
Watch all message on the window thread, instead of internal window only.
Otherwise, some global window messages, such as desktop layout change,
wouldn't be handled by our window.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3593>
2022-12-17 11:17:28 +00:00
Seungha Yang 068a5c1053 d3d11videosink: Move potentially time-consuming operations to ::prepare()
Move following tasks to ::prepare() from ::show_frame()
* CPU -> GPU upload
* GstD3D11Window object setup, including input caps change handling

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3574>
2022-12-17 02:11:07 +09:00
Seungha Yang 04451b108a d3d11videosink: Call ShowWindow() from window thread
... when rendering on external HWND. ShowWindow() will cause
synchronous message passing to window thread and then can be blocked.
At the same time, window thread can wait for GStreamer thread.
Instead of the synchronous call, queue the task to window message
and performs from the window thread.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3583>
2022-12-16 22:18:14 +09:00
Seungha Yang a27c5c81df d3d11videosink: Fix deadlock when parent window is busy
Deadlock sequence:
* From a streaming thread, d3d11videosink sends synchronous message
  to the parent window, so that internal (child) window can be
  constructed on the parent window's thread
* App thread (parent window thread) is waiting for pipeline's
  state change (to GST_STATE_NULL) but streaming thread is
  blocked and waiting for app thread

To avoid the deadlock, GstD3D11WindowWin32 should send message
to the parent window asynchronously.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3570>
2022-12-15 17:37:48 +00:00
Seungha Yang ac6b3e9a45 d3d11av1dec: Promote rank to primary + 1
... so that this element can have higher rank than the other software
AV1 decoders

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3495>
2022-12-02 17:56:22 +00:00
Seungha Yang b9b3a9c4e1 d3d11: Use correct ref/unref methods
Those objects are GstObject subclasses

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3479>
2022-11-28 18:50:03 +00:00
Seungha Yang 349f8de13e d3d11decoder: Handle input caps change
Update output caps if it's notified by baseclass

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3328>
2022-11-16 13:12:38 +00:00
Seungha Yang 219c5cf330 meson: d3d11: Clarify the message for WGC support check
Even Windows10 SDK seems to have required symbols depending on installed
SDK version

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3376>
2022-11-11 19:42:19 +00:00
Seungha Yang 12a2c1dffe d3d11screencapturesrc: Fix build error with MSVC x86
Delete the code for now. Note that the code block is unnecessary already

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3375>
2022-11-11 18:58:54 +00:00
Seungha Yang 99b83f33f7 d3d11screencapturesrc: Specify PAR 1/1 to template caps
... otherwise PAR can be wrongly signalled during the negotiation

Fixing below pipeline when desktop resolution is not 640x480
gst-launch-1.0.exe \
  d3d11screencapturesrc ! videoscale !
  video/x-raw,width=640,height=480,pixel-aspect-ratio=1/1 ! d3d11videosink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3360>
2022-11-09 11:22:06 +00:00
Seungha Yang 0405e0cfc7 d3d11videosink: Always clear back buffer on resize
Swapchain may not need to be resized if the size of backbuffer
is equal to the previous size. Then previously rendered frame will be stay
on the screen. Do clear back buffer whenever resize() is called

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3341>
2022-11-05 17:23:24 +00:00
Seungha Yang 92e03ba869 d3d11decoder: Fix for VP9 decoding with odd resolution
Fixing off by one mismatch when width and/or height of stream
is odd number

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3302>
2022-10-31 20:45:25 +00:00
Seungha Yang d8bdd9429b d3d11vp9dec: Disallow Profile2 12bits stream
Since DXVA does not support the format, specify bit-depth field
to sinkpad template caps so that d3d11vp9dec can be skipped
during autoplugging

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3297>
2022-10-31 11:29:39 +00:00
Seungha Yang 6974b6f6ff d3d11: Update for documentation
* Use GST_PARAM_DOC_SHOW_DEFAULT flags for GPU ID related
  properties
* Add doc caps
* Increase deinterlace max resolution

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3250>
2022-10-24 12:42:51 +00:00
Seungha Yang 31be056b6e d3d11: Run indent
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3250>
2022-10-24 12:42:51 +00:00
Seungha Yang 426535f3a6 d3d11screencapture: Add WinRT API based capture mode
Add Windows Graphics Capture (WGC) API based screen capture mode.
The conditions where this mode is used:
* Explicitly requested by user (capture-api property)
* To capture specific window
* When DXGI desktop duplication API does not work on hybrid graphics systems
  (e.g., multi-gpu laptop)

Full features of this implementation require Windows 11. And Windows 11
SDK is required to build this feature.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3144>
2022-10-21 14:21:28 +00:00
Seungha Yang 087e335006 d3d11screencapture: Subclassing capture implementation
Preparation to use WinRT capture API

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3144>
2022-10-21 14:21:28 +00:00
Seungha Yang 573a0489f6 d3d11videosink: Add "emit-present" property
Controls the decision for "present" signal use, and
allows delayed "present" signal handler install via the property

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3176>
2022-10-18 21:19:01 +00:00
Thibault Saunier 6a4425e46a meson: Call pkgconfig.generate in the loop where we declare plugins dependencies
Removing some copy pasted code

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2970>
2022-09-01 21:17:35 +00:00
Seungha Yang c3cf9521a5 d3d11: Update library doc
* Private header name is changed to gstd3d11-private.h to follow
  naming convention
* Add Since mark everywhere
* Update member variable names to be consistent with the other
  object implementations in this library
* Correct outdated documentation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2945>
2022-08-27 22:40:34 +09:00
Seungha Yang 0a65aaa6d2 d3d11videosink: Add display-format property
Make swapchian's display format configurable, since some DXGI formats
we can use for swapchain are not API interop compatible.
For instance, BGRA format should be used for Direct2D interop.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2923>
2022-08-24 17:44:49 +00:00
Seungha Yang 470436d7e6 d3d11videosink: Add present signal
The "present" signal will be emitted just before the
IDXGISwapChain::Present() call. The client can perform additional
GPU operation with given GstD3D11Device object and
ID3D11RenderTargetView handle. Or, the client can read back
the scene to be displayed on window using the signal.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2923>
2022-08-24 17:44:49 +00:00
Seungha Yang 7bcfccd0bd d3d11: Use CRITICAL_SECTION instead of GRecMutex
The GRecMutex abstraction (and heap allocation happens in GLib)
is unnecessary for this plugin.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2914>
2022-08-18 17:48:57 +00:00
Seungha Yang df64226e71 d3d11decoder: Do timer based DecoderBeginFrame retry
... instead of retry count based one, because the precision of Sleep()
varies depending on system and application configuration.
Also, don't retry DecoderBeginFrame if decoder is doing flush.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2886>
2022-08-15 19:16:16 +00:00
Seungha Yang 9b4fafb882 d3d11decoder: Do not use miniobject qdata
The miniobject qdata uses global mutex.
Use ID3D11DeviceChild::{Set,Get}PrivateData methods instead.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2885>
2022-08-15 02:50:18 +09:00
Corentin Damman 0d07ff60c9 d3d11window: fix DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING swap chain flag for full screen
Fixes #1372 (regression introduced in 5eeec165)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2866>
2022-08-12 09:35:40 +00:00
Seungha Yang 05dae94352 d3d11: Use WIN32 API directly for locking with RAII pattern
Such abstraction is unnecessary for this library/plugin.
Use WIN32 API directly instead of GLib wrappers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2848>
2022-08-08 20:13:51 +00:00
Seungha Yang 66d504ee58 d3d11: Don't find global default allocator
We were using global default allocator already. Pass null
allocator object to *_alloc() methods then the method will
use default allocator.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2843>
2022-08-06 23:55:18 +09:00
Seungha Yang 74f56632c3 d3d11: Use std::call_once()
g_once_init_enter() always takes global mutex for non-GCC build.
Use C++ once call implementation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2843>
2022-08-06 23:27:23 +09:00
Seungha Yang b8010e41a1 d3d11compositor: Add gamma-mode and primaries-mode properties
Allows controlling gamma remap and/or chromatic adaptation behavior.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2831>
2022-08-04 03:19:42 +09:00
Seungha Yang f89cb98495 d3d11videosink: Add gamma-mode and primaries-mode properties
Allows controlling gamma remap and/or chromatic adaptation behavior.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2831>
2022-08-04 02:48:57 +09:00
Seungha Yang 0ac7077d2d d3d11convert: Add gamma-mode and primaries-mode properties
Allows controlling gamma remap and/or chromatic adaptation behavior.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2831>
2022-08-04 02:48:57 +09:00
Seungha Yang bc065d2cc2 d3d11videosink: Translate mouse position
Converts mouse cursor position represented in display coordinates to
stream coordinates.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2824>
2022-08-02 14:24:22 +00:00
Seungha Yang 7d4a1a5beb d3d11videosink: Early terminate mouse/keyboard event handling
... and add missing null check (plus coding style fix)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2824>
2022-08-02 14:24:22 +00:00
Seungha Yang 6fff608f27 d3d11: Port to GstD3D11Fence
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2790>
2022-07-23 16:53:14 +00:00
Seungha Yang ac6577e2a9 d3d11compositor: Add support for crop meta
GstD3D11Converter supports cropping already. Cropping is just
a matter of setting source rectangle area to converter,
from d3d11 point of view

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2782>
2022-07-22 05:07:23 +09:00
Seungha Yang 1c3fac818d d3d11: Move GstD3D11Converter to gst-libs
The object is equivalent to GstVideoConverter but for D3D11.
Application can use this object directly for various conversions,
such as color space conversion, rescale, crop and flip/rotation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2767>
2022-07-22 00:08:51 +09:00
Seungha Yang ee289a65ce d3d11converter: Use GstStructure to set initialization options
Runtime updatable options are exposed via object properties
but there are a few options which should be known at initialization
time. Use GstStructure to signal it and to be easily extensible

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2776>
2022-07-20 07:05:51 +09:00
Seungha Yang d3d8820359 d3d11converter: Use primaries and transfer function compare methods
Different enum values could be functionally equal, then we don't need
to do full conversion.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2776>
2022-07-20 07:05:51 +09:00
Seungha Yang 16f4567a50 d3d11format: Move DXGI color space mapping method to gst-libs
Expose color space mapping method to public so that application
can configure GstCaps or GstVideoInfo using DXGI color space

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2776>
2022-07-20 07:05:46 +09:00
Seungha Yang 687f9feac6 d3d11convert: Use new colorimetry compare function
Avoid conversion if both are functionally identical

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2765>
2022-07-18 08:56:45 +00:00
Seungha Yang 35994eb5c9 d3d11testsrc: Fix SMPTE pattern rendering
It was wrong vertex shader code

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2766>
2022-07-17 23:59:04 +09:00
Seungha Yang 1dd29a2564 d3d11: Move HLSL compiler to gst-libs
We should move this functionality to gst-libs so that GstD3D11Converter
can be moved to gst-libs.
Another advantage is that applications can call our
HLSL compiler wrapper method without any worry about OS version
dependent system installed HLSL library.
Note that there are multiple HLSL compiler library versions
on Windows and system installed one would be OS version dependent.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2760>
2022-07-15 06:31:51 +09:00
Seungha Yang b09ca8635f d3d11: Use scoped device lock
Make code simpler and more deadlock-free

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2728>
2022-07-09 03:36:17 +09:00
Seungha Yang 6cc6494287 d3d11screencapturesrc: Set colorimetry to caps
Make use of reported DXGI colorspace if possible

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2729>
2022-07-08 21:05:25 +09:00
Seungha Yang 2476678b3c d3d11: Update colorspace map
Map DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 to sRGB colorimetry

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2729>
2022-07-08 20:15:28 +09:00
Seungha Yang 59d92ea62c d3d11: Add an utility method for DXGI colorspace conversion
Add a method for DXGI_COLOR_SPACE_TYPE -> GstVideoColorimetry conversion

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2729>
2022-07-08 20:03:06 +09:00