Commit graph

250 commits

Author SHA1 Message Date
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
Seungha Yang e0d1b98827 d3d11converter: Remove convert() method
Expose only single convert_buffer() method. It's safer approach than
passing arbitrary list of SRV/RTV pointers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2713>
2022-07-04 18:46:51 +00:00
Seungha Yang df396b9acd d3d11testsrc: Use convert_buffer() method
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2713>
2022-07-04 18:46:51 +00:00
Seungha Yang 7a48843ca6 d3d11: Remove video processor
Processing using ID3D11VideoProcessor was integrated into
GstD3D11Converter and GstD3D11VideoProcessor implementation is
not used anymore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2713>
2022-07-04 18:46:51 +00:00
Seungha Yang 347ad181be d3d11memory: Update alloc_wrapped() API to avoid staging texture alloc
Add size parameter and use it for CPU accessible memory size
instead of allocating staging texture per API call.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2713>
2022-07-04 18:46:51 +00:00
Seungha Yang 5f39388ae5 d3d11videosink: Add support for rotation
Adding "rotate-method" property

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1396
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2708>
2022-07-02 20:40:37 +00:00
Seungha Yang 4e75ca0351 d3d11videosink: Protect window with lock at every place
Access to the object should be thread safe to support runtime
property update

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2708>
2022-07-02 20:40:37 +00:00
Seungha Yang 60e6be7068 d3d11convert: Add support for GstVideoOrientationMethod
Add flip/rotation support via GstVideoDirectionInterface

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2708>
2022-07-02 20:40:37 +00:00
Seungha Yang f549575ce8 d3d11converter: Add support for GstVideoOrientationMethod
Shader can handle rotation/flip with other conversions
at once in a single pipeline, and depending on device
capability, videoprocessor may support it too.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2708>
2022-07-02 20:40:37 +00:00
Seungha Yang 5eeec16502 d3d11videosink: Use single GstD3D11Converter object
GstD3D11Converter supports videoprocessor and texture upload.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2697>
2022-07-02 05:40:47 +09:00
Seungha Yang 3919491eb2 d3d11: Use library private header in plugin
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2697>
2022-07-02 05:37:55 +09:00
Seungha Yang 9709bcf3fe d3d11compositor: Use single GstD3D11Converter object
... and remove unnessary videoprocessor/upload/copy code

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2697>
2022-07-02 05:37:55 +09:00
Seungha Yang 993b9b36db d3d11convert: Add border-color property
Use user specified border-color instead of black color

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2697>
2022-07-02 05:37:55 +09:00
Seungha Yang 6a59dd95e8 d3d11convert: Use single GstD3D11Converter object
... and don't use GstD3D11VideoProcessor. Now GstD3D11Converter will
be able to convert using videoprocessor, and texture upload is also supported by
GstD3D11Converter. All the noisy code can be removed therefore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2697>
2022-07-02 05:37:55 +09:00
Seungha Yang 91a732fe90 d3d11converter: Add support conversion using videoprocessor
* Add videoprocessor feature to d3d11converter, in order to unifiy
  conversion flow.
* Add convert_buffer() method to support automatic shader/videoprocessor
  selection. The method also supports texture upload if input memory
  cannot be used for conversion (e.g., system memory or so)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2697>
