bare-ffmpeg 1.0.0-6 → 1.0.0-7
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 +10 -3
- package/index.js +2 -0
- package/lib/codec-context.js +5 -4
- package/lib/codec.js +2 -0
- package/lib/constants.js +23 -1
- package/lib/dictionary.js +3 -1
- package/lib/frame.js +25 -5
- package/lib/image.js +1 -0
- package/lib/io-context.js +5 -1
- package/lib/packet.js +1 -1
- package/lib/resampler.js +49 -0
- package/package.json +2 -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.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
- package/binding.c +0 -2184
package/CMakeLists.txt
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
cmake_minimum_required(VERSION 3.25)
|
|
2
2
|
|
|
3
3
|
find_package(cmake-bare REQUIRED PATHS node_modules/cmake-bare)
|
|
4
|
+
find_package(cmake-harden REQUIRED PATHS node_modules/cmake-harden)
|
|
4
5
|
find_package(cmake-ports REQUIRED PATHS node_modules/cmake-ports)
|
|
5
6
|
|
|
6
|
-
project(bare_ffmpeg C)
|
|
7
|
+
project(bare_ffmpeg C CXX)
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
fetch_package("github:holepunchto/libjstl#096669a")
|
|
10
|
+
|
|
11
|
+
find_port(ffmpeg FEATURES dav1d svt-av1 x264)
|
|
9
12
|
|
|
10
13
|
add_bare_module(bare_ffmpeg)
|
|
11
14
|
|
|
15
|
+
harden(${bare_ffmpeg})
|
|
16
|
+
|
|
12
17
|
target_sources(
|
|
13
18
|
${bare_ffmpeg}
|
|
14
19
|
PRIVATE
|
|
15
|
-
binding.
|
|
20
|
+
binding.cc
|
|
16
21
|
)
|
|
17
22
|
|
|
18
23
|
target_link_libraries(
|
|
@@ -22,5 +27,7 @@ target_link_libraries(
|
|
|
22
27
|
avdevice
|
|
23
28
|
avformat
|
|
24
29
|
avutil
|
|
30
|
+
swresample
|
|
25
31
|
swscale
|
|
32
|
+
jstl
|
|
26
33
|
)
|
package/index.js
CHANGED
|
@@ -17,6 +17,7 @@ const Scaler = require('./lib/scaler')
|
|
|
17
17
|
const Stream = require('./lib/stream')
|
|
18
18
|
const Rational = require('./lib/rational')
|
|
19
19
|
const Dictionary = require('./lib/dictionary')
|
|
20
|
+
const Resampler = require('./lib/resampler')
|
|
20
21
|
|
|
21
22
|
exports.Codec = Codec
|
|
22
23
|
exports.CodecContext = CodecContext
|
|
@@ -35,5 +36,6 @@ exports.Scaler = Scaler
|
|
|
35
36
|
exports.Stream = Stream
|
|
36
37
|
exports.Rational = Rational
|
|
37
38
|
exports.Dictionary = Dictionary
|
|
39
|
+
exports.Resampler = Resampler
|
|
38
40
|
|
|
39
41
|
exports.constants = require('./lib/constants')
|
package/lib/codec-context.js
CHANGED
|
@@ -46,10 +46,11 @@ module.exports = class FFmpegCodecContext extends ReferenceCounted {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
set timeBase(value) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
binding.setCodecContextTimeBase(
|
|
50
|
+
this._handle,
|
|
51
|
+
value.numerator,
|
|
52
|
+
value.denominator
|
|
53
|
+
)
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
open(options) {
|
package/lib/codec.js
CHANGED
package/lib/constants.js
CHANGED
|
@@ -3,7 +3,9 @@ const binding = require('../binding')
|
|
|
3
3
|
module.exports = exports = {
|
|
4
4
|
codecs: {
|
|
5
5
|
MJPEG: binding.AV_CODEC_ID_MJPEG,
|
|
6
|
-
H264: binding.AV_CODEC_ID_H264
|
|
6
|
+
H264: binding.AV_CODEC_ID_H264,
|
|
7
|
+
AAC: binding.AV_CODEC_ID_AAC,
|
|
8
|
+
AV1: binding.AV_CODEC_ID_AV1
|
|
7
9
|
},
|
|
8
10
|
pixelFormats: {
|
|
9
11
|
RGBA: binding.AV_PIX_FMT_RGBA,
|
|
@@ -20,6 +22,26 @@ module.exports = exports = {
|
|
|
20
22
|
SUBTITLE: binding.AVMEDIA_TYPE_SUBTITLE,
|
|
21
23
|
ATTACHEMENT: binding.AVMEDIA_TYPE_ATTACHMENT,
|
|
22
24
|
NB: binding.AVMEDIA_TYPE_NB
|
|
25
|
+
},
|
|
26
|
+
sampleFormats: {
|
|
27
|
+
NONE: binding.AV_SAMPLE_FMT_NONE,
|
|
28
|
+
U8: binding.AV_SAMPLE_FMT_U8,
|
|
29
|
+
S16: binding.AV_SAMPLE_FMT_S16,
|
|
30
|
+
S32: binding.AV_SAMPLE_FMT_S32,
|
|
31
|
+
FLT: binding.AV_SAMPLE_FMT_FLT,
|
|
32
|
+
FLTP: binding.AV_SAMPLE_FMT_FLTP,
|
|
33
|
+
DBL: binding.AV_SAMPLE_FMT_DBL,
|
|
34
|
+
U8P: binding.AV_SAMPLE_FMT_U8P,
|
|
35
|
+
S16P: binding.AV_SAMPLE_FMT_S16P,
|
|
36
|
+
S32P: binding.AV_SAMPLE_FMT_S32P,
|
|
37
|
+
DBLP: binding.AV_SAMPLE_FMT_DBLP,
|
|
38
|
+
S64: binding.AV_SAMPLE_FMT_S64,
|
|
39
|
+
S64P: binding.AV_SAMPLE_FMT_S64P,
|
|
40
|
+
NB: binding.AV_SAMPLE_FMT_NB
|
|
41
|
+
},
|
|
42
|
+
channelLayouts: {
|
|
43
|
+
MONO: binding.AV_CH_LAYOUT_MONO,
|
|
44
|
+
STEREO: binding.AV_CH_LAYOUT_STEREO
|
|
23
45
|
}
|
|
24
46
|
}
|
|
25
47
|
|
package/lib/dictionary.js
CHANGED
|
@@ -14,7 +14,9 @@ module.exports = class FFmpegDictionary extends ReferenceCounted {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
get(key) {
|
|
17
|
-
|
|
17
|
+
const value = binding.getDictionaryEntry(this._handle, key)
|
|
18
|
+
if (value === undefined) return null
|
|
19
|
+
return value
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
set(key, value) {
|
package/lib/frame.js
CHANGED
|
@@ -37,12 +37,32 @@ module.exports = class FFmpegFrame extends ReferenceCounted {
|
|
|
37
37
|
binding.setFramePixelFormat(this._handle, value)
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
get format() {
|
|
41
|
+
return binding.getFrameFormat(this._handle)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
set format(value) {
|
|
45
|
+
binding.setFrameFormat(this._handle, value)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
get channelLayout() {
|
|
49
|
+
return binding.getFrameChannelLayout(this._handle)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
set channelLayout(value) {
|
|
53
|
+
binding.setFrameChannelLayout(this._handle, value)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
get nbSamples() {
|
|
57
|
+
return binding.getFrameNbSamples(this._handle)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
set nbSamples(value) {
|
|
61
|
+
binding.setFrameNbSamples(this._handle, value)
|
|
62
|
+
}
|
|
44
63
|
|
|
45
|
-
|
|
64
|
+
audioChannel() {
|
|
65
|
+
return binding.getFrameAudioChannel(this._handle)
|
|
46
66
|
}
|
|
47
67
|
|
|
48
68
|
alloc() {
|
package/lib/image.js
CHANGED
package/lib/io-context.js
CHANGED
|
@@ -5,7 +5,11 @@ module.exports = class FFmpegIOContext extends ReferenceCounted {
|
|
|
5
5
|
constructor(buffer = Buffer.alloc(0)) {
|
|
6
6
|
super()
|
|
7
7
|
|
|
8
|
-
this._handle = binding.initIOContext(
|
|
8
|
+
this._handle = binding.initIOContext(
|
|
9
|
+
buffer.buffer,
|
|
10
|
+
buffer.byteOffset,
|
|
11
|
+
buffer.byteLength
|
|
12
|
+
)
|
|
9
13
|
}
|
|
10
14
|
|
|
11
15
|
_destroy() {
|
package/lib/packet.js
CHANGED
package/lib/resampler.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const binding = require('../binding')
|
|
2
|
+
|
|
3
|
+
class Resampler {
|
|
4
|
+
constructor(
|
|
5
|
+
inputSampleRate,
|
|
6
|
+
inputChannelLayout,
|
|
7
|
+
inputFormat,
|
|
8
|
+
outputSampleRate,
|
|
9
|
+
outputChannelLayout,
|
|
10
|
+
outputFormat
|
|
11
|
+
) {
|
|
12
|
+
this._handle = binding.initResampler(
|
|
13
|
+
inputSampleRate,
|
|
14
|
+
inputFormat,
|
|
15
|
+
inputChannelLayout,
|
|
16
|
+
outputSampleRate,
|
|
17
|
+
outputFormat,
|
|
18
|
+
outputChannelLayout
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
this.inputSampleRate = inputSampleRate
|
|
22
|
+
this.outputSampleRate = outputSampleRate
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
convert(inputFrame, outputFrame) {
|
|
26
|
+
return binding.convertResampler(
|
|
27
|
+
this._handle,
|
|
28
|
+
inputFrame._handle,
|
|
29
|
+
outputFrame._handle
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
get delay() {
|
|
34
|
+
return binding.getResamplerDelay(this._handle, this.inputSampleRate)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
flush(outputFrame) {
|
|
38
|
+
return binding.flushResampler(this._handle, outputFrame._handle)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
destroy() {
|
|
42
|
+
if (this._handle) {
|
|
43
|
+
binding.destroyResampler(this._handle)
|
|
44
|
+
this._handle = null
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
module.exports = Resampler
|
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-7",
|
|
4
4
|
"description": "Low-level FFmpeg bindings for Bare",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"brittle": "^3.4.0",
|
|
33
33
|
"cmake-bare": "^1.1.2",
|
|
34
|
+
"cmake-harden": "^1.0.2",
|
|
34
35
|
"cmake-ports": "^1.5.0",
|
|
35
36
|
"prettier": "^3.3.3",
|
|
36
37
|
"prettier-config-standard": "^7.0.0"
|
|
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
|