ntgcalls-sys 3.0.0-beta10

Raw FFI bindings to the ntgcalls C ABI
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
// @generated from schema/ntgcalls.ntl -- DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case, dead_code)]

use std::os::raw::{c_char, c_int, c_void};

#[repr(C)]
pub struct ntg_bytes {
    pub data: *mut u8,
    pub len: usize,
}

pub type ntg_result = c_int;
pub const NTG_OK: ntg_result = 0;
pub const NTG_ERR_UNKNOWN: ntg_result = -1;
pub const NTG_ERR_NULL_POINTER: ntg_result = -2;
pub const NTG_ERR_RTC: ntg_result = -100;
pub const NTG_ERR_SDP_PARSE: ntg_result = -101;
pub const NTG_ERR_TRANSPORT_PARSE: ntg_result = -102;
pub const NTG_ERR_RTMP_STREAMING_UNSUPPORTED: ntg_result = -103;
pub const NTG_ERR_CONNECTION: ntg_result = -200;
pub const NTG_ERR_CONNECTION_NOT_FOUND: ntg_result = -201;
pub const NTG_ERR_CONNECTION_ERROR: ntg_result = -202;
pub const NTG_ERR_CRYPTO_ERROR: ntg_result = -203;
pub const NTG_ERR_TELEGRAM_SERVER_ERROR: ntg_result = -204;
pub const NTG_ERR_RTC_CONNECTION_NEEDED: ntg_result = -205;
pub const NTG_ERR_INVALID_PARAMS: ntg_result = -206;
pub const NTG_ERR_SIGNALING: ntg_result = -300;
pub const NTG_ERR_SIGNALING_ERROR: ntg_result = -301;
pub const NTG_ERR_SIGNALING_UNSUPPORTED: ntg_result = -302;
pub const NTG_ERR_MEDIA: ntg_result = -400;
pub const NTG_ERR_FILE_ERROR: ntg_result = -401;
pub const NTG_ERR_FFMPEG_ERROR: ntg_result = -402;
pub const NTG_ERR_SHELL_ERROR: ntg_result = -403;
pub const NTG_ERR_MEDIA_DEVICE_ERROR: ntg_result = -404;

pub type ntg_log_level = c_int;
pub const NTG_LOG_DEBUG: ntg_log_level = 1;
pub const NTG_LOG_INFO: ntg_log_level = 2;
pub const NTG_LOG_WARNING: ntg_log_level = 4;
pub const NTG_LOG_ERROR: ntg_log_level = 8;

pub type ntg_log_source = c_int;
pub const NTG_LOG_SOURCE_WEBRTC: ntg_log_source = 1;
pub const NTG_LOG_SOURCE_SELF: ntg_log_source = 2;

#[repr(C)]
pub struct ntg_log_message {
    pub level: ntg_log_level,
    pub source: ntg_log_source,
    pub file: *const c_char,
    pub line: u32,
    pub message: *const c_char,
}

pub type ntg_log_cb = Option<unsafe extern "C" fn(message: ntg_log_message, user_data: *mut c_void)>;

#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ntg_media_source {
    NTG_MEDIA_SOURCE_UNKNOWN,
    NTG_MEDIA_SOURCE_FILE,
    NTG_MEDIA_SOURCE_SHELL,
    NTG_MEDIA_SOURCE_FFMPEG,
    NTG_MEDIA_SOURCE_DEVICE,
    NTG_MEDIA_SOURCE_DESKTOP,
    NTG_MEDIA_SOURCE_EXTERNAL,
}

#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ntg_stream_type {
    NTG_STREAM_TYPE_AUDIO,
    NTG_STREAM_TYPE_VIDEO,
}

#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ntg_stream_status {
    NTG_STREAM_STATUS_ACTIVE,
    NTG_STREAM_STATUS_PAUSED,
    NTG_STREAM_STATUS_IDLING,
}

#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ntg_stream_mode {
    NTG_STREAM_MODE_CAPTURE,
    NTG_STREAM_MODE_PLAYBACK,
}

#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ntg_stream_device {
    NTG_STREAM_DEVICE_MICROPHONE,
    NTG_STREAM_DEVICE_SPEAKER,
    NTG_STREAM_DEVICE_CAMERA,
    NTG_STREAM_DEVICE_SCREEN,
}