2022-07-02 05:37:55 +09:00
Seungha Yang fdbb9041a2 d3d11overlaycompositor: Objectify overlay render implementation
Be consistent with other implementations

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2697>
2022-07-02 05:37:27 +09:00
Seungha Yang b2d09de899 d3d11: Don't use const pointer to GstDxgiColorSpace
Instead, fill values of passed GstDxgiColorSpace struct

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2697>
2022-07-01 19:34:16 +00:00
Seungha Yang 38e142db9a d3d11convert: Add support for GstVideoCropMeta
Performs crop, scale, and color space conversion all in
a single render pipeline. Note that cropping related property is not
added in this element (which will make negotiation very complicated),
but user can configure videocrop element for crop meta to be attached
on each buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2678>
2022-06-29 09:43:10 +00:00
Seungha Yang 1043481247 d3d11videosink: Fix for force-aspect-ratio setting when rendering on shared texture
Set specified force-aspect-ratio value on window object
in case of shared texture rendering as well

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1304
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2671>
2022-06-29 09:04:33 +00:00
Seungha Yang b09ae1d635 d3d11: Enumerate devices via native DXGI API
D3D11CreateDevice() can fail for some reason (e.g., buggy GPU driver)
and then gst_d3d11_device_new() will return nullptr.
Use DXGI API directly instead of relying on the gst_d3d11_device_new()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2663>
2022-06-27 20:30:13 +00:00
Seungha Yang aca71fd692 d3d11: Update gst_d3d11_allocation_params_new() interface
Define GST_D3D11_ALLOCATION_FLAG_DEFAULT (0) value instead of
casting enum type everywhere. And pass D3D11_RESOURCE_MISC_FLAG value

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2646>
2022-06-27 19:33:57 +00:00
Seungha Yang 170271b86f d3d11: Revert staging buffer pool implementation
The staging buffer pool implementation was added to improve
throughput performance since we can avoid per-frame
CPU copy operation via staging texture but it turned out that
we can not make it thread safe. See
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1182

Reverting the staging texture implementation as it does not show
any visible value.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2651>
2022-06-23 22:03:52 +09:00
Seungha Yang 513a1cbbb3 d3d11decoder: Fix texture download
Stride applied to src/dst was reversed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2651>
2022-06-23 21:41:24 +09:00
Seungha Yang 1dc24d23d2 d3d11: Fix some typos
Fix up spelling and d3d11testsrc class meta.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2644>
2022-06-21 20:12:06 +09:00
Seungha Yang a040450685 d3d11compositor: Performance optimization
Removing glvideomixer-like nuance (it was initially referenced)
and rewriting element since it's not an optimal design at all
from performance point of view.

* Remove wrapper bin (and internal conversion/upload/download elements)
  which will waste CPU/GPU resources. Conversion/blending can be done by the
  d3d11compositor element at once.
* Add support YUV blending without RGB conversion.
  The RGB <-> YUV conversion is completely unnecessary since YUV textures
  support blending as well.
* Remove complicated blending operation properties since it's hard
  to use from application point of view. Instead, adding "operator" property
  like what compositor element does.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2631>
2022-06-20 19:18:53 +00:00
Seungha Yang adcb3ec1f2 d3d11converter: Fix alpha factor update
converter should set entire constant buffer values since it's mapped
with write-discard flag

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2631>
2022-06-20 19:18:53 +00:00
Seungha Yang eaa9943b98 d3d11decoder: Check 16K resolution support
16K decoding is supported by some GPUs

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2629>
2022-06-18 18:02:44 +00:00
Seungha Yang e1fd0f620f d3d11decoder: Add support for non-zero crop-{x,y} position
AVC and HEVC define crop rectangle and the x/y coordinates might
not be zero. This commit will address the non-zero x/y offset coordinates
via GstVideoCropMeta if downstream supports the meta and d3d11 memory.
Otherwise decoder will copy decoded texture into output frame.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2624>
2022-06-17 20:15:02 +00:00
Seungha Yang 461416b5f1 d3d11converter: Implement filling border color
Equivalent to GST_VIDEO_CONVERTER_OPT_BORDER_ARGB and
GST_VIDEO_CONVERTER_OPT_FILL_BORDER options of GstVideoConverter

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2622>
2022-06-17 19:40:48 +00:00
Seungha Yang 59f39724b7 d3d11converter: Objectify converter
... and set conversion options via property

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2622>
2022-06-17 19:40:48 +00:00
Seungha Yang 3ed94c2dde d3d11shader: Remove GstD3D11Quad helper object
It's not very generic to be used for various scenario. Use native D3D11
APIs directly instead.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2622>
2022-06-17 19:40:48 +00:00
Seungha Yang ec6384947b d3d11compositor: Don't use GstD3D11Quad
The helper object will be removed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2622>
2022-06-17 19:40:48 +00:00
Seungha Yang 93662da3d1 d3d11overlaycompositor: Fix HLSL compiler warning
warning X3206: 'Sample': implicit truncation of vector type

