bare-ffmpeg 1.0.0-6 → 1.0.0-8
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/README.md +809 -0
- package/index.js +2 -0
- package/lib/codec-context.js +13 -14
- package/lib/codec-parameters.js +6 -5
- package/lib/codec.js +2 -0
- package/lib/constants.js +23 -1
- package/lib/dictionary.js +9 -6
- package/lib/format-context.js +26 -17
- package/lib/frame.js +31 -10
- package/lib/image.js +1 -0
- package/lib/input-format.js +1 -0
- package/lib/io-context.js +11 -6
- package/lib/packet.js +7 -7
- package/lib/resampler.js +53 -0
- package/lib/scaler.js +6 -5
- package/lib/stream.js +6 -5
- 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/lib/reference-counted.js +0 -39
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
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
const binding = require('../binding')
|
|
2
|
-
const ReferenceCounted = require('./reference-counted')
|
|
3
2
|
const Rational = require('./rational')
|
|
4
3
|
|
|
5
|
-
module.exports = class FFmpegCodecContext
|
|
4
|
+
module.exports = class FFmpegCodecContext {
|
|
6
5
|
constructor(codec) {
|
|
7
|
-
super()
|
|
8
|
-
|
|
9
6
|
this._codec = codec
|
|
10
7
|
this._opened = false
|
|
11
8
|
this._handle = binding.initCodecContext(codec._handle)
|
|
12
9
|
}
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
destroy() {
|
|
15
12
|
binding.destroyCodecContext(this._handle)
|
|
16
13
|
this._handle = null
|
|
17
14
|
}
|
|
@@ -46,10 +43,11 @@ module.exports = class FFmpegCodecContext extends ReferenceCounted {
|
|
|
46
43
|
}
|
|
47
44
|
|
|
48
45
|
set timeBase(value) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
binding.setCodecContextTimeBase(
|
|
47
|
+
this._handle,
|
|
48
|
+
value.numerator,
|
|
49
|
+
value.denominator
|
|
50
|
+
)
|
|
53
51
|
}
|
|
54
52
|
|
|
55
53
|
open(options) {
|
|
@@ -64,14 +62,11 @@ module.exports = class FFmpegCodecContext extends ReferenceCounted {
|
|
|
64
62
|
}
|
|
65
63
|
|
|
66
64
|
sendPacket(packet) {
|
|
67
|
-
binding.sendCodecContextPacket(this._handle, packet._handle)
|
|
68
|
-
return this
|
|
65
|
+
return binding.sendCodecContextPacket(this._handle, packet._handle)
|
|
69
66
|
}
|
|
70
67
|
|
|
71
68
|
receivePacket(packet) {
|
|
72
|
-
|
|
73
|
-
if (res) packet._ref()
|
|
74
|
-
return res
|
|
69
|
+
return binding.receiveCodecContextPacket(this._handle, packet._handle)
|
|
75
70
|
}
|
|
76
71
|
|
|
77
72
|
sendFrame(frame) {
|
|
@@ -81,4 +76,8 @@ module.exports = class FFmpegCodecContext extends ReferenceCounted {
|
|
|
81
76
|
receiveFrame(frame) {
|
|
82
77
|
return binding.receiveCodecContextFrame(this._handle, frame._handle)
|
|
83
78
|
}
|
|
79
|
+
|
|
80
|
+
[Symbol.dispose]() {
|
|
81
|
+
this.destroy()
|
|
82
|
+
}
|
|
84
83
|
}
|
package/lib/codec-parameters.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
const binding = require('../binding')
|
|
2
|
-
const ReferenceCounted = require('./reference-counted')
|
|
3
2
|
|
|
4
|
-
module.exports = class FFmpegCodecParameters
|
|
3
|
+
module.exports = class FFmpegCodecParameters {
|
|
5
4
|
constructor(handle) {
|
|
6
|
-
super()
|
|
7
|
-
|
|
8
5
|
this._handle = handle
|
|
9
6
|
}
|
|
10
7
|
|
|
11
|
-
|
|
8
|
+
destroy() {
|
|
12
9
|
this._handle = null
|
|
13
10
|
}
|
|
14
11
|
|
|
@@ -35,4 +32,8 @@ module.exports = class FFmpegCodecParameters extends ReferenceCounted {
|
|
|
35
32
|
toContext(context) {
|
|
36
33
|
binding.codecParametersToContext(context._handle, this._handle)
|
|
37
34
|
}
|
|
35
|
+
|
|
36
|
+
[Symbol.dispose]() {
|
|
37
|
+
this.destroy()
|
|
38
|
+
}
|
|
38
39
|
}
|
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
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
const binding = require('../binding')
|
|
2
|
-
const ReferenceCounted = require('./reference-counted')
|
|
3
2
|
|
|
4
|
-
module.exports = class FFmpegDictionary
|
|
3
|
+
module.exports = class FFmpegDictionary {
|
|
5
4
|
constructor() {
|
|
6
|
-
super()
|
|
7
|
-
|
|
8
5
|
this._handle = binding.initDictionary()
|
|
9
6
|
}
|
|
10
7
|
|
|
11
|
-
|
|
8
|
+
destroy() {
|
|
12
9
|
binding.destroyDictionary(this._handle)
|
|
13
10
|
this._handle = null
|
|
14
11
|
}
|
|
15
12
|
|
|
16
13
|
get(key) {
|
|
17
|
-
|
|
14
|
+
const value = binding.getDictionaryEntry(this._handle, key)
|
|
15
|
+
if (value === undefined) return null
|
|
16
|
+
return value
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
set(key, value) {
|
|
21
20
|
binding.setDictionaryEntry(this._handle, key, value)
|
|
22
21
|
}
|
|
22
|
+
|
|
23
|
+
[Symbol.dispose]() {
|
|
24
|
+
this.destroy()
|
|
25
|
+
}
|
|
23
26
|
}
|
package/lib/format-context.js
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
const binding = require('../binding')
|
|
2
2
|
const Stream = require('./stream.js')
|
|
3
|
-
const ReferenceCounted = require('./reference-counted')
|
|
4
3
|
const OutputFormat = require('./output-format')
|
|
5
4
|
const IOContext = require('./io-context')
|
|
6
5
|
const InputFormat = require('./input-format')
|
|
7
6
|
const Dictionary = require('./dictionary')
|
|
8
7
|
|
|
9
|
-
class FFmpegFormatContext
|
|
8
|
+
class FFmpegFormatContext {
|
|
10
9
|
constructor(io) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
this._io = io ? io._ref() : null
|
|
10
|
+
this._io = io
|
|
14
11
|
this._streams = []
|
|
15
12
|
}
|
|
16
13
|
|
|
17
|
-
|
|
14
|
+
destroy() {
|
|
18
15
|
if (this._io) {
|
|
19
|
-
this._io.
|
|
16
|
+
this._io.destroy()
|
|
20
17
|
this._io = null
|
|
21
18
|
}
|
|
22
19
|
|
|
@@ -33,13 +30,19 @@ class FFmpegFormatContext extends ReferenceCounted {
|
|
|
33
30
|
}
|
|
34
31
|
|
|
35
32
|
readFrame(packet) {
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
return binding.readFormatContextFrame(this._handle, packet._handle)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
getBestStreamIndex(type) {
|
|
37
|
+
return binding.getFormatContextBestStreamIndex(this._handle, type)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
getStream(index) {
|
|
41
|
+
if (index < 0 || index >= this._streams.length) {
|
|
42
|
+
return null
|
|
38
43
|
}
|
|
39
44
|
|
|
40
|
-
|
|
41
|
-
if (result) packet._ref()
|
|
42
|
-
return result
|
|
45
|
+
return this._streams[index]
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
getBestStream(type) {
|
|
@@ -58,16 +61,22 @@ class FFmpegFormatContext extends ReferenceCounted {
|
|
|
58
61
|
|
|
59
62
|
return this._streams[bestIndex]
|
|
60
63
|
}
|
|
64
|
+
|
|
65
|
+
[Symbol.dispose]() {
|
|
66
|
+
this.destroy()
|
|
67
|
+
}
|
|
61
68
|
}
|
|
62
69
|
|
|
63
70
|
let defaultURL = null
|
|
64
71
|
|
|
65
72
|
switch (Bare.platform) {
|
|
66
73
|
case 'darwin':
|
|
67
|
-
defaultURL = '0'
|
|
74
|
+
defaultURL = '0:0'
|
|
68
75
|
break
|
|
69
76
|
case 'linux':
|
|
70
77
|
// TODO: test on real machine
|
|
78
|
+
// we might need separate contexts for linux
|
|
79
|
+
// video: V4L2 and audio: ALSA/PulseAudio
|
|
71
80
|
defaultURL = '/dev/video0'
|
|
72
81
|
break
|
|
73
82
|
case 'win32':
|
|
@@ -102,8 +111,8 @@ exports.InputFormatContext = class FFmpegInputFormatContext extends (
|
|
|
102
111
|
}
|
|
103
112
|
}
|
|
104
113
|
|
|
105
|
-
|
|
106
|
-
super.
|
|
114
|
+
destroy() {
|
|
115
|
+
super.destroy()
|
|
107
116
|
|
|
108
117
|
binding.closeInputFormatContext(this._handle)
|
|
109
118
|
this._handle = null
|
|
@@ -121,8 +130,8 @@ exports.OutputFormatContext = class FFmpegOutputFormatContext extends (
|
|
|
121
130
|
this._handle = binding.openOutputFormatContext(format._handle, io._handle)
|
|
122
131
|
}
|
|
123
132
|
|
|
124
|
-
|
|
125
|
-
super.
|
|
133
|
+
destroy() {
|
|
134
|
+
super.destroy()
|
|
126
135
|
|
|
127
136
|
binding.closeOutputFormatContext(this._handle)
|
|
128
137
|
this._handle = null
|
package/lib/frame.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
const binding = require('../binding')
|
|
2
|
-
const ReferenceCounted = require('./reference-counted')
|
|
3
2
|
|
|
4
|
-
module.exports = class FFmpegFrame
|
|
3
|
+
module.exports = class FFmpegFrame {
|
|
5
4
|
constructor() {
|
|
6
|
-
super()
|
|
7
|
-
|
|
8
5
|
this._handle = binding.initFrame()
|
|
9
6
|
}
|
|
10
7
|
|
|
11
|
-
|
|
8
|
+
destroy() {
|
|
12
9
|
binding.destroyFrame(this._handle)
|
|
13
10
|
this._handle = null
|
|
14
11
|
}
|
|
@@ -37,15 +34,39 @@ module.exports = class FFmpegFrame extends ReferenceCounted {
|
|
|
37
34
|
binding.setFramePixelFormat(this._handle, value)
|
|
38
35
|
}
|
|
39
36
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
get format() {
|
|
38
|
+
return binding.getFrameFormat(this._handle)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
set format(value) {
|
|
42
|
+
binding.setFrameFormat(this._handle, value)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
get channelLayout() {
|
|
46
|
+
return binding.getFrameChannelLayout(this._handle)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
set channelLayout(value) {
|
|
50
|
+
binding.setFrameChannelLayout(this._handle, value)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
get nbSamples() {
|
|
54
|
+
return binding.getFrameNbSamples(this._handle)
|
|
55
|
+
}
|
|
44
56
|
|
|
45
|
-
|
|
57
|
+
set nbSamples(value) {
|
|
58
|
+
binding.setFrameNbSamples(this._handle, value)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
audioChannel() {
|
|
62
|
+
return binding.getFrameAudioChannel(this._handle)
|
|
46
63
|
}
|
|
47
64
|
|
|
48
65
|
alloc() {
|
|
49
66
|
binding.allocFrame(this._handle, 32)
|
|
50
67
|
}
|
|
68
|
+
|
|
69
|
+
[Symbol.dispose]() {
|
|
70
|
+
this.destroy()
|
|
71
|
+
}
|
|
51
72
|
}
|
package/lib/image.js
CHANGED
package/lib/input-format.js
CHANGED
package/lib/io-context.js
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
const binding = require('../binding')
|
|
2
|
-
const ReferenceCounted = require('./reference-counted')
|
|
3
2
|
|
|
4
|
-
module.exports = class FFmpegIOContext
|
|
3
|
+
module.exports = class FFmpegIOContext {
|
|
5
4
|
constructor(buffer = Buffer.alloc(0)) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
this._handle = binding.initIOContext(
|
|
6
|
+
buffer.buffer,
|
|
7
|
+
buffer.byteOffset,
|
|
8
|
+
buffer.byteLength
|
|
9
|
+
)
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
destroy() {
|
|
12
13
|
binding.destroyIOContext(this._handle)
|
|
13
14
|
this._handle = null
|
|
14
15
|
}
|
|
16
|
+
|
|
17
|
+
[Symbol.dispose]() {
|
|
18
|
+
this.destroy()
|
|
19
|
+
}
|
|
15
20
|
}
|
package/lib/packet.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
const binding = require('../binding')
|
|
2
|
-
const ReferenceCounted = require('./reference-counted')
|
|
3
2
|
|
|
4
|
-
module.exports = class FFmpegPacket
|
|
3
|
+
module.exports = class FFmpegPacket {
|
|
5
4
|
constructor(buffer) {
|
|
6
|
-
super()
|
|
7
|
-
|
|
8
5
|
if (buffer) {
|
|
9
6
|
this._handle = binding.initPacketFromBuffer(
|
|
10
7
|
buffer.buffer,
|
|
@@ -16,13 +13,12 @@ module.exports = class FFmpegPacket extends ReferenceCounted {
|
|
|
16
13
|
}
|
|
17
14
|
}
|
|
18
15
|
|
|
19
|
-
|
|
20
|
-
binding.
|
|
16
|
+
destroy() {
|
|
17
|
+
binding.unrefPacket(this._handle)
|
|
21
18
|
this._handle = null
|
|
22
19
|
}
|
|
23
20
|
|
|
24
21
|
unref() {
|
|
25
|
-
this._unref()
|
|
26
22
|
binding.unrefPacket(this._handle)
|
|
27
23
|
}
|
|
28
24
|
|
|
@@ -33,4 +29,8 @@ module.exports = class FFmpegPacket extends ReferenceCounted {
|
|
|
33
29
|
get data() {
|
|
34
30
|
return Buffer.from(binding.getPacketData(this._handle))
|
|
35
31
|
}
|
|
32
|
+
|
|
33
|
+
[Symbol.dispose]() {
|
|
34
|
+
this.destroy()
|
|
35
|
+
}
|
|
36
36
|
}
|
package/lib/resampler.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
[Symbol.dispose]() {
|
|
49
|
+
this.destroy()
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
module.exports = Resampler
|
package/lib/scaler.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
const binding = require('../binding')
|
|
2
2
|
const constants = require('./constants')
|
|
3
|
-
const ReferenceCounted = require('./reference-counted')
|
|
4
3
|
|
|
5
|
-
module.exports = class FFmpegScaler
|
|
4
|
+
module.exports = class FFmpegScaler {
|
|
6
5
|
constructor(
|
|
7
6
|
sourcePixelFormat,
|
|
8
7
|
sourceWidth,
|
|
@@ -11,8 +10,6 @@ module.exports = class FFmpegScaler extends ReferenceCounted {
|
|
|
11
10
|
targetWidth,
|
|
12
11
|
targetHeight
|
|
13
12
|
) {
|
|
14
|
-
super()
|
|
15
|
-
|
|
16
13
|
sourcePixelFormat = constants.toPixelFormat(sourcePixelFormat)
|
|
17
14
|
targetPixelFormat = constants.toPixelFormat(targetPixelFormat)
|
|
18
15
|
|
|
@@ -33,7 +30,7 @@ module.exports = class FFmpegScaler extends ReferenceCounted {
|
|
|
33
30
|
)
|
|
34
31
|
}
|
|
35
32
|
|
|
36
|
-
|
|
33
|
+
destroy() {
|
|
37
34
|
binding.destroyScaler(this._handle)
|
|
38
35
|
this._handle = null
|
|
39
36
|
}
|
|
@@ -56,4 +53,8 @@ module.exports = class FFmpegScaler extends ReferenceCounted {
|
|
|
56
53
|
target._handle
|
|
57
54
|
)
|
|
58
55
|
}
|
|
56
|
+
|
|
57
|
+
[Symbol.dispose]() {
|
|
58
|
+
this.destroy()
|
|
59
|
+
}
|
|
59
60
|
}
|
package/lib/stream.js
CHANGED
|
@@ -2,12 +2,9 @@ const binding = require('../binding')
|
|
|
2
2
|
const Codec = require('./codec')
|
|
3
3
|
const CodecContext = require('./codec-context')
|
|
4
4
|
const CodecParameters = require('./codec-parameters')
|
|
5
|
-
const ReferenceCounted = require('./reference-counted')
|
|
6
5
|
|
|
7
|
-
module.exports = class FFmpegStream
|
|
6
|
+
module.exports = class FFmpegStream {
|
|
8
7
|
constructor(handle) {
|
|
9
|
-
super()
|
|
10
|
-
|
|
11
8
|
this._handle = handle
|
|
12
9
|
|
|
13
10
|
this._codec = Codec.for(binding.getStreamCodec(this._handle))
|
|
@@ -17,7 +14,7 @@ module.exports = class FFmpegStream extends ReferenceCounted {
|
|
|
17
14
|
)
|
|
18
15
|
}
|
|
19
16
|
|
|
20
|
-
|
|
17
|
+
destroy() {
|
|
21
18
|
this._codecParameters.destroy()
|
|
22
19
|
this._codecParameters = null
|
|
23
20
|
}
|
|
@@ -41,4 +38,8 @@ module.exports = class FFmpegStream extends ReferenceCounted {
|
|
|
41
38
|
this._codecParameters.toContext(context)
|
|
42
39
|
return context.open()
|
|
43
40
|
}
|
|
41
|
+
|
|
42
|
+
[Symbol.dispose]() {
|
|
43
|
+
this.destroy()
|
|
44
|
+
}
|
|
44
45
|
}
|
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-8",
|
|
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
|