summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2018-03-22 14:07:53 +0000
committerTim-Philipp Müller <tim@centricular.com>2018-03-22 14:34:17 +0000
commitb647888dc876dfa54cc06a3aea16194a8b778ae6 (patch)
treeda85aacd3511b70eb1e111816c8e6c38d5221b5a /gst-libs
parent503769e8e3414384f3f1fa46f529f8f265157abb (diff)
downloadgstreamer-plugins-bad-b647888dc876dfa54cc06a3aea16194a8b778ae6.tar.gz
meson: webrtc: use gnome.mkenums_simple() to generate enumtypes files
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/webrtc/meson.build20
-rwxr-xr-xgst-libs/gst/webrtc/webrtc_mkenum.py55
2 files changed, 8 insertions, 67 deletions
diff --git a/gst-libs/gst/webrtc/meson.build b/gst-libs/gst/webrtc/meson.build
index f138fa374..bf0861c3a 100644
--- a/gst-libs/gst/webrtc/meson.build
+++ b/gst-libs/gst/webrtc/meson.build
@@ -25,19 +25,15 @@ webrtc_enumtypes_headers = [
'webrtc_fwd.h',
]
-mkenums = find_program('webrtc_mkenum.py')
-gstwebrtc_h = custom_target('gstwebrtcenum_h',
- output : 'webrtc-enumtypes.h',
- input : webrtc_enumtypes_headers,
- install : true,
- install_dir : 'include/gstreamer-1.0/gst/webrtc/',
- command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
+webrtc_enums = gnome.mkenums_simple('webrtc-enumtypes',
+ sources : webrtc_enumtypes_headers,
+ header_prefix : '#include <gst/webrtc/webrtc_fwd.h>',
+ decorator: 'GST_WEBRTC_API',
+ install_header: true,
+ install_dir : 'include/gstreamer-1.0/gst/webrtc/')
+gstwebrtc_c = webrtc_enums[0]
+gstwebrtc_h = webrtc_enums[1]
-gstwebrtc_c = custom_target('gstwebrtcenum_c',
- output : 'webrtc-enumtypes.c',
- input : webrtc_enumtypes_headers,
- depends : [gstwebrtc_h],
- command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
webrtc_gen_sources = [gstwebrtc_h]
gstwebrtc_dependencies = [gstbase_dep, gstsdp_dep]
diff --git a/gst-libs/gst/webrtc/webrtc_mkenum.py b/gst-libs/gst/webrtc/webrtc_mkenum.py
deleted file mode 100755
index 68a53faf1..000000000
--- a/gst-libs/gst/webrtc/webrtc_mkenum.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/env python3
-
-# This is in its own file rather than inside meson.build
-# because a) mixing the two is ugly and b) trying to
-# make special characters such as \n go through all
-# backends is a fool's errand.
-
-import sys, os, shutil, subprocess
-
-h_array = ['--fhead',
- "#ifndef __GST_WEBRTC_ENUM_TYPES_H__\n#define __GST_WEBRTC_ENUM_TYPES_H__\n\n#include <gst/gst.h>\n#include <gst/webrtc/webrtc_fwd.h>\nG_BEGIN_DECLS\n",
- '--fprod',
- "\n/* enumerations from \"@filename@\" */\n",
- '--vhead',
- "GST_WEBRTC_API GType @enum_name@_get_type (void);\n#define GST_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n",
- '--ftail',
- "G_END_DECLS\n\n#endif /* __GST_WEBRTC_ENUM_TYPES_H__ */"
-]
-
-c_array = ['--fhead',
- "#include \"webrtc-enumtypes.h\"\n\n#include \"webrtc.h\"",
- '--fprod',
- "\n/* enumerations from \"@filename@\" */",
- '--vhead',
- "GType\n@enum_name@_get_type (void)\n{\n static volatile gsize g_define_type_id__volatile = 0;\n if (g_once_init_enter (&g_define_type_id__volatile)) {\n static const G@Type@Value values[] = {",
- '--vprod',
- " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" },",
- '--vtail',
- " { 0, NULL, NULL }\n };\n GType g_define_type_id = g_@type@_register_static (\"@EnumName@\", values);\n g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);\n }\n return g_define_type_id__volatile;\n}\n"
-]
-
-cmd = []
-argn = 1
-# Find the full command needed to run glib-mkenums
-# On UNIX-like, this is just the full path to glib-mkenums
-# On Windows, this is the full path to interpreter + full path to glib-mkenums
-for arg in sys.argv[1:]:
- cmd.append(arg)
- argn += 1
- if arg.endswith('glib-mkenums'):
- break
-ofilename = sys.argv[argn]
-headers = sys.argv[argn + 1:]
-
-if ofilename.endswith('.h'):
- arg_array = h_array
-else:
- arg_array = c_array
-
-cmd_array = cmd + arg_array + headers
-pc = subprocess.Popen(cmd_array, stdout=subprocess.PIPE)
-(stdo, _) = pc.communicate()
-if pc.returncode != 0:
- sys.exit(pc.returncode)
-open(ofilename, 'wb').write(stdo)