From e115981b9fc30e0f40cdc683da8d810e0b1744b2 Mon Sep 17 00:00:00 2001 From: Bruno Herbelin Date: Sat, 17 Aug 2024 23:31:03 +0200 Subject: [PATCH 1/2] OSX 14 M2 platform compilation --- CMakeLists.txt | 8 ++++---- src/Connection.cpp | 3 +++ src/ControlManager.cpp | 3 +++ src/NetworkSource.cpp | 3 +++ src/ShaderEditWindow.cpp | 2 +- src/Streamer.cpp | 3 +++ 6 files changed, 17 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fdf44b0..d2070b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,11 +61,11 @@ if(UNIX) set(CMAKE_SKIP_RPATH TRUE) set(OpenGL_DIR /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/) - set(CMAKE_OSX_ARCHITECTURES "x86_64") - set(CMAKE_OSX_DEPLOYMENT_TARGET "11") + # set(CMAKE_OSX_ARCHITECTURES "x86_64") + # set(CMAKE_OSX_DEPLOYMENT_TARGET "11") -# set(CMAKE_OSX_ARCHITECTURES "arm64") -# set(CMAKE_OSX_DEPLOYMENT_TARGET "12") + set(CMAKE_OSX_ARCHITECTURES "arm64") + set(CMAKE_OSX_DEPLOYMENT_TARGET "13") # CPACK set(CPACK_SYSTEM_NAME "OSX_${CMAKE_OSX_DEPLOYMENT_TARGET}_${CMAKE_OSX_ARCHITECTURES}") diff --git a/src/Connection.cpp b/src/Connection.cpp index 4ec5dd4..7d159a9 100644 --- a/src/Connection.cpp +++ b/src/Connection.cpp @@ -21,6 +21,9 @@ #include #include +#if ((ULONG_MAX) != (UINT_MAX)) +#define _M_X64 +#endif #include "osc/OscOutboundPacketStream.h" #include "defines.h" diff --git a/src/ControlManager.cpp b/src/ControlManager.cpp index 1c26cfe..87ba0f1 100644 --- a/src/ControlManager.cpp +++ b/src/ControlManager.cpp @@ -25,6 +25,9 @@ #include #include +#if ((ULONG_MAX) != (UINT_MAX)) +#define _M_X64 +#endif #include "osc/OscOutboundPacketStream.h" #include "Log.h" diff --git a/src/NetworkSource.cpp b/src/NetworkSource.cpp index 5a09bda..7e235e8 100644 --- a/src/NetworkSource.cpp +++ b/src/NetworkSource.cpp @@ -27,6 +27,9 @@ #include #include +#if ((ULONG_MAX) != (UINT_MAX)) +#define _M_X64 +#endif #include "osc/OscOutboundPacketStream.h" #include "SystemToolkit.h" diff --git a/src/ShaderEditWindow.cpp b/src/ShaderEditWindow.cpp index 11b3961..f79ed4e 100644 --- a/src/ShaderEditWindow.cpp +++ b/src/ShaderEditWindow.cpp @@ -364,7 +364,7 @@ void ShaderEditWindow::Render() // cancel edit clone else { // possibility that source was removed - g_printerr("cancel edit clone %ld\n", current_); + // g_printerr("cancel edit clone %ld\n", current_); // disable editor _editor.SetReadOnly(true); diff --git a/src/Streamer.cpp b/src/Streamer.cpp index 272a66f..c075653 100644 --- a/src/Streamer.cpp +++ b/src/Streamer.cpp @@ -33,6 +33,9 @@ #include //osc +#if ((ULONG_MAX) != (UINT_MAX)) +#define _M_X64 +#endif #include "osc/OscOutboundPacketStream.h" #include "Settings.h" From 0016a4147421c18d81e8f9048165c721511c4406 Mon Sep 17 00:00:00 2001 From: Bruno Herbelin Date: Sun, 18 Aug 2024 00:18:56 +0200 Subject: [PATCH 2/2] OSX Audio compatibility --- src/MediaPlayer.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/MediaPlayer.cpp b/src/MediaPlayer.cpp index a531373..b5bc190 100644 --- a/src/MediaPlayer.cpp +++ b/src/MediaPlayer.cpp @@ -479,7 +479,6 @@ void MediaPlayer::execute_open() Rendering::LinkPipeline(GST_PIPELINE (pipeline_)); #endif - // set to desired state (PLAY or PAUSE) GstStateChangeReturn ret = gst_element_set_state (pipeline_, desired_state_); if (ret == GST_STATE_CHANGE_FAILURE) { @@ -1741,16 +1740,30 @@ void MediaPlayer::setAudioEnabled(bool on) void MediaPlayer::setAudioVolume(float vol) { - if (pipeline_ && media_.hasaudio) - g_object_set(G_OBJECT(pipeline_), "volume", vol, NULL); + if (pipeline_ && media_.hasaudio){ + + GstElement *asink = NULL; + g_object_get (G_OBJECT (pipeline_), "audio-sink", &asink, NULL); + if ( asink ) + g_object_set(G_OBJECT(asink), "volume", vol, NULL); + else + g_object_set(G_OBJECT(pipeline_), "volume", vol, NULL); + + } // gst_stream_volume_set_volume (GST_STREAM_VOLUME (pipeline_), GST_STREAM_VOLUME_FORMAT_LINEAR, vol); } float MediaPlayer::audioVolume() const { float vol = 0.f; - if (pipeline_ && media_.hasaudio) - g_object_get(G_OBJECT(pipeline_), "volume", &vol, NULL); + if (pipeline_ && media_.hasaudio){ + GstElement *asink = NULL; + g_object_get (G_OBJECT (pipeline_), "audio-sink", &asink, NULL); + if ( asink ) + g_object_get(G_OBJECT(asink), "volume", &vol, NULL); + else + g_object_get(G_OBJECT(pipeline_), "volume", &vol, NULL); + } return vol; }