[vlc-commits] [Git][videolan/vlc][master] 9 commits: meson: add support for projectM-4

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Apr 21 17:22:36 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
d3392204 by Steve Lhomme at 2026-04-21T16:10:31+00:00
meson: add support for projectM-4

The define is added globally as in autotools.

- - - - -
3f9c0cdc by Steve Lhomme at 2026-04-21T16:10:31+00:00
projectm: remove stray spaces

- - - - -
4e7e7d5e by Steve Lhomme at 2026-04-21T16:10:31+00:00
projectm: fix running on Windows

ProjectM-4 uses glew but never initializes it. See https://github.com/projectM-visualizer/projectm/issues/822

- - - - -
a0526a94 by Steve Lhomme at 2026-04-21T16:10:31+00:00
projectm: disable locale hack for v4

It's using std:locale with the default (classic "C") format.

- - - - -
2b32e46e by Steve Lhomme at 2026-04-21T16:10:31+00:00
contrib: glew: switch to GitHub

It's the same project with a matching hash.

- - - - -
6383e4f8 by Steve Lhomme at 2026-04-21T16:10:31+00:00
contrib: glew: update to 2.3.6

- - - - -
283bf370 by Steve Lhomme at 2026-04-21T16:10:31+00:00
contrib: projectm: update to 4.1.6

- - - - -
0dc4e53a by Steve Lhomme at 2026-04-21T16:10:31+00:00
meson: don't set HAVE_PROJECTM compiler flags globally

It's only used to compile one file.

gnu++14 is not needed with projectM-4 as it's a C API.

- - - - -
fabf83c2 by Steve Lhomme at 2026-04-21T16:10:31+00:00
configure: don't set HAVE_PROJECTM compiler flags globally

It's only used to compile one file.

gnu++14 is not needed with projectM-4 as it's a C API.

- - - - -


24 changed files:

- config.h.meson
- configure.ac
- + contrib/src/glew/0001-Define-GLEW_STATIC-in-pkg-config-file-when-compiled-.patch
- + contrib/src/glew/0002-Link-with-opengl32-on-Windows.patch
- + contrib/src/glew/0003-Link-directly-with-glu32-on-Windows.patch
- + contrib/src/glew/0004-Allow-disabling-the-CMAKE_DEBUG_POSTFIX.patch
- contrib/src/glew/SHA512SUMS
- − contrib/src/glew/glew-drop-debug-postfix.patch
- contrib/src/glew/rules.mak
- + contrib/src/projectM/0001-Always-generate-pkg-config-files.patch
- + contrib/src/projectM/0002-Install-the-regular-projectM-4.pc-for-debug-builds.patch
- + contrib/src/projectM/0003-Require-glew-package-when-building-for-Windows.patch
- + contrib/src/projectM/0004-Do-not-use-the-l-form-of-link-flags.patch
- contrib/src/projectM/SHA512SUMS
- − contrib/src/projectM/clang6.patch
- − contrib/src/projectM/gcc6.patch
- − contrib/src/projectM/missing-includes.patch
- − contrib/src/projectM/projectm-cmake-install.patch
- contrib/src/projectM/rules.mak
- − contrib/src/projectM/win32.patch
- − contrib/src/projectM/win64.patch
- modules/visualization/Makefile.am
- modules/visualization/meson.build
- modules/visualization/projectm.cpp


Changes:

=====================================
config.h.meson
=====================================
@@ -296,9 +296,6 @@
 /* Define to 1 if you have the `posix_memalign' function. */
 #mesondefine HAVE_POSIX_MEMALIGN
 
-/* Define to 1 if using libprojectM 2.x */
-#mesondefine HAVE_PROJECTM2
-
 /* Define to 1 if you have the <pthread.h> header file. */
 #mesondefine HAVE_PTHREAD_H
 


