ohos-media-sys 0.1.0

Raw Bindings to the media framework on 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
// automatically generated by rust-bindgen 0.71.1

#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(deprecated)]
#[cfg(feature = "api-20")]
#[allow(unused_imports)]
use crate::avcodec_base::OH_AVDataSourceExt;
#[allow(unused_imports)]
use crate::averrors::OH_AVErrCode;
use crate::avplayer_base::{
    AVPlaybackSpeed, AVPlayerCallback, AVPlayerSeekMode, AVPlayerState, OH_AVPlayer,
};
#[cfg(feature = "api-12")]
use crate::avplayer_base::{OH_AVPlayerOnErrorCallback, OH_AVPlayerOnInfoCallback};
use ohos_sys_opaque_types::OHNativeWindow;

/// MediaKeySession field.
///
/// Available since API-level: 12
///
/// Version: 1.0
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
#[repr(C)]
pub struct MediaKeySession {
    _unused: [u8; 0],
}
/// DRM_MediaKeySystemInfo field.
///
/// Available since API-level: 12
///
/// Version: 1.0
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
#[repr(C)]
pub struct DRM_MediaKeySystemInfo {
    _unused: [u8; 0],
}
/// Call back will be invoked when updating DRM information.
/// # Arguments
///
/// * `player` - Player instance.
///
/// * `mediaKeySystemInfo` - DRM information.
///
/// # Returns
///
/// * void
///
/// Available since API-level: 12
///
/// Version: 1.0
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
pub type Player_MediaKeySystemInfoCallback = ::core::option::Option<
    unsafe extern "C" fn(player: *mut OH_AVPlayer, mediaKeySystemInfo: *mut DRM_MediaKeySystemInfo),
