diff --git a/sys/d3d11/gstd3d11colorconvert.c b/sys/d3d11/gstd3d11colorconvert.c index c12e97a683..48f66416aa 100644 --- a/sys/d3d11/gstd3d11colorconvert.c +++ b/sys/d3d11/gstd3d11colorconvert.c @@ -819,7 +819,7 @@ do_convert (GstD3D11Device * device, DoConvertData * data) gst_memory_unmap (mem, &info); } - if (gst_d3d11_memory_ensure_shader_resource_view (mem)) { + if (gst_d3d11_memory_ensure_shader_resource_view (d3d11_mem)) { GST_TRACE_OBJECT (self, "Use input texture resource without copy"); for (j = 0; j < d3d11_mem->num_shader_resource_views; j++) { @@ -866,7 +866,7 @@ do_convert (GstD3D11Device * device, DoConvertData * data) d3d11_mem = (GstD3D11Memory *) mem; - if (gst_d3d11_memory_ensure_render_target_view (mem)) { + if (gst_d3d11_memory_ensure_render_target_view (d3d11_mem)) { GST_TRACE_OBJECT (self, "Render to output texture directly"); for (j = 0; j < d3d11_mem->num_render_target_views; j++) { diff --git a/sys/d3d11/gstd3d11memory.c b/sys/d3d11/gstd3d11memory.c index e6efadb3b8..1cf6eb96d2 100644 --- a/sys/d3d11/gstd3d11memory.c +++ b/sys/d3d11/gstd3d11memory.c @@ -774,51 +774,43 @@ gst_is_d3d11_memory (GstMemory * mem) } gboolean -gst_d3d11_memory_ensure_shader_resource_view (GstMemory * mem) +gst_d3d11_memory_ensure_shader_resource_view (GstD3D11Memory * mem) { - GstD3D11Memory *dmem; + g_return_val_if_fail (gst_is_d3d11_memory (GST_MEMORY_CAST (mem)), FALSE); - g_return_val_if_fail (gst_is_d3d11_memory (mem), FALSE); - - dmem = (GstD3D11Memory *) mem; - - if (dmem->num_shader_resource_views) + if (mem->num_shader_resource_views) return TRUE; - if (!(dmem->desc.BindFlags & D3D11_BIND_SHADER_RESOURCE)) { - GST_WARNING_OBJECT (mem->allocator, - "Need BindFlags, current flag 0x%x", dmem->desc.BindFlags); + if (!(mem->desc.BindFlags & D3D11_BIND_SHADER_RESOURCE)) { + GST_WARNING_OBJECT (GST_MEMORY_CAST (mem)->allocator, + "Need BindFlags, current flag 0x%x", mem->desc.BindFlags); return FALSE; } - gst_d3d11_device_thread_add (dmem->device, + gst_d3d11_device_thread_add (mem->device, (GstD3D11DeviceThreadFunc) create_shader_resource_views, mem); - return ! !dmem->num_shader_resource_views; + return ! !mem->num_shader_resource_views; } gboolean -gst_d3d11_memory_ensure_render_target_view (GstMemory * mem) +gst_d3d11_memory_ensure_render_target_view (GstD3D11Memory * mem) { - GstD3D11Memory *dmem; + g_return_val_if_fail (gst_is_d3d11_memory (GST_MEMORY_CAST (mem)), FALSE); - g_return_val_if_fail (gst_is_d3d11_memory (mem), FALSE); - - dmem = (GstD3D11Memory *) mem; - - if (dmem->num_render_target_views) + if (mem->num_render_target_views) return TRUE; - if (!(dmem->desc.BindFlags & D3D11_BIND_RENDER_TARGET)) { - GST_WARNING_OBJECT (mem->allocator, - "Need BindFlags, current flag 0x%x", dmem->desc.BindFlags); + if (!(mem->desc.BindFlags & D3D11_BIND_RENDER_TARGET)) { + GST_WARNING_OBJECT (GST_MEMORY_CAST (mem)->allocator, + "Need BindFlags, current flag 0x%x", mem->desc.BindFlags); return FALSE; } - gst_d3d11_device_thread_add (dmem->device, + gst_d3d11_device_thread_add (mem->device, (GstD3D11DeviceThreadFunc) create_render_target_views, mem); - return ! !dmem->num_render_target_views; + return ! !mem->num_render_target_views; } diff --git a/sys/d3d11/gstd3d11memory.h b/sys/d3d11/gstd3d11memory.h index e2a67acfbe..dc0515de1e 100644 --- a/sys/d3d11/gstd3d11memory.h +++ b/sys/d3d11/gstd3d11memory.h @@ -163,9 +163,9 @@ GstMemory * gst_d3d11_allocator_alloc (GstD3D11Allocator * allocator gboolean gst_is_d3d11_memory (GstMemory * mem); -gboolean gst_d3d11_memory_ensure_shader_resource_view (GstMemory * mem); +gboolean gst_d3d11_memory_ensure_shader_resource_view (GstD3D11Memory * mem); -gboolean gst_d3d11_memory_ensure_render_target_view (GstMemory * mem); +gboolean gst_d3d11_memory_ensure_render_target_view (GstD3D11Memory * mem); G_END_DECLS diff --git a/sys/d3d11/gstd3d11videosink.c b/sys/d3d11/gstd3d11videosink.c index a81d6ffd02..b79180dc9e 100644 --- a/sys/d3d11/gstd3d11videosink.c +++ b/sys/d3d11/gstd3d11videosink.c @@ -672,7 +672,7 @@ gst_d3d11_video_sink_show_frame (GstVideoSink * sink, GstBuffer * buf) break; } - if (self->need_srv && !gst_d3d11_memory_ensure_shader_resource_view (mem)) { + if (self->need_srv && !gst_d3d11_memory_ensure_shader_resource_view (dmem)) { GST_LOG_OBJECT (sink, "shader resource view is unavailable, need fallback"); render_buf = NULL; @@ -743,8 +743,7 @@ gst_d3d11_video_sink_show_frame (GstVideoSink * sink, GstBuffer * buf) gst_memory_unmap (GST_MEMORY_CAST (dmem), &info); if (self->need_srv && - !gst_d3d11_memory_ensure_shader_resource_view (GST_MEMORY_CAST - (dmem))) { + !gst_d3d11_memory_ensure_shader_resource_view (dmem)) { GST_ERROR_OBJECT (self, "shader resource view is not available"); gst_buffer_unref (render_buf);