=====================================
configure.ac
=====================================
@@ -4674,14 +4674,14 @@ AS_IF([test "${enable_projectm}" != "no"],
     PKG_CHECK_MODULES(PROJECTM, [projectM-4],
     [
       VLC_ADD_PLUGIN([projectm])
-      AC_DEFINE([HAVE_PROJECTM4], 1, [Define to 1 if using libprojectM 4.x])
+      VLC_ADD_CPPFLAGS([projectm],[-DHAVE_PROJECTM4])
     ],
     [
       PKG_CHECK_MODULES(PROJECTM, [libprojectM],
       [
         VLC_ADD_PLUGIN([projectm])
         PKG_CHECK_EXISTS([libprojectM >= 2.0.0],
-          [ AC_DEFINE([HAVE_PROJECTM2], 1, [Define to 1 if using libprojectM 2.x]) ],
+          [ VLC_ADD_CPPFLAGS([projectm],[-DHAVE_PROJECTM2 -std=gnu++14]) ],
           [ AC_MSG_WARN( [Using libprojectM version 1] ) ]
         )
       ],


=====================================
contrib/src/glew/0001-Define-GLEW_STATIC-in-pkg-config-file-when-compiled-.patch
=====================================
@@ -0,0 +1,30 @@
+From ff48c25db79dcaaf1b9ec89af9f085b2541cba57 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Wed, 15 Apr 2026 13:47:23 +0200
+Subject: [PATCH 1/4] Define GLEW_STATIC in pkg-config file when compiled
+ statically
+
+---
+ build/cmake/CMakeLists.txt | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt
+index 7b7f8b4..d4eb8a5 100644
+--- a/build/cmake/CMakeLists.txt
++++ b/build/cmake/CMakeLists.txt
+@@ -219,7 +219,11 @@ set (libdir ${CMAKE_INSTALL_FULL_LIBDIR})
+ set (includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR})
+ set (version ${GLEW_VERSION})
+ set (libname ${GLEW_LIB_NAME})
+-set (cflags)
++if(BUILD_SHARED_LIBS)
++  set (cflags)
++else()
++  set (cflags -DGLEW_STATIC)
++endif ()
+ set (requireslib glu)
+ 
+ #  Mac OSX has no glu.pc unless optional X11/GLX is installed
+-- 
+2.52.0.windows.1
+


=====================================
contrib/src/glew/0002-Link-with-opengl32-on-Windows.patch
=====================================
@@ -0,0 +1,26 @@
+From 0f272be0aaf41e7225188ff44750399bbf5c78d9 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Wed, 15 Apr 2026 13:54:45 +0200
+Subject: [PATCH 2/4] Link with opengl32 on Windows
+
+---
+ build/cmake/CMakeLists.txt | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt
+index d4eb8a5..6c83c50 100644
+--- a/build/cmake/CMakeLists.txt
++++ b/build/cmake/CMakeLists.txt
+@@ -224,6 +224,9 @@ if(BUILD_SHARED_LIBS)
+ else()
+   set (cflags -DGLEW_STATIC)
+ endif ()
++if (WIN32)
++  set (libgl -lopengl32)
++endif ()
+ set (requireslib glu)
+ 
+ #  Mac OSX has no glu.pc unless optional X11/GLX is installed
+-- 
+2.52.0.windows.1
+


=====================================
contrib/src/glew/0003-Link-directly-with-glu32-on-Windows.patch
=====================================
@@ -0,0 +1,28 @@
+From a4f97da1d0753ba570db3265077f100c3306f137 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Wed, 15 Apr 2026 13:44:24 +0200
+Subject: [PATCH 3/4] Link directly with glu32 on Windows
+
+---
+ build/cmake/CMakeLists.txt | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt
+index 6c83c50..8bcd803 100644
+--- a/build/cmake/CMakeLists.txt
++++ b/build/cmake/CMakeLists.txt
+@@ -233,6 +233,11 @@ set (requireslib glu)
+ if (APPLE)
+   set (requireslib)
+ endif ()
++if (WIN32)
++  # Windows/mingw-w64 doesn't have a glu.pc but has libglu32.a
++  set (requireslib)
++  set (libgl "${libgl} -lglu32")
++endif()
+ 
+ configure_file (${GLEW_DIR}/glew.pc.in ${CMAKE_CURRENT_BINARY_DIR}/glew.pc @ONLY)
+ 
+-- 
+2.52.0.windows.1
+


=====================================
contrib/src/glew/0004-Allow-disabling-the-CMAKE_DEBUG_POSTFIX.patch
=====================================
@@ -0,0 +1,25 @@
+From e19b0eb3bad3305586a21eeeb8f1f3d99c09c8af Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Wed, 15 Apr 2026 13:58:45 +0200
+Subject: [PATCH 4/4] Allow disabling the CMAKE_DEBUG_POSTFIX
+
+---
+ build/cmake/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt
+index 8bcd803..4970272 100644
+--- a/build/cmake/CMakeLists.txt
++++ b/build/cmake/CMakeLists.txt
+@@ -7,7 +7,7 @@ endif ()
+ 
+ include(GNUInstallDirs)
+ 
+-set(CMAKE_DEBUG_POSTFIX d)
++set(CMAKE_DEBUG_POSTFIX d CACHE STRING "")
+ 
+ option (BUILD_UTILS "utilities" ON)
+ option (GLEW_REGAL "Regal mode" OFF)
+-- 
+2.52.0.windows.1
+


=====================================
contrib/src/glew/SHA512SUMS
=====================================
@@ -1 +1 @@
-9a9b4d81482ccaac4b476c34ed537585ae754a82ebb51c3efa16d953c25cc3931be46ed2e49e79c730cd8afc6a1b78c97d52cd714044a339c3bc29734cd4d2ab  glew-2.1.0.tgz
+cb4caecf32ec0f180c2691dc7769ffc99571c64f259a2663a2b80e788f1c2fd5362c59e0caaeefed6fb78a4070366d244666a657358049b09071b59fae2377e0  glew-2.3.1.tgz


=====================================
contrib/src/glew/glew-drop-debug-postfix.patch deleted
=====================================
@@ -1,11 +0,0 @@
---- glew.pristine/build/cmake/CMakeLists.txt	2017-07-31 14:25:39.000000000 +0300
-+++ glew/build/cmake/CMakeLists.txt	2019-10-27 06:26:55.413590264 +0300
-@@ -13,8 +13,6 @@
-   cmake_policy (SET CMP0042 NEW)
- endif()
- 
--set(CMAKE_DEBUG_POSTFIX d)
--
- option (BUILD_UTILS "utilities" ON)
- option (GLEW_REGAL "Regal mode" OFF)
- option (GLEW_OSMESA "OSMesa mode" OFF)


=====================================
contrib/src/glew/rules.mak
=====================================
@@ -1,6 +1,6 @@
 # GLEW
-GLEW_VERSION := 2.1.0
-GLEW_URL := $(SF)/glew/glew/$(GLEW_VERSION)/glew-$(GLEW_VERSION).tgz
+GLEW_VERSION := 2.3.1
+GLEW_URL := $(GITHUB)/nigels-com/glew/releases/download/glew-$(GLEW_VERSION)/glew-$(GLEW_VERSION).tgz
 
 ifeq ($(call need_pkg,"glew"),)
 PKGS_FOUND += glew
@@ -13,12 +13,17 @@ $(TARBALLS)/glew-$(GLEW_VERSION).tgz:
 
 glew: glew-$(GLEW_VERSION).tgz .sum-glew
 	$(UNPACK)
-	$(APPLY) $(SRC)/glew/glew-drop-debug-postfix.patch
+	$(APPLY) $(SRC)/glew/0001-Define-GLEW_STATIC-in-pkg-config-file-when-compiled-.patch
+	$(APPLY) $(SRC)/glew/0002-Link-with-opengl32-on-Windows.patch
+	$(APPLY) $(SRC)/glew/0003-Link-directly-with-glu32-on-Windows.patch
+	$(APPLY) $(SRC)/glew/0004-Allow-disabling-the-CMAKE_DEBUG_POSTFIX.patch
 	$(MOVE)
 
+GLEW_CONF := -DBUILD_UTILS=OFF
+
 .glew: glew toolchain.cmake
 	$(CMAKECLEAN)
-	$(HOSTVARS_CMAKE) $(CMAKE) -S $</build/cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5
+	$(HOSTVARS_CMAKE) $(CMAKE) -S $</build/cmake $(GLEW_CONF)
 	+$(CMAKEBUILD)
 	$(CMAKEINSTALL)
 	touch $@


=====================================
contrib/src/projectM/0001-Always-generate-pkg-config-files.patch
=====================================
@@ -0,0 +1,56 @@
+From a45445c0db5fd48638e04cc17d639996d5b169f2 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Wed, 15 Apr 2026 07:59:45 +0200
+Subject: [PATCH 1/4] Always generate pkg-config files
+
+They can also be used in Windows environments using UNIX toolchains (msys2, WSL cross-compilation, etc).
+---
+ cmake/GeneratePkgConfigFiles.cmake | 4 ++--
+ src/libprojectM/CMakeLists.txt     | 4 ++--
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/cmake/GeneratePkgConfigFiles.cmake b/cmake/GeneratePkgConfigFiles.cmake
+index 640c595ac..1bb9b5aab 100644
+--- a/cmake/GeneratePkgConfigFiles.cmake
++++ b/cmake/GeneratePkgConfigFiles.cmake
+@@ -1,6 +1,6 @@
+ macro(GENERATE_PKG_CONFIG_FILES target package_name)
+ 
+-    if(UNIX)
++    # if(UNIX)
+         macro(set_pkg_config_path varname path)
+             if(IS_ABSOLUTE "${path}")
+                 set(${varname} "${path}")
+@@ -49,6 +49,6 @@ macro(GENERATE_PKG_CONFIG_FILES target package_name)
+         unset(_lib_name)
+         unset(_output_name)
+         unset(_exported_defines)
+-    endif()
++    # endif()
+ 
+ endmacro()
+\ No newline at end of file
+diff --git a/src/libprojectM/CMakeLists.txt b/src/libprojectM/CMakeLists.txt
+index 134850496..ce4b5623e 100644
+--- a/src/libprojectM/CMakeLists.txt
++++ b/src/libprojectM/CMakeLists.txt
+@@ -198,7 +198,7 @@ if(ENABLE_INSTALL)
+             )
+ 
+     # pkg-config export, only supported on UNIX systems.
+-    if(UNIX)
++#     if(UNIX)
+         include(GeneratePkgConfigFiles)
+ 
+         if(ENABLE_BOOST_FILESYSTEM)
+@@ -216,6 +216,6 @@ if(ENABLE_INSTALL)
+ 
+         generate_pkg_config_files(projectM ${PROJECTM_LIBRARY_BASE_OUTPUT_NAME})
+ 
+-    endif()
++#     endif()
+ 
+ endif()
+-- 
+2.52.0.windows.1
+


=====================================
contrib/src/projectM/0002-Install-the-regular-projectM-4.pc-for-debug-builds.patch
=====================================
@@ -0,0 +1,24 @@
+From bea63f445fbe7e9c4ddd3d6a9f47ecf6a3a2cbf1 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Wed, 15 Apr 2026 08:06:57 +0200
+Subject: [PATCH 2/4] Install the regular projectM-4.pc for debug builds
+
+---
+ cmake/GeneratePkgConfigFiles.cmake | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/cmake/GeneratePkgConfigFiles.cmake b/cmake/GeneratePkgConfigFiles.cmake
+index 1bb9b5aab..ba3efc8fb 100644
+--- a/cmake/GeneratePkgConfigFiles.cmake
++++ b/cmake/GeneratePkgConfigFiles.cmake
+@@ -32,7 +32,6 @@ macro(GENERATE_PKG_CONFIG_FILES target package_name)
+         set(PKGCONFIG_PACKAGE_REQUIREMENTS "${PKGCONFIG_PACKAGE_REQUIREMENTS_ALL} ${PKGCONFIG_PACKAGE_REQUIREMENTS_RELEASE}")
+         configure_file(${PROJECTM_SOURCE_DIR}/cmake/pkgconfig-file.in "${CMAKE_CURRENT_BINARY_DIR}/${package_name}.pc" @ONLY)
+         install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${package_name}.pc"
+-                CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
+                 DESTINATION "${PROJECTM_LIB_DIR}/pkgconfig"
+                 COMPONENT Devel
+                 )
+-- 
+2.52.0.windows.1
+


=====================================
contrib/src/projectM/0003-Require-glew-package-when-building-for-Windows.patch
=====================================
@@ -0,0 +1,30 @@
+From b8ac3c3770497781f9ac993c25e2e1e1af31575c Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Wed, 15 Apr 2026 08:20:52 +0200
+Subject: [PATCH 3/4] Require glew package when building for Windows
+
+This is the same condition as in the main CMakeLists.txt.
+---
+ src/libprojectM/CMakeLists.txt | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/libprojectM/CMakeLists.txt b/src/libprojectM/CMakeLists.txt
+index ce4b5623e..de0088b49 100644
+--- a/src/libprojectM/CMakeLists.txt
++++ b/src/libprojectM/CMakeLists.txt
+@@ -212,7 +212,11 @@ if(ENABLE_INSTALL)
+ 
+         set(PKGCONFIG_PACKAGE_NAME "${PROJECTM_LIBRARY_BASE_OUTPUT_NAME}")
+         set(PKGCONFIG_PACKAGE_DESCRIPTION "projectM Music Visualizer")
+-        set(PKGCONFIG_PACKAGE_REQUIREMENTS_ALL "opengl")
++        if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
++                set(PKGCONFIG_PACKAGE_REQUIREMENTS_ALL "glew")
++        else()
++                set(PKGCONFIG_PACKAGE_REQUIREMENTS_ALL "opengl")
++        endif()
+ 
+         generate_pkg_config_files(projectM ${PROJECTM_LIBRARY_BASE_OUTPUT_NAME})
+ 
+-- 
+2.52.0.windows.1
+


=====================================
contrib/src/projectM/0004-Do-not-use-the-l-form-of-link-flags.patch
=====================================
@@ -0,0 +1,23 @@
+From 46d9c5d5f9bac205a80389a4bcd9fb5879ed4e17 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Wed, 15 Apr 2026 08:35:04 +0200
+Subject: [PATCH 4/4] Do not use the -l: form of link flags
+
+---
+ cmake/pkgconfig-file.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cmake/pkgconfig-file.in b/cmake/pkgconfig-file.in
+index fc27c9e17..8a2b9c8b0 100644
+--- a/cmake/pkgconfig-file.in
++++ b/cmake/pkgconfig-file.in
+@@ -9,5 +9,5 @@ Name: @PKGCONFIG_PACKAGE_NAME@
+ Version: @PROJECT_VERSION@
+ Description: @PKGCONFIG_PACKAGE_DESCRIPTION@
+ Requires: @PKGCONFIG_PACKAGE_REQUIREMENTS@
+-Libs: -L${libdir} -l:@PKGCONFIG_PROJECTM_LIBRARY@ @PKGCONFIG_LIBS@
++Libs: -L${libdir} -l at PKGCONFIG_PROJECTM_LIBRARY@ @PKGCONFIG_LIBS@
+ Cflags: -I${includedir} @PKGCONFIG_FLAGS@
+-- 
+2.52.0.windows.1
+


=====================================
contrib/src/projectM/SHA512SUMS
=====================================
@@ -1 +1 @@
-0edbf487d45983b0004ee67009931da985f3b9909cb10eb32a2c9116eed46f9cf9c7a1c696138d16a30aedd81d43ac5533fb7666c9fba9326c9c89f4e87f88db  projectM-2.0.1-Source.tar.gz
+8fe729c61c9799b4054add813daea4c2e6dca8ec499c5b3f1c0486a8b1a4b5be88309a7f497de9f819e317d5858e7bf1b2c44347e3adbddb7c2dad1b045859c8  libprojectM-4.1.6.tar.gz


=====================================
contrib/src/projectM/clang6.patch deleted
=====================================
@@ -1,18 +0,0 @@
-diff -urN projectM-orig/Renderer/VideoEcho.cpp projectM/Renderer/VideoEcho.cpp
---- projectM-orig/Renderer/VideoEcho.cpp	2009-12-06 03:42:51.000000000 +0200
-+++ projectM/Renderer/VideoEcho.cpp	2018-03-29 23:56:45.852289647 +0300
-@@ -74,10 +74,10 @@
- 			default: flipx=1;flipy=1; break;
- 		}
- 
--		float pointsFlip[4][2] = {{-0.5*flipx, -0.5*flipy},
--					  {-0.5*flipx,  0.5*flipy},
--					  { 0.5*flipx,  0.5*flipy},
--					  { 0.5*flipx, -0.5*flipy}};
-+		float pointsFlip[4][2] = {{-0.5f*flipx, -0.5f*flipy},
-+					  {-0.5f*flipx,  0.5f*flipy},
-+					  { 0.5f*flipx,  0.5f*flipy},
-+					  { 0.5f*flipx, -0.5f*flipy}};
- 
- 		glVertexPointer(2,GL_FLOAT,0,pointsFlip);
- 		glDrawArrays(GL_TRIANGLE_FAN,0,4);


