bare-ffmpeg 1.0.0-32 → 1.0.0-33
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/CMakeLists.txt +31 -9
- package/README.md +65 -1761
- package/binding.cc +734 -1
- package/cmake/ports/ffmpeg/port.cmake +8 -9
- package/cmake/ports/libdrm/port.cmake +32 -0
- package/cmake/ports/libva/port.cmake +53 -0
- package/cmake/ports/x264/port.cmake +7 -2
- package/index.js +6 -0
- package/lib/codec-context.js +9 -0
- package/lib/codec-parameters.js +32 -0
- package/lib/codec.js +1 -0
- package/lib/constants.js +118 -1
- package/lib/frame.js +19 -0
- package/lib/hw-device-context.js +31 -0
- package/lib/hw-frames-constraints.js +54 -0
- package/lib/hw-frames-context.js +92 -0
- package/package.json +1 -1
- 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/libva-drm.so.2 +0 -0
- package/prebuilds/linux-arm64/bare-ffmpeg/libva.so.2 +0 -0
- package/prebuilds/linux-arm64/bare-ffmpeg.bare +0 -0
- package/prebuilds/linux-x64/bare-ffmpeg/libva-drm.so.2 +0 -0
- package/prebuilds/linux-x64/bare-ffmpeg/libva.so.2 +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
|
@@ -226,15 +226,6 @@ set(pkg_config_path)
|
|
|
226
226
|
|
|
227
227
|
if("gpl" IN_LIST features)
|
|
228
228
|
list(APPEND args --enable-gpl)
|
|
229
|
-
|
|
230
|
-
add_library(postproc STATIC IMPORTED GLOBAL)
|
|
231
|
-
|
|
232
|
-
list(APPEND libraries postproc)
|
|
233
|
-
list(APPEND byproducts lib/libpostproc.a)
|
|
234
|
-
|
|
235
|
-
target_link_libraries(postproc INTERFACE avutil)
|
|
236
|
-
target_link_libraries(avdevice INTERFACE postproc)
|
|
237
|
-
target_link_libraries(avfilter INTERFACE postproc)
|
|
238
229
|
endif()
|
|
239
230
|
|
|
240
231
|
if("zlib" IN_LIST features)
|
|
@@ -281,6 +272,14 @@ if("opus" IN_LIST features)
|
|
|
281
272
|
target_link_libraries(avcodec INTERFACE opus)
|
|
282
273
|
endif()
|
|
283
274
|
|
|
275
|
+
if(LINUX)
|
|
276
|
+
find_port(libva)
|
|
277
|
+
|
|
278
|
+
list(APPEND args --enable-vaapi)
|
|
279
|
+
list(APPEND pkg_config_path "${libva_PREFIX}/lib/pkgconfig")
|
|
280
|
+
list(APPEND pkg_config_path "${libdrm_PREFIX}/lib/pkgconfig")
|
|
281
|
+
endif()
|
|
282
|
+
|
|
284
283
|
if(CMAKE_HOST_WIN32)
|
|
285
284
|
find_path(
|
|
286
285
|
msys2
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
include_guard(GLOBAL)
|
|
2
|
+
|
|
3
|
+
declare_port(
|
|
4
|
+
"git:gitlab.freedesktop.org/mesa/drm#libdrm-2.4.128"
|
|
5
|
+
libdrm
|
|
6
|
+
MESON
|
|
7
|
+
BYPRODUCTS
|
|
8
|
+
lib/libdrm.a
|
|
9
|
+
ARGS
|
|
10
|
+
-Dcairo-tests=disabled
|
|
11
|
+
-Dman-pages=disabled
|
|
12
|
+
-Dvalgrind=disabled
|
|
13
|
+
-Dinstall-test-programs=false
|
|
14
|
+
-Dudev=true
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
add_library(drm STATIC IMPORTED GLOBAL)
|
|
18
|
+
|
|
19
|
+
add_dependencies(drm ${libdrm})
|
|
20
|
+
|
|
21
|
+
set_target_properties(
|
|
22
|
+
drm
|
|
23
|
+
PROPERTIES
|
|
24
|
+
IMPORTED_LOCATION "${libdrm_PREFIX}/lib/libdrm.a"
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
file(MAKE_DIRECTORY "${libdrm_PREFIX}/include")
|
|
28
|
+
|
|
29
|
+
target_include_directories(
|
|
30
|
+
drm
|
|
31
|
+
INTERFACE "${libdrm_PREFIX}/include"
|
|
32
|
+
)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
include_guard(GLOBAL)
|
|
2
|
+
|
|
3
|
+
find_port(libdrm)
|
|
4
|
+
|
|
5
|
+
declare_port(
|
|
6
|
+
"github:intel/libva#2.22.0"
|
|
7
|
+
libva
|
|
8
|
+
MESON
|
|
9
|
+
DEPENDS drm
|
|
10
|
+
BYPRODUCTS
|
|
11
|
+
lib/libva.so.2.2200.0
|
|
12
|
+
lib/libva-drm.so.2.2200.0
|
|
13
|
+
ARGS
|
|
14
|
+
-Denable_docs=false
|
|
15
|
+
-Ddisable_drm=false
|
|
16
|
+
ENV
|
|
17
|
+
"PKG_CONFIG_PATH=${libdrm_PREFIX}/lib/pkgconfig"
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
add_library(va SHARED IMPORTED GLOBAL)
|
|
21
|
+
add_library(va-drm SHARED IMPORTED GLOBAL)
|
|
22
|
+
|
|
23
|
+
add_dependencies(va ${libva})
|
|
24
|
+
add_dependencies(va-drm ${libva})
|
|
25
|
+
|
|
26
|
+
set_target_properties(
|
|
27
|
+
va
|
|
28
|
+
PROPERTIES
|
|
29
|
+
IMPORTED_LOCATION "${libva_PREFIX}/lib/libva.so.2.2200.0"
|
|
30
|
+
IMPORTED_SONAME libva.so.2
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
set_target_properties(
|
|
34
|
+
va-drm
|
|
35
|
+
PROPERTIES
|
|
36
|
+
IMPORTED_LOCATION "${libva_PREFIX}/lib/libva-drm.so.2.2200.0"
|
|
37
|
+
IMPORTED_SONAME libva-drm.so.2
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
file(MAKE_DIRECTORY "${libva_PREFIX}/include")
|
|
41
|
+
|
|
42
|
+
target_include_directories(
|
|
43
|
+
va
|
|
44
|
+
INTERFACE "${libva_PREFIX}/include"
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
target_include_directories(
|
|
48
|
+
va-drm
|
|
49
|
+
INTERFACE "${libva_PREFIX}/include"
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
target_link_libraries(va INTERFACE drm)
|
|
53
|
+
target_link_libraries(va-drm INTERFACE drm va)
|
|
@@ -128,6 +128,12 @@ if(CMAKE_AR)
|
|
|
128
128
|
list(APPEND env --modify "PATH=path_list_prepend:${AR_path}")
|
|
129
129
|
endif()
|
|
130
130
|
|
|
131
|
+
set(patches)
|
|
132
|
+
|
|
133
|
+
if(WIN32)
|
|
134
|
+
list(APPEND patches patches/01-windows-clang.patch)
|
|
135
|
+
endif()
|
|
136
|
+
|
|
131
137
|
declare_port(
|
|
132
138
|
"git:code.videolan.org/videolan/x264#stable"
|
|
133
139
|
x264
|
|
@@ -135,8 +141,7 @@ declare_port(
|
|
|
135
141
|
BYPRODUCTS lib/${lib}
|
|
136
142
|
ARGS ${args}
|
|
137
143
|
ENV ${env}
|
|
138
|
-
PATCHES
|
|
139
|
-
patches/01-windows-clang.patch
|
|
144
|
+
PATCHES ${patches}
|
|
140
145
|
)
|
|
141
146
|
|
|
142
147
|
add_library(x264 STATIC IMPORTED GLOBAL)
|
package/index.js
CHANGED
|
@@ -12,6 +12,9 @@ const FilterContext = require('./lib/filter-context')
|
|
|
12
12
|
const FilterGraph = require('./lib/filter-graph')
|
|
13
13
|
const FilterInOut = require('./lib/filter-inout')
|
|
14
14
|
const Frame = require('./lib/frame')
|
|
15
|
+
const HWDeviceContext = require('./lib/hw-device-context')
|
|
16
|
+
const HWFramesContext = require('./lib/hw-frames-context')
|
|
17
|
+
const HWFramesConstraints = require('./lib/hw-frames-constraints')
|
|
15
18
|
const IOContext = require('./lib/io-context')
|
|
16
19
|
const Image = require('./lib/image')
|
|
17
20
|
const InputFormat = require('./lib/input-format')
|
|
@@ -37,6 +40,9 @@ exports.FilterContext = FilterContext
|
|
|
37
40
|
exports.FilterGraph = FilterGraph
|
|
38
41
|
exports.FilterInOut = FilterInOut
|
|
39
42
|
exports.Frame = Frame
|
|
43
|
+
exports.HWDeviceContext = HWDeviceContext
|
|
44
|
+
exports.HWFramesContext = HWFramesContext
|
|
45
|
+
exports.HWFramesConstraints = HWFramesConstraints
|
|
40
46
|
exports.IOContext = IOContext
|
|
41
47
|
exports.Image = Image
|
|
42
48
|
exports.InputFormat = InputFormat
|
package/lib/codec-context.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const binding = require('../binding')
|
|
2
2
|
const Rational = require('./rational')
|
|
3
3
|
const ChannelLayout = require('./channel-layout')
|
|
4
|
+
const HWDeviceContext = require('./hw-device-context')
|
|
4
5
|
const { codecConfig, optionFlags } = require('./constants')
|
|
5
6
|
|
|
6
7
|
module.exports = class FFmpegCodecContext {
|
|
@@ -121,6 +122,14 @@ module.exports = class FFmpegCodecContext {
|
|
|
121
122
|
binding.setCodecContextRequestSampleFormat(this._handle, sampleFormat)
|
|
122
123
|
}
|
|
123
124
|
|
|
125
|
+
get hwDeviceCtx() {
|
|
126
|
+
return HWDeviceContext.from(binding.getCodecContextHWDeviceCtx(this._handle))
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
set hwDeviceCtx(hwDeviceContext) {
|
|
130
|
+
binding.setCodecContextHWDeviceCtx(this._handle, hwDeviceContext._handle)
|
|
131
|
+
}
|
|
132
|
+
|
|
124
133
|
set getFormat(callback) {
|
|
125
134
|
const wrap = (pixelFormats) => {
|
|
126
135
|
return callback(this, pixelFormats)
|
package/lib/codec-parameters.js
CHANGED
|
@@ -201,6 +201,38 @@ module.exports = class FFmpegCodecParameters {
|
|
|
201
201
|
binding.setCodecParametersSeekPreroll(this._handle, value)
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
+
get colorSpace() {
|
|
205
|
+
return binding.getCodecParametersColorSpace(this._handle)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
set colorSpace(value) {
|
|
209
|
+
binding.setCodecParametersColorSpace(this._handle, value)
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
get colorPrimaries() {
|
|
213
|
+
return binding.getCodecParametersColorPrimaries(this._handle)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
set colorPrimaries(value) {
|
|
217
|
+
binding.setCodecParametersColorPrimaries(this._handle, value)
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
get colorTRC() {
|
|
221
|
+
return binding.getCodecParametersColorTRC(this._handle)
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
set colorTRC(value) {
|
|
225
|
+
binding.setCodecParametersColorTRC(this._handle, value)
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
get colorRange() {
|
|
229
|
+
return binding.getCodecParametersColorRange(this._handle)
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
set colorRange(value) {
|
|
233
|
+
binding.setCodecParametersColorRange(this._handle, value)
|
|
234
|
+
}
|
|
235
|
+
|
|
204
236
|
// Methods
|
|
205
237
|
|
|
206
238
|
fromContext(context) {
|
package/lib/codec.js
CHANGED
|
@@ -51,6 +51,7 @@ module.exports = class FFmpegCodec {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
static MJPEG = this.for(constants.codecs.MJPEG)
|
|
54
|
+
static H264 = this.for(constants.codecs.H264)
|
|
54
55
|
static AAC = this.for(constants.codecs.AAC)
|
|
55
56
|
static OPUS = this.for(constants.codecs.OPUS)
|
|
56
57
|
static AV1 = this.for(constants.codecs.AV1)
|
package/lib/constants.js
CHANGED
|
@@ -10,15 +10,28 @@ function makeTag(a, b, c, d) {
|
|
|
10
10
|
module.exports = exports = {
|
|
11
11
|
codecs: {
|
|
12
12
|
MJPEG: binding.AV_CODEC_ID_MJPEG,
|
|
13
|
+
H264: binding.AV_CODEC_ID_H264,
|
|
14
|
+
AVC: binding.AV_CODEC_ID_H264, // Alias for H264
|
|
13
15
|
AAC: binding.AV_CODEC_ID_AAC,
|
|
14
16
|
OPUS: binding.AV_CODEC_ID_OPUS,
|
|
15
17
|
AV1: binding.AV_CODEC_ID_AV1,
|
|
16
18
|
FLAC: binding.AV_CODEC_ID_FLAC,
|
|
17
|
-
MP3: binding.AV_CODEC_ID_MP3
|
|
19
|
+
MP3: binding.AV_CODEC_ID_MP3,
|
|
20
|
+
H265: binding.AV_CODEC_ID_HEVC,
|
|
21
|
+
HEVC: binding.AV_CODEC_ID_HEVC,
|
|
22
|
+
VP8: binding.AV_CODEC_ID_VP8,
|
|
23
|
+
VP9: binding.AV_CODEC_ID_VP9,
|
|
24
|
+
VORBIS: binding.AV_CODEC_ID_VORBIS,
|
|
25
|
+
PCM_S16LE: binding.AV_CODEC_ID_PCM_S16LE,
|
|
26
|
+
PCM_S16BE: binding.AV_CODEC_ID_PCM_S16BE,
|
|
27
|
+
PCM_U8: binding.AV_CODEC_ID_PCM_U8,
|
|
28
|
+
PCM_ALAW: binding.AV_CODEC_ID_PCM_ALAW,
|
|
29
|
+
PCM_MULAW: binding.AV_CODEC_ID_PCM_MULAW
|
|
18
30
|
},
|
|
19
31
|
tags: {
|
|
20
32
|
MJPEG: makeTag('M', 'J', 'P', 'G'),
|
|
21
33
|
AV1: makeTag('A', 'V', '0', '1'),
|
|
34
|
+
H264: makeTag('H', '2', '6', '4'),
|
|
22
35
|
AAC: 0x00ff,
|
|
23
36
|
FLAC: 0xf1ac,
|
|
24
37
|
MP3: 0x0055
|
|
@@ -209,6 +222,86 @@ module.exports = exports = {
|
|
|
209
222
|
ALLOW_NULL: binding.AV_OPT_ALLOW_NULL,
|
|
210
223
|
ARRAY_REPLACE: binding.AV_OPT_ARRAY_REPLACE,
|
|
211
224
|
MULTI_COMPONENT_RANGE: binding.AV_OPT_MULTI_COMPONENT_RANGE
|
|
225
|
+
},
|
|
226
|
+
hwDeviceTypes: {
|
|
227
|
+
VIDEOTOOLBOX: binding.AV_HWDEVICE_TYPE_VIDEOTOOLBOX,
|
|
228
|
+
CUDA: binding.AV_HWDEVICE_TYPE_CUDA,
|
|
229
|
+
VAAPI: binding.AV_HWDEVICE_TYPE_VAAPI,
|
|
230
|
+
DXVA2: binding.AV_HWDEVICE_TYPE_DXVA2,
|
|
231
|
+
QSV: binding.AV_HWDEVICE_TYPE_QSV,
|
|
232
|
+
D3D11VA: binding.AV_HWDEVICE_TYPE_D3D11VA
|
|
233
|
+
},
|
|
234
|
+
hwFrameMapFlags: {
|
|
235
|
+
NONE: 0,
|
|
236
|
+
READ: binding.AV_HWFRAME_MAP_READ,
|
|
237
|
+
WRITE: binding.AV_HWFRAME_MAP_WRITE,
|
|
238
|
+
OVERWRITE: binding.AV_HWFRAME_MAP_OVERWRITE,
|
|
239
|
+
DIRECT: binding.AV_HWFRAME_MAP_DIRECT
|
|
240
|
+
},
|
|
241
|
+
colorSpace: {
|
|
242
|
+
RGB: binding.AVCOL_SPC_RGB,
|
|
243
|
+
BT709: binding.AVCOL_SPC_BT709,
|
|
244
|
+
UNSPECIFIED: binding.AVCOL_SPC_UNSPECIFIED,
|
|
245
|
+
RESERVED: binding.AVCOL_SPC_RESERVED,
|
|
246
|
+
FCC: binding.AVCOL_SPC_FCC,
|
|
247
|
+
BT470BG: binding.AVCOL_SPC_BT470BG,
|
|
248
|
+
SMPTE170M: binding.AVCOL_SPC_SMPTE170M,
|
|
249
|
+
SMPTE240M: binding.AVCOL_SPC_SMPTE240M,
|
|
250
|
+
YCGCO: binding.AVCOL_SPC_YCGCO,
|
|
251
|
+
YCOCG: binding.AVCOL_SPC_YCOCG,
|
|
252
|
+
BT2020_NCL: binding.AVCOL_SPC_BT2020_NCL,
|
|
253
|
+
BT2020_CL: binding.AVCOL_SPC_BT2020_CL,
|
|
254
|
+
SMPTE2085: binding.AVCOL_SPC_SMPTE2085,
|
|
255
|
+
CHROMA_DERIVED_NCL: binding.AVCOL_SPC_CHROMA_DERIVED_NCL,
|
|
256
|
+
CHROMA_DERIVED_CL: binding.AVCOL_SPC_CHROMA_DERIVED_CL,
|
|
257
|
+
ICTCP: binding.AVCOL_SPC_ICTCP,
|
|
258
|
+
IPT_C2: binding.AVCOL_SPC_IPT_C2,
|
|
259
|
+
YCGCO_RE: binding.AVCOL_SPC_YCGCO_RE,
|
|
260
|
+
YCGCO_RO: binding.AVCOL_SPC_YCGCO_RO
|
|
261
|
+
},
|
|
262
|
+
colorRange: {
|
|
263
|
+
UNSPECIFIED: binding.AVCOL_RANGE_UNSPECIFIED,
|
|
264
|
+
MPEG: binding.AVCOL_RANGE_MPEG,
|
|
265
|
+
JPEG: binding.AVCOL_RANGE_JPEG
|
|
266
|
+
},
|
|
267
|
+
colorPrimaries: {
|
|
268
|
+
BT709: binding.AVCOL_PRI_BT709,
|
|
269
|
+
UNSPECIFIED: binding.AVCOL_PRI_UNSPECIFIED,
|
|
270
|
+
RESERVED: binding.AVCOL_PRI_RESERVED,
|
|
271
|
+
BT470M: binding.AVCOL_PRI_BT470M,
|
|
272
|
+
BT470BG: binding.AVCOL_PRI_BT470BG,
|
|
273
|
+
SMPTE170M: binding.AVCOL_PRI_SMPTE170M,
|
|
274
|
+
SMPTE240M: binding.AVCOL_PRI_SMPTE240M,
|
|
275
|
+
FILM: binding.AVCOL_PRI_FILM,
|
|
276
|
+
BT2020: binding.AVCOL_PRI_BT2020,
|
|
277
|
+
SMPTE428: binding.AVCOL_PRI_SMPTE428,
|
|
278
|
+
SMPTEST428_1: binding.AVCOL_PRI_SMPTEST428_1,
|
|
279
|
+
SMPTE431: binding.AVCOL_PRI_SMPTE431,
|
|
280
|
+
SMPTE432: binding.AVCOL_PRI_SMPTE432,
|
|
281
|
+
EBU3213: binding.AVCOL_PRI_EBU3213,
|
|
282
|
+
JEDEC_P22: binding.AVCOL_PRI_JEDEC_P22
|
|
283
|
+
},
|
|
284
|
+
colorTRC: {
|
|
285
|
+
BT709: binding.AVCOL_TRC_BT709,
|
|
286
|
+
UNSPECIFIED: binding.AVCOL_TRC_UNSPECIFIED,
|
|
287
|
+
RESERVED: binding.AVCOL_TRC_RESERVED,
|
|
288
|
+
GAMMA22: binding.AVCOL_TRC_GAMMA22,
|
|
289
|
+
GAMMA28: binding.AVCOL_TRC_GAMMA28,
|
|
290
|
+
SMPTE170M: binding.AVCOL_TRC_SMPTE170M,
|
|
291
|
+
SMPTE240M: binding.AVCOL_TRC_SMPTE240M,
|
|
292
|
+
LINEAR: binding.AVCOL_TRC_LINEAR,
|
|
293
|
+
LOG: binding.AVCOL_TRC_LOG,
|
|
294
|
+
LOG_SQRT: binding.AVCOL_TRC_LOG_SQRT,
|
|
295
|
+
IEC61966_2_4: binding.AVCOL_TRC_IEC61966_2_4,
|
|
296
|
+
BT1361_ECG: binding.AVCOL_TRC_BT1361_ECG,
|
|
297
|
+
IEC61966_2_1: binding.AVCOL_TRC_IEC61966_2_1,
|
|
298
|
+
BT2020_10: binding.AVCOL_TRC_BT2020_10,
|
|
299
|
+
BT2020_12: binding.AVCOL_TRC_BT2020_12,
|
|
300
|
+
SMPTE2084: binding.AVCOL_TRC_SMPTE2084,
|
|
301
|
+
SMPTEST2084: binding.AVCOL_TRC_SMPTEST2084,
|
|
302
|
+
SMPTE428: binding.AVCOL_TRC_SMPTE428,
|
|
303
|
+
SMPTEST428_1: binding.AVCOL_TRC_SMPTEST428_1,
|
|
304
|
+
ARIB_STD_B67: binding.AVCOL_TRC_ARIB_STD_B67
|
|
212
305
|
}
|
|
213
306
|
}
|
|
214
307
|
|
|
@@ -267,3 +360,27 @@ exports.getSampleFormatName = function (sampleFormat) {
|
|
|
267
360
|
exports.getPixelFormatName = function (pixelFormat) {
|
|
268
361
|
return binding.getPixelFormatNameByID(pixelFormat)
|
|
269
362
|
}
|
|
363
|
+
|
|
364
|
+
exports.getColorSpaceName = function (colorSpace) {
|
|
365
|
+
return binding.getColorSpaceNameByID(colorSpace)
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
exports.toColorSpace = function (name) {
|
|
369
|
+
return binding.getColorSpaceFromName(name)
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
exports.getColorPrimariesName = function (colorPrimaries) {
|
|
373
|
+
return binding.getColorPrimariesNameByID(colorPrimaries)
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
exports.toColorPrimaries = function (name) {
|
|
377
|
+
return binding.getColorPrimariesFromName(name)
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
exports.getColorTransferName = function (colorTransfer) {
|
|
381
|
+
return binding.getColorTransferNameByID(colorTransfer)
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
exports.toColorTransfer = function (name) {
|
|
385
|
+
return binding.getColorTransferFromName(name)
|
|
386
|
+
}
|
package/lib/frame.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const binding = require('../binding')
|
|
2
2
|
const ChannelLayout = require('./channel-layout')
|
|
3
|
+
const HWFramesContext = require('./hw-frames-context')
|
|
3
4
|
const Rational = require('./rational')
|
|
5
|
+
const constants = require('./constants')
|
|
4
6
|
|
|
5
7
|
module.exports = class FFmpegFrame {
|
|
6
8
|
constructor() {
|
|
@@ -93,10 +95,27 @@ module.exports = class FFmpegFrame {
|
|
|
93
95
|
binding.setFrameSampleRate(this._handle, value)
|
|
94
96
|
}
|
|
95
97
|
|
|
98
|
+
get hwFramesCtx() {
|
|
99
|
+
const handle = binding.getFrameHWFramesCtx(this._handle)
|
|
100
|
+
return handle ? HWFramesContext.from(handle) : null
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
set hwFramesCtx(hwFramesContext) {
|
|
104
|
+
binding.setFrameHWFramesCtx(this._handle, hwFramesContext._handle)
|
|
105
|
+
}
|
|
106
|
+
|
|
96
107
|
copyProperties(source) {
|
|
97
108
|
binding.copyFrameProperties(this._handle, source._handle)
|
|
98
109
|
}
|
|
99
110
|
|
|
111
|
+
transferData(destination) {
|
|
112
|
+
binding.transferFrameData(destination._handle, this._handle)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
hwMap(destination, flags = constants.hwFrameMapFlags.NONE) {
|
|
116
|
+
binding.mapFrame(destination._handle, this._handle, flags)
|
|
117
|
+
}
|
|
118
|
+
|
|
100
119
|
alloc() {
|
|
101
120
|
binding.allocFrame(this._handle, 32)
|
|
102
121
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const binding = require('../binding')
|
|
2
|
+
|
|
3
|
+
module.exports = class HWDeviceContext {
|
|
4
|
+
constructor(type, device = undefined, handle = undefined) {
|
|
5
|
+
if (handle) {
|
|
6
|
+
this._handle = handle
|
|
7
|
+
} else {
|
|
8
|
+
this._handle = binding.initHWDeviceContext(type, device)
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
static from(handle) {
|
|
13
|
+
if (handle == null) return null
|
|
14
|
+
return new HWDeviceContext(null, undefined, handle)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
destroy() {
|
|
18
|
+
binding.destroyHWDeviceContext(this._handle)
|
|
19
|
+
this._handle = null
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
[Symbol.dispose]() {
|
|
23
|
+
this.destroy()
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
[Symbol.for('bare.inspect')]() {
|
|
27
|
+
return {
|
|
28
|
+
__proto__: { constructor: HWDeviceContext }
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const binding = require('../binding')
|
|
2
|
+
|
|
3
|
+
module.exports = class HWFramesConstraints {
|
|
4
|
+
constructor(handle) {
|
|
5
|
+
this._handle = handle
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
get validSwFormats() {
|
|
9
|
+
return binding.getHWFramesConstraintsValidSwFormats(this._handle)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get validHwFormats() {
|
|
13
|
+
return binding.getHWFramesConstraintsValidHwFormats(this._handle)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
get minWidth() {
|
|
17
|
+
return binding.getHWFramesConstraintsMinWidth(this._handle)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get maxWidth() {
|
|
21
|
+
return binding.getHWFramesConstraintsMaxWidth(this._handle)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
get minHeight() {
|
|
25
|
+
return binding.getHWFramesConstraintsMinHeight(this._handle)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
get maxHeight() {
|
|
29
|
+
return binding.getHWFramesConstraintsMaxHeight(this._handle)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Note: HWFramesConstraints is independently allocated by FFmpeg and must be
|
|
33
|
+
// explicitly freed. It is not owned by HWFramesContext.
|
|
34
|
+
destroy() {
|
|
35
|
+
binding.destroyHWFramesConstraints(this._handle)
|
|
36
|
+
this._handle = null
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
[Symbol.dispose]() {
|
|
40
|
+
this.destroy()
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
[Symbol.for('bare.inspect')]() {
|
|
44
|
+
return {
|
|
45
|
+
__proto__: { constructor: HWFramesConstraints },
|
|
46
|
+
validSwFormats: this.validSwFormats,
|
|
47
|
+
validHwFormats: this.validHwFormats,
|
|
48
|
+
minWidth: this.minWidth,
|
|
49
|
+
maxWidth: this.maxWidth,
|
|
50
|
+
minHeight: this.minHeight,
|
|
51
|
+
maxHeight: this.maxHeight
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
const binding = require('../binding')
|
|
2
|
+
const HWFramesConstraints = require('./hw-frames-constraints')
|
|
3
|
+
|
|
4
|
+
module.exports = class HWFramesContext {
|
|
5
|
+
constructor(hwDeviceContext, format, swFormat, width, height, handle = undefined) {
|
|
6
|
+
if (handle) {
|
|
7
|
+
this._handle = handle
|
|
8
|
+
return
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
this._handle = binding.initHWFramesContext(
|
|
12
|
+
hwDeviceContext._handle,
|
|
13
|
+
format,
|
|
14
|
+
swFormat,
|
|
15
|
+
width,
|
|
16
|
+
height
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static from(handle) {
|
|
21
|
+
if (handle == null) return null
|
|
22
|
+
return new HWFramesContext(null, null, null, null, null, handle)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
get format() {
|
|
26
|
+
return binding.getHWFramesContextFormat(this._handle)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
set format(value) {
|
|
30
|
+
binding.setHWFramesContextFormat(this._handle, value)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
get swFormat() {
|
|
34
|
+
return binding.getHWFramesContextSWFormat(this._handle)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
set swFormat(value) {
|
|
38
|
+
binding.setHWFramesContextSWFormat(this._handle, value)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
get width() {
|
|
42
|
+
return binding.getHWFramesContextWidth(this._handle)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
set width(value) {
|
|
46
|
+
binding.setHWFramesContextWidth(this._handle, value)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
get height() {
|
|
50
|
+
return binding.getHWFramesContextHeight(this._handle)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
set height(value) {
|
|
54
|
+
binding.setHWFramesContextHeight(this._handle, value)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
get initialPoolSize() {
|
|
58
|
+
return binding.getHWFramesContextInitialPoolSize(this._handle)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
set initialPoolSize(value) {
|
|
62
|
+
binding.setHWFramesContextInitialPoolSize(this._handle, value)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
getBuffer(frame) {
|
|
66
|
+
binding.getHWFramesContextBuffer(this._handle, frame._handle)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
getConstraints() {
|
|
70
|
+
const handle = binding.getHWFramesContextConstraints(this._handle)
|
|
71
|
+
return new HWFramesConstraints(handle)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
destroy() {
|
|
75
|
+
binding.destroyHWFramesContext(this._handle)
|
|
76
|
+
this._handle = null
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
[Symbol.dispose]() {
|
|
80
|
+
this.destroy()
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
[Symbol.for('bare.inspect')]() {
|
|
84
|
+
return {
|
|
85
|
+
__proto__: { constructor: HWFramesContext },
|
|
86
|
+
format: this.format,
|
|
87
|
+
swFormat: this.swFormat,
|
|
88
|
+
width: this.width,
|
|
89
|
+
height: this.height
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
package/package.json
CHANGED
|
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
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|