bare-ffmpeg 1.0.0-11 → 1.0.0-13

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.
@@ -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
+ )
@@ -10,15 +10,6 @@ module.exports = class FFmpegChannelLayout {
10
10
  return binding.getChannelLayoutNbChannels(this._handle)
11
11
  }
12
12
 
13
- destroy() {
14
- binding.destroyChannelLayout(this._handle)
15
- this._handle = null
16
- }
17
-
18
- [Symbol.dispose]() {
19
- this.destroy()
20
- }
21
-
22
13
  static from(value) {
23
14
  if (typeof value === 'string') value = constants.toChannelLayout(value)
24
15
 
@@ -72,9 +72,10 @@ module.exports = class FFmpegCodecContext {
72
72
  }
73
73
 
74
74
  set channelLayout(value) {
75
- using copy = ChannelLayout.from(value)
76
-
77
- binding.setCodecContextChannelLayout(this._handle, copy._handle)
75
+ binding.setCodecContextChannelLayout(
76
+ this._handle,
77
+ ChannelLayout.from(value)._handle
78
+ )
78
79
  }
79
80
 
80
81
  open(options) {
@@ -6,10 +6,6 @@ module.exports = class FFmpegCodecParameters {
6
6
  this._handle = handle
7
7
  }
8
8
 
9
- destroy() {
10
- this._handle = null
11
- }
12
-
13
9
  get bitRate() {
14
10
  return binding.getCodecParametersBitRate(this._handle)
15
11
  }
@@ -51,8 +47,4 @@ module.exports = class FFmpegCodecParameters {
51
47
  toContext(context) {
52
48
  binding.codecParametersToContext(context._handle, this._handle)
53
49
  }
54
-
55
- [Symbol.dispose]() {
56
- this.destroy()
57
- }
58
50
  }
@@ -16,9 +16,6 @@ class FFmpegFormatContext {
16
16
  this._io.destroy()
17
17
  this._io = null
18
18
  }
19
-
20
- for (const stream of this._streams) stream.destroy()
21
- this._streams = []
22
19
  }
23
20
 
24
21
  get io() {
package/lib/frame.js CHANGED
@@ -48,9 +48,10 @@ module.exports = class FFmpegFrame {
48
48
  }
49
49
 
50
50
  set channelLayout(value) {
51
- using copy = ChannelLayout.from(value)
52
-
53
- binding.setFrameChannelLayout(this._handle, copy._handle)
51
+ binding.setFrameChannelLayout(
52
+ this._handle,
53
+ ChannelLayout.from(value)._handle
54
+ )
54
55
  }
55
56
 
56
57
  get nbSamples() {
package/lib/stream.js CHANGED
@@ -14,11 +14,6 @@ module.exports = class FFmpegStream {
14
14
  )
15
15
  }
16
16
 
17
- destroy() {
18
- this._codecParameters.destroy()
19
- this._codecParameters = null
20
- }
21
-
22
17
  get codec() {
23
18
  return this._codec
24
19
  }
@@ -38,8 +33,4 @@ module.exports = class FFmpegStream {
38
33
  this._codecParameters.toContext(context)
39
34
  return context.open()
40
35
  }
41
-
42
- [Symbol.dispose]() {
43
- this.destroy()
44
- }
45
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-ffmpeg",
3
- "version": "1.0.0-11",
3
+ "version": "1.0.0-13",
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.c",
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": {