=====================================
contrib/src/projectM/gcc6.patch deleted
=====================================
@@ -1,60 +0,0 @@
-diff -ruN projectM-2.0.1-Source.old/Common.hpp projectM-2.0.1-Source/Common.hpp
---- projectM-2.0.1-Source.old/Common.hpp	2016-08-06 10:57:57.678183788 +0200
-+++ projectM-2.0.1-Source/Common.hpp	2016-08-06 11:01:06.714192806 +0200
-@@ -55,7 +55,7 @@
- 
- #ifdef LINUX
- #include <cstdlib>
--#define projectM_isnan isnan
-+#define projectM_isnan std::isnan
- 
- #endif
- 
-diff -ruN projectM-2.0.1-Source.old/MilkdropPresetFactory/Parser.cpp projectM-2.0.1-Source/MilkdropPresetFactory/Parser.cpp
---- projectM-2.0.1-Source.old/MilkdropPresetFactory/Parser.cpp	2016-08-06 10:57:57.690183788 +0200
-+++ projectM-2.0.1-Source/MilkdropPresetFactory/Parser.cpp	2016-08-06 10:58:47.634186171 +0200
-@@ -1405,7 +1405,7 @@
-   PerFrameEqn * per_frame_eqn;
-   GenExpr * gen_expr;
- 
--  if (fs == NULL)
-+  if (fs.fail())
-     return NULL;
-   if (param_string == NULL)
-     return NULL;
-@@ -1560,7 +1560,7 @@
- 
-   if (preset == NULL)
-     return NULL;
--  if (fs == NULL)
-+  if (fs.fail())
-     return NULL;
- 
-   if ((token = parseToken(fs, name)) != tEq)
-@@ -1874,7 +1874,7 @@
-   /* Null argument checks */
-   if (preset == NULL)
-     return PROJECTM_FAILURE;
--  if (fs == NULL)
-+  if (fs.fail())
-     return PROJECTM_FAILURE;
-   if (token == NULL)
-     return PROJECTM_FAILURE;
-@@ -2165,7 +2165,7 @@
- 
-   if (token == NULL)
-     return PROJECTM_FAILURE;
--  if (fs == NULL)
-+  if (fs.fail())
-     return PROJECTM_FAILURE;
-   if (preset == NULL)
-     return PROJECTM_FAILURE;
-@@ -2347,7 +2347,7 @@
-   if (token == NULL)
- 
-     return PROJECTM_FAILURE;
--  if (fs == NULL)
-+  if (fs.fail())
-     return PROJECTM_FAILURE;
-   if (preset == NULL)
-     return PROJECTM_FAILURE;


