@luckylillia-dev/plugin-ffmpeg-darwin-arm64 0.0.0-stage → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/native/build-sources.json +38 -0
- package/native/licenses/FFmpeg-COPYING.GPLv3.txt +674 -0
- package/native/licenses/FFmpeg-COPYING.LGPLv3.txt +165 -0
- package/native/licenses/FFmpeg-LICENSE.md.txt +127 -0
- package/native/licenses/GCC-GPLv3.txt +674 -0
- package/native/licenses/GCC-Runtime-Exception.txt +73 -0
- package/native/licenses/LAME-LGPL-2.0.txt +481 -0
- package/native/licenses/LAME-NOTICE.txt +13 -0
- package/native/licenses/LLVM-libcxx.txt +311 -0
- package/native/licenses/LLVM-libcxxabi.txt +311 -0
- package/native/licenses/LLVM-libunwind.txt +311 -0
- package/native/licenses/Ogg-BSD.txt +28 -0
- package/native/licenses/OpenCORE-AMR-Apache-2.0.txt +191 -0
- package/native/licenses/SILK-Mirror-MIT.txt +21 -0
- package/native/licenses/SILK-Skype-BSD-3-Clause-Clear.txt +26 -0
- package/native/licenses/Speex-BSD.txt +35 -0
- package/native/licenses/Vorbis-BSD.txt +28 -0
- package/native/licenses/Zig-compiler-rt-MIT.txt +21 -0
- package/native/licenses/Zlib.txt +22 -0
- package/native/loader.cjs +88 -0
- package/native/macos-arm64/LuckyLillia.FFmpeg.node +0 -0
- package/native/macos-arm64/build.json +120 -0
- package/package.json +28 -4
- package/README.md +0 -3
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright notice:
|
|
2
|
+
|
|
3
|
+
(C) 1995-2022 Jean-loup Gailly and Mark Adler
|
|
4
|
+
|
|
5
|
+
This software is provided 'as-is', without any express or implied
|
|
6
|
+
warranty. In no event will the authors be held liable for any damages
|
|
7
|
+
arising from the use of this software.
|
|
8
|
+
|
|
9
|
+
Permission is granted to anyone to use this software for any purpose,
|
|
10
|
+
including commercial applications, and to alter it and redistribute it
|
|
11
|
+
freely, subject to the following restrictions:
|
|
12
|
+
|
|
13
|
+
1. The origin of this software must not be misrepresented; you must not
|
|
14
|
+
claim that you wrote the original software. If you use this software
|
|
15
|
+
in a product, an acknowledgment in the product documentation would be
|
|
16
|
+
appreciated but is not required.
|
|
17
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
|
18
|
+
misrepresented as being the original software.
|
|
19
|
+
3. This notice may not be removed or altered from any source distribution.
|
|
20
|
+
|
|
21
|
+
Jean-loup Gailly Mark Adler
|
|
22
|
+
jloup@gzip.org madler@alumni.caltech.edu
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const fs = require('node:fs')
|
|
4
|
+
const path = require('node:path')
|
|
5
|
+
const os = require('node:os')
|
|
6
|
+
const { createHash, randomUUID } = require('node:crypto')
|
|
7
|
+
|
|
8
|
+
const filename = 'LuckyLillia.FFmpeg.node'
|
|
9
|
+
const targets = Object.freeze([
|
|
10
|
+
'win-x64', 'macos-arm64',
|
|
11
|
+
'linux-glibc-x64', 'linux-glibc-arm64',
|
|
12
|
+
'linux-musl-x64', 'linux-musl-arm64',
|
|
13
|
+
])
|
|
14
|
+
|
|
15
|
+
function selectTarget(platform = process.platform, arch = process.arch, libc) {
|
|
16
|
+
if (platform === 'win32' && arch === 'x64') return 'win-x64'
|
|
17
|
+
if (platform === 'darwin' && arch === 'arm64') return 'macos-arm64'
|
|
18
|
+
if (platform === 'linux' && (arch === 'x64' || arch === 'arm64')) {
|
|
19
|
+
libc ??= process.report.getReport().header.glibcVersionRuntime ? 'glibc' : 'musl'
|
|
20
|
+
const target = 'linux-' + libc + '-' + arch
|
|
21
|
+
if (targets.includes(target)) return target
|
|
22
|
+
}
|
|
23
|
+
throw new Error('FFmpeg 原生模块不支持当前平台:' + platform + '/' + arch)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function digest(file) {
|
|
27
|
+
const stat = fs.lstatSync(file)
|
|
28
|
+
if (!stat.isFile() || stat.isSymbolicLink()) throw new Error('FFmpeg 原生文件必须是普通文件:' + file)
|
|
29
|
+
return createHash('sha256').update(fs.readFileSync(file)).digest('hex')
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function inspectTarget(root, target) {
|
|
33
|
+
if (!targets.includes(target)) throw new Error('Unknown FFmpeg target: ' + target)
|
|
34
|
+
const directory = path.join(root, target)
|
|
35
|
+
if (fs.lstatSync(directory).isSymbolicLink()) throw new Error('FFmpeg 平台目录不能是符号链接')
|
|
36
|
+
const metadata = JSON.parse(fs.readFileSync(path.join(directory, 'build.json'), 'utf8'))
|
|
37
|
+
if (metadata.schemaVersion !== 1 || metadata.target !== target || metadata.filename !== filename ||
|
|
38
|
+
!/^[a-f0-9]{64}$/.test(metadata.sha256)) {
|
|
39
|
+
throw new Error('FFmpeg 构建元数据无效:' + target)
|
|
40
|
+
}
|
|
41
|
+
const file = path.join(directory, filename)
|
|
42
|
+
if (digest(file) !== metadata.sha256) throw new Error('FFmpeg 原生模块校验失败:' + target)
|
|
43
|
+
return { target, file, metadata }
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function inspectBundle(root, options = {}) {
|
|
47
|
+
const selected = options.allTargets ? targets : [options.target || selectTarget()]
|
|
48
|
+
return selected.map(target => inspectTarget(root, target))
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function loadNative(root, options = {}) {
|
|
52
|
+
const inspected = inspectTarget(root, options.target || selectTarget())
|
|
53
|
+
const cacheRoot = options.cacheDir || path.join(os.tmpdir(), 'lucky-lillia-ffmpeg')
|
|
54
|
+
const cacheDirectory = path.join(cacheRoot, inspected.target)
|
|
55
|
+
fs.mkdirSync(cacheDirectory, { recursive: true })
|
|
56
|
+
for (const directory of [cacheRoot, cacheDirectory]) {
|
|
57
|
+
if (fs.lstatSync(directory).isSymbolicLink()) throw new Error('FFmpeg 缓存目录不能是符号链接')
|
|
58
|
+
}
|
|
59
|
+
const cacheFile = path.join(cacheDirectory, 'LuckyLillia.FFmpeg.' + inspected.metadata.sha256 + '.node')
|
|
60
|
+
const verifyCache = () => {
|
|
61
|
+
if (digest(cacheFile) !== inspected.metadata.sha256) throw new Error('FFmpeg 原生缓存已损坏:' + cacheFile)
|
|
62
|
+
}
|
|
63
|
+
if (fs.existsSync(cacheFile)) {
|
|
64
|
+
verifyCache()
|
|
65
|
+
} else {
|
|
66
|
+
const temporary = path.join(cacheDirectory, '.' + process.pid + '-' + randomUUID() + '.tmp')
|
|
67
|
+
try {
|
|
68
|
+
fs.copyFileSync(inspected.file, temporary, fs.constants.COPYFILE_EXCL)
|
|
69
|
+
if (digest(temporary) !== inspected.metadata.sha256) throw new Error('FFmpeg 复制期间原生模块发生变化')
|
|
70
|
+
// Hard-link promotion is atomic and never replaces an addon another process has loaded.
|
|
71
|
+
try {
|
|
72
|
+
fs.linkSync(temporary, cacheFile)
|
|
73
|
+
} catch (error) {
|
|
74
|
+
if (error.code !== 'EEXIST') throw error
|
|
75
|
+
}
|
|
76
|
+
verifyCache()
|
|
77
|
+
} finally {
|
|
78
|
+
try { fs.unlinkSync(temporary) } catch (error) { if (error.code !== 'ENOENT') throw error }
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const addon = require(cacheFile)
|
|
82
|
+
for (const method of ['probe', 'decodeAudio', 'encodeAudio', 'transcodeAudio', 'thumbnail', 'version', 'silkVersion']) {
|
|
83
|
+
if (typeof addon[method] !== 'function') throw new Error('FFmpeg 原生模块缺少接口:' + method)
|
|
84
|
+
}
|
|
85
|
+
return addon
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
module.exports = { targets, selectTarget, inspectBundle, loadNative }
|
|
Binary file
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"target": "macos-arm64",
|
|
4
|
+
"filename": "LuckyLillia.FFmpeg.node",
|
|
5
|
+
"sha256": "a517aed1b30fe78fef2c9b3e9bf609cf247b225397e711f0ebedfb8798389266",
|
|
6
|
+
"addonSourceSha256": "8270cbfb0b60a42f6d3a9bd388d55eaebcc4a2ca90374d78c0d24c009dda18e2",
|
|
7
|
+
"ffmpegVersion": "8.0.git",
|
|
8
|
+
"napiVersion": 8,
|
|
9
|
+
"source": {
|
|
10
|
+
"kind": "verified-static-cache",
|
|
11
|
+
"upstream": {
|
|
12
|
+
"url": "https://github.com/FFmpeg/FFmpeg.git",
|
|
13
|
+
"commit": "9bfa1635aef08e777deaeeae15ff9a5ade412188",
|
|
14
|
+
"tree": "3ce4e0fca93864e7bd517b95f91c1e9b5513328e"
|
|
15
|
+
},
|
|
16
|
+
"patches": [],
|
|
17
|
+
"compiledSource": {
|
|
18
|
+
"kind": "custom-snapshot",
|
|
19
|
+
"sha256": "ef348c4516d89d29f24f23d9210e75bef3ab85c1a6bd69d7415a500122f6f926",
|
|
20
|
+
"sourceTreeSha256": "679758ea78c023abb8a9e24045b3b2c6fef1a699545aa79bdcbcc5dc57c2b318"
|
|
21
|
+
},
|
|
22
|
+
"cacheReceiptSha256": "8a23b7351961e510ccba0425fa2ef1fb3f3f4e1e27a6f5c4112279db7b697925",
|
|
23
|
+
"sourceTreeSha256": "679758ea78c023abb8a9e24045b3b2c6fef1a699545aa79bdcbcc5dc57c2b318",
|
|
24
|
+
"fullSourceTreeSha256": "6235b79db0cfea8b4e91a415e2a9127faef8c11b5ca26129067121b52d41b0d5",
|
|
25
|
+
"fullSourceFileCount": 10080,
|
|
26
|
+
"sourceHashExclusions": [
|
|
27
|
+
"tests/ref/fate/h264-conformance-canl1_toshiba_g",
|
|
28
|
+
"tests/ref/fate/h264-conformance-cvmaqp2_sony_g"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"componentConfigSha256": "2333f21f847e5b5be73fefe4f05b393ae1fa1bbefb4db1c7c5d190cee6c736c8",
|
|
32
|
+
"silkSource": {
|
|
33
|
+
"upstream": {
|
|
34
|
+
"url": "https://github.com/kn007/silk-v3-decoder.git",
|
|
35
|
+
"commit": "507be6bca8ce1fb977a061481f1d79e8c610e309"
|
|
36
|
+
},
|
|
37
|
+
"sourceTreeSha256": "ea860b2fbb857ddb386a6b3152bc5aafbca880a87356b42f4d6c8294fe873c85",
|
|
38
|
+
"version": "1.0.9.6"
|
|
39
|
+
},
|
|
40
|
+
"silkLibrarySha256": "ad42af26c6ed9780332ac45ba20bbb8a7e0af6fa38edb0f1512087c4650c85ca",
|
|
41
|
+
"silkRecipeSha256": "f69d980bd6de9f46085297e37a1a453485b3f82c57beeac605289e29e1a39883",
|
|
42
|
+
"compiler": "Zig 0.14.1 (Clang 19.1.7), WSL cross build",
|
|
43
|
+
"dependencies": "pinned-static",
|
|
44
|
+
"dynamicLibraries": [
|
|
45
|
+
"/usr/lib/libSystem.B.dylib"
|
|
46
|
+
],
|
|
47
|
+
"licenses": [
|
|
48
|
+
"LGPL-3.0-or-later",
|
|
49
|
+
"LGPL-2.0-or-later",
|
|
50
|
+
"Apache-2.0",
|
|
51
|
+
"BSD-3-Clause",
|
|
52
|
+
"Zlib",
|
|
53
|
+
"BSD-3-Clause-Clear",
|
|
54
|
+
"MIT",
|
|
55
|
+
"Apache-2.0 WITH LLVM-exception"
|
|
56
|
+
],
|
|
57
|
+
"sources": [
|
|
58
|
+
{
|
|
59
|
+
"name": "zlib",
|
|
60
|
+
"version": "1.3.1",
|
|
61
|
+
"sha256": "9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23",
|
|
62
|
+
"url": "https://zlib.net/fossils/zlib-1.3.1.tar.gz"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "lame",
|
|
66
|
+
"version": "3.100",
|
|
67
|
+
"sha256": "ddfe36cab873794038ae2c1210557ad34857a4b6bdc515785d1da9e175b1da1e",
|
|
68
|
+
"url": "https://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "opencore-amr",
|
|
72
|
+
"version": "0.1.6",
|
|
73
|
+
"sha256": "483eb4061088e2b34b358e47540b5d495a96cd468e361050fae615b1809dc4a1",
|
|
74
|
+
"url": "https://downloads.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.6.tar.gz"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"name": "speex",
|
|
78
|
+
"version": "1.2.1",
|
|
79
|
+
"sha256": "4b44d4f2b38a370a2d98a78329fefc56a0cf93d1c1be70029217baae6628feea",
|
|
80
|
+
"url": "https://downloads.xiph.org/releases/speex/speex-1.2.1.tar.gz"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "ogg",
|
|
84
|
+
"version": "1.3.5",
|
|
85
|
+
"sha256": "c4d91be36fc8e54deae7575241e03f4211eb102afb3fc0775fbbc1b740016705",
|
|
86
|
+
"url": "https://downloads.xiph.org/releases/ogg/libogg-1.3.5.tar.xz"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"name": "vorbis",
|
|
90
|
+
"version": "1.3.7",
|
|
91
|
+
"sha256": "b33cc4934322bcbf6efcbacf49e3ca01aadbea4114ec9589d1b1e9d20f72954b",
|
|
92
|
+
"url": "https://downloads.xiph.org/releases/vorbis/libvorbis-1.3.7.tar.xz"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"name": "node-headers",
|
|
96
|
+
"version": "22.22.2",
|
|
97
|
+
"sha256": "90e5ef0fdf02f88487f904a798836b35bd44896046d502873bc625ac2baeded2",
|
|
98
|
+
"url": "https://nodejs.org/dist/v22.22.2/node-v22.22.2-headers.tar.gz"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"name": "node-lib",
|
|
102
|
+
"version": "22.22.2",
|
|
103
|
+
"sha256": "0d8d8bcc11daea60f5dd4da414e72ccb785718345ec8fbec52cfc7d1a2326293",
|
|
104
|
+
"url": "https://nodejs.org/dist/v22.22.2/win-x64/node.lib"
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
"crossBuild": {
|
|
108
|
+
"toolchain": "Zig 0.14.1",
|
|
109
|
+
"macosDeploymentTarget": "11.0",
|
|
110
|
+
"asm": false,
|
|
111
|
+
"staticRuntimes": [
|
|
112
|
+
"LLVM libc++",
|
|
113
|
+
"LLVM libc++abi",
|
|
114
|
+
"LLVM libunwind",
|
|
115
|
+
"Zig compiler-rt"
|
|
116
|
+
],
|
|
117
|
+
"sourceSha256": "8270cbfb0b60a42f6d3a9bd388d55eaebcc4a2ca90374d78c0d24c009dda18e2",
|
|
118
|
+
"validation": "compiled; run target smoke separately"
|
|
119
|
+
}
|
|
120
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luckylillia-dev/plugin-ffmpeg-darwin-arm64",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.1.4",
|
|
4
|
+
"description": "@luckylillia-dev/plugin-ffmpeg native binaries for darwin-arm64",
|
|
5
|
+
"license": "LGPL-3.0-or-later",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/LuckyLilliaDev/lucky-lillia-plugin-ffmpeg.git"
|
|
9
|
+
},
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=22.15.0"
|
|
12
|
+
},
|
|
13
|
+
"os": [
|
|
14
|
+
"darwin"
|
|
15
|
+
],
|
|
16
|
+
"cpu": [
|
|
17
|
+
"arm64"
|
|
18
|
+
],
|
|
19
|
+
"exports": {
|
|
20
|
+
"./package.json": "./package.json"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"native",
|
|
24
|
+
"LICENSE"
|
|
25
|
+
],
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"registry": "https://registry.npmjs.org/",
|
|
28
|
+
"access": "public"
|
|
29
|
+
}
|
|
30
|
+
}
|
package/README.md
DELETED