1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 /** 17 * @addtogroup OHAudio 18 * @{ 19 * 20 * @brief Provide the definition of the C interface for the audio module. 21 * 22 * @syscap SystemCapability.Multimedia.Audio.Core 23 * 24 * @since 10 25 * @version 1.0 26 */ 27 28 /** 29 * @file native_audiostream_base.h 30 * 31 * @brief Declare the underlying data structure. 32 * 33 * @library libohaudio.so 34 * @syscap SystemCapability.Multimedia.Audio.Core 35 * @kit AudioKit 36 * @since 10 37 * @version 1.0 38 */ 39 40 #ifndef NATIVE_AUDIOSTREAM_BASE_H 41 #define NATIVE_AUDIOSTREAM_BASE_H 42 43 #include <stdint.h> 44 45 #ifdef __cplusplus 46 extern "C" { 47 #endif 48 49 struct OH_AudioDeviceDescriptorArray; 50 51 /** 52 * @brief Define the result of the function execution. 53 * 54 * @since 10 55 */ 56 typedef enum { 57 /** 58 * @error The call was successful. 59 * 60 * @since 10 61 */ 62 AUDIOSTREAM_SUCCESS = 0, 63 64 /** 65 * @error This means that the function was executed with an invalid input parameter. 66 * 67 * @since 10 68 */ 69 AUDIOSTREAM_ERROR_INVALID_PARAM = 1, 70 71 /** 72 * @error Execution status exception. 73 * 74 * @since 10 75 */ 76 AUDIOSTREAM_ERROR_ILLEGAL_STATE = 2, 77 78 /** 79 * @error An system error has occurred. 80 * 81 * @since 10 82 */ 83 AUDIOSTREAM_ERROR_SYSTEM = 3 84 } OH_AudioStream_Result; 85 86 /** 87 * @brief Define the audio stream type. 88 * 89 * @since 10 90 */ 91 typedef enum { 92 /** 93 * The type for audio stream is renderer. 94 * 95 * @since 10 96 */ 97 AUDIOSTREAM_TYPE_RENDERER = 1, 98 99 /** 100 * The type for audio stream is capturer. 101 * 102 * @since 10 103 */ 104 AUDIOSTREAM_TYPE_CAPTURER = 2 105 } OH_AudioStream_Type; 106 107 /** 108 * @brief Define the audio stream sample format. 109 * 110 * @since 10 111 */ 112 typedef enum { 113 /** 114 * Unsigned 8 format. 115 * 116 * @since 10 117 */ 118 AUDIOSTREAM_SAMPLE_U8 = 0, 119 /** 120 * Signed 16 bit integer, little endian. 121 * 122 * @since 10 123 */ 124 AUDIOSTREAM_SAMPLE_S16LE = 1, 125 /** 126 * Signed 24 bit integer, little endian. 127 * 128 * @since 10 129 */ 130 AUDIOSTREAM_SAMPLE_S24LE = 2, 131 /** 132 * Signed 32 bit integer, little endian. 133 * 134 * @since 10 135 */ 136 AUDIOSTREAM_SAMPLE_S32LE = 3, 137 /** 138 * 32 bit IEEE floating point, little endian. 139 * 140 * @since 16 141 */ 142 AUDIOSTREAM_SAMPLE_F32LE = 4, 143 } OH_AudioStream_SampleFormat; 144 145 /** 146 * @brief Define the audio encoding type. 147 * 148 * @since 10 149 */ 150 typedef enum { 151 /** 152 * PCM encoding type. 153 * 154 * @since 10 155 */ 156 AUDIOSTREAM_ENCODING_TYPE_RAW = 0, 157 /** 158 * AudioVivid encoding type. 159 * 160 * @since 12 161 */ 162 AUDIOSTREAM_ENCODING_TYPE_AUDIOVIVID = 1, 163 } OH_AudioStream_EncodingType; 164 165 /** 166 * @brief Define the audio stream usage. 167 * Audio stream usage is used to describe what work scenario 168 * the current stream is used for. 169 * 170 * @since 10 171 */ 172 typedef enum { 173 /** 174 * Unknown usage. 175 * 176 * @since 10 177 */ 178 AUDIOSTREAM_USAGE_UNKNOWN = 0, 179 /** 180 * Music usage. 181 * 182 * @since 10 183 */ 184 AUDIOSTREAM_USAGE_MUSIC = 1, 185 /** 186 * Voice communication usage. 187 * 188 * @since 10 189 */ 190 AUDIOSTREAM_USAGE_VOICE_COMMUNICATION = 2, 191 /** 192 * Voice assistant usage. 193 * 194 * @since 10 195 */ 196 AUDIOSTREAM_USAGE_VOICE_ASSISTANT = 3, 197 /** 198 * Alarm usage. 199 * 200 * @since 10 201 */ 202 AUDIOSTREAM_USAGE_ALARM = 4, 203 /** 204 * Voice message usage. 205 * 206 * @since 10 207 */ 208 AUDIOSTREAM_USAGE_VOICE_MESSAGE = 5, 209 /** 210 * Ringtone usage. 211 * 212 * @since 10 213 */ 214 AUDIOSTREAM_USAGE_RINGTONE = 6, 215 /** 216 * Notification usage. 217 * 218 * @since 10 219 */ 220 AUDIOSTREAM_USAGE_NOTIFICATION = 7, 221 /** 222 * Accessibility usage, such as screen reader. 223 * 224 * @since 10 225 */ 226 AUDIOSTREAM_USAGE_ACCESSIBILITY = 8, 227 /** 228 * Movie or video usage. 229 * 230 * @since 10 231 */ 232 AUDIOSTREAM_USAGE_MOVIE = 10, 233 /** 234 * Game sound effect usage. 235 * 236 * @since 10 237 */ 238 AUDIOSTREAM_USAGE_GAME = 11, 239 /** 240 * Audiobook usage. 241 * 242 * @since 10 243 */ 244 AUDIOSTREAM_USAGE_AUDIOBOOK = 12, 245 /** 246 * Navigation usage. 247 * 248 * @since 10 249 */ 250 AUDIOSTREAM_USAGE_NAVIGATION = 13, 251 /** 252 * Video call usage. 253 * 254 * @since 12 255 */ 256 AUDIOSTREAM_USAGE_VIDEO_COMMUNICATION = 17, 257 } OH_AudioStream_Usage; 258 259 /** 260 * @brief Define the audio latency mode. 261 * 262 * @since 10 263 */ 264 typedef enum { 265 /** 266 * This is a normal audio scene. 267 * 268 * @since 10 269 */ 270 AUDIOSTREAM_LATENCY_MODE_NORMAL = 0, 271 /** 272 * This is a low latency audio scene. 273 * 274 * @since 10 275 */ 276 AUDIOSTREAM_LATENCY_MODE_FAST = 1 277 } OH_AudioStream_LatencyMode; 278 279 /** 280 * @brief Define the audio stream volume mode. 281 * 282 * @since 18 283 */ 284 typedef enum { 285 /** 286 * Indicates this audio stream volume will be affected by system volume, also the default behavior. 287 * 288 * @since 18 289 */ 290 AUDIOSTREAM_VOLUMEMODE_SYSTEM_GLOBAL = 0, 291 /** 292 * Indicates this audio stream volume will be affected by app's individual volume percentage which set by yourself 293 * using the app volume api. 294 * 295 * @since 18 296 */ 297 AUDIOSTREAM_VOLUMEMODE_APP_INDIVIDUAL = 1 298 } OH_AudioStream_VolumeMode; 299 300 /** 301 * @brief Define the audio event. 302 * 303 * @since 10 304 */ 305 typedef enum { 306 /** 307 * The routing of the audio has changed. 308 * 309 * @since 10 310 */ 311 AUDIOSTREAM_EVENT_ROUTING_CHANGED = 0 312 } OH_AudioStream_Event; 313 314 /** 315 * @brief The audio stream states 316 * 317 * @since 10 318 */ 319 typedef enum { 320 /** 321 * The invalid state. 322 * 323 * @since 10 324 */ 325 AUDIOSTREAM_STATE_INVALID = -1, 326 /** 327 * Create new instance state. 328 * 329 * @since 10 330 */ 331 AUDIOSTREAM_STATE_NEW = 0, 332 /** 333 * The prepared state. 334 * 335 * @since 10 336 */ 337 AUDIOSTREAM_STATE_PREPARED = 1, 338 /** 339 * The stream is running. 340 * 341 * @since 10 342 */ 343 AUDIOSTREAM_STATE_RUNNING = 2, 344 /** 345 * The stream is stopped. 346 * 347 * @since 10 348 */ 349 AUDIOSTREAM_STATE_STOPPED = 3, 350 /** 351 * The stream is released. 352 * 353 * @since 10 354 */ 355 AUDIOSTREAM_STATE_RELEASED = 4, 356 /** 357 * The stream is paused. 358 * 359 * @since 10 360 */ 361 AUDIOSTREAM_STATE_PAUSED = 5, 362 } OH_AudioStream_State; 363 364 /** 365 * @brief Defines the audio interrupt type. 366 * 367 * @since 10 368 */ 369 typedef enum { 370 /** 371 * Force type, system change audio state. 372 * 373 * @since 10 374 */ 375 AUDIOSTREAM_INTERRUPT_FORCE = 0, 376 /** 377 * Share type, application change audio state. 378 * 379 * @since 10 380 */ 381 AUDIOSTREAM_INTERRUPT_SHARE = 1 382 } OH_AudioInterrupt_ForceType; 383 384 /** 385 * @brief Defines the audio interrupt hint type. 386 * 387 * @since 10 388 */ 389 typedef enum { 390 /** 391 * None. 392 * 393 * @since 10 394 */ 395 AUDIOSTREAM_INTERRUPT_HINT_NONE = 0, 396 /** 397 * Resume the stream. 398 * 399 * @since 10 400 */ 401 AUDIOSTREAM_INTERRUPT_HINT_RESUME = 1, 402 /** 403 * Pause the stream. 404 * 405 * @since 10 406 */ 407 AUDIOSTREAM_INTERRUPT_HINT_PAUSE = 2, 408 /** 409 * Stop the stream. 410 * 411 * @since 10 412 */ 413 AUDIOSTREAM_INTERRUPT_HINT_STOP = 3, 414 /** 415 * Ducked the stream. 416 * 417 * @since 10 418 */ 419 AUDIOSTREAM_INTERRUPT_HINT_DUCK = 4, 420 /** 421 * Unducked the stream. 422 * 423 * @since 10 424 */ 425 AUDIOSTREAM_INTERRUPT_HINT_UNDUCK = 5 426 } OH_AudioInterrupt_Hint; 427 428 /** 429 * @brief Defines the audio source type. 430 * 431 * @since 10 432 */ 433 typedef enum { 434 /** 435 * Invalid type. 436 * 437 * @since 10 438 */ 439 AUDIOSTREAM_SOURCE_TYPE_INVALID = -1, 440 /** 441 * Mic source type. 442 * 443 * @since 10 444 */ 445 AUDIOSTREAM_SOURCE_TYPE_MIC = 0, 446 /** 447 * Voice recognition source type. 448 * 449 * @since 10 450 */ 451 AUDIOSTREAM_SOURCE_TYPE_VOICE_RECOGNITION = 1, 452 /** 453 * Playback capture source type. 454 * 455 * @deprecated since 12 456 * @useinstead OH_AVScreenCapture in native interface. 457 * @since 10 458 */ 459 AUDIOSTREAM_SOURCE_TYPE_PLAYBACK_CAPTURE = 2, 460 /** 461 * Voice call source type. 462 * 463 * @permission ohos.permission.RECORD_VOICE_CALL 464 * @systemapi 465 * @since 11 466 */ 467 AUDIOSTREAM_SOURCE_TYPE_VOICE_CALL = 4, 468 /** 469 * Voice communication source type. 470 * 471 * @since 10 472 */ 473 AUDIOSTREAM_SOURCE_TYPE_VOICE_COMMUNICATION = 7, 474 /** 475 * Voice message source type. 476 * 477 * @since 12 478 */ 479 AUDIOSTREAM_SOURCE_TYPE_VOICE_MESSAGE = 10, 480 /** 481 * Camcorder source type. 482 * 483 * @since 13 484 */ 485 AUDIOSTREAM_SOURCE_TYPE_CAMCORDER = 13, 486 /** 487 * Unprocessed source type. 488 * 489 * @since 15 490 */ 491 AUDIOSTREAM_SOURCE_TYPE_UNPROCESSED = 14 492 } OH_AudioStream_SourceType; 493 494 /** 495 * Defines the audio interrupt mode. 496 * 497 * @since 12 498 */ 499 typedef enum { 500 /** 501 * Share mode 502 */ 503 AUDIOSTREAM_INTERRUPT_MODE_SHARE = 0, 504 /** 505 * Independent mode 506 */ 507 AUDIOSTREAM_INTERRUPT_MODE_INDEPENDENT = 1 508 } OH_AudioInterrupt_Mode; 509 510 /** 511 * @brief Defines the audio effect mode. 512 * 513 * @since 12 514 */ 515 typedef enum { 516 /** 517 * Audio Effect Mode effect none. 518 * 519 * @since 12 520 */ 521 EFFECT_NONE = 0, 522 /** 523 * Audio Effect Mode effect default. 524 * 525 * @since 12 526 */ 527 EFFECT_DEFAULT = 1, 528 } OH_AudioStream_AudioEffectMode; 529 530 /** 531 * @brief Declaring the audio stream builder. 532 * The instance of builder is used for creating audio stream. 533 * 534 * @since 10 535 */ 536 typedef struct OH_AudioStreamBuilderStruct OH_AudioStreamBuilder; 537 538 /** 539 * @brief Declaring the audio renderer stream. 540 * The instance of renderer stream is used for playing audio data. 541 * 542 * @since 10 543 */ 544 typedef struct OH_AudioRendererStruct OH_AudioRenderer; 545 546 /** 547 * @brief Declaring the audio capturer stream. 548 * The instance of renderer stream is used for capturing audio data. 549 * 550 * @since 10 551 */ 552 typedef struct OH_AudioCapturerStruct OH_AudioCapturer; 553 554 /** 555 * @brief Declaring the callback struct for renderer stream. 556 * 557 * @since 10 558 */ 559 typedef struct OH_AudioRenderer_Callbacks_Struct { 560 /** 561 * This function pointer will point to the callback function that 562 * is used to write audio data 563 * 564 * @since 10 565 */ 566 int32_t (*OH_AudioRenderer_OnWriteData)( 567 OH_AudioRenderer* renderer, 568 void* userData, 569 void* buffer, 570 int32_t length); 571 572 /** 573 * This function pointer will point to the callback function that 574 * is used to handle audio renderer stream events. 575 * 576 * @since 10 577 */ 578 int32_t (*OH_AudioRenderer_OnStreamEvent)( 579 OH_AudioRenderer* renderer, 580 void* userData, 581 OH_AudioStream_Event event); 582 583 /** 584 * This function pointer will point to the callback function that 585 * is used to handle audio interrupt events. 586 * 587 * @since 10 588 */ 589 int32_t (*OH_AudioRenderer_OnInterruptEvent)( 590 OH_AudioRenderer* renderer, 591 void* userData, 592 OH_AudioInterrupt_ForceType type, 593 OH_AudioInterrupt_Hint hint); 594 595 /** 596 * This function pointer will point to the callback function that 597 * is used to handle audio error result. 598 * 599 * @since 10 600 */ 601 int32_t (*OH_AudioRenderer_OnError)( 602 OH_AudioRenderer* renderer, 603 void* userData, 604 OH_AudioStream_Result error); 605 } OH_AudioRenderer_Callbacks; 606 607 /** 608 * @brief Declaring the callback struct for capturer stream. 609 * 610 * @since 10 611 */ 612 typedef struct OH_AudioCapturer_Callbacks_Struct { 613 /** 614 * This function pointer will point to the callback function that 615 * is used to read audio data. 616 * 617 * @since 10 618 */ 619 int32_t (*OH_AudioCapturer_OnReadData)( 620 OH_AudioCapturer* capturer, 621 void* userData, 622 void* buffer, 623 int32_t length); 624 625 /** 626 * This function pointer will point to the callback function that 627 * is used to handle audio capturer stream events. 628 * 629 * @since 10 630 */ 631 int32_t (*OH_AudioCapturer_OnStreamEvent)( 632 OH_AudioCapturer* capturer, 633 void* userData, 634 OH_AudioStream_Event event); 635 636 /** 637 * This function pointer will point to the callback function that 638 * is used to handle audio interrupt events. 639 * 640 * @since 10 641 */ 642 int32_t (*OH_AudioCapturer_OnInterruptEvent)( 643 OH_AudioCapturer* capturer, 644 void* userData, 645 OH_AudioInterrupt_ForceType type, 646 OH_AudioInterrupt_Hint hint); 647 648 /** 649 * This function pointer will point to the callback function that 650 * is used to handle audio error result. 651 * 652 * @since 10 653 */ 654 int32_t (*OH_AudioCapturer_OnError)( 655 OH_AudioCapturer* capturer, 656 void* userData, 657 OH_AudioStream_Result error); 658 } OH_AudioCapturer_Callbacks; 659 660 /** 661 * @brief Defines reason for device changes of one audio stream. 662 * 663 * @since 11 664 */ 665 typedef enum { 666 /* Unknown. */ 667 REASON_UNKNOWN = 0, 668 /* New Device available. */ 669 REASON_NEW_DEVICE_AVAILABLE = 1, 670 /* Old Device unavailable. Applications should consider to pause the audio playback when this reason is 671 reported. */ 672 REASON_OLD_DEVICE_UNAVAILABLE = 2, 673 /* Device is overrode by user or system. */ 674 REASON_OVERRODE = 3, 675 } OH_AudioStream_DeviceChangeReason; 676 677 /** 678 * @brief Callback when the output device of an audio renderer changed. 679 * 680 * @param renderer AudioRenderer where this event occurs. 681 * @param userData User data which is passed by user. 682 * @param reason Indicates that why does the output device changes. 683 * @since 11 684 */ 685 typedef void (*OH_AudioRenderer_OutputDeviceChangeCallback)(OH_AudioRenderer* renderer, void* userData, 686 OH_AudioStream_DeviceChangeReason reason); 687 688 /** 689 * @brief Callback when the mark position reached. 690 * 691 * @param renderer AudioRenderer where this event occurs. 692 * @param samplePos Mark position in samples. 693 * @param userData User data which is passed by user. 694 * @since 12 695 */ 696 typedef void (*OH_AudioRenderer_OnMarkReachedCallback)(OH_AudioRenderer* renderer, uint32_t samplePos, void* userData); 697 698 /** 699 * @brief This function pointer will point to the callback function that 700 * is used to write audio data with metadata 701 * 702 * @param renderer AudioRenderer where this event occurs. 703 * @param userData User data which is passed by user. 704 * @param audioData Audio data which is written by user. 705 * @param audioDataSize Audio data size which is the size of audio data written by user. 706 * @param metadata Metadata which is written by user. 707 * @param metadataSize Metadata size which is the size of metadata written by user. 708 * @return Error code of the callback function returned by user. 709 * @since 12 710 */ 711 typedef int32_t (*OH_AudioRenderer_WriteDataWithMetadataCallback)(OH_AudioRenderer* renderer, 712 void* userData, void* audioData, int32_t audioDataSize, void* metadata, int32_t metadataSize); 713 714 /** 715 * @brief Defines Enumeration of audio stream privacy type for playback capture. 716 * 717 * @since 12 718 */ 719 typedef enum { 720 /** Privacy type that stream can be captured by third party applications. 721 * @since 12 722 */ 723 AUDIO_STREAM_PRIVACY_TYPE_PUBLIC = 0, 724 /** Privacy type that stream can not be captured. 725 * @since 12 726 */ 727 AUDIO_STREAM_PRIVACY_TYPE_PRIVATE = 1, 728 } OH_AudioStream_PrivacyType; 729 730 /** 731 * @brief Defines enumeration of audio data callback result. 732 * 733 * @since 12 734 */ 735 typedef enum { 736 /** Result of audio data callabck is invalid. */ 737 AUDIO_DATA_CALLBACK_RESULT_INVALID = -1, 738 /** Result of audio data callabck is valid. */ 739 AUDIO_DATA_CALLBACK_RESULT_VALID = 0, 740 } OH_AudioData_Callback_Result; 741 742 /** 743 * @brief Callback function of write data. 744 * 745 * This function is similar with OH_AudioRenderer_Callbacks_Struct.OH_AudioRenderer_OnWriteData instead of the return 746 * value. The return result of this function indicates whether the data filled in the buffer is valid or invalid. If 747 * result is invalid, the data filled by user will not be played. 748 * 749 * @param renderer AudioRenderer where this callback occurs. 750 * @param userData User data which is passed by user. 751 * @param audioData Audio data pointer, where user should fill in audio data. 752 * @param audioDataSize Size of audio data that user should fill in. 753 * @return Audio Data callback result. 754 * @see OH_AudioRenderer_Callbacks_Struct.OH_AudioRenderer_OnWriteData 755 * @since 12 756 */ 757 typedef OH_AudioData_Callback_Result (*OH_AudioRenderer_OnWriteDataCallback)(OH_AudioRenderer* renderer, void* userData, 758 void* audioData, int32_t audioDataSize); 759 760 /** 761 * @brief Callback function of audio interrupt event. 762 * 763 * This function pointer will point to the callback function that 764 * is used to handle audio interrupt events. 765 * 766 * @param renderer AudioRenderer where this callback occurs. 767 * @param userData User data which is passed by user. 768 * @param type Interrupt event type. 769 * @param hint Interrupt event hint. 770 * @return Audio Data callback result. 771 * @see OH_AudioRenderer_Callbacks_Struct.OH_AudioRenderer_OnInterruptEvent 772 * @since 18 773 */ 774 typedef OH_AudioData_Callback_Result (*OH_AudioRenderer_OnInterruptCallback)(OH_AudioRenderer* renderer, 775 void* userData, OH_AudioInterrupt_ForceType type, OH_AudioInterrupt_Hint hint); 776 777 /** 778 * @brief Callback function of audio error. 779 * 780 * This function pointer will point to the callback function that 781 * is used to used to handle audio error result. 782 * 783 * @param renderer AudioRenderer where this callback occurs. 784 * @param userData User data which is passed by user. 785 * @param error Error code. 786 * @return Audio Data callback result. 787 * @see OH_AudioRenderer_Callbacks_Struct.OH_AudioRenderer_OnError 788 * @since 18 789 */ 790 typedef OH_AudioData_Callback_Result (*OH_AudioRenderer_OnErrorCallback)(OH_AudioRenderer* renderer, void* userData, 791 OH_AudioStream_Result error); 792 793 /** 794 * @brief Callback function of read data. 795 * 796 * This function is similar with OH_AudioCapturer_Callbacks_Struct.OH_AudioCapturer_OnReadData instead of the return 797 * value.The return result of this function indicates whether the data has filled in the buffer successfully or not. If 798 * result is invalid, which indicates the record data do not fill in the buffer. 799 * 800 * @param capturer AudioCapturer where this callback occurs. 801 * @param userData User data which is passed by user. 802 * @param audioData Audio data pointer, where fill in record data. 803 * @param audioDataSize Size of audio data that capturer has recorded. 804 * @return Audio Data callback result. 805 * @see OH_AudioCapturer_Callbacks_Struct.OH_AudioCapturer_OnReadData 806 * @since 18 807 */ 808 typedef OH_AudioData_Callback_Result (*OH_AudioCapturer_OnReadDataCallback)(OH_AudioCapturer* capturer, void* userData, 809 void* audioData, int32_t audioDataSize); 810 811 /** 812 * @brief Callback function of stream events. 813 * 814 * This function is similar with OH_AudioCapturer_Callbacks_Struct.OH_AudioCapturer_OnStreamEvent instead of the return 815 * value.The return result of this function indicates whether the stream event callabck is valid or not. 816 * 817 * @param capturer AudioCapturer where this callback occurs. 818 * @param userData User data which is passed by user. 819 * @param deviceArray Audio device descriptors should be released. 820 * @return OH_AudioData_Callback_Result. 821 * @see OH_AudioCapturer_Callbacks_Struct.OH_AudioCapturer_OnStreamEvent 822 * @since 18 823 */ 824 typedef void (*OH_AudioCapturer_OnDeviceChangeCallback)(OH_AudioCapturer* capturer, void* userData, 825 OH_AudioDeviceDescriptorArray* deviceArray); 826 827 /** 828 * @brief Callback function of interrupt event. 829 * 830 * This function is similar with OH_AudioCapturer_Callbacks_Struct.OH_AudioCapturer_OnInterruptEvent instead of the 831 * return value. 832 * 833 * @param capturer AudioCapturer where this callback occurs. 834 * @param userData User data which is passed by user. 835 * @param forceType Type which is choose based on priorities. 836 * @param hintType Hint which is Selected hint type based on the interrupt type. 837 * @return Audio Data callback result. 838 * @see OH_AudioCapturer_OnInterruptEventCallbacks_Struct.OH_AudioCapturer_OnInterruptEvent 839 * @since 18 840 */ 841 typedef OH_AudioData_Callback_Result (*OH_AudioCapturer_OnInterruptCallback)(OH_AudioCapturer* capturer, 842 void* userData, OH_AudioInterrupt_ForceType forceType, OH_AudioInterrupt_Hint hintType); 843 844 /** 845 * @brief Callback function of error. 846 * 847 * This function is similar with OH_AudioCapturer_Callbacks_Struct.OH_AudioCapturer_OnError instead of the return 848 * value. 849 * 850 * @param capturer AudioCapturer where this callback occurs. 851 * @param userData User data which is passed by user. 852 * @param error Error which is represented the result status of audio stream operations. 853 * @return Audio Data callback result. 854 * @see OH_AudioCapturer_Callbacks_Struct.OH_AudioCapturer_OnError 855 * @since 18 856 */ 857 typedef OH_AudioData_Callback_Result (*OH_AudioCapturer_OnErrorCallback)(OH_AudioCapturer* capturer, void* userData, 858 OH_AudioStream_Result error); 859 #ifdef __cplusplus 860 } 861 #endif 862 863 #endif // NATIVE_AUDIOSTREAM_BASE_H 864