=====================================
contrib/src/projectM/missing-includes.patch deleted
=====================================
@@ -1,10 +0,0 @@
---- projectM/Renderer/Waveform.cpp.orig	2022-04-27 10:54:35.706616587 +0300
-+++ projectM/Renderer/Waveform.cpp	2022-04-27 10:54:43.374663065 +0300
-@@ -17,6 +17,7 @@
- 
- #include "Waveform.hpp"
- #include <algorithm>
-+#include <functional>
- #include "BeatDetect.hpp"
- 
- Waveform::Waveform(int samples)


=====================================
contrib/src/projectM/projectm-cmake-install.patch deleted
=====================================
@@ -1,14 +0,0 @@
---- projectM/MilkdropPresetFactory/CMakeLists.txt.orig	2022-09-13 09:39:32.537914700 +0200
-+++ projectM/MilkdropPresetFactory/CMakeLists.txt	2022-09-13 09:39:11.108002400 +0200
-@@ -17,3 +17,4 @@ LINK_DIRECTORIES(${projectM_BINARY_DIR}
- ADD_LIBRARY(MilkdropPresetFactory STATIC ${MilkdropPresetFactory_SOURCES})
- SET_TARGET_PROPERTIES(MilkdropPresetFactory PROPERTIES VERSION 2.00 SOVERSION 2)
- TARGET_LINK_LIBRARIES(MilkdropPresetFactory Renderer)
-+INSTALL(TARGETS MilkdropPresetFactory LIBRARY)
---- projectM/Renderer/CMakeLists.txt.orig	2022-09-13 09:39:40.281885500 +0200
-+++ projectM/Renderer/CMakeLists.txt	2022-09-13 09:39:07.123633100 +0200
-@@ -11,3 +11,4 @@ INCLUDE_DIRECTORIES(${projectM_SOURCE_DI
- ADD_LIBRARY(Renderer STATIC ${Renderer_SOURCES})
- SET_TARGET_PROPERTIES(Renderer PROPERTIES VERSION 2.00 SOVERSION 2)
- TARGET_LINK_LIBRARIES(Renderer m)
-+INSTALL(TARGETS Renderer LIBRARY)


=====================================
contrib/src/projectM/rules.mak
=====================================
@@ -1,6 +1,6 @@
 # PROJECTM
-PROJECTM_VERSION := 2.0.1
-PROJECTM_URL := $(SF)/projectm/$(PROJECTM_VERSION)/projectM-$(PROJECTM_VERSION)-Source.tar.gz
+PROJECTM_VERSION := 4.1.6
+PROJECTM_URL := $(GITHUB)/projectM-visualizer/projectm/releases/download/v$(PROJECTM_VERSION)/libprojectM-$(PROJECTM_VERSION).tar.gz
 
 ifdef HAVE_WIN32
 ifneq ($(ARCH),arm)
@@ -11,39 +11,28 @@ endif
 endif
 endif
 endif
-ifeq ($(call need_pkg,"libprojectM"),)
+ifeq ($(call need_pkg,"projectM-4"),)
 PKGS_FOUND += projectM
 endif
 
 DEPS_projectM = glew $(DEPS_glew)
 
-$(TARBALLS)/projectM-$(PROJECTM_VERSION)-Source.tar.gz:
+$(TARBALLS)/libprojectM-$(PROJECTM_VERSION).tar.gz:
 	$(call download_pkg,$(PROJECTM_URL),projectM)
 
-.sum-projectM: projectM-$(PROJECTM_VERSION)-Source.tar.gz
+.sum-projectM: libprojectM-$(PROJECTM_VERSION).tar.gz
 
-projectM: projectM-$(PROJECTM_VERSION)-Source.tar.gz .sum-projectM
+projectM: libprojectM-$(PROJECTM_VERSION).tar.gz .sum-projectM
 	$(UNPACK)
-ifdef HAVE_WIN64
-	$(APPLY) $(SRC)/projectM/win64.patch
-endif
-ifdef HAVE_WIN32
-	$(APPLY) $(SRC)/projectM/win32.patch
-endif
-	$(APPLY) $(SRC)/projectM/gcc6.patch
-	$(APPLY) $(SRC)/projectM/clang6.patch
-	$(APPLY) $(SRC)/projectM/missing-includes.patch
-	$(APPLY) $(SRC)/projectM/projectm-cmake-install.patch
-	# remove enforced CMP0005 incompatible with recent CMake
-	sed -i.orig 's,cmake_policy(,# cmake_policy(,' "$(UNPACK_DIR)/CMakeLists.txt"
+	$(APPLY) $(SRC)/projectM/0001-Always-generate-pkg-config-files.patch
+	$(APPLY) $(SRC)/projectM/0002-Install-the-regular-projectM-4.pc-for-debug-builds.patch
+	$(APPLY) $(SRC)/projectM/0003-Require-glew-package-when-building-for-Windows.patch
+	$(APPLY) $(SRC)/projectM/0004-Do-not-use-the-l-form-of-link-flags.patch
 	$(MOVE)
 
 PROJECTM_CONF := \
-		-DCMAKE_CXX_STANDARD=98 \
-		-DDISABLE_NATIVE_PRESETS:BOOL=ON \
-		-DUSE_FTGL:BOOL=OFF \
-		-DBUILD_PROJECTM_STATIC:BOOL=ON \
-		-DCMAKE_POLICY_VERSION_MINIMUM=3.5
+		-DENABLE_DEBUG_POSTFIX:BOOL=OFF \
+		-DENABLE_PLAYLIST:BOOL=OFF
 
 .projectM: projectM toolchain.cmake
 	$(CMAKECLEAN)


=====================================
contrib/src/projectM/win32.patch deleted
=====================================
@@ -1,264 +0,0 @@
-diff -ruN libprojectM/Renderer/TextureManager.cpp libprojectM.new/Renderer/TextureManager.cpp
---- libprojectM/Renderer/TextureManager.cpp	2009-12-01 07:38:42.000000000 +0100
-+++ libprojectM.new/Renderer/TextureManager.cpp	2009-12-03 23:28:44.000000000 +0100
-@@ -59,7 +59,7 @@
- 	ilLoadL(IL_TYPE_UNKNOWN,(ILvoid*) M_data, M_bytes);
- 	GLuint tex = ilutGLBindTexImage();
- #else
--	 uint tex = SOIL_load_OGL_texture_from_memory(
-+	 unsigned int tex = SOIL_load_OGL_texture_from_memory(
- 					  M_data,
- 					  M_bytes,
- 					  SOIL_LOAD_AUTO,
-@@ -173,7 +173,7 @@
- #else
-        int width, height;
- 
--       uint tex = SOIL_load_OGL_texture_size(
-+       unsigned int tex = SOIL_load_OGL_texture_size(
-     		   imageURL.c_str(),
- 					  SOIL_LOAD_AUTO,
- 					  SOIL_CREATE_NEW_ID,
-diff -ruN libprojectM/win32-dirent.h libprojectM.new/win32-dirent.h
---- libprojectM/win32-dirent.h	2009-12-01 07:38:42.000000000 +0100
-+++ libprojectM.new/win32-dirent.h	2009-12-03 23:29:13.000000000 +0100
-@@ -19,7 +19,7 @@
- 
- typedef struct DIR DIR;
- 
--static int errno;
-+//static int errno;
- 
- struct dirent
- {
-diff -ruN libprojectM/PresetLoader.hpp libprojectM.new2/PresetLoader.hpp
---- libprojectM/PresetLoader.hpp	2009-12-01 07:38:42.000000000 +0100
-+++ libprojectM.new2/PresetLoader.hpp	2009-12-04 00:29:20.000000000 +0100
-@@ -6,7 +6,7 @@
- #include <sys/types.h>
- 
- #ifdef WIN32
--#include "win32-dirent.h"
-+#include <dirent.h>
- #endif
- 
- #ifdef LINUX
-diff -ruN libprojectM/projectM.cpp libprojectM.new2/projectM.cpp
---- libprojectM/projectM.cpp	2009-12-01 07:38:42.000000000 +0100
-+++ libprojectM.new2/projectM.cpp	2009-12-04 00:28:29.000000000 +0100
-@@ -24,9 +24,6 @@
- #include "fatal.h"
- #include "Common.hpp"
- 
--#ifdef WIN32
--#include "win32-dirent.h"
--#endif
- 
- #include "timer.h"
- #include <iostream>
-diff -ruN libprojectM/projectM.hpp libprojectM.new2/projectM.hpp
---- libprojectM/projectM.hpp	2009-12-01 07:38:42.000000000 +0100
-+++ libprojectM.new2/projectM.hpp	2009-12-04 00:28:22.000000000 +0100
-@@ -29,11 +29,7 @@
- #ifndef _PROJECTM_HPP
- #define _PROJECTM_HPP
- 
--#ifdef WIN32
--#include "win32-dirent.h"
--#else
- #include <dirent.h>
--#endif /** WIN32 */
- #include <cmath>
- #include <cstdio>
- #include <string>
-
---- libprojectM/CMakeLists.txt	2009-12-01 07:38:42.000000000 +0100
-+++ libprojectM.new/CMakeLists.txt	2009-12-04 00:34:12.000000000 +0100
-@@ -121,15 +121,13 @@
- 
- SET_TARGET_PROPERTIES(projectM PROPERTIES VERSION 2.00 SOVERSION 2)
- 
--ADD_DEFINITIONS(-DUSE_THREADS)
--
- if (APPLE)
- ADD_DEFINITIONS(-DMACOS -DSTBI_NO_DDS -DUSE_THREADS)
- set(RESOURCE_PREFIX "Resources")
- else (APPLE)
- if (WIN32)
- set (RESOURCE_PREFIX "Resources")
--ADD_DEFINITIONS(-DWIN32 -DSTBI_NO_DDS -DUSE_THREADS)
-+ADD_DEFINITIONS(-DWIN32 -DSTBI_NO_DDS )
- else(WIN32)
- set (RESOURCE_PREFIX "share/projectM")
- ADD_DEFINITIONS(-DLINUX -DSTBI_NO_DDS -DUSE_THREADS)
---- libprojectM.new/CMakeLists.txt	2009-12-04 00:34:12.000000000 +0100
-+++ libprojectM/CMakeLists.txt	2009-12-04 09:04:54.000000000 +0100
-@@ -62,6 +62,8 @@
- SET(PRESET_FACTORY_SOURCES ${PRESET_FACTORY_SOURCES} ${NativePresetFactory_SOURCE_DIR})
- SET(PRESET_FACTORY_BINARY_DIR ${PRESET_FACTORY_BINARY_DIR} ${NativePresetFactory_BINARY_DIR})
- SET(PRESET_FACTORY_LINK_TARGETS ${PRESET_FACTORY_LINK_TARGETS} NativePresetFactory)
-+else (NOT DISABLE_NATIVE_PRESETS)
-+ADD_DEFINITIONS(-DDISABLE_NATIVE_PRESETS)
- endif(NOT DISABLE_NATIVE_PRESETS)
- 
- if (NOT DISABLE_MILKDROP_PRESETS)
-@@ -114,6 +116,7 @@
- endif(COMMAND cmake_policy)
- 
- if (BUILD_PROJECTM_STATIC)
-+ADD_DEFINITIONS(-DGLEW_STATIC)
- ADD_LIBRARY(projectM STATIC ${projectM_SOURCES})
- else(BUILD_PROJECTM_STATIC)
- ADD_LIBRARY(projectM SHARED ${projectM_SOURCES})
---- libprojectM.new/libprojectM.pc.in	2009-12-04 00:33:48.000000000 +0100
-+++ libprojectM/libprojectM.pc.in	2009-12-04 08:59:27.000000000 +0100
-@@ -9,5 +9,5 @@
- Version: 2.0.0
- Description: projectM - OpenGL Milkdrop
- Requires:
--Libs: -L${libdir} -lprojectM 
-+Libs: -L${libdir} -lprojectM -lglu32 -lglew32 -lopengl32
- Cflags: -I${includedir} 
---- libprojectM/libprojectM.pc.in	2009-12-04 09:55:20.000000000 +0100
-+++ libprojectM.new/libprojectM.pc.in	2009-12-04 09:54:55.000000000 +0100
-@@ -9,5 +9,5 @@
- Version: 2.0.0
- Description: projectM - OpenGL Milkdrop
- Requires:
--Libs: -L${libdir} -lprojectM -lglu32 -lglew32 -lopengl32
-+Libs: -L${libdir} -lprojectM ${libdir}/libMilkdropPresetFactory.a ${libdir}/libRenderer.a  ${libdir}/libprojectM.a -lglu32 -lglew32 -lopengl32
- Cflags: -I${includedir} 
-diff -ruN libprojectM.new/libprojectM.pc.in libprojectM/libprojectM.pc.in
---- libprojectM.new/libprojectM.pc.in	2009-12-04 09:54:55.000000000 +0100
-+++ libprojectM/libprojectM.pc.in	2009-12-04 10:15:18.000000000 +0100
-@@ -1,6 +1,6 @@
- prefix=@CMAKE_INSTALL_PREFIX@
- exec_prefix=@CMAKE_INSTALL_PREFIX@
--libdir=@LIB_INSTALL_DIR@
-+libdir=@CMAKE_INSTALL_PREFIX@/lib
- includedir=@CMAKE_INSTALL_PREFIX@/include
- pkgdatadir=@CMAKE_INSTALL_PREFIX@/@RESOURCE_PREFIX@
- sysconfdir=@CMAKE_INSTALL_PREFIX@/@RESOURCE_PREFIX@
-@@ -9,5 +9,5 @@
- Version: 2.0.0
- Description: projectM - OpenGL Milkdrop
- Requires:
--Libs: -L${libdir} -lprojectM ${libdir}/libMilkdropPresetFactory.a ${libdir}/libRenderer.a  ${libdir}/libprojectM.a -lglu32 -lglew32 -lopengl32
-+Libs: -L${libdir} -lprojectM -lMilkdropPresetFactory -lRenderer -lglu32 -lglew32 -lopengl32
- Cflags: -I${includedir} 
-diff -ruN libprojectM.new/MilkdropPresetFactory/CMakeLists.txt libprojectM/MilkdropPresetFactory/CMakeLists.txt
---- libprojectM.new/MilkdropPresetFactory/CMakeLists.txt	2009-12-01 07:38:42.000000000 +0100
-+++ libprojectM/MilkdropPresetFactory/CMakeLists.txt	2009-12-04 10:26:42.000000000 +0100
-@@ -5,7 +5,11 @@
-       cmake_policy(SET CMP0003 NEW)
-     endif(COMMAND cmake_policy)
- 
--SET(MilkdropPresetFactory_SOURCES BuiltinFuncs.cpp Func.cpp MilkdropPreset.cpp Param.hpp PresetFrameIO.cpp CustomShape.cpp  Eval.cpp MilkdropPresetFactory.cpp PerPixelEqn.cpp BuiltinParams.cpp InitCond.cpp Parser.cpp CustomWave.cpp Expr.cpp PerPointEqn.cpp Param.cpp PerFrameEqn.cpp IdlePreset.cpp)
-+SET(MilkdropPresetFactory_SOURCES BuiltinFuncs.cpp Func.cpp MilkdropPreset.cpp
-+        Param.hpp PresetFrameIO.cpp CustomShape.cpp  Eval.cpp
-+        MilkdropPresetFactory.cpp PerPixelEqn.cpp BuiltinParams.cpp
-+        InitCond.cpp Parser.cpp CustomWave.cpp Expr.cpp PerPointEqn.cpp
-+        Param.cpp PerFrameEqn.cpp IdlePreset.cpp ../PresetFactory.cpp )
- 
- SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
- 
-diff -ruN libprojectM.new/Renderer/Renderer.cpp libprojectM/Renderer/Renderer.cpp
---- libprojectM.new/Renderer/Renderer.cpp	2009-12-01 07:38:42.000000000 +0100
-+++ libprojectM/Renderer/Renderer.cpp	2009-12-04 10:21:38.000000000 +0100
-@@ -222,7 +222,7 @@
- 	glTranslatef(-0.5, -0.5, 0);
- 
- 	// When console refreshes, there is a chance the preset has been changed by the user
--	refreshConsole();
-+	//refreshConsole();
- 	draw_title_to_screen(false);
- 	if (this->showhelp % 2)
- 		draw_help();
-diff -ruN libprojectM/RandomNumberGenerators.hpp libprojectM.new/RandomNumberGenerators.hpp
---- libprojectM/RandomNumberGenerators.hpp	2009-12-01 07:38:42.000000000 +0100
-+++ libprojectM.new/RandomNumberGenerators.hpp	2010-01-09 01:09:38.000000000 +0100
-@@ -4,6 +4,7 @@
- #include <vector>
- #include <cassert>
- #include <iostream>
-+#include <stdlib.h>
- 
- #define WEIGHTED_RANDOM_DEBUG 0
- 
-diff -ruN libprojectM/Renderer/TextureManager.cpp libprojectM.new/Renderer/TextureManager.cpp
---- libprojectM/Renderer/TextureManager.cpp	2010-01-09 01:16:11.000000000 +0100
-+++ libprojectM.new/Renderer/TextureManager.cpp	2010-01-09 01:03:59.000000000 +0100
-@@ -30,6 +30,10 @@
- #include "IdleTextures.hpp"
- 
- 
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <time.h>
-+
- 
- TextureManager::TextureManager(const std::string _presetURL): presetURL(_presetURL)
- {
---- projectM/projectM.hpp	2011-11-09 22:33:29.997034349 +0100
-+++ projectM.new/projectM.hpp	2011-11-09 22:32:27.064722289 +0100
-@@ -57,7 +57,9 @@
- #include "event.h"
- #include "fatal.h"
- #include "PCM.hpp"
--#include "pthread.h"
-+#ifdef USE_THREADS
-+# include "pthread.h"
-+#endif
- class PipelineContext;
- 
- class BeatDetect;
-@@ -309,10 +311,12 @@
- 
-   RenderItemMatcher * _matcher;
-   MasterRenderItemMerge * _merger;
-+#ifdef USE_THREADS
-   pthread_mutex_t mutex;
- 
-   pthread_cond_t  condition;
-   pthread_t thread;
-+#endif
-   bool running;
- 
-   Pipeline* currentPipe;
-diff -ruN projectM/MilkdropPresetFactory/CMakeLists.txt projectM.new/MilkdropPresetFactory/CMakeLists.txt
---- projectM/MilkdropPresetFactory/CMakeLists.txt	2018-02-26 00:24:12.274797430 +0200
-+++ projectM.new/MilkdropPresetFactory/CMakeLists.txt	2018-02-26 00:24:28.786407718 +0200
-@@ -11,8 +11,6 @@
-         InitCond.cpp Parser.cpp CustomWave.cpp Expr.cpp PerPointEqn.cpp
-         Param.cpp PerFrameEqn.cpp IdlePreset.cpp ../PresetFactory.cpp )
- 
--SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
--
- INCLUDE_DIRECTORIES(${projectM_SOURCE_DIR} ${Renderer_SOURCE_DIR})
- LINK_DIRECTORIES(${projectM_BINARY_DIR} ${Renderer_BINARY_DIR})
- 
-diff -ruN projectM/NativePresetFactory/CMakeLists.txt projectM.new/NativePresetFactory/CMakeLists.txt
---- projectM/NativePresetFactory/CMakeLists.txt	2009-12-06 03:42:51.000000000 +0200
-+++ projectM.new/NativePresetFactory/CMakeLists.txt	2018-02-26 00:24:36.774219188 +0200
-@@ -7,8 +7,6 @@
- 
- SET(NativePresetFactory_SOURCES NativePresetFactory.cpp)
- 
--SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
-- 
- INCLUDE_DIRECTORIES(${projectM_SOURCE_DIR} ${Renderer_SOURCE_DIR})
- ADD_LIBRARY(NativePresetFactory STATIC ${NativePresetFactory_SOURCES})
- SET_TARGET_PROPERTIES(NativePresetFactory PROPERTIES VERSION 2.00 SOVERSION 2)
-diff -ruN projectM/Renderer/CMakeLists.txt projectM.new/Renderer/CMakeLists.txt
---- projectM/Renderer/CMakeLists.txt	2009-12-06 03:42:51.000000000 +0200
-+++ projectM.new/Renderer/CMakeLists.txt	2018-02-26 00:24:46.257995347 +0200
-@@ -7,9 +7,6 @@
- Filters.cpp PerlinNoise.cpp PipelineContext.cpp  Renderable.cpp BeatDetect.cpp Shader.cpp TextureManager.cpp VideoEcho.cpp 
- RenderItemDistanceMetric.cpp RenderItemMatcher.cpp ${SOIL_SOURCES})
- 
--SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
--SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
--
- INCLUDE_DIRECTORIES(${projectM_SOURCE_DIR})
- ADD_LIBRARY(Renderer STATIC ${Renderer_SOURCES})
- SET_TARGET_PROPERTIES(Renderer PROPERTIES VERSION 2.00 SOVERSION 2)


=====================================
contrib/src/projectM/win64.patch deleted
=====================================
@@ -1,12 +0,0 @@
---- projectM/glew.h.orig	2011-11-06 20:20:42.573445229 -0500
-+++ projectM/glew.h	2011-11-06 20:21:25.349657365 -0500
-@@ -150,7 +150,8 @@
- #endif
- #if !defined(_PTRDIFF_T_DEFINED) && !defined(_PTRDIFF_T_)
- #  ifdef _WIN64
--typedef __int64 ptrdiff_t;
-+#include <inttypes.h>
-+typedef int64_t ptrdiff_t;
- #  else
- typedef _W64 int ptrdiff_t;
- #  endif


=====================================
modules/visualization/Makefile.am
=====================================
@@ -32,7 +32,7 @@ EXTRA_LTLIBRARIES += libgoom_plugin.la
 visu_PLUGINS += $(LTLIBgoom)
 
 libprojectm_plugin_la_SOURCES = visualization/projectm.cpp
-libprojectm_plugin_la_CXXFLAGS = $(AM_CXXFLAGS) $(PROJECTM_CFLAGS) -std=gnu++14
+libprojectm_plugin_la_CXXFLAGS = $(AM_CXXFLAGS) $(PROJECTM_CFLAGS) $(CPPFLAGS_projectm)
 libprojectm_plugin_la_LDFLAGS = $(AM_LDFLAGS) $(visu_RPATH)
 libprojectm_plugin_la_LIBADD = $(PROJECTM_LIBS)
 EXTRA_LTLIBRARIES += libprojectm_plugin.la


=====================================
modules/visualization/meson.build
=====================================
@@ -20,16 +20,25 @@ vlc_modules += {
 }
 
 # projectM visualization plugin
-projectm_dep = dependency('libprojectM', required: get_option('projectm'))
-if projectm_dep.found() and projectm_dep.version().version_compare('>= 2.0.0')
-    cdata.set('HAVE_PROJECTM2',1)
+projectm_dep = disabler()
+projectm_cpp_args = []
+if get_option('projectm').allowed()
+    projectm_dep = dependency('projectM-4', required: false)
+    if (projectm_dep.found())
+        projectm_cpp_args += '-DHAVE_PROJECTM4'
+    else
+        projectm_dep = dependency('libprojectM', required: get_option('projectm'))
+        if projectm_dep.found() and projectm_dep.version().version_compare('>= 2.0.0')
+            projectm_cpp_args += ['-DHAVE_PROJECTM2', '-std=gnu++14' ]
+        endif
+    endif
 endif
 
 vlc_modules += {
     'name' : 'projectm',
     'sources' : files('projectm.cpp'),
     'dependencies' : [projectm_dep],
-    'cpp_args' : [ '-std=gnu++14' ],
+    'cpp_args' : projectm_cpp_args,
     'enabled' : projectm_dep.found()
 }
 


=====================================
modules/visualization/projectm.cpp
=====================================
@@ -40,11 +40,20 @@
 # include <libprojectM/projectM.hpp>
 #endif
 
-#ifndef _WIN32
-# include <locale.h>
+#ifndef HAVE_PROJECTM4
+# ifndef _WIN32
+#  include <locale.h>
+# endif
+# ifdef HAVE_XLOCALE_H
+#  include <xlocale.h>
+# endif
 #endif
-#ifdef HAVE_XLOCALE_H
-# include <xlocale.h>
+
+#ifdef HAVE_PROJECTM4
+# ifdef _WIN32
+#  include <windows.h>
+#  include <GL/glew.h>
+# endif
 #endif
 
 /*****************************************************************************
@@ -283,11 +292,9 @@ static void *Thread( void *p_data )
     filter_t  *p_filter = (filter_t*)p_data;
     filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
     vlc_gl_t *gl = p_sys->gl;
-    locale_t loc;
-    locale_t oldloc;
 
 #ifdef HAVE_PROJECTM4
-    projectm_handle p_projectm; 
+    projectm_handle p_projectm;
 #else
     projectM *p_projectm;
 #endif
@@ -309,15 +316,27 @@ static void *Thread( void *p_data )
         return NULL;
     }
 
+#ifdef HAVE_PROJECTM4
+#ifdef _WIN32
+    if (glewInit() != GLEW_OK)
+    {
+        vlc_gl_ReleaseCurrent( gl );
+        return NULL;
+    }
+#endif
+#endif
+
+#ifndef HAVE_PROJECTM4
     /* Work-around the projectM locale bug */
-    loc = newlocale (LC_NUMERIC_MASK, "C", NULL);
-    oldloc = uselocale (loc);
+    locale_t loc = newlocale (LC_NUMERIC_MASK, "C", NULL);
+    locale_t oldloc = uselocale (loc);
+#endif
 
     /* Create the projectM object */
 #ifdef HAVE_PROJECTM4
     p_projectm = projectm_create();
-    projectm_set_window_size(p_projectm, 
-                             var_InheritInteger( p_filter, "projectm-width" ), 
+    projectm_set_window_size(p_projectm,
+                             var_InheritInteger( p_filter, "projectm-width" ),
                              var_CreateGetInteger( p_filter, "projectm-height" ));
 #else
 #ifndef HAVE_PROJECTM2
@@ -370,7 +389,7 @@ static void *Thread( void *p_data )
                                       sizeof( float ) );
 
     /* Choose a preset randomly or projectM will always show the first one */
-#ifndef HAVE_PROJECTM4 
+#ifndef HAVE_PROJECTM4
     if ( p_projectm->getPlaylistSize() > 0 )
         p_projectm->selectPreset( (unsigned)vlc_mrand48() % p_projectm->getPlaylistSize() );
 #endif
@@ -401,11 +420,11 @@ static void *Thread( void *p_data )
         {
 #ifdef HAVE_PROJECTM4
             projectm_pcm_add_float( p_projectm, p_sys->p_buffer, p_sys->i_nb_samples, (projectm_channels)1 );
-        
+
 #else
             p_projectm->pcm()->addPCMfloat( p_sys->p_buffer,
                                             p_sys->i_nb_samples );
-                
+
 #endif
             p_sys->i_nb_samples = 0;
         }
@@ -437,11 +456,13 @@ static void *Thread( void *p_data )
 
 #endif
 
+#ifndef HAVE_PROJECTM4
     if (loc != (locale_t)0)
     {
         uselocale (oldloc);
         freelocale (loc);
     }
+#endif
 
     vlc_gl_ReleaseCurrent( gl );
     return NULL;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f193a6a62f2418c01da63dd580295cd2a949b700...fabf83c23030bd5e63f07abb831e3bf64c63ac96

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f193a6a62f2418c01da63dd580295cd2a949b700...fabf83c23030bd5e63f07abb831e3bf64c63ac96
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list