And don't use GstD3D11Quad since it will result in redundant API calls

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2622>
2022-06-17 19:40:48 +00:00
Seungha Yang 7b39a09f9d d3d11converter: Add support for colorimetry conversion
Handle color primaries and gamma functions.
HDR <-> SDR conversion (tone mapping) should be implemented as well
but not a part of this patch.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2581>
2022-06-14 05:04:53 +09:00
Seungha Yang 3a44d14ac8 d3d11convert: Don't passthrough if colorimetry conversion is required
Different input/output colorimetry requires conversion

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2581>
2022-06-14 04:41:40 +09:00
Seungha Yang f3f905b491 d3d11window: Use SDR colorspace whenever possible
PQ uses completely different light level scale
and it should not be used for SDR bt2020.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2581>
2022-06-14 04:39:31 +09:00
Seungha Yang ac26860a80 d3d11converter: Rewrite conversion object
Rewriting GstD3D11Converter (equivalent to GstVideoConverter)
to optimize some conversion path and clean up.

* Extract YUV <-> RGB conversion matrix building method to
  utils. It will be used by other implementation
* Use calculated offset values for YCbCr <-> YPbPr conversion
  instead of hardcoded values
* Handle color range adjustment
* Move transform matrix building helper function to utils.
  The method will be used by other elements
* Use single constant buffer. Multiple constatne buffer for
  conversion pipeline is almost pointless
* Remove lots of duplicated HLSL code and split pixel shader
  code path into sampling -> colorspace conversion ->
  shader output packing
* Avoid floating point precision error around UV coordinates
* Optimize RGB -> YUV conversion path

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2581>
2022-06-14 04:37:30 +09:00
Tim-Philipp Müller 9d9e59622f Bump GLib requirement to >= 2.62
Can't require 2.64 yet because of
https://gitlab.freedesktop.org/gstreamer/cerbero/-/issues/323

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2568>
2022-06-10 06:01:41 +00:00
Seungha Yang e8fdf9177a d3d11decoder: Fix for alternate interlacing signalling
Don't set d3d11+interlace caps feature. None of d3d11 elements
support it

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2579>
2022-06-09 23:19:24 +09:00
Seungha Yang 45dd8bf35a d3d11: Add d3d11testsrc element
Adding Direct3D11 based videotestsrc element

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2554>
2022-06-09 05:08:41 +09:00
Seungha Yang fe64295841 d3d11decoder: Work around Intel DXVA driver crash
Intel DXVA driver crashes sometimes (from GPU thread) if
ID3D11VideoDecoder is released while there are outstanding view objects.
To make sure the object life cycle, holds an ID3D11VideoDecoder refcount
in GstD3D11Memory object.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2504>
2022-05-27 15:13:15 +00:00
Seungha Yang 9b128f1841 d3d11decoder: Don't print error log on negotiation failure
It may not be a critical error and even expected when shutting down
pipeline or flushing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2483>
2022-05-25 05:46:40 +09:00
Erwann Gouesbet 09a45c37ca d3d11screencapture: Fix missing/outdated cursor shape
d3d11screencapture can miss a cursor shape to draw or draw an outdated cursor shape.
 - AcquireNextFrame only provides cursor shape when there is one update
 - current d3d11screencapture skips cursor shape when mouse is not drawn

So, if a gstreamer application uses d3d11screencapture with cursor initially not drawn
"show-cursor"=false and then switches this property to true, the cursor will not be
actually drawn until AcquireNextFrame provides a new cursor shape.
This commit makes d3d11screencapture always update the cursor shape information, even
if the mouse is not drawn. d3d11screencapture will always have the latest cursor shape
when requested to draw it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2485>
2022-05-24 20:10:00 +00:00
Seungha Yang 858520932c d3d11decoder: Add hardcoded minimum resolution values to caps for NVIDIA
NVIDIA GPUs have undocumented limitation regarding minimum resolution
and it can be queried via a NVDEC API. However, since we don't want to
bring CUDA/NVDEC API into D3D11, use hardcoded values for now
until we find a nice way for capability check.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2406>
2022-05-12 18:20:26 +00:00
Seungha Yang e0a9a73adf d3d11screencapturesrc: Fix crash when d3d11 device is different from owned one
GstD3D11ScreenCapture object is pipeline-independent global object
and the object can be shared by multiple src elements,
in order to overcome a limitation of DXGI Desktop Duplication API.
Note that the API allows only single capture session in a process for
a monitor.

