From fce7431381b602b8e005a7cfb3a072f19e11e402 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Fri, 24 Jun 2022 01:25:07 +0900 Subject: [PATCH] d3d11: Install library headers Our Direct3D11 abstraction layer has been improved and it gained good shape from API point of view. Also, On Windows, GstD3D11 has various advantages over GstGL in terms of compatibility/stability/feature/performance. Note that WGL implementation is known to be buggy for some drivers/vendors/scenario (that's a reason why Google implemented ANGLE). Moreover, GstGL is not fully optimized for Windows unfortunately. It's the time to open this interface to application developers for various optimized processing using our Direct3D11 infrastructure. Part-of: --- .../gst-libs/gst/d3d11/d3d11-prelude.h | 4 +- .../gst-libs/gst/d3d11/gstd3d11.h | 5 +- .../gst-libs/gst/d3d11/gstd3d11_fwd.h | 4 +- .../gst-libs/gst/d3d11/gstd3d11_private.h | 4 +- .../gst-libs/gst/d3d11/gstd3d11bufferpool.cpp | 6 +- .../gst-libs/gst/d3d11/gstd3d11bufferpool.h | 4 +- .../gst-libs/gst/d3d11/gstd3d11config.h.meson | 7 +- .../gst-libs/gst/d3d11/gstd3d11device.cpp | 20 ++--- .../gst-libs/gst/d3d11/gstd3d11device.h | 4 +- .../gst-libs/gst/d3d11/gstd3d11format.cpp | 14 +++- .../gst-libs/gst/d3d11/gstd3d11format.h | 4 +- .../gst-libs/gst/d3d11/gstd3d11memory.cpp | 61 +++++++++----- .../gst-libs/gst/d3d11/gstd3d11memory.h | 20 +++-- .../gst-libs/gst/d3d11/gstd3d11utils.cpp | 12 +-- .../gst-libs/gst/d3d11/gstd3d11utils.h | 6 +- .../gst-libs/gst/d3d11/meson.build | 80 ++++++++++++++++++- 16 files changed, 167 insertions(+), 88 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/d3d11-prelude.h b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/d3d11-prelude.h index f96c12072f..5f2194083b 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/d3d11-prelude.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/d3d11-prelude.h @@ -17,8 +17,7 @@ * Boston, MA 02110-1301, USA. */ -#ifndef __GST_D3D11_PRELUDE_H__ -#define __GST_D3D11_PRELUDE_H__ +#pragma once #include @@ -30,4 +29,3 @@ # endif #endif -#endif /* __GST_D3D11_PRELUDE_H__ */ diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11.h b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11.h index f92bdb3926..5ba4e5a240 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11.h @@ -17,8 +17,7 @@ * Boston, MA 02110-1301, USA. */ -#ifndef __GST_D3D11_H__ -#define __GST_D3D11_H__ +#pragma once #ifndef GST_USE_UNSTABLE_API #pragma message ("The d3d11 library from gst-plugins-bad is unstable API and may change in future.") @@ -28,10 +27,10 @@ #include #include #include +#include #include #include #include #include #include -#endif /* __GST_D3D11_H__ */ diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11_fwd.h b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11_fwd.h index cec4829b3c..259b1b3640 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11_fwd.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11_fwd.h @@ -18,8 +18,7 @@ * Boston, MA 02110-1301, USA. */ -#ifndef __GST_D3D11_FWD_H__ -#define __GST_D3D11_FWD_H__ +#pragma once #include #include @@ -62,4 +61,3 @@ typedef struct _GstD3D11Format GstD3D11Format; G_END_DECLS -#endif /* __GST_D3D11_FWD_H__ */ diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11_private.h b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11_private.h index e31a55cddf..ab159a914c 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11_private.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11_private.h @@ -17,8 +17,7 @@ * Boston, MA 02110-1301, USA. */ -#ifndef __GST_D3D11_PRIVATE_H__ -#define __GST_D3D11_PRIVATE_H__ +#pragma once #include #include @@ -113,4 +112,3 @@ static const GstD3D11Format _gst_d3d11_default_format_map[] = { G_END_DECLS -#endif /* __GST_D3D11_PRIVATE_H__ */ diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11bufferpool.cpp b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11bufferpool.cpp index 628f6c1df2..461ddb6ea6 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11bufferpool.cpp +++ b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11bufferpool.cpp @@ -505,7 +505,7 @@ gst_d3d11_buffer_pool_stop (GstBufferPool * pool) * * Returns: a #GstBufferPool that allocates buffers with #GstD3D11Memory * - * Since: 1.20 + * Since: 1.22 */ GstBufferPool * gst_d3d11_buffer_pool_new (GstD3D11Device * device) @@ -530,7 +530,7 @@ gst_d3d11_buffer_pool_new (GstD3D11Device * device) * #GstD3D11AllocationParams on @config or %NULL if @config doesn't contain * #GstD3D11AllocationParams * - * Since: 1.20 + * Since: 1.22 */ GstD3D11AllocationParams * gst_buffer_pool_config_get_d3d11_allocation_params (GstStructure * config) @@ -551,7 +551,7 @@ gst_buffer_pool_config_get_d3d11_allocation_params (GstStructure * config) * * Sets @params on @config * - * Since: 1.20 + * Since: 1.22 */ void gst_buffer_pool_config_set_d3d11_allocation_params (GstStructure * config, diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11bufferpool.h b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11bufferpool.h index 114288ccf0..eed9de89d7 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11bufferpool.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11bufferpool.h @@ -19,8 +19,7 @@ * Boston, MA 02110-1301, USA. */ -#ifndef __GST_D3D11_BUFFER_POOL_H__ -#define __GST_D3D11_BUFFER_POOL_H__ +#pragma once #include #include @@ -70,4 +69,3 @@ void gst_buffer_pool_config_set_d3d11_allocation_params (GstStru G_END_DECLS -#endif /* __GST_D3D11_BUFFER_POOL_H__ */ diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11config.h.meson b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11config.h.meson index dff91664df..3248164cde 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11config.h.meson +++ b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11config.h.meson @@ -1,7 +1,4 @@ -/* gstd3d11config.h */ - -#ifndef __GST_D3D11_CONFIG_H__ -#define __GST_D3D11_CONFIG_H__ +#pragma once #include @@ -11,5 +8,3 @@ G_BEGIN_DECLS #mesondefine GST_D3D11_WINAPI_APP G_END_DECLS - -#endif /* __GST_D3D11_CONFIG_H__ */ diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11device.cpp b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11device.cpp index 61fd50b406..a36f284271 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11device.cpp +++ b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11device.cpp @@ -1110,7 +1110,7 @@ gst_d3d11_device_new_internal (const GstD3D11DeviceConstructData * data) * Returns: (transfer full) (nullable): a new #GstD3D11Device for @adapter_index * or %NULL when failed to create D3D11 device with given adapter index. * - * Since: 1.20 + * Since: 1.22 */ GstD3D11Device * gst_d3d11_device_new (guint adapter_index, guint flags) @@ -1132,7 +1132,7 @@ gst_d3d11_device_new (guint adapter_index, guint flags) * Returns: (transfer full) (nullable): a new #GstD3D11Device for @adapter_luid * or %NULL when failed to create D3D11 device with given adapter luid. * - * Since: 1.20 + * Since: 1.22 */ GstD3D11Device * gst_d3d11_device_new_for_adapter_luid (gint64 adapter_luid, guint flags) @@ -1153,7 +1153,7 @@ gst_d3d11_device_new_for_adapter_luid (gint64 adapter_luid, guint flags) * Returns: (transfer full) (nullable): a new #GstD3D11Device for @device * or %NULL if an error occurred * - * Since: 1.20 + * Since: 1.22 */ GstD3D11Device * gst_d3d11_device_new_wrapped (ID3D11Device * device) @@ -1178,7 +1178,7 @@ gst_d3d11_device_new_wrapped (ID3D11Device * device) * * Returns: (transfer none): the ID3D11Device handle * - * Since: 1.20 + * Since: 1.22 */ ID3D11Device * gst_d3d11_device_get_device_handle (GstD3D11Device * device) @@ -1198,7 +1198,7 @@ gst_d3d11_device_get_device_handle (GstD3D11Device * device) * * Returns: (transfer none): the immeidate ID3D11DeviceContext handle * - * Since: 1.20 + * Since: 1.22 */ ID3D11DeviceContext * gst_d3d11_device_get_device_context_handle (GstD3D11Device * device) @@ -1217,7 +1217,7 @@ gst_d3d11_device_get_device_context_handle (GstD3D11Device * device) * * Returns: (transfer none): the IDXGIFactory1 handle * - * Since: 1.20 + * Since: 1.22 */ IDXGIFactory1 * gst_d3d11_device_get_dxgi_factory_handle (GstD3D11Device * device) @@ -1237,7 +1237,7 @@ gst_d3d11_device_get_dxgi_factory_handle (GstD3D11Device * device) * Returns: (nullable) (transfer none) : the ID3D11VideoDevice handle or %NULL * if ID3D11VideoDevice is unavailable. * - * Since: 1.20 + * Since: 1.22 */ ID3D11VideoDevice * gst_d3d11_device_get_video_device_handle (GstD3D11Device * device) @@ -1271,7 +1271,7 @@ gst_d3d11_device_get_video_device_handle (GstD3D11Device * device) * Returns: (nullable) (transfer none): the ID3D11VideoContext handle or %NULL * if ID3D11VideoContext is unavailable. * - * Since: 1.20 + * Since: 1.22 */ ID3D11VideoContext * gst_d3d11_device_get_video_context_handle (GstD3D11Device * device) @@ -1303,7 +1303,7 @@ gst_d3d11_device_get_video_context_handle (GstD3D11Device * device) * protected by this method. This call must be paired with * gst_d3d11_device_unlock() * - * Since: 1.20 + * Since: 1.22 */ void gst_d3d11_device_lock (GstD3D11Device * device) @@ -1326,7 +1326,7 @@ gst_d3d11_device_lock (GstD3D11Device * device) * Release lock for @device. This call must be paired with * gst_d3d11_device_lock() * - * Since: 1.20 + * Since: 1.22 */ void gst_d3d11_device_unlock (GstD3D11Device * device) diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11device.h b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11device.h index bcce6d3400..970d3344bb 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11device.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11device.h @@ -18,8 +18,7 @@ * Boston, MA 02110-1301, USA. */ -#ifndef __GST_D3D11_DEVICE_H__ -#define __GST_D3D11_DEVICE_H__ +#pragma once #include #include @@ -97,4 +96,3 @@ gboolean gst_d3d11_device_get_format (GstD3D11Device * devi G_END_DECLS -#endif /* __GST_D3D11_DEVICE_H__ */ diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11format.cpp b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11format.cpp index c95e58706d..597b119557 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11format.cpp +++ b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11format.cpp @@ -127,7 +127,7 @@ gst_d3d11_format_support_get_type (void) * * Returns: %TRUE if @size can be calculated with given information * - * Since: 1.20 + * Since: 1.22 */ gboolean gst_d3d11_dxgi_format_get_size (DXGI_FORMAT format, guint width, guint height, @@ -183,7 +183,7 @@ gst_d3d11_dxgi_format_get_size (DXGI_FORMAT format, guint width, guint height, * * Returns: a #GstVideoFormat equivalent to @format * - * Since: 1.20 + * Since: 1.22 */ GstVideoFormat gst_d3d11_dxgi_format_to_gst (DXGI_FORMAT format) @@ -295,6 +295,16 @@ gst_d3d11_dxgi_format_get_alignment (DXGI_FORMAT format) return 0; } +/** + * gst_d3d11_dxgi_format_to_string: + * @format: a DXGI_FORMAT + * + * Converts @format enum value to its string representation + * + * Returns: a string representation of @format + * + * Since: 1.22 + */ const gchar * gst_d3d11_dxgi_format_to_string (DXGI_FORMAT format) { diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11format.h b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11format.h index bb71a2a708..6448dee9e5 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11format.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11format.h @@ -17,8 +17,7 @@ * Boston, MA 02110-1301, USA. */ -#ifndef __GST_D3D11_FORMAT_H__ -#define __GST_D3D11_FORMAT_H__ +#pragma once #include #include @@ -94,4 +93,3 @@ const gchar * gst_d3d11_dxgi_format_to_string (DXGI_FORMAT format); G_END_DECLS -#endif /* __GST_D3D11_FORMAT_H__ */ diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11memory.cpp b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11memory.cpp index a47ae7b195..e5fabf3d26 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11memory.cpp +++ b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11memory.cpp @@ -55,11 +55,12 @@ G_DEFINE_BOXED_TYPE_WITH_CODE (GstD3D11AllocationParams, * * Returns: a #GstD3D11AllocationParams or %NULL if @info is not supported * - * Since: 1.20 + * Since: 1.22 */ GstD3D11AllocationParams * -gst_d3d11_allocation_params_new (GstD3D11Device * device, GstVideoInfo * info, - GstD3D11AllocationFlags flags, guint bind_flags, guint misc_flags) +gst_d3d11_allocation_params_new (GstD3D11Device * device, + const GstVideoInfo * info, GstD3D11AllocationFlags flags, guint bind_flags, + guint misc_flags) { GstD3D11AllocationParams *ret; GstD3D11Format d3d11_format; @@ -136,11 +137,11 @@ gst_d3d11_allocation_params_new (GstD3D11Device * device, GstVideoInfo * info, * * Returns: %TRUE if alignment could be applied * - * Since: 1.20 + * Since: 1.22 */ gboolean gst_d3d11_allocation_params_alignment (GstD3D11AllocationParams * params, - GstVideoAlignment * align) + const GstVideoAlignment * align) { guint i; guint padding_width, padding_height; @@ -179,7 +180,7 @@ gst_d3d11_allocation_params_alignment (GstD3D11AllocationParams * params, * * Returns: a copy of @src * - * Since: 1.20 + * Since: 1.22 */ GstD3D11AllocationParams * gst_d3d11_allocation_params_copy (GstD3D11AllocationParams * src) @@ -200,7 +201,7 @@ gst_d3d11_allocation_params_copy (GstD3D11AllocationParams * src) * * Free @params * - * Since: 1.20 + * Since: 1.22 */ void gst_d3d11_allocation_params_free (GstD3D11AllocationParams * params) @@ -547,7 +548,7 @@ out: * * Returns: whether @mem is a #GstD3D11Memory * - * Since: 1.20 + * Since: 1.22 */ gboolean gst_is_d3d11_memory (GstMemory * mem) @@ -581,7 +582,7 @@ gst_d3d11_memory_get_native_type (GstD3D11Memory * mem) * this function multiple times. This must be called before any other * GstD3D11Memory operation. * - * Since: 1.20 + * Since: 1.22 */ void gst_d3d11_memory_init_once (void) @@ -634,7 +635,7 @@ gst_d3d11_memory_get_resource_handle (GstD3D11Memory * mem) * * Returns: subresource index corresponding to @mem. * - * Since: 1.20 + * Since: 1.22 */ guint gst_d3d11_memory_get_subresource_index (GstD3D11Memory * mem) @@ -656,7 +657,7 @@ gst_d3d11_memory_get_subresource_index (GstD3D11Memory * mem) * * Returns: %TRUE if successeed * - * Since: 1.20 + * Since: 1.22 */ gboolean gst_d3d11_memory_get_texture_desc (GstD3D11Memory * mem, @@ -813,7 +814,7 @@ done: * Returns: the number of ID3D11ShaderResourceView that can be used * for processing GPU operation with @mem * - * Since: 1.20 + * Since: 1.22 */ guint gst_d3d11_memory_get_shader_resource_view_size (GstD3D11Memory * mem) @@ -835,7 +836,7 @@ gst_d3d11_memory_get_shader_resource_view_size (GstD3D11Memory * mem) * ID3D11ShaderResourceView or %NULL if ID3D11ShaderResourceView is unavailable * for @index * - * Since: 1.20 + * Since: 1.22 */ ID3D11ShaderResourceView * gst_d3d11_memory_get_shader_resource_view (GstD3D11Memory * mem, guint index) @@ -951,7 +952,7 @@ done: * Returns: the number of ID3D11RenderTargetView that can be used * for processing GPU operation with @mem * - * Since: 1.20 + * Since: 1.22 */ guint gst_d3d11_memory_get_render_target_view_size (GstD3D11Memory * mem) @@ -973,7 +974,7 @@ gst_d3d11_memory_get_render_target_view_size (GstD3D11Memory * mem) * ID3D11RenderTargetView or %NULL if ID3D11RenderTargetView is unavailable * for @index * - * Since: 1.20 + * Since: 1.22 */ ID3D11RenderTargetView * gst_d3d11_memory_get_render_target_view (GstD3D11Memory * mem, guint index) @@ -1073,7 +1074,7 @@ done: * ID3D11VideoDecoderOutputView or %NULL if ID3D11VideoDecoderOutputView is * unavailable * - * Since: 1.20 + * Since: 1.22 */ ID3D11VideoDecoderOutputView * gst_d3d11_memory_get_decoder_output_view (GstD3D11Memory * mem, @@ -1166,7 +1167,7 @@ done: * ID3D11VideoProcessorInputView or %NULL if ID3D11VideoProcessorInputView is * unavailable * - * Since: 1.20 + * Since: 1.22 */ ID3D11VideoProcessorInputView * gst_d3d11_memory_get_processor_input_view (GstD3D11Memory * mem, @@ -1249,7 +1250,7 @@ done: * ID3D11VideoProcessorOutputView or %NULL if ID3D11VideoProcessorOutputView is * unavailable * - * Since: 1.20 + * Since: 1.22 */ ID3D11VideoProcessorOutputView * gst_d3d11_memory_get_processor_output_view (GstD3D11Memory * mem, @@ -1544,7 +1545,7 @@ gst_d3d11_allocator_alloc_internal (GstD3D11Allocator * self, * * Returns: a newly allocated #GstD3D11Memory with given parameters. * - * Since: 1.20 + * Since: 1.22 */ GstMemory * gst_d3d11_allocator_alloc (GstD3D11Allocator * allocator, @@ -1622,6 +1623,22 @@ gst_d3d11_allocator_alloc_buffer (GstD3D11Allocator * allocator, return GST_MEMORY_CAST (mem); } +/** + * gst_d3d11_allocator_set_active: + * @allocator: a #GstD3D11Allocator + * @active: the new active state + * + * Controls the active state of @allocator. Default #GstD3D11Allocator is + * stateless and therefore active state is ignored, but subclass implementation + * (e.g., #GstD3D11PoolAllocator) will require explicit active state control + * for its internal resource management. + * + * This method is conceptually identical to gst_buffer_pool_set_active method. + * + * Returns: %TRUE if active state of @allocator was successfully updated. + * + * Since: 1.22 + */ gboolean gst_d3d11_allocator_set_active (GstD3D11Allocator * allocator, gboolean active) { @@ -2156,6 +2173,8 @@ flushing: * Creates a new #GstD3D11PoolAllocator instance. * * Returns: (transfer full): a new #GstD3D11PoolAllocator instance + * + * Since: 1.22 */ GstD3D11PoolAllocator * gst_d3d11_pool_allocator_new (GstD3D11Device * device, @@ -2181,7 +2200,7 @@ gst_d3d11_pool_allocator_new (GstD3D11Device * device, /** * gst_d3d11_pool_allocator_acquire_memory: * @allocator: a #GstD3D11PoolAllocator - * @memory: (transfer full): a #GstMemory + * @memory: (out): a #GstMemory * * Acquires a #GstMemory from @allocator. @memory should point to a memory * location that can hold a pointer to the new #GstMemory. @@ -2228,7 +2247,7 @@ gst_d3d11_pool_allocator_acquire_memory (GstD3D11PoolAllocator * allocator, * * Returns: %TRUE if the size of memory pool is known * - * Since: 1.20 + * Since: 1.22 */ gboolean gst_d3d11_pool_allocator_get_pool_size (GstD3D11PoolAllocator * allocator, diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11memory.h b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11memory.h index c026c16e7f..11c5902bf5 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11memory.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11memory.h @@ -19,8 +19,7 @@ * Boston, MA 02110-1301, USA. */ -#ifndef __GST_D3D11_MEMORY_H__ -#define __GST_D3D11_MEMORY_H__ +#pragma once #include #include @@ -54,7 +53,7 @@ G_BEGIN_DECLS * * The name of the Direct3D11 memory * - * Since: 1.20 + * Since: 1.22 */ #define GST_D3D11_MEMORY_NAME "D3D11Memory" @@ -63,7 +62,7 @@ G_BEGIN_DECLS * * Name of the caps feature for indicating the use of #GstD3D11Memory * - * Since: 1.20 + * Since: 1.22 */ #define GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY "memory:D3D11Memory" @@ -72,7 +71,7 @@ G_BEGIN_DECLS * * Flag indicating that we should map the D3D11 resource instead of to system memory. * - * Since: 1.20 + * Since: 1.22 */ #define GST_MAP_D3D11 (GST_MAP_FLAG_LAST << 1) @@ -84,7 +83,7 @@ G_BEGIN_DECLS * is used for D3D11/DXVA decoders * in general. * - * Since: 1.20 + * Since: 1.22 */ typedef enum { @@ -99,7 +98,7 @@ typedef enum * @GST_D3D11_MEMORY_TRANSFER_NEED_UPLOAD: the staging texture needs uploading * to the texture * - * Since: 1.20 + * Since: 1.22 */ typedef enum { @@ -134,7 +133,7 @@ struct _GstD3D11AllocationParams GstD3D11AllocationFlags flags; /*< private >*/ - gpointer _gst_reserved[GST_PADDING_LARGE]; + gpointer _gst_reserved[GST_PADDING]; }; GST_D3D11_API @@ -142,7 +141,7 @@ GType gst_d3d11_allocation_params_get_type (void); GST_D3D11_API GstD3D11AllocationParams * gst_d3d11_allocation_params_new (GstD3D11Device * device, - GstVideoInfo * info, + const GstVideoInfo * info, GstD3D11AllocationFlags flags, guint bind_flags, guint misc_flags); @@ -155,7 +154,7 @@ void gst_d3d11_allocation_params_free (GstD3D11Allocat GST_D3D11_API gboolean gst_d3d11_allocation_params_alignment (GstD3D11AllocationParams * parms, - GstVideoAlignment * align); + const GstVideoAlignment * align); struct _GstD3D11Memory { @@ -303,4 +302,3 @@ gboolean gst_d3d11_pool_allocator_get_pool_size (GstD3D11PoolAllo G_END_DECLS -#endif /* __GST_D3D11_MEMORY_H__ */ diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11utils.cpp b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11utils.cpp index 033e0528c8..4e2db8db62 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11utils.cpp +++ b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11utils.cpp @@ -78,7 +78,7 @@ _init_context_debug (void) * * Returns: whether the @device could be set successfully * - * Since: 1.20 + * Since: 1.22 */ gboolean gst_d3d11_handle_set_context (GstElement * element, GstContext * context, @@ -139,7 +139,7 @@ gst_d3d11_handle_set_context (GstElement * element, GstContext * context, * * Returns: whether the @device could be set successfully * - * Since: 1.20 + * Since: 1.22 */ gboolean gst_d3d11_handle_set_context_for_adapter_luid (GstElement * element, @@ -227,7 +227,7 @@ context_set_d3d11_device (GstContext * context, GstD3D11Device * device) * Returns: Whether the @query was successfully responded to from the passed * @device. * - * Since: 1.20 + * Since: 1.22 */ gboolean gst_d3d11_handle_context_query (GstElement * element, GstQuery * query, @@ -373,7 +373,7 @@ run_d3d11_context_query (GstElement * element, GstD3D11Device ** device) * * Returns: whether a #GstD3D11Device exists in @device * - * Since: 1.20 + * Since: 1.22 */ gboolean gst_d3d11_ensure_element_data (GstElement * element, gint adapter, @@ -441,7 +441,7 @@ gst_d3d11_ensure_element_data (GstElement * element, gint adapter, * * Returns: whether a #GstD3D11Device exists in @device * - * Since: 1.20 + * Since: 1.22 */ gboolean gst_d3d11_ensure_element_data_for_adapter_luid (GstElement * element, @@ -499,7 +499,7 @@ gst_d3d11_ensure_element_data_for_adapter_luid (GstElement * element, * See also Int64FromLuid method defined in * windows.devices.display.core.interop.h Windows SDK header * - * Since: 1.20 + * Since: 1.22 */ gint64 gst_d3d11_luid_to_int64 (const LUID * luid) diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11utils.h b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11utils.h index a5b22ac1f9..8c59c1f484 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11utils.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11utils.h @@ -17,8 +17,7 @@ * Boston, MA 02110-1301, USA. */ -#ifndef __GST_D3D11_UTILS_H__ -#define __GST_D3D11_UTILS_H__ +#pragma once #include #include @@ -69,11 +68,10 @@ gboolean _gst_d3d11_result (HRESULT hr, * * Returns: %TRUE if D3D11 API call result is SUCCESS * - * Since: 1.20 + * Since: 1.22 */ #define gst_d3d11_result(result,device) \ _gst_d3d11_result (result, device, GST_CAT_DEFAULT, __FILE__, GST_FUNCTION, __LINE__) G_END_DECLS -#endif /* __GST_D3D11_UTILS_H__ */ diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/meson.build b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/meson.build index b1e9a2d52e..033151fe56 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/meson.build +++ b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/meson.build @@ -6,6 +6,26 @@ d3d11_sources = [ 'gstd3d11utils.cpp', ] +d3d11_headers = [ + 'd3d11-prelude.h', + 'gstd3d11_fwd.h', + 'gstd3d11.h', + 'gstd3d11bufferpool.h', + 'gstd3d11device.h', + 'gstd3d11format.h', + 'gstd3d11memory.h', + 'gstd3d11utils.h', +] + +d3d11_enum_types_headers = [ + 'gstd3d11_fwd.h', + 'gstd3d11bufferpool.h', + 'gstd3d11device.h', + 'gstd3d11format.h', + 'gstd3d11memory.h', + 'gstd3d11utils.h', +] + gstd3d11_dep = dependency('', required : false) if host_system != 'windows' @@ -135,13 +155,31 @@ if cc.get_id() != 'msvc' endif configure_file( - output: 'gstd3d11config.h', + input : 'gstd3d11config.h.meson', + output : 'gstd3d11config.h', + install_dir : get_option('libdir') + '/gstreamer-1.0/include/gst/d3d11', + install_tag : 'devel', configuration: d3d11_conf, ) +d3d11_enums = gnome.mkenums_simple('gstd3d11-enumtypes', + sources : d3d11_enum_types_headers, + body_prefix : '#ifdef HAVE_CONFIG_H\n#include "config.h"\n#endif', + header_prefix : '#include ', + decorator: 'GST_D3D11_API', + identifier_prefix: 'GstD3D11', + symbol_prefix: 'gst_d3d11', + install_header: true, + install_dir : join_paths(get_option('includedir'), 'gstreamer-1.0/gst/d3d11')) + +gstd3d11_c = d3d11_enums[0] +gstd3d11_h = d3d11_enums[1] + +gen_sources = [gstd3d11_h] + pkg_name = 'gstreamer-d3d11-' + api_version gstd3d11 = library('gstd3d11-' + api_version, - d3d11_sources, + d3d11_sources + d3d11_enums, c_args : gst_plugins_bad_args + extra_c_args + extra_comm_args, cpp_args : gst_plugins_bad_args + extra_comm_args, include_directories : [configinc, libsinc], @@ -151,10 +189,44 @@ gstd3d11 = library('gstd3d11-' + api_version, dependencies : [gstbase_dep, gstvideo_dep, gmodule_dep, d3d11_lib, dxgi_lib] ) +pkgconfig.generate(gstd3d11, + libraries : [gstbase_dep, gstvideo_dep, d3d11_lib, dxgi_lib], + variables : pkgconfig_variables, + subdirs : pkgconfig_subdirs, + extra_cflags : ['-I${libdir}/gstreamer-1.0/include'], + name : pkg_name, + description : 'GStreamer Direct3D11 library', +) + library_def = {'lib': gstd3d11} +if build_gir + gir_includes = ['Gst-1.0', 'GstBase-1.0', 'GstVideo-1.0'] + gir = { + 'sources' : d3d11_sources + d3d11_headers + [gstd3d11_h], + 'namespace' : 'GstD3D11', + 'nsversion' : api_version, + 'identifier_prefix' : 'Gst', + 'symbol_prefix' : 'gst', + 'export_packages' : pkg_name, + 'includes' : gir_includes, + 'install' : true, + 'extra_args' : gir_init_section + ['-DGST_USE_UNSTABLE_API'], + 'dependencies' : [gstbase_dep, gstvideo_dep, d3d11_lib, dxgi_lib], + } + if not static_build + d3d11_gir = gnome.generate_gir(gstd3d11, kwargs: gir) + gen_sources += d3d11_gir + endif + + library_def += {'gir': [gir]} +endif libraries += [[pkg_name, library_def]] -# Still non-public api, should not install headers +install_headers(d3d11_headers, subdir : 'gstreamer-1.0/gst/d3d11') + gstd3d11_dep = declare_dependency(link_with : gstd3d11, include_directories : [libsinc], - dependencies : [gstbase_dep, gstvideo_dep, d3d11_lib, dxgi_lib]) + dependencies : [gstbase_dep, gstvideo_dep, d3d11_lib, dxgi_lib], + sources : gen_sources) + +meson.override_dependency(pkg_name, gstd3d11_dep)