1 /* 2 * Copyright (c) 2024 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 OHAVSession 18 * @{ 19 * 20 * @brief Provide the definition of the C interface for the avsession module. 21 * 22 * @syscap SystemCapability.Multimedia.AVSession.Core 23 * 24 * @since 13 25 * @version 1.0 26 */ 27 28 /** 29 * @file native_avsession.h 30 * 31 * @brief Declare avsession interface. 32 * 33 * @library libohavsession.so 34 * @syscap SystemCapability.Multimedia.AVSession.Core 35 * @kit AVSessionKit 36 * @since 13 37 * @version 1.0 38 */ 39 40 #ifndef NATIVE_AVSESSION_H 41 #define NATIVE_AVSESSION_H 42 43 #include <stdint.h> 44 #include "native_avsession_errors.h" 45 #include "native_avmetadata.h" 46 47 #ifdef __cplusplus 48 extern "C" { 49 #endif 50 51 /** 52 * @brief Enum for avsession type. 53 * 54 * @since 13 55 * @version 1.0 56 */ 57 typedef enum { 58 /** 59 * @brief audio session type. 60 */ 61 SESSION_TYPE_AUDIO = 0, 62 63 /** 64 * @brief video session type. 65 */ 66 SESSION_TYPE_VIDEO = 1, 67 68 /** 69 * @brief voice call session type. 70 */ 71 SESSION_TYPE_VOICE_CALL = 2, 72 73 /** 74 * @brief video call session type. 75 */ 76 SESSION_TYPE_VIDEO_CALL = 3 77 } AVSession_Type; 78 79 /** 80 * @brief Enum for playback state. 81 * 82 * @since 13 83 * @version 1.0 84 */ 85 typedef enum { 86 /** 87 * @brief Initial state. 88 */ 89 PLAYBACK_STATE_INITIAL = 0, 90 91 /** 92 * @brief Preparing state. Indicates that the media file is not ready to play. 93 */ 94 PLAYBACK_STATE_PREPARING = 1, 95 96 /** 97 * @brief Playing state. 98 */ 99 PLAYBACK_STATE_PLAYING = 2, 100 101 /** 102 * @brief Pause state. 103 */ 104 PLAYBACK_STATE_PAUSED = 3, 105 106 /** 107 * @brief Fast forward state. 108 */ 109 PLAYBACK_STATE_FAST_FORWARDING = 4, 110 111 /** 112 * @brief Rewind state. 113 */ 114 PLAYBACK_STATE_REWINDED = 5, 115 116 /** 117 * @brief Stopped state. 118 */ 119 PLAYBACK_STATE_STOPPED = 6, 120 121 /** 122 * @brief Complete state. 123 */ 124 PLAYBACK_STATE_COMPLETED = 7, 125 126 /** 127 * @brief Release state. 128 */ 129 PLAYBACK_STATE_RELEASED = 8, 130 131 /** 132 * @brief Error state. 133 */ 134 PLAYBACK_STATE_ERROR = 9, 135 136 /** 137 * @brief Idle state. 138 */ 139 PLAYBACK_STATE_IDLE = 10, 140 141 /** 142 * @brief Buffering state. 143 */ 144 PLAYBACK_STATE_BUFFERING = 11, 145 146 /** 147 * @brief Max state. 148 */ 149 PLAYBACK_STATE_MAX = 12, 150 } AVSession_PlaybackState; 151 152 /** 153 * @brief Defines the playback position. 154 * 155 * @since 13 156 */ 157 typedef struct AVSession_PlaybackPosition { 158 /** 159 * @brief Elapsed time(position) of this media set by the app. 160 */ 161 int64_t elapsedTime; 162 163 /** 164 * @brief Record the system time when elapsedTime is set. 165 */ 166 int64_t updateTime; 167 } AVSession_PlaybackPosition; 168 169 /** 170 * @brief Defines the playback mode. 171 * 172 * @since 13 173 */ 174 typedef enum { 175 /** 176 * @brief sequential playback mode 177 */ 178 LOOP_MODE_SEQUENCE = 0, 179 180 /** 181 * @brief single playback mode 182 */ 183 LOOP_MODE_SINGLE = 1, 184 185 /** 186 * @brief list playback mode 187 */ 188 LOOP_MODE_LIST = 2, 189 190 /** 191 * @brief shuffle playback mode 192 */ 193 LOOP_MODE_SHUFFLE = 3, 194 195 /** 196 * @brief custom playback mode 197 */ 198 LOOP_MODE_CUSTOM = 4, 199 } AVSession_LoopMode; 200 201 /** 202 * @brief Enum for different control command. 203 * 204 * @since 13 205 * @version 1.0 206 */ 207 typedef enum AVSession_ControlCommand { 208 /** 209 * @brief invalid control command 210 */ 211 CONTROL_CMD_INVALID = -1, 212 213 /** 214 * @brief play command 215 */ 216 CONTROL_CMD_PLAY = 0, 217 218 /** 219 * @brief pause command 220 */ 221 CONTROL_CMD_PAUSE = 1, 222 223 /** 224 * @brief stop command 225 */ 226 CONTROL_CMD_STOP = 2, 227 228 /** 229 * @brief playnext command 230 */ 231 CONTROL_CMD_PLAY_NEXT = 3, 232 233 /** 234 * @brief playprevious command 235 */ 236 CONTROL_CMD_PLAY_PREVIOUS = 4, 237 } AVSession_ControlCommand; 238 239 /** 240 * @brief Defines enumeration of avsession callback result. 241 * 242 * @since 13 243 */ 244 typedef enum { 245 /** 246 * @brief Result of avsession callabck is success. 247 */ 248 AVSESSION_CALLBACK_RESULT_SUCCESS = 0, 249 250 /** 251 * @brief Result of avsession callabck failed. 252 */ 253 AVSESSION_CALLBACK_RESULT_FAILURE = -1, 254 } AVSessionCallback_Result; 255 256 /** 257 * @brief AVSession object 258 * 259 * A pointer can be created using {@link OH_AVSession_Create} method. 260 * 261 * @since 13 262 * @version 1.0 263 */ 264 typedef struct OH_AVSession OH_AVSession; 265 266 /** 267 * @brief Declaring the callback struct for playback command 268 * 269 * @since 13 270 * @version 1.0 271 */ 272 typedef AVSessionCallback_Result (*OH_AVSessionCallback_OnCommand)(OH_AVSession* session, 273 AVSession_ControlCommand command, void* userData); 274 275 /** 276 * @brief Declaring the callback struct for forward command 277 * 278 * @since 13 279 * @version 1.0 280 */ 281 typedef AVSessionCallback_Result (*OH_AVSessionCallback_OnFastForward)(OH_AVSession* session, 282 uint32_t seekTime, void* userData); 283 284 /** 285 * @brief Declaring the callback struct for rewind command 286 * 287 * @since 13 288 * @version 1.0 289 */ 290 typedef AVSessionCallback_Result (*OH_AVSessionCallback_OnRewind)(OH_AVSession* session, 291 uint32_t seekTime, void* userData); 292 293 /** 294 * @brief Declaring the callback struct for seek command 295 * 296 * @since 13 297 * @version 1.0 298 */ 299 typedef AVSessionCallback_Result (*OH_AVSessionCallback_OnSeek)(OH_AVSession* session, 300 uint64_t seekTime, void* userData); 301 302 /** 303 * @brief Declaring the callback struct for set loop mode command 304 * 305 * @since 13 306 * @version 1.0 307 */ 308 typedef AVSessionCallback_Result (*OH_AVSessionCallback_OnSetLoopMode)(OH_AVSession* session, 309 AVSession_LoopMode curLoopMode, void* userData); 310 311 /** 312 * @brief Declaring the callback struct for toggle favorite command 313 * 314 * @since 13 315 * @version 1.0 316 */ 317 typedef AVSessionCallback_Result (*OH_AVSessionCallback_OnToggleFavorite)(OH_AVSession* session, 318 const char* assetId, void* userData); 319 320 /** 321 * @brief Request to create the avsession. 322 * 323 * @param sessionType The session type to set 324 * @param sessionTag The session tag set by the application 325 * @param bundleName The bundle name to set 326 * @param abilityName The abilityName name to set 327 * @param avsession Pointer to a viriable to receive the OH_AVSession 328 * @return Function result code: 329 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 330 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} If session already existed or internal server error. 331 * {@link AV_SESSION_ERR_INVALID_PARAMETER}: 332 * 1. The param of sessionType is invalid. 333 * 2. The param of sessionTag is nullptr. 334 * 3. The param of bundleName is nullptr. 335 * 4. The param of abilityName is nullptr. 336 * 5. The param of avsession is nullptr. 337 * @since 13 338 */ 339 AVSession_ErrCode OH_AVSession_Create(AVSession_Type sessionType, const char* sessionTag, 340 const char* bundleName, const char* abilityName, OH_AVSession** avsession); 341 342 /** 343 * @brief Request to destory the avsession. 344 * 345 * @param avsession The avsession instance pointer 346 * @return Function result code: 347 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 348 * {@link AV_SESSION_ERR_INVALID_PARAMETER} The param of avsession is nullptr. 349 * @since 13 350 */ 351 AVSession_ErrCode OH_AVSession_Destroy(OH_AVSession* avsession); 352 353 /** 354 * @brief Activate the avsession. 355 * 356 * @param avsession The avsession instance pointer 357 * @return Function result code: 358 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 359 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 360 * {@link AV_SESSION_ERR_INVALID_PARAMETER} The param of avsession is nullptr. 361 * @since 13 362 */ 363 AVSession_ErrCode OH_AVSession_Activate(OH_AVSession* avsession); 364 365 /** 366 * @brief Deactivate the avsession. 367 * 368 * @param avsession The avsession instance pointer 369 * @return Function result code: 370 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 371 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 372 * {@link AV_SESSION_ERR_INVALID_PARAMETER} The param of avsession is nullptr. 373 * @since 13 374 */ 375 AVSession_ErrCode OH_AVSession_Deactivate(OH_AVSession* avsession); 376 377 /** 378 * @brief Get session type. 379 * 380 * @param avsession The avsession instance pointer 381 * @param sessionType The returned session type 382 * @return Function result code: 383 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 384 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 385 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 386 * 1. The param of avsession is invalid. 387 * 2. The param of sessionType is nullptr. 388 * @since 13 389 */ 390 AVSession_ErrCode OH_AVSession_GetSessionType(OH_AVSession* avsession, AVSession_Type* sessionType); 391 392 /** 393 * @brief Get session id. 394 * 395 * @param avsession The avsession instance pointer 396 * @param sessionId The returned session id 397 * @return Function result code: 398 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 399 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 400 * 1. The param of avsession is nullptr. 401 * 2. The param of sessionId is nullptr. 402 * @since 13 403 */ 404 AVSession_ErrCode OH_AVSession_GetSessionId(OH_AVSession* avsession, const char** sessionId); 405 406 /** 407 * @brief Request to set av metadata. 408 * 409 * @param avsession The avsession instance pointer 410 * @param avmetadata The metadata to set 411 * @return Function result code: 412 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 413 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 414 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 415 * 1. The param of avsession is nullptr. 416 * 2. The param of avmetadata is nullptr. 417 * @since 13 418 */ 419 AVSession_ErrCode OH_AVSession_SetAVMetadata(OH_AVSession* avsession, OH_AVMetadata* avmetadata); 420 421 /** 422 * @brief Request to set av playbackstate. 423 * 424 * @param avsession The avsession instance pointer 425 * @param playbackState The playbackState to set 426 * @return Function result code: 427 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 428 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 429 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 430 * 1. The param of avsession is nullptr. 431 * 2. The param of playbackState is invalid. 432 * @since 13 433 */ 434 AVSession_ErrCode OH_AVSession_SetPlaybackState(OH_AVSession* avsession, 435 AVSession_PlaybackState playbackState); 436 437 /** 438 * @brief Request to set playback position. 439 * 440 * @param avsession The avsession instance pointer 441 * @param playbackPosition The playbackPosition to set 442 * @return Function result code: 443 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 444 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 445 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 446 * 1. The param of avsession is nullptr. 447 * 2. The param of playbackPosition is nullptr. 448 * @since 13 449 */ 450 AVSession_ErrCode OH_AVSession_SetPlaybackPosition(OH_AVSession* avsession, 451 AVSession_PlaybackPosition* playbackPosition); 452 453 /** 454 * @brief Request to set favorite state. 455 * 456 * @param avsession The avsession instance pointer 457 * @param favorite true means making the resource to be liked, false means dislike. 458 * @return Function result code: 459 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 460 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 461 * {@link AV_SESSION_ERR_INVALID_PARAMETER} The param of avsession is nullptr. 462 * @since 13 463 */ 464 AVSession_ErrCode OH_AVSession_SetFavorite(OH_AVSession* avsession, bool favorite); 465 466 /** 467 * @brief Request to set loop mode. 468 * 469 * @param avsession The avsession instance pointer 470 * @param loopMode The loopmode to be set for playback. 471 * @return Function result code: 472 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 473 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 474 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 475 * 1. The param of avsession is nullptr. 476 * 2. The param of loopMode is invalid. 477 * @since 13 478 */ 479 AVSession_ErrCode OH_AVSession_SetLoopMode(OH_AVSession* avsession, AVSession_LoopMode loopMode); 480 481 /** 482 * @brief Request to register command callback. 483 * 484 * @param avsession The avsession instance pointer 485 * @param command The control command type to be registered. 486 * @param callback the {@link OH_AVSessionCallback_OnCommand} to be registered. 487 * @param userData User data which is passed by user. 488 * @return Function result code: 489 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 490 * {@link AV_SESSION_ERR_CODE_COMMAND_INVALID} The command is invalid. 491 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 492 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 493 * 1. The param of avsession is nullptr. 494 * 2. The param of callback is nullptr. 495 * @since 13 496 */ 497 AVSession_ErrCode OH_AVSession_RegisterCommandCallback(OH_AVSession* avsession, 498 AVSession_ControlCommand command, OH_AVSessionCallback_OnCommand callback, void* userData); 499 500 /** 501 * @brief Request to unregister command callback. 502 * 503 * @param avsession The avsession instance pointer 504 * @param command The control command type to be unregistered. 505 * @param callback the {@link OH_AVSessionCallback_OnCommand} to be unregistered. 506 * @return Function result code: 507 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 508 * {@link AV_SESSION_ERR_CODE_COMMAND_INVALID} The command is invalid. 509 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 510 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 511 * 1. The param of avsession is nullptr. 512 * 2. The param of callback is nullptr. 513 * @since 13 514 */ 515 AVSession_ErrCode OH_AVSession_UnregisterCommandCallback(OH_AVSession* avsession, 516 AVSession_ControlCommand command, OH_AVSessionCallback_OnCommand callback); 517 518 /** 519 * @brief Request to register fastforward callback. 520 * 521 * @param avsession The avsession instance pointer 522 * @param callback the {@link OH_AVSessionCallback_OnFastForward} to be registered. 523 * @param userData User data which is passed by user. 524 * @return Function result code: 525 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 526 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 527 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 528 * 1. The param of avsession is nullptr. 529 * 2. The param of callback is nullptr. 530 * @since 13 531 */ 532 AVSession_ErrCode OH_AVSession_RegisterForwardCallback(OH_AVSession* avsession, 533 OH_AVSessionCallback_OnFastForward callback, void* userData); 534 535 /** 536 * @brief Request to unregister fastforward callback. 537 * 538 * @param avsession The avsession instance pointer 539 * @param callback the {@link OH_AVSessionCallback_OnFastForward} to be unregistered. 540 * @return Function result code: 541 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 542 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 543 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 544 * 1. The param of avsession is nullptr. 545 * 2. The param of callback is nullptr. 546 * @since 13 547 */ 548 AVSession_ErrCode OH_AVSession_UnregisterForwardCallback(OH_AVSession* avsession, 549 OH_AVSessionCallback_OnFastForward callback); 550 551 /** 552 * @brief Request to register rewind callback. 553 * 554 * @param avsession The avsession instance pointer 555 * @param callback the {@link OH_AVSessionCallback_OnRewind} to be registered. 556 * @param userData User data which is passed by user. 557 * @return Function result code: 558 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 559 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 560 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 561 * 1. The param of avsession is nullptr. 562 * 2. The param of callback is nullptr. 563 * @since 13 564 */ 565 AVSession_ErrCode OH_AVSession_RegisterRewindCallback(OH_AVSession* avsession, 566 OH_AVSessionCallback_OnRewind callback, void* userData); 567 568 /** 569 * @brief Request to unregister rewind callback. 570 * 571 * @param avsession The avsession instance pointer 572 * @param callback the {@link OH_AVSessionCallback_OnRewind} to be unregistered. 573 * @return Function result code: 574 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 575 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 576 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 577 * 1. The param of avsession is nullptr. 578 * 2. The param of callback is nullptr. 579 * @since 13 580 */ 581 AVSession_ErrCode OH_AVSession_UnregisterRewindCallback(OH_AVSession* avsession, 582 OH_AVSessionCallback_OnRewind callback); 583 584 /** 585 * @brief Request to register seek callback. 586 * 587 * @param avsession The avsession instance pointer 588 * @param callback the {@link OH_AVSessionCallback_OnSeek} to be registered. 589 * @param userData User data which is passed by user. 590 * @return Function result code: 591 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 592 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 593 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 594 * 1. The param of avsession is nullptr. 595 * 2. The param of callback is nullptr. 596 * @since 13 597 */ 598 AVSession_ErrCode OH_AVSession_RegisterSeekCallback(OH_AVSession* avsession, 599 OH_AVSessionCallback_OnSeek callback, void* userData); 600 601 /** 602 * @brief Request to unregister seek callback. 603 * 604 * @param avsession The avsession instance pointer 605 * @param callback the {@link OH_AVSessionCallback_OnSeek} to be unregistered. 606 * @return Function result code: 607 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 608 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 609 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 610 * 1. The param of avsession is nullptr. 611 * 2. The param of callback is nullptr. 612 * @since 13 613 */ 614 AVSession_ErrCode OH_AVSession_UnregisterSeekCallback(OH_AVSession* avsession, 615 OH_AVSessionCallback_OnSeek callback); 616 617 /** 618 * @brief Request to register set loopmode callback. 619 * 620 * @param avsession The avsession instance pointer 621 * @param callback the {@link OH_AVSessionCallback_OnSetLoopMode} to be registered. 622 * @param userData User data which is passed by user. 623 * @return Function result code: 624 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 625 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 626 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 627 * 1. The param of avsession is nullptr. 628 * 2. The param of callback is nullptr. 629 * @since 13 630 */ 631 AVSession_ErrCode OH_AVSession_RegisterSetLoopModeCallback(OH_AVSession* avsession, 632 OH_AVSessionCallback_OnSetLoopMode callback, void* userData); 633 634 /** 635 * @brief Request to unregister set loopmode callback. 636 * 637 * @param avsession The avsession instance pointer 638 * @param callback the {@link OH_AVSessionCallback_OnSetLoopMode} to be unregistered. 639 * @return Function result code: 640 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 641 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 642 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 643 * 1. The param of avsession is nullptr. 644 * 2. The param of callback is nullptr. 645 * @since 13 646 */ 647 AVSession_ErrCode OH_AVSession_UnregisterSetLoopModeCallback(OH_AVSession* avsession, 648 OH_AVSessionCallback_OnSetLoopMode callback); 649 650 /** 651 * @brief Request to register toggle favorite callback. 652 * 653 * @param avsession The avsession instance pointer 654 * @param callback the {@link OH_AVSessionCallback_OnToggleFavorite} to be registered. 655 * @param userData User data which is passed by user. 656 * @return Function result code: 657 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 658 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 659 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 660 * 1. The param of avsession is nullptr. 661 * 2. The param of callback is nullptr. 662 * @since 13 663 */ 664 AVSession_ErrCode OH_AVSession_RegisterToggleFavoriteCallback(OH_AVSession* avsession, 665 OH_AVSessionCallback_OnToggleFavorite callback, void* userData); 666 667 /** 668 * @brief Request to unregister toggle favorite callback. 669 * 670 * @param avsession The avsession instance pointer 671 * @param callback the {@link OH_AVSessionCallback_OnToggleFavorite} to be unregistered. 672 * @return Function result code: 673 * {@link AV_SESSION_ERR_SUCCESS} If the execution is successful. 674 * {@link AV_SESSION_ERR_SERVICE_EXCEPTION} Internal server error. 675 * {@link AV_SESSION_ERR_INVALID_PARAMETER} 676 * 1. The param of avsession is nullptr. 677 * 2. The param of callback is nullptr. 678 * @since 13 679 */ 680 AVSession_ErrCode OH_AVSession_UnregisterToggleFavoriteCallback(OH_AVSession* avsession, 681 OH_AVSessionCallback_OnToggleFavorite callback); 682 683 #ifdef __cplusplus 684 } 685 #endif 686 687 #endif // NATIVE_AVSESSION_H 688 /** @} */