#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ntg_connection_state {
    NTG_CONNECTION_STATE_CONNECTING,
    NTG_CONNECTION_STATE_CONNECTED,
    NTG_CONNECTION_STATE_FAILED,
    NTG_CONNECTION_STATE_TIMEOUT,
    NTG_CONNECTION_STATE_CLOSED,
}

#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ntg_connection_kind {
    NTG_CONNECTION_KIND_NORMAL,
    NTG_CONNECTION_KIND_PRESENTATION,
}

#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ntg_call_type {
    NTG_CALL_TYPE_GROUP,
    NTG_CALL_TYPE_OUTGOING,
    NTG_CALL_TYPE_INCOMING,
    NTG_CALL_TYPE_P2P,
    NTG_CALL_TYPE_CONFERENCE,
}

#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ntg_media_segment_quality {
    NTG_MEDIA_SEGMENT_QUALITY_NONE,
    NTG_MEDIA_SEGMENT_QUALITY_THUMBNAIL,
    NTG_MEDIA_SEGMENT_QUALITY_MEDIUM,
    NTG_MEDIA_SEGMENT_QUALITY_FULL,
}

#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ntg_media_segment_part_status {
    NTG_MEDIA_SEGMENT_PART_STATUS_NOT_READY,
    NTG_MEDIA_SEGMENT_PART_STATUS_RESYNC_NEEDED,
    NTG_MEDIA_SEGMENT_PART_STATUS_DOWNLOADING,
    NTG_MEDIA_SEGMENT_PART_STATUS_SUCCESS,
}

#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ntg_connection_mode {
    NTG_CONNECTION_MODE_NONE,
    NTG_CONNECTION_MODE_RTC,
    NTG_CONNECTION_MODE_STREAM,
    NTG_CONNECTION_MODE_RTMP,
}

#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ntg_video_rotation {
    NTG_VIDEO_ROTATION_VIDEO_ROTATION_0,
    NTG_VIDEO_ROTATION_VIDEO_ROTATION_90,
    NTG_VIDEO_ROTATION_VIDEO_ROTATION_180,
    NTG_VIDEO_ROTATION_VIDEO_ROTATION_270,
}

#[repr(C)]
pub struct ntg_connection_info {
    pub state: ntg_connection_state,
    pub kind: ntg_connection_kind,
}

#[repr(C)]
pub struct ntg_remote_source {
    pub ssrc: u32,
    pub state: ntg_stream_status,
    pub device: ntg_stream_device,
}

#[repr(C)]
pub struct ntg_subchain_request {
    pub subchain: i32,
    pub height: i32,
    pub limit: i32,
}

#[repr(C)]
pub struct ntg_audio_description {
    pub media_source: ntg_media_source,
    pub sample_rate: u32,
    pub channel_count: u8,
    pub input: *mut c_char,
    pub keep_open: bool,
}

#[repr(C)]
pub struct ntg_call_info {
    pub playback: ntg_stream_status,
    pub capture: ntg_stream_status,
}

#[repr(C)]
pub struct ntg_device_info {
    pub name: *mut c_char,
    pub metadata: *mut c_char,
}

#[repr(C)]
pub struct ntg_media_devices {
    pub microphone: *mut ntg_device_info,
    pub microphone_len: usize,
    pub speaker: *mut ntg_device_info,
    pub speaker_len: usize,
    pub camera: *mut ntg_device_info,
    pub camera_len: usize,
    pub screen: *mut ntg_device_info,
    pub screen_len: usize,
}

#[repr(C)]
pub struct ntg_media_state {
    pub muted: bool,
    pub video_paused: bool,
    pub video_stopped: bool,
    pub presentation_paused: bool,
    pub presentation_stopped: bool,
}

#[repr(C)]
pub struct ntg_video_description {
    pub media_source: ntg_media_source,
    pub width: i16,
    pub height: i16,
    pub fps: u8,
    pub input: *mut c_char,
    pub keep_open: bool,
}

