gstreamer/sys/d3d11/gstd3d11videoprocessor.h
Seungha Yang 59a1897c39 d3d11: Privatize d3d11memory implementation
Hide most of symbols of GstD3D11Memory object.
GstD3D11Memory is one of primary resource for imcoming d3d11 library
and it's expected to be a extensible feature.
Hiding implementation detail would be helpful for later use case.

Summary of this commit:
* Now all native Direct3D11 resources are private of GstD3D11Memory.
  To access native resources, getter methods need to be used
  or generic map (e.g., gst_memory_map) API should be called
  apart from some exceptional case such as d3d11decoder case.
* Various helper methods are added for GstBuffer related operations
  and in order to remove duplicated code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1892>
2020-12-21 01:02:37 +09:00

115 lines
6.1 KiB
C

/* GStreamer
* Copyright (C) <2020> Seungha Yang <seungha.yang@navercorp.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_D3D11_VIDEO_PROCESSOR_H__
#define __GST_D3D11_VIDEO_PROCESSOR_H__
#include <gst/gst.h>
#include <gst/video/video.h>
#include "gstd3d11_fwd.h"
G_BEGIN_DECLS
typedef struct _GstD3D11VideoProcessor GstD3D11VideoProcessor;
GstD3D11VideoProcessor * gst_d3d11_video_processor_new (GstD3D11Device * device,
guint in_width,
guint in_height,
guint out_width,
guint out_height);
void gst_d3d11_video_processor_free (GstD3D11VideoProcessor * processor);
gboolean gst_d3d11_video_processor_supports_input_format (GstD3D11VideoProcessor * processor,
DXGI_FORMAT format);
gboolean gst_d3d11_video_processor_supports_output_format (GstD3D11VideoProcessor * processor,
DXGI_FORMAT format);
gboolean gst_d3d11_video_processor_get_caps (GstD3D11VideoProcessor * processor,
D3D11_VIDEO_PROCESSOR_CAPS * caps);
gboolean gst_d3d11_video_processor_set_input_color_space (GstD3D11VideoProcessor * processor,
GstVideoColorimetry * color);
gboolean gst_d3d11_video_processor_set_output_color_space (GstD3D11VideoProcessor * processor,
GstVideoColorimetry * color);
#if (DXGI_HEADER_VERSION >= 4)
gboolean gst_d3d11_video_processor_check_format_conversion (GstD3D11VideoProcessor * processor,
DXGI_FORMAT in_format,
DXGI_COLOR_SPACE_TYPE in_color_space,
DXGI_FORMAT out_format,
DXGI_COLOR_SPACE_TYPE out_color_space);
gboolean gst_d3d11_video_processor_set_input_dxgi_color_space (GstD3D11VideoProcessor * processor,
DXGI_COLOR_SPACE_TYPE color_space);
gboolean gst_d3d11_video_processor_set_output_dxgi_color_space (GstD3D11VideoProcessor * processor,
DXGI_COLOR_SPACE_TYPE color_space);
#endif
#if (DXGI_HEADER_VERSION >= 5)
gboolean gst_d3d11_video_processor_set_input_hdr10_metadata (GstD3D11VideoProcessor * processor,
DXGI_HDR_METADATA_HDR10 * hdr10_meta);
gboolean gst_d3d11_video_processor_set_output_hdr10_metadata (GstD3D11VideoProcessor * processor,
DXGI_HDR_METADATA_HDR10 * hdr10_meta);
#endif
gboolean gst_d3d11_video_processor_create_input_view (GstD3D11VideoProcessor * processor,
D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC * desc,
ID3D11Resource *resource,
ID3D11VideoProcessorInputView ** view);
ID3D11VideoProcessorInputView * gst_d3d11_video_processor_get_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,
ID3D11VideoProcessorOutputView ** view);
ID3D11VideoProcessorOutputView * gst_d3d11_video_processor_get_output_view (GstD3D11VideoProcessor * processor,
GstD3D11Memory *mem);
void gst_d3d11_video_processor_input_view_release (ID3D11VideoProcessorInputView * view);
void gst_d3d11_video_processor_output_view_release (ID3D11VideoProcessorOutputView * view);
gboolean gst_d3d11_video_processor_render (GstD3D11VideoProcessor * processor,
RECT *in_rect,
ID3D11VideoProcessorInputView * in_view,
RECT *out_rect,
ID3D11VideoProcessorOutputView * out_view);
gboolean gst_d3d11_video_processor_render_unlocked (GstD3D11VideoProcessor * processor,
RECT *in_rect,
ID3D11VideoProcessorInputView * in_view,
RECT *out_rect,
ID3D11VideoProcessorOutputView * out_view);
/* utils */
gboolean gst_d3d11_video_processor_check_bind_flags_for_input_view (guint bind_flags);
gboolean gst_d3d11_video_processor_check_bind_flags_for_output_view (guint bind_flags);
G_END_DECLS
#endif /* __GST_D3D11_VIDEO_PROCESSOR_H__ */