tirtc-devtools-cli 0.0.10 → 0.0.12

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.
Files changed (116) hide show
  1. package/README.md +17 -11
  2. package/USAGE.md +148 -41
  3. package/bin/tirtc-devtools-cli.js +1 -1
  4. package/dist/cli/src/bootstrap_flows.d.ts +46 -0
  5. package/dist/cli/src/bootstrap_flows.js +249 -0
  6. package/dist/{devtools/cli → cli}/src/config.d.ts +4 -15
  7. package/dist/{devtools/cli → cli}/src/config.js +8 -8
  8. package/dist/cli/src/default_paths.d.ts +3 -0
  9. package/dist/cli/src/default_paths.js +23 -0
  10. package/dist/{devtools/cli → cli}/src/embedded_paths.d.ts +1 -0
  11. package/dist/{devtools/cli → cli}/src/embedded_paths.js +18 -1
  12. package/dist/{devtools/cli → cli}/src/facade.d.ts +41 -235
  13. package/dist/{devtools/cli → cli}/src/facade.js +8 -27
  14. package/dist/cli/src/guide.js +47 -0
  15. package/dist/{devtools/cli → cli}/src/index.js +67 -153
  16. package/dist/{devtools/cli → cli}/src/session_manager.js +9 -11
  17. package/dist/{devtools/cli → cli}/src/token_command.js +80 -16
  18. package/dist/cli/src/token_tool.d.ts +55 -0
  19. package/dist/{devtools/cli → cli}/src/token_tool.js +143 -47
  20. package/dist/{devtools/cli → cli}/src/transport.d.ts +1 -1
  21. package/package.json +6 -2
  22. package/script/ensure_ffmpeg.sh +1 -1
  23. package/vendor/app-server/bin/native/linux-x64/credential_napi.node +0 -0
  24. package/vendor/app-server/bin/native/macos-arm64/credential_napi.node +0 -0
  25. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/credential.h +34 -0
  26. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/error.h +13 -0
  27. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/foundation/build_info.h +27 -0
  28. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/http.h +57 -0
  29. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/logging.h +3 -1
  30. package/vendor/app-server/bin/runtime/linux-x64/lib/libcrypto.a +0 -0
  31. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_credential.a +0 -0
  32. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_foundation_http.a +0 -0
  33. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_foundation_logging.a +0 -0
  34. package/vendor/app-server/bin/runtime/linux-x64/lib/libssl.a +0 -0
  35. package/vendor/app-server/bin/runtime/linux-x64/manifest.txt +2 -32
  36. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio.h +44 -305
  37. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/av.h +52 -372
  38. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/error.h +2 -0
  39. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_downlink.h +6 -0
  40. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/transport.h +58 -133
  41. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/trp.h +56 -511
  42. package/vendor/app-server/bin/runtime/macos-arm64/lib/libTGTRP.a +0 -0
  43. package/vendor/app-server/bin/runtime/macos-arm64/lib/libTiRTC.a +0 -0
  44. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_audio.a +0 -0
  45. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_credential.a +0 -0
  46. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_facade.a +0 -0
  47. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_foundation_http.a +0 -0
  48. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_foundation_logging.a +0 -0
  49. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_media.a +0 -0
  50. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_transport.a +0 -0
  51. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_video.a +0 -0
  52. package/vendor/app-server/bin/runtime/macos-arm64/manifest.txt +19 -15
  53. package/vendor/app-server/dist/host/HostCommandCoordinator.d.ts +19 -0
  54. package/vendor/app-server/dist/host/HostCommandCoordinator.js +196 -0
  55. package/vendor/app-server/dist/host/HostProtocol.d.ts +1 -11
  56. package/vendor/app-server/dist/host/HostProtocol.js +3 -37
  57. package/vendor/app-server/dist/host/HostServer.d.ts +1 -4
  58. package/vendor/app-server/dist/host/HostServer.js +16 -152
  59. package/vendor/app-server/dist/host/RuntimeAdapter.js +2 -2
  60. package/vendor/app-server/dist/host/native/RuntimeCredentialTokenIssuer.js +3 -3
  61. package/vendor/app-server/dist/host/native/RuntimeHostBridge.js +4 -4
  62. package/vendor/app-server/dist/host/runtime_backed_preflight.js +2 -2
  63. package/vendor/app-server/dist/host/tests/helpers/runtime_e2e_local_config.js +1 -1
  64. package/vendor/app-server/dist/protocol/contract.d.ts +5 -64
  65. package/vendor/app-server/dist/protocol/contract.js +3 -12
  66. package/dist/devtools/cli/src/guide.js +0 -50
  67. package/dist/devtools/cli/src/token_tool.d.ts +0 -38
  68. package/dist/dummy.d.ts +0 -0
  69. package/dist/dummy.js +0 -1
  70. package/dist/index.d.ts +0 -1
  71. package/dist/index.js +0 -48
  72. package/vendor/app-server/bin/native/macos-arm64/libcrypto.dylib +0 -0
  73. package/vendor/app-server/bin/native/macos-arm64/libssl.dylib +0 -0
  74. package/vendor/app-server/bin/native/macos-arm64/runtime_host_napi.node +0 -0
  75. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_codec.h +0 -23
  76. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_frame.h +0 -36
  77. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io.h +0 -56
  78. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_android.h +0 -19
  79. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_apple.h +0 -19
  80. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_harmony.h +0 -19
  81. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_windows.h +0 -19
  82. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_processing.h +0 -56
  83. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_sample_rate.h +0 -18
  84. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/media_codec.h +0 -21
  85. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/media_downlink.h +0 -89
  86. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/media_uplink.h +0 -115
  87. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/runtime.h +0 -236
  88. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_codec.h +0 -57
  89. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_frame.h +0 -55
  90. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io.h +0 -46
  91. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_android.h +0 -32
  92. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_apple.h +0 -34
  93. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_harmony.h +0 -32
  94. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_windows.h +0 -26
  95. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_processing.h +0 -34
  96. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_audio.a +0 -0
  97. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_facade.a +0 -0
  98. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_media.a +0 -0
  99. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_video.a +0 -0
  100. package/vendor/app-server/bin/runtime/linux-x64/lib/libwebrtc_apm.a +0 -0
  101. package/vendor/app-server/dist/host/RuntimeCredentialTokenIssuer.d.ts +0 -30
  102. package/vendor/app-server/dist/host/RuntimeCredentialTokenIssuer.js +0 -224
  103. /package/dist/{devtools/cli → cli}/src/dummy.d.ts +0 -0
  104. /package/dist/{devtools/cli → cli}/src/dummy.js +0 -0
  105. /package/dist/{devtools/cli → cli}/src/ffmpeg_tool.d.ts +0 -0
  106. /package/dist/{devtools/cli → cli}/src/ffmpeg_tool.js +0 -0
  107. /package/dist/{devtools/cli → cli}/src/guide.d.ts +0 -0
  108. /package/dist/{devtools/cli → cli}/src/index.d.ts +0 -0
  109. /package/dist/{devtools/cli → cli}/src/media_assets.d.ts +0 -0
  110. /package/dist/{devtools/cli → cli}/src/media_assets.js +0 -0
  111. /package/dist/{devtools/cli → cli}/src/progress.d.ts +0 -0
  112. /package/dist/{devtools/cli → cli}/src/progress.js +0 -0
  113. /package/dist/{devtools/cli → cli}/src/session_manager.d.ts +0 -0
  114. /package/dist/{devtools/cli → cli}/src/token_command.d.ts +0 -0
  115. /package/dist/{devtools/cli → cli}/src/transport.js +0 -0
  116. /package/vendor/app-server/bin/{native/macos-arm64 → runtime/macos-arm64/lib}/libtgrtc.dylib +0 -0
