tirtc-devtools-cli 0.0.13 → 0.0.14
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 +42 -46
- package/USAGE.md +87 -312
- package/dist/cli/src/embedded_paths.d.ts +0 -2
- package/dist/cli/src/embedded_paths.js +3 -25
- package/dist/cli/src/index.js +82 -584
- package/dist/cli/src/role_driver.d.ts +33 -0
- package/dist/cli/src/role_driver.js +500 -0
- package/dist/cli/src/token_command.js +4 -2
- package/dist/cli/src/token_issue.d.ts +9 -0
- package/dist/cli/src/token_issue.js +138 -0
- package/dist/cli/src/token_tool.d.ts +2 -4
- package/dist/cli/src/token_tool.js +12 -186
- package/package.json +1 -1
- package/vendor/devtools/driver/macos-arm64/devtools_driver_probe +0 -0
- package/vendor/devtools/driver/macos-arm64/runtime_validation_client_bin +0 -0
- package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio.h +56 -2
- package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_io.h +9 -0
- package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/av.h +52 -0
- package/vendor/{app-server/bin/runtime/linux-x64 → runtime/macos-arm64}/include/tirtc/error.h +11 -0
- package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/media_downlink.h +11 -5
- package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/media_uplink.h +4 -0
- package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/transport.h +52 -15
- package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/trp.h +7 -5
- package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_codec.h +41 -0
- package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_io.h +7 -0
- package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_io_android.h +2 -0
- package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libmatrix_runtime_audio.a +0 -0
- package/vendor/runtime/macos-arm64/lib/libmatrix_runtime_facade.a +0 -0
- package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libmatrix_runtime_foundation_http.a +0 -0
- package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libmatrix_runtime_foundation_logging.a +0 -0
- package/vendor/runtime/macos-arm64/lib/libmatrix_runtime_media.a +0 -0
- package/vendor/runtime/macos-arm64/lib/libmatrix_runtime_transport.a +0 -0
- package/vendor/runtime/macos-arm64/lib/libmatrix_runtime_video.a +0 -0
- package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/manifest.txt +20 -25
- package/vendor/runtime/script/prepare_runtime_media_dataset.sh +308 -12
- package/dist/app-server/protocol-client/index.d.ts +0 -25
- package/dist/app-server/protocol-client/index.js +0 -114
- package/dist/cli/src/bootstrap_flows.d.ts +0 -46
- package/dist/cli/src/bootstrap_flows.js +0 -249
- package/dist/cli/src/config.d.ts +0 -26
- package/dist/cli/src/config.js +0 -62
- package/dist/cli/src/facade.d.ts +0 -430
- package/dist/cli/src/facade.js +0 -170
- package/dist/cli/src/guide.d.ts +0 -1
- package/dist/cli/src/guide.js +0 -48
- package/dist/cli/src/session_manager.d.ts +0 -25
- package/dist/cli/src/session_manager.js +0 -391
- package/dist/cli/src/transport.d.ts +0 -30
- package/dist/cli/src/transport.js +0 -84
- package/vendor/app-server/bin/native/linux-x64/credential_napi.node +0 -0
- package/vendor/app-server/bin/native/macos-arm64/credential_napi.node +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/credential.h +0 -34
- package/vendor/app-server/bin/runtime/linux-x64/lib/libcrypto.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_credential.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_foundation_http.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_foundation_logging.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/lib/libssl.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/lib/libxlog.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/manifest.txt +0 -4
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/credential.h +0 -34
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/error.h +0 -52
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/foundation/build_info.h +0 -27
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/http.h +0 -57
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/logging.h +0 -55
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_fixture_av_sync.h +0 -61
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_fixture_source.h +0 -77
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_live_source.h +0 -71
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_credential.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_facade.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_media.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_transport.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_video.a +0 -0
- package/vendor/app-server/bin/tirtc-devtool-host.js +0 -2
- package/vendor/app-server/dist/host/ArtifactManager.d.ts +0 -18
- package/vendor/app-server/dist/host/ArtifactManager.js +0 -98
- package/vendor/app-server/dist/host/HostCommandCoordinator.d.ts +0 -19
- package/vendor/app-server/dist/host/HostCommandCoordinator.js +0 -196
- package/vendor/app-server/dist/host/HostProtocol.d.ts +0 -103
- package/vendor/app-server/dist/host/HostProtocol.js +0 -239
- package/vendor/app-server/dist/host/HostServer.d.ts +0 -52
- package/vendor/app-server/dist/host/HostServer.js +0 -727
- package/vendor/app-server/dist/host/HostState.d.ts +0 -69
- package/vendor/app-server/dist/host/HostState.js +0 -19
- package/vendor/app-server/dist/host/RuntimeAdapter.d.ts +0 -95
- package/vendor/app-server/dist/host/RuntimeAdapter.js +0 -636
- package/vendor/app-server/dist/host/RuntimeReceiveWorker.d.ts +0 -37
- package/vendor/app-server/dist/host/RuntimeReceiveWorker.js +0 -186
- package/vendor/app-server/dist/host/RuntimeSendWorker.d.ts +0 -58
- package/vendor/app-server/dist/host/RuntimeSendWorker.js +0 -438
- package/vendor/app-server/dist/host/TokenTool.d.ts +0 -15
- package/vendor/app-server/dist/host/TokenTool.js +0 -84
- package/vendor/app-server/dist/host/WebPreviewGateway.d.ts +0 -28
- package/vendor/app-server/dist/host/WebPreviewGateway.js +0 -815
- package/vendor/app-server/dist/host/native/RuntimeCredentialTokenIssuer.d.ts +0 -23
- package/vendor/app-server/dist/host/native/RuntimeCredentialTokenIssuer.js +0 -115
- package/vendor/app-server/dist/host/native/RuntimeHostBridge.d.ts +0 -32
- package/vendor/app-server/dist/host/native/RuntimeHostBridge.js +0 -157
- package/vendor/app-server/dist/host/runtime_backed_preflight.d.ts +0 -10
- package/vendor/app-server/dist/host/runtime_backed_preflight.js +0 -78
- package/vendor/app-server/dist/host/tests/helpers/host_socket_client.d.ts +0 -28
- package/vendor/app-server/dist/host/tests/helpers/host_socket_client.js +0 -85
- package/vendor/app-server/dist/host/tests/helpers/runtime_e2e_local_config.d.ts +0 -10
- package/vendor/app-server/dist/host/tests/helpers/runtime_e2e_local_config.js +0 -41
- package/vendor/app-server/dist/host/tests/helpers/runtime_test_env.d.ts +0 -11
- package/vendor/app-server/dist/host/tests/helpers/runtime_test_env.js +0 -32
- package/vendor/app-server/dist/protocol/contract.d.ts +0 -1128
- package/vendor/app-server/dist/protocol/contract.js +0 -217
- package/vendor/app-server/dist/protocol-client/index.d.ts +0 -25
- package/vendor/app-server/dist/protocol-client/index.js +0 -114
- package/vendor/app-server/dist/src/index.d.ts +0 -1
- package/vendor/app-server/dist/src/index.js +0 -294
- /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_codec.h +0 -0
- /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_frame.h +0 -0
- /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_io_android.h +0 -0
- /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_io_apple.h +0 -0
- /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_io_harmony.h +0 -0
- /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_io_windows.h +0 -0
- /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_processing.h +0 -0
- /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_sample_rate.h +0 -0
- /package/vendor/{app-server/bin/runtime/linux-x64 → runtime/macos-arm64}/include/tirtc/foundation/build_info.h +0 -0
- /package/vendor/{app-server/bin/runtime/linux-x64 → runtime/macos-arm64}/include/tirtc/http.h +0 -0
- /package/vendor/{app-server/bin/runtime/linux-x64 → runtime/macos-arm64}/include/tirtc/logging.h +0 -0
- /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/media_codec.h +0 -0
- /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_frame.h +0 -0
- /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_io_apple.h +0 -0
- /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_io_harmony.h +0 -0
- /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_io_windows.h +0 -0
- /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_processing.h +0 -0
- /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libTGTRP.a +0 -0
- /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libTiRTC.a +0 -0
- /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libcrypto.a +0 -0
- /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libcrypto.dylib +0 -0
- /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libssl.a +0 -0
- /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libssl.dylib +0 -0
- /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libtgrtc.dylib +0 -0
- /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libwebrtc_apm.a +0 -0
- /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libxlog.a +0 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.issueToken = issueToken;
|
|
7
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
8
|
+
const http_1 = __importDefault(require("http"));
|
|
9
|
+
const https_1 = __importDefault(require("https"));
|
|
10
|
+
const defaultOpenapiEndpoint = 'http://api-test-tirtc.tange365.com';
|
|
11
|
+
const defaultUserTtlSeconds = 86400;
|
|
12
|
+
const defaultChannelTtlSeconds = 300;
|
|
13
|
+
const defaultHttpTimeoutMs = 15000;
|
|
14
|
+
function normalizeRequired(value, field) {
|
|
15
|
+
const normalized = value.trim();
|
|
16
|
+
if (normalized.length === 0) {
|
|
17
|
+
throw new Error('missing required credential field: ' + field);
|
|
18
|
+
}
|
|
19
|
+
return normalized;
|
|
20
|
+
}
|
|
21
|
+
function timestampUtc() {
|
|
22
|
+
return new Date().toISOString().replace(/\.\d{3}Z$/, 'Z');
|
|
23
|
+
}
|
|
24
|
+
function sha256Hex(input) {
|
|
25
|
+
return crypto_1.default.createHash('sha256').update(input).digest('hex');
|
|
26
|
+
}
|
|
27
|
+
function base64Url(input) {
|
|
28
|
+
return input.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/g, '');
|
|
29
|
+
}
|
|
30
|
+
function buildAuthorization(method, requestPath, query, timestamp, body, accessId, secretKey) {
|
|
31
|
+
const bodyHash = sha256Hex(body);
|
|
32
|
+
const stringToSign = [method, requestPath, query, timestamp, bodyHash].join('\n');
|
|
33
|
+
const signature = crypto_1.default.createHmac('sha256', secretKey).update(stringToSign).digest();
|
|
34
|
+
return 'TGServer ' + accessId + ':' + base64Url(signature);
|
|
35
|
+
}
|
|
36
|
+
function postJson(endpoint, requestPath, headers, body) {
|
|
37
|
+
const url = new URL(endpoint);
|
|
38
|
+
const client = url.protocol === 'https:' ? https_1.default : http_1.default;
|
|
39
|
+
const port = url.port.length > 0 ? Number.parseInt(url.port, 10) : (url.protocol === 'https:' ? 443 : 80);
|
|
40
|
+
return new Promise((resolve, reject) => {
|
|
41
|
+
const request = client.request({
|
|
42
|
+
protocol: url.protocol,
|
|
43
|
+
hostname: url.hostname,
|
|
44
|
+
port,
|
|
45
|
+
method: 'POST',
|
|
46
|
+
path: requestPath,
|
|
47
|
+
headers: {
|
|
48
|
+
...headers,
|
|
49
|
+
'Content-Length': Buffer.byteLength(body),
|
|
50
|
+
},
|
|
51
|
+
timeout: defaultHttpTimeoutMs,
|
|
52
|
+
}, (response) => {
|
|
53
|
+
const chunks = [];
|
|
54
|
+
response.on('data', (chunk) => chunks.push(chunk));
|
|
55
|
+
response.on('end', () => {
|
|
56
|
+
resolve({
|
|
57
|
+
statusCode: response.statusCode ?? 0,
|
|
58
|
+
body: Buffer.concat(chunks).toString('utf8'),
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
request.on('timeout', () => {
|
|
63
|
+
request.destroy(new Error('token issue request timeout'));
|
|
64
|
+
});
|
|
65
|
+
request.on('error', reject);
|
|
66
|
+
request.write(body);
|
|
67
|
+
request.end();
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function findStringByKey(value, key) {
|
|
71
|
+
if (typeof value !== 'object' || value === null) {
|
|
72
|
+
return '';
|
|
73
|
+
}
|
|
74
|
+
if (Array.isArray(value)) {
|
|
75
|
+
for (const entry of value) {
|
|
76
|
+
const found = findStringByKey(entry, key);
|
|
77
|
+
if (found.length > 0) {
|
|
78
|
+
return found;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return '';
|
|
82
|
+
}
|
|
83
|
+
const record = value;
|
|
84
|
+
if (typeof record[key] === 'string') {
|
|
85
|
+
return record[key];
|
|
86
|
+
}
|
|
87
|
+
for (const entry of Object.values(record)) {
|
|
88
|
+
const found = findStringByKey(entry, key);
|
|
89
|
+
if (found.length > 0) {
|
|
90
|
+
return found;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return '';
|
|
94
|
+
}
|
|
95
|
+
function readJsonString(body, key) {
|
|
96
|
+
try {
|
|
97
|
+
return findStringByKey(JSON.parse(body), key);
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
return '';
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function issueFailure(statusCode) {
|
|
104
|
+
return new Error('issue token failed error=3 http_status=' + statusCode);
|
|
105
|
+
}
|
|
106
|
+
async function issueToken(input) {
|
|
107
|
+
const accessId = normalizeRequired(input.accessId, 'accessId');
|
|
108
|
+
const secretKey = normalizeRequired(input.secretKey, 'secretKey');
|
|
109
|
+
const remoteId = normalizeRequired(input.remoteId, 'remoteId');
|
|
110
|
+
const endpoint = input.openapiEndpoint?.trim() || defaultOpenapiEndpoint;
|
|
111
|
+
const userTtlSeconds = input.userTtlSeconds && input.userTtlSeconds > 0 ?
|
|
112
|
+
input.userTtlSeconds :
|
|
113
|
+
defaultUserTtlSeconds;
|
|
114
|
+
const channelTtlSeconds = input.channelTtlSeconds && input.channelTtlSeconds > 0 ?
|
|
115
|
+
input.channelTtlSeconds :
|
|
116
|
+
defaultChannelTtlSeconds;
|
|
117
|
+
const timestamp = timestampUtc();
|
|
118
|
+
const userBody = JSON.stringify({ access_id: accessId, uid: remoteId, ttl: userTtlSeconds });
|
|
119
|
+
const userResponse = await postJson(endpoint, '/v1/user_token', {
|
|
120
|
+
'Content-Type': 'application/json',
|
|
121
|
+
Authorization: buildAuthorization('POST', '/v1/user_token', '', timestamp, userBody, accessId, secretKey),
|
|
122
|
+
'X-TG-Timestamp': timestamp,
|
|
123
|
+
}, userBody);
|
|
124
|
+
const userToken = readJsonString(userResponse.body, 'user_token');
|
|
125
|
+
if (userResponse.statusCode < 200 || userResponse.statusCode >= 300 || userToken.length === 0) {
|
|
126
|
+
throw issueFailure(userResponse.statusCode);
|
|
127
|
+
}
|
|
128
|
+
const channelBody = JSON.stringify({ device_id: remoteId, ttl: channelTtlSeconds });
|
|
129
|
+
const channelResponse = await postJson(endpoint, '/v1/token', {
|
|
130
|
+
'Content-Type': 'application/json',
|
|
131
|
+
Authorization: 'Bearer ' + userToken,
|
|
132
|
+
}, channelBody);
|
|
133
|
+
const token = readJsonString(channelResponse.body, 'token').trim();
|
|
134
|
+
if (channelResponse.statusCode < 200 || channelResponse.statusCode >= 300 || token.length === 0) {
|
|
135
|
+
throw issueFailure(channelResponse.statusCode);
|
|
136
|
+
}
|
|
137
|
+
return token;
|
|
138
|
+
}
|
|
@@ -40,11 +40,9 @@ export type LicenseQrcodeOutput = {
|
|
|
40
40
|
qrCodeAscii: string;
|
|
41
41
|
qrCodeAsciiIncluded: boolean;
|
|
42
42
|
};
|
|
43
|
-
export declare function resolveIssueTokenEnvironment(
|
|
43
|
+
export declare function resolveIssueTokenEnvironment(): {
|
|
44
44
|
runtimePlatform: string;
|
|
45
|
-
|
|
46
|
-
repoRoot: string;
|
|
47
|
-
addonPath: string;
|
|
45
|
+
provider: string;
|
|
48
46
|
};
|
|
49
47
|
export declare function issueToken(input: TokenIssueInput): Promise<string>;
|
|
50
48
|
export declare function buildIssuedTokenPayload(input: TokenIssueInput, token: string): IssuedTokenPayload;
|
|
@@ -1,37 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
4
|
};
|
|
@@ -46,15 +13,11 @@ exports.issueTokenWithQrcode = issueTokenWithQrcode;
|
|
|
46
13
|
exports.buildLicenseQrcode = buildLicenseQrcode;
|
|
47
14
|
exports.formatTokenIssueConsoleOutput = formatTokenIssueConsoleOutput;
|
|
48
15
|
exports.formatLicenseQrcodeConsoleOutput = formatLicenseQrcodeConsoleOutput;
|
|
49
|
-
const childProcess = __importStar(require("child_process"));
|
|
50
16
|
const fs_1 = __importDefault(require("fs"));
|
|
51
17
|
const path_1 = __importDefault(require("path"));
|
|
52
18
|
const qrcode_1 = __importDefault(require("qrcode"));
|
|
53
|
-
const
|
|
19
|
+
const token_issue_1 = require("./token_issue");
|
|
54
20
|
const kAsciiQrQuietZoneModules = 2;
|
|
55
|
-
function pathExists(filePath) {
|
|
56
|
-
return fs_1.default.existsSync(filePath);
|
|
57
|
-
}
|
|
58
21
|
function ensureDirectory(dirPath) {
|
|
59
22
|
fs_1.default.mkdirSync(dirPath, { recursive: true });
|
|
60
23
|
}
|
|
@@ -78,109 +41,10 @@ function buildTokenQrCodePngPath(payload) {
|
|
|
78
41
|
function buildLicenseQrCodePngPath(payload) {
|
|
79
42
|
return buildQrCodePngPath('license', payload.license);
|
|
80
43
|
}
|
|
81
|
-
function
|
|
82
|
-
const raw = process.env.TIRTC_RUNTIME_PLATFORM;
|
|
83
|
-
if (raw && raw.trim().length > 0) {
|
|
84
|
-
return raw.trim();
|
|
85
|
-
}
|
|
86
|
-
if (process.platform === 'darwin' && process.arch === 'arm64') {
|
|
87
|
-
return 'macos-arm64';
|
|
88
|
-
}
|
|
89
|
-
return 'linux-x64';
|
|
90
|
-
}
|
|
91
|
-
function resolveRuntimeBundleRoot(runtimePlatform, fromDir = __dirname) {
|
|
92
|
-
const explicit = process.env.TIRTC_RUNTIME_BUNDLE_ROOT;
|
|
93
|
-
if (explicit && explicit.trim().length > 0) {
|
|
94
|
-
return explicit.trim();
|
|
95
|
-
}
|
|
96
|
-
const embedded = (0, embedded_paths_1.resolveEmbeddedRuntimeBundleRoot)(fromDir, runtimePlatform);
|
|
97
|
-
if (embedded) {
|
|
98
|
-
return embedded;
|
|
99
|
-
}
|
|
100
|
-
const execDir = path_1.default.dirname(process.execPath);
|
|
101
|
-
const candidates = [
|
|
102
|
-
path_1.default.resolve(execDir, 'runtime', runtimePlatform),
|
|
103
|
-
path_1.default.resolve(execDir, '../runtime', runtimePlatform),
|
|
104
|
-
path_1.default.resolve(__dirname, '../bin/runtime', runtimePlatform),
|
|
105
|
-
path_1.default.resolve(__dirname, '../../../../bin/runtime', runtimePlatform),
|
|
106
|
-
path_1.default.resolve(process.cwd(), 'products/cli/bin/runtime', runtimePlatform),
|
|
107
|
-
path_1.default.resolve(process.cwd(), 'bin/runtime', runtimePlatform),
|
|
108
|
-
path_1.default.resolve(process.cwd(), '../bin/runtime', runtimePlatform),
|
|
109
|
-
];
|
|
110
|
-
for (const candidate of candidates) {
|
|
111
|
-
if (pathExists(path_1.default.join(candidate, 'manifest.txt'))) {
|
|
112
|
-
return candidate;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return candidates[0];
|
|
116
|
-
}
|
|
117
|
-
function resolveRepoRoot(fromDir = __dirname) {
|
|
118
|
-
const embeddedAppServerRoot = (0, embedded_paths_1.resolveEmbeddedAppServerRoot)(fromDir);
|
|
119
|
-
if (embeddedAppServerRoot) {
|
|
120
|
-
return path_1.default.resolve(embeddedAppServerRoot, '..');
|
|
121
|
-
}
|
|
122
|
-
const candidates = [
|
|
123
|
-
path_1.default.resolve(__dirname, '../../../../../../'),
|
|
124
|
-
path_1.default.resolve(__dirname, '../../../../../'),
|
|
125
|
-
path_1.default.resolve(__dirname, '../../../..'),
|
|
126
|
-
path_1.default.resolve(process.cwd()),
|
|
127
|
-
];
|
|
128
|
-
for (const candidate of candidates) {
|
|
129
|
-
if (pathExists(path_1.default.join(candidate, 'products/app-server')) && pathExists(path_1.default.join(candidate, 'products/cli'))) {
|
|
130
|
-
return candidate;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return candidates[0];
|
|
134
|
-
}
|
|
135
|
-
function resolveEmbeddedAddonPath(runtimePlatform, fromDir = __dirname) {
|
|
136
|
-
const embeddedAppServerRoot = (0, embedded_paths_1.resolveEmbeddedAppServerRoot)(fromDir);
|
|
137
|
-
if (!embeddedAppServerRoot) {
|
|
138
|
-
return undefined;
|
|
139
|
-
}
|
|
140
|
-
const candidate = path_1.default.join(embeddedAppServerRoot, 'bin/native', runtimePlatform, 'credential_napi.node');
|
|
141
|
-
if (pathExists(candidate)) {
|
|
142
|
-
return candidate;
|
|
143
|
-
}
|
|
144
|
-
return undefined;
|
|
145
|
-
}
|
|
146
|
-
function ensureRuntimeBundleReady(runtimeBundleRoot) {
|
|
147
|
-
const includeDir = path_1.default.join(runtimeBundleRoot, 'include');
|
|
148
|
-
const libDir = path_1.default.join(runtimeBundleRoot, 'lib');
|
|
149
|
-
if (!pathExists(includeDir) || !pathExists(libDir)) {
|
|
150
|
-
throw new Error('runtime-backed sdk bundle is missing: ' + runtimeBundleRoot);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
function resolveAddonPath(repoRoot, runtimePlatform, fromDir = __dirname) {
|
|
154
|
-
const explicit = process.env.TIRTC_CREDENTIAL_ADDON_PATH;
|
|
155
|
-
const embedded = resolveEmbeddedAddonPath(runtimePlatform, fromDir);
|
|
156
|
-
const candidates = [
|
|
157
|
-
explicit,
|
|
158
|
-
embedded,
|
|
159
|
-
path_1.default.join(repoRoot, `products/app-server/bin/native/${runtimePlatform}/credential_napi.node`),
|
|
160
|
-
path_1.default.join(repoRoot, `app-server/bin/native/${runtimePlatform}/credential_napi.node`),
|
|
161
|
-
path_1.default.join(repoRoot, `.build/app-server/native/${runtimePlatform}/credential_napi.node`),
|
|
162
|
-
path_1.default.resolve(process.cwd(), `products/app-server/bin/native/${runtimePlatform}/credential_napi.node`),
|
|
163
|
-
path_1.default.resolve(process.cwd(), `app-server/bin/native/${runtimePlatform}/credential_napi.node`),
|
|
164
|
-
path_1.default.resolve(process.cwd(), `.build/app-server/native/${runtimePlatform}/credential_napi.node`),
|
|
165
|
-
].filter((entry) => typeof entry === 'string' && entry.trim().length > 0);
|
|
166
|
-
for (const candidate of candidates) {
|
|
167
|
-
const normalized = path_1.default.resolve(candidate);
|
|
168
|
-
if (pathExists(normalized)) {
|
|
169
|
-
return normalized;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
throw new Error('credential addon missing for platform ' + runtimePlatform +
|
|
173
|
-
'; run: npm --prefix products/app-server run build:native');
|
|
174
|
-
}
|
|
175
|
-
function resolveIssueTokenEnvironment(runtimePlatform = resolveRuntimePlatform(), fromDir = __dirname) {
|
|
176
|
-
const runtimeBundleRoot = resolveRuntimeBundleRoot(runtimePlatform, fromDir);
|
|
177
|
-
const repoRoot = resolveRepoRoot(fromDir);
|
|
178
|
-
ensureRuntimeBundleReady(runtimeBundleRoot);
|
|
44
|
+
function resolveIssueTokenEnvironment() {
|
|
179
45
|
return {
|
|
180
|
-
runtimePlatform,
|
|
181
|
-
|
|
182
|
-
repoRoot,
|
|
183
|
-
addonPath: resolveAddonPath(repoRoot, runtimePlatform, fromDir),
|
|
46
|
+
runtimePlatform: 'node',
|
|
47
|
+
provider: 'products/cli',
|
|
184
48
|
};
|
|
185
49
|
}
|
|
186
50
|
function normalizeIssuedToken(token) {
|
|
@@ -190,30 +54,6 @@ function normalizeIssuedToken(token) {
|
|
|
190
54
|
}
|
|
191
55
|
return normalized;
|
|
192
56
|
}
|
|
193
|
-
function buildIssueTokenHelperSource() {
|
|
194
|
-
return [
|
|
195
|
-
'const addon = require(process.env.TIRTC_CREDENTIAL_ADDON_PATH_HELPER);',
|
|
196
|
-
'const input = JSON.parse(process.env.TIRTC_CREDENTIAL_INPUT_JSON || "{}");',
|
|
197
|
-
'const originalWrite = process.stderr.write.bind(process.stderr);',
|
|
198
|
-
'process.stderr.write = ((chunk, encoding, callback) => {',
|
|
199
|
-
' if (typeof callback === "function") {',
|
|
200
|
-
' callback();',
|
|
201
|
-
' }',
|
|
202
|
-
' return true;',
|
|
203
|
-
'});',
|
|
204
|
-
'try {',
|
|
205
|
-
' const token = addon.issueToken({',
|
|
206
|
-
' openapiEndpoint: input.openapiEndpoint,',
|
|
207
|
-
' accessId: input.accessId,',
|
|
208
|
-
' secretKey: input.secretKey,',
|
|
209
|
-
' remoteId: input.remoteId,',
|
|
210
|
-
' });',
|
|
211
|
-
' process.stdout.write(String(token).trim());',
|
|
212
|
-
'} finally {',
|
|
213
|
-
' process.stderr.write = originalWrite;',
|
|
214
|
-
'}',
|
|
215
|
-
].join('\n');
|
|
216
|
-
}
|
|
217
57
|
function parseIssueTokenFailure(message) {
|
|
218
58
|
const matched = message.match(/issue token failed error=(\d+) http_status=(\d+)/i);
|
|
219
59
|
if (!matched) {
|
|
@@ -270,25 +110,6 @@ function formatIssueTokenFailureMessage(message) {
|
|
|
270
110
|
}
|
|
271
111
|
return 'token issuing failed: ' + detail;
|
|
272
112
|
}
|
|
273
|
-
function issueTokenViaSubprocess(addonPath, input) {
|
|
274
|
-
const result = childProcess.spawnSync(process.execPath, ['-e', buildIssueTokenHelperSource()], {
|
|
275
|
-
encoding: 'utf8',
|
|
276
|
-
env: {
|
|
277
|
-
...process.env,
|
|
278
|
-
TIRTC_CREDENTIAL_ADDON_PATH_HELPER: addonPath,
|
|
279
|
-
TIRTC_CREDENTIAL_INPUT_JSON: JSON.stringify(input),
|
|
280
|
-
},
|
|
281
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
282
|
-
});
|
|
283
|
-
if (result.error) {
|
|
284
|
-
throw result.error;
|
|
285
|
-
}
|
|
286
|
-
if (result.status !== 0) {
|
|
287
|
-
const details = String(result.stderr || result.stdout || 'issue token subprocess failed').trim();
|
|
288
|
-
throw new Error(formatIssueTokenFailureMessage(details || 'issue token subprocess failed'));
|
|
289
|
-
}
|
|
290
|
-
return normalizeIssuedToken(String(result.stdout || ''));
|
|
291
|
-
}
|
|
292
113
|
function readQrModule(modules, row, column) {
|
|
293
114
|
return Boolean(modules.data[row * modules.size + column]);
|
|
294
115
|
}
|
|
@@ -345,13 +166,18 @@ function renderHalfBlockQr(modules) {
|
|
|
345
166
|
return lines.join('\n');
|
|
346
167
|
}
|
|
347
168
|
async function issueToken(input) {
|
|
348
|
-
|
|
169
|
+
resolveIssueTokenEnvironment();
|
|
349
170
|
try {
|
|
350
|
-
return
|
|
171
|
+
return normalizeIssuedToken(await (0, token_issue_1.issueToken)({
|
|
172
|
+
accessId: input.accessId,
|
|
173
|
+
secretKey: input.secretKey,
|
|
174
|
+
remoteId: input.remoteId,
|
|
175
|
+
openapiEndpoint: input.openapiEndpoint,
|
|
176
|
+
}));
|
|
351
177
|
}
|
|
352
178
|
catch (error) {
|
|
353
179
|
const message = error instanceof Error ? error.message : String(error);
|
|
354
|
-
throw new Error(message);
|
|
180
|
+
throw new Error(formatIssueTokenFailureMessage(message));
|
|
355
181
|
}
|
|
356
182
|
}
|
|
357
183
|
function buildIssuedTokenPayload(input, token) {
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
#include <stdint.h>
|
|
5
5
|
|
|
6
|
+
#include "tirtc/audio_frame.h"
|
|
6
7
|
#include "tirtc/audio_io.h"
|
|
7
8
|
#include "tirtc/audio_processing.h"
|
|
9
|
+
#include "tirtc/media_codec.h"
|
|
8
10
|
#include "tirtc/trp.h"
|
|
9
11
|
|
|
10
12
|
#ifdef __cplusplus
|
|
@@ -13,6 +15,8 @@ extern "C" {
|
|
|
13
15
|
|
|
14
16
|
typedef struct TirtcAudioInput TirtcAudioInput;
|
|
15
17
|
|
|
18
|
+
typedef struct TirtcAudioEncodedInput TirtcAudioEncodedInput;
|
|
19
|
+
|
|
16
20
|
typedef struct TirtcAudioOutput TirtcAudioOutput;
|
|
17
21
|
|
|
18
22
|
typedef enum TirtcInputState {
|
|
@@ -47,12 +51,25 @@ typedef struct TirtcAudioInputOptions {
|
|
|
47
51
|
TirtcAudioAnsLevel ans_level;
|
|
48
52
|
} TirtcAudioInputOptions;
|
|
49
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Options for a facade audio encoded input.
|
|
56
|
+
*
|
|
57
|
+
* The encoded input does not own or create an audio source. Callers submit already-encoded audio
|
|
58
|
+
* frames with `tirtc_audio_encoded_input_submit_frame()`. Non-NONE fields constrain submitted
|
|
59
|
+
* frames and reject mismatched packets with `TIRTC_ERROR_INVALID_ARGUMENT`.
|
|
60
|
+
*/
|
|
61
|
+
typedef struct TirtcAudioEncodedInputOptions {
|
|
62
|
+
TirtcMediaCodec codec;
|
|
63
|
+
|
|
64
|
+
TirtcAudioSampleRate sample_rate;
|
|
65
|
+
} TirtcAudioEncodedInputOptions;
|
|
66
|
+
|
|
50
67
|
typedef struct TirtcAudioOutputOptions {
|
|
51
68
|
uint32_t volume_percent;
|
|
52
69
|
|
|
53
|
-
|
|
70
|
+
TirtcAudioAgcLevel agc_level;
|
|
54
71
|
|
|
55
|
-
|
|
72
|
+
TirtcAudioAnsLevel ans_level;
|
|
56
73
|
} TirtcAudioOutputOptions;
|
|
57
74
|
|
|
58
75
|
typedef struct TirtcOutputStutterMetrics {
|
|
@@ -92,6 +109,20 @@ typedef struct TirtcAudioInputObserver {
|
|
|
92
109
|
void* user_data);
|
|
93
110
|
} TirtcAudioInputObserver;
|
|
94
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Audio encoded input observer.
|
|
114
|
+
*
|
|
115
|
+
* State callbacks report only facade input lifecycle changes. They do not mean a remote consumer
|
|
116
|
+
* has subscribed to, decoded, or rendered the stream. `owned_message` is allocated by facade for
|
|
117
|
+
* this callback dispatch; consumers must release it with `tirtc_owned_string_release()`.
|
|
118
|
+
*/
|
|
119
|
+
typedef struct TirtcAudioEncodedInputObserver {
|
|
120
|
+
void (*on_state_changed)(TirtcAudioEncodedInput* input, TirtcInputState state, void* user_data);
|
|
121
|
+
|
|
122
|
+
void (*on_error)(TirtcAudioEncodedInput* input, TirtcError error, TirtcOwnedString* owned_message,
|
|
123
|
+
void* user_data);
|
|
124
|
+
} TirtcAudioEncodedInputObserver;
|
|
125
|
+
|
|
95
126
|
/**
|
|
96
127
|
* Audio output observer.
|
|
97
128
|
*
|
|
@@ -130,6 +161,29 @@ TirtcError tirtc_audio_input_detach(TirtcAudioInput* input, TirtcConn* connectio
|
|
|
130
161
|
|
|
131
162
|
void tirtc_audio_input_destroy(TirtcAudioInput* input);
|
|
132
163
|
|
|
164
|
+
TirtcError tirtc_audio_encoded_input_create(TirtcAudioEncodedInput** out_input);
|
|
165
|
+
|
|
166
|
+
TirtcError tirtc_audio_encoded_input_set_options(TirtcAudioEncodedInput* input,
|
|
167
|
+
const TirtcAudioEncodedInputOptions* options);
|
|
168
|
+
|
|
169
|
+
TirtcError tirtc_audio_encoded_input_set_observer(TirtcAudioEncodedInput* input,
|
|
170
|
+
const TirtcAudioEncodedInputObserver* observer,
|
|
171
|
+
void* user_data);
|
|
172
|
+
|
|
173
|
+
TirtcError tirtc_audio_encoded_input_start(TirtcAudioEncodedInput* input);
|
|
174
|
+
|
|
175
|
+
TirtcError tirtc_audio_encoded_input_stop(TirtcAudioEncodedInput* input);
|
|
176
|
+
|
|
177
|
+
TirtcError tirtc_audio_encoded_input_attach(TirtcAudioEncodedInput* input, TirtcConn* connection,
|
|
178
|
+
uint8_t stream_id);
|
|
179
|
+
|
|
180
|
+
TirtcError tirtc_audio_encoded_input_detach(TirtcAudioEncodedInput* input, TirtcConn* connection);
|
|
181
|
+
|
|
182
|
+
TirtcError tirtc_audio_encoded_input_submit_frame(TirtcAudioEncodedInput* input,
|
|
183
|
+
const TirtcAudioEncodedFrame* frame);
|
|
184
|
+
|
|
185
|
+
void tirtc_audio_encoded_input_destroy(TirtcAudioEncodedInput* input);
|
|
186
|
+
|
|
133
187
|
TirtcError tirtc_audio_output_create(TirtcAudioOutput** out_output);
|
|
134
188
|
|
|
135
189
|
TirtcError tirtc_audio_output_set_aout(TirtcAudioOutput* output, TirtcAudioAout* aout);
|
|
@@ -19,6 +19,12 @@ typedef struct TirtcAudioIoConfig {
|
|
|
19
19
|
uint32_t samples_per_buffer;
|
|
20
20
|
} TirtcAudioIoConfig;
|
|
21
21
|
|
|
22
|
+
typedef struct TirtcAudioHeadlessAoutOptions {
|
|
23
|
+
const char* first_output_json_path;
|
|
24
|
+
const char* pcm_path;
|
|
25
|
+
uint32_t max_capture_bytes;
|
|
26
|
+
} TirtcAudioHeadlessAoutOptions;
|
|
27
|
+
|
|
22
28
|
typedef void (*TirtcAudioAinOnFrameFn)(TirtcAudioAin* ain, const TirtcAudioPcmFrame* frame,
|
|
23
29
|
void* user_data);
|
|
24
30
|
|
|
@@ -43,6 +49,9 @@ void tirtc_audio_ain_destroy(TirtcAudioAin* ain);
|
|
|
43
49
|
TirtcError tirtc_audio_aout_open(TirtcAudioAout* aout, const TirtcAudioIoConfig* config,
|
|
44
50
|
TirtcAudioAoutRenderFn render, void* user_data);
|
|
45
51
|
|
|
52
|
+
TirtcError tirtc_audio_aout_create_headless_capture(const TirtcAudioHeadlessAoutOptions* options,
|
|
53
|
+
TirtcAudioAout** out_aout);
|
|
54
|
+
|
|
46
55
|
TirtcError tirtc_audio_aout_set_volume(TirtcAudioAout* aout, uint32_t volume_percent);
|
|
47
56
|
TirtcError tirtc_audio_aout_pause(TirtcAudioAout* aout, int pause_on);
|
|
48
57
|
TirtcError tirtc_audio_aout_flush(TirtcAudioAout* aout);
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
#include "tirtc/audio.h"
|
|
7
7
|
#include "tirtc/media_codec.h"
|
|
8
|
+
#include "tirtc/video_codec.h"
|
|
8
9
|
#include "tirtc/video_io.h"
|
|
9
10
|
|
|
10
11
|
#ifdef __cplusplus
|
|
@@ -13,6 +14,8 @@ extern "C" {
|
|
|
13
14
|
|
|
14
15
|
typedef struct TirtcVideoInput TirtcVideoInput;
|
|
15
16
|
|
|
17
|
+
typedef struct TirtcVideoEncodedInput TirtcVideoEncodedInput;
|
|
18
|
+
|
|
16
19
|
typedef struct TirtcVideoOutput TirtcVideoOutput;
|
|
17
20
|
|
|
18
21
|
typedef enum TirtcVideoOutputState {
|
|
@@ -45,6 +48,10 @@ typedef struct TirtcVideoOutputMetricsSnapshot {
|
|
|
45
48
|
TirtcPendingDurationMetrics pending;
|
|
46
49
|
} TirtcVideoOutputMetricsSnapshot;
|
|
47
50
|
|
|
51
|
+
typedef struct TirtcVideoOutputOptions {
|
|
52
|
+
TirtcVideoDecoderPreference decoder_preference;
|
|
53
|
+
} TirtcVideoOutputOptions;
|
|
54
|
+
|
|
48
55
|
typedef struct TirtcVideoInputOptions {
|
|
49
56
|
TirtcMediaCodec codec;
|
|
50
57
|
|
|
@@ -55,6 +62,8 @@ typedef struct TirtcVideoInputOptions {
|
|
|
55
62
|
uint32_t fps;
|
|
56
63
|
|
|
57
64
|
uint32_t bitrate_kbps;
|
|
65
|
+
|
|
66
|
+
TirtcVideoEncoderPreference encoder_preference;
|
|
58
67
|
} TirtcVideoInputOptions;
|
|
59
68
|
|
|
60
69
|
/**
|
|
@@ -73,6 +82,23 @@ typedef struct TirtcVideoInputObserver {
|
|
|
73
82
|
void* user_data);
|
|
74
83
|
} TirtcVideoInputObserver;
|
|
75
84
|
|
|
85
|
+
typedef struct TirtcVideoEncodedInputOptions {
|
|
86
|
+
TirtcMediaCodec codec;
|
|
87
|
+
TirtcVideoBitstreamFormat bitstream_format;
|
|
88
|
+
} TirtcVideoEncodedInputOptions;
|
|
89
|
+
|
|
90
|
+
typedef struct TirtcVideoEncodedInputObserver {
|
|
91
|
+
void (*on_state_changed)(TirtcVideoEncodedInput* input, TirtcInputState state, void* user_data);
|
|
92
|
+
|
|
93
|
+
void (*on_output_size_changed)(TirtcVideoEncodedInput* input, uint32_t width, uint32_t height,
|
|
94
|
+
void* user_data);
|
|
95
|
+
|
|
96
|
+
void (*on_error)(TirtcVideoEncodedInput* input, TirtcError error, TirtcOwnedString* owned_message,
|
|
97
|
+
void* user_data);
|
|
98
|
+
|
|
99
|
+
void (*on_key_frame_requested)(TirtcVideoEncodedInput* input, void* user_data);
|
|
100
|
+
} TirtcVideoEncodedInputObserver;
|
|
101
|
+
|
|
76
102
|
/**
|
|
77
103
|
* Video output observer.
|
|
78
104
|
*
|
|
@@ -125,8 +151,34 @@ TirtcError tirtc_video_input_detach_preview(TirtcVideoInput* input);
|
|
|
125
151
|
|
|
126
152
|
void tirtc_video_input_destroy(TirtcVideoInput* input);
|
|
127
153
|
|
|
154
|
+
TirtcError tirtc_video_encoded_input_create(TirtcVideoEncodedInput** out_input);
|
|
155
|
+
|
|
156
|
+
TirtcError tirtc_video_encoded_input_set_options(TirtcVideoEncodedInput* input,
|
|
157
|
+
const TirtcVideoEncodedInputOptions* options);
|
|
158
|
+
|
|
159
|
+
TirtcError tirtc_video_encoded_input_set_observer(TirtcVideoEncodedInput* input,
|
|
160
|
+
const TirtcVideoEncodedInputObserver* observer,
|
|
161
|
+
void* user_data);
|
|
162
|
+
|
|
163
|
+
TirtcError tirtc_video_encoded_input_start(TirtcVideoEncodedInput* input);
|
|
164
|
+
|
|
165
|
+
TirtcError tirtc_video_encoded_input_stop(TirtcVideoEncodedInput* input);
|
|
166
|
+
|
|
167
|
+
TirtcError tirtc_video_encoded_input_attach(TirtcVideoEncodedInput* input, TirtcConn* connection,
|
|
168
|
+
uint8_t stream_id);
|
|
169
|
+
|
|
170
|
+
TirtcError tirtc_video_encoded_input_detach(TirtcVideoEncodedInput* input, TirtcConn* connection);
|
|
171
|
+
|
|
172
|
+
TirtcError tirtc_video_encoded_input_submit_frame(TirtcVideoEncodedInput* input,
|
|
173
|
+
const TirtcVideoEncodedFrame* frame);
|
|
174
|
+
|
|
175
|
+
void tirtc_video_encoded_input_destroy(TirtcVideoEncodedInput* input);
|
|
176
|
+
|
|
128
177
|
TirtcError tirtc_video_output_create(TirtcVideoOutput** out_output);
|
|
129
178
|
|
|
179
|
+
TirtcError tirtc_video_output_set_options(TirtcVideoOutput* output,
|
|
180
|
+
const TirtcVideoOutputOptions* options);
|
|
181
|
+
|
|
130
182
|
TirtcError tirtc_video_output_set_observer(TirtcVideoOutput* output,
|
|
131
183
|
const TirtcVideoOutputObserver* observer,
|
|
132
184
|
void* user_data);
|
package/vendor/{app-server/bin/runtime/linux-x64 → runtime/macos-arm64}/include/tirtc/error.h
RENAMED
|
@@ -41,6 +41,17 @@ typedef enum TirtcError {
|
|
|
41
41
|
TIRTC_ERROR_NOT_BOUND = 6029,
|
|
42
42
|
TIRTC_ERROR_NOT_CONFIGURED = 6030,
|
|
43
43
|
TIRTC_ERROR_NOT_OPEN = 6031,
|
|
44
|
+
TIRTC_ERROR_APP_ID_REQUIRED = 6032,
|
|
45
|
+
TIRTC_ERROR_VIDEO_ENCODER_BACKEND_UNAVAILABLE = 6033,
|
|
46
|
+
TIRTC_ERROR_VIDEO_ENCODER_CODEC_UNSUPPORTED = 6034,
|
|
47
|
+
TIRTC_ERROR_VIDEO_ENCODER_INITIALIZATION_FAILED = 6035,
|
|
48
|
+
TIRTC_ERROR_VIDEO_DECODER_CODEC_UNSUPPORTED = 6036,
|
|
49
|
+
TIRTC_ERROR_VIDEO_DECODER_BACKEND_UNAVAILABLE = 6037,
|
|
50
|
+
TIRTC_ERROR_VIDEO_DECODER_INITIALIZATION_FAILED = 6038,
|
|
51
|
+
TIRTC_ERROR_VIDEO_DECODER_CONFIGURATION_FAILED = 6039,
|
|
52
|
+
TIRTC_ERROR_VIDEO_DECODER_RUNTIME_FAILED = 6040,
|
|
53
|
+
TIRTC_ERROR_VIDEO_OUTPUT_TARGET_UNAVAILABLE = 6041,
|
|
54
|
+
TIRTC_ERROR_VIDEO_OUTPUT_RENDER_FAILED = 6042,
|
|
44
55
|
} TirtcError;
|
|
45
56
|
|
|
46
57
|
const char* tirtc_error_to_string(TirtcError error);
|