Therefore GstD3D11ScreenCapture object must be able to handle a case
where a src element holds different GstD3D11Device object. Which can
happen when GstD3D11Device context is not shared by pipelines.

What's changed:
* Allocates capture texture with D3D11_RESOURCE_MISC_SHARED for the
  texture to be able to copied into other device's texture
* Holds additional shader objects per src element and use it when drawing
  mouse

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1197
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2366>
2022-05-05 18:18:57 +00:00
Jakub Adam 03b6dab006 d3d11screencapture: Set viewport when drawing mouse cursor
If there weren't any moved/dirty regions in the captured frame, the
viewport of the ID3D11DeviceContext would be left at whatever previous
value it had, which could lead to the cursor being drawn in a wrong
position and/or in an incorrect size.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2362>
2022-05-04 17:18:32 +02:00
Seungha Yang a8b2fbf77f d3d11decoder: Handle DPB size margin in a single place
... instead of each subclass

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2343>
2022-05-03 14:17:49 +00:00
Seungha Yang 6a4c42c03f codecs: Signal required DPB size for AV1,MPEG2,VP8, and VP9 via new_sequence()
Make all codecs consistent so that subclass can know additional DPB
size requirement depending on render-delay configuration regardless
of codec. Note that render-delay feature is not implemented for AV1
yet but it's planned.

Also, consider new_sequence() is mandatory requirement, not optional

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2343>
2022-05-03 14:17:49 +00:00
Seungha Yang 4047653275 d3d11h265dec: Assign PRIMARY + 1 rank
Promote d3d11h265dec to be default one if available

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2314>
2022-04-27 20:06:53 +00:00
Seungha Yang 9f19ca68b3 d3d11videosink: Fix for unhandled mouse double click events
Only window created with CS_DBLCLKS style can receive those mouse
double click events, so we need to use the style for internal/external
windows can get double click events.

