bare-ffmpeg 1.0.0-15 → 1.0.0-16
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 +755 -17
- package/index.d.ts +46 -0
- package/index.js +5 -3
- package/lib/audio-fifo.d.ts +20 -0
- package/lib/channel-layout.d.ts +9 -0
- package/lib/channel-layout.js +11 -0
- package/lib/codec-context.d.ts +34 -0
- package/lib/codec-context.js +43 -1
- package/lib/codec-parameters.d.ts +20 -0
- package/lib/codec-parameters.js +38 -0
- package/lib/codec.d.ts +20 -0
- package/lib/codec.js +14 -0
- package/lib/constants.d.ts +74 -0
- package/lib/constants.js +49 -3
- package/lib/decoder.d.ts +7 -0
- package/lib/dictionary.d.ts +11 -0
- package/lib/dictionary.js +2 -0
- package/lib/encoder.d.ts +7 -0
- package/lib/format-context.d.ts +43 -0
- package/lib/format-context.js +28 -5
- package/lib/frame.d.ts +23 -0
- package/lib/frame.js +42 -0
- package/lib/image.d.ts +30 -0
- package/lib/input-format.d.ts +5 -0
- package/lib/input-format.js +4 -0
- package/lib/io-context.d.ts +10 -0
- package/lib/io-context.js +24 -6
- package/lib/log.js +16 -0
- package/lib/output-format.d.ts +5 -0
- package/lib/output-format.js +4 -0
- package/lib/packet.d.ts +16 -0
- package/lib/packet.js +77 -0
- package/lib/rational.d.ts +8 -0
- package/lib/rational.js +27 -1
- package/lib/resampler.d.ts +26 -0
- package/lib/resampler.js +2 -2
- package/lib/samples.d.ts +16 -0
- package/lib/scaler.d.ts +26 -0
- package/lib/scaler.js +2 -2
- package/lib/stream.d.ts +18 -0
- package/lib/stream.js +38 -5
- package/package.json +17 -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
package/lib/frame.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import FFmpegChannelLayout from './channel-layout'
|
|
2
|
+
|
|
3
|
+
declare class FFmpegFrame {
|
|
4
|
+
readonly pictType: number
|
|
5
|
+
|
|
6
|
+
get channelLayout(): FFmpegChannelLayout
|
|
7
|
+
set channelLayout(value: FFmpegChannelLayout | string | number)
|
|
8
|
+
|
|
9
|
+
width: number
|
|
10
|
+
height: number
|
|
11
|
+
pixelFormat: number
|
|
12
|
+
format: number
|
|
13
|
+
nbSamples: number
|
|
14
|
+
|
|
15
|
+
constructor()
|
|
16
|
+
|
|
17
|
+
alloc(): void
|
|
18
|
+
|
|
19
|
+
destroy(): void
|
|
20
|
+
[Symbol.dispose](): void
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export = FFmpegFrame
|
package/lib/frame.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const binding = require('../binding')
|
|
2
2
|
const ChannelLayout = require('./channel-layout')
|
|
3
|
+
const Rational = require('./rational')
|
|
3
4
|
|
|
4
5
|
module.exports = class FFmpegFrame {
|
|
5
6
|
constructor() {
|
|
@@ -66,6 +67,31 @@ module.exports = class FFmpegFrame {
|
|
|
66
67
|
return binding.getFramePictType(this._handle)
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
get pts() {
|
|
71
|
+
return binding.getFramePTS(this._handle)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
set pts(value) {
|
|
75
|
+
return binding.setFramePTS(this._handle, value)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
get packetDTS() {
|
|
79
|
+
return binding.getFramePacketDTS(this._handle)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
set packetDTS(value) {
|
|
83
|
+
return binding.setFramePacketDTS(this._handle, value)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
get timeBase() {
|
|
87
|
+
const view = new Int32Array(binding.getFrameTimeBase(this._handle))
|
|
88
|
+
return new Rational(view[0], view[1])
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
set timeBase(value) {
|
|
92
|
+
binding.setFrameTimeBase(this._handle, value.numerator, value.denominator)
|
|
93
|
+
}
|
|
94
|
+
|
|
69
95
|
alloc() {
|
|
70
96
|
binding.allocFrame(this._handle, 32)
|
|
71
97
|
}
|
|
@@ -73,4 +99,20 @@ module.exports = class FFmpegFrame {
|
|
|
73
99
|
[Symbol.dispose]() {
|
|
74
100
|
this.destroy()
|
|
75
101
|
}
|
|
102
|
+
|
|
103
|
+
[Symbol.for('bare.inspect')]() {
|
|
104
|
+
return {
|
|
105
|
+
__proto__: { constructor: FFmpegFrame },
|
|
106
|
+
width: this.width,
|
|
107
|
+
height: this.height,
|
|
108
|
+
pixelFormat: this.pixelFormat,
|
|
109
|
+
format: this.format,
|
|
110
|
+
channelLayout: this.channelLayout,
|
|
111
|
+
nbSamples: this.nbSamples,
|
|
112
|
+
pictType: this.pictType,
|
|
113
|
+
pts: this.pts,
|
|
114
|
+
packetDTS: this.packetDTS,
|
|
115
|
+
timeBase: this.timeBase
|
|
116
|
+
}
|
|
117
|
+
}
|
|
76
118
|
}
|
package/lib/image.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Buffer from 'bare-buffer'
|
|
2
|
+
import FFmpegFrame from './frame'
|
|
3
|
+
|
|
4
|
+
declare class FFmpegImage {
|
|
5
|
+
readonly pixelFormat: number
|
|
6
|
+
readonly width: number
|
|
7
|
+
readonly height: number
|
|
8
|
+
readonly align: number
|
|
9
|
+
readonly data: Buffer
|
|
10
|
+
|
|
11
|
+
constructor(
|
|
12
|
+
pixelFormat: string | number,
|
|
13
|
+
width: number,
|
|
14
|
+
height: number,
|
|
15
|
+
align?: number
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
fill(frame: FFmpegFrame): void
|
|
19
|
+
read(frame: FFmpegFrame): void
|
|
20
|
+
|
|
21
|
+
lineSize(plane?: number): number
|
|
22
|
+
|
|
23
|
+
static lineSize(
|
|
24
|
+
pixelFormat: string | number,
|
|
25
|
+
width: number,
|
|
26
|
+
plane?: number
|
|
27
|
+
): number
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export = FFmpegImage
|
package/lib/input-format.js
CHANGED
package/lib/io-context.js
CHANGED
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
const binding = require('../binding')
|
|
2
2
|
|
|
3
3
|
module.exports = class FFmpegIOContext {
|
|
4
|
-
constructor(buffer =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
constructor(buffer, opts = {}) {
|
|
5
|
+
let offset = 0
|
|
6
|
+
let len = 0
|
|
7
|
+
|
|
8
|
+
if (typeof buffer === 'number') {
|
|
9
|
+
len = buffer
|
|
10
|
+
buffer = undefined
|
|
11
|
+
} else if (buffer) {
|
|
12
|
+
offset = buffer.byteOffset
|
|
13
|
+
len = buffer.byteLength
|
|
14
|
+
buffer = buffer.buffer
|
|
15
|
+
} else {
|
|
16
|
+
buffer = Buffer.alloc(0)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let onwrite
|
|
20
|
+
|
|
21
|
+
if (typeof opts.onwrite === 'function') {
|
|
22
|
+
onwrite = function (chunk) {
|
|
23
|
+
opts.onwrite(Buffer.from(chunk))
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
this._handle = binding.initIOContext(buffer, offset, len, onwrite)
|
|
10
28
|
}
|
|
11
29
|
|
|
12
30
|
destroy() {
|
package/lib/log.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const binding = require('../binding')
|
|
2
|
+
const constants = require('./constants')
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
...constants.logLevels
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(module.exports, 'level', {
|
|
9
|
+
get() {
|
|
10
|
+
return binding.getLogLevel()
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
set(level) {
|
|
14
|
+
return binding.setLogLevel(level)
|
|
15
|
+
}
|
|
16
|
+
})
|
package/lib/output-format.js
CHANGED
package/lib/packet.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Buffer from 'bare-buffer'
|
|
2
|
+
|
|
3
|
+
declare class FFmpegPacket {
|
|
4
|
+
readonly streamIndex: number
|
|
5
|
+
readonly data: Buffer
|
|
6
|
+
readonly isKeyframe: boolean
|
|
7
|
+
|
|
8
|
+
constructor(buffer?: Buffer)
|
|
9
|
+
|
|
10
|
+
unref(): void
|
|
11
|
+
|
|
12
|
+
destroy(): void
|
|
13
|
+
[Symbol.dispose](): void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export = FFmpegPacket
|
package/lib/packet.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const binding = require('../binding')
|
|
2
|
+
const Rational = require('./rational')
|
|
2
3
|
|
|
3
4
|
module.exports = class FFmpegPacket {
|
|
4
5
|
constructor(buffer) {
|
|
@@ -26,14 +27,90 @@ module.exports = class FFmpegPacket {
|
|
|
26
27
|
return binding.getPacketStreamIndex(this._handle)
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
set streamIndex(value) {
|
|
31
|
+
return binding.setPacketStreamIndex(this._handle, value)
|
|
32
|
+
}
|
|
33
|
+
|
|
29
34
|
get data() {
|
|
30
35
|
return Buffer.from(binding.getPacketData(this._handle))
|
|
31
36
|
}
|
|
32
37
|
|
|
38
|
+
set data(value) {
|
|
39
|
+
binding.setPacketData(
|
|
40
|
+
this._handle,
|
|
41
|
+
value.buffer,
|
|
42
|
+
value.byteOffset,
|
|
43
|
+
value.byteLength
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
33
47
|
get isKeyframe() {
|
|
34
48
|
return binding.isPacketKeyframe(this._handle)
|
|
35
49
|
}
|
|
36
50
|
|
|
51
|
+
get dts() {
|
|
52
|
+
return binding.getPacketDTS(this._handle)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
set dts(value) {
|
|
56
|
+
return binding.setPacketDTS(this._handle, value)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get pts() {
|
|
60
|
+
return binding.getPacketPTS(this._handle)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
set pts(value) {
|
|
64
|
+
return binding.setPacketPTS(this._handle, value)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
get timeBase() {
|
|
68
|
+
const view = new Int32Array(binding.getPacketTimeBase(this._handle))
|
|
69
|
+
return new Rational(view[0], view[1])
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
set timeBase(value) {
|
|
73
|
+
binding.setPacketTimeBase(this._handle, value.numerator, value.denominator)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
rescaleTimestamps(rational) {
|
|
77
|
+
return binding.rescalePacketTimestamps(
|
|
78
|
+
this._handle,
|
|
79
|
+
rational.numerator,
|
|
80
|
+
rational.denominator
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
get duration() {
|
|
85
|
+
return binding.getPacketDuration(this._handle)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
set duration(value) {
|
|
89
|
+
return binding.setPacketDuration(this._handle, value)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
get flags() {
|
|
93
|
+
return binding.getPacketFlags(this._handle)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
set flags(value) {
|
|
97
|
+
return binding.setPacketFlags(this._handle, value)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
[Symbol.for('bare.inspect')]() {
|
|
101
|
+
return {
|
|
102
|
+
__proto__: { constructor: FFmpegPacket },
|
|
103
|
+
streamIndex: this.streamIndex,
|
|
104
|
+
flags: this.flags,
|
|
105
|
+
isKeyframe: this.isKeyframe,
|
|
106
|
+
timeBase: this.timeBase,
|
|
107
|
+
dts: this.dts,
|
|
108
|
+
pts: this.pts,
|
|
109
|
+
duration: this.duration,
|
|
110
|
+
data: this.data
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
37
114
|
[Symbol.dispose]() {
|
|
38
115
|
this.destroy()
|
|
39
116
|
}
|
package/lib/rational.js
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
|
+
const binding = require('../binding')
|
|
2
|
+
|
|
1
3
|
module.exports = class FFmpegRational {
|
|
2
|
-
constructor(numerator, denominator) {
|
|
4
|
+
constructor(numerator = 0, denominator = 1) {
|
|
3
5
|
this.numerator = numerator
|
|
4
6
|
this.denominator = denominator
|
|
5
7
|
}
|
|
8
|
+
|
|
9
|
+
get valid() {
|
|
10
|
+
// don't support negative denominators unless
|
|
11
|
+
// required by codec or format
|
|
12
|
+
if (this.denominator < 1) return false
|
|
13
|
+
|
|
14
|
+
// common initial value for AVRational(0, 1)
|
|
15
|
+
if (this.q2d === 0) return false
|
|
16
|
+
|
|
17
|
+
return true
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get uninitialized() {
|
|
21
|
+
return this.numerator === 0 && this.denominator === 1
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
get q2d() {
|
|
25
|
+
return this.numerator / this.denominator
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
static from(num) {
|
|
29
|
+
const view = new Int32Array(binding.rationalD2Q(num))
|
|
30
|
+
return new FFmpegRational(view[0], view[1])
|
|
31
|
+
}
|
|
6
32
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import FFmpegChannelLayout from './channel-layout'
|
|
2
|
+
import FFmpegFrame from './frame'
|
|
3
|
+
|
|
4
|
+
declare class FFmpegResampler {
|
|
5
|
+
readonly inputSampleRate: number
|
|
6
|
+
readonly outputSampleRate: number
|
|
7
|
+
readonly delay: number
|
|
8
|
+
|
|
9
|
+
constructor(
|
|
10
|
+
inputSampleRate: number,
|
|
11
|
+
inputChannelLayout: FFmpegChannelLayout | string | number,
|
|
12
|
+
inputFormat: number,
|
|
13
|
+
outputSampleRate: number,
|
|
14
|
+
outputChannelLayout: FFmpegChannelLayout | string | number,
|
|
15
|
+
outputFormat: number
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
convert(inputFrame: FFmpegFrame, outputFrame: FFmpegFrame): number
|
|
19
|
+
|
|
20
|
+
flush(outputFrame: FFmpegFrame): number
|
|
21
|
+
|
|
22
|
+
destroy(): void
|
|
23
|
+
[Symbol.dispose](): void
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export = FFmpegResampler
|
package/lib/resampler.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const binding = require('../binding')
|
|
2
2
|
const ChannelLayout = require('./channel-layout')
|
|
3
3
|
|
|
4
|
-
class
|
|
4
|
+
class FFmpegResampler {
|
|
5
5
|
constructor(
|
|
6
6
|
inputSampleRate,
|
|
7
7
|
inputChannelLayout,
|
|
@@ -60,4 +60,4 @@ class Resampler {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
module.exports =
|
|
63
|
+
module.exports = FFmpegResampler
|
package/lib/samples.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Buffer from 'bare-buffer'
|
|
2
|
+
import FFmpegFrame from './frame'
|
|
3
|
+
|
|
4
|
+
declare class FFmpegSamples {
|
|
5
|
+
readonly sampleFormat: string | number
|
|
6
|
+
readonly nbChannels: number
|
|
7
|
+
readonly nbSamples: number
|
|
8
|
+
readonly align: number
|
|
9
|
+
readonly data: Buffer
|
|
10
|
+
|
|
11
|
+
constructor(sampleFormat: string | number, nbSamples: number, align?: number)
|
|
12
|
+
|
|
13
|
+
fill(frame: FFmpegFrame): void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export = FFmpegSamples
|
package/lib/scaler.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import FFmpegFrame from './frame'
|
|
2
|
+
|
|
3
|
+
declare class FFmpegScaler {
|
|
4
|
+
constructor(
|
|
5
|
+
sourcePixelFormat: string | number,
|
|
6
|
+
sourceWidth: number,
|
|
7
|
+
sourceHeight: number,
|
|
8
|
+
targetPixelFormat: string | number,
|
|
9
|
+
targetWidth: number,
|
|
10
|
+
targetHeight: number
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
scale(
|
|
14
|
+
source: FFmpegFrame,
|
|
15
|
+
y: number,
|
|
16
|
+
height: number,
|
|
17
|
+
target: FFmpegFrame
|
|
18
|
+
): boolean
|
|
19
|
+
scale(source: FFmpegFrame, y: number, target: FFmpegFrame): boolean
|
|
20
|
+
scale(source: FFmpegFrame, target: FFmpegFrame): boolean
|
|
21
|
+
|
|
22
|
+
destroy(): void
|
|
23
|
+
[Symbol.dispose](): void
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export = FFmpegScaler
|
package/lib/scaler.js
CHANGED
|
@@ -39,10 +39,10 @@ module.exports = class FFmpegScaler {
|
|
|
39
39
|
if (typeof y !== 'number') {
|
|
40
40
|
target = y
|
|
41
41
|
y = 0
|
|
42
|
-
height =
|
|
42
|
+
height = source.height
|
|
43
43
|
} else if (typeof height !== 'number') {
|
|
44
44
|
target = height
|
|
45
|
-
height =
|
|
45
|
+
height = source.height
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
return binding.scaleScaler(
|
package/lib/stream.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import FFmpegCodec from './codec'
|
|
2
|
+
import FFmpegCodecContext from './codec-context'
|
|
3
|
+
import FFmpegCodecParameters from './codec-parameters'
|
|
4
|
+
|
|
5
|
+
declare class FFmpegStream {
|
|
6
|
+
readonly codec: FFmpegCodec
|
|
7
|
+
readonly codecParameters: FFmpegCodecParameters
|
|
8
|
+
|
|
9
|
+
constructor(handle: ArrayBuffer)
|
|
10
|
+
|
|
11
|
+
decoder(): FFmpegCodecContext
|
|
12
|
+
encoder(): FFmpegCodecContext
|
|
13
|
+
|
|
14
|
+
destroy(): void
|
|
15
|
+
[Symbol.dispose](): void
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export = FFmpegStream
|
package/lib/stream.js
CHANGED
|
@@ -2,34 +2,67 @@ 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 Rational = require('./rational')
|
|
5
6
|
|
|
6
7
|
module.exports = class FFmpegStream {
|
|
7
8
|
constructor(handle) {
|
|
8
9
|
this._handle = handle
|
|
9
10
|
|
|
10
|
-
this._codec = Codec.for(binding.getStreamCodec(this._handle))
|
|
11
|
-
|
|
12
11
|
this._codecParameters = new CodecParameters(
|
|
13
12
|
binding.getStreamCodecParameters(this._handle)
|
|
14
13
|
)
|
|
15
14
|
}
|
|
16
15
|
|
|
16
|
+
get id() {
|
|
17
|
+
return binding.getStreamId(this._handle)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
set id(value) {
|
|
21
|
+
binding.setStreamId(this._handle, value)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
get index() {
|
|
25
|
+
return binding.getStreamIndex(this._handle)
|
|
26
|
+
}
|
|
27
|
+
|
|
17
28
|
get codec() {
|
|
18
|
-
return this.
|
|
29
|
+
return Codec.for(this.codecParameters.codecId)
|
|
19
30
|
}
|
|
20
31
|
|
|
21
32
|
get codecParameters() {
|
|
22
33
|
return this._codecParameters
|
|
23
34
|
}
|
|
24
35
|
|
|
36
|
+
get timeBase() {
|
|
37
|
+
const view = new Int32Array(binding.getStreamTimeBase(this._handle))
|
|
38
|
+
return new Rational(view[0], view[1])
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
set timeBase(value) {
|
|
42
|
+
binding.setStreamTimeBase(this._handle, value.numerator, value.denominator)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
get avgFramerate() {
|
|
46
|
+
const view = new Int32Array(binding.getStreamAverageFramerate(this._handle))
|
|
47
|
+
return new Rational(view[0], view[1])
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
set avgFramerate(value) {
|
|
51
|
+
binding.setStreamAverageFramerate(
|
|
52
|
+
this._handle,
|
|
53
|
+
value.numerator,
|
|
54
|
+
value.denominator
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
25
58
|
decoder() {
|
|
26
|
-
const context = new CodecContext(this.
|
|
59
|
+
const context = new CodecContext(this.codec.decoder)
|
|
27
60
|
this._codecParameters.toContext(context)
|
|
28
61
|
return context.open()
|
|
29
62
|
}
|
|
30
63
|
|
|
31
64
|
encoder() {
|
|
32
|
-
const context = new CodecContext(this.
|
|
65
|
+
const context = new CodecContext(this.codec.encoder)
|
|
33
66
|
this._codecParameters.toContext(context)
|
|
34
67
|
return context.open()
|
|
35
68
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bare-ffmpeg",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-16",
|
|
4
4
|
"description": "Low-level FFmpeg bindings for Bare",
|
|
5
5
|
"exports": {
|
|
6
|
-
".":
|
|
6
|
+
".": {
|
|
7
|
+
"types": "./index.d.ts",
|
|
8
|
+
"default": "./index.js"
|
|
9
|
+
},
|
|
7
10
|
"./package": "./package.json"
|
|
8
11
|
},
|
|
9
12
|
"files": [
|
|
10
13
|
"index.js",
|
|
14
|
+
"index.d.ts",
|
|
11
15
|
"binding.cc",
|
|
12
16
|
"binding.js",
|
|
13
17
|
"CMakeLists.txt",
|
|
@@ -17,7 +21,8 @@
|
|
|
17
21
|
],
|
|
18
22
|
"addon": true,
|
|
19
23
|
"scripts": {
|
|
20
|
-
"test": "prettier . --check && bare test.js"
|
|
24
|
+
"test": "prettier . --check && bare test.js",
|
|
25
|
+
"format": "prettier . --write && clang-format -i binding.cc"
|
|
21
26
|
},
|
|
22
27
|
"repository": {
|
|
23
28
|
"type": "git",
|
|
@@ -30,11 +35,20 @@
|
|
|
30
35
|
},
|
|
31
36
|
"homepage": "https://github.com/holepunchto/bare-ffmpeg#readme",
|
|
32
37
|
"devDependencies": {
|
|
38
|
+
"bare-buffer": "^3.2.0",
|
|
33
39
|
"brittle": "^3.4.0",
|
|
34
40
|
"cmake-bare": "^1.1.2",
|
|
35
41
|
"cmake-harden": "^1.0.2",
|
|
36
42
|
"cmake-ports": "^1.5.0",
|
|
37
43
|
"prettier": "^3.3.3",
|
|
38
44
|
"prettier-config-standard": "^7.0.0"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"bare-buffer": "*"
|
|
48
|
+
},
|
|
49
|
+
"peerDependenciesMeta": {
|
|
50
|
+
"bare-buffer": {
|
|
51
|
+
"optional": true
|
|
52
|
+
}
|
|
39
53
|
}
|
|
40
54
|
}
|
|
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
|