feat: use FFmpeg media player on macOS with static FFmpeg

This commit is contained in:
Noisyfox
2026-08-14 21:01:43 +08:00
parent ec31750330
commit 2c8f56dd84
4 changed files with 13 additions and 15 deletions

View File

@@ -784,8 +784,9 @@ if (APPLE)
GUI/DeepLinkHandlerMac.mm GUI/DeepLinkHandlerMac.mm
GUI/DeepLinkHandlerMac.h GUI/DeepLinkHandlerMac.h
GUI/GUI_UtilsMac.mm GUI/GUI_UtilsMac.mm
GUI/wxMediaCtrl2.mm GUI/AVVideoDecoder.cpp
GUI/wxMediaCtrl2.h GUI/AVVideoDecoder.hpp
GUI/wxMediaCtrl3.cpp
GUI/wxMediaCtrl3.h GUI/wxMediaCtrl3.h
) )
FIND_LIBRARY(DISKARBITRATION_LIBRARY DiskArbitration) FIND_LIBRARY(DISKARBITRATION_LIBRARY DiskArbitration)
@@ -903,7 +904,15 @@ if (SLIC3R_PCH AND NOT SLIC3R_SYNTAXONLY)
add_precompiled_header(libslic3r_gui pchheader.hpp FORCEINCLUDE) add_precompiled_header(libslic3r_gui pchheader.hpp FORCEINCLUDE)
endif () endif ()
if (NOT APPLE) if (APPLE)
# Static FFmpeg from the deps install: nothing to bundle into the .app,
# no rpath/install_name handling. Order matters: avcodec -> swscale -> avutil.
find_library(LIBAVCODEC_LIBRARY NAMES libavcodec.a PATHS ${CMAKE_PREFIX_PATH}/lib NO_DEFAULT_PATH)
find_library(LIBSWSCALE_LIBRARY NAMES libswscale.a PATHS ${CMAKE_PREFIX_PATH}/lib NO_DEFAULT_PATH)
find_library(LIBAVUTIL_LIBRARY NAMES libavutil.a PATHS ${CMAKE_PREFIX_PATH}/lib NO_DEFAULT_PATH)
target_link_libraries(libslic3r_gui ${LIBAVCODEC_LIBRARY} ${LIBSWSCALE_LIBRARY} ${LIBAVUTIL_LIBRARY})
target_include_directories(libslic3r_gui SYSTEM PRIVATE ${CMAKE_PREFIX_PATH}/include)
else ()
pkg_check_modules(LIBAV REQUIRED IMPORTED_TARGET pkg_check_modules(LIBAV REQUIRED IMPORTED_TARGET
libavcodec libavcodec
libswscale libswscale

View File

@@ -98,8 +98,6 @@ public:
}; };
#endif #endif
wxDEFINE_EVENT(EVT_MEDIA_CTRL_STAT, wxCommandEvent);
wxMediaCtrl2::wxMediaCtrl2(wxWindow *parent) wxMediaCtrl2::wxMediaCtrl2(wxWindow *parent)
{ {
#if defined(__LINUX__) && defined(__WXGTK__) #if defined(__LINUX__) && defined(__WXGTK__)

View File

@@ -10,7 +10,7 @@
#include <shellapi.h> #include <shellapi.h>
#endif #endif
//wxDEFINE_EVENT(EVT_MEDIA_CTRL_STAT, wxCommandEvent); wxDEFINE_EVENT(EVT_MEDIA_CTRL_STAT, wxCommandEvent);
BEGIN_EVENT_TABLE(wxMediaCtrl3, wxWindow) BEGIN_EVENT_TABLE(wxMediaCtrl3, wxWindow)

View File

@@ -15,13 +15,6 @@ wxDECLARE_EVENT(EVT_MEDIA_CTRL_STAT, wxCommandEvent);
void wxMediaCtrl_OnSize(wxWindow * ctrl, wxSize const & videoSize, int width, int height); void wxMediaCtrl_OnSize(wxWindow * ctrl, wxSize const & videoSize, int width, int height);
#ifdef __WXMAC__
#include "wxMediaCtrl2.h"
#define wxMediaCtrl3 wxMediaCtrl2
#else
#define BAMBU_DYNAMIC #define BAMBU_DYNAMIC
#include <condition_variable> #include <condition_variable>
#include <thread> #include <thread>
@@ -89,6 +82,4 @@ private:
std::thread m_thread; std::thread m_thread;
}; };
#endif
#endif /* wxMediaCtrl3_h */ #endif /* wxMediaCtrl3_h */