@@ -1,6 +1,8 @@
1
1
  #ifndef TIRTC_FACADE_AV_H_
2
2
  #define TIRTC_FACADE_AV_H_
3
3
 
4
+ #include <stdint.h>
5
+
4
6
  #include "tirtc/audio.h"
5
7
  #include "tirtc/media_codec.h"
6
8
  #include "tirtc/video_io.h"
@@ -9,446 +11,124 @@
9
11
  extern "C" {
10
12
  #endif
11
13
 
12
- /**
13
- * @file tirtc/av.h
14
- * @brief Audio-video facade layer built on top of `tirtc/audio.h`.
15
- *
16
- * This header adds local video input, remote video output, preview binding,
17
- * and video-specific control helpers to the transport-plus-audio facade.
18
- *
19
- * Typical uplink flow:
20
- * 1. Create a ::TirtcVideoInput.
21
- * 2. Bind a concrete capture backend with ::tirtc_video_input_set_vin.
22
- * 3. Optionally configure encoding options and observers.
23
- * 4. Optionally bind a preview output with
24
- * ::tirtc_video_input_set_preview_output.
25
- * 5. Start the input and attach it to a connection stream.
26
- * 6. Detach, stop, clear preview, and destroy the input during shutdown.
27
- *
28
- * Typical downlink flow:
29
- * 1. Create a ::TirtcVideoOutput.
30
- * 2. Bind a concrete render backend with ::tirtc_video_output_set_vout.
31
- * 3. Optionally install an observer.
32
- * 4. Attach the output to a connection stream.
33
- * 5. Detach and destroy the output during shutdown.
34
- *
35
- * Important exclusivity rule:
36
- * one ::TirtcVideoOutput can serve only one consumer at a time. It may be used
37
- * either as a local preview target for one ::TirtcVideoInput or as a remote
38
- * display target for one connection stream, but not both at once.
39
- *
40
- * Ownership model:
41
- * - The caller owns all video input and output handles.
42
- * - Attaching to a connection or binding a preview output is non-owning.
43
- * - Destroying a connection detaches remote-bound video objects but does not
44
- * destroy them.
45
- * - Destroying a video input clears its preview binding but does not destroy
46
- * the preview output object.
47
- */
48
-
49
- /** @brief Opaque video uplink handle. */
50
14
  typedef struct TirtcVideoInput TirtcVideoInput;
51
15
 
52
- /** @brief Opaque video downlink or preview output handle. */
53
16
  typedef struct TirtcVideoOutput TirtcVideoOutput;
54
17
 
55
- /**
56
- * @brief Video output state reported through ::TirtcVideoOutputObserver.
57
- */
58
18
  typedef enum TirtcVideoOutputState {
59
- /** Output is attached but not currently rendering frames. */
60
- TIRTC_VIDEO_OUTPUT_STATE_IDLE = 0,
61
19
 
62
- /** Output is actively rendering frames. */
63
- TIRTC_VIDEO_OUTPUT_STATE_RENDERING = 1,
64
-
65
- /** Output is waiting for frames or recovering from a transient failure. */
66
- TIRTC_VIDEO_OUTPUT_STATE_BUFFERING = 2,
20
+ TIRTC_VIDEO_OUTPUT_STATE_IDLE = 0,
67
21
 
68
- /** Reserved paused state. */
69
- TIRTC_VIDEO_OUTPUT_STATE_PAUSED = 3,
22
+ TIRTC_VIDEO_OUTPUT_STATE_BUFFERING = 1,
70
23
 
71
- /** Reserved completed state. */
72
- TIRTC_VIDEO_OUTPUT_STATE_COMPLETED = 4,
24
+ TIRTC_VIDEO_OUTPUT_STATE_RENDERING = 2,
73
25
 
74
- /** Output encountered repeated rendering failures. */
75
- TIRTC_VIDEO_OUTPUT_STATE_FAILED = 5,
26
+ TIRTC_VIDEO_OUTPUT_STATE_FAILED = 3,
76
27
  } TirtcVideoOutputState;
77
28
 
78
- /**
79
- * @brief Video input encoding options.
80
- *
81
- * These options are consumed when the internal video uplink pipeline is first
82
- * created. Configure them before the first successful start for predictable
83
- * behavior.
84
- */
85
29
  typedef struct TirtcVideoInputOptions {
86
- /**
87
- * @brief Encoded video codec.
88
- *
89
- * The current implementation defaults to ::TIRTC_MEDIA_CODEC_VIDEO_H264 when
90
- * this field is ::TIRTC_MEDIA_CODEC_NONE.
91
- */
92
30
  TirtcMediaCodec codec;
93
31
 
94
- /**
95
- * @brief Target encoded width in pixels.
96
- *
97
- * The current implementation defaults to 320 when this field is zero.
98
- */
99
32
  uint32_t width;
100
33
 
101
- /**
102
- * @brief Target encoded height in pixels.
103
- *
104
- * The current implementation defaults to 180 when this field is zero.
105
- */
106
34
  uint32_t height;
107
35
 
108
- /**
109
- * @brief Target frame rate.
110
- *
111
- * The current implementation defaults to 15 when this field is zero.
112
- */
113
36
  uint32_t fps;
114
37
 
115
- /**
116
- * @brief Target encoded bitrate in kilobits per second.
117
- *
118
- * The current implementation passes zero through to the underlying encoder,
119
- * allowing the codec backend to choose its default rate-control behavior.
120
- */
121
38
  uint32_t bitrate_kbps;
122
39
  } TirtcVideoInputOptions;
123
40
 
124
41
  /**
125
- * @brief Optional observer for a video input object.
126
- *
127
- * The implementation stores a copy of this structure. Installing or replacing
128
- * an observer does not replay prior state; callbacks describe subsequent local
129
- * start and stop transitions.
42
+ * Video input observer.
130
43
  *
131
- * Callback delivery is not guaranteed to be on a fixed thread. In the current
132
- * implementation, input state notifications may be dispatched synchronously by
133
- * API calls such as ::tirtc_video_input_start and ::tirtc_video_input_stop.
134
- * Callers must therefore make callback logic safe for reentrant delivery.
44
+ * `owned_message` is allocated by facade for this callback dispatch. Consumers must release it
45
+ * with `tirtc_owned_string_release()` after copying or converting the string they need.
135
46
  */
136
47
  typedef struct TirtcVideoInputObserver {
137
- /**
138
- * @brief Called when the input starts or stops.
139
- *
140
- * In the current implementation, a start failure is reported as STOPPED with
141
- * a non-OK ::error value.
142
- */
143
- void (*on_state_changed)(TirtcVideoInput* input, TirtcInputState state, TirtcError error,
144
- void* user_data);
145
-
146
- /**
147
- * @brief Reserved callback for output-size updates.
148
- *
149
- * The current facade implementation exposes this callback in the contract but
150
- * does not currently emit it.
151
- */
48
+ void (*on_state_changed)(TirtcVideoInput* input, TirtcInputState state, void* user_data);
49
+
152
50
  void (*on_output_size_changed)(TirtcVideoInput* input, uint32_t width, uint32_t height,
153
51
  void* user_data);
52
+
53
+ void (*on_error)(TirtcVideoInput* input, TirtcError error, TirtcOwnedString* owned_message,
54
+ void* user_data);
154
55
  } TirtcVideoInputObserver;
155
56
 
156
57
  /**
157
- * @brief Optional observer for a video output object.
58
+ * Video output observer.
158
59
  *
159
- * The implementation stores a copy of this structure. Installing or replacing
160
- * an observer does not replay the current output state.
161
- *
162
- * Callback delivery is not guaranteed to be on a fixed thread. State changes
163
- * may be reported synchronously by attach, detach, or backend-clear paths, or
164
- * asynchronously from the internal downlink pipeline. Callers must therefore
165
- * make callback logic safe for reentrant delivery and perform their own thread
166
- * handoff when thread affinity is required.
60
+ * `owned_message` is allocated by facade for this callback dispatch. Consumers must release it
61
+ * with `tirtc_owned_string_release()` after copying or converting the string they need.
167
62
  */
168
63
  typedef struct TirtcVideoOutputObserver {
169
- /**
170
- * @brief Called when the output state changes.
171
- *
172
- * A common sequence is IDLE after attach, then BUFFERING, then RENDERING,
173
- * and IDLE again after detach or backend removal.
174
- */
175
- void (*on_state_changed)(TirtcVideoOutput* output, TirtcVideoOutputState state, TirtcError error,
176
- void* user_data);
177
-
178
- /**
179
- * @brief Reserved callback for output-size updates.
180
- *
181
- * The current facade implementation exposes this callback in the contract but
182
- * does not currently emit it.
183
- */
64
+ void (*on_state_changed)(TirtcVideoOutput* output, TirtcVideoOutputState state, void* user_data);
65
+
184
66
  void (*on_output_size_changed)(TirtcVideoOutput* output, uint32_t width, uint32_t height,
185
67
  void* user_data);
68
+
69
+ void (*on_error)(TirtcVideoOutput* output, TirtcError error, TirtcOwnedString* owned_message,
70
+ void* user_data);
186
71
  } TirtcVideoOutputObserver;
187
72
 
188
- /**
189
- * @brief Enable or disable runtime media-trace logging.
190
- *
191
- * This is a process-wide runtime switch, not a per-connection setting.
192
- *
193
- * @param enabled Non-zero to enable tracing; zero to disable it.
194
- * @return ::TIRTC_ERROR_OK on success.
195
- */
196
73
  TirtcError tirtc_set_media_trace_enabled(int enabled);
197
74
 
198
- /**
199
- * @brief Query whether runtime media tracing is enabled.
200
- *
201
- * @param out_enabled Receives `1` when enabled or `0` when disabled.
202
- * @return ::TIRTC_ERROR_OK on success.
203
- */
204
75
  TirtcError tirtc_get_media_trace_enabled(int* out_enabled);
205
76
 
206
- /**
207
- * @brief Request an I-frame from the remote sender for a video stream.
208
- *
209
- * This is typically used by a receiver after join, decoder recovery, or severe
210
- * packet loss when waiting for the next natural key frame would be too slow.
211
- *
212
- * @param connection Target connection.
213
- * @param stream_id Video stream identifier.
214
- * @return ::TIRTC_ERROR_OK on success.
215
- */
216
- TirtcError tirtc_conn_request_iframe(TirtcConn* connection, uint8_t stream_id);
217
-
218
- /**
219
- * @brief Attach a local video input to a connection stream.
220
- *
221
- * This bind is non-owning. The same input cannot be attached to more than one
222
- * connection at a time. The selected ::stream_id must be unique across all
223
- * currently attached input and output streams on the same connection.
224
- *
225
- * @param connection Target connection.
226
- * @param stream_id Stream identifier that will carry this video route.
227
- * @param input Video input to bind.
228
- * @return ::TIRTC_ERROR_OK on success.
229
- */
230
- TirtcError tirtc_conn_attach_video_input(TirtcConn* connection, uint8_t stream_id,
231
- TirtcVideoInput* input);
232
-
233
- /**
234
- * @brief Attach a remote video output to a connection stream.
235
- *
236
- * The output must not currently be used as a preview target. A video output
237
- * can be either a preview sink or a remote sink, but never both at the same
238
- * time.
239
- *
240
- * If an observer is already installed, a successful attach typically reports an
241
- * initial IDLE state before decoded frames begin to render.
242
- * Attach is a local bind only; it does not send a remote request for this
243
- * stream.
244
- *
245
- * @param connection Target connection.
246
- * @param stream_id Remote video stream identifier to render.
247
- * @param output Video output to bind.
248
- * @return ::TIRTC_ERROR_OK on success.
249
- */
250
- TirtcError tirtc_conn_attach_video_output(TirtcConn* connection, uint8_t stream_id,
251
- TirtcVideoOutput* output);
77
+ TirtcError tirtc_conn_subscribe_video(TirtcConn* connection, uint8_t stream_id);
252
78
 
253
- /**
254
- * @brief Detach a video input from a connection stream.
255
- *
256
- * This call is idempotent.
257
- *
258
- * @param connection Target connection.
259
- * @param stream_id Stream identifier to detach.
260
- * @return ::TIRTC_ERROR_OK on success.
261
- */
262
- TirtcError tirtc_conn_detach_video_input(TirtcConn* connection, uint8_t stream_id);
79
+ TirtcError tirtc_conn_unsubscribe_video(TirtcConn* connection, uint8_t stream_id);
263
80
 
264
- /**
265
- * @brief Detach a video output from a connection stream.
266
- *
267
- * This call is idempotent.
268
- *
269
- * @param connection Target connection.
270
- * @param stream_id Stream identifier to detach.
271
- * @return ::TIRTC_ERROR_OK on success.
272
- */
273
- TirtcError tirtc_conn_detach_video_output(TirtcConn* connection, uint8_t stream_id);
81
+ TirtcError tirtc_conn_request_key_frame(TirtcConn* connection, uint8_t stream_id);
274
82
 
275
- /**
276
- * @brief Create a video input object.
277
- *
278
- * The runtime must already be initialized.
279
- *
280
- * @param out_input Receives the created input handle on success.
281
- * @return ::TIRTC_ERROR_OK on success.
282
- */
283
83
  TirtcError tirtc_video_input_create(TirtcVideoInput** out_input);
284
84
 
285
- /**
286
- * @brief Destroy a video input object.
287
- *
288
- * The input must already be detached from any connection. Any preview binding
289
- * is cleared during destruction.
290
- *
291
- * @param input Input handle to destroy.
292
- */
293
- void tirtc_video_input_destroy(TirtcVideoInput* input);
294
-
295
- /**
296
- * @brief Bind a concrete video capture backend to an input object.
297
- *
298
- * This must be done while the input is stopped and detached, before the next
299
- * successful start. The backend pointer is non-owning and should remain valid
300
- * while the input may still use it.
301
- *
302
- * @param input Target video input.
303
- * @param vin Capture backend to bind.
304
- * @return ::TIRTC_ERROR_OK on success.
305
- */
306
85
  TirtcError tirtc_video_input_set_vin(TirtcVideoInput* input, TirtcVideoVin* vin);
307
86
 
308
- /**
309
- * @brief Store video encoding options.
310
- *
311
- * Best practice is to call this before the first successful start. Updating
312
- * options after the internal uplink pipeline has already been created does not
313
- * retroactively rebuild that running pipeline.
314
- *
315
- * @param input Target video input.
316
- * @param options Options to copy into the facade object.
317
- * @return ::TIRTC_ERROR_OK on success.
318
- */
319
87
  TirtcError tirtc_video_input_set_options(TirtcVideoInput* input,
320
88
  const TirtcVideoInputOptions* options);
321
89
 
322
- /**
323
- * @brief Install, replace, or clear the video input observer.
324
- *
325
- * Passing NULL for ::observer clears the current observer. The implementation
326
- * stores a copy of the observer structure and does not require it to outlive
327
- * this call.
328
- *
329
- * @param input Target video input.
330
- * @param observer Observer to install, or NULL to clear.
331
- * @param user_data Opaque pointer returned to observer callbacks.
332
- * @return ::TIRTC_ERROR_OK on success.
333
- */
334
90
  TirtcError tirtc_video_input_set_observer(TirtcVideoInput* input,
335
91
  const TirtcVideoInputObserver* observer, void* user_data);
336
92
 
337
- /**
338
- * @brief Bind a preview output to a video input.
339
- *
340
- * Use this when local camera frames should also be rendered locally, for
341
- * example in a self-preview view.
342
- *
343
- * The supplied output must already have a non-NULL render backend configured
344
- * by ::tirtc_video_output_set_vout, and it must not currently be attached to a
345
- * remote connection stream or owned by another preview input.
346
- *
347
- * This preview relationship is non-owning and may be established before or
348
- * after ::tirtc_video_input_start. Rebinding to a different output
349
- * automatically releases the previous preview relationship held by this input.
350
- * When the input is already running, the new preview sink is applied to the
351
- * live uplink immediately.
352
- *
353
- * @param input Target video input.
354
- * @param output Video output to use for preview.
355
- * @return ::TIRTC_ERROR_OK on success.
356
- */
357
- TirtcError tirtc_video_input_set_preview_output(TirtcVideoInput* input, TirtcVideoOutput* output);
358
-
359
- /**
360
- * @brief Clear the preview output currently associated with a video input.
361
- *
362
- * This call is idempotent and is the normal pairing call for
363
- * ::tirtc_video_input_set_preview_output when a preview surface is being
364
- * released or repurposed for remote display. Clearing the preview relationship
365
- * does not destroy the output object.
366
- *
367
- * @param input Target video input.
368
- * @return ::TIRTC_ERROR_OK on success.
369
- */
370
- TirtcError tirtc_video_input_clear_preview_output(TirtcVideoInput* input);
371
-
372
- /**
373
- * @brief Start local video capture and encoding for an input object.
374
- *
375
- * A capture backend must already be bound with ::tirtc_video_input_set_vin.
376
- *
377
- * @param input Target video input.
378
- * @return ::TIRTC_ERROR_OK on success.
379
- */
380
93
  TirtcError tirtc_video_input_start(TirtcVideoInput* input);
381
94
 
382
- /**
383
- * @brief Stop local video capture and encoding for an input object.
384
- *
385
- * This is the normal pairing call for ::tirtc_video_input_start. The current
386
- * implementation also tolerates stopping an already stopped input.
387
- *
388
- * @param input Target video input.
389
- * @return ::TIRTC_ERROR_OK on success.
390
- */
391
95
  TirtcError tirtc_video_input_stop(TirtcVideoInput* input);
392
96
 
393
- /**
394
- * @brief Create a video output object.
395
- *
396
- * The runtime must already be initialized.
397
- *
398
- * @param out_output Receives the created output handle on success.
399
- * @return ::TIRTC_ERROR_OK on success.
400
- */
401
- TirtcError tirtc_video_output_create(TirtcVideoOutput** out_output);
97
+ TirtcError tirtc_video_input_attach(TirtcVideoInput* input, TirtcConn* connection,
98
+ uint8_t stream_id);
402
99
 
403
- /**
404
- * @brief Destroy a video output object.
405
- *
406
- * The output must already be detached from any connection stream and must not
407
- * be owned by a preview input. If it is still active, the current
408
- * implementation keeps it alive and ignores the destroy request.
409
- *
410
- * @param output Output handle to destroy.
411
- */
412
- void tirtc_video_output_destroy(TirtcVideoOutput* output);
100
+ TirtcError tirtc_video_input_detach(TirtcVideoInput* input, TirtcConn* connection);
413
101
 
414
- /**
415
- * @brief Bind or clear a concrete video render backend for an output object.
416
- *
417
- * Passing a non-NULL backend is allowed only while the output is inactive.
418
- * That means it must be neither attached to a remote stream nor serving as a
419
- * preview output.
420
- *
421
- * Passing NULL clears the current backend. When a remote output is already
422
- * attached, clearing the backend stops rendering and returns the output to the
423
- * IDLE state. When the output is currently used for preview, clearing the
424
- * backend stops the live preview sink but does not clear the preview
425
- * relationship itself. The output remains owned by that preview binding until
426
- * ::tirtc_video_input_clear_preview_output is called.
427
- *
428
- * @param output Target video output.
429
- * @param vout Render backend to bind, or NULL to clear.
430
- * @return ::TIRTC_ERROR_OK on success.
431
- */
432
- TirtcError tirtc_video_output_set_vout(TirtcVideoOutput* output, TirtcVideoVout* vout);
102
+ TirtcError tirtc_video_input_attach_preview(TirtcVideoInput* input,
103
+ TirtcVideoOutput* preview_output);
104
+
105
+ TirtcError tirtc_video_input_detach_preview(TirtcVideoInput* input);
106
+
107
+ void tirtc_video_input_destroy(TirtcVideoInput* input);
108
+
109
+ TirtcError tirtc_video_output_create(TirtcVideoOutput** out_output);
433
110
 
434
- /**
435
- * @brief Install, replace, or clear the video output observer.
436
- *
437
- * Passing NULL for ::observer clears the current observer. The implementation
438
- * stores a copy of the observer structure and does not require it to outlive
439
- * this call.
440
- *
441
- * @param output Target video output.
442
- * @param observer Observer to install, or NULL to clear.
443
- * @param user_data Opaque pointer returned to observer callbacks.
444
- * @return ::TIRTC_ERROR_OK on success.
445
- */
446
111
  TirtcError tirtc_video_output_set_observer(TirtcVideoOutput* output,
447
112
  const TirtcVideoOutputObserver* observer,
448
113
  void* user_data);
449
114
 
115
+ TirtcError tirtc_video_output_attach_view(TirtcVideoOutput* output, TirtcVideoVout* view_sink);
116
+
117
+ TirtcError tirtc_video_output_detach_view(TirtcVideoOutput* output);
118
+
119
+ TirtcError tirtc_video_output_attach(TirtcVideoOutput* output, TirtcConn* connection,
120
+ uint8_t stream_id);
121
+
122
+ TirtcError tirtc_video_output_detach(TirtcVideoOutput* output);
123
+
124
+ void tirtc_video_output_destroy(TirtcVideoOutput* output);
125
+
126
+ TirtcError tirtc_video_output_start_raw_dump(TirtcVideoOutput* output);
127
+
128
+ TirtcError tirtc_video_output_stop_raw_dump(TirtcVideoOutput* output);
129
+
450
130
  #ifdef __cplusplus
451
131
  }
