tirtc-devtools-cli 0.0.1
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 +52 -0
- package/USAGE.md +417 -0
- package/bin/tirtc-devtool.js +2 -0
- package/dist/app-server/protocol-client/index.d.ts +25 -0
- package/dist/app-server/protocol-client/index.js +114 -0
- package/dist/devtools/cli/src/config.d.ts +46 -0
- package/dist/devtools/cli/src/config.js +98 -0
- package/dist/devtools/cli/src/dummy.d.ts +0 -0
- package/dist/devtools/cli/src/dummy.js +1 -0
- package/dist/devtools/cli/src/embedded_paths.d.ts +7 -0
- package/dist/devtools/cli/src/embedded_paths.js +85 -0
- package/dist/devtools/cli/src/facade.d.ts +723 -0
- package/dist/devtools/cli/src/facade.js +194 -0
- package/dist/devtools/cli/src/ffmpeg_tool.d.ts +6 -0
- package/dist/devtools/cli/src/ffmpeg_tool.js +146 -0
- package/dist/devtools/cli/src/guide.d.ts +1 -0
- package/dist/devtools/cli/src/guide.js +49 -0
- package/dist/devtools/cli/src/index.d.ts +1 -0
- package/dist/devtools/cli/src/index.js +753 -0
- package/dist/devtools/cli/src/media_assets.d.ts +25 -0
- package/dist/devtools/cli/src/media_assets.js +121 -0
- package/dist/devtools/cli/src/session_manager.d.ts +25 -0
- package/dist/devtools/cli/src/session_manager.js +393 -0
- package/dist/devtools/cli/src/token_tool.d.ts +33 -0
- package/dist/devtools/cli/src/token_tool.js +217 -0
- package/dist/devtools/cli/src/transport.d.ts +30 -0
- package/dist/devtools/cli/src/transport.js +84 -0
- package/dist/dummy.d.ts +0 -0
- package/dist/dummy.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +48 -0
- package/package.json +54 -0
- package/script/ensure_ffmpeg.sh +22 -0
- package/vendor/app-server/bin/native/macos-arm64/credential_napi.node +0 -0
- package/vendor/app-server/bin/native/macos-arm64/libcrypto.dylib +0 -0
- package/vendor/app-server/bin/native/macos-arm64/libssl.dylib +0 -0
- package/vendor/app-server/bin/native/macos-arm64/libtgrtc.dylib +0 -0
- package/vendor/app-server/bin/native/macos-arm64/runtime_host_napi.node +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_codec.h +23 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_frame.h +36 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io.h +56 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_android.h +19 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_apple.h +19 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_harmony.h +19 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_windows.h +19 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_processing.h +56 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_sample_rate.h +18 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/error.h +20 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/logging.h +53 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/media_codec.h +21 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/media_downlink.h +89 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/media_uplink.h +115 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/runtime.h +236 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_codec.h +57 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_frame.h +55 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io.h +46 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_android.h +32 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_apple.h +34 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_harmony.h +32 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_windows.h +26 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_processing.h +34 -0
- package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_audio.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_facade.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/libmatrix_runtime_media.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_video.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/lib/libwebrtc_apm.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 +34 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio.h +398 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio_codec.h +23 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio_frame.h +36 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio_io.h +56 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio_io_android.h +19 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio_io_apple.h +19 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio_io_harmony.h +19 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio_io_windows.h +19 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio_processing.h +56 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio_sample_rate.h +18 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/av.h +452 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/credential.h +34 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/error.h +30 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/foundation/build_info.h +27 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/http.h +57 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/logging.h +55 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_codec.h +21 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_downlink.h +95 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_fixture_av_sync.h +61 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_fixture_source.h +77 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_live_source.h +71 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_uplink.h +116 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/transport.h +481 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/trp.h +541 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/video_codec.h +58 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/video_frame.h +55 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/video_io.h +46 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/video_io_android.h +32 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/video_io_apple.h +47 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/video_io_harmony.h +32 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/video_io_windows.h +26 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/video_processing.h +34 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libcrypto.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libcrypto.dylib +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_audio.a +0 -0
- 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_foundation_http.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_foundation_logging.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/runtime/macos-arm64/lib/libssl.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libssl.dylib +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libwebrtc_apm.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libxlog.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/manifest.txt +50 -0
- package/vendor/app-server/bin/tirtc-devtool-host.js +2 -0
- package/vendor/app-server/dist/host/ArtifactManager.d.ts +18 -0
- package/vendor/app-server/dist/host/ArtifactManager.js +83 -0
- package/vendor/app-server/dist/host/HostProtocol.d.ts +107 -0
- package/vendor/app-server/dist/host/HostProtocol.js +256 -0
- package/vendor/app-server/dist/host/HostServer.d.ts +49 -0
- package/vendor/app-server/dist/host/HostServer.js +635 -0
- package/vendor/app-server/dist/host/HostState.d.ts +60 -0
- package/vendor/app-server/dist/host/HostState.js +19 -0
- package/vendor/app-server/dist/host/RuntimeAdapter.d.ts +81 -0
- package/vendor/app-server/dist/host/RuntimeAdapter.js +559 -0
- package/vendor/app-server/dist/host/RuntimeCredentialTokenIssuer.d.ts +30 -0
- package/vendor/app-server/dist/host/RuntimeCredentialTokenIssuer.js +224 -0
- package/vendor/app-server/dist/host/RuntimeReceiveWorker.d.ts +37 -0
- package/vendor/app-server/dist/host/RuntimeReceiveWorker.js +186 -0
- package/vendor/app-server/dist/host/RuntimeSendWorker.d.ts +42 -0
- package/vendor/app-server/dist/host/RuntimeSendWorker.js +274 -0
- package/vendor/app-server/dist/host/TokenTool.d.ts +15 -0
- package/vendor/app-server/dist/host/TokenTool.js +84 -0
- package/vendor/app-server/dist/host/WebPreviewGateway.d.ts +28 -0
- package/vendor/app-server/dist/host/WebPreviewGateway.js +815 -0
- package/vendor/app-server/dist/host/native/RuntimeCredentialTokenIssuer.d.ts +26 -0
- package/vendor/app-server/dist/host/native/RuntimeCredentialTokenIssuer.js +118 -0
- package/vendor/app-server/dist/host/native/RuntimeHostBridge.d.ts +19 -0
- package/vendor/app-server/dist/host/native/RuntimeHostBridge.js +141 -0
- package/vendor/app-server/dist/host/runtime_backed_preflight.d.ts +10 -0
- package/vendor/app-server/dist/host/runtime_backed_preflight.js +78 -0
- package/vendor/app-server/dist/host/tests/helpers/host_socket_client.d.ts +28 -0
- package/vendor/app-server/dist/host/tests/helpers/host_socket_client.js +85 -0
- package/vendor/app-server/dist/host/tests/helpers/runtime_e2e_local_config.d.ts +10 -0
- package/vendor/app-server/dist/host/tests/helpers/runtime_e2e_local_config.js +41 -0
- package/vendor/app-server/dist/host/tests/helpers/runtime_test_env.d.ts +11 -0
- package/vendor/app-server/dist/host/tests/helpers/runtime_test_env.js +32 -0
- package/vendor/app-server/dist/protocol/contract.d.ts +983 -0
- package/vendor/app-server/dist/protocol/contract.js +198 -0
- package/vendor/app-server/dist/protocol-client/index.d.ts +25 -0
- package/vendor/app-server/dist/protocol-client/index.js +114 -0
- package/vendor/app-server/dist/src/index.d.ts +1 -0
- package/vendor/app-server/dist/src/index.js +294 -0
- package/vendor/runtime/script/prepare_runtime_media_dataset.sh +427 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#ifndef TIRTC_AUDIO_PROCESSING_H_
|
|
2
|
+
#define TIRTC_AUDIO_PROCESSING_H_
|
|
3
|
+
|
|
4
|
+
#include "tirtc/audio_frame.h"
|
|
5
|
+
#include "tirtc/error.h"
|
|
6
|
+
|
|
7
|
+
#ifdef __cplusplus
|
|
8
|
+
extern "C" {
|
|
9
|
+
#endif
|
|
10
|
+
|
|
11
|
+
typedef struct TirtcAudioProcessor TirtcAudioProcessor;
|
|
12
|
+
|
|
13
|
+
typedef enum TirtcAudioAecMode {
|
|
14
|
+
TIRTC_AUDIO_AEC_MODE_DISABLED = 0,
|
|
15
|
+
TIRTC_AUDIO_AEC_MODE_ENABLED = 1,
|
|
16
|
+
} TirtcAudioAecMode;
|
|
17
|
+
|
|
18
|
+
typedef enum TirtcAudioAnsLevel {
|
|
19
|
+
TIRTC_AUDIO_ANS_LEVEL_DISABLED = 0,
|
|
20
|
+
TIRTC_AUDIO_ANS_LEVEL_LOW = 1,
|
|
21
|
+
TIRTC_AUDIO_ANS_LEVEL_MEDIUM = 2,
|
|
22
|
+
TIRTC_AUDIO_ANS_LEVEL_HIGH = 3,
|
|
23
|
+
} TirtcAudioAnsLevel;
|
|
24
|
+
|
|
25
|
+
typedef enum TirtcAudioAgcLevel {
|
|
26
|
+
TIRTC_AUDIO_AGC_LEVEL_DISABLED = 0,
|
|
27
|
+
TIRTC_AUDIO_AGC_LEVEL_LOW = 1,
|
|
28
|
+
TIRTC_AUDIO_AGC_LEVEL_MEDIUM = 2,
|
|
29
|
+
TIRTC_AUDIO_AGC_LEVEL_HIGH = 3,
|
|
30
|
+
} TirtcAudioAgcLevel;
|
|
31
|
+
|
|
32
|
+
typedef struct TirtcAudioProcessorConfig {
|
|
33
|
+
TirtcAudioSampleRate sample_rate;
|
|
34
|
+
TirtcAudioAecMode aec_mode;
|
|
35
|
+
TirtcAudioAnsLevel ans_level;
|
|
36
|
+
TirtcAudioAgcLevel agc_level;
|
|
37
|
+
} TirtcAudioProcessorConfig;
|
|
38
|
+
|
|
39
|
+
TirtcError tirtc_audio_processor_create(const TirtcAudioProcessorConfig* config,
|
|
40
|
+
TirtcAudioProcessor** out_processor);
|
|
41
|
+
void tirtc_audio_processor_destroy(TirtcAudioProcessor* processor);
|
|
42
|
+
|
|
43
|
+
TirtcError tirtc_audio_processor_set_config(TirtcAudioProcessor* processor,
|
|
44
|
+
const TirtcAudioProcessorConfig* config);
|
|
45
|
+
|
|
46
|
+
TirtcError tirtc_audio_processor_process(TirtcAudioProcessor* processor,
|
|
47
|
+
const TirtcAudioPcmFrame* in_frame,
|
|
48
|
+
TirtcAudioPcmFrame* out_frame);
|
|
49
|
+
|
|
50
|
+
TirtcError tirtc_audio_processor_reset(TirtcAudioProcessor* processor);
|
|
51
|
+
|
|
52
|
+
#ifdef __cplusplus
|
|
53
|
+
}
|
|
54
|
+
#endif
|
|
55
|
+
|
|
56
|
+
#endif // TIRTC_AUDIO_PROCESSING_H_
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#ifndef TIRTC_MEDIA_CONTRACT_AUDIO_SAMPLE_RATE_H_
|
|
2
|
+
#define TIRTC_MEDIA_CONTRACT_AUDIO_SAMPLE_RATE_H_
|
|
3
|
+
|
|
4
|
+
#ifdef __cplusplus
|
|
5
|
+
extern "C" {
|
|
6
|
+
#endif
|
|
7
|
+
|
|
8
|
+
typedef enum TirtcAudioSampleRate {
|
|
9
|
+
TIRTC_AUDIO_SAMPLE_RATE_NONE = 0,
|
|
10
|
+
TIRTC_AUDIO_SAMPLE_RATE_8K = 8000,
|
|
11
|
+
TIRTC_AUDIO_SAMPLE_RATE_16K = 16000,
|
|
12
|
+
} TirtcAudioSampleRate;
|
|
13
|
+
|
|
14
|
+
#ifdef __cplusplus
|
|
15
|
+
}
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
#endif // TIRTC_MEDIA_CONTRACT_AUDIO_SAMPLE_RATE_H_
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#ifndef TIRTC_FOUNDATION_ERROR_H_
|
|
2
|
+
#define TIRTC_FOUNDATION_ERROR_H_
|
|
3
|
+
|
|
4
|
+
#ifdef __cplusplus
|
|
5
|
+
extern "C" {
|
|
6
|
+
#endif
|
|
7
|
+
|
|
8
|
+
typedef enum TirtcError {
|
|
9
|
+
TIRTC_ERROR_OK = 0,
|
|
10
|
+
TIRTC_ERROR_INVALID_ARGUMENT = 1,
|
|
11
|
+
TIRTC_ERROR_NOT_INITIALIZED = 2,
|
|
12
|
+
TIRTC_ERROR_INTERNAL = 3,
|
|
13
|
+
TIRTC_ERROR_NOT_READY = 4,
|
|
14
|
+
} TirtcError;
|
|
15
|
+
|
|
16
|
+
#ifdef __cplusplus
|
|
17
|
+
}
|
|
18
|
+
#endif
|
|
19
|
+
|
|
20
|
+
#endif // TIRTC_FOUNDATION_ERROR_H_
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#ifndef TIRTC_FOUNDATION_LOGGING_H_
|
|
2
|
+
#define TIRTC_FOUNDATION_LOGGING_H_
|
|
3
|
+
|
|
4
|
+
#include <stdarg.h>
|
|
5
|
+
|
|
6
|
+
#include "tirtc/error.h"
|
|
7
|
+
|
|
8
|
+
#ifdef __cplusplus
|
|
9
|
+
extern "C" {
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
typedef enum TirtcLogLevel {
|
|
13
|
+
TIRTC_LOG_LEVEL_VERBOSE = 0,
|
|
14
|
+
TIRTC_LOG_LEVEL_DEBUG,
|
|
15
|
+
TIRTC_LOG_LEVEL_INFO,
|
|
16
|
+
TIRTC_LOG_LEVEL_WARN,
|
|
17
|
+
TIRTC_LOG_LEVEL_ERROR,
|
|
18
|
+
TIRTC_LOG_LEVEL_FATAL,
|
|
19
|
+
} TirtcLogLevel;
|
|
20
|
+
|
|
21
|
+
typedef void (*TirtcLoggingPrintFunction)(const char* prefix, TirtcLogLevel level, const char* tag,
|
|
22
|
+
const char* fmt, va_list args);
|
|
23
|
+
|
|
24
|
+
#define TIRTC_LOG_PREFIX_DEFAULT "TIRTC"
|
|
25
|
+
|
|
26
|
+
TirtcError tirtc_logging_set_print_function(TirtcLoggingPrintFunction function);
|
|
27
|
+
TirtcError tirtc_logging_set_level(TirtcLogLevel level);
|
|
28
|
+
|
|
29
|
+
TirtcError tirtc_logging_initialize(const char* root_dir);
|
|
30
|
+
TirtcError tirtc_logging_write(TirtcLogLevel level, const char* tag, const char* message);
|
|
31
|
+
TirtcError tirtc_logging_print(const char* prefix, TirtcLogLevel level, const char* tag,
|
|
32
|
+
const char* fmt, ...);
|
|
33
|
+
TirtcError tirtc_logging_flush(void);
|
|
34
|
+
TirtcError tirtc_logging_export(const char* output_zip_path);
|
|
35
|
+
|
|
36
|
+
#define TIRTC_LOGV(tag, fmt, ...) \
|
|
37
|
+
tirtc_logging_print(TIRTC_LOG_PREFIX_DEFAULT, TIRTC_LOG_LEVEL_VERBOSE, tag, fmt, ##__VA_ARGS__)
|
|
38
|
+
#define TIRTC_LOGD(tag, fmt, ...) \
|
|
39
|
+
tirtc_logging_print(TIRTC_LOG_PREFIX_DEFAULT, TIRTC_LOG_LEVEL_DEBUG, tag, fmt, ##__VA_ARGS__)
|
|
40
|
+
#define TIRTC_LOGI(tag, fmt, ...) \
|
|
41
|
+
tirtc_logging_print(TIRTC_LOG_PREFIX_DEFAULT, TIRTC_LOG_LEVEL_INFO, tag, fmt, ##__VA_ARGS__)
|
|
42
|
+
#define TIRTC_LOGW(tag, fmt, ...) \
|
|
43
|
+
tirtc_logging_print(TIRTC_LOG_PREFIX_DEFAULT, TIRTC_LOG_LEVEL_WARN, tag, fmt, ##__VA_ARGS__)
|
|
44
|
+
#define TIRTC_LOGE(tag, fmt, ...) \
|
|
45
|
+
tirtc_logging_print(TIRTC_LOG_PREFIX_DEFAULT, TIRTC_LOG_LEVEL_ERROR, tag, fmt, ##__VA_ARGS__)
|
|
46
|
+
#define TIRTC_LOGF(tag, fmt, ...) \
|
|
47
|
+
tirtc_logging_print(TIRTC_LOG_PREFIX_DEFAULT, TIRTC_LOG_LEVEL_FATAL, tag, fmt, ##__VA_ARGS__)
|
|
48
|
+
|
|
49
|
+
#ifdef __cplusplus
|
|
50
|
+
}
|
|
51
|
+
#endif
|
|
52
|
+
|
|
53
|
+
#endif // TIRTC_FOUNDATION_LOGGING_H_
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#ifndef TIRTC_MEDIA_CONTRACT_MEDIA_CODEC_H_
|
|
2
|
+
#define TIRTC_MEDIA_CONTRACT_MEDIA_CODEC_H_
|
|
3
|
+
|
|
4
|
+
#ifdef __cplusplus
|
|
5
|
+
extern "C" {
|
|
6
|
+
#endif
|
|
7
|
+
|
|
8
|
+
typedef enum TirtcMediaCodec {
|
|
9
|
+
TIRTC_MEDIA_CODEC_NONE = 0,
|
|
10
|
+
TIRTC_MEDIA_CODEC_AUDIO_G711A = 1,
|
|
11
|
+
/* Reserved shared identifiers; concrete video implementations live outside media-contract. */
|
|
12
|
+
TIRTC_MEDIA_CODEC_VIDEO_H264 = 65,
|
|
13
|
+
TIRTC_MEDIA_CODEC_VIDEO_H265 = 66,
|
|
14
|
+
TIRTC_MEDIA_CODEC_VIDEO_MJPEG = 67,
|
|
15
|
+
} TirtcMediaCodec;
|
|
16
|
+
|
|
17
|
+
#ifdef __cplusplus
|
|
18
|
+
}
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
#endif // TIRTC_MEDIA_CONTRACT_MEDIA_CODEC_H_
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#ifndef TIRTC_MEDIA_DOWNLINK_H_
|
|
2
|
+
#define TIRTC_MEDIA_DOWNLINK_H_
|
|
3
|
+
|
|
4
|
+
#include <stdint.h>
|
|
5
|
+
|
|
6
|
+
#include "tirtc/audio_frame.h"
|
|
7
|
+
#include "tirtc/audio_io.h"
|
|
8
|
+
#include "tirtc/error.h"
|
|
9
|
+
#include "tirtc/video_frame.h"
|
|
10
|
+
#include "tirtc/video_io.h"
|
|
11
|
+
|
|
12
|
+
#ifdef __cplusplus
|
|
13
|
+
extern "C" {
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
typedef struct TirtcMediaDownlinkAudio TirtcMediaDownlinkAudio;
|
|
17
|
+
typedef struct TirtcMediaDownlinkVideo TirtcMediaDownlinkVideo;
|
|
18
|
+
|
|
19
|
+
typedef enum TirtcMediaDownlinkState {
|
|
20
|
+
TIRTC_MEDIA_DOWNLINK_STATE_IDLE = 0,
|
|
21
|
+
TIRTC_MEDIA_DOWNLINK_STATE_RENDERING = 1,
|
|
22
|
+
TIRTC_MEDIA_DOWNLINK_STATE_BUFFERING = 2,
|
|
23
|
+
TIRTC_MEDIA_DOWNLINK_STATE_PAUSED = 3,
|
|
24
|
+
TIRTC_MEDIA_DOWNLINK_STATE_COMPLETED = 4,
|
|
25
|
+
TIRTC_MEDIA_DOWNLINK_STATE_FAILED = 5,
|
|
26
|
+
} TirtcMediaDownlinkState;
|
|
27
|
+
|
|
28
|
+
typedef struct TirtcMediaDownlinkAudioOptions {
|
|
29
|
+
uint32_t volume_percent;
|
|
30
|
+
int gain_level;
|
|
31
|
+
int noise_reduction_level;
|
|
32
|
+
} TirtcMediaDownlinkAudioOptions;
|
|
33
|
+
|
|
34
|
+
typedef struct TirtcMediaDownlinkAudioObserver {
|
|
35
|
+
void (*on_state_changed)(TirtcMediaDownlinkAudio* downlink, TirtcMediaDownlinkState state,
|
|
36
|
+
TirtcError error, void* user_data);
|
|
37
|
+
} TirtcMediaDownlinkAudioObserver;
|
|
38
|
+
|
|
39
|
+
typedef struct TirtcMediaDownlinkVideoObserver {
|
|
40
|
+
void (*on_state_changed)(TirtcMediaDownlinkVideo* downlink, TirtcMediaDownlinkState state,
|
|
41
|
+
TirtcError error, void* user_data);
|
|
42
|
+
void (*on_output_size_changed)(TirtcMediaDownlinkVideo* downlink, uint32_t width, uint32_t height,
|
|
43
|
+
void* user_data);
|
|
44
|
+
} TirtcMediaDownlinkVideoObserver;
|
|
45
|
+
|
|
46
|
+
TirtcError tirtc_media_downlink_audio_create(TirtcMediaDownlinkAudio** out_downlink);
|
|
47
|
+
void tirtc_media_downlink_audio_destroy(TirtcMediaDownlinkAudio* downlink);
|
|
48
|
+
TirtcError tirtc_media_downlink_audio_set_aout(TirtcMediaDownlinkAudio* downlink,
|
|
49
|
+
TirtcAudioAout* aout);
|
|
50
|
+
TirtcError tirtc_media_downlink_audio_set_options(TirtcMediaDownlinkAudio* downlink,
|
|
51
|
+
const TirtcMediaDownlinkAudioOptions* options);
|
|
52
|
+
TirtcError tirtc_media_downlink_audio_set_observer(TirtcMediaDownlinkAudio* downlink,
|
|
53
|
+
const TirtcMediaDownlinkAudioObserver* observer,
|
|
54
|
+
void* user_data);
|
|
55
|
+
TirtcError tirtc_media_downlink_audio_clear_observer(TirtcMediaDownlinkAudio* downlink);
|
|
56
|
+
TirtcError tirtc_media_downlink_audio_submit_frame(TirtcMediaDownlinkAudio* downlink,
|
|
57
|
+
const TirtcAudioEncodedFrame* frame);
|
|
58
|
+
TirtcError tirtc_media_downlink_audio_get_current_pts(TirtcMediaDownlinkAudio* downlink,
|
|
59
|
+
int64_t* out_pts_us);
|
|
60
|
+
TirtcError tirtc_media_downlink_audio_start(TirtcMediaDownlinkAudio* downlink);
|
|
61
|
+
TirtcError tirtc_media_downlink_audio_stop(TirtcMediaDownlinkAudio* downlink);
|
|
62
|
+
|
|
63
|
+
TirtcError tirtc_media_downlink_video_create(TirtcMediaDownlinkVideo** out_downlink);
|
|
64
|
+
void tirtc_media_downlink_video_destroy(TirtcMediaDownlinkVideo* downlink);
|
|
65
|
+
TirtcError tirtc_media_downlink_video_set_vout(TirtcMediaDownlinkVideo* downlink,
|
|
66
|
+
TirtcVideoVout* vout);
|
|
67
|
+
TirtcError tirtc_media_downlink_video_set_observer(TirtcMediaDownlinkVideo* downlink,
|
|
68
|
+
const TirtcMediaDownlinkVideoObserver* observer,
|
|
69
|
+
void* user_data);
|
|
70
|
+
TirtcError tirtc_media_downlink_video_clear_observer(TirtcMediaDownlinkVideo* downlink);
|
|
71
|
+
TirtcError tirtc_media_downlink_video_submit_frame(TirtcMediaDownlinkVideo* downlink,
|
|
72
|
+
const TirtcVideoEncodedFrame* frame);
|
|
73
|
+
TirtcError tirtc_media_downlink_video_get_current_pts(TirtcMediaDownlinkVideo* downlink,
|
|
74
|
+
int64_t* out_pts_us);
|
|
75
|
+
TirtcError tirtc_media_downlink_video_get_output_size(TirtcMediaDownlinkVideo* downlink,
|
|
76
|
+
uint32_t* out_width, uint32_t* out_height);
|
|
77
|
+
TirtcError tirtc_media_downlink_video_follow_audio(TirtcMediaDownlinkVideo* follower,
|
|
78
|
+
TirtcMediaDownlinkAudio* source);
|
|
79
|
+
TirtcError tirtc_media_downlink_video_follow_video(TirtcMediaDownlinkVideo* follower,
|
|
80
|
+
TirtcMediaDownlinkVideo* source);
|
|
81
|
+
TirtcError tirtc_media_downlink_video_use_self_timing(TirtcMediaDownlinkVideo* downlink);
|
|
82
|
+
TirtcError tirtc_media_downlink_video_start(TirtcMediaDownlinkVideo* downlink);
|
|
83
|
+
TirtcError tirtc_media_downlink_video_stop(TirtcMediaDownlinkVideo* downlink);
|
|
84
|
+
|
|
85
|
+
#ifdef __cplusplus
|
|
86
|
+
}
|
|
87
|
+
#endif
|
|
88
|
+
|
|
89
|
+
#endif // TIRTC_MEDIA_DOWNLINK_H_
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
#ifndef TIRTC_MEDIA_UPLINK_H_
|
|
2
|
+
#define TIRTC_MEDIA_UPLINK_H_
|
|
3
|
+
|
|
4
|
+
#include <stdint.h>
|
|
5
|
+
|
|
6
|
+
#include "tirtc/audio_frame.h"
|
|
7
|
+
#include "tirtc/audio_io.h"
|
|
8
|
+
#include "tirtc/audio_processing.h"
|
|
9
|
+
#include "tirtc/error.h"
|
|
10
|
+
#include "tirtc/media_codec.h"
|
|
11
|
+
#include "tirtc/video_frame.h"
|
|
12
|
+
#include "tirtc/video_io.h"
|
|
13
|
+
|
|
14
|
+
#ifdef __cplusplus
|
|
15
|
+
extern "C" {
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
typedef struct TirtcMediaUplinkPtsSource TirtcMediaUplinkPtsSource;
|
|
19
|
+
typedef struct TirtcMediaUplinkAudio TirtcMediaUplinkAudio;
|
|
20
|
+
typedef struct TirtcMediaUplinkVideo TirtcMediaUplinkVideo;
|
|
21
|
+
|
|
22
|
+
typedef enum TirtcMediaUplinkState {
|
|
23
|
+
TIRTC_MEDIA_UPLINK_STATE_IDLE = 0,
|
|
24
|
+
TIRTC_MEDIA_UPLINK_STATE_RUNNING = 1,
|
|
25
|
+
TIRTC_MEDIA_UPLINK_STATE_PAUSED = 2,
|
|
26
|
+
TIRTC_MEDIA_UPLINK_STATE_STOPPED = 3,
|
|
27
|
+
TIRTC_MEDIA_UPLINK_STATE_FAILED = 4,
|
|
28
|
+
} TirtcMediaUplinkState;
|
|
29
|
+
|
|
30
|
+
typedef struct TirtcMediaUplinkAudioOptions {
|
|
31
|
+
TirtcAudioSampleRate sample_rate;
|
|
32
|
+
TirtcAudioAecMode aec_mode;
|
|
33
|
+
TirtcAudioAgcLevel agc_level;
|
|
34
|
+
TirtcAudioAnsLevel ans_level;
|
|
35
|
+
} TirtcMediaUplinkAudioOptions;
|
|
36
|
+
|
|
37
|
+
typedef struct TirtcMediaUplinkVideoOptions {
|
|
38
|
+
TirtcMediaCodec codec;
|
|
39
|
+
uint32_t width;
|
|
40
|
+
uint32_t height;
|
|
41
|
+
uint32_t fps;
|
|
42
|
+
uint32_t bitrate_kbps;
|
|
43
|
+
} TirtcMediaUplinkVideoOptions;
|
|
44
|
+
|
|
45
|
+
typedef struct TirtcMediaUplinkAudioSink {
|
|
46
|
+
void (*on_encoded_frame)(TirtcMediaUplinkAudio* uplink, const TirtcAudioEncodedFrame* frame,
|
|
47
|
+
void* user_data);
|
|
48
|
+
} TirtcMediaUplinkAudioSink;
|
|
49
|
+
|
|
50
|
+
typedef struct TirtcMediaUplinkVideoSink {
|
|
51
|
+
void (*on_encoded_frame)(TirtcMediaUplinkVideo* uplink, const TirtcVideoEncodedFrame* frame,
|
|
52
|
+
void* user_data);
|
|
53
|
+
} TirtcMediaUplinkVideoSink;
|
|
54
|
+
|
|
55
|
+
typedef struct TirtcMediaUplinkAudioObserver {
|
|
56
|
+
void (*on_state_changed)(TirtcMediaUplinkAudio* uplink, TirtcMediaUplinkState state,
|
|
57
|
+
TirtcError error, void* user_data);
|
|
58
|
+
} TirtcMediaUplinkAudioObserver;
|
|
59
|
+
|
|
60
|
+
typedef struct TirtcMediaUplinkVideoObserver {
|
|
61
|
+
void (*on_state_changed)(TirtcMediaUplinkVideo* uplink, TirtcMediaUplinkState state,
|
|
62
|
+
TirtcError error, void* user_data);
|
|
63
|
+
void (*on_output_size_changed)(TirtcMediaUplinkVideo* uplink, uint32_t width, uint32_t height,
|
|
64
|
+
void* user_data);
|
|
65
|
+
} TirtcMediaUplinkVideoObserver;
|
|
66
|
+
|
|
67
|
+
TirtcError tirtc_media_uplink_pts_source_create(TirtcMediaUplinkPtsSource** out_pts_source);
|
|
68
|
+
void tirtc_media_uplink_pts_source_destroy(TirtcMediaUplinkPtsSource* pts_source);
|
|
69
|
+
|
|
70
|
+
TirtcError tirtc_media_uplink_audio_create(TirtcMediaUplinkAudio** out_uplink);
|
|
71
|
+
void tirtc_media_uplink_audio_destroy(TirtcMediaUplinkAudio* uplink);
|
|
72
|
+
TirtcError tirtc_media_uplink_audio_set_pts_source(TirtcMediaUplinkAudio* uplink,
|
|
73
|
+
TirtcMediaUplinkPtsSource* pts_source);
|
|
74
|
+
TirtcError tirtc_media_uplink_audio_set_ain(TirtcMediaUplinkAudio* uplink, TirtcAudioAin* ain);
|
|
75
|
+
TirtcError tirtc_media_uplink_audio_set_options(TirtcMediaUplinkAudio* uplink,
|
|
76
|
+
const TirtcMediaUplinkAudioOptions* options);
|
|
77
|
+
TirtcError tirtc_media_uplink_audio_set_sink(TirtcMediaUplinkAudio* uplink,
|
|
78
|
+
const TirtcMediaUplinkAudioSink* sink,
|
|
79
|
+
void* user_data);
|
|
80
|
+
TirtcError tirtc_media_uplink_audio_clear_sink(TirtcMediaUplinkAudio* uplink);
|
|
81
|
+
TirtcError tirtc_media_uplink_audio_set_observer(TirtcMediaUplinkAudio* uplink,
|
|
82
|
+
const TirtcMediaUplinkAudioObserver* observer,
|
|
83
|
+
void* user_data);
|
|
84
|
+
TirtcError tirtc_media_uplink_audio_clear_observer(TirtcMediaUplinkAudio* uplink);
|
|
85
|
+
TirtcError tirtc_media_uplink_audio_start(TirtcMediaUplinkAudio* uplink);
|
|
86
|
+
TirtcError tirtc_media_uplink_audio_stop(TirtcMediaUplinkAudio* uplink);
|
|
87
|
+
|
|
88
|
+
TirtcError tirtc_media_uplink_video_create(TirtcMediaUplinkVideo** out_uplink);
|
|
89
|
+
void tirtc_media_uplink_video_destroy(TirtcMediaUplinkVideo* uplink);
|
|
90
|
+
TirtcError tirtc_media_uplink_video_set_pts_source(TirtcMediaUplinkVideo* uplink,
|
|
91
|
+
TirtcMediaUplinkPtsSource* pts_source);
|
|
92
|
+
TirtcError tirtc_media_uplink_video_set_vin(TirtcMediaUplinkVideo* uplink, TirtcVideoVin* vin);
|
|
93
|
+
TirtcError tirtc_media_uplink_video_set_options(TirtcMediaUplinkVideo* uplink,
|
|
94
|
+
const TirtcMediaUplinkVideoOptions* options);
|
|
95
|
+
TirtcError tirtc_media_uplink_video_set_sink(TirtcMediaUplinkVideo* uplink,
|
|
96
|
+
const TirtcMediaUplinkVideoSink* sink,
|
|
97
|
+
void* user_data);
|
|
98
|
+
TirtcError tirtc_media_uplink_video_clear_sink(TirtcMediaUplinkVideo* uplink);
|
|
99
|
+
TirtcError tirtc_media_uplink_video_set_observer(TirtcMediaUplinkVideo* uplink,
|
|
100
|
+
const TirtcMediaUplinkVideoObserver* observer,
|
|
101
|
+
void* user_data);
|
|
102
|
+
TirtcError tirtc_media_uplink_video_clear_observer(TirtcMediaUplinkVideo* uplink);
|
|
103
|
+
TirtcError tirtc_media_uplink_video_set_preview_vout(TirtcMediaUplinkVideo* uplink,
|
|
104
|
+
TirtcVideoVout* vout);
|
|
105
|
+
TirtcError tirtc_media_uplink_video_clear_preview_vout(TirtcMediaUplinkVideo* uplink);
|
|
106
|
+
TirtcError tirtc_media_uplink_video_get_output_size(TirtcMediaUplinkVideo* uplink,
|
|
107
|
+
uint32_t* out_width, uint32_t* out_height);
|
|
108
|
+
TirtcError tirtc_media_uplink_video_start(TirtcMediaUplinkVideo* uplink);
|
|
109
|
+
TirtcError tirtc_media_uplink_video_stop(TirtcMediaUplinkVideo* uplink);
|
|
110
|
+
|
|
111
|
+
#ifdef __cplusplus
|
|
112
|
+
}
|
|
113
|
+
#endif
|
|
114
|
+
|
|
115
|
+
#endif // TIRTC_MEDIA_UPLINK_H_
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
#ifndef TIRTC_FACADE_RUNTIME_H_
|
|
2
|
+
#define TIRTC_FACADE_RUNTIME_H_
|
|
3
|
+
|
|
4
|
+
#include <stddef.h>
|
|
5
|
+
#include <stdint.h>
|
|
6
|
+
|
|
7
|
+
#include "tirtc/audio_io.h"
|
|
8
|
+
#include "tirtc/audio_processing.h"
|
|
9
|
+
#include "tirtc/error.h"
|
|
10
|
+
#include "tirtc/media_codec.h"
|
|
11
|
+
#include "tirtc/video_io.h"
|
|
12
|
+
|
|
13
|
+
#ifdef __cplusplus
|
|
14
|
+
extern "C" {
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
typedef struct TirtcOptions {
|
|
18
|
+
const char* endpoint;
|
|
19
|
+
} TirtcOptions;
|
|
20
|
+
|
|
21
|
+
typedef struct TirtcConnServiceStartOptions {
|
|
22
|
+
const char* license;
|
|
23
|
+
} TirtcConnServiceStartOptions;
|
|
24
|
+
|
|
25
|
+
typedef struct TirtcConnOptions {
|
|
26
|
+
const char* peer_id;
|
|
27
|
+
const char* token;
|
|
28
|
+
} TirtcConnOptions;
|
|
29
|
+
|
|
30
|
+
typedef struct TirtcConnService TirtcConnService;
|
|
31
|
+
typedef struct TirtcConn TirtcConn;
|
|
32
|
+
typedef struct TirtcAudioInput TirtcAudioInput;
|
|
33
|
+
typedef struct TirtcAudioOutput TirtcAudioOutput;
|
|
34
|
+
typedef struct TirtcVideoInput TirtcVideoInput;
|
|
35
|
+
typedef struct TirtcVideoOutput TirtcVideoOutput;
|
|
36
|
+
|
|
37
|
+
typedef enum TirtcConnState {
|
|
38
|
+
TIRTC_CONN_STATE_CONNECTING = 1,
|
|
39
|
+
TIRTC_CONN_STATE_CONNECTED = 2,
|
|
40
|
+
TIRTC_CONN_STATE_DISCONNECTED = 3,
|
|
41
|
+
} TirtcConnState;
|
|
42
|
+
|
|
43
|
+
typedef enum TirtcConnDisconnectReason {
|
|
44
|
+
TIRTC_CONN_DISCONNECT_REASON_UNKNOWN = 0,
|
|
45
|
+
TIRTC_CONN_DISCONNECT_REASON_LOCAL_CLOSED = 1,
|
|
46
|
+
TIRTC_CONN_DISCONNECT_REASON_REMOTE_CLOSED = 2,
|
|
47
|
+
TIRTC_CONN_DISCONNECT_REASON_CONNECT_FAILED = 3,
|
|
48
|
+
TIRTC_CONN_DISCONNECT_REASON_INVALID_DESCRIPTOR = 4,
|
|
49
|
+
TIRTC_CONN_DISCONNECT_REASON_BACKEND_ERROR = 5,
|
|
50
|
+
} TirtcConnDisconnectReason;
|
|
51
|
+
|
|
52
|
+
typedef enum TirtcInputState {
|
|
53
|
+
TIRTC_INPUT_STATE_IDLE = 0,
|
|
54
|
+
TIRTC_INPUT_STATE_RUNNING = 1,
|
|
55
|
+
TIRTC_INPUT_STATE_PAUSED = 2,
|
|
56
|
+
TIRTC_INPUT_STATE_STOPPED = 3,
|
|
57
|
+
TIRTC_INPUT_STATE_FAILED = 4,
|
|
58
|
+
} TirtcInputState;
|
|
59
|
+
|
|
60
|
+
typedef enum TirtcAudioOutputState {
|
|
61
|
+
TIRTC_AUDIO_OUTPUT_STATE_IDLE = 0,
|
|
62
|
+
TIRTC_AUDIO_OUTPUT_STATE_PLAYING = 1,
|
|
63
|
+
TIRTC_AUDIO_OUTPUT_STATE_BUFFERING = 2,
|
|
64
|
+
TIRTC_AUDIO_OUTPUT_STATE_PAUSED = 3,
|
|
65
|
+
TIRTC_AUDIO_OUTPUT_STATE_COMPLETED = 4,
|
|
66
|
+
TIRTC_AUDIO_OUTPUT_STATE_FAILED = 5,
|
|
67
|
+
} TirtcAudioOutputState;
|
|
68
|
+
|
|
69
|
+
typedef enum TirtcVideoOutputState {
|
|
70
|
+
TIRTC_VIDEO_OUTPUT_STATE_IDLE = 0,
|
|
71
|
+
TIRTC_VIDEO_OUTPUT_STATE_RENDERING = 1,
|
|
72
|
+
TIRTC_VIDEO_OUTPUT_STATE_BUFFERING = 2,
|
|
73
|
+
TIRTC_VIDEO_OUTPUT_STATE_PAUSED = 3,
|
|
74
|
+
TIRTC_VIDEO_OUTPUT_STATE_COMPLETED = 4,
|
|
75
|
+
TIRTC_VIDEO_OUTPUT_STATE_FAILED = 5,
|
|
76
|
+
} TirtcVideoOutputState;
|
|
77
|
+
|
|
78
|
+
typedef struct TirtcStreamMessage {
|
|
79
|
+
uint32_t timestamp_ms;
|
|
80
|
+
const void* data;
|
|
81
|
+
size_t length;
|
|
82
|
+
} TirtcStreamMessage;
|
|
83
|
+
|
|
84
|
+
typedef struct TirtcCommand {
|
|
85
|
+
uint16_t sequence_number;
|
|
86
|
+
uint16_t command_id;
|
|
87
|
+
uint8_t is_response;
|
|
88
|
+
const void* data;
|
|
89
|
+
size_t length;
|
|
90
|
+
} TirtcCommand;
|
|
91
|
+
|
|
92
|
+
typedef struct TirtcConnServiceObserver {
|
|
93
|
+
void (*on_started)(TirtcConnService* service, void* user_data);
|
|
94
|
+
void (*on_stopped)(TirtcConnService* service, void* user_data);
|
|
95
|
+
void (*on_connected)(TirtcConnService* service, TirtcConn* connection, void* user_data);
|
|
96
|
+
void (*on_error)(TirtcConnService* service, TirtcError error, const char* message,
|
|
97
|
+
void* user_data);
|
|
98
|
+
} TirtcConnServiceObserver;
|
|
99
|
+
|
|
100
|
+
typedef struct TirtcConnObserver {
|
|
101
|
+
void (*on_state_changed)(TirtcConn* connection, TirtcConnState state, void* user_data);
|
|
102
|
+
void (*on_disconnected)(TirtcConn* connection, TirtcConnDisconnectReason reason, void* user_data);
|
|
103
|
+
void (*on_stream_message)(TirtcConn* connection, uint8_t stream_id,
|
|
104
|
+
const TirtcStreamMessage* message, void* user_data);
|
|
105
|
+
void (*on_command)(TirtcConn* connection, const TirtcCommand* command, void* user_data);
|
|
106
|
+
void (*on_error)(TirtcConn* connection, TirtcError error, const char* message, void* user_data);
|
|
107
|
+
void (*on_request_iframe)(TirtcConn* connection, uint8_t stream_id, void* user_data);
|
|
108
|
+
int (*on_request_video)(TirtcConn* connection, uint8_t stream_id, void* user_data);
|
|
109
|
+
void (*on_release_video)(TirtcConn* connection, uint8_t stream_id, void* user_data);
|
|
110
|
+
int (*on_request_audio)(TirtcConn* connection, uint8_t stream_id, void* user_data);
|
|
111
|
+
void (*on_release_audio)(TirtcConn* connection, uint8_t stream_id, void* user_data);
|
|
112
|
+
} TirtcConnObserver;
|
|
113
|
+
|
|
114
|
+
typedef struct TirtcAudioInputOptions {
|
|
115
|
+
TirtcAudioSampleRate sample_rate;
|
|
116
|
+
TirtcAudioAecMode aec_mode;
|
|
117
|
+
TirtcAudioAgcLevel agc_level;
|
|
118
|
+
TirtcAudioAnsLevel ans_level;
|
|
119
|
+
} TirtcAudioInputOptions;
|
|
120
|
+
|
|
121
|
+
typedef struct TirtcAudioOutputOptions {
|
|
122
|
+
uint32_t volume_percent;
|
|
123
|
+
int gain_level;
|
|
124
|
+
int noise_reduction_level;
|
|
125
|
+
} TirtcAudioOutputOptions;
|
|
126
|
+
|
|
127
|
+
typedef struct TirtcVideoInputOptions {
|
|
128
|
+
TirtcMediaCodec codec;
|
|
129
|
+
uint32_t width;
|
|
130
|
+
uint32_t height;
|
|
131
|
+
uint32_t fps;
|
|
132
|
+
uint32_t bitrate_kbps;
|
|
133
|
+
} TirtcVideoInputOptions;
|
|
134
|
+
|
|
135
|
+
typedef struct TirtcAudioInputObserver {
|
|
136
|
+
void (*on_state_changed)(TirtcAudioInput* input, TirtcInputState state, TirtcError error,
|
|
137
|
+
void* user_data);
|
|
138
|
+
} TirtcAudioInputObserver;
|
|
139
|
+
|
|
140
|
+
typedef struct TirtcVideoInputObserver {
|
|
141
|
+
void (*on_state_changed)(TirtcVideoInput* input, TirtcInputState state, TirtcError error,
|
|
142
|
+
void* user_data);
|
|
143
|
+
void (*on_output_size_changed)(TirtcVideoInput* input, uint32_t width, uint32_t height,
|
|
144
|
+
void* user_data);
|
|
145
|
+
} TirtcVideoInputObserver;
|
|
146
|
+
|
|
147
|
+
typedef struct TirtcAudioOutputObserver {
|
|
148
|
+
void (*on_state_changed)(TirtcAudioOutput* output, TirtcAudioOutputState state, TirtcError error,
|
|
149
|
+
void* user_data);
|
|
150
|
+
} TirtcAudioOutputObserver;
|
|
151
|
+
|
|
152
|
+
typedef struct TirtcVideoOutputObserver {
|
|
153
|
+
void (*on_state_changed)(TirtcVideoOutput* output, TirtcVideoOutputState state, TirtcError error,
|
|
154
|
+
void* user_data);
|
|
155
|
+
void (*on_output_size_changed)(TirtcVideoOutput* output, uint32_t width, uint32_t height,
|
|
156
|
+
void* user_data);
|
|
157
|
+
} TirtcVideoOutputObserver;
|
|
158
|
+
|
|
159
|
+
TirtcError tirtc_init(const TirtcOptions* options);
|
|
160
|
+
void tirtc_uninit(void);
|
|
161
|
+
|
|
162
|
+
TirtcError tirtc_conn_service_start(const TirtcConnServiceStartOptions* options,
|
|
163
|
+
const TirtcConnServiceObserver* observer, void* user_data,
|
|
164
|
+
TirtcConnService** out_service);
|
|
165
|
+
TirtcError tirtc_conn_service_stop(TirtcConnService* service);
|
|
166
|
+
|
|
167
|
+
TirtcError tirtc_connect(const TirtcConnOptions* options, TirtcConn** out_connection);
|
|
168
|
+
TirtcError tirtc_conn_set_observer(TirtcConn* connection, const TirtcConnObserver* observer,
|
|
169
|
+
void* user_data);
|
|
170
|
+
TirtcError tirtc_disconnect(TirtcConn* connection);
|
|
171
|
+
void tirtc_conn_destroy(TirtcConn* connection);
|
|
172
|
+
|
|
173
|
+
TirtcError tirtc_send_stream_message(TirtcConn* connection, uint8_t stream_id,
|
|
174
|
+
const TirtcStreamMessage* message);
|
|
175
|
+
TirtcError tirtc_send_command(TirtcConn* connection, const TirtcCommand* command);
|
|
176
|
+
TirtcError tirtc_conn_request_iframe(TirtcConn* connection, uint8_t stream_id);
|
|
177
|
+
TirtcError tirtc_conn_request_video(TirtcConn* connection, uint8_t stream_id);
|
|
178
|
+
TirtcError tirtc_conn_release_video(TirtcConn* connection, uint8_t stream_id);
|
|
179
|
+
TirtcError tirtc_conn_request_audio(TirtcConn* connection, uint8_t stream_id);
|
|
180
|
+
TirtcError tirtc_conn_release_audio(TirtcConn* connection, uint8_t stream_id);
|
|
181
|
+
|
|
182
|
+
TirtcError tirtc_conn_bind_audio_input(TirtcConn* connection, uint8_t stream_id,
|
|
183
|
+
TirtcAudioInput* input);
|
|
184
|
+
TirtcError tirtc_conn_bind_audio_output(TirtcConn* connection, TirtcAudioOutput* output);
|
|
185
|
+
TirtcError tirtc_conn_bind_video_input(TirtcConn* connection, uint8_t stream_id,
|
|
186
|
+
TirtcVideoInput* input);
|
|
187
|
+
TirtcError tirtc_conn_bind_video_output(TirtcConn* connection, uint8_t stream_id,
|
|
188
|
+
TirtcVideoOutput* output);
|
|
189
|
+
TirtcError tirtc_conn_unbind_audio_input(TirtcConn* connection, uint8_t stream_id);
|
|
190
|
+
TirtcError tirtc_conn_unbind_audio_output(TirtcConn* connection);
|
|
191
|
+
TirtcError tirtc_conn_unbind_video_input(TirtcConn* connection, uint8_t stream_id);
|
|
192
|
+
TirtcError tirtc_conn_unbind_video_output(TirtcConn* connection, uint8_t stream_id);
|
|
193
|
+
|
|
194
|
+
TirtcError tirtc_audio_input_create(TirtcAudioInput** out_input);
|
|
195
|
+
void tirtc_audio_input_destroy(TirtcAudioInput* input);
|
|
196
|
+
TirtcError tirtc_audio_input_set_ain(TirtcAudioInput* input, TirtcAudioAin* ain);
|
|
197
|
+
TirtcError tirtc_audio_input_set_options(TirtcAudioInput* input,
|
|
198
|
+
const TirtcAudioInputOptions* options);
|
|
199
|
+
TirtcError tirtc_audio_input_set_observer(TirtcAudioInput* input,
|
|
200
|
+
const TirtcAudioInputObserver* observer, void* user_data);
|
|
201
|
+
TirtcError tirtc_audio_input_start(TirtcAudioInput* input);
|
|
202
|
+
TirtcError tirtc_audio_input_stop(TirtcAudioInput* input);
|
|
203
|
+
|
|
204
|
+
TirtcError tirtc_audio_output_create(TirtcAudioOutput** out_output);
|
|
205
|
+
void tirtc_audio_output_destroy(TirtcAudioOutput* output);
|
|
206
|
+
TirtcError tirtc_audio_output_set_aout(TirtcAudioOutput* output, TirtcAudioAout* aout);
|
|
207
|
+
TirtcError tirtc_audio_output_set_options(TirtcAudioOutput* output,
|
|
208
|
+
const TirtcAudioOutputOptions* options);
|
|
209
|
+
TirtcError tirtc_audio_output_set_observer(TirtcAudioOutput* output,
|
|
210
|
+
const TirtcAudioOutputObserver* observer,
|
|
211
|
+
void* user_data);
|
|
212
|
+
|
|
213
|
+
TirtcError tirtc_video_input_create(TirtcVideoInput** out_input);
|
|
214
|
+
void tirtc_video_input_destroy(TirtcVideoInput* input);
|
|
215
|
+
TirtcError tirtc_video_input_set_vin(TirtcVideoInput* input, TirtcVideoVin* vin);
|
|
216
|
+
TirtcError tirtc_video_input_set_options(TirtcVideoInput* input,
|
|
217
|
+
const TirtcVideoInputOptions* options);
|
|
218
|
+
TirtcError tirtc_video_input_set_observer(TirtcVideoInput* input,
|
|
219
|
+
const TirtcVideoInputObserver* observer, void* user_data);
|
|
220
|
+
TirtcError tirtc_video_input_set_preview_output(TirtcVideoInput* input, TirtcVideoOutput* output);
|
|
221
|
+
TirtcError tirtc_video_input_clear_preview_output(TirtcVideoInput* input);
|
|
222
|
+
TirtcError tirtc_video_input_start(TirtcVideoInput* input);
|
|
223
|
+
TirtcError tirtc_video_input_stop(TirtcVideoInput* input);
|
|
224
|
+
|
|
225
|
+
TirtcError tirtc_video_output_create(TirtcVideoOutput** out_output);
|
|
226
|
+
void tirtc_video_output_destroy(TirtcVideoOutput* output);
|
|
227
|
+
TirtcError tirtc_video_output_set_vout(TirtcVideoOutput* output, TirtcVideoVout* vout);
|
|
228
|
+
TirtcError tirtc_video_output_set_observer(TirtcVideoOutput* output,
|
|
229
|
+
const TirtcVideoOutputObserver* observer,
|
|
230
|
+
void* user_data);
|
|
231
|
+
|
|
232
|
+
#ifdef __cplusplus
|
|
233
|
+
}
|
|
234
|
+
#endif
|
|
235
|
+
|
|
236
|
+
#endif // TIRTC_FACADE_RUNTIME_H_
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#ifndef TIRTC_VIDEO_CODEC_H_
|
|
2
|
+
#define TIRTC_VIDEO_CODEC_H_
|
|
3
|
+
|
|
4
|
+
#include <stddef.h>
|
|
5
|
+
#include <stdint.h>
|
|
6
|
+
|
|
7
|
+
#include "tirtc/error.h"
|
|
8
|
+
#include "tirtc/video_frame.h"
|
|
9
|
+
|
|
10
|
+
#ifdef __cplusplus
|
|
11
|
+
extern "C" {
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
typedef struct TirtcVideoEncoder TirtcVideoEncoder;
|
|
15
|
+
typedef struct TirtcVideoDecoder TirtcVideoDecoder;
|
|
16
|
+
|
|
17
|
+
typedef struct TirtcVideoEncoderConfig {
|
|
18
|
+
TirtcMediaCodec codec;
|
|
19
|
+
TirtcVideoBitstreamFormat bitstream_format;
|
|
20
|
+
uint32_t width;
|
|
21
|
+
uint32_t height;
|
|
22
|
+
uint32_t fps;
|
|
23
|
+
uint32_t bitrate_kbps;
|
|
24
|
+
TirtcVideoPixelFormat input_pixel_format;
|
|
25
|
+
} TirtcVideoEncoderConfig;
|
|
26
|
+
|
|
27
|
+
typedef struct TirtcVideoDecoderConfig {
|
|
28
|
+
TirtcMediaCodec codec;
|
|
29
|
+
TirtcVideoBitstreamFormat bitstream_format;
|
|
30
|
+
TirtcVideoPixelFormat output_pixel_format;
|
|
31
|
+
} TirtcVideoDecoderConfig;
|
|
32
|
+
|
|
33
|
+
TirtcError tirtc_video_encoder_create(const TirtcVideoEncoderConfig* config,
|
|
34
|
+
TirtcVideoEncoder** out_encoder);
|
|
35
|
+
void tirtc_video_encoder_destroy(TirtcVideoEncoder* encoder);
|
|
36
|
+
TirtcError tirtc_video_encoder_reset(TirtcVideoEncoder* encoder);
|
|
37
|
+
TirtcError tirtc_video_encoder_encode(TirtcVideoEncoder* encoder,
|
|
38
|
+
const TirtcVideoPixelFrame* in_frame, void* out_buffer,
|
|
39
|
+
size_t out_buffer_capacity,
|
|
40
|
+
TirtcVideoEncodedFrame* out_frame);
|
|
41
|
+
|
|
42
|
+
TirtcError tirtc_video_decoder_create(const TirtcVideoDecoderConfig* config,
|
|
43
|
+
TirtcVideoDecoder** out_decoder);
|
|
44
|
+
void tirtc_video_decoder_destroy(TirtcVideoDecoder* decoder);
|
|
45
|
+
TirtcError tirtc_video_decoder_reset(TirtcVideoDecoder* decoder);
|
|
46
|
+
TirtcError tirtc_video_decoder_decode(TirtcVideoDecoder* decoder,
|
|
47
|
+
const TirtcVideoEncodedFrame* in_frame,
|
|
48
|
+
TirtcVideoPixelFrame* out_frame);
|
|
49
|
+
|
|
50
|
+
TirtcError tirtc_video_snapshot_export_jpeg(const TirtcVideoPixelFrame* frame,
|
|
51
|
+
const char* output_path);
|
|
52
|
+
|
|
53
|
+
#ifdef __cplusplus
|
|
54
|
+
}
|
|
55
|
+
#endif
|
|
56
|
+
|
|
57
|
+
#endif // TIRTC_VIDEO_CODEC_H_
|