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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2646>
This commit is contained in:
Seungha Yang 2022-06-24 01:25:07 +09:00 committed by GStreamer Marge Bot
parent aca71fd692
commit fce7431381
16 changed files with 167 additions and 88 deletions

View file

@ -17,8 +17,7 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifndef __GST_D3D11_PRELUDE_H__ #pragma once
#define __GST_D3D11_PRELUDE_H__
#include <gst/gst.h> #include <gst/gst.h>
@ -30,4 +29,3 @@
# endif # endif
#endif #endif
#endif /* __GST_D3D11_PRELUDE_H__ */

View file

@ -17,8 +17,7 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifndef __GST_D3D11_H__ #pragma once
#define __GST_D3D11_H__
#ifndef GST_USE_UNSTABLE_API #ifndef GST_USE_UNSTABLE_API
#pragma message ("The d3d11 library from gst-plugins-bad is unstable API and may change in future.") #pragma message ("The d3d11 library from gst-plugins-bad is unstable API and may change in future.")
@ -28,10 +27,10 @@
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/d3d11/gstd3d11config.h> #include <gst/d3d11/gstd3d11config.h>
#include <gst/d3d11/gstd3d11_fwd.h> #include <gst/d3d11/gstd3d11_fwd.h>
#include <gst/d3d11/gstd3d11-enumtypes.h>
#include <gst/d3d11/gstd3d11device.h> #include <gst/d3d11/gstd3d11device.h>
#include <gst/d3d11/gstd3d11memory.h> #include <gst/d3d11/gstd3d11memory.h>
#include <gst/d3d11/gstd3d11bufferpool.h> #include <gst/d3d11/gstd3d11bufferpool.h>
#include <gst/d3d11/gstd3d11utils.h> #include <gst/d3d11/gstd3d11utils.h>
#include <gst/d3d11/gstd3d11format.h> #include <gst/d3d11/gstd3d11format.h>
#endif /* __GST_D3D11_H__ */

View file

@ -18,8 +18,7 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifndef __GST_D3D11_FWD_H__ #pragma once
#define __GST_D3D11_FWD_H__
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/d3d11/gstd3d11config.h> #include <gst/d3d11/gstd3d11config.h>
@ -62,4 +61,3 @@ typedef struct _GstD3D11Format GstD3D11Format;
G_END_DECLS G_END_DECLS
#endif /* __GST_D3D11_FWD_H__ */

View file

