ohaudio-sys 0.1.0

Raw Bindings to the audio module of OpenHarmony
Documentation
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
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
// automatically generated by rust-bindgen 0.71.1

#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#[cfg(feature = "api-12")]
use crate::audio_device_base::OH_AudioDevice_Type;
use crate::audiostream_base::*;
use libc::clockid_t;

/// Called when an interrupt event occurs in an AudioRenderer instance.
/// This function is similar to OH_AudioRenderer_Callbacks_Struct.OH_AudioRenderer_OnInterruptEvent.
///
/// # Arguments
///
/// * `renderer` - Pointer to the AudioRenderer instance that triggers the callback.
///
/// * `userData` - Pointer to the user data passed when setting the callback via
/// OH_AudioStreamBuilder_SetRendererInterruptCallback.
///
/// * `type` - Type of force that causes the interrupt event.
///
/// * `hint` - Hint provided along with the interrupt event.
/// [`OH_AudioRenderer_Callbacks_Struct.OH_AudioRenderer_OnInterruptEvent.`]
/// Available since API-level: 20
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
pub type OH_AudioRenderer_OnInterruptCallback = ::core::option::Option<
    unsafe extern "C" fn(
        renderer: *mut OH_AudioRenderer,
        userData: *mut ::core::ffi::c_void,
        type_: OH_AudioInterrupt_ForceType,
        hint: OH_AudioInterrupt_Hint,
    ),
>;
/// Called when an error event occurs in an AudioRenderer instance.
/// This function is similar to OH_AudioRenderer_Callbacks_Struct.OH_AudioRenderer_OnError.
///
/// # Arguments
///
/// * `renderer` - Pointer to the AudioRenderer instance that triggers the callback.
///
/// * `userData` - Pointer to the user data passed when setting the callback via
/// OH_AudioStreamBuilder_SetRendererErrorCallback.
///
/// * `error` - Specific error information.
/// [`OH_AudioRenderer_Callbacks_Struct.OH_AudioRenderer_OnError`]
/// Available since API-level: 20
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
pub type OH_AudioRenderer_OnErrorCallback = ::core::option::Option<
    unsafe extern "C" fn(
        renderer: *mut OH_AudioRenderer,
        userData: *mut ::core::ffi::c_void,
        error: OH_AudioStream_Result,
    ),
>;
/// Callback function of fast status change event for audio renderer.
///
/// # Arguments
///
/// * `renderer` - Pointer to an audio renderer instance for which this callback occurs.
///
/// * `userData` - Userdata which is passed by register.
///
/// * `status` - Current fast status.
///
/// Available since API-level: 20
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
pub type OH_AudioRenderer_OnFastStatusChange = ::core::option::Option<
    unsafe extern "C" fn(
        renderer: *mut OH_AudioRenderer,
        userData: *mut ::core::ffi::c_void,
        status: OH_AudioStream_FastStatus,
    ),
>;
/// Callback function of write data on Render.
///
/// Different with OH_AudioRenderer_OnWriteDataCallback, this function allows the caller to write partial data which
/// ranges from 0 to the callback buffer size. If 0 is returned, the callback thread will sleep for a while. Otherwise,
/// the system may callback again immediately.
///
/// # Arguments
///
/// * `renderer` - AudioRenderer where this callback occurs.
///
/// * `userData` - User data which is passed by user.
///
/// * `audioData` - Audio data pointer, where user should fill in audio data.
///
/// * `audioDataSize` - Size of audio data that user should fill in.
///
/// # Returns
///
/// * Length of the valid data that has written into audioData buffer. The return value must be in range of
/// [0, audioDataSize]. If the return value is less than 0, the system changes it to 0. And, if the return value is
/// greater than audioDataSize, the system changes it to audioDataSize. Note that the length of the returned buffer
/// must be an integer multiple of the length of the single sample data. For example, for 2 channels and S16 format
/// audio data, it must be an integer multiple of 4(2*16/8). Otherwise, it may cause noise during playback.
/// [`OH_AudioRenderer_OnWriteDataCallback`]
/// Available since API-level: 20
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
pub type OH_AudioRenderer_OnWriteDataCallbackAdvanced = ::core::option::Option<
    unsafe extern "C" fn(
        renderer: *mut OH_AudioRenderer,
        userData: *mut ::core::ffi::c_void,
        audioData: *mut ::core::ffi::c_void,
        audioDataSize: i32,
    ) -> i32,
