2019-12-26 05:24:46 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2019 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_DECODER_H__
|
|
|
|
#define __GST_D3D11_DECODER_H__
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
#include <gst/video/video.h>
|
2020-12-20 17:47:45 +00:00
|
|
|
#include <gst/d3d11/gstd3d11.h>
|
2019-12-26 05:24:46 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2020-09-25 18:27:39 +00:00
|
|
|
#define GST_TYPE_D3D11_DECODER (gst_d3d11_decoder_get_type())
|
|
|
|
G_DECLARE_FINAL_TYPE (GstD3D11Decoder,
|
|
|
|
gst_d3d11_decoder, GST, D3D11_DECODER, GstObject);
|
2019-12-26 05:24:46 +00:00
|
|
|
|
2020-09-25 18:27:39 +00:00
|
|
|
typedef struct _GstD3D11DecoderPrivate GstD3D11DecoderPrivate;
|
2019-12-26 05:24:46 +00:00
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
GST_D3D11_CODEC_NONE,
|
|
|
|
GST_D3D11_CODEC_H264,
|
2019-12-20 14:05:52 +00:00
|
|
|
GST_D3D11_CODEC_VP9,
|
2019-12-26 05:28:03 +00:00
|
|
|
GST_D3D11_CODEC_H265,
|
2020-02-28 09:14:51 +00:00
|
|
|
GST_D3D11_CODEC_VP8,
|
2021-01-10 16:06:24 +00:00
|
|
|
GST_D3D11_CODEC_MPEG2,
|
2019-12-26 05:24:46 +00:00
|
|
|
|
|
|
|
/* the last of supported codec */
|
|
|
|
GST_D3D11_CODEC_LAST
|
|
|
|
} GstD3D11Codec;
|
|
|
|
|
2020-02-14 16:23:32 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GstCaps *sink_caps;
|
|
|
|
GstCaps *src_caps;
|
|
|
|
guint adapter;
|
|
|
|
guint device_id;
|
|
|
|
guint vendor_id;
|
|
|
|
gchar *description;
|
|
|
|
} GstD3D11DecoderClassData;
|
|
|
|
|
2019-12-26 05:24:46 +00:00
|
|
|
struct _GstD3D11Decoder
|
|
|
|
{
|
|
|
|
GstObject parent;
|
|
|
|
|
|
|
|
/* TRUE if decoder was successfully opened ever */
|
|
|
|
gboolean opened;
|
|
|
|
|
|
|
|
/*< private >*/
|
|
|
|
GstD3D11DecoderPrivate *priv;
|
|
|
|
gpointer padding[GST_PADDING_LARGE];
|
|
|
|
};
|
|
|
|
|
|
|
|
GstD3D11Decoder * gst_d3d11_decoder_new (GstD3D11Device * device);
|
|
|
|
|
|
|
|
gboolean gst_d3d11_decoder_open (GstD3D11Decoder * decoder,
|
|
|
|
GstD3D11Codec codec,
|
|
|
|
GstVideoInfo * info,
|
2020-02-03 13:23:21 +00:00
|
|
|
guint codec_width,
|
|
|
|
guint codec_height,
|
2021-02-14 12:01:32 +00:00
|
|
|
guint dpb_size,
|
2019-12-26 05:24:46 +00:00
|
|
|
const GUID ** decoder_profiles,
|
|
|
|
guint profile_size);
|
|
|
|
|
|
|
|
void gst_d3d11_decoder_reset (GstD3D11Decoder * decoder);
|
|
|
|
|
|
|
|
gboolean gst_d3d11_decoder_begin_frame (GstD3D11Decoder * decoder,
|
2020-10-20 08:31:17 +00:00
|
|
|
ID3D11VideoDecoderOutputView * output_view,
|
2019-12-26 05:24:46 +00:00
|
|
|
guint content_key_size,
|
|
|
|
gconstpointer content_key);
|
|
|
|
|
|
|
|
gboolean gst_d3d11_decoder_end_frame (GstD3D11Decoder * decoder);
|
|
|
|
|
|
|
|
gboolean gst_d3d11_decoder_get_decoder_buffer (GstD3D11Decoder * decoder,
|
|
|
|
D3D11_VIDEO_DECODER_BUFFER_TYPE type,
|
|
|
|
guint * buffer_size,
|
|
|
|
gpointer * buffer);
|
|
|
|
|
|
|
|
gboolean gst_d3d11_decoder_release_decoder_buffer (GstD3D11Decoder * decoder,
|
|
|
|
D3D11_VIDEO_DECODER_BUFFER_TYPE type);
|
|
|
|
|
|
|
|
gboolean gst_d3d11_decoder_submit_decoder_buffers (GstD3D11Decoder * decoder,
|
|
|
|
guint buffer_count,
|
|
|
|
const D3D11_VIDEO_DECODER_BUFFER_DESC * buffers);
|
|
|
|
|
2021-02-14 12:01:32 +00:00
|
|
|
GstBuffer * gst_d3d11_decoder_get_output_view_buffer (GstD3D11Decoder * decoder,
|
|
|
|
GstVideoDecoder * videodec);
|
2019-12-26 05:24:46 +00:00
|
|
|
|
2020-10-20 08:31:17 +00:00
|
|
|
ID3D11VideoDecoderOutputView * gst_d3d11_decoder_get_output_view_from_buffer (GstD3D11Decoder * decoder,
|
|
|
|
GstBuffer * buffer);
|
2019-12-26 05:24:46 +00:00
|
|
|
|
2020-10-20 08:31:17 +00:00
|
|
|
guint8 gst_d3d11_decoder_get_output_view_index (ID3D11VideoDecoderOutputView * view_handle);
|
2019-12-26 05:24:46 +00:00
|
|
|
|
2020-03-07 10:41:53 +00:00
|
|
|
gboolean gst_d3d11_decoder_process_output (GstD3D11Decoder * decoder,
|
2019-12-26 05:24:46 +00:00
|
|
|
GstVideoInfo * info,
|
2020-03-07 10:41:53 +00:00
|
|
|
gint display_width,
|
|
|
|
gint display_height,
|
2019-12-26 05:24:46 +00:00
|
|
|
GstBuffer * decoder_buffer,
|
|
|
|
GstBuffer * output);
|
|
|
|
|
2020-03-29 14:31:13 +00:00
|
|
|
gboolean gst_d3d11_decoder_negotiate (GstVideoDecoder * decoder,
|
|
|
|
GstVideoCodecState * input_state,
|
|
|
|
GstVideoFormat format,
|
|
|
|
guint width,
|
|
|
|
guint height,
|
2020-11-05 17:45:21 +00:00
|
|
|
GstVideoInterlaceMode interlace_mode,
|
2020-03-29 14:31:13 +00:00
|
|
|
GstVideoCodecState ** output_state,
|
|
|
|
gboolean * downstream_supports_d3d11);
|
|
|
|
|
|
|
|
gboolean gst_d3d11_decoder_decide_allocation (GstVideoDecoder * decoder,
|
|
|
|
GstQuery * query,
|
|
|
|
GstD3D11Device * device,
|
|
|
|
GstD3D11Codec codec,
|
2021-02-14 12:01:32 +00:00
|
|
|
gboolean use_d3d11_pool,
|
|
|
|
GstD3D11Decoder * d3d11_decoder);
|
2020-03-29 14:31:13 +00:00
|
|
|
|
2021-02-03 18:42:05 +00:00
|
|
|
gboolean gst_d3d11_decoder_can_direct_render (GstD3D11Decoder * decoder,
|
|
|
|
GstBuffer * view_buffer,
|
|
|
|
GstMiniObject * picture);
|
|
|
|
|
2020-06-15 12:10:09 +00:00
|
|
|
|
2020-02-14 16:23:32 +00:00
|
|
|
/* Utils for class registration */
|
|
|
|
gboolean gst_d3d11_decoder_util_is_legacy_device (GstD3D11Device * device);
|
|
|
|
|
|
|
|
gboolean gst_d3d11_decoder_get_supported_decoder_profile (GstD3D11Decoder * decoder,
|
|
|
|
const GUID ** decoder_profiles,
|
|
|
|
guint profile_size,
|
|
|
|
GUID * selected_profile);
|
|
|
|
|
|
|
|
gboolean gst_d3d11_decoder_supports_format (GstD3D11Decoder * decoder,
|
|
|
|
const GUID * decoder_profile,
|
|
|
|
DXGI_FORMAT format);
|
|
|
|
|
|
|
|
gboolean gst_d3d11_decoder_supports_resolution (GstD3D11Decoder * decoder,
|
|
|
|
const GUID * decoder_profile,
|
|
|
|
DXGI_FORMAT format,
|
|
|
|
guint width,
|
|
|
|
guint height);
|
|
|
|
|
|
|
|
GstD3D11DecoderClassData * gst_d3d11_decoder_class_data_new (GstD3D11Device * device,
|
|
|
|
GstCaps * sink_caps,
|
|
|
|
GstCaps * src_caps);
|
|
|
|
|
|
|
|
void gst_d3d11_decoder_class_data_free (GstD3D11DecoderClassData * data);
|
|
|
|
|
2019-12-26 05:24:46 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __GST_D3D11_DECODER_H__ */
|