mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 13:11:06 +00:00
d3d11convert: Add support for YUY2 and Y410 output
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5691>
This commit is contained in:
parent
2afa0fe7d0
commit
ca14eeeeaa
2 changed files with 22 additions and 11 deletions
|
@ -32,21 +32,18 @@ G_BEGIN_DECLS
|
||||||
#define GST_D3D11_COMMON_FORMATS \
|
#define GST_D3D11_COMMON_FORMATS \
|
||||||
"RGBA64_LE, RGB10A2_LE, BGRA, RGBA, BGRx, RGBx, VUYA, NV12, NV21, " \
|
"RGBA64_LE, RGB10A2_LE, BGRA, RGBA, BGRx, RGBx, VUYA, NV12, NV21, " \
|
||||||
"P010_10LE, P012_LE, P016_LE, I420, YV12, I420_10LE, I420_12LE, " \
|
"P010_10LE, P012_LE, P016_LE, I420, YV12, I420_10LE, I420_12LE, " \
|
||||||
"Y42B, I422_10LE, I422_12LE, Y444, Y444_10LE, Y444_12LE, Y444_16LE, " \
|
"Y42B, I422_10LE, I422_12LE, Y444, Y444_10LE, Y444_12LE, Y444_16LE, YUY2, Y410, " \
|
||||||
"GRAY8, GRAY16_LE, AYUV, AYUV64, RGBP, BGRP, GBR, GBR_10LE, GBR_12LE, " \
|
"GRAY8, GRAY16_LE, AYUV, AYUV64, RGBP, BGRP, GBR, GBR_10LE, GBR_12LE, " \
|
||||||
"GBR_16LE, GBRA, GBRA_10LE, GBRA_12LE"
|
"GBR_16LE, GBRA, GBRA_10LE, GBRA_12LE"
|
||||||
|
|
||||||
#define GST_D3D11_EXTRA_IN_FORMATS \
|
|
||||||
"Y410, YUY2"
|
|
||||||
|
|
||||||
#define GST_D3D11_SINK_FORMATS \
|
#define GST_D3D11_SINK_FORMATS \
|
||||||
"{ " GST_D3D11_COMMON_FORMATS " ," GST_D3D11_EXTRA_IN_FORMATS " }"
|
"{ " GST_D3D11_COMMON_FORMATS " }"
|
||||||
|
|
||||||
#define GST_D3D11_SRC_FORMATS \
|
#define GST_D3D11_SRC_FORMATS \
|
||||||
"{ " GST_D3D11_COMMON_FORMATS " }"
|
"{ " GST_D3D11_COMMON_FORMATS " }"
|
||||||
|
|
||||||
#define GST_D3D11_ALL_FORMATS \
|
#define GST_D3D11_ALL_FORMATS \
|
||||||
"{ " GST_D3D11_COMMON_FORMATS " ," GST_D3D11_EXTRA_IN_FORMATS " }"
|
"{ " GST_D3D11_COMMON_FORMATS " }"
|
||||||
|
|
||||||
#define GST_TYPE_D3D11_FORMAT_SUPPORT (gst_d3d11_format_support_get_type())
|
#define GST_TYPE_D3D11_FORMAT_SUPPORT (gst_d3d11_format_support_get_type())
|
||||||
GType gst_d3d11_format_support_get_type (void);
|
GType gst_d3d11_format_support_get_type (void);
|
||||||
|
|
|
@ -1446,7 +1446,7 @@ gst_d3d11_base_convert_decide_allocation (GstBaseTransform * trans,
|
||||||
GstVideoInfo info;
|
GstVideoInfo info;
|
||||||
guint i;
|
guint i;
|
||||||
GstD3D11Format d3d11_format;
|
GstD3D11Format d3d11_format;
|
||||||
guint bind_flags = D3D11_BIND_RENDER_TARGET;
|
guint bind_flags = 0;
|
||||||
DXGI_FORMAT dxgi_format = DXGI_FORMAT_UNKNOWN;
|
DXGI_FORMAT dxgi_format = DXGI_FORMAT_UNKNOWN;
|
||||||
UINT supported = 0;
|
UINT supported = 0;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
@ -1481,12 +1481,26 @@ gst_d3d11_base_convert_decide_allocation (GstBaseTransform * trans,
|
||||||
|
|
||||||
device_handle = gst_d3d11_device_get_device_handle (filter->device);
|
device_handle = gst_d3d11_device_get_device_handle (filter->device);
|
||||||
hr = device_handle->CheckFormatSupport (dxgi_format, &supported);
|
hr = device_handle->CheckFormatSupport (dxgi_format, &supported);
|
||||||
if (gst_d3d11_result (hr, filter->device) &&
|
if (!gst_d3d11_result (hr, filter->device)) {
|
||||||
(supported & D3D11_FORMAT_SUPPORT_SHADER_SAMPLE) ==
|
GST_ERROR_OBJECT (self, "CheckFormatSupport failed");
|
||||||
D3D11_FORMAT_SUPPORT_SHADER_SAMPLE) {
|
return FALSE;
|
||||||
bind_flags |= D3D11_BIND_SHADER_RESOURCE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((supported & D3D11_FORMAT_SUPPORT_RENDER_TARGET) != 0) {
|
||||||
|
bind_flags |= D3D11_BIND_RENDER_TARGET;
|
||||||
|
} else {
|
||||||
|
if (d3d11_format.dxgi_format != DXGI_FORMAT_UNKNOWN &&
|
||||||
|
(supported & D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_OUTPUT) != 0) {
|
||||||
|
bind_flags |= D3D11_BIND_RENDER_TARGET;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((supported & D3D11_FORMAT_SUPPORT_TYPED_UNORDERED_ACCESS_VIEW) != 0)
|
||||||
|
bind_flags |= D3D11_BIND_UNORDERED_ACCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((supported & D3D11_FORMAT_SUPPORT_SHADER_SAMPLE) != 0)
|
||||||
|
bind_flags |= D3D11_BIND_SHADER_RESOURCE;
|
||||||
|
|
||||||
size = GST_VIDEO_INFO_SIZE (&info);
|
size = GST_VIDEO_INFO_SIZE (&info);
|
||||||
|
|
||||||
if (gst_query_get_n_allocation_pools (query) > 0) {
|
if (gst_query_get_n_allocation_pools (query) > 0) {
|
||||||
|
|
Loading…
Reference in a new issue