#[repr(C)]
pub struct ntg_media_description {
    pub microphone: *mut ntg_audio_description,
    pub speaker: *mut ntg_audio_description,
    pub camera: *mut ntg_video_description,
    pub screen: *mut ntg_video_description,
}

#[repr(C)]
pub struct ntg_frame_data {
    pub absolute_capture_timestamp_ms: i64,
    pub rotation: ntg_video_rotation,
    pub width: u16,
    pub height: u16,
}

#[repr(C)]
pub struct ntg_ssrc_group {
    pub semantics: *mut c_char,
    pub ssrcs: *mut u32,
    pub ssrcs_len: usize,
}

#[repr(C)]
pub struct ntg_frame {
    pub ssrc: i64,
    pub data: *mut u8,
    pub data_len: usize,
    pub frame_data: ntg_frame_data,
}

#[repr(C)]
pub struct ntg_segment_part_request {
    pub segment_id: i64,
    pub part_id: i32,
    pub limit: i32,
    pub timestamp: i64,
    pub quality_update: bool,
    pub channel_id: i32,
    pub quality: ntg_media_segment_quality,
}

#[repr(C)]
pub struct ntg_ssrc_mapping {
    pub user_id: i64,
    pub ssrc: i32,
}

#[repr(C)]
pub struct ntg_auth_params {
    pub key_fingerprint: i64,
    pub ga_or_gb: *mut u8,
    pub ga_or_gb_len: usize,
}

#[repr(C)]
pub struct ntg_conference_join_params {
    pub payload: *mut c_char,
    pub public_key: *mut u8,
    pub public_key_len: usize,
    pub block: *mut u8,
    pub block_len: usize,
}

#[repr(C)]
pub struct ntg_dh_config {
    pub g: i32,
    pub p: *mut u8,
    pub p_len: usize,
    pub random: *mut u8,
    pub random_len: usize,
}

#[repr(C)]
pub struct ntg_protocol {
    pub min_layer: i32,
    pub max_layer: i32,
    pub udp_p2p: bool,
    pub udp_reflector: bool,
    pub library_versions: *mut *mut c_char,
    pub library_versions_len: usize,
}

#[repr(C)]
pub struct ntg_rtc_server {
    pub id: u64,
    pub ipv4: *mut c_char,
    pub ipv6: *mut c_char,
    pub port: u16,
    pub username: *mut c_char,
    pub password: *mut c_char,
    pub turn: bool,
    pub stun: bool,
    pub tcp: bool,
    pub peer_tag: *mut u8,
    pub peer_tag_len: usize,
}

#[repr(C)]
pub struct ntg_call_info_entry {
    pub key: i64,
    pub value: ntg_call_info,
}

#[repr(C)]
pub struct ntg_instance {
    _private: [u8; 0],
}

pub type ntg_upgrade_callback_cb = Option<unsafe extern "C" fn(
    handle: *mut ntg_instance,
    chat_id: i64,
    state: ntg_media_state,
    user_data: *mut c_void,
)>;

pub type ntg_stream_end_callback_cb = Option<unsafe extern "C" fn(
    handle: *mut ntg_instance,
    chat_id: i64,
    r#type: ntg_stream_type,
    device: ntg_stream_device,
    user_data: *mut c_void,
)>;

pub type ntg_connection_change_callback_cb = Option<unsafe extern "C" fn(
    handle: *mut ntg_instance,
    chat_id: i64,
    state: ntg_connection_info,
    user_data: *mut c_void,
)>;

pub type ntg_frames_callback_cb = Option<unsafe extern "C" fn(
    handle: *mut ntg_instance,
    chat_id: i64,
    mode: ntg_stream_mode,
    device: ntg_stream_device,
    frames: *const ntg_frame, frames_len: usize,
    user_data: *mut c_void,
)>;

pub type ntg_signaling_data_callback_cb = Option<unsafe extern "C" fn(
    handle: *mut ntg_instance,
    chat_id: i64,
    data: *const u8, data_len: usize,
    user_data: *mut c_void,
)>;

pub type ntg_remote_source_change_callback_cb = Option<unsafe extern "C" fn(
    handle: *mut ntg_instance,
    chat_id: i64,
    state: ntg_remote_source,
    user_data: *mut c_void,
)>;