Also, passthrough mouse events to parent window in the same message pumping
threads instead of manually forwarding each mouse event.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1172
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2277>
2022-04-23 13:20:54 +00:00
Seungha Yang dd32e2efbc d3d11decoder: Do not preallocate texture using downstream d3d11 buffer pool
Our decoder implementation does not use downstream d3d11 pool for
decoding because of special requirement of D3D11/DXVA. So preallocation
using the downstream buffer pool will waste GPU memory in most cases.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2211>
2022-04-18 18:31:02 +00:00
Seungha Yang b5a8bef5a7 d3d11decoder: Copy HDR10 related caps field manually
If negotiate() is called from the set_format() chain, sinkpad may not
hold caps yet, so baseclass cannot copy it over to srcpad caps.
Copy them manually.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2203>
2022-04-16 18:36:41 +00:00
Seungha Yang 2548014dfc win32: Enable high-resolution timer for MinGW build
timeapi.h is missing in our MinGW toolchain. Include mmsystem.h
header instead, which defines struct and APIs in case of our MinGW
toolchain. Note that in case of native Windows10 SDK (MSVC build),
mmsystem.h will include timeapi.h

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2153>
2022-04-12 15:09:16 +00:00
Seungha Yang 2291781087 d3d11window: Use ANSI version WIN32 API explicitly
We were using ANSI version APIs implicitly because UNICODE is not
defined by ourselves. But potentially it can be broken if user
defines UNICODE.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2131>
2022-04-08 11:51:37 +00:00
Seungha Yang fb226f4733 d3d11: Run indent
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2131>
2022-04-08 11:51:37 +00:00
Thibault Saunier 25819c41fb navigation: Add support for key Modifiers in all relevant events
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2010>
2022-03-25 15:16:03 +00:00
Vivienne Watermeier 6c2f6c3bd4 all: Use new navigation interface and API
Use and implement the new navigation interface in all relevant sink elements,
and use API functions everywhere instead of directy accessing the event structure.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1633>
2022-03-23 13:14:52 +00:00
Daniel Almeida 9a364464f0 av1decoder: Sync duplicate_picture with VP9 one
Pass the current frame to the duplicate_picture callback. This makes it easier
to set the frame's output_buffer if we already have one available. Also
documented that unlike VP9, it is not optional to implement this as the
picture will populate the DPB if it is a key-frame. To ensure this, remove the
default implementation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1992>
2022-03-21 15:10:01 +00:00
Jakub Adam 90eadae350 d3d11: Fix some typos
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1985>
2022-03-19 00:19:41 +00:00
Jakub Adam df55700f44 d3d11screencapturesrc: Allow capturing screen sub-area
Adds crop-x, crop-y, crop-width, crop-height properties specifying the
screen area to capture.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1932>
2022-03-18 13:56:51 +01:00
Seungha Yang 8ff5f10a40 d3d11screencapturesrc: Use staging buffer pool for performance
By using staging pool/buffer, we can avoid per frame
staging texture -> system memory copy.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1756>
2022-02-20 23:43:18 +00:00
Seungha Yang 04b8dfa391 d3d11: Add support for AYUV, AYUV64, and RGBA64_LE formats
Note that AYUV and AYUV64 formats will be used to expand format
support, especially some packed YUV formats (e.g., Y410, YUY2)
are common DXGI formats used for hardware decoder/encoder on Windows
but those formats cannot be used as a render target. We need to handle
them differently without pixel shader help, using compute shader
for example.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1699>
2022-02-16 18:41:05 +00:00
Seungha Yang dd906f9610 d3d11: Store device format in struct
Holding pointer to struct was unsafe approach because
the pointer to d3d11 format will be invalidated once d3d11 device
object is released

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1699>
2022-02-16 18:41:05 +00:00
Seungha Yang dbda4cf409 d3d11converter: Fix for missing GRAY conversion
Add missing Y410 -> GRAY and GRAY -> semi-planar conversion

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1724>
2022-02-16 02:30:01 +09:00
Seungha Yang 98345a141a d3d11converter: Don't use FIXME_OBJECT for non-GstObject
... and print ERROR messages for unexpected input/output formats

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1724>
2022-02-16 02:27:53 +09:00
Seungha Yang e3e23a2c84 d3d11converter: Fix RGB to GRAY conversion
Fix typo in shader code

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1697>
2022-02-14 17:49:54 +00:00
Seungha Yang 27246ebeb0 d3d11download: Fix decide_allocation
Caps should be parsed in any cases.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1691>
2022-02-14 10:48:31 +00:00
Seungha Yang e96687d88d d3d11: Update build-time dependency
Remove all the d3d11 and dxgi header version dependent ifdef
and bump the minimum requirement to d3d11_4.h and dxgi1_6.h.
We are already failing support old Visual Studio (Windows SDK actually)
such as Visual Studio 2015. Note that our MinGW toolchain satisfies
the requirement.

