* Boston, MA 02110-1301, USA.
*/
-#ifndef __GST_D3D11_PRELUDE_H__
-#define __GST_D3D11_PRELUDE_H__
+#pragma once
#include <gst/gst.h>
# endif
#endif
-#endif /* __GST_D3D11_PRELUDE_H__ */
* 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.")
#include <gst/gst.h>
#include <gst/d3d11/gstd3d11config.h>
#include <gst/d3d11/gstd3d11_fwd.h>
+#include <gst/d3d11/gstd3d11-enumtypes.h>
#include <gst/d3d11/gstd3d11device.h>
#include <gst/d3d11/gstd3d11memory.h>
#include <gst/d3d11/gstd3d11bufferpool.h>
#include <gst/d3d11/gstd3d11utils.h>
#include <gst/d3d11/gstd3d11format.h>
-#endif /* __GST_D3D11_H__ */
* Boston, MA 02110-1301, USA.
*/
-#ifndef __GST_D3D11_FWD_H__
-#define __GST_D3D11_FWD_H__
+#pragma once
#include <gst/gst.h>
#include <gst/d3d11/gstd3d11config.h>
G_END_DECLS
-#endif /* __GST_D3D11_FWD_H__ */
* Boston, MA 02110-1301, USA.
*/
-#ifndef __GST_D3D11_PRIVATE_H__
-#define __GST_D3D11_PRIVATE_H__
+#pragma once
#include <gst/gst.h>
#include <gst/video/video.h>
G_END_DECLS
-#endif /* __GST_D3D11_PRIVATE_H__ */
*
* Returns: a #GstBufferPool that allocates buffers with #GstD3D11Memory
*
- * Since: 1.20
+ * Since: 1.22
*/
GstBufferPool *
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)
*
* Sets @params on @config
*
- * Since: 1.20
+ * Since: 1.22
*/
void
gst_buffer_pool_config_set_d3d11_allocation_params (GstStructure * config,
* Boston, MA 02110-1301, USA.
*/
-#ifndef __GST_D3D11_BUFFER_POOL_H__
-#define __GST_D3D11_BUFFER_POOL_H__
+#pragma once
#include <gst/gst.h>
#include <gst/video/video.h>
G_END_DECLS
-#endif /* __GST_D3D11_BUFFER_POOL_H__ */
-/* gstd3d11config.h */
-
-#ifndef __GST_D3D11_CONFIG_H__
-#define __GST_D3D11_CONFIG_H__
+#pragma once
#include <gst/gst.h>
#mesondefine GST_D3D11_WINAPI_APP
G_END_DECLS
-
-#endif /* __GST_D3D11_CONFIG_H__ */
* 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)
* 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)
* 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)
*
* Returns: (transfer none): the ID3D11Device handle
*
- * Since: 1.20
+ * Since: 1.22
*/
ID3D11Device *
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)
*
* Returns: (transfer none): the IDXGIFactory1 handle
*
- * Since: 1.20
+ * Since: 1.22
*/
IDXGIFactory1 *
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)
* 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)
* 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)
* 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)
* Boston, MA 02110-1301, USA.
*/
-#ifndef __GST_D3D11_DEVICE_H__
-#define __GST_D3D11_DEVICE_H__
+#pragma once
#include <gst/gst.h>
#include <gst/video/video.h>
G_END_DECLS
-#endif /* __GST_D3D11_DEVICE_H__ */
*
* 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,
*
* Returns: a #GstVideoFormat equivalent to @format
*
- * Since: 1.20
+ * Since: 1.22
*/
GstVideoFormat
gst_d3d11_dxgi_format_to_gst (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)
{
* Boston, MA 02110-1301, USA.
*/
-#ifndef __GST_D3D11_FORMAT_H__
-#define __GST_D3D11_FORMAT_H__
+#pragma once
#include <gst/gst.h>
#include <gst/video/video.h>
G_END_DECLS
-#endif /* __GST_D3D11_FORMAT_H__ */
*
* 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;
*
* 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;
*
* Returns: a copy of @src
*
- * Since: 1.20
+ * Since: 1.22
*/
GstD3D11AllocationParams *
gst_d3d11_allocation_params_copy (GstD3D11AllocationParams * src)
*
* Free @params
*
- * Since: 1.20
+ * Since: 1.22
*/
void
gst_d3d11_allocation_params_free (GstD3D11AllocationParams * params)
*
* Returns: whether @mem is a #GstD3D11Memory
*
- * Since: 1.20
+ * Since: 1.22
*/
gboolean
gst_is_d3d11_memory (GstMemory * 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)
*
* Returns: subresource index corresponding to @mem.
*
- * Since: 1.20
+ * Since: 1.22
*/
guint
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,
* 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)
* 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)
* 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)
* 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)
* ID3D11VideoDecoderOutputView or %NULL if ID3D11VideoDecoderOutputView is
* unavailable
*
- * Since: 1.20
+ * Since: 1.22
*/
ID3D11VideoDecoderOutputView *
gst_d3d11_memory_get_decoder_output_view (GstD3D11Memory * mem,
* ID3D11VideoProcessorInputView or %NULL if ID3D11VideoProcessorInputView is
* unavailable
*
- * Since: 1.20
+ * Since: 1.22
*/
ID3D11VideoProcessorInputView *
gst_d3d11_memory_get_processor_input_view (GstD3D11Memory * mem,
* ID3D11VideoProcessorOutputView or %NULL if ID3D11VideoProcessorOutputView is
* unavailable
*
- * Since: 1.20
+ * Since: 1.22
*/
ID3D11VideoProcessorOutputView *
gst_d3d11_memory_get_processor_output_view (GstD3D11Memory * mem,
*
* Returns: a newly allocated #GstD3D11Memory with given parameters.
*
- * Since: 1.20
+ * Since: 1.22
*/
GstMemory *
gst_d3d11_allocator_alloc (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)
{
* Creates a new #GstD3D11PoolAllocator instance.
*
* Returns: (transfer full): a new #GstD3D11PoolAllocator instance
+ *
+ * Since: 1.22
*/
GstD3D11PoolAllocator *
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.
*
* 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,
* Boston, MA 02110-1301, USA.
*/
-#ifndef __GST_D3D11_MEMORY_H__
-#define __GST_D3D11_MEMORY_H__
+#pragma once
#include <gst/gst.h>
#include <gst/video/video.h>
*
* The name of the Direct3D11 memory
*
- * Since: 1.20
+ * Since: 1.22
*/
#define GST_D3D11_MEMORY_NAME "D3D11Memory"
*
* 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"
*
* 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)
* is used for D3D11/DXVA decoders
* in general.
*
- * Since: 1.20
+ * Since: 1.22
*/
typedef enum
{
* @GST_D3D11_MEMORY_TRANSFER_NEED_UPLOAD: the staging texture needs uploading
* to the texture
*
- * Since: 1.20
+ * Since: 1.22
*/
typedef enum
{
GstD3D11AllocationFlags flags;
/*< private >*/
- gpointer _gst_reserved[GST_PADDING_LARGE];
+ gpointer _gst_reserved[GST_PADDING];
};
GST_D3D11_API
GST_D3D11_API
GstD3D11AllocationParams * gst_d3d11_allocation_params_new (GstD3D11Device * device,
- GstVideoInfo * info,
+ const GstVideoInfo * info,
GstD3D11AllocationFlags flags,
guint bind_flags,
guint misc_flags);
GST_D3D11_API
gboolean gst_d3d11_allocation_params_alignment (GstD3D11AllocationParams * parms,
- GstVideoAlignment * align);
+ const GstVideoAlignment * align);
struct _GstD3D11Memory
{
G_END_DECLS
-#endif /* __GST_D3D11_MEMORY_H__ */
*
* Returns: whether the @device could be set successfully
*
- * Since: 1.20
+ * Since: 1.22
*/
gboolean
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,
* 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,
*
* Returns: whether a #GstD3D11Device exists in @device
*
- * Since: 1.20
+ * Since: 1.22
*/
gboolean
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,
* 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)
* Boston, MA 02110-1301, USA.
*/
-#ifndef __GST_D3D11_UTILS_H__
-#define __GST_D3D11_UTILS_H__
+#pragma once
#include <gst/gst.h>
#include <gst/d3d11/gstd3d11_fwd.h>
*
* 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__ */
'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'
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 <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
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],
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)