From 7890a1f8c74240405adcbb4751d782c5aeeb1cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 31 Jan 2023 16:34:33 +0200 Subject: [PATCH] svtav1: Integrate into the build system properly --- subprojects/gst-plugins-bad/ext/meson.build | 1 + .../gst-plugins-bad/ext/svtav1/gstsvtav1enc.c | 19 ++---- .../gst-plugins-bad/ext/svtav1/meson.build | 63 ++++--------------- subprojects/gst-plugins-bad/meson_options.txt | 1 + 4 files changed, 19 insertions(+), 65 deletions(-) diff --git a/subprojects/gst-plugins-bad/ext/meson.build b/subprojects/gst-plugins-bad/ext/meson.build index 31ca793b01..f4fbbaeb67 100644 --- a/subprojects/gst-plugins-bad/ext/meson.build +++ b/subprojects/gst-plugins-bad/ext/meson.build @@ -59,6 +59,7 @@ subdir('soundtouch') subdir('spandsp') subdir('srt') subdir('srtp') +subdir('svtav1') subdir('svthevcenc') subdir('teletextdec') subdir('ttml') diff --git a/subprojects/gst-plugins-bad/ext/svtav1/gstsvtav1enc.c b/subprojects/gst-plugins-bad/ext/svtav1/gstsvtav1enc.c index 31e27bd745..68c958822d 100644 --- a/subprojects/gst-plugins-bad/ext/svtav1/gstsvtav1enc.c +++ b/subprojects/gst-plugins-bad/ext/svtav1/gstsvtav1enc.c @@ -19,6 +19,8 @@ * */ +#include "config.h" + #include #include #include @@ -963,19 +965,6 @@ static gboolean plugin_init(GstPlugin *plugin) { return gst_element_register(plugin, "svtav1enc", GST_RANK_SECONDARY, GST_TYPE_SVTAV1ENC); } -#ifndef VERSION -#define VERSION "1.0" -#endif -#ifndef PACKAGE -#define PACKAGE "gstreamer-svt-av1" -#endif -#ifndef PACKAGE_NAME -#define PACKAGE_NAME "SVT-AV1 Encoder plugin for GStreamer" -#endif -#ifndef GST_PACKAGE_ORIGIN -#define GST_PACKAGE_ORIGIN "https://gitlab.com/AOMediaCodec" -#endif - -GST_PLUGIN_DEFINE(GST_VERSION_MAJOR, GST_VERSION_MINOR, svtav1enc, - "Scalable Video Technology for AV1 Encoder (SVT-AV1 Encoder)", plugin_init, +GST_PLUGIN_DEFINE(GST_VERSION_MAJOR, GST_VERSION_MINOR, svtav1, + "Scalable Video Technology for AV1 (SVT-AV1)", plugin_init, VERSION, "LGPL", PACKAGE_NAME, GST_PACKAGE_ORIGIN) diff --git a/subprojects/gst-plugins-bad/ext/svtav1/meson.build b/subprojects/gst-plugins-bad/ext/svtav1/meson.build index 4955be33d4..202720c911 100644 --- a/subprojects/gst-plugins-bad/ext/svtav1/meson.build +++ b/subprojects/gst-plugins-bad/ext/svtav1/meson.build @@ -1,54 +1,17 @@ -# standalone plugin meson configuration -project('gst-svt-av1', 'c', - version : '0.1', - meson_version : '>= 0.29', - default_options : [ 'buildtype=debugoptimized' ]) - -# GStreamer dependencies -gst_req = '>= 1.16' -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', +svtav1_sources = [ + 'gstsvtav1enc.c', ] -foreach flag: cc_flags - if cc.has_argument(flag) - add_global_arguments(flag, language: 'c') - endif -endforeach +svtav1_dep = dependency('SvtAv1Enc', version : '>= 1.1', required: get_option('svtav1')) -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, - ) +if svtav1_dep.found() + gstsvtav1 = library('gstsvtav1', + svtav1_sources, + c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'], + include_directories : [configinc], + dependencies : [gstbase_dep, gstvideo_dep, svtav1_dep], + install : true, + install_dir : plugins_install_dir, + ) + plugins += [gstsvtav1] endif diff --git a/subprojects/gst-plugins-bad/meson_options.txt b/subprojects/gst-plugins-bad/meson_options.txt index 71fcc800c9..a3962373b9 100644 --- a/subprojects/gst-plugins-bad/meson_options.txt +++ b/subprojects/gst-plugins-bad/meson_options.txt @@ -158,6 +158,7 @@ option('soundtouch', type : 'feature', value : 'auto', description : 'Audio pitc option('spandsp', type : 'feature', value : 'auto', description : 'Packet loss concealment audio plugin') option('srt', type : 'feature', value : 'auto', description : 'Secure, Reliable, Transport client/server network source/sink plugin') option('srtp', type : 'feature', value : 'auto', description : 'Secure RTP codec plugin') +option('svtav1', type : 'feature', value : 'auto', description : 'Scalable Video Technology for AV1 plugin') option('svthevcenc', type : 'feature', value : 'auto', description : 'Scalable Video Technology for HEVC encoder plugin') option('teletext', type : 'feature', value : 'auto', description : 'Teletext plugin') option('tinyalsa', type : 'feature', value : 'auto', description : 'TinyALSA plugin')