meson: enable more warnings
diff --git a/ext/dts/meson.build b/ext/dts/meson.build
index 882a6aa..6bbf95a 100644
--- a/ext/dts/meson.build
+++ b/ext/dts/meson.build
@@ -4,10 +4,14 @@
   dca_dep = cc.find_library('dca', required : false)
 endif
 
+# autotools didn't use the libdca pkg-config cflags, and they
+# can point to a non-existing location (/usr/include/dca)
+no_warn_c_args = ['-Wno-missing-include-dirs']
+
 if dca_dep.found()
   gstdtsdec = library('gstdtsdec',
     'gstdtsdec.c',
-    c_args : gst_plugins_bad_args,
+    c_args : gst_plugins_bad_args + no_warn_c_args,
     link_args : noseh_link_args,
     include_directories : [configinc, libsinc],
     dependencies : [gstaudio_dep, orc_dep, dca_dep],
diff --git a/meson.build b/meson.build
index 7a92ef4..88c4fa9 100644
--- a/meson.build
+++ b/meson.build
@@ -269,6 +269,52 @@
 cdata.set_quoted('GST_LICENSE', 'LGPL')
 cdata.set_quoted('LIBDIR', join_paths(get_option('prefix'), get_option('libdir')))
 
+warning_flags = [
+  '-Wmissing-declarations',
+  '-Wredundant-decls',
+  '-Wwrite-strings',
+  '-Wformat',
+  '-Wformat-security',
+  '-Winit-self',
+  '-Wmissing-include-dirs',
+  '-Waddress',
+  '-Wno-multichar',
+  '-Wvla',
+  '-Wpointer-arith',
+]
+
+warning_c_flags = [
+  '-Wmissing-prototypes',
+  '-Wdeclaration-after-statement',
+  '-Wold-style-definition',
+  '-Wnested-externs',
+]
+
+warning_cxx_flags = [
+  '-Wformat-nonliteral',
+]
+
+foreach extra_arg : warning_c_flags
+  if cc.has_argument (extra_arg)
+    add_project_arguments([extra_arg], language: 'c')
+  endif
+endforeach
+
+foreach extra_arg : warning_cxx_flags
+  if cxx.has_argument (extra_arg)
+    add_project_arguments([extra_arg], language: 'cpp')
+  endif
+endforeach
+
+foreach extra_arg : warning_flags
+  if cc.has_argument (extra_arg)
+    add_project_arguments([extra_arg], language: 'c')
+  endif
+  if cxx.has_argument (extra_arg)
+    add_project_arguments([extra_arg], language: 'cpp')
+  endif
+endforeach
+
 # GStreamer package name and origin url
 gst_package_name = get_option('with-package-name')
 if gst_package_name == ''