pub type ntg_request_broadcast_part_callback_cb = Option<unsafe extern "C" fn(
    handle: *mut ntg_instance,
    chat_id: i64,
    request: ntg_segment_part_request,
    user_data: *mut c_void,
)>;

pub type ntg_request_broadcast_timestamp_callback_cb = Option<unsafe extern "C" fn(
    handle: *mut ntg_instance,
    chat_id: i64,
    user_data: *mut c_void,
)>;

pub type ntg_request_participants_callback_cb = Option<unsafe extern "C" fn(
    handle: *mut ntg_instance,
    chat_id: i64,
    user_data: *mut c_void,
)>;

pub type ntg_outbound_block_callback_cb = Option<unsafe extern "C" fn(
    handle: *mut ntg_instance,
    chat_id: i64,
    block: *const u8, block_len: usize,
    user_data: *mut c_void,
)>;

pub type ntg_subchain_request_callback_cb = Option<unsafe extern "C" fn(
    handle: *mut ntg_instance,
    chat_id: i64,
    subchain_request: ntg_subchain_request,
    user_data: *mut c_void,
)>;

pub type ntg_update_emojis_callback_cb = Option<unsafe extern "C" fn(
    handle: *mut ntg_instance,
    chat_id: i64,
    emojis: *const c_char,
    user_data: *mut c_void,
)>;

