GStreamer plugin (#195)

* SVT-AV1 GStreamer plugin
This commit is contained in:
Jun 2019-03-29 15:58:56 -07:00 committed by Hassene Tmar
commit 36d5e870f7
3 changed files with 1224 additions and 0 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,57 @@
/*
* Copyright(c) 2019 Intel Corporation
* Authors: Jun Tian <jun.tian@intel.com> Xavier Hallade <xavier.hallade@intel.com>
* SPDX - License - Identifier: LGPL-2.1-or-later
*/
#ifndef _GST_SVTAV1ENC_H_
#define _GST_SVTAV1ENC_H_
#include <string.h>
#include <gst/video/video.h>
#include <gst/video/gstvideoencoder.h>
#include <EbSvtAv1.h>
#include <EbSvtAv1Enc.h>
G_BEGIN_DECLS
#define GST_TYPE_SVTAV1ENC \
(gst_svtav1enc_get_type())
#define GST_SVTAV1ENC(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SVTAV1ENC,GstSvtAv1Enc))
#define GST_SVTAV1ENC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SVTAV1ENC,GstSvtHevcEncClass))
#define GST_IS_SVTAV1ENC(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SVTAV1ENC))
#define GST_IS_SVTAV1ENC_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SVTAV1ENC))
typedef struct _GstSvtAv1Enc
{
GstVideoEncoder video_encoder;
/* SVT-AV1 Encoder Handle */
EbComponentType *svt_encoder;
/* GStreamer Codec state */
GstVideoCodecState *state;
/* SVT-AV1 configuration */
EbSvtAv1EncConfiguration *svt_config;
EbBufferHeaderType *input_buf;
long long int frame_count;
int dts_offset;
} GstSvtAv1Enc;
typedef struct _GstSvtAv1EncClass
{
GstVideoEncoderClass video_encoder_class;
} GstSvtAv1EncClass;
GType gst_svtav1enc_get_type (void);
G_END_DECLS
#endif

View file

@ -0,0 +1,54 @@
# standalone plugin meson configuration
project('gst-svt-av1', 'c',
version : '0.1',
meson_version : '>= 0.29',
default_options : [ 'buildtype=debugoptimized' ])
# standard gst-plugins-bad dependencies and configuration
gst_req = '>= 1.15.1'
gst_dep = dependency('gstreamer-1.0', version : gst_req,
fallback : ['gstreamer', 'gst_dep'])
gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
fallback : ['gstreamer', 'gstbase_dep'])
gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req,
fallback : ['gstreamer', 'gstvideo_dep'])
plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
# common meson configuration
svtav1enc_dep = dependency('SvtAv1Enc')
cc = meson.get_compiler('c')
cc_flags = [
'-O2',
'-D_FORTIFY_SOURCE=2',
'-Wformat',
'-Wformat-security',
'-fPIE',
'-fPIC',
'-fstack-protector-strong',
]
foreach flag: cc_flags
if cc.has_argument(flag)
add_global_arguments(flag, language: 'c')
endif
endforeach
ldflags = [
'-Wl,-z,now',
'-Wl,-z,relro',
'-Wl,-z,noexecstack',
]
foreach lflag : ldflags
add_global_link_arguments(lflag, language : 'c')
endforeach
if svtav1enc_dep.found()
gstsvtav1enc = library('gstsvtav1enc',
'gstsvtav1enc.c',
dependencies: [gstbase_dep, gstvideo_dep, svtav1enc_dep],
install: true,
install_dir: plugins_install_dir,
)
endif