mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
nvcodec: Add H265 stateless codec implementation
Add a new GstCodecs based H265 decoder element Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1357>
This commit is contained in:
parent
1e544f741a
commit
711e964572
4 changed files with 1147 additions and 11 deletions
1068
sys/nvcodec/gstnvh265dec.c
Normal file
1068
sys/nvcodec/gstnvh265dec.c
Normal file
File diff suppressed because it is too large
Load diff
49
sys/nvcodec/gstnvh265dec.h
Normal file
49
sys/nvcodec/gstnvh265dec.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2020 Seungha Yang <seungha@centricular.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_NV_H265_DEC_H__
|
||||
#define __GST_NV_H265_DEC_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/codecs/gsth265decoder.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_NV_H265_DEC (gst_nv_h265_dec_get_type())
|
||||
#define GST_NV_H265_DEC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_NV_H265_DEC, GstNvH265Dec))
|
||||
#define GST_NV_H265_DEC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_NV_H265_DEC, GstNvH265DecClass))
|
||||
#define GST_NV_H265_DEC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_NV_H265_DEC, GstNvH265DecClass))
|
||||
|
||||
typedef struct _GstNvH265Dec GstNvH265Dec;
|
||||
typedef struct _GstNvH265DecClass GstNvH265DecClass;
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
GType gst_nv_h265_dec_get_type (void);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
void gst_nv_h265_dec_register (GstPlugin * plugin,
|
||||
guint device_id,
|
||||
guint rank,
|
||||
GstCaps * sink_caps,
|
||||
GstCaps * src_caps,
|
||||
gboolean is_primary);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_NV_H265_DEC_H__ */
|
|
@ -11,6 +11,7 @@ nvcodec_sources = [
|
|||
'gstcudautils.c',
|
||||
'gstnvdecoder.c',
|
||||
'gstnvh264dec.c',
|
||||
'gstnvh265dec.c',
|
||||
]
|
||||
|
||||
if get_option('nvcodec').disabled()
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "gstnvdec.h"
|
||||
#include "gstnvenc.h"
|
||||
#include "gstnvh264dec.h"
|
||||
#include "gstnvh265dec.h"
|
||||
#include "gstnvdecoder.h"
|
||||
|
||||
GST_DEBUG_CATEGORY (gst_nvcodec_debug);
|
||||
|
@ -54,6 +55,7 @@ plugin_init (GstPlugin * plugin)
|
|||
guint api_minor_ver = 1;
|
||||
const gchar *env;
|
||||
gboolean use_h264_sl_dec = FALSE;
|
||||
gboolean use_h265_sl_dec = FALSE;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_nvcodec_debug, "nvcodec", 0, "nvcodec");
|
||||
GST_DEBUG_CATEGORY_INIT (gst_nvdec_debug, "nvdec", 0, "nvdec");
|
||||
|
@ -103,9 +105,10 @@ plugin_init (GstPlugin * plugin)
|
|||
if (g_ascii_strcasecmp (*iter, "h264") == 0) {
|
||||
GST_INFO ("Found %s in GST_USE_NV_STATELESS_CODEC environment", *iter);
|
||||
use_h264_sl_dec = TRUE;
|
||||
break;
|
||||
} else if (g_ascii_strcasecmp (*iter, "h265") == 0) {
|
||||
GST_INFO ("Found %s in GST_USE_NV_STATELESS_CODEC environment", *iter);
|
||||
use_h265_sl_dec = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
g_strfreev (split);
|
||||
|
@ -147,7 +150,8 @@ plugin_init (GstPlugin * plugin)
|
|||
"src template %" GST_PTR_FORMAT, codec_name,
|
||||
sink_template, src_template);
|
||||
|
||||
if (codec == cudaVideoCodec_H264) {
|
||||
switch (codec) {
|
||||
case cudaVideoCodec_H264:
|
||||
gst_nv_h264_dec_register (plugin,
|
||||
i, GST_RANK_SECONDARY, sink_template, src_template, FALSE);
|
||||
if (use_h264_sl_dec) {
|
||||
|
@ -157,6 +161,20 @@ plugin_init (GstPlugin * plugin)
|
|||
gst_nv_h264_dec_register (plugin,
|
||||
i, GST_RANK_PRIMARY, sink_template, src_template, TRUE);
|
||||
}
|
||||
break;
|
||||
case cudaVideoCodec_HEVC:
|
||||
gst_nv_h265_dec_register (plugin,
|
||||
i, GST_RANK_SECONDARY, sink_template, src_template, FALSE);
|
||||
if (use_h265_sl_dec) {
|
||||
GST_INFO ("Skip register cuvid parser based nvh264dec");
|
||||
register_cuviddec = FALSE;
|
||||
|
||||
gst_nv_h265_dec_register (plugin,
|
||||
i, GST_RANK_PRIMARY, sink_template, src_template, TRUE);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (register_cuviddec) {
|
||||
|
|
Loading…
Reference in a new issue