extern "C" {
    pub fn ntg_get_version() -> *const c_char;
    pub fn ntg_set_log_callback(callback: ntg_log_cb, user_data: *mut c_void);
    pub fn ntg_instance_create() -> *mut ntg_instance;
    pub fn ntg_instance_destroy(handle: *mut ntg_instance);
    pub fn ntg_string_free(value: *mut c_char);
    pub fn ntg_bytes_free(value: *mut c_void);
    pub fn ntg_connection_info_free(value: *mut ntg_connection_info);
    pub fn ntg_remote_source_free(value: *mut ntg_remote_source);
    pub fn ntg_subchain_request_free(value: *mut ntg_subchain_request);
    pub fn ntg_audio_description_free(value: *mut ntg_audio_description);
    pub fn ntg_call_info_free(value: *mut ntg_call_info);
    pub fn ntg_device_info_free(value: *mut ntg_device_info);
    pub fn ntg_media_devices_free(value: *mut ntg_media_devices);
    pub fn ntg_media_state_free(value: *mut ntg_media_state);
    pub fn ntg_video_description_free(value: *mut ntg_video_description);
    pub fn ntg_media_description_free(value: *mut ntg_media_description);
    pub fn ntg_frame_data_free(value: *mut ntg_frame_data);
    pub fn ntg_ssrc_group_free(value: *mut ntg_ssrc_group);
    pub fn ntg_frame_free(value: *mut ntg_frame);
    pub fn ntg_segment_part_request_free(value: *mut ntg_segment_part_request);
    pub fn ntg_ssrc_mapping_free(value: *mut ntg_ssrc_mapping);
    pub fn ntg_auth_params_free(value: *mut ntg_auth_params);
    pub fn ntg_conference_join_params_free(value: *mut ntg_conference_join_params);
    pub fn ntg_dh_config_free(value: *mut ntg_dh_config);
    pub fn ntg_protocol_free(value: *mut ntg_protocol);
    pub fn ntg_rtc_server_free(value: *mut ntg_rtc_server);
    pub fn ntg_call_info_entry_free(entries: *mut ntg_call_info_entry, len: usize);

    pub fn ntg_create_p2p_call(
        handle: *mut ntg_instance,
        user_id: i64,
    ) -> ntg_result;
    pub fn ntg_init_exchange(
        handle: *mut ntg_instance,
        user_id: i64,
        dh_config: ntg_dh_config,
        ga_hash: *const u8, ga_hash_len: usize,
        out: *mut *mut u8, out_len: *mut usize,
    ) -> ntg_result;
    pub fn ntg_exchange_keys(
        handle: *mut ntg_instance,
        user_id: i64,
        ga_or_gb: *const u8, ga_or_gb_len: usize,
        fingerprint: i64,
        out: *mut ntg_auth_params,
    ) -> ntg_result;
    pub fn ntg_skip_exchange(
        handle: *mut ntg_instance,
        user_id: i64,
        encryption_key: *const u8, encryption_key_len: usize,
        is_outgoing: bool,
    ) -> ntg_result;
    pub fn ntg_connect_p2p(
        handle: *mut ntg_instance,
        user_id: i64,
        servers: *const ntg_rtc_server, servers_len: usize,
        versions: *const *mut c_char, versions_len: usize,
        p2p_allowed: bool,
        custom_parameters: *const c_char,
    ) -> ntg_result;
    pub fn ntg_create_call(
        handle: *mut ntg_instance,
        chat_id: i64,
        out: *mut *mut c_char,
    ) -> ntg_result;
    pub fn ntg_init_presentation(
        handle: *mut ntg_instance,
        chat_id: i64,
        out: *mut *mut c_char,
    ) -> ntg_result;
    pub fn ntg_init_conference(
        handle: *mut ntg_instance,
        chat_id: i64,
        user_id: i64,
        last_block: *const u8, last_block_len: usize,
        out: *mut ntg_conference_join_params,
    ) -> ntg_result;
    pub fn ntg_connect(
        handle: *mut ntg_instance,
        chat_id: i64,
        params: *const c_char,
        is_presentation: bool,
    ) -> ntg_result;
    pub fn ntg_add_incoming_video(
        handle: *mut ntg_instance,
        chat_id: i64,
        user_id: i64,
        endpoint: *const c_char,
        ssrc_groups: *const ntg_ssrc_group, ssrc_groups_len: usize,
        out: *mut u32,
    ) -> ntg_result;
    pub fn ntg_remove_incoming_video(
        handle: *mut ntg_instance,
        chat_id: i64,
        endpoint: *const c_char,
        out: *mut bool,
    ) -> ntg_result;
    pub fn ntg_set_stream_sources(
        handle: *mut ntg_instance,
        chat_id: i64,
        mode: ntg_stream_mode,
        media: ntg_media_description,
    ) -> ntg_result;
    pub fn ntg_pause(
        handle: *mut ntg_instance,
        chat_id: i64,
        out: *mut bool,
    ) -> ntg_result;
    pub fn ntg_resume(
        handle: *mut ntg_instance,
        chat_id: i64,
        out: *mut bool,
    ) -> ntg_result;
    pub fn ntg_mute(
        handle: *mut ntg_instance,
        chat_id: i64,
        out: *mut bool,
    ) -> ntg_result;
    pub fn ntg_unmute(
        handle: *mut ntg_instance,
        chat_id: i64,
        out: *mut bool,
    ) -> ntg_result;
    pub fn ntg_stop(
        handle: *mut ntg_instance,
        chat_id: i64,
    ) -> ntg_result;
    pub fn ntg_stop_presentation(
        handle: *mut ntg_instance,
        chat_id: i64,
    ) -> ntg_result;
    pub fn ntg_get_emojis_fingerprint(
        handle: *mut ntg_instance,
        chat_id: i64,
        out: *mut *mut c_char,
    ) -> ntg_result;
    pub fn ntg_time(
        handle: *mut ntg_instance,
        chat_id: i64,
        mode: ntg_stream_mode,
        out: *mut u64,
    ) -> ntg_result;
    pub fn ntg_get_state(
        handle: *mut ntg_instance,
        chat_id: i64,
        out: *mut ntg_media_state,
    ) -> ntg_result;
    pub fn ntg_get_call_type(
        handle: *mut ntg_instance,
        chat_id: i64,
        out: *mut ntg_call_type,
    ) -> ntg_result;
    pub fn ntg_get_connection_mode(
        handle: *mut ntg_instance,
        chat_id: i64,
        out: *mut ntg_connection_mode,
    ) -> ntg_result;
    pub fn ntg_cpu_usage(
        handle: *mut ntg_instance,
        out: *mut f64,
    ) -> ntg_result;
    pub fn ntg_ping(
        out: *mut *mut c_char,
    ) -> ntg_result;
    pub fn ntg_get_media_devices(
        out: *mut ntg_media_devices,
    ) -> ntg_result;
    pub fn ntg_get_protocol(
        out: *mut ntg_protocol,
    ) -> ntg_result;
    pub fn ntg_enable_glib_loop(
        enable: bool,
    ) -> ntg_result;
    pub fn ntg_send_broadcast_timestamp(
        handle: *mut ntg_instance,
        chat_id: i64,
        timestamp: i64,
    ) -> ntg_result;
    pub fn ntg_send_broadcast_part(
        handle: *mut ntg_instance,
        chat_id: i64,
        segment_id: i64,
        part_id: i32,
        status: ntg_media_segment_part_status,
        quality_update: bool,
        data: *const u8, data_len: usize,
    ) -> ntg_result;
    pub fn ntg_send_signaling_data(
        handle: *mut ntg_instance,
        chat_id: i64,
        msg_key: *const u8, msg_key_len: usize,
    ) -> ntg_result;
    pub fn ntg_send_external_frame(
        handle: *mut ntg_instance,
        chat_id: i64,
        device: ntg_stream_device,
        data: *const u8, data_len: usize,
        frame_data: ntg_frame_data,
    ) -> ntg_result;
    pub fn ntg_update_audio_ssrc_mappings(
        handle: *mut ntg_instance,
        chat_id: i64,
        ssrc_groups: *const ntg_ssrc_mapping, ssrc_groups_len: usize,
    ) -> ntg_result;
    pub fn ntg_apply_blocks(
        handle: *mut ntg_instance,
        chat_id: i64,
        subchain: i32,
        next_offset: i32,
        blocks: *const ntg_bytes, blocks_len: usize,
        from_short_poll: bool,
    ) -> ntg_result;
    pub fn ntg_finish_subchain_request(
        handle: *mut ntg_instance,
        chat_id: i64,
        subchain: i32,
    ) -> ntg_result;
    pub fn ntg_calls(
        handle: *mut ntg_instance,
        out: *mut *mut ntg_call_info_entry, out_len: *mut usize,
    ) -> ntg_result;

    pub fn ntg_on_upgrade_callback(handle: *mut ntg_instance, callback: ntg_upgrade_callback_cb, user_data: *mut c_void) -> ntg_result;
    pub fn ntg_on_stream_end_callback(handle: *mut ntg_instance, callback: ntg_stream_end_callback_cb, user_data: *mut c_void) -> ntg_result;
    pub fn ntg_on_connection_change_callback(handle: *mut ntg_instance, callback: ntg_connection_change_callback_cb, user_data: *mut c_void) -> ntg_result;
    pub fn ntg_on_frames_callback(handle: *mut ntg_instance, callback: ntg_frames_callback_cb, user_data: *mut c_void) -> ntg_result;
    pub fn ntg_on_signaling_data_callback(handle: *mut ntg_instance, callback: ntg_signaling_data_callback_cb, user_data: *mut c_void) -> ntg_result;
    pub fn ntg_on_remote_source_change_callback(handle: *mut ntg_instance, callback: ntg_remote_source_change_callback_cb, user_data: *mut c_void) -> ntg_result;
    pub fn ntg_on_request_broadcast_part_callback(handle: *mut ntg_instance, callback: ntg_request_broadcast_part_callback_cb, user_data: *mut c_void) -> ntg_result;
    pub fn ntg_on_request_broadcast_timestamp_callback(handle: *mut ntg_instance, callback: ntg_request_broadcast_timestamp_callback_cb, user_data: *mut c_void) -> ntg_result;
    pub fn ntg_on_request_participants_callback(handle: *mut ntg_instance, callback: ntg_request_participants_callback_cb, user_data: *mut c_void) -> ntg_result;
    pub fn ntg_on_outbound_block_callback(handle: *mut ntg_instance, callback: ntg_outbound_block_callback_cb, user_data: *mut c_void) -> ntg_result;
    pub fn ntg_on_subchain_request_callback(handle: *mut ntg_instance, callback: ntg_subchain_request_callback_cb, user_data: *mut c_void) -> ntg_result;
    pub fn ntg_on_update_emojis_callback(handle: *mut ntg_instance, callback: ntg_update_emojis_callback_cb, user_data: *mut c_void) -> ntg_result;
}