From 560faa38c5ff763cffb076a84adb988032dd0dcf Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Tue, 29 Aug 2023 23:06:42 +0900 Subject: [PATCH] d3d11: Update plugin docs Part-of: --- .../docs/plugins/gst_plugins_cache.json | 413 +++++++++++++++++- .../sys/d3d11/gstd3d11convert.cpp | 58 ++- .../sys/d3d11/gstd3d11ipcclient.cpp | 26 +- .../sys/d3d11/gstd3d11pluginutils.cpp | 40 ++ .../sys/d3d11/gstd3d11pluginutils.h | 11 + .../sys/d3d11/gstd3d11screencapturesrc.cpp | 4 +- .../sys/d3d11/gstd3d11testsrc.cpp | 11 +- 7 files changed, 537 insertions(+), 26 deletions(-) diff --git a/subprojects/gst-plugins-bad/docs/plugins/gst_plugins_cache.json b/subprojects/gst-plugins-bad/docs/plugins/gst_plugins_cache.json index 1700f59607..fc098eb447 100644 --- a/subprojects/gst-plugins-bad/docs/plugins/gst_plugins_cache.json +++ b/subprojects/gst-plugins-bad/docs/plugins/gst_plugins_cache.json @@ -7624,6 +7624,18 @@ } }, "properties": { + "dest-alpha-mode": { + "blurb": "Output alpha mode to be applied", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "unspecified (0)", + "mutable": "playing", + "readable": true, + "type": "GstD3D11AlphaMode", + "writable": true + }, "gamma-mode": { "blurb": "Gamma conversion mode", "conditionally-available": false, @@ -7647,6 +7659,18 @@ "readable": true, "type": "GstVideoPrimariesMode", "writable": true + }, + "src-alpha-mode": { + "blurb": "Applied input alpha mode", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "unspecified (0)", + "mutable": "playing", + "readable": true, + "type": "GstD3D11AlphaMode", + "writable": true } }, "rank": "none" @@ -7707,13 +7731,25 @@ "readable": true, "type": "GstD3D11CompositorBackground", "writable": true + }, + "ignore-inactive-pads": { + "blurb": "Avoid timing out waiting for inactive pads", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "false", + "mutable": "null", + "readable": true, + "type": "gboolean", + "writable": true } }, "rank": "secondary" }, "d3d11convert": { "author": "Seungha Yang , Jeongki Kim ", - "description": "Resizes video and allow color conversion using Direct3D11", + "description": "Performs resizing, colorspace conversion, cropping, and flipping/rotating using Direct3D11", "hierarchy": [ "GstD3D11Convert", "GstD3D11BaseConvert", @@ -7767,6 +7803,18 @@ "type": "guint64", "writable": true }, + "dest-alpha-mode": { + "blurb": "Output alpha mode to be applied", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "unspecified (0)", + "mutable": "playing", + "readable": true, + "type": "GstD3D11AlphaMode", + "writable": true + }, "gamma-mode": { "blurb": "Gamma conversion mode", "conditionally-available": false, @@ -7790,6 +7838,18 @@ "readable": true, "type": "GstVideoPrimariesMode", "writable": true + }, + "src-alpha-mode": { + "blurb": "Applied input alpha mode", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "unspecified (0)", + "mutable": "playing", + "readable": true, + "type": "GstD3D11AlphaMode", + "writable": true } }, "rank": "none" @@ -8166,6 +8226,144 @@ }, "rank": "primary + 1" }, + "d3d11ipcsink": { + "author": "Seungha Yang ", + "description": "Sends Direct3D11 shared handle to peer d3d11ipcsrc elements", + "hierarchy": [ + "GstD3D11IpcSink", + "GstBaseSink", + "GstElement", + "GstObject", + "GInitiallyUnowned", + "GObject" + ], + "klass": "Sink/Video", + "pad-templates": { + "sink": { + "caps": "video/x-raw(memory:D3D11Memory):\n format: { RGBA64_LE, RGB10A2_LE, BGRA, RGBA, BGRx, RGBx, VUYA, NV12, NV21, P010_10LE, P012_LE, P016_LE }\n width: [ 1, 16384 ]\n height: [ 1, 16384 ]\n framerate: [ 0/1, 2147483647/1 ]\nvideo/x-raw:\n format: { RGBA64_LE, RGB10A2_LE, BGRA, RGBA, BGRx, RGBx, VUYA, NV12, NV21, P010_10LE, P012_LE, P016_LE }\n width: [ 1, 16384 ]\n height: [ 1, 16384 ]\n framerate: [ 0/1, 2147483647/1 ]\n", + "direction": "sink", + "presence": "always" + } + }, + "properties": { + "adapter": { + "blurb": "DXGI adapter index (-1 for default)", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "-1", + "max": "2147483647", + "min": "-1", + "mutable": "ready", + "readable": true, + "type": "gint", + "writable": true + }, + "min-buffer-size": { + "blurb": "Minumum number of buffers", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "0", + "max": "-1", + "min": "0", + "mutable": "ready", + "readable": true, + "type": "guint", + "writable": true + }, + "pipe-name": { + "blurb": "The name of Win32 named pipe to communicate with clients. Validation of the pipe name is caller's responsibility", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "\\\\.\\pipe\\gst.d3d11.ipc", + "mutable": "ready", + "readable": true, + "type": "gchararray", + "writable": true + } + }, + "rank": "none" + }, + "d3d11ipcsrc": { + "author": "Seungha Yang ", + "description": "Receives Direct3D11 shared handle from the d3d11ipcsink element", + "hierarchy": [ + "GstD3D11IpcSrc", + "GstBaseSrc", + "GstElement", + "GstObject", + "GInitiallyUnowned", + "GObject" + ], + "klass": "Source/Video", + "pad-templates": { + "src": { + "caps": "video/x-raw(memory:D3D11Memory):\n format: { RGBA64_LE, RGB10A2_LE, BGRA, RGBA, BGRx, RGBx, VUYA, NV12, NV21, P010_10LE, P012_LE, P016_LE }\n width: [ 1, 16384 ]\n height: [ 1, 16384 ]\n framerate: [ 0/1, 2147483647/1 ]\n", + "direction": "src", + "presence": "always" + } + }, + "properties": { + "connection-timeout": { + "blurb": "Connection timeout in seconds (0 = never timeout)", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "5", + "max": "2147483647", + "min": "0", + "mutable": "ready", + "readable": true, + "type": "guint", + "writable": true + }, + "io-mode": { + "blurb": "Memory I/O mode to use", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "copy (0)", + "mutable": "ready", + "readable": true, + "type": "GstD3D11IpcIOMode", + "writable": true + }, + "pipe-name": { + "blurb": "The name of Win32 named pipe to communicate with clients. Validation of the pipe name is caller's responsibility", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "\\\\.\\pipe\\gst.d3d11.ipc", + "mutable": "ready", + "readable": true, + "type": "gchararray", + "writable": true + }, + "processing-deadline": { + "blurb": "Maximum processing time for a buffer in nanoseconds", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "20000000", + "max": "18446744073709551615", + "min": "0", + "mutable": "playing", + "readable": true, + "type": "guint64", + "writable": true + } + }, + "rank": "none" + }, "d3d11mpeg2dec": { "author": "Seungha Yang ", "description": "Direct3D11/DXVA based MPEG2 video decoder", @@ -8235,7 +8433,68 @@ "writable": false } }, - "rank": "secondary" + "rank": "primary + 1" + }, + "d3d11overlay": { + "author": "Seungha Yang ", + "description": "Provides application renderable Direct3D11 render target view", + "hierarchy": [ + "GstD3D11Overlay", + "GstD3D11BaseFilter", + "GstBaseTransform", + "GstElement", + "GstObject", + "GInitiallyUnowned", + "GObject" + ], + "klass": "Filter/Video", + "pad-templates": { + "sink": { + "caps": "video/x-raw(memory:D3D11Memory):\n format: { BGRA, RGBA }\n width: [ 1, 16384 ]\n height: [ 1, 16384 ]\n framerate: [ 0/1, 2147483647/1 ]\n", + "direction": "sink", + "presence": "always" + }, + "src": { + "caps": "video/x-raw(memory:D3D11Memory):\n format: { BGRA, RGBA }\n width: [ 1, 16384 ]\n height: [ 1, 16384 ]\n framerate: [ 0/1, 2147483647/1 ]\n", + "direction": "src", + "presence": "always" + } + }, + "rank": "none", + "signals": { + "caps-changed": { + "args": [ + { + "name": "arg0", + "type": "GstCaps" + } + ], + "return-type": "void", + "when": "last" + }, + "draw": { + "args": [ + { + "name": "arg0", + "type": "GstObject" + }, + { + "name": "arg1", + "type": "gpointer" + }, + { + "name": "arg2", + "type": "guint64" + }, + { + "name": "arg3", + "type": "guint64" + } + ], + "return-type": "gboolean", + "when": "last" + } + } }, "d3d11scale": { "author": "Seungha Yang ", @@ -8447,6 +8706,18 @@ "type": "gboolean", "writable": true }, + "window-capture-mode": { + "blurb": "Window capture mode to use if \"window-handle\" is set", + "conditionally-available": true, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "default (0)", + "mutable": "ready", + "readable": true, + "type": "GstD3D11WindowCaptureMode", + "writable": true + }, "window-handle": { "blurb": "A HWND handle of window to capture", "conditionally-available": true, @@ -8498,6 +8769,32 @@ "type": "gint", "writable": true }, + "alpha": { + "blurb": "Global alpha value to use", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "1", + "max": "1", + "min": "0", + "mutable": "ready", + "readable": true, + "type": "gfloat", + "writable": true + }, + "alpha-mode": { + "blurb": "alpha mode to use", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "unspecified (0)", + "mutable": "ready", + "readable": true, + "type": "GstD3D11AlphaMode", + "writable": true + }, "is-live": { "blurb": "Whether to act as a live source", "conditionally-available": false, @@ -8699,6 +8996,17 @@ "type": "GstVideoPrimariesMode", "writable": true }, + "render-rectangle": { + "blurb": "The render rectangle ('')", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "mutable": "null", + "readable": false, + "type": "GstValueArray", + "writable": true + }, "rotate-method": { "blurb": "Rotate method to use", "conditionally-available": false, @@ -8904,6 +9212,26 @@ "filename": "gstd3d11", "license": "LGPL", "other-types": { + "GstD3D11AlphaMode": { + "kind": "enum", + "values": [ + { + "desc": "Unspecified", + "name": "unspecified", + "value": "0" + }, + { + "desc": "Premultiplied", + "name": "premultiplied", + "value": "1" + }, + { + "desc": "Straight", + "name": "straight", + "value": "2" + } + ] + }, "GstD3D11BaseConvert": { "hierarchy": [ "GstD3D11BaseConvert", @@ -8914,7 +9242,21 @@ "GInitiallyUnowned", "GObject" ], - "kind": "object" + "kind": "object", + "properties": { + "method": { + "blurb": "Method used for sampling", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "bilinear (1)", + "mutable": "playing", + "readable": true, + "type": "GstD3D11SamplingMethod", + "writable": true + } + } }, "GstD3D11BaseFilter": { "hierarchy": [ @@ -9155,6 +9497,41 @@ } ] }, + "GstD3D11IpcIOMode": { + "kind": "enum", + "values": [ + { + "desc": "Copy remote texture", + "name": "copy", + "value": "0" + }, + { + "desc": "Import remote texture", + "name": "import", + "value": "1" + } + ] + }, + "GstD3D11SamplingMethod": { + "kind": "enum", + "values": [ + { + "desc": "Nearest Neighbour", + "name": "nearest-neighbour", + "value": "0" + }, + { + "desc": "Bilinear", + "name": "bilinear", + "value": "1" + }, + { + "desc": "Linear minification, point magnification", + "name": "linear-minification", + "value": "2" + } + ] + }, "GstD3D11ScreenCaptureAPI": { "kind": "enum", "values": [ @@ -9227,6 +9604,21 @@ "desc": "Checkers 8px", "name": "checkers-8", "value": "10" + }, + { + "desc": "Circular", + "name": "circular", + "value": "11" + }, + { + "desc": "Blink", + "name": "blink", + "value": "12" + }, + { + "desc": "Moving ball", + "name": "ball", + "value": "18" } ] }, @@ -9255,6 +9647,21 @@ } ] }, + "GstD3D11WindowCaptureMode": { + "kind": "enum", + "values": [ + { + "desc": "Capture entire window area", + "name": "default", + "value": "0" + }, + { + "desc": "Capture client area", + "name": "client", + "value": "1" + } + ] + }, "GstD3D11WindowFullscreenToggleMode": { "kind": "flags", "values": [ diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11convert.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11convert.cpp index be228e1761..7fe8b3201b 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11convert.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11convert.cpp @@ -48,6 +48,13 @@ static GstStaticCaps src_template_caps = GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION, GST_D3D11_SRC_FORMATS)); +/** + * GstD3D11SamplingMethod: + * + * Texture sampling method + * + * Since: 1.24 + */ typedef enum { GST_D3D11_SAMPLING_METHOD_NEAREST, @@ -56,10 +63,27 @@ typedef enum } GstD3D11SamplingMethod; static const GEnumValue gst_d3d11_sampling_methods[] = { + /** + * GstD3D11SamplingMethod::nearest-neighbour: + * + * Since: 1.24 + */ {GST_D3D11_SAMPLING_METHOD_NEAREST, "Nearest Neighbour", "nearest-neighbour"}, + + /** + * GstD3D11SamplingMethod::bilinear: + * + * Since: 1.24 + */ {GST_D3D11_SAMPLING_METHOD_BILINEAR, "Bilinear", "bilinear"}, + + /** + * GstD3D11SamplingMethod::linear-minification: + * + * Since: 1.24 + */ {GST_D3D11_SAMPLING_METHOD_LINEAR_MINIFICATION, "Linear minification, point magnification", "linear-minification"}, {0, nullptr, nullptr}, @@ -99,7 +123,7 @@ gst_d3d11_base_convert_sampling_method_to_filter (GstD3D11SamplingMethod method) #define DEFAULT_GAMMA_MODE GST_VIDEO_GAMMA_MODE_NONE #define DEFAULT_PRIMARIES_MODE GST_VIDEO_PRIMARIES_MODE_NONE #define DEFAULT_SAMPLING_METHOD GST_D3D11_SAMPLING_METHOD_BILINEAR -#define DEFAULT_ALPHA_MODE GST_D3D11_CONVERTER_ALPHA_MODE_UNSPECIFIED +#define DEFAULT_ALPHA_MODE GST_D3D11_ALPHA_MODE_UNSPECIFIED struct _GstD3D11BaseConvert { @@ -143,8 +167,8 @@ struct _GstD3D11BaseConvert /* method previously selected and used for negotiation */ GstVideoOrientationMethod active_method; - GstD3D11ConverterAlphaMode src_alpha_mode; - GstD3D11ConverterAlphaMode dst_alpha_mode; + GstD3D11AlphaMode src_alpha_mode; + GstD3D11AlphaMode dst_alpha_mode; SRWLOCK lock; }; @@ -386,6 +410,10 @@ gst_d3d11_base_convert_class_init (GstD3D11BaseConvertClass * klass) gst_type_mark_as_plugin_api (GST_TYPE_D3D11_BASE_CONVERT, (GstPluginAPIFlags) 0); + gst_type_mark_as_plugin_api (GST_TYPE_D3D11_SAMPLING_METHOD, + (GstPluginAPIFlags) 0); + gst_type_mark_as_plugin_api (GST_TYPE_D3D11_ALPHA_MODE, + (GstPluginAPIFlags) 0); } static void @@ -1930,8 +1958,8 @@ gst_d3d11_base_convert_need_convert (GstD3D11BaseConvert * self) if (!self->same_caps) return TRUE; - if (self->src_alpha_mode == GST_D3D11_CONVERTER_ALPHA_MODE_PREMULTIPLIED || - self->dst_alpha_mode == GST_D3D11_CONVERTER_ALPHA_MODE_PREMULTIPLIED) { + if (self->src_alpha_mode == GST_D3D11_ALPHA_MODE_PREMULTIPLIED || + self->dst_alpha_mode == GST_D3D11_ALPHA_MODE_PREMULTIPLIED) { return TRUE; } @@ -2213,7 +2241,7 @@ gst_d3d11_base_convert_set_sampling_method (GstD3D11BaseConvert * self, static void gst_d3d11_base_convert_set_src_alpha_mode (GstD3D11BaseConvert * self, - GstD3D11ConverterAlphaMode mode) + GstD3D11AlphaMode mode) { GstD3D11SRWLockGuard lk (&self->lock); @@ -2224,7 +2252,7 @@ gst_d3d11_base_convert_set_src_alpha_mode (GstD3D11BaseConvert * self, static void gst_d3d11_base_convert_set_dst_alpha_mode (GstD3D11BaseConvert * self, - GstD3D11ConverterAlphaMode mode) + GstD3D11AlphaMode mode) { GstD3D11SRWLockGuard lk (&self->lock); @@ -2375,7 +2403,7 @@ gst_d3d11_convert_class_init (GstD3D11ConvertClass * klass) g_object_class_install_property (gobject_class, PROP_CONVERT_SRC_ALPHA_MODE, g_param_spec_enum ("src-alpha-mode", "Src Alpha Mode", "Applied input alpha mode", - GST_TYPE_D3D11_CONVERTER_ALPHA_MODE, DEFAULT_ALPHA_MODE, + GST_TYPE_D3D11_ALPHA_MODE, DEFAULT_ALPHA_MODE, (GParamFlags) (GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); @@ -2390,7 +2418,7 @@ gst_d3d11_convert_class_init (GstD3D11ConvertClass * klass) g_object_class_install_property (gobject_class, PROP_CONVERT_DEST_ALPHA_MODE, g_param_spec_enum ("dest-alpha-mode", "Dest Alpha Mode", "Output alpha mode to be applied", - GST_TYPE_D3D11_CONVERTER_ALPHA_MODE, DEFAULT_ALPHA_MODE, + GST_TYPE_D3D11_ALPHA_MODE, DEFAULT_ALPHA_MODE, (GParamFlags) (GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); @@ -2437,11 +2465,11 @@ gst_d3d11_convert_set_property (GObject * object, guint prop_id, break; case PROP_CONVERT_SRC_ALPHA_MODE: gst_d3d11_base_convert_set_src_alpha_mode (base, - (GstD3D11ConverterAlphaMode) g_value_get_enum (value)); + (GstD3D11AlphaMode) g_value_get_enum (value)); break; case PROP_CONVERT_DEST_ALPHA_MODE: gst_d3d11_base_convert_set_dst_alpha_mode (base, - (GstD3D11ConverterAlphaMode) g_value_get_enum (value)); + (GstD3D11AlphaMode) g_value_get_enum (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -2599,7 +2627,7 @@ gst_d3d11_color_convert_class_init (GstD3D11ColorConvertClass * klass) PROP_COLOR_CONVERT_SRC_ALPHA_MODE, g_param_spec_enum ("src-alpha-mode", "Src Alpha Mode", "Applied input alpha mode", - GST_TYPE_D3D11_CONVERTER_ALPHA_MODE, DEFAULT_ALPHA_MODE, + GST_TYPE_D3D11_ALPHA_MODE, DEFAULT_ALPHA_MODE, (GParamFlags) (GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); @@ -2615,7 +2643,7 @@ gst_d3d11_color_convert_class_init (GstD3D11ColorConvertClass * klass) PROP_COLOR_CONVERT_DEST_ALPHA_MODE, g_param_spec_enum ("dest-alpha-mode", "Dest Alpha Mode", "Output alpha mode to be applied", - GST_TYPE_D3D11_CONVERTER_ALPHA_MODE, DEFAULT_ALPHA_MODE, + GST_TYPE_D3D11_ALPHA_MODE, DEFAULT_ALPHA_MODE, (GParamFlags) (GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); @@ -2653,11 +2681,11 @@ gst_d3d11_color_convert_set_property (GObject * object, guint prop_id, break; case PROP_COLOR_CONVERT_SRC_ALPHA_MODE: gst_d3d11_base_convert_set_src_alpha_mode (base, - (GstD3D11ConverterAlphaMode) g_value_get_enum (value)); + (GstD3D11AlphaMode) g_value_get_enum (value)); break; case PROP_COLOR_CONVERT_DEST_ALPHA_MODE: gst_d3d11_base_convert_set_dst_alpha_mode (base, - (GstD3D11ConverterAlphaMode) g_value_get_enum (value)); + (GstD3D11AlphaMode) g_value_get_enum (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11ipcclient.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11ipcclient.cpp index 4bb02e7081..abbf4467b9 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11ipcclient.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11ipcclient.cpp @@ -52,13 +52,35 @@ gst_d3d11_ipc_client_deinit (void) } } +/** + * GstD3D11IpcIOMode: + * + * Texture import mode + * + * Since: 1.24 + */ GType gst_d3d11_ipc_io_mode_get_type (void) { static GType type = 0; static const GEnumValue io_modes[] = { - {GST_D3D11_IPC_IO_COPY, "Copy remote memory", "copy"}, - {GST_D3D11_IPC_IO_IMPORT, "Import remote memory", "import"}, + /** + * GstD3D11IpcIOMode::copy: + * + * Copy remote texture to newly allocated texture + * + * Since: 1.24 + */ + {GST_D3D11_IPC_IO_COPY, "Copy remote texture", "copy"}, + + /** + * GstD3D11IpcIOMode::import: + * + * Import remote texture to without any allocation/copy + * + * Since: 1.24 + */ + {GST_D3D11_IPC_IO_IMPORT, "Import remote texture", "import"}, {0, nullptr, nullptr} }; diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11pluginutils.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11pluginutils.cpp index c262e7e492..3d111d2df4 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11pluginutils.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11pluginutils.cpp @@ -30,6 +30,46 @@ GST_DEBUG_CATEGORY_EXTERN (gst_d3d11_plugin_utils_debug); #define GST_CAT_DEFAULT gst_d3d11_plugin_utils_debug +/** + * GstD3D11AlphaMode: + * + * Since: 1.24 + */ +GType +gst_d3d11_alpha_mode_get_type (void) +{ + static GType type = 0; + static const GEnumValue alpha_mode[] = { + /** + * GstD3D11AlphaMode::unspecified: + * + * Since: 1.24 + */ + {GST_D3D11_ALPHA_MODE_UNSPECIFIED, "Unspecified", "unspecified"}, + + /** + * GstD3D11AlphaMode::premultiplied: + * + * Since: 1.24 + */ + {GST_D3D11_ALPHA_MODE_PREMULTIPLIED, "Premultiplied", "premultiplied"}, + + /** + * GstD3D11AlphaMode::straight: + * + * Since: 1.24 + */ + {GST_D3D11_ALPHA_MODE_STRAIGHT, "Straight", "straight"}, + {0, nullptr, nullptr}, + }; + + GST_D3D11_CALL_ONCE_BEGIN { + type = g_enum_register_static ("GstD3D11AlphaMode", alpha_mode); + } GST_D3D11_CALL_ONCE_END; + + return type; +} + /* Max Texture Dimension for feature level 11_0 ~ 12_1 */ static guint _gst_d3d11_texture_max_dimension = 16384; diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11pluginutils.h b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11pluginutils.h index 30aa6313d6..fb09e9eb17 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11pluginutils.h +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11pluginutils.h @@ -38,6 +38,17 @@ typedef enum GST_D3D11_DEVICE_VENDOR_XBOX, } GstD3D11DeviceVendor; + +typedef enum +{ + GST_D3D11_ALPHA_MODE_UNSPECIFIED = 0, + GST_D3D11_ALPHA_MODE_PREMULTIPLIED, + GST_D3D11_ALPHA_MODE_STRAIGHT, +} GstD3D11AlphaMode; + +#define GST_TYPE_D3D11_ALPHA_MODE (gst_d3d11_alpha_mode_get_type()) +GType gst_d3d11_alpha_mode_get_type (void); + void gst_d3d11_plugin_utils_init (D3D_FEATURE_LEVEL feature_level); GstCaps * gst_d3d11_get_updated_template_caps (GstStaticCaps * template_caps); diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11screencapturesrc.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11screencapturesrc.cpp index 7b5b1e32e9..077d59b4ea 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11screencapturesrc.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11screencapturesrc.cpp @@ -390,7 +390,9 @@ gst_d3d11_screen_capture_src_class_init (GstD3D11ScreenCaptureSrcClass * klass) GST_PARAM_CONDITIONALLY_AVAILABLE | G_PARAM_STATIC_STRINGS))); /** - * GstD3D11ScreenCaptureSrc:hwnd-capture-mode: + * GstD3D11ScreenCaptureSrc:window-capture-mode: + * + * Window capture mode to use * * Since: 1.24 */ diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11testsrc.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11testsrc.cpp index 57251b6013..706f017543 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11testsrc.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11testsrc.cpp @@ -231,7 +231,7 @@ struct _GstD3D11TestSrc ID2D1Factory *d2d_factory; gint64 token; gfloat alpha; - GstD3D11ConverterAlphaMode alpha_mode; + GstD3D11AlphaMode alpha_mode; gboolean reverse; gint64 n_frames; @@ -1105,7 +1105,7 @@ enum #define DEFAULT_ADAPTER -1 #define DEFAULT_PATTERN GST_D3D11_TEST_SRC_SMPTE #define DEFAULT_ALPHA 1.0f -#define DEFAULT_ALPHA_MODE GST_D3D11_CONVERTER_ALPHA_MODE_UNSPECIFIED +#define DEFAULT_ALPHA_MODE GST_D3D11_ALPHA_MODE_UNSPECIFIED static void gst_d3d11_test_src_dispose (GObject * object); static void gst_d3d11_test_src_set_property (GObject * object, @@ -1186,8 +1186,7 @@ gst_d3d11_test_src_class_init (GstD3D11TestSrcClass * klass) */ g_object_class_install_property (gobject_class, PROP_ALPHA_MODE, g_param_spec_enum ("alpha-mode", "Alpha Mode", - "alpha mode to use", GST_TYPE_D3D11_CONVERTER_ALPHA_MODE, - GST_D3D11_CONVERTER_ALPHA_MODE_UNSPECIFIED, + "alpha mode to use", GST_TYPE_D3D11_ALPHA_MODE, DEFAULT_ALPHA_MODE, (GParamFlags) (G_PARAM_READWRITE | GST_PARAM_MUTABLE_READY | G_PARAM_STATIC_STRINGS))); @@ -1221,6 +1220,8 @@ gst_d3d11_test_src_class_init (GstD3D11TestSrcClass * klass) gst_type_mark_as_plugin_api (GST_TYPE_D3D11_TEST_SRC_PATTERN, (GstPluginAPIFlags) 0); + gst_type_mark_as_plugin_api (GST_TYPE_D3D11_ALPHA_MODE, + (GstPluginAPIFlags) 0); } static void @@ -1264,7 +1265,7 @@ gst_d3d11_test_src_set_property (GObject * object, guint prop_id, self->alpha = g_value_get_float (value); break; case PROP_ALPHA_MODE: - self->alpha_mode = (GstD3D11ConverterAlphaMode) g_value_get_enum (value); + self->alpha_mode = (GstD3D11AlphaMode) g_value_get_enum (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);