@qvac/decoder-audio 0.2.10 → 0.3.0
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/README.md +15 -43
- package/index.d.ts +34 -52
- package/index.js +0 -115
- package/package.json +1 -7
- package/test/mobile/testAssets/corrupted.mp3 +0 -0
- package/binding.js +0 -3
- package/gstreamer.js +0 -131
- package/prebuilds/android-arm/qvac__decoder-audio.bare +0 -0
- package/prebuilds/android-arm64/qvac__decoder-audio.bare +0 -0
- package/prebuilds/android-ia32/qvac__decoder-audio.bare +0 -0
- package/prebuilds/android-x64/qvac__decoder-audio.bare +0 -0
- package/prebuilds/darwin-arm64/qvac__decoder-audio.bare +0 -0
- package/prebuilds/darwin-arm64/qvac__decoder-audio.bare.exports +0 -7163
- package/prebuilds/ios-arm64/qvac__decoder-audio.bare +0 -0
- package/prebuilds/ios-arm64/qvac__decoder-audio.bare.exports +0 -7163
- package/prebuilds/ios-arm64-simulator/qvac__decoder-audio.bare +0 -0
- package/prebuilds/ios-arm64-simulator/qvac__decoder-audio.bare.exports +0 -7163
- package/prebuilds/ios-x64-simulator/qvac__decoder-audio.bare +0 -0
- package/prebuilds/ios-x64-simulator/qvac__decoder-audio.bare.exports +0 -7141
- package/prebuilds/linux-x64/qvac__decoder-audio.bare +0 -0
- package/prebuilds/win32-x64/qvac__decoder-audio.bare +0 -0
- package/prebuilds/win32-x64/qvac__decoder-audio.bare.exports +0 -0
- package/test/mobile/gst-test.cjs +0 -103
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/test/mobile/gst-test.cjs
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
const GSTDecoder = require('@qvac/decoder-audio')
|
|
2
|
-
const fs = require('bare-fs')
|
|
3
|
-
|
|
4
|
-
async function testDecodeMp3() {
|
|
5
|
-
const decoder = new GSTDecoder({
|
|
6
|
-
config: {
|
|
7
|
-
audioFormat: 'f32le',
|
|
8
|
-
sampleRate: 16000
|
|
9
|
-
}
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
try {
|
|
13
|
-
await decoder.load()
|
|
14
|
-
|
|
15
|
-
const audioPath = getAssetPath('sample.mp3')
|
|
16
|
-
const audioStream = fs.createReadStream(audioPath)
|
|
17
|
-
const response = await decoder.run(audioStream)
|
|
18
|
-
|
|
19
|
-
let totalBytes = 0
|
|
20
|
-
let updateCount = 0
|
|
21
|
-
|
|
22
|
-
await response
|
|
23
|
-
.onUpdate(output => {
|
|
24
|
-
if (output && output.outputArray) {
|
|
25
|
-
const bytes = new Uint8Array(output.outputArray)
|
|
26
|
-
totalBytes += bytes.length
|
|
27
|
-
updateCount++
|
|
28
|
-
}
|
|
29
|
-
})
|
|
30
|
-
.await()
|
|
31
|
-
|
|
32
|
-
if (totalBytes === 0) {
|
|
33
|
-
throw new Error('No audio data decoded')
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (updateCount === 0) {
|
|
37
|
-
throw new Error('No decoder updates received')
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
console.log(`MP3 decode complete: ${totalBytes} bytes, ${updateCount} updates`)
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
success: true,
|
|
44
|
-
totalBytes,
|
|
45
|
-
updateCount
|
|
46
|
-
}
|
|
47
|
-
} catch (error) {
|
|
48
|
-
console.error('Error during testDecodeMp3:', error)
|
|
49
|
-
throw error
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
async function testDecodeWav() {
|
|
54
|
-
const decoder = new GSTDecoder({
|
|
55
|
-
config: {
|
|
56
|
-
audioFormat: 'f32le',
|
|
57
|
-
sampleRate: 16000
|
|
58
|
-
}
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
await decoder.load()
|
|
63
|
-
|
|
64
|
-
const audioPath = getAssetPath('sample.wav')
|
|
65
|
-
const audioStream = fs.createReadStream(audioPath)
|
|
66
|
-
const response = await decoder.run(audioStream)
|
|
67
|
-
|
|
68
|
-
let totalBytes = 0
|
|
69
|
-
let updateCount = 0
|
|
70
|
-
|
|
71
|
-
await response
|
|
72
|
-
.onUpdate(output => {
|
|
73
|
-
if (output && output.outputArray) {
|
|
74
|
-
const bytes = new Uint8Array(output.outputArray)
|
|
75
|
-
totalBytes += bytes.length
|
|
76
|
-
updateCount++
|
|
77
|
-
}
|
|
78
|
-
})
|
|
79
|
-
.await()
|
|
80
|
-
|
|
81
|
-
if (totalBytes === 0) {
|
|
82
|
-
throw new Error('No audio data decoded')
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (updateCount === 0) {
|
|
86
|
-
throw new Error('No decoder updates received')
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
console.log(`WAV decode complete: ${totalBytes} bytes, ${updateCount} updates`)
|
|
90
|
-
|
|
91
|
-
return {
|
|
92
|
-
success: true,
|
|
93
|
-
totalBytes,
|
|
94
|
-
updateCount
|
|
95
|
-
}
|
|
96
|
-
} catch (error) {
|
|
97
|
-
console.error('Error during testDecodeWav:', error)
|
|
98
|
-
throw error
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
module.exports = { testDecodeMp3, testDecodeWav }
|
|
103
|
-
|