@scrypted/libav 1.0.7 → 1.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/lib/index.js +31 -71
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/tsconfig.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1,40 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
4
|
};
|
|
@@ -43,9 +7,9 @@ exports.isInstalled = isInstalled;
|
|
|
43
7
|
exports.install = install;
|
|
44
8
|
exports.setAVLogCallback = setAVLogCallback;
|
|
45
9
|
exports.createAVFormatContext = createAVFormatContext;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const child_process_1 = require("child_process");
|
|
12
|
+
let addon;
|
|
49
13
|
try {
|
|
50
14
|
addon = require('../build/Release/addon');
|
|
51
15
|
}
|
|
@@ -54,40 +18,36 @@ catch (e) {
|
|
|
54
18
|
function isInstalled() {
|
|
55
19
|
return !!addon;
|
|
56
20
|
}
|
|
57
|
-
|
|
58
|
-
function install() {
|
|
59
|
-
|
|
60
|
-
return
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
reject(new Error('Failed to install'));
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
})
|
|
85
|
-
.finally(function () {
|
|
86
|
-
installing = undefined;
|
|
87
|
-
});
|
|
88
|
-
return [2 /*return*/, installing];
|
|
21
|
+
let installing;
|
|
22
|
+
async function install() {
|
|
23
|
+
if (addon)
|
|
24
|
+
return;
|
|
25
|
+
if (installing)
|
|
26
|
+
return installing;
|
|
27
|
+
installing = new Promise((resolve, reject) => {
|
|
28
|
+
const cp = (0, child_process_1.fork)(require.resolve('prebuild-install/bin.js'), {
|
|
29
|
+
cwd: path_1.default.dirname(__dirname),
|
|
30
|
+
});
|
|
31
|
+
cp.on('error', reject);
|
|
32
|
+
cp.on('exit', (code) => {
|
|
33
|
+
if (code === 0) {
|
|
34
|
+
try {
|
|
35
|
+
addon = require('../build/Release/addon');
|
|
36
|
+
resolve();
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
reject(e);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
reject(new Error('Failed to install'));
|
|
44
|
+
}
|
|
89
45
|
});
|
|
46
|
+
})
|
|
47
|
+
.finally(() => {
|
|
48
|
+
installing = undefined;
|
|
90
49
|
});
|
|
50
|
+
return installing;
|
|
91
51
|
}
|
|
92
52
|
function setAVLogCallback(callback) {
|
|
93
53
|
addon.set_console_callback(callback);
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
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