d3d11videosink: Add sampling-method property

Identical to "method" property in d3d11convert element

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5572>
This commit is contained in:
Seungha Yang 2023-10-28 23:12:30 +09:00
parent b16665dc75
commit e7069984df
2 changed files with 38 additions and 1 deletions

View file

@ -10471,6 +10471,18 @@
"type": "gfloat", "type": "gfloat",
"writable": true "writable": true
}, },
"sampling-method": {
"blurb": "Sampler filter type to use",
"conditionally-available": false,
"construct": false,
"construct-only": false,
"controllable": false,
"default": "bilinear (1)",
"mutable": "ready",
"readable": true,
"type": "GstD3D11SamplingMethod",
"writable": true
},
"scale-x": { "scale-x": {
"blurb": "Scale multiplier for x-axis", "blurb": "Scale multiplier for x-axis",
"conditionally-available": false, "conditionally-available": false,

View file

@ -73,6 +73,7 @@ enum
PROP_SCALE_X, PROP_SCALE_X,
PROP_SCALE_Y, PROP_SCALE_Y,
PROP_MSAA, PROP_MSAA,
PROP_SAMPLING_METHOD,
PROP_RENDER_RECTANGE, PROP_RENDER_RECTANGE,
}; };
@ -91,6 +92,7 @@ enum
#define DEFAULT_FOV 90.0f #define DEFAULT_FOV 90.0f
#define DEFAULT_ORTHO FALSE #define DEFAULT_ORTHO FALSE
#define DEFAULT_MSAA GST_D3D11_MSAA_DISABLED #define DEFAULT_MSAA GST_D3D11_MSAA_DISABLED
#define DEFAULT_SAMPLING_METHOD GST_D3D11_SAMPLING_METHOD_BILINEAR
/** /**
* GstD3D11VideoSinkDisplayFormat: * GstD3D11VideoSinkDisplayFormat:
@ -209,6 +211,7 @@ struct _GstD3D11VideoSink
gfloat scale_x; gfloat scale_x;
gfloat scale_y; gfloat scale_y;
GstD3D11MSAAMode msaa; GstD3D11MSAAMode msaa;
GstD3D11SamplingMethod sampling_method;
/* saved render rectangle until we have a window */ /* saved render rectangle until we have a window */
GstVideoRectangle render_rect; GstVideoRectangle render_rect;
@ -523,6 +526,18 @@ gst_d3d11_video_sink_class_init (GstD3D11VideoSinkClass * klass)
GST_TYPE_D3D11_MSAA_MODE, DEFAULT_MSAA, GST_TYPE_D3D11_MSAA_MODE, DEFAULT_MSAA,
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
/**
* GstD3D11VideoSink:sampling-method:
*
* Sampling method
*
* Since: 1.24
*/
g_object_class_install_property (gobject_class, PROP_SAMPLING_METHOD,
g_param_spec_enum ("sampling-method", "Sampling method",
"Sampler filter type to use", GST_TYPE_D3D11_SAMPLING_METHOD,
DEFAULT_SAMPLING_METHOD, (GParamFlags) (GST_PARAM_MUTABLE_READY |
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
/** /**
* GstD3D11VideoSink:render-rectangle: * GstD3D11VideoSink:render-rectangle:
@ -652,6 +667,7 @@ gst_d3d11_video_sink_init (GstD3D11VideoSink * self)
self->scale_x = DEFAULT_SCALE; self->scale_x = DEFAULT_SCALE;
self->scale_y = DEFAULT_SCALE; self->scale_y = DEFAULT_SCALE;
self->msaa = DEFAULT_MSAA; self->msaa = DEFAULT_MSAA;
self->sampling_method = DEFAULT_SAMPLING_METHOD;
InitializeCriticalSection (&self->lock); InitializeCriticalSection (&self->lock);
} }
@ -746,6 +762,9 @@ gst_d3d11_videosink_set_property (GObject * object, guint prop_id,
if (self->window) if (self->window)
gst_d3d11_window_set_msaa_mode (self->window, self->msaa); gst_d3d11_window_set_msaa_mode (self->window, self->msaa);
break; break;
case PROP_SAMPLING_METHOD:
self->sampling_method = (GstD3D11SamplingMethod) g_value_get_enum (value);
break;
case PROP_RENDER_RECTANGE: case PROP_RENDER_RECTANGE:
gst_video_overlay_set_property (object, PROP_RENDER_RECTANGE, gst_video_overlay_set_property (object, PROP_RENDER_RECTANGE,
PROP_RENDER_RECTANGE, value); PROP_RENDER_RECTANGE, value);
@ -825,6 +844,9 @@ gst_d3d11_videosink_get_property (GObject * object, guint prop_id,
case PROP_MSAA: case PROP_MSAA:
g_value_set_enum (value, self->msaa); g_value_set_enum (value, self->msaa);
break; break;
case PROP_SAMPLING_METHOD:
g_value_set_enum (value, self->sampling_method);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -1024,7 +1046,10 @@ gst_d3d11_video_sink_update_window (GstD3D11VideoSink * self, GstCaps * caps)
GST_D3D11_CONVERTER_OPT_GAMMA_MODE, GST_D3D11_CONVERTER_OPT_GAMMA_MODE,
GST_TYPE_VIDEO_GAMMA_MODE, self->gamma_mode, GST_TYPE_VIDEO_GAMMA_MODE, self->gamma_mode,
GST_D3D11_CONVERTER_OPT_PRIMARIES_MODE, GST_D3D11_CONVERTER_OPT_PRIMARIES_MODE,
GST_TYPE_VIDEO_PRIMARIES_MODE, self->primaries_mode, nullptr); GST_TYPE_VIDEO_PRIMARIES_MODE, self->primaries_mode,
GST_D3D11_CONVERTER_OPT_SAMPLER_FILTER,
GST_TYPE_D3D11_CONVERTER_SAMPLER_FILTER,
gst_d3d11_sampling_method_to_native (self->sampling_method), nullptr);
window = (GstD3D11Window *) gst_object_ref (self->window); window = (GstD3D11Window *) gst_object_ref (self->window);
LeaveCriticalSection (&self->lock); LeaveCriticalSection (&self->lock);