@ -17,8 +17,7 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifndef __GST_D3D11_PRIVATE_H__ #pragma once
#define __GST_D3D11_PRIVATE_H__
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/video/video.h> #include <gst/video/video.h>
@ -113,4 +112,3 @@ static const GstD3D11Format _gst_d3d11_default_format_map[] = {
G_END_DECLS G_END_DECLS
#endif /* __GST_D3D11_PRIVATE_H__ */

View file

@ -505,7 +505,7 @@ gst_d3d11_buffer_pool_stop (GstBufferPool * pool)
* *
* Returns: a #GstBufferPool that allocates buffers with #GstD3D11Memory * Returns: a #GstBufferPool that allocates buffers with #GstD3D11Memory
* *
* Since: 1.20 * Since: 1.22
*/ */
GstBufferPool * GstBufferPool *
gst_d3d11_buffer_pool_new (GstD3D11Device * device) 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 on @config or %NULL if @config doesn't contain
* #GstD3D11AllocationParams * #GstD3D11AllocationParams
* *
* Since: 1.20 * Since: 1.22
*/ */
GstD3D11AllocationParams * GstD3D11AllocationParams *
gst_buffer_pool_config_get_d3d11_allocation_params (GstStructure * config) 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 * Sets @params on @config
* *
* Since: 1.20 * Since: 1.22
*/ */
void void
gst_buffer_pool_config_set_d3d11_allocation_params (GstStructure * config, gst_buffer_pool_config_set_d3d11_allocation_params (GstStructure * config,

View file

@ -19,8 +19,7 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifndef __GST_D3D11_BUFFER_POOL_H__ #pragma once
#define __GST_D3D11_BUFFER_POOL_H__
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/video/video.h> #include <gst/video/video.h>
@ -70,4 +69,3 @@ void gst_buffer_pool_config_set_d3d11_allocation_params (GstStru
G_END_DECLS G_END_DECLS
#endif /* __GST_D3D11_BUFFER_POOL_H__ */

View file

@ -1,7 +1,4 @@
/* gstd3d11config.h */ #pragma once
#ifndef __GST_D3D11_CONFIG_H__
#define __GST_D3D11_CONFIG_H__
#include <gst/gst.h> #include <gst/gst.h>
@ -11,5 +8,3 @@ G_BEGIN_DECLS
#mesondefine GST_D3D11_WINAPI_APP #mesondefine GST_D3D11_WINAPI_APP
G_END_DECLS G_END_DECLS
#endif /* __GST_D3D11_CONFIG_H__ */

View file

@ -1110,7 +1110,7 @@ gst_d3d11_device_new_internal (const GstD3D11DeviceConstructData * data)
* Returns: (transfer full) (nullable): a new #GstD3D11Device for @adapter_index * Returns: (transfer full) (nullable): a new #GstD3D11Device for @adapter_index
* or %NULL when failed to create D3D11 device with given adapter index. * or %NULL when failed to create D3D11 device with given adapter index.
* *
* Since: 1.20 * Since: 1.22
*/ */
GstD3D11Device * GstD3D11Device *
gst_d3d11_device_new (guint adapter_index, guint flags) 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 * Returns: (transfer full) (nullable): a new #GstD3D11Device for @adapter_luid
* or %NULL when failed to create D3D11 device with given adapter luid. * or %NULL when failed to create D3D11 device with given adapter luid.
* *
* Since: 1.20 * Since: 1.22
*/ */
GstD3D11Device * GstD3D11Device *
gst_d3d11_device_new_for_adapter_luid (gint64 adapter_luid, guint flags) 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 * Returns: (transfer full) (nullable): a new #GstD3D11Device for @device
* or %NULL if an error occurred * or %NULL if an error occurred
* *
* Since: 1.20 * Since: 1.22
*/ */
GstD3D11Device * GstD3D11Device *
gst_d3d11_device_new_wrapped (ID3D11Device * device) gst_d3d11_device_new_wrapped (ID3D11Device * device)
@ -1178,7 +1178,7 @@ gst_d3d11_device_new_wrapped (ID3D11Device * device)
* *
* Returns: (transfer none): the ID3D11Device handle * Returns: (transfer none): the ID3D11Device handle
* *
* Since: 1.20 * Since: 1.22
*/ */
ID3D11Device * ID3D11Device *
gst_d3d11_device_get_device_handle (GstD3D11Device * device) 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 * Returns: (transfer none): the immeidate ID3D11DeviceContext handle
* *
* Since: 1.20 * Since: 1.22
*/ */
ID3D11DeviceContext * ID3D11DeviceContext *
gst_d3d11_device_get_device_context_handle (GstD3D11Device * device) 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 * Returns: (transfer none): the IDXGIFactory1 handle
* *
* Since: 1.20 * Since: 1.22
*/ */
IDXGIFactory1 * IDXGIFactory1 *
gst_d3d11_device_get_dxgi_factory_handle (GstD3D11Device * device) 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 * Returns: (nullable) (transfer none) : the ID3D11VideoDevice handle or %NULL
* if ID3D11VideoDevice is unavailable. * if ID3D11VideoDevice is unavailable.
* *
* Since: 1.20 * Since: 1.22
*/ */
ID3D11VideoDevice * ID3D11VideoDevice *
gst_d3d11_device_get_video_device_handle (GstD3D11Device * device) 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 * Returns: (nullable) (transfer none): the ID3D11VideoContext handle or %NULL
* if ID3D11VideoContext is unavailable. * if ID3D11VideoContext is unavailable.
* *
* Since: 1.20 * Since: 1.22
*/ */
ID3D11VideoContext * ID3D11VideoContext *
gst_d3d11_device_get_video_context_handle (GstD3D11Device * device) 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 * protected by this method. This call must be paired with
* gst_d3d11_device_unlock() * gst_d3d11_device_unlock()
* *
* Since: 1.20 * Since: 1.22
*/ */
void void
gst_d3d11_device_lock (GstD3D11Device * device) 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 * Release lock for @device. This call must be paired with
* gst_d3d11_device_lock() * gst_d3d11_device_lock()
* *
* Since: 1.20 * Since: 1.22
*/ */
void void
gst_d3d11_device_unlock (GstD3D11Device * device) gst_d3d11_device_unlock (GstD3D11Device * device)

View file

@ -18,8 +18,7 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifndef __GST_D3D11_DEVICE_H__ #pragma once
#define __GST_D3D11_DEVICE_H__
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/video/video.h> #include <gst/video/video.h>
@ -97,4 +96,3 @@ gboolean gst_d3d11_device_get_format (GstD3D11Device * devi
G_END_DECLS G_END_DECLS
#endif /* __GST_D3D11_DEVICE_H__ */

View file

@ -127,7 +127,7 @@ gst_d3d11_format_support_get_type (void)
* *
* Returns: %TRUE if @size can be calculated with given information * Returns: %TRUE if @size can be calculated with given information
* *
* Since: 1.20 * Since: 1.22
*/ */
gboolean gboolean
gst_d3d11_dxgi_format_get_size (DXGI_FORMAT format, guint width, guint height, 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 * Returns: a #GstVideoFormat equivalent to @format
* *
* Since: 1.20 * Since: 1.22
*/ */
GstVideoFormat GstVideoFormat
gst_d3d11_dxgi_format_to_gst (DXGI_FORMAT format) gst_d3d11_dxgi_format_to_gst (DXGI_FORMAT format)
@ -295,6 +295,16 @@ gst_d3d11_dxgi_format_get_alignment (DXGI_FORMAT format)
return 0; 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 * const gchar *
gst_d3d11_dxgi_format_to_string (DXGI_FORMAT format) gst_d3d11_dxgi_format_to_string (DXGI_FORMAT format)
{ {

View file

@ -17,8 +17,7 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifndef __GST_D3D11_FORMAT_H__ #pragma once
#define __GST_D3D11_FORMAT_H__
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/video/video.h> #include <gst/video/video.h>
@ -94,4 +93,3 @@ const gchar * gst_d3d11_dxgi_format_to_string (DXGI_FORMAT format);
G_END_DECLS G_END_DECLS
#endif /* __GST_D3D11_FORMAT_H__ */

View file

@ -55,11 +55,12 @@ G_DEFINE_BOXED_TYPE_WITH_CODE (GstD3D11AllocationParams,
* *
* Returns: a #GstD3D11AllocationParams or %NULL if @info is not supported * Returns: a #GstD3D11AllocationParams or %NULL if @info is not supported
* *
* Since: 1.20 * Since: 1.22
*/ */
GstD3D11AllocationParams * GstD3D11AllocationParams *
gst_d3d11_allocation_params_new (GstD3D11Device * device, GstVideoInfo * info, gst_d3d11_allocation_params_new (GstD3D11Device * device,
GstD3D11AllocationFlags flags, guint bind_flags, guint misc_flags) const GstVideoInfo * info, GstD3D11AllocationFlags flags, guint bind_flags,
guint misc_flags)
{ {
GstD3D11AllocationParams *ret; GstD3D11AllocationParams *ret;
GstD3D11Format d3d11_format; GstD3D11Format d3d11_format;
@ -136,11 +137,11 @@ gst_d3d11_allocation_params_new (GstD3D11Device * device, GstVideoInfo * info,
* *
* Returns: %TRUE if alignment could be applied * Returns: %TRUE if alignment could be applied
* *
* Since: 1.20 * Since: 1.22
*/ */
gboolean gboolean
gst_d3d11_allocation_params_alignment (GstD3D11AllocationParams * params, gst_d3d11_allocation_params_alignment (GstD3D11AllocationParams * params,
GstVideoAlignment * align) const GstVideoAlignment * align)
{ {
guint i; guint i;
guint padding_width, padding_height; guint padding_width, padding_height;
@ -179,7 +180,7 @@ gst_d3d11_allocation_params_alignment (GstD3D11AllocationParams * params,
* *
* Returns: a copy of @src * Returns: a copy of @src
* *
* Since: 1.20 * Since: 1.22
*/ */
GstD3D11AllocationParams * GstD3D11AllocationParams *
gst_d3d11_allocation_params_copy (GstD3D11AllocationParams * src) gst_d3d11_allocation_params_copy (GstD3D11AllocationParams * src)
@ -200,7 +201,7 @@ gst_d3d11_allocation_params_copy (GstD3D11AllocationParams * src)
* *
* Free @params * Free @params
* *
* Since: 1.20 * Since: 1.22
*/ */
void void
gst_d3d11_allocation_params_free (GstD3D11AllocationParams * params) gst_d3d11_allocation_params_free (GstD3D11AllocationParams * params)
@ -547,7 +548,7 @@ out:
* *
* Returns: whether @mem is a #GstD3D11Memory * Returns: whether @mem is a #GstD3D11Memory
* *
* Since: 1.20 * Since: 1.22
*/ */
gboolean gboolean
gst_is_d3d11_memory (GstMemory * mem) 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 * this function multiple times. This must be called before any other
* GstD3D11Memory operation. * GstD3D11Memory operation.
* *
* Since: 1.20 * Since: 1.22
*/ */
void void
gst_d3d11_memory_init_once (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. * Returns: subresource index corresponding to @mem.
* *
* Since: 1.20 * Since: 1.22
*/ */
guint guint
gst_d3d11_memory_get_subresource_index (GstD3D11Memory * mem) gst_d3d11_memory_get_subresource_index (GstD3D11Memory * mem)
@ -656,7 +657,7 @@ gst_d3d11_memory_get_subresource_index (GstD3D11Memory * mem)
* *
* Returns: %TRUE if successeed * Returns: %TRUE if successeed
* *
* Since: 1.20 * Since: 1.22
*/ */
gboolean gboolean
gst_d3d11_memory_get_texture_desc (GstD3D11Memory * mem, gst_d3d11_memory_get_texture_desc (GstD3D11Memory * mem,
@ -813,7 +814,7 @@ done:
* Returns: the number of ID3D11ShaderResourceView that can be used * Returns: the number of ID3D11ShaderResourceView that can be used
* for processing GPU operation with @mem * for processing GPU operation with @mem
* *
* Since: 1.20 * Since: 1.22
*/ */
guint guint
gst_d3d11_memory_get_shader_resource_view_size (GstD3D11Memory * mem) 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 * ID3D11ShaderResourceView or %NULL if ID3D11ShaderResourceView is unavailable
* for @index * for @index
* *
* Since: 1.20 * Since: 1.22
*/ */
ID3D11ShaderResourceView * ID3D11ShaderResourceView *
gst_d3d11_memory_get_shader_resource_view (GstD3D11Memory * mem, guint index) 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 * Returns: the number of ID3D11RenderTargetView that can be used
* for processing GPU operation with @mem * for processing GPU operation with @mem
* *
* Since: 1.20 * Since: 1.22
*/ */
guint guint
gst_d3d11_memory_get_render_target_view_size (GstD3D11Memory * mem) 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 * ID3D11RenderTargetView or %NULL if ID3D11RenderTargetView is unavailable
* for @index * for @index
* *
* Since: 1.20 * Since: 1.22
*/ */
ID3D11RenderTargetView * ID3D11RenderTargetView *
gst_d3d11_memory_get_render_target_view (GstD3D11Memory * mem, guint index) gst_d3d11_memory_get_render_target_view (GstD3D11Memory * mem, guint index)
@ -1073,7 +1074,7 @@ done:
* ID3D11VideoDecoderOutputView or %NULL if ID3D11VideoDecoderOutputView is * ID3D11VideoDecoderOutputView or %NULL if ID3D11VideoDecoderOutputView is
* unavailable * unavailable
* *
* Since: 1.20 * Since: 1.22
*/ */
ID3D11VideoDecoderOutputView * ID3D11VideoDecoderOutputView *
gst_d3d11_memory_get_decoder_output_view (GstD3D11Memory * mem, gst_d3d11_memory_get_decoder_output_view (GstD3D11Memory * mem,
@ -1166,7 +1167,7 @@ done:
* ID3D11VideoProcessorInputView or %NULL if ID3D11VideoProcessorInputView is * ID3D11VideoProcessorInputView or %NULL if ID3D11VideoProcessorInputView is
* unavailable * unavailable
* *
* Since: 1.20 * Since: 1.22
*/ */
ID3D11VideoProcessorInputView * ID3D11VideoProcessorInputView *
gst_d3d11_memory_get_processor_input_view (GstD3D11Memory * mem, gst_d3d11_memory_get_processor_input_view (GstD3D11Memory * mem,
@ -1249,7 +1250,7 @@ done:
* ID3D11VideoProcessorOutputView or %NULL if ID3D11VideoProcessorOutputView is * ID3D11VideoProcessorOutputView or %NULL if ID3D11VideoProcessorOutputView is
* unavailable * unavailable
* *
* Since: 1.20 * Since: 1.22
*/ */
ID3D11VideoProcessorOutputView * ID3D11VideoProcessorOutputView *
gst_d3d11_memory_get_processor_output_view (GstD3D11Memory * mem, 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. * Returns: a newly allocated #GstD3D11Memory with given parameters.
* *
* Since: 1.20 * Since: 1.22
*/ */
GstMemory * GstMemory *
gst_d3d11_allocator_alloc (GstD3D11Allocator * allocator, gst_d3d11_allocator_alloc (GstD3D11Allocator * allocator,
@ -1622,6 +1623,22 @@ gst_d3d11_allocator_alloc_buffer (GstD3D11Allocator * allocator,
return GST_MEMORY_CAST (mem); 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 gboolean
gst_d3d11_allocator_set_active (GstD3D11Allocator * allocator, gboolean active) gst_d3d11_allocator_set_active (GstD3D11Allocator * allocator, gboolean active)
{ {
@ -2156,6 +2173,8 @@ flushing:
* Creates a new #GstD3D11PoolAllocator instance. * Creates a new #GstD3D11PoolAllocator instance.
* *
* Returns: (transfer full): a new #GstD3D11PoolAllocator instance * Returns: (transfer full): a new #GstD3D11PoolAllocator instance
*
* Since: 1.22
*/ */
GstD3D11PoolAllocator * GstD3D11PoolAllocator *
gst_d3d11_pool_allocator_new (GstD3D11Device * device, gst_d3d11_pool_allocator_new (GstD3D11Device * device,
@ -2181,7 +2200,7 @@ gst_d3d11_pool_allocator_new (GstD3D11Device * device,
/** /**
* gst_d3d11_pool_allocator_acquire_memory: * gst_d3d11_pool_allocator_acquire_memory:
* @allocator: a #GstD3D11PoolAllocator * @allocator: a #GstD3D11PoolAllocator
* @memory: (transfer full): a #GstMemory * @memory: (out): a #GstMemory
* *
* Acquires a #GstMemory from @allocator. @memory should point to a memory * Acquires a #GstMemory from @allocator. @memory should point to a memory
* location that can hold a pointer to the new #GstMemory. * 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 * Returns: %TRUE if the size of memory pool is known
* *
* Since: 1.20 * Since: 1.22
*/ */
gboolean gboolean
gst_d3d11_pool_allocator_get_pool_size (GstD3D11PoolAllocator * allocator, gst_d3d11_pool_allocator_get_pool_size (GstD3D11PoolAllocator * allocator,

View file

@ -19,8 +19,7 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifndef __GST_D3D11_MEMORY_H__ #pragma once
#define __GST_D3D11_MEMORY_H__
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/video/video.h> #include <gst/video/video.h>
@ -54,7 +53,7 @@ G_BEGIN_DECLS
* *
* The name of the Direct3D11 memory * The name of the Direct3D11 memory
* *
* Since: 1.20 * Since: 1.22
*/ */
#define GST_D3D11_MEMORY_NAME "D3D11Memory" #define GST_D3D11_MEMORY_NAME "D3D11Memory"
@ -63,7 +62,7 @@ G_BEGIN_DECLS
* *
* Name of the caps feature for indicating the use of #GstD3D11Memory * 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" #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. * 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) #define GST_MAP_D3D11 (GST_MAP_FLAG_LAST << 1)
@ -84,7 +83,7 @@ G_BEGIN_DECLS
* is used for D3D11/DXVA decoders * is used for D3D11/DXVA decoders
* in general. * in general.
* *
* Since: 1.20 * Since: 1.22
*/ */
typedef enum typedef enum
{ {
@ -99,7 +98,7 @@ typedef enum
* @GST_D3D11_MEMORY_TRANSFER_NEED_UPLOAD: the staging texture needs uploading * @GST_D3D11_MEMORY_TRANSFER_NEED_UPLOAD: the staging texture needs uploading
* to the texture * to the texture
* *
* Since: 1.20 * Since: 1.22
*/ */
typedef enum typedef enum
{ {
@ -134,7 +133,7 @@ struct _GstD3D11AllocationParams
GstD3D11AllocationFlags flags; GstD3D11AllocationFlags flags;
/*< private >*/ /*< private >*/
gpointer _gst_reserved[GST_PADDING_LARGE]; gpointer _gst_reserved[GST_PADDING];
}; };
GST_D3D11_API GST_D3D11_API
@ -142,7 +141,7 @@ GType gst_d3d11_allocation_params_get_type (void);
GST_D3D11_API GST_D3D11_API
GstD3D11AllocationParams * gst_d3d11_allocation_params_new (GstD3D11Device * device, GstD3D11AllocationParams * gst_d3d11_allocation_params_new (GstD3D11Device * device,
GstVideoInfo * info, const GstVideoInfo * info,
GstD3D11AllocationFlags flags, GstD3D11AllocationFlags flags,
guint bind_flags, guint bind_flags,
guint misc_flags); guint misc_flags);
@ -155,7 +154,7 @@ void gst_d3d11_allocation_params_free (GstD3D11Allocat
GST_D3D11_API GST_D3D11_API
gboolean gst_d3d11_allocation_params_alignment (GstD3D11AllocationParams * parms, gboolean gst_d3d11_allocation_params_alignment (GstD3D11AllocationParams * parms,
GstVideoAlignment * align); const GstVideoAlignment * align);
struct _GstD3D11Memory struct _GstD3D11Memory
{ {
@ -303,4 +302,3 @@ gboolean gst_d3d11_pool_allocator_get_pool_size (GstD3D11PoolAllo
G_END_DECLS G_END_DECLS
#endif /* __GST_D3D11_MEMORY_H__ */

View file

@ -78,7 +78,7 @@ _init_context_debug (void)
* *
* Returns: whether the @device could be set successfully * Returns: whether the @device could be set successfully
* *
* Since: 1.20 * Since: 1.22
*/ */
gboolean gboolean
gst_d3d11_handle_set_context (GstElement * element, GstContext * context, 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 * Returns: whether the @device could be set successfully
* *
* Since: 1.20 * Since: 1.22
*/ */
gboolean gboolean
gst_d3d11_handle_set_context_for_adapter_luid (GstElement * element, 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 * Returns: Whether the @query was successfully responded to from the passed
* @device. * @device.
* *
* Since: 1.20 * Since: 1.22
*/ */
gboolean gboolean
gst_d3d11_handle_context_query (GstElement * element, GstQuery * query, 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 * Returns: whether a #GstD3D11Device exists in @device
* *
* Since: 1.20 * Since: 1.22
*/ */
gboolean gboolean
gst_d3d11_ensure_element_data (GstElement * element, gint adapter, 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 * Returns: whether a #GstD3D11Device exists in @device
* *
* Since: 1.20 * Since: 1.22
*/ */
gboolean gboolean
gst_d3d11_ensure_element_data_for_adapter_luid (GstElement * element, 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 * See also Int64FromLuid method defined in
* windows.devices.display.core.interop.h Windows SDK header * windows.devices.display.core.interop.h Windows SDK header
* *
* Since: 1.20 * Since: 1.22
*/ */
gint64 gint64
gst_d3d11_luid_to_int64 (const LUID * luid) gst_d3d11_luid_to_int64 (const LUID * luid)

View file

@ -17,8 +17,7 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifndef __GST_D3D11_UTILS_H__ #pragma once
#define __GST_D3D11_UTILS_H__
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/d3d11/gstd3d11_fwd.h> #include <gst/d3d11/gstd3d11_fwd.h>
@ -69,11 +68,10 @@ gboolean _gst_d3d11_result (HRESULT hr,
* *
* Returns: %TRUE if D3D11 API call result is SUCCESS * Returns: %TRUE if D3D11 API call result is SUCCESS
* *
* Since: 1.20 * Since: 1.22
*/ */
#define gst_d3d11_result(result,device) \ #define gst_d3d11_result(result,device) \
_gst_d3d11_result (result, device, GST_CAT_DEFAULT, __FILE__, GST_FUNCTION, __LINE__) _gst_d3d11_result (result, device, GST_CAT_DEFAULT, __FILE__, GST_FUNCTION, __LINE__)
G_END_DECLS G_END_DECLS
#endif /* __GST_D3D11_UTILS_H__ */

View file

@ -6,6 +6,26 @@ d3d11_sources = [
'gstd3d11utils.cpp', '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) gstd3d11_dep = dependency('', required : false)
if host_system != 'windows' if host_system != 'windows'
@ -135,13 +155,31 @@ if cc.get_id() != 'msvc'
endif endif
configure_file( 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, 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 <gst/d3d11/d3d11-prelude.h>',
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 pkg_name = 'gstreamer-d3d11-' + api_version
gstd3d11 = library('gstd3d11-' + 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, c_args : gst_plugins_bad_args + extra_c_args + extra_comm_args,
cpp_args : gst_plugins_bad_args + extra_comm_args, cpp_args : gst_plugins_bad_args + extra_comm_args,
include_directories : [configinc, libsinc], include_directories : [configinc, libsinc],
@ -151,10 +189,44 @@ gstd3d11 = library('gstd3d11-' + api_version,
dependencies : [gstbase_dep, gstvideo_dep, gmodule_dep, d3d11_lib, dxgi_lib] 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} 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]] 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, gstd3d11_dep = declare_dependency(link_with : gstd3d11,
include_directories : [libsinc], 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)