GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
- (GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY, GST_D3D11_FORMATS) "; "
+ (GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY, GST_D3D11_SINK_FORMATS) "; "
GST_VIDEO_CAPS_MAKE_WITH_FEATURES
(GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY ","
GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION,
- GST_D3D11_FORMATS))
+ GST_D3D11_SINK_FORMATS))
);
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
- (GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY, GST_D3D11_FORMATS) "; "
+ (GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY, GST_D3D11_SRC_FORMATS) "; "
GST_VIDEO_CAPS_MAKE_WITH_FEATURES
(GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY ","
GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION,
- GST_D3D11_FORMATS))
+ GST_D3D11_SRC_FORMATS))
);
#define gst_d3d11_color_convert_parent_class parent_class
" vuya.a = sample.a;\n"
" output.Plane_0 = vuya;\n";
+static const gchar templ_PACKED_YUV_to_RGB_BODY[] =
+ " float4 sample, rgba;\n"
+ " sample.x = shaderTexture[0].Sample(samplerState, input.Texture).%c;\n"
+ " sample.y = shaderTexture[0].Sample(samplerState, input.Texture).%c;\n"
+ " sample.z = shaderTexture[0].Sample(samplerState, input.Texture).%c;\n"
+ " rgba.rgb = yuv_to_rgb (sample.xyz);\n"
+ " rgba.a = 1;\n"
+ " output.Plane_0 = rgba;\n";
+
/* YUV to RGB conversion */
static const gchar templ_PLANAR_YUV_to_RGB_BODY[] =
" float4 sample, rgba;\n"
" sample.xy = shaderTexture[1].Sample(samplerState, input.Texture).yx;\n"
" output.Plane_0 = float4(sample.xyz, 1.0f);\n";
+static const gchar templ_PACKED_YUV_to_VUYA_BODY[] =
+ " float4 sample;\n"
+ " sample.z = shaderTexture[0].Sample(samplerState, input.Texture).%c;\n"
+ " sample.y = shaderTexture[0].Sample(samplerState, input.Texture).%c;\n"
+ " sample.x = shaderTexture[0].Sample(samplerState, input.Texture).%c;\n"
+ " output.Plane_0 = float4(sample.xyz, 1.0f);\n";
+
+/* packed YUV to (semi) planar YUV */
+static const gchar templ_PACKED_YUV_to_LUMA_BODY[] =
+ " float4 sample;\n"
+ " sample.x = shaderTexture[0].Sample(samplerState, input.Texture).%c;\n"
+ " output.Plane_0 = float4(sample.x / %d, 0.0, 0.0, 0.0);\n";
+
+static const gchar templ_PACKED_YUV_TO_PLANAR_CHROMA_BODY[] =
+ " float4 sample;\n"
+ " sample.y = shaderTexture[0].Sample(samplerState, input.Texture).%c;\n"
+ " sample.z = shaderTexture[0].Sample(samplerState, input.Texture).%c;\n"
+ " output.Plane_0 = float4(sample.y / %d, 0.0, 0.0, 0.0);\n"
+ " output.Plane_1 = float4(sample.z / %d, 0.0, 0.0, 0.0);\n";
+
+static const gchar templ_PACKED_YUV_TO_SEMI_PLANAR_CHROMA_BODY[] =
+ " float4 sample;\n"
+ " sample.y = shaderTexture[0].Sample(samplerState, input.Texture).%c;\n"
+ " sample.z = shaderTexture[0].Sample(samplerState, input.Texture).%c;\n"
+ " output.Plane_0 = float4(sample.yz, 0.0, 0.0);\n";
+
static const gchar templ_pixel_shader[] =
/* constant buffer */
"%s\n"
return TRUE;
}
+static gboolean
+get_packed_yuv_components (GstD3D11ColorConverter * self, GstVideoFormat
+ format, gchar * y, gchar * u, gchar * v)
+{
+ switch (format) {
+ case GST_VIDEO_FORMAT_YUY2:
+ {
+ const GstD3D11Format *d3d11_format =
+ gst_d3d11_device_format_from_gst (self->device,
+ GST_VIDEO_FORMAT_YUY2);
+
+ g_assert (d3d11_format != NULL);
+
+ if (d3d11_format->resource_format[0] == DXGI_FORMAT_R8G8B8A8_UNORM) {
+ *y = 'x';
+ *u = 'y';
+ *v = 'a';
+ } else if (d3d11_format->resource_format[0] ==
+ DXGI_FORMAT_G8R8_G8B8_UNORM) {
+ *y = 'y';
+ *u = 'x';
+ *v = 'z';
+ } else {
+ g_assert_not_reached ();
+ return FALSE;
+ }
+ break;
+ }
+ case GST_VIDEO_FORMAT_UYVY:
+ *y = 'y';
+ *u = 'x';
+ *v = 'z';
+ break;
+ case GST_VIDEO_FORMAT_VYUY:
+ *y = 'y';
+ *u = 'z';
+ *v = 'x';
+ break;
+ default:
+ g_assert_not_reached ();
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
static gboolean
setup_convert_info_yuv_to_rgb (GstD3D11ColorConverter * self,
const GstVideoInfo * in_info, const GstVideoInfo * out_info)
case GST_VIDEO_FORMAT_VUYA:
info->ps_body[0] = g_strdup_printf (templ_VUYA_to_RGB_BODY);
break;
+ case GST_VIDEO_FORMAT_YUY2:
+ case GST_VIDEO_FORMAT_UYVY:
+ case GST_VIDEO_FORMAT_VYUY:
+ {
+ gchar y, u, v;
+ if (!get_packed_yuv_components (self, GST_VIDEO_INFO_FORMAT (in_info),
+ &y, &u, &v)) {
+ return FALSE;
+ }
+
+ info->ps_body[0] =
+ g_strdup_printf (templ_PACKED_YUV_to_RGB_BODY, y, u, v);
+ break;
+ }
case GST_VIDEO_FORMAT_I420:
info->ps_body[0] =
g_strdup_printf (templ_PLANAR_YUV_to_RGB_BODY, 1, 1, 1);
return TRUE;
}
+static gboolean
+setup_convert_info_packed_yuv_to_vuya (GstD3D11ColorConverter * self,
+ const GstVideoInfo * in_info, const GstVideoInfo * out_info)
+{
+ ConvertInfo *info = &self->convert_info;
+ gchar y, u, v;
+
+ info->templ = &templ_REORDER;
+
+ if (!get_packed_yuv_components (self, GST_VIDEO_INFO_FORMAT (in_info),
+ &y, &u, &v)) {
+ return FALSE;
+ }
+
+ info->ps_body[0] = g_strdup_printf (templ_PACKED_YUV_to_VUYA_BODY, y, u, v);
+
+ return TRUE;
+}
+
static gboolean
setup_convert_info_semi_planar_to_vuya (GstD3D11ColorConverter * self,
const GstVideoInfo * in_info, const GstVideoInfo * out_info)
return TRUE;
}
+static gboolean
+setup_convert_info_packed_yuv_to_planar (GstD3D11ColorConverter * self,
+ const GstVideoInfo * in_info, const GstVideoInfo * out_info)
+{
+ ConvertInfo *info = &self->convert_info;
+ gint div = 1;
+ gchar y, u, v;
+
+ info->templ = &templ_REORDER;
+
+ if (GST_VIDEO_INFO_FORMAT (out_info) == GST_VIDEO_FORMAT_I420_10LE)
+ div = 64;
+
+ if (!get_packed_yuv_components (self, GST_VIDEO_INFO_FORMAT (in_info),
+ &y, &u, &v)) {
+ return FALSE;
+ }
+
+ info->ps_body[0] = g_strdup_printf (templ_PACKED_YUV_to_LUMA_BODY, y, div);
+ info->ps_body[1] =
+ g_strdup_printf (templ_PACKED_YUV_TO_PLANAR_CHROMA_BODY, u, v, div, div);
+
+ return TRUE;
+}
+
+static gboolean
+setup_convert_info_packed_yuv_to_semi_planar (GstD3D11ColorConverter * self,
+ const GstVideoInfo * in_info, const GstVideoInfo * out_info)
+{
+ ConvertInfo *info = &self->convert_info;
+ gint div = 1;
+ gchar y, u, v;
+
+ info->templ = &templ_REORDER;
+
+ if (!get_packed_yuv_components (self, GST_VIDEO_INFO_FORMAT (in_info),
+ &y, &u, &v)) {
+ return FALSE;
+ }
+
+ info->ps_body[0] = g_strdup_printf (templ_PACKED_YUV_to_LUMA_BODY, y, div);
+ info->ps_body[1] =
+ g_strdup_printf (templ_PACKED_YUV_TO_SEMI_PLANAR_CHROMA_BODY, u, v);
+
+ return TRUE;
+}
+
static gboolean
setup_convert_info_yuv_to_yuv (GstD3D11ColorConverter * self,
const GstVideoInfo * in_info, const GstVideoInfo * out_info)
{
gboolean in_planar, out_planar;
gboolean in_vuya, out_vuya;
+ gboolean in_packed;
in_vuya = GST_VIDEO_INFO_FORMAT (in_info) == GST_VIDEO_FORMAT_VUYA;
out_vuya = GST_VIDEO_INFO_FORMAT (out_info) == GST_VIDEO_FORMAT_VUYA;
in_planar = (GST_VIDEO_INFO_FORMAT (in_info) == GST_VIDEO_FORMAT_I420 ||
GST_VIDEO_INFO_FORMAT (in_info) == GST_VIDEO_FORMAT_I420_10LE);
+ in_packed = (GST_VIDEO_INFO_FORMAT (in_info) == GST_VIDEO_FORMAT_YUY2 ||
+ GST_VIDEO_INFO_FORMAT (in_info) == GST_VIDEO_FORMAT_UYVY ||
+ GST_VIDEO_INFO_FORMAT (in_info) == GST_VIDEO_FORMAT_VYUY);
out_planar = (GST_VIDEO_INFO_FORMAT (out_info) == GST_VIDEO_FORMAT_I420 ||
GST_VIDEO_INFO_FORMAT (out_info) == GST_VIDEO_FORMAT_I420_10LE);
+ /* From/to VUYA */
if (in_vuya && out_vuya) {
return setup_convert_info_vuya_to_vuya (self, in_info, out_info);
} else if (in_vuya) {
} else if (out_vuya) {
if (in_planar)
return setup_convert_info_planar_to_vuya (self, in_info, out_info);
+ else if (in_packed)
+ return setup_convert_info_packed_yuv_to_vuya (self, in_info, out_info);
else
return setup_convert_info_semi_planar_to_vuya (self, in_info, out_info);
}
return setup_convert_info_planar_to_planar (self, in_info, out_info);
else
return setup_convert_info_planar_to_semi_planar (self, in_info, out_info);
+ } else if (in_packed) {
+ if (out_planar)
+ return setup_convert_info_packed_yuv_to_planar (self, in_info, out_info);
+ else
+ return setup_convert_info_packed_yuv_to_semi_planar (self, in_info,
+ out_info);
} else {
if (out_planar)
return setup_convert_info_semi_planar_to_planar (self, in_info, out_info);
}
static gboolean
-can_support_format (GstD3D11Device * self, DXGI_FORMAT format)
+can_support_format (GstD3D11Device * self, DXGI_FORMAT format,
+ D3D11_FORMAT_SUPPORT extra_flags)
{
GstD3D11DevicePrivate *priv = self->priv;
ID3D11Device *handle = priv->device;
HRESULT hr;
UINT supported;
- D3D11_FORMAT_SUPPORT flags =
- (D3D11_FORMAT_SUPPORT_TEXTURE2D | D3D11_FORMAT_SUPPORT_RENDER_TARGET |
- D3D11_FORMAT_SUPPORT_SHADER_SAMPLE);
+ D3D11_FORMAT_SUPPORT flags = D3D11_FORMAT_SUPPORT_TEXTURE2D;
+
+ flags |= extra_flags;
if (!gst_d3d11_is_windows_8_or_greater ()) {
GST_WARNING_OBJECT (self, "DXGI format %d needs Windows 8 or greater",
/* YUV packed */
priv->format_table[n_formats].format = GST_VIDEO_FORMAT_VUYA;
priv->format_table[n_formats].resource_format[0] = DXGI_FORMAT_R8G8B8A8_UNORM;
- if (can_support_format (self, DXGI_FORMAT_AYUV))
+ if (can_support_format (self, DXGI_FORMAT_AYUV,
+ D3D11_FORMAT_SUPPORT_RENDER_TARGET |
+ D3D11_FORMAT_SUPPORT_SHADER_SAMPLE))
priv->format_table[n_formats].dxgi_format = DXGI_FORMAT_AYUV;
else
priv->format_table[n_formats].dxgi_format = DXGI_FORMAT_UNKNOWN;
n_formats++;
+ /* NOTE: packted yuv 4:2:2 YUY2, UYVY, and VYUY formats are not natively
+ * supported render target view formats
+ * (i.e., cannot be output format of shader pipeline) */
+ priv->format_table[n_formats].format = GST_VIDEO_FORMAT_YUY2;
+ if (can_support_format (self, DXGI_FORMAT_YUY2,
+ D3D11_FORMAT_SUPPORT_SHADER_SAMPLE)) {
+ priv->format_table[n_formats].resource_format[0] =
+ DXGI_FORMAT_R8G8B8A8_UNORM;
+ priv->format_table[n_formats].dxgi_format = DXGI_FORMAT_YUY2;
+ } else {
+ /* If DXGI_FORMAT_YUY2 format is not supported, use this format,
+ * it's analogous to YUY2 */
+ priv->format_table[n_formats].resource_format[0] =
+ DXGI_FORMAT_G8R8_G8B8_UNORM;
+ }
+ n_formats++;
+
+ /* No native DXGI format available for UYVY */
+ priv->format_table[n_formats].format = GST_VIDEO_FORMAT_UYVY;
+ priv->format_table[n_formats].resource_format[0] =
+ DXGI_FORMAT_R8G8_B8G8_UNORM;
+ n_formats++;
+
+ /* No native DXGI format available for VYUY */
+ priv->format_table[n_formats].format = GST_VIDEO_FORMAT_VYUY;
+ priv->format_table[n_formats].resource_format[0] =
+ DXGI_FORMAT_R8G8_B8G8_UNORM;
+ n_formats++;
+
/* YUV semi-planar */
priv->format_table[n_formats].format = GST_VIDEO_FORMAT_NV12;
priv->format_table[n_formats].resource_format[0] = DXGI_FORMAT_R8_UNORM;
priv->format_table[n_formats].resource_format[1] = DXGI_FORMAT_R8G8_UNORM;
- if (can_support_format (self, DXGI_FORMAT_NV12))
+ if (can_support_format (self, DXGI_FORMAT_NV12,
+ D3D11_FORMAT_SUPPORT_RENDER_TARGET |
+ D3D11_FORMAT_SUPPORT_SHADER_SAMPLE))
priv->format_table[n_formats].dxgi_format = DXGI_FORMAT_NV12;
else
priv->format_table[n_formats].dxgi_format = DXGI_FORMAT_UNKNOWN;
priv->format_table[n_formats].format = GST_VIDEO_FORMAT_P010_10LE;
priv->format_table[n_formats].resource_format[0] = DXGI_FORMAT_R16_UNORM;
priv->format_table[n_formats].resource_format[1] = DXGI_FORMAT_R16G16_UNORM;
- if (can_support_format (self, DXGI_FORMAT_P010))
+ if (can_support_format (self, DXGI_FORMAT_P010,
+ D3D11_FORMAT_SUPPORT_RENDER_TARGET |
+ D3D11_FORMAT_SUPPORT_SHADER_SAMPLE))
priv->format_table[n_formats].dxgi_format = DXGI_FORMAT_P010;
else
priv->format_table[n_formats].dxgi_format = DXGI_FORMAT_UNKNOWN;
priv->format_table[n_formats].format = GST_VIDEO_FORMAT_P016_LE;
priv->format_table[n_formats].resource_format[0] = DXGI_FORMAT_R16_UNORM;
priv->format_table[n_formats].resource_format[1] = DXGI_FORMAT_R16G16_UNORM;
- if (can_support_format (self, DXGI_FORMAT_P016))
+ if (can_support_format (self, DXGI_FORMAT_P016,
+ D3D11_FORMAT_SUPPORT_RENDER_TARGET |
+ D3D11_FORMAT_SUPPORT_SHADER_SAMPLE))
priv->format_table[n_formats].dxgi_format = DXGI_FORMAT_P016;
else
priv->format_table[n_formats].dxgi_format = DXGI_FORMAT_UNKNOWN;
n_formats++;
- /* YUV plannar */
+ /* YUV planar */
priv->format_table[n_formats].format = GST_VIDEO_FORMAT_I420;
priv->format_table[n_formats].resource_format[0] = DXGI_FORMAT_R8_UNORM;
priv->format_table[n_formats].resource_format[1] = DXGI_FORMAT_R8_UNORM;
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
- (GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY, GST_D3D11_FORMATS) "; "
+ (GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY, GST_D3D11_ALL_FORMATS) "; "
GST_VIDEO_CAPS_MAKE_WITH_FEATURES
(GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY ","
GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION,
- GST_D3D11_FORMATS) "; "
- GST_VIDEO_CAPS_MAKE (GST_D3D11_FORMATS) "; "
+ GST_D3D11_ALL_FORMATS) "; "
+ GST_VIDEO_CAPS_MAKE (GST_D3D11_ALL_FORMATS) "; "
GST_VIDEO_CAPS_MAKE_WITH_FEATURES
(GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY ","
GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION,
- GST_D3D11_FORMATS)
+ GST_D3D11_ALL_FORMATS)
));
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
- (GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY, GST_D3D11_FORMATS) "; "
+ (GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY, GST_D3D11_ALL_FORMATS) "; "
GST_VIDEO_CAPS_MAKE_WITH_FEATURES
(GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY ","
GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION,
- GST_D3D11_FORMATS) "; "
- GST_VIDEO_CAPS_MAKE (GST_D3D11_FORMATS) "; "
+ GST_D3D11_ALL_FORMATS) "; "
+ GST_VIDEO_CAPS_MAKE (GST_D3D11_ALL_FORMATS) "; "
GST_VIDEO_CAPS_MAKE_WITH_FEATURES
(GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY ","
GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION,
- GST_D3D11_FORMATS)
+ GST_D3D11_ALL_FORMATS)
));
#define gst_d3d11_download_parent_class parent_class
case DXGI_FORMAT_R8G8B8A8_UNORM:
case DXGI_FORMAT_R10G10B10A2_UNORM:
case DXGI_FORMAT_AYUV:
+ case DXGI_FORMAT_YUY2:
case DXGI_FORMAT_R8_UNORM:
case DXGI_FORMAT_R8G8_UNORM:
case DXGI_FORMAT_R16_UNORM:
case DXGI_FORMAT_R16G16_UNORM:
+ case DXGI_FORMAT_G8R8_G8B8_UNORM:
+ case DXGI_FORMAT_R8G8_B8G8_UNORM:
return 1;
case DXGI_FORMAT_NV12:
case DXGI_FORMAT_P010:
case DXGI_FORMAT_R8G8B8A8_UNORM:
case DXGI_FORMAT_R10G10B10A2_UNORM:
case DXGI_FORMAT_AYUV:
+ case DXGI_FORMAT_YUY2:
case DXGI_FORMAT_R8_UNORM:
case DXGI_FORMAT_R8G8_UNORM:
case DXGI_FORMAT_R16_UNORM:
case DXGI_FORMAT_R16G16_UNORM:
+ case DXGI_FORMAT_G8R8_G8B8_UNORM:
+ case DXGI_FORMAT_R8G8_B8G8_UNORM:
offset[0] = 0;
stride[0] = pitch;
*size = pitch * height;
#include "gstd3d11_fwd.h"
-#define GST_D3D11_FORMATS \
- "{ BGRA, RGBA, RGB10A2_LE, VUYA, NV12, P010_10LE, P016_LE, I420, I420_10LE }"
-#define GST_D3D11_N_FORMATS 9
+#define GST_D3D11_COMMON_FORMATS \
+ "BGRA, RGBA, RGB10A2_LE, VUYA, NV12, P010_10LE, P016_LE, I420, I420_10LE"
+
+#define GST_D3D11_EXTRA_IN_FORMATS \
+ "YUY2, UYVY, VYUY"
+
+#define GST_D3D11_SINK_FORMATS \
+ "{ " GST_D3D11_COMMON_FORMATS " ," GST_D3D11_EXTRA_IN_FORMATS " }"
+
+#define GST_D3D11_SRC_FORMATS \
+ "{ " GST_D3D11_COMMON_FORMATS " }"
+
+#define GST_D3D11_ALL_FORMATS \
+ "{ " GST_D3D11_COMMON_FORMATS " ," GST_D3D11_EXTRA_IN_FORMATS " }"
+
+#define GST_D3D11_N_FORMATS 12
G_BEGIN_DECLS
case DXGI_FORMAT_R8G8_UNORM:
case DXGI_FORMAT_R16_UNORM:
case DXGI_FORMAT_R16G16_UNORM:
+ case DXGI_FORMAT_G8R8_G8B8_UNORM:
+ case DXGI_FORMAT_R8G8_B8G8_UNORM:
num_views = 1;
formats[0] = mem->desc.Format;
break;
case DXGI_FORMAT_AYUV:
+ case DXGI_FORMAT_YUY2:
num_views = 1;
formats[0] = DXGI_FORMAT_R8G8B8A8_UNORM;
break;
g_assert (GstD3DCompileFunc);
+ GST_TRACE ("Compile code \n%s", shader_source);
+
hr = GstD3DCompileFunc (shader_source, strlen (shader_source), NULL, NULL,
NULL, "main", shader_target, 0, 0, &ret, &error);
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_D3D11_FORMATS) "; "
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_D3D11_ALL_FORMATS) "; "
GST_VIDEO_CAPS_MAKE_WITH_FEATURES
(GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY ","
GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION,
- GST_D3D11_FORMATS) "; "
+ GST_D3D11_ALL_FORMATS) "; "
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY,
- GST_D3D11_FORMATS) ";"
+ GST_D3D11_ALL_FORMATS) ";"
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY
"," GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION,
- GST_D3D11_FORMATS))
+ GST_D3D11_ALL_FORMATS))
);
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
- (GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY, GST_D3D11_FORMATS) "; "
+ (GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY, GST_D3D11_ALL_FORMATS) "; "
GST_VIDEO_CAPS_MAKE_WITH_FEATURES
(GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY ","
GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION,
- GST_D3D11_FORMATS)));
+ GST_D3D11_ALL_FORMATS)));
#define gst_d3d11_upload_parent_class parent_class
G_DEFINE_TYPE (GstD3D11Upload, gst_d3d11_upload, GST_TYPE_D3D11_BASE_FILTER);
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
- (GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY, GST_D3D11_FORMATS) "; "
+ (GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY, GST_D3D11_SINK_FORMATS) "; "
GST_VIDEO_CAPS_MAKE_WITH_FEATURES
(GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY ","
GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION,
- GST_D3D11_FORMATS)
+ GST_D3D11_SINK_FORMATS)
));
GST_DEBUG_CATEGORY (d3d11_video_sink_debug);
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
- (GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY, GST_D3D11_FORMATS) "; "
+ (GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY, GST_D3D11_SINK_FORMATS) "; "
GST_VIDEO_CAPS_MAKE_WITH_FEATURES
(GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY ","
GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION,
- GST_D3D11_FORMATS) ";"
- GST_VIDEO_CAPS_MAKE (GST_D3D11_FORMATS) "; "
+ GST_D3D11_SINK_FORMATS) ";"
+ GST_VIDEO_CAPS_MAKE (GST_D3D11_SINK_FORMATS) "; "
GST_VIDEO_CAPS_MAKE_WITH_FEATURES
(GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY ","
GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION,
- GST_D3D11_FORMATS)
+ GST_D3D11_SINK_FORMATS)
));
GST_DEBUG_CATEGORY (d3d11_video_sink_bin_debug);
GST_START_TEST (test_d3d11_color_convert_rgba_reorder)
{
GstHarness *h =
- gst_harness_new_parse ("d3d11upload ! d3d11colorconvert ! d3d11download");
+ gst_harness_new_parse ("d3d11upload ! d3d11convert ! d3d11download");
gint i, j, k;
for (i = 0; i < G_N_ELEMENTS (test_rgba_reorder); i++) {
gchar *pipeline_str =
g_strdup_printf ("videotestsrc num-buffers=1 is-live=true ! "
"video/x-raw,format=%s,framerate=3/1 ! d3d11upload ! "
- "d3d11colorconvert ! d3d11download ! video/x-raw,format=%s ! "
+ "d3d11convert ! d3d11download ! video/x-raw,format=%s ! "
"videoconvert ! d3d11videosink", in_format, out_format);
GstElement *pipeline;
}
}
+GST_END_TEST;
+
+GST_START_TEST (test_d3d11_color_convert_packed_yuv_yuv)
+{
+ const gchar *in_format_list[] = {
+ "YUY2", "UYVY", "VYUY",
+ };
+ const gchar *out_format_list[] = {
+ "VUYA", "NV12", "P010_10LE", "P016_LE", "I420", "I420_10LE"
+ };
+
+ gint i, j;
+
+ for (i = 0; i < G_N_ELEMENTS (in_format_list); i++) {
+ for (j = 0; j < G_N_ELEMENTS (out_format_list); j++) {
+ GST_DEBUG ("run conversion %s to %s", in_format_list[i],
+ out_format_list[j]);
+ run_convert_pipelne (in_format_list[i], out_format_list[j]);
+ }
+ }
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_d3d11_color_convert_packed_yuv_rgb)
+{
+ const gchar *in_format_list[] = {
+ "YUY2", "UYVY", "VYUY",
+ };
+ const gchar *out_format_list[] = {
+ "BGRA", "RGBA", "RGB10A2_LE",
+ };
+
+ gint i, j;
+
+ for (i = 0; i < G_N_ELEMENTS (in_format_list); i++) {
+ for (j = 0; j < G_N_ELEMENTS (out_format_list); j++) {
+ GST_DEBUG ("run conversion %s to %s", in_format_list[i],
+ out_format_list[j]);
+ run_convert_pipelne (in_format_list[i], out_format_list[j]);
+ }
+ }
+}
+
GST_END_TEST;
#endif /* RUN_VISUAL_TEST */
tcase_add_test (tc_basic, test_d3d11_color_convert_yuv_rgb);
tcase_add_test (tc_basic, test_d3d11_color_convert_rgb_yuv);
tcase_add_test (tc_basic, test_d3d11_color_convert_rgb_rgb);
+ tcase_add_test (tc_basic, test_d3d11_color_convert_packed_yuv_yuv);
+ tcase_add_test (tc_basic, test_d3d11_color_convert_packed_yuv_rgb);
#endif
return s;