bare-ffmpeg 1.0.0-10 → 1.0.0-12
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/binding.cc +1771 -0
- package/cmake/ports/ffmpeg/port.cmake +513 -0
- package/cmake/ports/opus/patches/01-windows-clang.patch +52 -0
- package/cmake/ports/opus/port.cmake +38 -0
- package/cmake/ports/svt-av1/port.cmake +42 -0
- package/cmake/ports/x264/patches/01-windows-clang.patch +33 -0
- package/cmake/ports/x264/port.cmake +157 -0
- package/lib/codec-context.js +19 -0
- package/package.json +4 -3
- package/prebuilds/android-arm/bare-ffmpeg.bare +0 -0
- package/prebuilds/android-arm64/bare-ffmpeg.bare +0 -0
- package/prebuilds/android-ia32/bare-ffmpeg.bare +0 -0
- package/prebuilds/android-x64/bare-ffmpeg.bare +0 -0
- package/prebuilds/darwin-arm64/bare-ffmpeg.bare +0 -0
- package/prebuilds/darwin-x64/bare-ffmpeg.bare +0 -0
- package/prebuilds/ios-arm64/bare-ffmpeg.bare +0 -0
- package/prebuilds/ios-arm64-simulator/bare-ffmpeg.bare +0 -0
- package/prebuilds/ios-x64-simulator/bare-ffmpeg.bare +0 -0
- package/prebuilds/linux-arm64/bare-ffmpeg.bare +0 -0
- package/prebuilds/linux-x64/bare-ffmpeg.bare +0 -0
- package/prebuilds/win32-arm64/bare-ffmpeg.bare +0 -0
- package/prebuilds/win32-x64/bare-ffmpeg.bare +0 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
include_guard(GLOBAL)
|
|
2
|
+
|
|
3
|
+
if(WIN32)
|
|
4
|
+
set(lib x264.lib)
|
|
5
|
+
else()
|
|
6
|
+
set(lib libx264.a)
|
|
7
|
+
endif()
|
|
8
|
+
|
|
9
|
+
set(env)
|
|
10
|
+
|
|
11
|
+
set(args
|
|
12
|
+
--disable-cli
|
|
13
|
+
|
|
14
|
+
--enable-static
|
|
15
|
+
--enable-strip
|
|
16
|
+
--enable-pic
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
if(CMAKE_BUILD_TYPE MATCHES "Debug|RelWithDebInfo")
|
|
20
|
+
list(APPEND args --enable-debug)
|
|
21
|
+
endif()
|
|
22
|
+
|
|
23
|
+
if(CMAKE_SYSTEM_NAME)
|
|
24
|
+
set(platform ${CMAKE_SYSTEM_NAME})
|
|
25
|
+
else()
|
|
26
|
+
set(platform ${CMAKE_HOST_SYSTEM_NAME})
|
|
27
|
+
endif()
|
|
28
|
+
|
|
29
|
+
string(TOLOWER "${platform}" platform)
|
|
30
|
+
|
|
31
|
+
if(platform MATCHES "darwin|ios")
|
|
32
|
+
set(platform "darwin")
|
|
33
|
+
elseif(platform MATCHES "linux|android")
|
|
34
|
+
set(platform "linux")
|
|
35
|
+
elseif(platform MATCHES "windows")
|
|
36
|
+
set(platform "msys")
|
|
37
|
+
else()
|
|
38
|
+
message(FATAL_ERROR "Unsupported platform '${platform}'")
|
|
39
|
+
endif()
|
|
40
|
+
|
|
41
|
+
if(APPLE AND CMAKE_OSX_ARCHITECTURES)
|
|
42
|
+
set(arch ${CMAKE_OSX_ARCHITECTURES})
|
|
43
|
+
elseif(MSVC AND CMAKE_GENERATOR_PLATFORM)
|
|
44
|
+
set(arch ${CMAKE_GENERATOR_PLATFORM})
|
|
45
|
+
elseif(ANDROID AND CMAKE_ANDROID_ARCH_ABI)
|
|
46
|
+
set(arch ${CMAKE_ANDROID_ARCH_ABI})
|
|
47
|
+
elseif(CMAKE_SYSTEM_PROCESSOR)
|
|
48
|
+
set(arch ${CMAKE_SYSTEM_PROCESSOR})
|
|
49
|
+
else()
|
|
50
|
+
set(arch ${CMAKE_HOST_SYSTEM_PROCESSOR})
|
|
51
|
+
endif()
|
|
52
|
+
|
|
53
|
+
string(TOLOWER "${arch}" arch)
|
|
54
|
+
|
|
55
|
+
if(arch MATCHES "arm64|aarch64")
|
|
56
|
+
set(arch "aarch64")
|
|
57
|
+
elseif(arch MATCHES "armv7-a|armeabi-v7a")
|
|
58
|
+
set(arch "arm")
|
|
59
|
+
elseif(arch MATCHES "x64|x86_64|amd64")
|
|
60
|
+
set(arch "x86_64")
|
|
61
|
+
elseif(arch MATCHES "x86|i386|i486|i586|i686")
|
|
62
|
+
set(arch "i686")
|
|
63
|
+
else()
|
|
64
|
+
message(FATAL_ERROR "Unsupported architecture '${arch}'")
|
|
65
|
+
endif()
|
|
66
|
+
|
|
67
|
+
list(APPEND args --host=${arch}-${platform})
|
|
68
|
+
|
|
69
|
+
if(APPLE)
|
|
70
|
+
list(APPEND args --sysroot=${CMAKE_OSX_SYSROOT})
|
|
71
|
+
elseif(ANDROID)
|
|
72
|
+
list(APPEND args --sysroot=${CMAKE_SYSROOT} --disable-asm)
|
|
73
|
+
elseif(WIN32)
|
|
74
|
+
list(APPEND args --disable-asm)
|
|
75
|
+
endif()
|
|
76
|
+
|
|
77
|
+
if(CMAKE_C_COMPILER)
|
|
78
|
+
cmake_path(GET CMAKE_C_COMPILER PARENT_PATH CC_path)
|
|
79
|
+
cmake_path(GET CMAKE_C_COMPILER FILENAME CC_filename)
|
|
80
|
+
|
|
81
|
+
list(APPEND env "CC=${CC_filename}")
|
|
82
|
+
|
|
83
|
+
list(APPEND args
|
|
84
|
+
--extra-cflags=--target=${CMAKE_C_COMPILER_TARGET}
|
|
85
|
+
--extra-ldflags=--target=${CMAKE_C_COMPILER_TARGET}
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
if(CMAKE_LINKER_TYPE MATCHES "LLD")
|
|
89
|
+
list(APPEND args --extra-ldflags=-fuse-ld=lld)
|
|
90
|
+
endif()
|
|
91
|
+
|
|
92
|
+
list(APPEND env --modify "PATH=path_list_prepend:${CC_path}")
|
|
93
|
+
endif()
|
|
94
|
+
|
|
95
|
+
if(CMAKE_ASM_NASM_COMPILER)
|
|
96
|
+
cmake_path(GET CMAKE_ASM_NASM_COMPILER PARENT_PATH AS_path)
|
|
97
|
+
cmake_path(GET CMAKE_ASM_NASM_COMPILER FILENAME AS_filename)
|
|
98
|
+
|
|
99
|
+
list(APPEND env "AS=${AS_filename}")
|
|
100
|
+
|
|
101
|
+
list(APPEND env --modify "PATH=path_list_prepend:${AS_path}")
|
|
102
|
+
elseif(CMAKE_ASM_COMPILER)
|
|
103
|
+
cmake_path(GET CMAKE_ASM_COMPILER PARENT_PATH AS_path)
|
|
104
|
+
cmake_path(GET CMAKE_ASM_COMPILER FILENAME AS_filename)
|
|
105
|
+
|
|
106
|
+
list(APPEND env "AS=${AS_filename}")
|
|
107
|
+
|
|
108
|
+
list(APPEND args --extra-asflags=--target=${CMAKE_ASM_COMPILER_TARGET})
|
|
109
|
+
|
|
110
|
+
list(APPEND env --modify "PATH=path_list_prepend:${AS_path}")
|
|
111
|
+
endif()
|
|
112
|
+
|
|
113
|
+
if(CMAKE_RC_COMPILER)
|
|
114
|
+
cmake_path(GET CMAKE_RC_COMPILER PARENT_PATH RC_path)
|
|
115
|
+
cmake_path(GET CMAKE_RC_COMPILER FILENAME RC_filename)
|
|
116
|
+
|
|
117
|
+
list(APPEND env "RC=${RC_filename}")
|
|
118
|
+
|
|
119
|
+
list(APPEND env --modify "PATH=path_list_prepend:${RC_path}")
|
|
120
|
+
endif()
|
|
121
|
+
|
|
122
|
+
if(CMAKE_AR)
|
|
123
|
+
cmake_path(GET CMAKE_AR PARENT_PATH AR_path)
|
|
124
|
+
cmake_path(GET CMAKE_AR FILENAME AR_filename)
|
|
125
|
+
|
|
126
|
+
list(APPEND env "AR=${AR_filename}")
|
|
127
|
+
|
|
128
|
+
list(APPEND env --modify "PATH=path_list_prepend:${AR_path}")
|
|
129
|
+
endif()
|
|
130
|
+
|
|
131
|
+
declare_port(
|
|
132
|
+
"git:code.videolan.org/videolan/x264#stable"
|
|
133
|
+
x264
|
|
134
|
+
AUTOTOOLS
|
|
135
|
+
BYPRODUCTS lib/${lib}
|
|
136
|
+
ARGS ${args}
|
|
137
|
+
ENV ${env}
|
|
138
|
+
PATCHES
|
|
139
|
+
patches/01-windows-clang.patch
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
add_library(x264 STATIC IMPORTED GLOBAL)
|
|
143
|
+
|
|
144
|
+
add_dependencies(x264 ${x264})
|
|
145
|
+
|
|
146
|
+
set_target_properties(
|
|
147
|
+
x264
|
|
148
|
+
PROPERTIES
|
|
149
|
+
IMPORTED_LOCATION "${x264_PREFIX}/lib/${lib}"
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
file(MAKE_DIRECTORY "${x264_PREFIX}/include")
|
|
153
|
+
|
|
154
|
+
target_include_directories(
|
|
155
|
+
x264
|
|
156
|
+
INTERFACE "${x264_PREFIX}/include"
|
|
157
|
+
)
|
package/lib/codec-context.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const binding = require('../binding')
|
|
2
2
|
const Rational = require('./rational')
|
|
3
|
+
const ChannelLayout = require('./channel-layout')
|
|
3
4
|
|
|
4
5
|
module.exports = class FFmpegCodecContext {
|
|
5
6
|
constructor(codec) {
|
|
@@ -45,6 +46,14 @@ module.exports = class FFmpegCodecContext {
|
|
|
45
46
|
return binding.setCodecContextSampleFormat(this._handle, value)
|
|
46
47
|
}
|
|
47
48
|
|
|
49
|
+
get sampleRate() {
|
|
50
|
+
return binding.getCodecContextSampleRate(this._handle)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
set sampleRate(value) {
|
|
54
|
+
binding.setCodecContextSampleRate(this._handle, value)
|
|
55
|
+
}
|
|
56
|
+
|
|
48
57
|
get timeBase() {
|
|
49
58
|
const view = new Int32Array(binding.getCodecContextTimeBase(this._handle))
|
|
50
59
|
return new Rational(view[0], view[1])
|
|
@@ -58,6 +67,16 @@ module.exports = class FFmpegCodecContext {
|
|
|
58
67
|
)
|
|
59
68
|
}
|
|
60
69
|
|
|
70
|
+
get channelLayout() {
|
|
71
|
+
return new ChannelLayout(binding.getCodecContextChannelLayout(this._handle))
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
set channelLayout(value) {
|
|
75
|
+
using copy = ChannelLayout.from(value)
|
|
76
|
+
|
|
77
|
+
binding.setCodecContextChannelLayout(this._handle, copy._handle)
|
|
78
|
+
}
|
|
79
|
+
|
|
61
80
|
open(options) {
|
|
62
81
|
if (this._opened) return
|
|
63
82
|
this._opened = true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bare-ffmpeg",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-12",
|
|
4
4
|
"description": "Low-level FFmpeg bindings for Bare",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -8,11 +8,12 @@
|
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"index.js",
|
|
11
|
-
"binding.
|
|
11
|
+
"binding.cc",
|
|
12
12
|
"binding.js",
|
|
13
13
|
"CMakeLists.txt",
|
|
14
14
|
"lib",
|
|
15
|
-
"prebuilds"
|
|
15
|
+
"prebuilds",
|
|
16
|
+
"cmake"
|
|
16
17
|
],
|
|
17
18
|
"addon": true,
|
|
18
19
|
"scripts": {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|