From runtime point of view, this change should be fine since
we are checking OS version with IUnknown::QueryInterface()
everywhere in order to check API availability

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1684>
2022-02-11 20:01:52 +00:00
Seungha Yang c7a9b5c458 d3d11decoder: Promote rank to primary except for mpeg2
Our D3D11/DXVA codecs implementation has been verified
during 1.18 and 1.20 development cycle and also via the Fluster
test framework. Similar to the case of nvdec and vtdec,
we can prefer hardware over software in most cases

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1672>
2022-02-10 17:16:18 +00:00
Seungha Yang a37da515f4 d3d11memory: Add support for ID3D11Buffer
Allow wrap ID3D11Buffer via GstD3D11Memory object
At the moment, only staging ID3D11Buffer is supported.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1408>
2022-02-08 10:05:35 +00:00
Seungha Yang 6434d69f8c codecs: Stop claiming constness for refcounted object
It's almost pointless and makes little sense as subclass might
want to modify refcount of the object or so. And all subclasses
are already casting them to non-const version as well.
In a general sense, we need to avoid passing refcounted object
with const qualifier.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1238>
2022-02-06 17:17:22 +00:00
Seungha Yang 499c89c729 d3d11videosink: Use staging buffer pool for non-d3d11 upstream
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1643>
2022-02-06 21:58:52 +09:00
Seungha Yang 9518f15309 d3d11upload,d3d11download: Use staging buffer pool
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1643>
2022-02-06 21:58:48 +09:00
Seungha Yang b22aa14e43 d3d11decoder: Use staging buffer pool for non-d3d11 downstream
In specific condition, this can show about 10% ~ 30%
performance gain with non-d3d11 downstream element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1643>
2022-02-06 21:57:17 +09:00
Seungha Yang ea06439c39 d3d11decoder: Fix typo in doc
s/elemenet/element/g

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1598>
2022-01-29 04:47:16 +09:00
Seungha Yang 7b1683f6b2 d3d11av1dec: Fix typo in debug message
Fixing copy and paste mistake, It's AV1 decoder not VP8

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1576>
2022-01-27 03:11:33 +09:00
Seungha Yang f97ab9edf7 d3d11deinterlace: Do not restrict minimum resolution to 64x64
The value 64 was completely arbitrary one, and this element
will be able to support smaller resolutions

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1528>
2022-01-16 02:23:55 +09:00
Seungha Yang e63a3a7f31 d3d11compositor: Don't try to read empty buffer
The queued buffer may not be readable buffer in case that
upstream sends GAP event or so.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1497>
2022-01-13 20:27:50 +00:00
Seungha Yang 5fefc689a0 d3d11decoder: Negotiate again on the first output buffer
... unconditionally. There may be updated field in sinkpad caps
after the new_sequence() call (HDR related ones for example),
then we should signal the information to downstream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1474>
2021-12-30 11:09:45 +00:00
Seungha Yang 91484ce2ac d3d11av1dec: Update sinkpad template for profile
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1456>
2021-12-21 22:20:34 +09:00
Seungha Yang 1564567c3e d3d11av1dec: Fix for Cdef param
av1parser will increase the sec_strength values by 1 if parsed
values were equal to 3 as defined in spec. But DXVA wants unmodified
ones.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1455>
2021-12-17 23:28:29 +09:00
Seungha Yang 146815bbb6 d3d11av1dec: Sync DXVA AV1 data structure with released header
Update AV1 data structure based on Windows 11 SDK header

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1455>
2021-12-17 23:27:24 +09:00
Seungha Yang f10867dfb5 d3d11videosink: Use only tested color space for swapchain
We are querying supported swapchain colorspace via
CheckColorSpaceSupport() but it doesn't seem to be reliable.
Use only tested full-range RGB formats which are:
- sRGB
- BT709 primaries with linear RGB
- BT2020 primaries with PQ gamma

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1433>
2021-12-12 11:00:24 +00:00
Seungha Yang e8c923ebde d3d11window: Remove hack related to color space selection
Use input GstVideoColorPrimaries without any special case handling
otherwise rendered image color would be very wrong.

The hack was added to work around an issue that some Intel driver
couldn't handle wide color gamut image without HDR10 metadata, specifically PQ image.
But device capability can be checked via a method added in
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1723
so there's no issue now.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1175
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1430>
2021-12-09 20:12:12 +09:00
Seungha Yang 1a12883993 d3d11window: Fix typo in debug message
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1430>
2021-12-09 19:51:20 +09:00
Seungha Yang e87791592e d3d11vp9dec: Drop frames on non-keyframe format change
... in case of NVIDIA GPU

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1407>
2021-12-02 19:19:59 +00:00
Seungha Yang 7fe08d8bed d3d11: Stop doc for non-default decoder and deinterlacer elements
Just skip doc for non-default decoder/deinterlacer elements
since there are multiple element in case that system has
multiple GPUs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1360>
2021-11-19 13:38:19 +00:00
Wonchul Lee ae7a365274 d3d11: Fix deadlock while doing unprepare
ShowWindow() could be blocked while doing gst_d3d11_window_win32_unprepare
when external window handle provided to d3d11videosink in multi-threaded
environment.
The condition that issue happened is, UI thread is waiting for a
background thread that changes d3d11videosink state to NULL, and the
background thread would try to send a window message to the queue.
The queue is already occupied by the UI thread, so the background
thread will be blocked.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1366>
2021-11-19 13:42:53 +09:00
Seungha Yang be9cf6c9cd d3d11: d3d11{convert,scale}: Add add-borders property
Functionally identical to that of videoscale element.

