#define HAVE_VIDEO_CONTEXT_TWO
#endif
-GQuark
-gst_d3d11_video_processor_input_view_quark (void)
-{
- static volatile gsize quark = 0;
-
- if (g_once_init_enter (&quark)) {
- GQuark q = g_quark_from_static_string ("GstD3D11VideoProcessorInputView");
- g_once_init_leave (&quark, (gsize) q);
- }
-
- return (GQuark) quark;
-}
-
-GQuark
-gst_d3d11_video_processor_output_view_quark (void)
-{
- static volatile gsize quark = 0;
-
- if (g_once_init_enter (&quark)) {
- GQuark q = g_quark_from_static_string ("GstD3D11VideoProcessorOutputView");
- g_once_init_leave (&quark, (gsize) q);
- }
-
- return (GQuark) quark;
-}
-
struct _GstD3D11VideoProcessor
{
GstD3D11Device *device;
}
gboolean
+gst_d3d11_video_processor_ensure_input_view (GstD3D11VideoProcessor * processor,
+ GstD3D11Memory * mem)
+{
+ return gst_d3d11_memory_ensure_processor_input_view (mem,
+ processor->video_device, processor->enumerator);
+}
+
+gboolean
gst_d3d11_video_processor_create_output_view (GstD3D11VideoProcessor *
processor, D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC * desc,
ID3D11Resource * resource, ID3D11VideoProcessorOutputView ** view)
typedef struct _GstD3D11VideoProcessor GstD3D11VideoProcessor;
-GQuark gst_d3d11_video_processor_input_view_quark (void);
-GQuark gst_d3d11_video_processor_output_view_quark (void);
-
GstD3D11VideoProcessor * gst_d3d11_video_processor_new (GstD3D11Device * device,
guint in_width,
guint in_height,
ID3D11Resource *resource,
ID3D11VideoProcessorInputView ** view);
+gboolean gst_d3d11_video_processor_ensure_input_view (GstD3D11VideoProcessor * processor,
+ GstD3D11Memory *mem);
+
gboolean gst_d3d11_video_processor_create_output_view (GstD3D11VideoProcessor * processor,
D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC * desc,
ID3D11Resource *resource,
GstBuffer * buffer, ID3D11VideoProcessorInputView ** in_view)
{
GstD3D11Memory *mem;
- ID3D11VideoProcessorInputView *view;
- GQuark quark;
if (!self->processor)
return FALSE;
return FALSE;
}
- quark = gst_d3d11_video_processor_input_view_quark ();
- view = (ID3D11VideoProcessorInputView *)
- gst_mini_object_get_qdata (GST_MINI_OBJECT (mem), quark);
-
- if (!view) {
- D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC in_desc;
-
- in_desc.FourCC = 0;
- in_desc.ViewDimension = D3D11_VPIV_DIMENSION_TEXTURE2D;
- in_desc.Texture2D.MipSlice = 0;
- in_desc.Texture2D.ArraySlice = mem->subresource_index;
-
- GST_TRACE_OBJECT (self, "Create new processor input view");
-
- if (!gst_d3d11_video_processor_create_input_view (self->processor,
- &in_desc, mem->texture, &view)) {
- GST_LOG_OBJECT (self, "Failed to create processor input view");
- return FALSE;
- }
-
- gst_mini_object_set_qdata (GST_MINI_OBJECT (mem), quark, view,
- (GDestroyNotify) gst_d3d11_video_processor_input_view_release);
- } else {
- GST_TRACE_OBJECT (self, "Reuse existing processor input view %p", view);
+ if (!gst_d3d11_video_processor_ensure_input_view (self->processor, mem)) {
+ GST_LOG_OBJECT (self, "Failed to create processor input view");
+ return FALSE;
}
- *in_view = view;
+ *in_view = mem->processor_input_view;
return TRUE;
}