452
132
  #endif
453
133
 
454
- #endif // TIRTC_FACADE_AV_H_
134
+ #endif
@@ -22,6 +22,8 @@ typedef enum TirtcError {
22
22
  TIRTC_ERROR_TRANSPORT_REMOTE_CLOSED = 13,
23
23
  TIRTC_ERROR_TRANSPORT_CONNECTION_OTHER_ERROR = 14,
24
24
  TIRTC_ERROR_TRANSPORT_TOKEN_EXPIRED = 15,
25
+ TIRTC_ERROR_DUMP_ROOT_UNAVAILABLE = 16,
26
+ TIRTC_ERROR_DUMP_ALREADY_ACTIVE = 17,
25
27
  } TirtcError;
26
28
 
27
29
  #ifdef __cplusplus
@@ -62,6 +62,9 @@ TirtcError tirtc_media_downlink_audio_get_current_pts(TirtcMediaDownlinkAudio* d
62
62
  int64_t* out_pts_us);
63
63
  TirtcError tirtc_media_downlink_audio_start(TirtcMediaDownlinkAudio* downlink);
64
64
  TirtcError tirtc_media_downlink_audio_stop(TirtcMediaDownlinkAudio* downlink);
65
+ TirtcError tirtc_media_downlink_audio_start_raw_dump(TirtcMediaDownlinkAudio* downlink,
66
+ const char* prefix);
67
+ TirtcError tirtc_media_downlink_audio_stop_raw_dump(TirtcMediaDownlinkAudio* downlink);
65
68
 
66
69
  TirtcError tirtc_media_downlink_video_create(TirtcMediaDownlinkVideo** out_downlink);
67
70
  void tirtc_media_downlink_video_retain(TirtcMediaDownlinkVideo* downlink);
@@ -87,6 +90,9 @@ TirtcError tirtc_media_downlink_video_follow_video(TirtcMediaDownlinkVideo* foll
87
90
  TirtcError tirtc_media_downlink_video_use_self_timing(TirtcMediaDownlinkVideo* downlink);
88
91
  TirtcError tirtc_media_downlink_video_start(TirtcMediaDownlinkVideo* downlink);
89
92
  TirtcError tirtc_media_downlink_video_stop(TirtcMediaDownlinkVideo* downlink);
93
+ TirtcError tirtc_media_downlink_video_start_raw_dump(TirtcMediaDownlinkVideo* downlink,
94
+ const char* prefix);
95
+ TirtcError tirtc_media_downlink_video_stop_raw_dump(TirtcMediaDownlinkVideo* downlink);
90
96
 
91
97
  #ifdef __cplusplus
92
98
  }