2 * Copyright (C) 2020 Seungha Yang <seungha@centricular.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 #ifndef __GST_NV_DECODER_H__
21 #define __GST_NV_DECODER_H__
24 #include <gst/video/video.h>
25 #include "gstcudautils.h"
26 #include "gstcuvidloader.h"
30 #define GST_TYPE_NV_DECODER (gst_nv_decoder_get_type())
31 G_DECLARE_FINAL_TYPE (GstNvDecoder,
32 gst_nv_decoder, GST, NV_DECODER, GstObject);
34 typedef struct _GstNvDecoderFrame
36 /* CUVIDPICPARAMS::CurrPicIdx */
44 GstNvDecoder *decoder;
49 GstNvDecoder * gst_nv_decoder_new (GstCudaContext * context);
51 gboolean gst_nv_decoder_is_configured (GstNvDecoder * decoder);
53 gboolean gst_nv_decoder_configure (GstNvDecoder * decoder,
61 GstNvDecoderFrame * gst_nv_decoder_new_frame (GstNvDecoder * decoder);
63 GstNvDecoderFrame * gst_nv_decoder_frame_ref (GstNvDecoderFrame * frame);
65 void gst_nv_decoder_frame_unref (GstNvDecoderFrame * frame);
67 gboolean gst_nv_decoder_decode_picture (GstNvDecoder * decoder,
68 CUVIDPICPARAMS * params);
70 gboolean gst_nv_decoder_finish_frame (GstNvDecoder * decoder,
71 GstVideoDecoder * videodec,
72 GstNvDecoderFrame *frame,
75 /* utils for class registration */
76 gboolean gst_nv_decoder_check_device_caps (CUcontext cuda_ctx,
78 GstCaps **sink_template,
79 GstCaps **src_template);
81 const gchar * gst_cuda_video_codec_to_string (cudaVideoCodec codec);
84 gboolean gst_nv_decoder_handle_set_context (GstNvDecoder * decoder,
85 GstElement * videodec,
86 GstContext * context);
88 gboolean gst_nv_decoder_handle_context_query (GstNvDecoder * decoder,
89 GstVideoDecoder * videodec,
92 gboolean gst_nv_decoder_negotiate (GstNvDecoder * decoder,
93 GstVideoDecoder * videodec,
94 GstVideoCodecState * input_state,
95 GstVideoCodecState ** output_state);
97 gboolean gst_nv_decoder_decide_allocation (GstNvDecoder * decoder,
98 GstVideoDecoder * videodec,
103 #endif /* __GST_NV_DECODER_H__ */