>;
extern "C" {
    /// Request to release the renderer stream.
    ///
    ///
    /// Available since API-level: 10
    ///
    /// # Arguments
    ///
    /// * `renderer` - Reference created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`] The param of renderer is nullptr.
    /// [`AUDIOSTREAM_ERROR_ILLEGAL_STATE`] Execution status exception.
    pub fn OH_AudioRenderer_Release(renderer: *mut OH_AudioRenderer) -> OH_AudioStream_Result;
    /// Request to start the renderer stream.
    ///
    ///
    /// Available since API-level: 10
    ///
    /// # Arguments
    ///
    /// * `renderer` - reference created by OH_AudioStreamBuilder
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`] The param of renderer is nullptr.
    /// [`AUDIOSTREAM_ERROR_ILLEGAL_STATE`] Execution status exception.
    pub fn OH_AudioRenderer_Start(renderer: *mut OH_AudioRenderer) -> OH_AudioStream_Result;
    /// Request to pause the renderer stream.
    ///
    ///
    /// Available since API-level: 10
    ///
    /// # Arguments
    ///
    /// * `renderer` - Reference created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`] The param of renderer is nullptr.
    /// [`AUDIOSTREAM_ERROR_ILLEGAL_STATE`] Execution status exception.
    pub fn OH_AudioRenderer_Pause(renderer: *mut OH_AudioRenderer) -> OH_AudioStream_Result;
    /// Request to stop renderer stream.
    ///
    ///
    /// Available since API-level: 10
    ///
    /// # Arguments
    ///
    /// * `renderer` - Reference created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`] The param of renderer is nullptr.
    /// [`AUDIOSTREAM_ERROR_ILLEGAL_STATE`] Execution status exception.
    pub fn OH_AudioRenderer_Stop(renderer: *mut OH_AudioRenderer) -> OH_AudioStream_Result;
    /// Request to flush the renderer stream.
    ///
    ///
    /// Available since API-level: 10
    ///
    /// # Arguments
    ///
    /// * `renderer` - Reference created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`] The param of renderer is nullptr.
    /// [`AUDIOSTREAM_ERROR_ILLEGAL_STATE`] Execution status exception.
    pub fn OH_AudioRenderer_Flush(renderer: *mut OH_AudioRenderer) -> OH_AudioStream_Result;
    /// Query the current state of the renderer client.
    ///
    /// This function will return the renderer state without updating the state.
    ///
    ///
    /// Available since API-level: 10
    ///
    /// # Arguments
    ///
    /// * `renderer` - Reference created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `state` - Pointer to a variable that will be set for the state value.
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`] The param of renderer is nullptr.
    pub fn OH_AudioRenderer_GetCurrentState(
        renderer: *mut OH_AudioRenderer,
        state: *mut OH_AudioStream_State,
    ) -> OH_AudioStream_Result;
    /// Query the sample rate value of the renderer client
    ///
    /// This function will return the renderer sample rate value without updating the state.
    ///
    ///
    /// Available since API-level: 10
    ///
    /// # Arguments
    ///
    /// * `renderer` - Reference created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `rate` - The state value to be updated
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`] The param of renderer is nullptr.
    pub fn OH_AudioRenderer_GetSamplingRate(
        renderer: *mut OH_AudioRenderer,
        rate: *mut i32,
    ) -> OH_AudioStream_Result;
    /// Query the stream id of the renderer client.
    ///
    ///
    /// Available since API-level: 10
    ///
    /// # Arguments
    ///
    /// * `renderer` - Reference created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `streamId` - Pointer to a variable that will be set for the stream id.
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`] The param of renderer is nullptr.
    pub fn OH_AudioRenderer_GetStreamId(
        renderer: *mut OH_AudioRenderer,
        streamId: *mut u32,
    ) -> OH_AudioStream_Result;
    /// Query the channel count of the renderer client.
    ///
    ///
    /// Available since API-level: 10
    ///
    /// # Arguments
    ///
    /// * `renderer` - Reference created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `channelCount` - Pointer to a variable that will be set for the channel count.
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`] The param of renderer is nullptr.
    pub fn OH_AudioRenderer_GetChannelCount(
        renderer: *mut OH_AudioRenderer,
        channelCount: *mut i32,
    ) -> OH_AudioStream_Result;
    /// Query the sample format of the renderer client.
    ///
    ///
    /// Available since API-level: 10
    ///
    /// # Arguments
    ///
    /// * `renderer` - Reference created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `sampleFormat` - Pointer to a variable that will be set for the sample format.
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`] The param of renderer is nullptr.
    pub fn OH_AudioRenderer_GetSampleFormat(
        renderer: *mut OH_AudioRenderer,
        sampleFormat: *mut OH_AudioStream_SampleFormat,
    ) -> OH_AudioStream_Result;
    /// Query the latency mode of the renderer client.
    ///
    ///
    /// Available since API-level: 10
    ///
    /// # Arguments
    ///
    /// * `renderer` - Reference created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `latencyMode` - Pointer to a variable that will be set for the latency mode.
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`] The param of renderer is nullptr.
    pub fn OH_AudioRenderer_GetLatencyMode(
        renderer: *mut OH_AudioRenderer,
        latencyMode: *mut OH_AudioStream_LatencyMode,
    ) -> OH_AudioStream_Result;
    /// Query the renderer info of the renderer client.
    ///
    /// The rendere info includes [`OH_AudioStream_Usage`] value.
    ///
    ///
    /// Available since API-level: 10
    ///
    /// # Arguments
    ///
    /// * `renderer` - Reference created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `usage` - Pointer to a variable that will be set for the stream usage.
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`] The param of renderer is nullptr.
    pub fn OH_AudioRenderer_GetRendererInfo(
        renderer: *mut OH_AudioRenderer,
        usage: *mut OH_AudioStream_Usage,
    ) -> OH_AudioStream_Result;
    /// Query the encoding type of the renderer client.
    ///
    ///
    /// Available since API-level: 10
    ///
    /// # Arguments
    ///
    /// * `renderer` - Reference created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `encodingType` - Pointer to a variable that will be set for the encoding type.
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`] The param of renderer is nullptr.
    pub fn OH_AudioRenderer_GetEncodingType(
        renderer: *mut OH_AudioRenderer,
        encodingType: *mut OH_AudioStream_EncodingType,
    ) -> OH_AudioStream_Result;
    /// Query the the number of frames that have been written since the stream was created.
    ///
    ///
    /// Available since API-level: 10
    ///
    /// # Arguments
    ///
    /// * `renderer` - Reference created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `frames` - Pointer to a variable that will be set for the frame count number.
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`] The param of renderer is nullptr.
    pub fn OH_AudioRenderer_GetFramesWritten(
        renderer: *mut OH_AudioRenderer,
        frames: *mut i64,
    ) -> OH_AudioStream_Result;
    /// Query the the time at which a particular frame was presented.
    ///
    /// It is recommended to use new api [`OH_AudioRenderer_GetAudioTimestampInfo`]
    /// because it adapts to playback speed change, but current api does not. The
    /// increasing speed for position will not change when speed become fast.
    ///
    ///
    /// Available since API-level: 10
    ///
    /// # Arguments
    ///
    /// * `renderer` - Reference created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `clockId` - [`#CLOCK_MONOTONIC`]
    ///
    /// * `framePosition` - Pointer to a variable to receive the position
    ///
    /// * `timestamp` - Pointer to a variable to receive the timestamp
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`]:
    /// 1.The param of renderer is nullptr;
    /// 2.The param of clockId invalid.
    /// [`AUDIOSTREAM_ERROR_ILLEGAL_STATE`] Execution status exception.
    pub fn OH_AudioRenderer_GetTimestamp(
        renderer: *mut OH_AudioRenderer,
        clockId: clockid_t,
        framePosition: *mut i64,
        timestamp: *mut i64,
    ) -> OH_AudioStream_Result;
    /// Query the frame size in callback, it is a fixed length that the stream want to be filled for each callback.
    ///
    ///
    /// Available since API-level: 10
    ///
    /// # Arguments
    ///
    /// * `renderer` - Reference created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `frameSize` - Pointer to a variable that will be set for the frame size.
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`] The param of renderer is nullptr.
    pub fn OH_AudioRenderer_GetFrameSizeInCallback(
        renderer: *mut OH_AudioRenderer,
        frameSize: *mut i32,
    ) -> OH_AudioStream_Result;
    /// Query the playback speed of the stream client
    ///
    ///
    /// Available since API-level: 11
    ///
    /// # Arguments
    ///
    /// * `renderer` - Reference created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `speed` - Pointer to a variable to receive the playback speed.
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`] The param of renderer is nullptr.
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AudioRenderer_GetSpeed(
        renderer: *mut OH_AudioRenderer,
        speed: *mut f32,
    ) -> OH_AudioStream_Result;
    /// Set the playback speed of the stream client
    ///
    ///
    /// Available since API-level: 11
    ///
    /// # Arguments
    ///
    /// * `renderer` - Reference created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `speed` - The playback speed, form 0.25 to 4.0.
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`] The param of renderer is nullptr.
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AudioRenderer_SetSpeed(
        renderer: *mut OH_AudioRenderer,
        speed: f32,
    ) -> OH_AudioStream_Result;
    /// Set volume of current renderer.
    ///
    ///
    /// Available since API-level: 12
    ///
    /// # Arguments
    ///
    /// * `renderer` - Reference created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `volume` - Volume to set which changes from 0.0 to 1.0.
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`]:
    /// 1.The param of renderer is nullptr;
    /// 2.The param of volume invalid.
    /// [`AUDIOSTREAM_ERROR_ILLEGAL_STATE`] Execution status exception.
    /// [`AUDIOSTREAM_ERROR_SYSTEM`] An system error has occurred.
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_AudioRenderer_SetVolume(
        renderer: *mut OH_AudioRenderer,
        volume: f32,
    ) -> OH_AudioStream_Result;
    /// Changes the volume with ramp for a duration.
    ///
    ///
    /// Available since API-level: 12
    ///
    /// # Arguments
    ///
    /// * `renderer` - Reference created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `volume` - Volume to set which changes from 0.0 to 1.0.
    ///
    /// * `durationMs` - Duration for volume ramp, in millisecond.
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`]:
    /// 1.The param of renderer is nullptr;
    /// 2.The param of volume invalid.
    /// [`AUDIOSTREAM_ERROR_ILLEGAL_STATE`] Execution status exception.
    /// [`AUDIOSTREAM_ERROR_SYSTEM`] An system error has occurred.
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_AudioRenderer_SetVolumeWithRamp(
        renderer: *mut OH_AudioRenderer,
        volume: f32,
        durationMs: i32,
    ) -> OH_AudioStream_Result;
    /// Get Volume of current renderer.
    ///
    ///
    /// Available since API-level: 12
    ///
    /// # Arguments
    ///
    /// * `renderer` - Reference created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `volume` - Pointer to a variable to receive the volume.
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`]:
    /// 1.The param of renderer is nullptr;
    /// 2.The param of volume is nullptr.
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_AudioRenderer_GetVolume(
        renderer: *mut OH_AudioRenderer,
        volume: *mut f32,
    ) -> OH_AudioStream_Result;
    /// Set mark position on current renderer. Calling this function will overwrite the mark postion which has already
    /// set.
    ///
    ///
    /// Available since API-level: 12
    ///
    /// # Arguments
    ///
    /// * `renderer` - Renderer generated by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `samplePos` - Mark position in samples.
    ///
    /// * `callback` - Callback used when the samplePos has reached.
    ///
    /// * `userData` - User data which is passed by user.
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`]:
    /// 1.The param of renderer is nullptr;
    /// 2.The param of samplePos invalid.
    /// [`AUDIOSTREAM_ERROR_ILLEGAL_STATE`] Execution status exception.
    /// [`AUDIOSTREAM_ERROR_SYSTEM`] An system error has occurred.
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_AudioRenderer_SetMarkPosition(
        renderer: *mut OH_AudioRenderer,
        samplePos: u32,
        callback: OH_AudioRenderer_OnMarkReachedCallback,
        userData: *mut ::core::ffi::c_void,
    ) -> OH_AudioStream_Result;
    /// Cancel mark which has set by [`#OH_AudioRenderer_SetMarkPosition`].
    ///
    ///
    /// Available since API-level: 12
    ///
    /// # Arguments
    ///
    /// * `renderer` - Renderer generated by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`] The param of renderer is nullptr.
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_AudioRenderer_CancelMark(renderer: *mut OH_AudioRenderer) -> OH_AudioStream_Result;
    /// Gets the underflow count on this stream.
    ///
    ///
    /// Available since API-level: 12
    ///
    /// # Arguments
    ///
    /// * `renderer` - Renderer generated by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `count` - Pointer to a variable to receive the underflow count number.
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`]:
    /// 1.The param of renderer is nullptr;
    /// 2.The param of count is nullptr.
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_AudioRenderer_GetUnderflowCount(
        renderer: *mut OH_AudioRenderer,
        count: *mut u32,
    ) -> OH_AudioStream_Result;
    /// Query the channel layout of the renderer client.
    ///
    ///
    /// Available since API-level: 12
    ///
    /// # Arguments
    ///
    /// * `renderer` - Reference created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `channelLayout` - Pointer to a variable to receive the channel layout
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`] The param of renderer is nullptr.
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_AudioRenderer_GetChannelLayout(
        renderer: *mut OH_AudioRenderer,
        channelLayout: *mut OH_AudioChannelLayout,
    ) -> OH_AudioStream_Result;
    /// Query current audio effect mode.
    ///
    ///
    /// Available since API-level: 12
    ///
    /// # Arguments
    ///
    /// * `renderer` - Reference created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `effectMode` - Pointer to a variable to receive current audio effect mode
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`] The param of renderer is nullptr.
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_AudioRenderer_GetEffectMode(
        renderer: *mut OH_AudioRenderer,
        effectMode: *mut OH_AudioStream_AudioEffectMode,
    ) -> OH_AudioStream_Result;
    /// Set current audio effect mode.
    ///
    ///
    /// Available since API-level: 12
    ///
    /// # Arguments
    ///
    /// * `renderer` - Reference created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `effectMode` - Audio effect mode that will be set for the stream
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`] The param of renderer is nullptr.
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_AudioRenderer_SetEffectMode(
        renderer: *mut OH_AudioRenderer,
        effectMode: OH_AudioStream_AudioEffectMode,
    ) -> OH_AudioStream_Result;
    /// Get the privacy of this stream.
    ///
    ///
    /// Available since API-level: 12
    ///
    /// # Arguments
    ///
    /// * `renderer` - Renderer generated by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `privacy` - Pointer to a variable which receives the results.
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`] The param of renderer is nullptr.
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_AudioRenderer_GetRendererPrivacy(
        renderer: *mut OH_AudioRenderer,
        privacy: *mut OH_AudioStream_PrivacyType,
    ) -> OH_AudioStream_Result;
    /// Set silent and mix with other streams for this stream.
    ///
    /// # Arguments
    ///
    /// * `renderer` - Renderer generated by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `on` - The silent and mix with other streams mode.
    /// true: set the slient mode and mix with other streams.
    /// false: unset the slient mode, current stream will trigger the audio focus internally.
    ///
    /// # Returns
    ///
    /// * result code for this function.
    /// [`#AUDIOSTREAM_SUCCESS`] succeed in setting to the silent and mix with other streams.
    /// [`#AUDIOSTREAM_ERROR_ILLEGAL_STATE`] this stream is not allowed to set/unset the silent mode.
    ///
    /// Available since API-level: 12
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_AudioRenderer_SetSilentModeAndMixWithOthers(
        renderer: *mut OH_AudioRenderer,
        on: bool,
    ) -> OH_AudioStream_Result;
    /// Query silent and mix with other streams status for this stream.
    ///
    /// # Arguments
    ///
    /// * `renderer` - Renderer generated by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `on` - Pointer to the silent and mix with other streams status.
    ///
    /// # Returns
    ///
    /// * result code for this function.
    /// [`#AUDIOSTREAM_SUCCESS`] succeed in getting silent and mix with other streams status
    /// [`#AUDIOSTREAM_ERROR_SYSTEM`] system error when calling this function.
    ///
    /// Available since API-level: 12
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_AudioRenderer_GetSilentModeAndMixWithOthers(
        renderer: *mut OH_AudioRenderer,
        on: *mut bool,
    ) -> OH_AudioStream_Result;
    /// Temporarily changes the current audio device
    /// This function applys on audiorenderers whose StreamUsage are
    /// STREAM_USAGE_VOICE_COMMUNICATIN/STREAM_USAGE_VIDEO_COMMUNICATION/STREAM_USAGE_VOICE_MESSAGE.
    /// Setting the device will only takes effect if no other accessory such as headphones are in use.
    ///
    /// # Arguments
    ///
    /// * `renderer` - Renderer generated by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `deviceType` - The target device. The available deviceTypes are:
    /// EARPIECE: Built-in earpiece
    /// SPEAKER: Built-in speaker
    /// DEFAULT: System default output device
    ///
    /// # Returns
    ///
    /// * result code for this function.
    /// [`#AUDIOSTREAM_SUCCESS`] succeed in setting the default output device
    /// [`#AUDIOSTREAM_ERROR_INVALID_PARAM`]:
    /// 1.The param of renderer is nullptr;
    /// 2.The param of deviceType is not valid
    /// [`#AUDIOSTREAM_ERROR_ILLEGAL_STATE`] This audiorenderer can not reset the output device
    /// [`#AUDIOSTREAM_ERROR_SYSTEM`] system error when calling this function.
    ///
    /// Available since API-level: 12
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_AudioRenderer_SetDefaultOutputDevice(
        renderer: *mut OH_AudioRenderer,
        deviceType: OH_AudioDevice_Type,
    ) -> OH_AudioStream_Result;
    /// Query the timestamp at which a particular frame was presented in clock monotonic timebase,
    /// the frame at the returned position was just committed to hardware. This is often used in
    /// video synchronization and recording stream alignment.
    ///
    /// Position is 0 and timestamp is fixed until stream really runs and frame is committed. Position
    /// will also be reset while flush function is called. When a audio route change happens, like in
    /// device or output type change situations, the position may also be reset but timestamp remains
    /// monotonically increasing.
    /// So it is better to use the values until they becomes regularly after the change.
    /// This interface also adapts to playback speed change. For example, the increseing speed for
    /// position will be double for 2x speed playback.
    ///
    /// For video synchronization usage, there is a best practice document for developer to refer
    /// **AV Synchronization**.
    ///
    /// # Arguments
    ///
    /// * `renderer` - Reference created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `framePosition` - Pointer to a variable to receive the position
    ///
    /// * `timestamp` - Pointer to a variable to receive the timestamp
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`]:
    /// 1.The param of renderer is nullptr;
    /// 2.The param of framePosition or timestamp is nullptr;
    /// [`AUDIOSTREAM_ERROR_ILLEGAL_STATE`]:
    /// 1.Only running state is legal for getting audio timestamp.
    /// [`AUDIOSTREAM_ERROR_SYSTEM`]:
    /// 1.Crash or blocking occurs in system process.
    /// 2.Other unexpected error from internal system.
    ///
    /// Available since API-level: 15
    #[cfg(feature = "api-15")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
    pub fn OH_AudioRenderer_GetAudioTimestampInfo(
        renderer: *mut OH_AudioRenderer,
        framePosition: *mut i64,
        timestamp: *mut i64,
    ) -> OH_AudioStream_Result;
    /// Gets audio renderer running status, check if it works in fast status.
    ///
    /// # Arguments
    ///
    /// * `renderer` - Reference created by OH_AudioStreamBuilder_GenerateRenderer.
    ///
    /// * `status` - Pointer to a variable to receive the status.
    ///
    /// # Returns
    ///
    /// * [`AUDIOSTREAM_SUCCESS`] if the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`] the param of renderer is nullptr.
    /// [`AUDIOSTREAM_ERROR_ILLEGAL_STATE`] function called in invalid state, only available before release state.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_AudioRenderer_GetFastStatus(
        renderer: *mut OH_AudioRenderer,
        status: *mut OH_AudioStream_FastStatus,
    ) -> OH_AudioStream_Result;
    /// Sets the loudness gain of current renderer.
    /// The default loudness gain is 0.0dB. The stream usage of the audio renderer must be
    /// [`OH_AudioStream_Usage#AUDIOSTREAM_USAGE_MUSIC`], [`OH_AudioStream_Usage#AUDIOSTREAM_USAGE_MOVIE`]
    /// or [`OH_AudioStream_Usage#AUDIOSTREAM_USAGE_AUDIOBOOK`].
    /// The latency mode of the audio renderer must be [`OH_AudioStream_LatencyMode#AUDIOSTREAM_LATENCY_MODE_NORMAL`].
    /// If AudioRenderer is played through the high-resolution pipe, this operation is not supported.
    ///
    /// # Arguments
    ///
    /// * `renderer` - AudioRender created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `loudnessGain` - Loudness gain to set which changes from -90.0 to 24.0, expressing in dB.
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`]:
    /// 1.The param of renderer is nullptr or not supported to set gain;
    /// 2.The param of loudnessGain is invalid.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_AudioRenderer_SetLoudnessGain(
        renderer: *mut OH_AudioRenderer,
        loudnessGain: f32,
    ) -> OH_AudioStream_Result;
    /// Get the loudness gain of current renderer.
    ///
    /// # Arguments
    ///
    /// * `renderer` - AudioRender created by OH_AudioStreamBuilder_GenerateRenderer()
    ///
    /// * `loudnessGain` - Pointer to a variable to receive the loudness gain.
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`AUDIOSTREAM_ERROR_INVALID_PARAM`]:
    /// 1.The param of renderer is nullptr;
    /// 2.The param of loudnessGain is nullptr.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_AudioRenderer_GetLoudnessGain(
        renderer: *mut OH_AudioRenderer,
        loudnessGain: *mut f32,
    ) -> OH_AudioStream_Result;
    /// Gets the estimated audio latency in milliseconds for current audio route. For wireless connection
    /// audio devices cases, the latency result may not be very accurate, system just provides it for reference only.
    /// The real-time buffer status is also not taken into consideration, so it is recommended to get it only at the
    /// beginning of audio playback, and do not call th function very frequently because it may be blocked by route
    /// change.
    /// Applications should still use [`#OH_AudioRenderer_GetAudioTimestampInfo`] to handle A/V sync after audio
    /// data has been output to hardware.
    ///
    /// # Arguments
    ///
    /// * `renderer` - AudioRenderer created by OH_AudioStreamBuilder_GenerateRenderer().
    ///
    /// * `type` - Type of audio latency to get.
    ///
    /// * `latencyMs` - Pointer to a variable to receive the latency in milliseconds.
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`#AUDIOSTREAM_SUCCESS`] If the execution is successful.
    /// [`#AUDIOSTREAM_ERROR_INVALID_PARAM`]
    /// 1.The param of renderer is nullptr.
    /// 2.The param of latencyMs is nullptr.
    /// 3.The param of type is invalid value.
    /// [`#AUDIOSTREAM_ERROR_SYSTEM`] System internal error, like audio service error.
    ///
    /// Available since API-level: 23
    #[cfg(feature = "api-23")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-23")))]
    pub fn OH_AudioRenderer_GetLatency(
        renderer: *mut OH_AudioRenderer,
        type_: OH_AudioStream_LatencyType,
        latencyMs: *mut i32,
    ) -> OH_AudioStream_Result;
}