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
|
|
|
|
2021-09-15 14:41:39 +00:00
|
|
|
typedef struct _GstD3D11DecoderClassData GstD3D11DecoderClassData;
|
2019-12-26 05:24:46 +00:00
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
2021-09-15 15:59:37 +00:00
|
|
|
GST_DXVA_CODEC_NONE,
|
|
|
|
GST_DXVA_CODEC_MPEG2,
|
|
|
|
GST_DXVA_CODEC_H264,
|
|
|
|
GST_DXVA_CODEC_H265,
|
|
|
|
GST_DXVA_CODEC_VP8,
|
|
|
|
GST_DXVA_CODEC_VP9,
|
|
|
|
GST_DXVA_CODEC_AV1,
|
2019-12-26 05:24:46 +00:00
|
|
|
|
|
|
|
/* the last of supported codec */
|
2021-09-15 15:59:37 +00:00
|
|
|
GST_DXVA_CODEC_LAST
|
|
|
|
} GstDXVACodec;
|
2019-12-26 05:24:46 +00:00
|
|
|
|
2020-02-14 16:23:32 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2021-10-08 13:37:20 +00:00
|
|
|
GstDXVACodec codec;
|
|
|
|
gint64 adapter_luid;
|
2020-02-14 16:23:32 +00:00
|
|
|
guint device_id;
|
|
|
|
guint vendor_id;
|
2021-09-15 14:41:39 +00:00
|
|
|
} GstD3D11DecoderSubClassData;
|
2020-02-14 16:23:32 +00:00
|
|
|
|
2021-09-15 15:59:37 +00:00
|
|
|
typedef struct _GstD3D11DecodeInputStreamArgs
|
|
|
|
{
|
|
|
|
gpointer picture_params;
|
|
|
|
gsize picture_params_size;
|
|
|
|
|
|
|
|
gpointer slice_control;
|
|
|
|
gsize slice_control_size;
|
|
|
|
|
|
|
|
gpointer bitstream;
|
|
|
|
gsize bitstream_size;
|
|
|
|
|
|
|
|
gpointer inverse_quantization_matrix;
|
|
|
|
gsize inverse_quantization_matrix_size;
|
|
|
|
} GstD3D11DecodeInputStreamArgs;
|
|
|
|
|
|
|
|
GstD3D11Decoder * gst_d3d11_decoder_new (GstD3D11Device * device,
|
|
|
|
GstDXVACodec codec);
|
2019-12-26 05:24:46 +00:00
|
|
|
|
2021-03-14 05:26:17 +00:00
|
|
|
gboolean gst_d3d11_decoder_is_configured (GstD3D11Decoder * decoder);
|
|
|
|
|
|
|
|
gboolean gst_d3d11_decoder_configure (GstD3D11Decoder * decoder,
|
2021-03-28 07:06:55 +00:00
|
|
|
GstVideoCodecState * input_state,
|
2021-03-14 05:26:17 +00:00
|
|
|
GstVideoInfo * info,
|
2021-03-14 06:08:01 +00:00
|
|
|
gint coded_width,
|
|
|
|
gint coded_height,
|
|
|
|
guint dpb_size);
|
2019-12-26 05:24:46 +00:00
|
|
|
|
2021-09-15 15:59:37 +00:00
|
|
|
gboolean gst_d3d11_decoder_decode_frame (GstD3D11Decoder * decoder,
|
|
|
|
ID3D11VideoDecoderOutputView * output_view,
|
|
|
|
GstD3D11DecodeInputStreamArgs * input_args);
|
2019-12-26 05:24:46 +00:00
|
|
|
|
|
|
|
|
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,
|
2021-03-20 10:52:16 +00:00
|
|
|
GstBuffer * buffer,
|
|
|
|
guint8 * view_id);
|
2019-12-26 05:24:46 +00:00
|
|
|
|
2020-03-07 10:41:53 +00:00
|
|
|
gboolean gst_d3d11_decoder_process_output (GstD3D11Decoder * decoder,
|
2021-03-28 07:06:55 +00:00
|
|
|
GstVideoDecoder * videodec,
|
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,
|
2021-03-28 07:06:55 +00:00
|
|
|
GstBuffer ** output);
|
2019-12-26 05:24:46 +00:00
|
|
|
|
2021-03-14 07:11:12 +00:00
|
|
|
gboolean gst_d3d11_decoder_negotiate (GstD3D11Decoder * decoder,
|
2021-03-28 07:06:55 +00:00
|
|
|
GstVideoDecoder * videodec);
|
2021-03-14 07:11:12 +00:00
|
|
|
|
|
|
|
gboolean gst_d3d11_decoder_decide_allocation (GstD3D11Decoder * decoder,
|
|
|
|
GstVideoDecoder * videodec,
|
|
|
|
GstQuery * query);
|
2020-03-29 14:31:13 +00:00
|
|
|
|
2021-04-23 14:20:54 +00:00
|
|
|
gboolean gst_d3d11_decoder_set_flushing (GstD3D11Decoder * decoder,
|
|
|
|
GstVideoDecoder * videodec,
|
|
|
|
gboolean flushing);
|
2021-03-15 09:26:03 +00:00
|
|
|
|
2020-02-14 16:23:32 +00:00
|
|
|
/* Utils for class registration */
|
2021-09-15 15:59:37 +00:00
|
|
|
typedef struct _GstDXVAResolution
|
|
|
|
{
|
|
|
|
guint width;
|
|
|
|
guint height;
|
|
|
|
} GstDXVAResolution;
|
|
|
|
|
|
|
|
static const GstDXVAResolution gst_dxva_resolutions[] = {
|
|
|
|
{1920, 1088}, {2560, 1440}, {3840, 2160}, {4096, 2160},
|
2022-06-17 19:05:53 +00:00
|
|
|
{7680, 4320}, {8192, 4320}, {15360, 8640}, {16384, 8640}
|
2021-09-15 15:59:37 +00:00
|
|
|
};
|
|
|
|
|
2020-02-14 16:23:32 +00:00
|
|
|
gboolean gst_d3d11_decoder_util_is_legacy_device (GstD3D11Device * device);
|
|
|
|
|
2021-09-15 15:59:37 +00:00
|
|
|
gboolean gst_d3d11_decoder_get_supported_decoder_profile (GstD3D11Device * device,
|
|
|
|
GstDXVACodec codec,
|
2021-03-14 06:08:01 +00:00
|
|
|
GstVideoFormat format,
|
|
|
|
const GUID ** selected_profile);
|
2020-02-14 16:23:32 +00:00
|
|
|
|
2021-09-15 15:59:37 +00:00
|
|
|
gboolean gst_d3d11_decoder_supports_format (GstD3D11Device * device,
|
2020-02-14 16:23:32 +00:00
|
|
|
const GUID * decoder_profile,
|
|
|
|
DXGI_FORMAT format);
|
|
|
|
|
2021-09-15 15:59:37 +00:00
|
|
|
gboolean gst_d3d11_decoder_supports_resolution (GstD3D11Device * device,
|
2020-02-14 16:23:32 +00:00
|
|
|
const GUID * decoder_profile,
|
|
|
|
DXGI_FORMAT format,
|
|
|
|
guint width,
|
|
|
|
guint height);
|
|
|
|
|
2021-09-15 14:41:39 +00:00
|
|
|
GstD3D11DecoderClassData * gst_d3d11_decoder_class_data_new (GstD3D11Device * device,
|
2021-09-15 15:59:37 +00:00
|
|
|
GstDXVACodec codec,
|
2021-09-15 14:41:39 +00:00
|
|
|
GstCaps * sink_caps,
|
|
|
|
GstCaps * src_caps);
|
2020-02-14 16:23:32 +00:00
|
|
|
|
2021-09-15 14:41:39 +00:00
|
|
|
void gst_d3d11_decoder_class_data_fill_subclass_data (GstD3D11DecoderClassData * data,
|
|
|
|
GstD3D11DecoderSubClassData * subclass_data);
|
|
|
|
|
|
|
|
void gst_d3d11_decoder_proxy_class_init (GstElementClass * klass,
|
|
|
|
GstD3D11DecoderClassData * data,
|
|
|
|
const gchar * author);
|
|
|
|
|
|
|
|
void gst_d3d11_decoder_proxy_get_property (GObject * object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue * value,
|
|
|
|
GParamSpec * pspec,
|
|
|
|
GstD3D11DecoderSubClassData * subclass_data);
|
2020-02-14 16:23:32 +00:00
|
|
|
|
2021-10-08 13:37:20 +00:00
|
|
|
gboolean gst_d3d11_decoder_proxy_open (GstVideoDecoder * videodec,
|
|
|
|
GstD3D11DecoderSubClassData * subclass_data,
|
|
|
|
GstD3D11Device ** device,
|
|
|
|
GstD3D11Decoder ** decoder);
|
|
|
|
|
2019-12-26 05:24:46 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __GST_D3D11_DECODER_H__ */
|