From: Seungha Yang Date: Wed, 20 Jul 2022 20:40:45 +0000 (+0900) Subject: d3d11: Define enum and flags types manually X-Git-Tag: 1.22.0~1250 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=32eeadb4a55744261983e98c1549c03a2536fe0c;p=platform%2Fupstream%2Fgstreamer.git 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: --- 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 decbfe7..fe85170 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11.h @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include 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 684d452..13a84d2 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11memory.cpp +++ b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11memory.cpp @@ -33,6 +33,68 @@ GST_DEBUG_CATEGORY_STATIC (gst_d3d11_allocator_debug); 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 */ static void gst_d3d11_allocation_params_init (GType type); G_DEFINE_BOXED_TYPE_WITH_CODE (GstD3D11AllocationParams, 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 dca39a5..2e0ce6f 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11memory.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11memory.h @@ -91,6 +91,10 @@ typedef enum GST_D3D11_ALLOCATION_FLAG_TEXTURE_ARRAY = (1 << 0), } 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: * @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) } 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: * @GST_D3D11_MEMORY_NATIVE_TYPE_INVALID: not a valid object type @@ -121,6 +129,10 @@ typedef enum GST_D3D11_MEMORY_NATIVE_TYPE_TEXTURE_2D, } 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 { /* Texture description per plane */ 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 97abce2..abb3c83 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/meson.build +++ b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/meson.build @@ -180,24 +180,9 @@ configure_file( 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_enums, + d3d11_sources, 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],