>;
extern "C" {
    /// Create a player
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    ///
    /// # Returns
    ///
    /// * Returns a pointer to an OH_AVPlayer instance for success, nullptr for failure
    /// Possible failure causes: 1. failed to PlayerFactory::CreatePlayer. 2. failed to new PlayerObject.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_Create() -> *mut OH_AVPlayer;
    /// Sets the playback source for the player. The corresponding source can be http url
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// * `url` - Indicates the playback source.
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr, url is null or player setUrlSource failed.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_SetURLSource(
        player: *mut OH_AVPlayer,
        url: *const ::core::ffi::c_char,
    ) -> OH_AVErrCode;
    /// Sets the playback media file descriptor source for the player.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// * `fd` - Indicates the file descriptor of media source.
    ///
    /// * `offset` - Indicates the offset of media source in file descriptor.
    ///
    /// * `size` - Indicates the size of media source.
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr or player setFdSource failed.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_SetFDSource(
        player: *mut OH_AVPlayer,
        fd: i32,
        offset: i64,
        size: i64,
    ) -> OH_AVErrCode;
    /// Prepares the playback environment and buffers media data asynchronous.
    ///
    /// This function must be called after [`SetSource`].
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr or player Prepare failed.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_Prepare(player: *mut OH_AVPlayer) -> OH_AVErrCode;
    /// Start playback.
    ///
    /// This function must be called after [`Prepare`]. If the player state is <b>Prepared</b>,
    /// this function is called to start playback.
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr or player Play failed.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_Play(player: *mut OH_AVPlayer) -> OH_AVErrCode;
    /// Pauses playback.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr or player Pause failed.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_Pause(player: *mut OH_AVPlayer) -> OH_AVErrCode;
    /// Stop playback.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr or player Stop failed.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_Stop(player: *mut OH_AVPlayer) -> OH_AVErrCode;
    /// Restores the player to the initial state.
    ///
    /// After the function is called, add a playback source by calling [`SetSource`],
    /// call [`Play`] to start playback again after [`Prepare`] is called.
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr or player Reset failed.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_Reset(player: *mut OH_AVPlayer) -> OH_AVErrCode;
    /// Releases player resources async
    ///
    /// Asynchronous release guarantees the performance
    /// but cannot ensure whether the surfacebuffer is released.
    /// The caller needs to ensure the life cycle security of the surface
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr or player Release failed.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_Release(player: *mut OH_AVPlayer) -> OH_AVErrCode;
    /// Releases player resources sync
    ///
    /// Synchronous release ensures effective release of surfacebuffer
    /// but this interface will take a long time (when the engine is not idle state)
    /// requiring the caller to design an asynchronous mechanism by itself
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr or player ReleaseSync failed.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_ReleaseSync(player: *mut OH_AVPlayer) -> OH_AVErrCode;
    /// Sets the volume of the player.
    ///
    /// This function can be used during playback or pause. The value <b>0</b> indicates no sound,
    /// and <b>1</b> indicates the original volume. If no audio device is started or no audio
    /// stream exists, the value <b>-1</b> is returned.
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// * `leftVolume` - Indicates the target volume of the left audio channel to set,
    /// ranging from 0 to 1. each step is 0.01.
    ///
    /// * `rightVolume` - Indicates the target volume of the right audio channel to set,
    /// ranging from 0 to 1. each step is 0.01.
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr or player SetVolume failed.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_SetVolume(
        player: *mut OH_AVPlayer,
        leftVolume: f32,
        rightVolume: f32,
    ) -> OH_AVErrCode;
    /// Changes the playback position.
    ///
    /// This function can be used during play or pause.
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// * `mSeconds` - Indicates the target playback position, accurate to milliseconds.
    ///
    /// * `mode` - Indicates the player seek mode. For details, see [`AVPlayerSeekMode`].
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr or player Seek failed.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_Seek(
        player: *mut OH_AVPlayer,
        mSeconds: i32,
        mode: AVPlayerSeekMode,
    ) -> OH_AVErrCode;
    /// Obtains the playback position, accurate to millisecond.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// * `currentTime` - Indicates the playback position.
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr or player GetCurrentTime failed.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_GetCurrentTime(
        player: *mut OH_AVPlayer,
        currentTime: *mut i32,
    ) -> OH_AVErrCode;
    /// get the video width.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// * `videoWidth` - The video width
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_GetVideoWidth(
        player: *mut OH_AVPlayer,
        videoWidth: *mut i32,
    ) -> OH_AVErrCode;
    /// get the video height.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// * `videoHeight` - The video height
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_GetVideoHeight(
        player: *mut OH_AVPlayer,
        videoHeight: *mut i32,
    ) -> OH_AVErrCode;
    /// set the player playback rate
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// * `speed` - the rate mode [`AVPlaybackSpeed`] which can set.
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr or player SetPlaybackSpeed failed.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_SetPlaybackSpeed(
        player: *mut OH_AVPlayer,
        speed: AVPlaybackSpeed,
    ) -> OH_AVErrCode;
    /// Sets playback rate.
    /// Supported states: prepared/playing/paused/completed.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to OH_AVPlayer instance
    ///
    /// * `rate` - Playback rate, valid range is 0.125 ~ 4.
    ///
    /// # Returns
    ///
    /// * OH_AVErrCode Operation result code
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_OPERATE_NOT_PERMIT`] if called in unsupported state or during live streaming.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr, or rate is out of range.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_AVPlayer_SetPlaybackRate(player: *mut OH_AVPlayer, rate: f32) -> OH_AVErrCode;
    /// get the current player playback rate
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// * `speed` - the rate mode [`AVPlaybackSpeed`] which can get.
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr or player GetPlaybackSpeed failed.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_GetPlaybackSpeed(
        player: *mut OH_AVPlayer,
        speed: *mut AVPlaybackSpeed,
    ) -> OH_AVErrCode;
    /// set the bit rate use for hls player
    ///
    /// the playback bitrate expressed in bits per second, expressed in bits per second,
    /// which is only valid for HLS protocol network flow. By default,
    /// the player will select the appropriate bit rate and speed according to the network connection.
    /// report the effective bit rate linked list by "INFO_TYPE_BITRATE_COLLECT"
    /// set and select the specified bit rate, and select the bit rate that is less than and closest
    /// to the specified bit rate for playback. When ready, read it to query the currently selected bit rate.
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// * `bitRate` - the bit rate, The unit is bps.
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr or player SelectBitRate failed.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_SelectBitRate(player: *mut OH_AVPlayer, bitRate: u32) -> OH_AVErrCode;
    /// Method to set the surface.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// * `window` - A pointer to a OHNativeWindow instance, see [`OHNativeWindow`]
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr, input window is nullptr,
    /// or player SetVideoSurface failed.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_SetVideoSurface(
        player: *mut OH_AVPlayer,
        window: *mut OHNativeWindow,
    ) -> OH_AVErrCode;
    /// Obtains the total duration of media files, accurate to milliseconds.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// * `duration` - Indicates the total duration of media files.
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr or player GetDuration failed.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_GetDuration(player: *mut OH_AVPlayer, duration: *mut i32) -> OH_AVErrCode;
    /// get current playback state.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// * `state` - the current playback state
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_GetState(
        player: *mut OH_AVPlayer,
        state: *mut AVPlayerState,
    ) -> OH_AVErrCode;
    /// Checks whether the player is playing.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// # Returns
    ///
    /// * Returns true if the playback is playing; Return false if not or input player is nullptr.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_IsPlaying(player: *mut OH_AVPlayer) -> bool;
    /// Returns the value whether single looping is enabled or not .
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// # Returns
    ///
    /// * Returns true if the playback is single looping; Return false if not or input player is nullptr.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_IsLooping(player: *mut OH_AVPlayer) -> bool;
    /// Enables single looping of the media playback.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// * `loop` - The switch to set loop
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr or player SetLooping failed.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_SetLooping(player: *mut OH_AVPlayer, loop_: bool) -> OH_AVErrCode;
    /// Method to set player callback.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// * `callback` - object pointer.
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr, callback.onInfo or callback.onError is null,
    /// or player SetPlayerCallback failed.
    ///
    /// Available since API-level: 11
    ///
    /// **Deprecated** since 12
    /// [`OH_AVPlayer_SetPlayerOnInfoCallback`] [`OH_AVPlayer_SetPlayerOnErrorCallback`]
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    #[deprecated(since = "12")]
    pub fn OH_AVPlayer_SetPlayerCallback(
        player: *mut OH_AVPlayer,
        callback: AVPlayerCallback,
    ) -> OH_AVErrCode;
    /// Select audio or subtitle track.
    ///
    /// By default, the first audio stream with data is played, and the subtitle track is not played.
    /// After the settings take effect, the original track will become invalid. Please set subtitles
    /// in prepared/playing/paused/completed state and set audio tracks in prepared state.
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// * `index` - Track index
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr or player SelectTrack failed.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_SelectTrack(player: *mut OH_AVPlayer, index: i32) -> OH_AVErrCode;
    /// Deselect the current audio or subtitle track.
    ///
    /// After audio is deselected, the default track will be played, and after subtitles are deselected,
    /// they will not be played. Please set subtitles in prepared/playing/paused/completed state and set
    /// audio tracks in prepared state.
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// * `index` - Track index
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr or player DeselectTrack failed.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_DeselectTrack(player: *mut OH_AVPlayer, index: i32) -> OH_AVErrCode;
    /// Obtain the currently effective track index.
    ///
    /// Please get it in the prepared/playing/paused/completed state.
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// * `trackType` - Media type.
    ///
    /// * `index` - Track index
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr or player GetCurrentTrack failed.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVPlayer_GetCurrentTrack(
        player: *mut OH_AVPlayer,
        trackType: i32,
        index: *mut i32,
    ) -> OH_AVErrCode;
    /// Method to set player media key system info callback.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// * `callback` - object pointer.
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr, MediaKeySystemInfoCallback is null
    /// player SetDrmSystemInfoCallback failed, SetDrmSystemInfoCallback failed or SetDrmSystemInfoCallback failed.
    ///
    /// Available since API-level: 12
    ///
    /// Version: 1.0
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_AVPlayer_SetMediaKeySystemInfoCallback(
        player: *mut OH_AVPlayer,
        callback: Player_MediaKeySystemInfoCallback,
    ) -> OH_AVErrCode;
    /// Obtains media key system info to create media key session.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// * `mediaKeySystemInfo` - Media key system info.
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr or no memory.
    ///
    /// Available since API-level: 12
    ///
    /// Version: 1.0
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_AVPlayer_GetMediaKeySystemInfo(
        player: *mut OH_AVPlayer,
        mediaKeySystemInfo: *mut DRM_MediaKeySystemInfo,
    ) -> OH_AVErrCode;
    /// Set decryption info.
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance
    ///
    /// * `mediaKeySession` - A media key session instance with decryption function.
    ///
    /// * `secureVideoPath` - Require secure decoder or not.
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr or player SetDecryptConfig failed.
    ///
    /// Available since API-level: 12
    ///
    /// Version: 1.0
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_AVPlayer_SetDecryptionConfig(
        player: *mut OH_AVPlayer,
        mediaKeySession: *mut MediaKeySession,
        secureVideoPath: bool,
    ) -> OH_AVErrCode;
    /// Method to set player information notify callback.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance.
    ///
    /// * `callback` - Pointer to callback function, nullptr indicates unregister callback.
    ///
    /// * `userData` - Pointer to user specific data.
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is null or player SetOnInfoCallback failed.
    ///
    /// Available since API-level: 12
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_AVPlayer_SetOnInfoCallback(
        player: *mut OH_AVPlayer,
        callback: OH_AVPlayerOnInfoCallback,
        userData: *mut ::core::ffi::c_void,
    ) -> OH_AVErrCode;
    /// Method to set player error callback.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVPlayer
    /// # Arguments
    ///
    /// * `player` - Pointer to an OH_AVPlayer instance.
    ///
    /// * `callback` - Pointer to callback function, nullptr indicates unregister callback.
    ///
    /// * `userData` - Pointer to user specific data.
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is null or player SetOnErrorCallback failed.
    ///
    /// Available since API-level: 12
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_AVPlayer_SetOnErrorCallback(
        player: *mut OH_AVPlayer,
        callback: OH_AVPlayerOnErrorCallback,
        userData: *mut ::core::ffi::c_void,
    ) -> OH_AVErrCode;
    /// Sets the loudness gain of current media. The default gain is 0.0 dB.
    /// This API can be called only when the AVPlayer is in the prepared, playing, paused completed or stopped state.
    /// The default loudness gain is 0.0dB. The stream usage of the player 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
    ///
    /// * `player` - Pointer to an <b>OH_AVPlayer</b> instance.
    ///
    /// * `loudnessGain` - Loudness gain to set which changes from -90.0 to 24.0, expressing in dB.
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AV_ERR_OK`] If the execution is successful.
    /// [`AV_ERR_INVALID_VAL`]:The value of <b>player</b> is a null pointer or
    /// the value of <b>loudnessGain</b> is invalid.
    /// [`AV_ERR_INVALID_STATE`]: The function is called in an incorrect state. or the stream usage of
    /// audioRendererInfo is not one of [`StreamUsage#STREAM_USAGE_MUSIC`],
    /// [`StreamUsage#STREAM_USAGE_MOVIE`] or [`StreamUsage#STREAM_USAGE_AUDIOBOOK`].
    /// [`AV_ERR_SERVICE_DIED`]: System errors such as media service breakdown.
    ///
    /// Available since API-level: 21
    #[cfg(feature = "api-21")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-21")))]
    pub fn OH_AVPlayer_SetLoudnessGain(player: *mut OH_AVPlayer, loudnessGain: f32)
        -> OH_AVErrCode;
    /// Set the media source of the player. The data of this media source is provided by the application.
    /// # Arguments
    ///
    /// {OH_AVPlayer*} player Pointer to an OH_AVPlayer instance
    ///
    /// {OH_AVDataSourceExt*} datasrc Pointer to an OH_AVDataSourceExt instance
    ///
    /// {void*} userData The handle passed in by the user is used to pass in the callback
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input player is nullptr or datasrc is nullptr.
    ///
    /// Available since API-level: 21
    #[cfg(feature = "api-21")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-21")))]
    pub fn OH_AVPlayer_SetDataSource(
        player: *mut OH_AVPlayer,
        datasrc: *mut OH_AVDataSourceExt,
        userData: *mut ::core::ffi::c_void,
    ) -> OH_AVErrCode;
}