mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
d3d11: Define enum and flags types manually
gnome.mkenums_simple() doesn't work well for GstD3D11, seems to be confused by numeric representation of D3D11, must be a bug in GLib or so. Just don't rely on the incomplete automagic. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2767>
This commit is contained in:
parent
879eb9412b
commit
32eeadb4a5
4 changed files with 75 additions and 17 deletions
|
@ -27,7 +27,6 @@
|
||||||
#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/gstd3d11bufferpool.h>
|
#include <gst/d3d11/gstd3d11bufferpool.h>
|
||||||
#include <gst/d3d11/gstd3d11compile.h>
|
#include <gst/d3d11/gstd3d11compile.h>
|
||||||
#include <gst/d3d11/gstd3d11device.h>
|
#include <gst/d3d11/gstd3d11device.h>
|
||||||
|
|
|
@ -33,6 +33,68 @@ GST_DEBUG_CATEGORY_STATIC (gst_d3d11_allocator_debug);
|
||||||
|
|
||||||
static GstAllocator *_d3d11_memory_allocator;
|
static GstAllocator *_d3d11_memory_allocator;
|
||||||
|
|
||||||
|
GType
|
||||||
|
gst_d3d11_allocation_flags_get_type (void)
|
||||||
|
{
|
||||||
|
static gsize type = 0;
|
||||||
|
static const GFlagsValue values[] = {
|
||||||
|
{GST_D3D11_ALLOCATION_FLAG_DEFAULT, "GST_D3D11_ALLOCATION_FLAG_DEFAULT",
|
||||||
|
"default"},
|
||||||
|
{GST_D3D11_ALLOCATION_FLAG_TEXTURE_ARRAY,
|
||||||
|
"GST_D3D11_ALLOCATION_FLAG_TEXTURE_ARRAY", "texture-array"},
|
||||||
|
{0, nullptr, nullptr}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (g_once_init_enter (&type)) {
|
||||||
|
GType tmp = g_flags_register_static ("GstD3D11AllocationFlags", values);
|
||||||
|
g_once_init_leave (&type, tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (GType) type;
|
||||||
|
}
|
||||||
|
|
||||||
|
GType
|
||||||
|
gst_d3d11_memory_transfer_get_type (void)
|
||||||
|
{
|
||||||
|
static gsize type = 0;
|
||||||
|
static const GFlagsValue values[] = {
|
||||||
|
{GST_D3D11_MEMORY_TRANSFER_NEED_DOWNLOAD,
|
||||||
|
"GST_D3D11_MEMORY_TRANSFER_NEED_DOWNLOAD", "need-download"},
|
||||||
|
{GST_D3D11_MEMORY_TRANSFER_NEED_UPLOAD,
|
||||||
|
"GST_D3D11_MEMORY_TRANSFER_NEED_UPLOAD", "need-upload"},
|
||||||
|
{0, nullptr, nullptr}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (g_once_init_enter (&type)) {
|
||||||
|
GType tmp = g_flags_register_static ("GstD3D11MemoryTransfer", values);
|
||||||
|
g_once_init_leave (&type, tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (GType) type;
|
||||||
|
}
|
||||||
|
|
||||||
|
GType
|
||||||
|
gst_d3d11_memory_native_type_get_type (void)
|
||||||
|
{
|
||||||
|
static gsize type = 0;
|
||||||
|
static const GEnumValue values[] = {
|
||||||
|
{GST_D3D11_MEMORY_NATIVE_TYPE_INVALID,
|
||||||
|
"GST_D3D11_MEMORY_NATIVE_TYPE_INVALID", "invalid"},
|
||||||
|
{GST_D3D11_MEMORY_NATIVE_TYPE_BUFFER, "GST_D3D11_MEMORY_NATIVE_TYPE_BUFFER",
|
||||||
|
"buffer"},
|
||||||
|
{GST_D3D11_MEMORY_NATIVE_TYPE_TEXTURE_2D,
|
||||||
|
"GST_D3D11_MEMORY_NATIVE_TYPE_TEXTURE_2D", "texture-2d"},
|
||||||
|
{0, nullptr, nullptr}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (g_once_init_enter (&type)) {
|
||||||
|
GType tmp = g_enum_register_static ("GstD3D11MemoryNativeType", values);
|
||||||
|
g_once_init_leave (&type, tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (GType) type;
|
||||||
|
}
|
||||||
|
|
||||||
/* GstD3D11AllocationParams */
|
/* GstD3D11AllocationParams */
|
||||||
static void gst_d3d11_allocation_params_init (GType type);
|
static void gst_d3d11_allocation_params_init (GType type);
|
||||||
G_DEFINE_BOXED_TYPE_WITH_CODE (GstD3D11AllocationParams,
|
G_DEFINE_BOXED_TYPE_WITH_CODE (GstD3D11AllocationParams,
|
||||||
|
|
|
@ -91,6 +91,10 @@ typedef enum
|
||||||
GST_D3D11_ALLOCATION_FLAG_TEXTURE_ARRAY = (1 << 0),
|
GST_D3D11_ALLOCATION_FLAG_TEXTURE_ARRAY = (1 << 0),
|
||||||
} GstD3D11AllocationFlags;
|
} GstD3D11AllocationFlags;
|
||||||
|
|
||||||
|
GST_D3D11_API
|
||||||
|
GType gst_d3d11_allocation_flags_get_type (void);
|
||||||
|
#define GST_TYPE_D3D11_ALLOCATION_FLAGS (gst_d3d11_allocation_flags_get_type())
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstD3D11MemoryTransfer:
|
* GstD3D11MemoryTransfer:
|
||||||
* @GST_D3D11_MEMORY_TRANSFER_NEED_DOWNLOAD: the texture needs downloading
|
* @GST_D3D11_MEMORY_TRANSFER_NEED_DOWNLOAD: the texture needs downloading
|
||||||
|
@ -106,6 +110,10 @@ typedef enum
|
||||||
GST_D3D11_MEMORY_TRANSFER_NEED_UPLOAD = (GST_MEMORY_FLAG_LAST << 1)
|
GST_D3D11_MEMORY_TRANSFER_NEED_UPLOAD = (GST_MEMORY_FLAG_LAST << 1)
|
||||||
} GstD3D11MemoryTransfer;
|
} GstD3D11MemoryTransfer;
|
||||||
|
|
||||||
|
GST_D3D11_API
|
||||||
|
GType gst_d3d11_memory_transfer_get_type (void);
|
||||||
|
#define GST_TYPE_D3D11_MEMORY_TRANSFER (gst_d3d11_memory_transfer_get_type())
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstD3D11MemoryNativeType:
|
* GstD3D11MemoryNativeType:
|
||||||
* @GST_D3D11_MEMORY_NATIVE_TYPE_INVALID: not a valid object type
|
* @GST_D3D11_MEMORY_NATIVE_TYPE_INVALID: not a valid object type
|
||||||
|
@ -121,6 +129,10 @@ typedef enum
|
||||||
GST_D3D11_MEMORY_NATIVE_TYPE_TEXTURE_2D,
|
GST_D3D11_MEMORY_NATIVE_TYPE_TEXTURE_2D,
|
||||||
} GstD3D11MemoryNativeType;
|
} GstD3D11MemoryNativeType;
|
||||||
|
|
||||||
|
GST_D3D11_API
|
||||||
|
GType gst_d3d11_memory_native_type_get_type (void);
|
||||||
|
#define GST_TYPE_D3D11_MEMORY_NATIVE_TYPE (gst_d3d11_memory_native_type_get_type())
|
||||||
|
|
||||||
struct _GstD3D11AllocationParams
|
struct _GstD3D11AllocationParams
|
||||||
{
|
{
|
||||||
/* Texture description per plane */
|
/* Texture description per plane */
|
||||||
|
|
|
@ -180,24 +180,9 @@ configure_file(
|
||||||
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_enums,
|
d3d11_sources,
|
||||||
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],
|
||||||
|
|
Loading…
Reference in a new issue