mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
d3d11memory: Store ID3D11VideoProcessorOutputView object
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1718>
This commit is contained in:
parent
002cddf131
commit
484d510558
2 changed files with 54 additions and 1 deletions
|
@ -465,6 +465,9 @@ gst_d3d11_allocator_free (GstAllocator * allocator, GstMemory * mem)
|
|||
if (dmem->processor_input_view)
|
||||
ID3D11VideoProcessorInputView_Release (dmem->processor_input_view);
|
||||
|
||||
if (dmem->processor_output_view)
|
||||
ID3D11VideoProcessorOutputView_Release (dmem->processor_output_view);
|
||||
|
||||
if (dmem->texture)
|
||||
ID3D11Texture2D_Release (dmem->texture);
|
||||
|
||||
|
@ -1171,3 +1174,49 @@ gst_d3d11_memory_ensure_processor_input_view (GstD3D11Memory * mem,
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_d3d11_memory_ensure_processor_output_view (GstD3D11Memory * mem,
|
||||
ID3D11VideoDevice * video_device,
|
||||
ID3D11VideoProcessorEnumerator * enumerator)
|
||||
{
|
||||
GstD3D11Allocator *allocator;
|
||||
D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC desc = { 0, };
|
||||
HRESULT hr;
|
||||
|
||||
g_return_val_if_fail (gst_is_d3d11_memory (GST_MEMORY_CAST (mem)), FALSE);
|
||||
g_return_val_if_fail (video_device != NULL, FALSE);
|
||||
g_return_val_if_fail (enumerator != NULL, FALSE);
|
||||
|
||||
allocator = GST_D3D11_ALLOCATOR (GST_MEMORY_CAST (mem)->allocator);
|
||||
|
||||
if (mem->processor_output_view)
|
||||
return TRUE;
|
||||
|
||||
if (!(mem->desc.BindFlags & D3D11_BIND_RENDER_TARGET)) {
|
||||
GST_WARNING_OBJECT (allocator,
|
||||
"Need BindFlags, current flag 0x%x", mem->desc.BindFlags);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* FIXME: texture array should be supported at some point */
|
||||
if (mem->subresource_index != 0) {
|
||||
GST_FIXME_OBJECT (allocator,
|
||||
"Texture array is not suppoted for processor output view");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
desc.ViewDimension = D3D11_VPOV_DIMENSION_TEXTURE2D;
|
||||
desc.Texture2D.MipSlice = 0;
|
||||
|
||||
hr = ID3D11VideoDevice_CreateVideoProcessorOutputView (video_device,
|
||||
(ID3D11Resource *) mem->texture, enumerator, &desc,
|
||||
&mem->processor_output_view);
|
||||
if (!gst_d3d11_result (hr, mem->device)) {
|
||||
GST_ERROR_OBJECT (allocator,
|
||||
"Could not create processor input view, hr: 0x%x", (guint) hr);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -114,8 +114,8 @@ struct _GstD3D11Memory
|
|||
guint num_render_target_views;
|
||||
|
||||
ID3D11VideoDecoderOutputView *decoder_output_view;
|
||||
|
||||
ID3D11VideoProcessorInputView *processor_input_view;
|
||||
ID3D11VideoProcessorOutputView *processor_output_view;
|
||||
|
||||
GstD3D11MemoryType type;
|
||||
|
||||
|
@ -195,6 +195,10 @@ gboolean gst_d3d11_memory_ensure_processor_input_view (GstD3D11Memory
|
|||
ID3D11VideoDevice * video_device,
|
||||
ID3D11VideoProcessorEnumerator * enumerator);
|
||||
|
||||
gboolean gst_d3d11_memory_ensure_processor_output_view (GstD3D11Memory * mem,
|
||||
ID3D11VideoDevice * video_device,
|
||||
ID3D11VideoProcessorEnumerator * enumerator);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_D3D11_MEMORY_H__ */
|
||||
|
|
Loading…
Reference in a new issue