From 3727bc2355bbba7d1e39ac3db4e3483e67f7ff9f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 23 Aug 2024 23:13:54 +0530 Subject: [PATCH] Include ffmpeg backed for Qt MultiMedia on macos and windows Qt docs indicate this is the only actually maintained backend --- bypy/macos/__main__.py | 10 +++++++++- bypy/sources.json | 10 ++++++++++ bypy/windows/__main__.py | 2 ++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/bypy/macos/__main__.py b/bypy/macos/__main__.py index 484e2130cf..4f473c436f 100644 --- a/bypy/macos/__main__.py +++ b/bypy/macos/__main__.py @@ -272,7 +272,7 @@ class Freeze: if x in ('libunrar.dylib', 'libstemmer.0.dylib', 'libstemmer.dylib', 'libjbig.2.1.dylib') and not is_id: yield x, x, is_id else: - for y in ('@rpath/', PREFIX + '/lib/', PREFIX + '/python/Python.framework/'): + for y in ('@rpath/', PREFIX + '/lib/', PREFIX + '/python/Python.framework/', PREFIX + '/ffmpeg/lib/'): if x.startswith(y): if y == PREFIX + '/python/Python.framework/': y = PREFIX + '/python/' @@ -322,6 +322,14 @@ class Freeze: @flush def add_qt_frameworks(self): print('\nAdding Qt Frameworks') + # First add FFMPEG + for x in os.listdir(join(PREFIX, 'ffmpeg', 'lib')): + if x.endswith('.dylib') and x.count('.') == 2: + src = join(PREFIX, 'ffmpeg', 'lib', x) + shutil.copy2(src, self.frameworks_dir) + dest = join(self.frameworks_dir, os.path.basename(src)) + self.set_id(dest, self.FID + '/' + os.path.basename(src)) + self.fix_dependencies_in_lib(dest) for f in QT_FRAMEWORKS: self.add_qt_framework(f) pdir = join(QT_PREFIX, 'plugins') diff --git a/bypy/sources.json b/bypy/sources.json index f8143602be..2f2b755748 100644 --- a/bypy/sources.json +++ b/bypy/sources.json @@ -506,6 +506,16 @@ } }, + { + "name": "ffmpeg", + "os": "macos,windows", + "unix": { + "filename": "ffmpeg-6.1.2.tar.xz", + "hash": "sha256:3b624649725ecdc565c903ca6643d41f33bd49239922e45c9b1442c63dca4e38", + "urls": ["https://www.ffmpeg.org/releases/{filename}"] + } + }, + { "name": "qt-base", "version": "6.7.2", diff --git a/bypy/windows/__main__.py b/bypy/windows/__main__.py index d9eb08c0fd..5749b2fb15 100644 --- a/bypy/windows/__main__.py +++ b/bypy/windows/__main__.py @@ -138,6 +138,8 @@ def freeze(env, ext_dir, incdir): os.mkdir(ossm) for f in glob.glob(os.path.join(PREFIX, 'lib', 'ossl-modules', '*.dll')): copybin(f, ossm) + for f in glob.glob(os.path.join(PREFIX, 'ffmpeg', 'bin', '*.dll')): + copybin(f) copybin(os.path.join(env.python_base, 'python%s.dll' % env.py_ver.replace('.', ''))) copybin(os.path.join(env.python_base, 'python%s.dll' % env.py_ver[0]))