When disabled, d3d11convert or d3d11scale element will scale
image without adding borders, meaning that display aspect ratio
will not be preserved.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1170>
2021-10-17 12:36:28 +00:00
Seungha Yang b3710aa68d d3d11: Rename screen capture element
Old name "desktopdup" may confuse users. Now it's renamed to
"screencapture"

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1136>
2021-10-14 15:15:56 +00:00
Seungha Yang 4b85704b88 d3d11: Add device provider for d3d11desktopdupsrc
... and add support for multi-GPU/multi-monitor

By using newly added "monitor-handle" property, user can specify a
monitor to be captured via HMONITOR handle.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1673
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1103>
2021-10-11 15:21:26 +00:00
Seungha Yang 5707e487cf d3d11: d3d11decoder: Use DXGI adapter LUID
... instead of index of DXGI adapter.

The order of IDXGIAdapter1 enumerated via IDXGIFactory1::EnumAdapters1
can be varying even there's no rebooting in case that GPU preference order
is updated by user (for example, it can be done by using NVIDIA Control Panel
in case of multi-GPU laptop system) and eGPU is another possible case.

So, for an element which requires fixed target GPU requirement,
index based device enumeration is unreliable.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1098>
2021-10-10 03:23:58 +09:00
Seungha Yang d8eff2623d d3d11: d3d11device: Remove "allow-tearing" property
Plugin can query DXGI_FEATURE_PRESENT_ALLOW_TEARING without d3d11device
help

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1098>
2021-10-10 01:01:44 +09:00
Seungha Yang 7286c8e302 d3d11: d3d11desktopdupsrc: Add support for non-D3D11 downstream element
By this commit, application doesn't need to configure d3d11download
element for software pipeline which will make things simpler

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1082>
2021-10-08 16:13:46 +09:00
Seungha Yang 7c557c2d65 codecs: mpeg2decoder: Use GstFlowReturn everywhere
boolean return value is not sufficient for representing the reason
of error in most cases. For instance, any errors around new_sequence()
would mean negotiation error, not just *ERROR*.
And some subclasses will allocate buffer/memory/surface on new_picture()
but it could be failed because of expected error, likely flushing

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1019>
2021-10-04 20:56:46 +00:00
Seungha Yang e322745763 codecs: h264decoder: Use GstFlowReturn everywhere
boolean return value is not sufficient for representing the reason
of error in most cases. For instance, any errors around new_sequence()
would mean negotiation error, not just *ERROR*.
And some subclasses will allocate buffer/memory/surface on new_picture()
but it could be failed because of expected error, likely flushing

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1019>
2021-10-04 20:56:46 +00:00
Seungha Yang 5b405d1585 codecs: h265decoder: Use GstFlowReturn everywhere
boolean return value is not sufficient for representing the reason
of error in most cases. For instance, any errors around new_sequence()
would mean negotiation error, not just *ERROR*.
And some subclasses will allocate buffer/memory/surface on new_picture()
but it could be failed because of expected error, likely flushing

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1019>
2021-10-04 20:56:46 +00:00
Seungha Yang 6a756b9f46 d3d11: d3d11vp9dec: Fix use_prev_in_find_mv_refs value setting
"last_show_frame" should be updated based on
GstVp9FrameHeader::show_frame, not show_existing_frame

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1021>
2021-10-03 02:25:50 +09:00
Seungha Yang 052983014e d3d11videosink: Add support for crop meta
... when upstream element is d3d11.

Note that, if upstream element is not d3d11, crop meta is almost
pointless since d3d11videosink will upload video frame to GPU memory
in any case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/933>
2021-09-27 16:29:09 +00:00
Seungha Yang 0fa5a06ed9 d3d11videosink: Perform propose_allocation() even when we have no configured window
In order to support d3d11 device update, d3d11videosink will configure
window on the first buffer. So, there might not be configured
window when propose_allocation() is required.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/933>
2021-09-27 16:29:09 +00:00
Thibault Saunier 019971a3c7 Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00