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 AVPlayer
18 * @{
19 *
20 * @brief Provides APIs of Playback capability for Media Source.
21 *
22 * @Syscap SystemCapability.Multimedia.Media.AVPlayer
23 * @since 11
24 * @version 1.0
25 */
26
27/**
28 * @file avplayer.h
29 *
30 * @brief Defines the avplayer APIs. Uses the Native APIs provided by Media AVPlayer
31 *        to play the media source.
32 *
33 * @kit MediaKit
34 * @library libavplayer.so
35 * @since 11
36 * @version 1.0
37 */
38
39#ifndef MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVPLAYER_H
40#define MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVPLAYER_H
41
42#include <stdbool.h>
43#include <stdint.h>
44#include <stdio.h>
45#include "native_averrors.h"
46#include "avplayer_base.h"
47#include "native_window/external_window.h"
48#include "ohaudio/native_audiostream_base.h"
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
54/**
55 * @brief MediaKeySession field.
56 * @since 12
57 * @version 1.0
58 */
59typedef struct MediaKeySession MediaKeySession;
60/**
61 * @brief DRM_MediaKeySystemInfo field.
62 * @since 12
63 * @version 1.0
64 */
65typedef struct DRM_MediaKeySystemInfo DRM_MediaKeySystemInfo;
66
67/**
68 * @brief Call back will be invoked when updating DRM information.
69 * @param player Player instance.
70 * @param mediaKeySystemInfo DRM information.
71 * @return void
72 * @since 12
73 * @version 1.0
74 */
75typedef void (*Player_MediaKeySystemInfoCallback)(OH_AVPlayer *player, DRM_MediaKeySystemInfo* mediaKeySystemInfo);
76
77/**
78 * @brief Create a player
79 * @syscap SystemCapability.Multimedia.Media.AVPlayer
80 * @return Returns a pointer to an OH_AVPlayer instance for success, nullptr for failure
81 * Possible failure causes: 1. failed to PlayerFactory::CreatePlayer. 2. failed to new PlayerObject.
82 * @since 11
83 * @version 1.0
84*/
85OH_AVPlayer *OH_AVPlayer_Create(void);
86
87/**
88 * @brief Sets the playback source for the player. The corresponding source can be http url
89 * @syscap SystemCapability.Multimedia.Media.AVPlayer
90 * @param player Pointer to an OH_AVPlayer instance
91 * @param url Indicates the playback source.
92 * @return Function result code.
93 *         {@link AV_ERR_OK} if the execution is successful.
94 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr, url is null or player setUrlSource failed.
95 * @since 11
96 * @version 1.0
97 */
98OH_AVErrCode OH_AVPlayer_SetURLSource(OH_AVPlayer *player, const char *url);
99
100/**
101 * @brief Sets the playback media file descriptor source for the player.
102 * @syscap SystemCapability.Multimedia.Media.AVPlayer
103 * @param player Pointer to an OH_AVPlayer instance
104 * @param fd Indicates the file descriptor of media source.
105 * @param offset Indicates the offset of media source in file descriptor.
106 * @param size Indicates the size of media source.
107 * @return Function result code.
108 *         {@link AV_ERR_OK} if the execution is successful.
109 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr or player setFdSource failed.
110 * @since 11
111 * @version 1.0
112 */
113OH_AVErrCode OH_AVPlayer_SetFDSource(OH_AVPlayer *player, int32_t fd, int64_t offset, int64_t size);
114
115/**
116 * @brief Prepares the playback environment and buffers media data asynchronous.
117 *
118 * This function must be called after {@link SetSource}.
119 *
120 * @syscap SystemCapability.Multimedia.Media.AVPlayer
121 * @param player Pointer to an OH_AVPlayer instance
122 * @return Function result code.
123 *         {@link AV_ERR_OK} if the execution is successful.
124 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr or player Prepare failed.
125 * @since 11
126 * @version 1.0
127 */
128OH_AVErrCode OH_AVPlayer_Prepare(OH_AVPlayer *player);
129
130/**
131 * @brief Start playback.
132 *
133 * This function must be called after {@link Prepare}. If the player state is <b>Prepared</b>,
134 * this function is called to start playback.
135 *
136 * @syscap SystemCapability.Multimedia.Media.AVPlayer
137 * @param player Pointer to an OH_AVPlayer instance
138 * @return Function result code.
139 *         {@link AV_ERR_OK} if the execution is successful.
140 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr or player Play failed.
141 * @since 11
142 * @version 1.0
143 */
144OH_AVErrCode OH_AVPlayer_Play(OH_AVPlayer *player);
145
146/**
147 * @brief Pauses playback.
148 * @syscap SystemCapability.Multimedia.Media.AVPlayer
149 * @param player Pointer to an OH_AVPlayer instance
150 * @return Function result code.
151 *         {@link AV_ERR_OK} if the execution is successful.
152 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr or player Pause failed.
153 * @since 11
154 * @version 1.0
155 */
156OH_AVErrCode OH_AVPlayer_Pause(OH_AVPlayer *player);
157
158/**
159 * @brief Stop playback.
160 * @syscap SystemCapability.Multimedia.Media.AVPlayer
161 * @param player Pointer to an OH_AVPlayer instance
162 * @return Function result code.
163 *         {@link AV_ERR_OK} if the execution is successful.
164 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr or player Stop failed.
165 * @since 11
166 * @version 1.0
167 */
168OH_AVErrCode OH_AVPlayer_Stop(OH_AVPlayer *player);
169
170/**
171 * @brief Restores the player to the initial state.
172 *
173 * After the function is called, add a playback source by calling {@link SetSource},
174 * call {@link Play} to start playback again after {@link Prepare} is called.
175 *
176 * @syscap SystemCapability.Multimedia.Media.AVPlayer
177 * @param player Pointer to an OH_AVPlayer instance
178 * @return Function result code.
179 *         {@link AV_ERR_OK} if the execution is successful.
180 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr or player Reset failed.
181 * @since 11
182 * @version 1.0
183 */
184OH_AVErrCode OH_AVPlayer_Reset(OH_AVPlayer *player);
185
186/**
187 * @brief Releases player resources async
188 *
189 *  Asynchronous release guarantees the performance
190 *  but cannot ensure whether the surfacebuffer is released.
191 *  The caller needs to ensure the life cycle security of the surface
192 *
193 * @syscap SystemCapability.Multimedia.Media.AVPlayer
194 * @param player Pointer to an OH_AVPlayer instance
195 * @return Function result code.
196 *         {@link AV_ERR_OK} if the execution is successful.
197 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr or player Release failed.
198 * @since 11
199 * @version 1.0
200 */
201OH_AVErrCode OH_AVPlayer_Release(OH_AVPlayer *player);
202
203/**
204 * @brief Releases player resources sync
205 *
206 * Synchronous release ensures effective release of surfacebuffer
207 * but this interface will take a long time (when the engine is not idle state)
208 * requiring the caller to design an asynchronous mechanism by itself
209 *
210 * @syscap SystemCapability.Multimedia.Media.AVPlayer
211 * @param player Pointer to an OH_AVPlayer instance
212 * @return Function result code.
213 *         {@link AV_ERR_OK} if the execution is successful.
214 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr or player ReleaseSync failed.
215 * @since 11
216 * @version 1.0
217 */
218OH_AVErrCode OH_AVPlayer_ReleaseSync(OH_AVPlayer *player);
219
220/**
221 * @brief Sets the volume of the player.
222 *
223 * This function can be used during playback or pause. The value <b>0</b> indicates no sound,
224 * and <b>1</b> indicates the original volume. If no audio device is started or no audio
225 * stream exists, the value <b>-1</b> is returned.
226 *
227 * @syscap SystemCapability.Multimedia.Media.AVPlayer
228 * @param player Pointer to an OH_AVPlayer instance
229 * @param leftVolume Indicates the target volume of the left audio channel to set,
230 *        ranging from 0 to 1. each step is 0.01.
231 * @param rightVolume Indicates the target volume of the right audio channel to set,
232 *        ranging from 0 to 1. each step is 0.01.
233 * @return Function result code.
234 *         {@link AV_ERR_OK} if the execution is successful.
235 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr or player SetVolume failed.
236 * @since 11
237 * @version 1.0
238 */
239OH_AVErrCode OH_AVPlayer_SetVolume(OH_AVPlayer *player, float leftVolume, float rightVolume);
240
241/**
242 * @brief Changes the playback position.
243 *
244 * This function can be used during play or pause.
245 *
246 * @syscap SystemCapability.Multimedia.Media.AVPlayer
247 * @param player Pointer to an OH_AVPlayer instance
248 * @param mSeconds Indicates the target playback position, accurate to milliseconds.
249 * @param mode Indicates the player seek mode. For details, see {@link AVPlayerSeekMode}.
250 * @return Function result code.
251 *         {@link AV_ERR_OK} if the execution is successful.
252 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr or player Seek failed.
253 * @since 11
254 * @version 1.0
255*/
256OH_AVErrCode OH_AVPlayer_Seek(OH_AVPlayer *player, int32_t mSeconds, AVPlayerSeekMode mode);
257
258/**
259 * @brief Obtains the playback position, accurate to millisecond.
260 * @syscap SystemCapability.Multimedia.Media.AVPlayer
261 * @param player Pointer to an OH_AVPlayer instance
262 * @param currentTime Indicates the playback position.
263 * @return Function result code.
264 *         {@link AV_ERR_OK} if the execution is successful.
265 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr or player GetCurrentTime failed.
266 * @since 11
267 * @version 1.0
268 */
269OH_AVErrCode OH_AVPlayer_GetCurrentTime(OH_AVPlayer *player, int32_t *currentTime);
270
271/**
272 * @brief get the video width.
273 * @syscap SystemCapability.Multimedia.Media.AVPlayer
274 * @param player Pointer to an OH_AVPlayer instance
275 * @param videoWidth The video width
276 * @return Function result code.
277 *         {@link AV_ERR_OK} if the execution is successful.
278 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr.
279 * @since 11
280 * @version 1.0
281 */
282OH_AVErrCode OH_AVPlayer_GetVideoWidth(OH_AVPlayer *player, int32_t *videoWidth);
283
284/**
285 * @brief get the video height.
286 * @syscap SystemCapability.Multimedia.Media.AVPlayer
287 * @param player Pointer to an OH_AVPlayer instance
288 * @param videoHeight The video height
289 * @return Function result code.
290 *         {@link AV_ERR_OK} if the execution is successful.
291 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr.
292 * @since 11
293 * @version 1.0
294 */
295OH_AVErrCode OH_AVPlayer_GetVideoHeight(OH_AVPlayer *player, int32_t *videoHeight);
296
297/**
298 * @brief set the player playback rate
299 * @syscap SystemCapability.Multimedia.Media.AVPlayer
300 * @param player Pointer to an OH_AVPlayer instance
301 * @param speed the rate mode {@link AVPlaybackSpeed} which can set.
302 * @return Function result code.
303 *         {@link AV_ERR_OK} if the execution is successful.
304 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr or player SetPlaybackSpeed failed.
305 * @since 11
306 * @version 1.0
307 */
308OH_AVErrCode OH_AVPlayer_SetPlaybackSpeed(OH_AVPlayer *player, AVPlaybackSpeed speed);
309
310/**
311 * @brief get the current player playback rate
312 * @syscap SystemCapability.Multimedia.Media.AVPlayer
313 * @param player Pointer to an OH_AVPlayer instance
314 * @param speed the rate mode {@link AVPlaybackSpeed} which can get.
315 * @return Function result code.
316 *         {@link AV_ERR_OK} if the execution is successful.
317 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr or player GetPlaybackSpeed failed.
318 * @since 11
319 * @version 1.0
320 */
321OH_AVErrCode OH_AVPlayer_GetPlaybackSpeed(OH_AVPlayer *player, AVPlaybackSpeed *speed);
322
323/**
324 * @brief Set the renderer information of the player's audio renderer
325 * @param player Pointer to an OH_AVPlayer instance
326 * @param streamUsage The value {@link OH_AudioStream_Usage} used for the stream usage of the player audio render.
327 * @return Function result code.
328 *     {@link AV_ERR_OK} if the execution is successful.
329 *     {@link AV_ERR_INVALID_VAL} if input player is nullptr or streamUsage value is invalid.
330 * @since 12
331 * @version 1.0
332 */
333OH_AVErrCode OH_AVPlayer_SetAudioRendererInfo(OH_AVPlayer *player, OH_AudioStream_Usage streamUsage);
334
335/**
336 * @brief Set the interruption mode of the player's audio stream
337 * @param player Pointer to an OH_AVPlayer instance
338 * @param interruptMode The value {@link OH_AudioInterrupt_Mode} used for the interruption mode of
339 *                      the player audio stream.
340 * @return Function result code.
341 *     {@link AV_ERR_OK} if the execution is successful.
342 *     {@link AV_ERR_INVALID_VAL} if input player is nullptr or interruptMode value is invalid.
343 * @since 12
344 * @version 1.0
345 */
346OH_AVErrCode OH_AVPlayer_SetAudioInterruptMode(OH_AVPlayer *player, OH_AudioInterrupt_Mode interruptMode);
347
348/**
349 * @brief Set the effect mode of the player's audio stream
350 * @param player Pointer to an OH_AVPlayer instance
351 * @param effectMode The value {@link OH_AudioStream_AudioEffectMode} used for the effect mode of
352 *                   the player audio stream.
353 * @return Function result code.
354 *     {@link AV_ERR_OK} if the execution is successful.
355 *     {@link AV_ERR_INVALID_VAL} if input player is nullptr or effectMode value is invalid.
356 * @since 12
357 * @version 1.0
358 */
359OH_AVErrCode OH_AVPlayer_SetAudioEffectMode(OH_AVPlayer *player, OH_AudioStream_AudioEffectMode effectMode);
360
361/**
362 * @brief set the bit rate use for hls player
363 *
364 * the playback bitrate expressed in bits per second, expressed in bits per second,
365 * which is only valid for HLS protocol network flow. By default,
366 * the player will select the appropriate bit rate and speed according to the network connection.
367 * report the effective bit rate linked list by "INFO_TYPE_BITRATE_COLLECT"
368 * set and select the specified bit rate, and select the bit rate that is less than and closest
369 * to the specified bit rate for playback. When ready, read it to query the currently selected bit rate.
370 *
371 * @syscap SystemCapability.Multimedia.Media.AVPlayer
372 * @param player Pointer to an OH_AVPlayer instance
373 * @param bitRate the bit rate, The unit is bps.
374 * @return Function result code.
375 *         {@link AV_ERR_OK} if the execution is successful.
376 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr or player SelectBitRate failed.
377 * @since 11
378 * @version 1.0
379 */
380OH_AVErrCode OH_AVPlayer_SelectBitRate(OH_AVPlayer *player, uint32_t bitRate);
381
382/**
383 * @brief Method to set the surface.
384 * @syscap SystemCapability.Multimedia.Media.AVPlayer
385 * @param player Pointer to an OH_AVPlayer instance
386 * @param window A pointer to a OHNativeWindow instance, see {@link OHNativeWindow}
387 * @return Function result code.
388 *         {@link AV_ERR_OK} if the execution is successful.
389 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr, input window is nullptr,
390 *          or player SetVideoSurface failed.
391 * @since 11
392 * @version 1.0
393 */
394OH_AVErrCode  OH_AVPlayer_SetVideoSurface(OH_AVPlayer *player, OHNativeWindow *window);
395
396/**
397 * @brief Obtains the total duration of media files, accurate to milliseconds.
398 * @syscap SystemCapability.Multimedia.Media.AVPlayer
399 * @param player Pointer to an OH_AVPlayer instance
400 * @param duration Indicates the total duration of media files.
401 * @return Function result code.
402 *         {@link AV_ERR_OK} if the execution is successful.
403 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr or player GetDuration failed.
404 * @since 11
405 * @version 1.0
406 */
407OH_AVErrCode OH_AVPlayer_GetDuration(OH_AVPlayer *player, int32_t *duration);
408
409/**
410 * @brief get current playback state.
411 * @syscap SystemCapability.Multimedia.Media.AVPlayer
412 * @param player Pointer to an OH_AVPlayer instance
413 * @param state the current playback state
414 * @return Function result code.
415 *         {@link AV_ERR_OK} if the execution is successful.
416 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr.
417 * @since 11
418 * @version 1.0
419 */
420OH_AVErrCode OH_AVPlayer_GetState(OH_AVPlayer *player, AVPlayerState *state);
421
422/**
423 * @brief Checks whether the player is playing.
424 * @syscap SystemCapability.Multimedia.Media.AVPlayer
425 * @param player Pointer to an OH_AVPlayer instance
426 * @return Returns true if the playback is playing; Return false if not or input player is nullptr.
427 * @since 11
428 * @version 1.0
429 */
430bool OH_AVPlayer_IsPlaying(OH_AVPlayer *player);
431
432/**
433 * @brief Returns the value whether single looping is enabled or not .
434 * @syscap SystemCapability.Multimedia.Media.AVPlayer
435 * @param player Pointer to an OH_AVPlayer instance
436 * @return Returns true if the playback is single looping; Return false if not or input player is nullptr.
437 * @since 11
438 * @version 1.0
439 */
440bool OH_AVPlayer_IsLooping(OH_AVPlayer *player);
441
442/**
443 * @brief Enables single looping of the media playback.
444 * @syscap SystemCapability.Multimedia.Media.AVPlayer
445 * @param player Pointer to an OH_AVPlayer instance
446 * @param loop The switch to set loop
447 * @return Function result code.
448 *         {@link AV_ERR_OK} if the execution is successful.
449 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr or player SetLooping failed.
450 * @since 11
451 * @version 1.0
452 */
453OH_AVErrCode OH_AVPlayer_SetLooping(OH_AVPlayer *player, bool loop);
454
455/**
456 * @brief Method to set player callback.
457 * @syscap SystemCapability.Multimedia.Media.AVPlayer
458 * @param player Pointer to an OH_AVPlayer instance
459 * @param callback object pointer.
460 * @return Function result code.
461 *         {@link AV_ERR_OK} if the execution is successful.
462 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr, callback.onInfo or callback.onError is null,
463 *         or player SetPlayerCallback failed.
464 * @since 11
465 * @deprecated since 12
466 * @useinstead {@link OH_AVPlayer_SetPlayerOnInfoCallback} {@link OH_AVPlayer_SetPlayerOnErrorCallback}
467 * @version 1.0
468 */
469OH_AVErrCode OH_AVPlayer_SetPlayerCallback(OH_AVPlayer *player, AVPlayerCallback callback);
470
471/**
472 * @brief Select audio or subtitle track.
473 *
474 * By default, the first audio stream with data is played, and the subtitle track is not played.
475 * After the settings take effect, the original track will become invalid. Please set subtitles
476 * in prepared/playing/paused/completed state and set audio tracks in prepared state.
477 *
478 * @syscap SystemCapability.Multimedia.Media.AVPlayer
479 * @param player Pointer to an OH_AVPlayer instance
480 * @param index Track index
481 * @return Function result code.
482 *         {@link AV_ERR_OK} if the execution is successful.
483 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr or player SelectTrack failed.
484 * @since 11
485 * @version 1.0
486*/
487OH_AVErrCode OH_AVPlayer_SelectTrack(OH_AVPlayer *player, int32_t index);
488
489/**
490 * @brief Deselect the current audio or subtitle track.
491 *
492 * After audio is deselected, the default track will be played, and after subtitles are deselected,
493 * they will not be played. Please set subtitles in prepared/playing/paused/completed state and set
494 * audio tracks in prepared state.
495 *
496 * @syscap SystemCapability.Multimedia.Media.AVPlayer
497 * @param player Pointer to an OH_AVPlayer instance
498 * @param index Track index
499 * @return Function result code.
500 *         {@link AV_ERR_OK} if the execution is successful.
501 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr or player DeselectTrack failed.
502 * @since 11
503 * @version 1.0
504*/
505OH_AVErrCode OH_AVPlayer_DeselectTrack(OH_AVPlayer *player, int32_t index);
506
507/**
508 * @brief Obtain the currently effective track index.
509 *
510 * Please get it in the prepared/playing/paused/completed state.
511 *
512 * @syscap SystemCapability.Multimedia.Media.AVPlayer
513 * @param player Pointer to an OH_AVPlayer instance
514 * @param trackType Media type.
515 * @param index Track index
516 * @return Function result code.
517 *         {@link AV_ERR_OK} if the execution is successful.
518 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr or player GetCurrentTrack failed.
519 * @since 11
520 * @version 1.0
521 */
522OH_AVErrCode OH_AVPlayer_GetCurrentTrack(OH_AVPlayer *player, int32_t trackType, int32_t *index);
523
524/**
525 * @brief Method to set player media key system info callback.
526 * @syscap SystemCapability.Multimedia.Media.AVPlayer
527 * @param player Pointer to an OH_AVPlayer instance
528 * @param callback object pointer.
529 * @return Function result code.
530 *         {@link AV_ERR_OK} if the execution is successful.
531 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr, MediaKeySystemInfoCallback is null
532 *         player SetDrmSystemInfoCallback failed, SetDrmSystemInfoCallback failed or SetDrmSystemInfoCallback failed.
533 * @since 12
534 * @version 1.0
535 */
536OH_AVErrCode OH_AVPlayer_SetMediaKeySystemInfoCallback(OH_AVPlayer *player,
537    Player_MediaKeySystemInfoCallback callback);
538
539/**
540 * @brief Obtains media key system info to create media key session.
541 * @syscap SystemCapability.Multimedia.Media.AVPlayer
542 * @param player Pointer to an OH_AVPlayer instance
543 * @param mediaKeySystemInfo Media key system info.
544 * @return Function result code.
545 *         {@link AV_ERR_OK} if the execution is successful.
546 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr or no memory.
547 * @since 12
548 * @version 1.0
549 */
550OH_AVErrCode OH_AVPlayer_GetMediaKeySystemInfo(OH_AVPlayer *player, DRM_MediaKeySystemInfo *mediaKeySystemInfo);
551
552/**
553 * @brief Set decryption info.
554 *
555 * @syscap SystemCapability.Multimedia.Media.AVPlayer
556 * @param player Pointer to an OH_AVPlayer instance
557 * @param mediaKeySession A media key session instance with decryption function.
558 * @param secureVideoPath Require secure decoder or not.
559 * @return Function result code.
560 *         {@link AV_ERR_OK} if the execution is successful.
561 *         {@link AV_ERR_INVALID_VAL} if input player is nullptr or player SetDecryptConfig failed.
562 * @since 12
563 * @version 1.0
564*/
565OH_AVErrCode OH_AVPlayer_SetDecryptionConfig(OH_AVPlayer *player, MediaKeySession *mediaKeySession,
566    bool secureVideoPath);
567
568/**
569 * @brief Method to set player information notify callback.
570 * @syscap SystemCapability.Multimedia.Media.AVPlayer
571 * @param player Pointer to an OH_AVPlayer instance.
572 * @param callback Pointer to callback function, nullptr indicates unregister callback.
573 * @param userData Pointer to user specific data.
574 * @return Function result code.
575 *         {@link AV_ERR_OK} if the execution is successful.
576 *         {@link AV_ERR_INVALID_VAL} if input player is null or player SetOnInfoCallback failed.
577 * @since 12
578 */
579OH_AVErrCode OH_AVPlayer_SetOnInfoCallback(OH_AVPlayer *player, OH_AVPlayerOnInfoCallback callback, void *userData);
580
581/**
582 * @brief Method to set player error callback.
583 * @syscap SystemCapability.Multimedia.Media.AVPlayer
584 * @param player Pointer to an OH_AVPlayer instance.
585 * @param callback Pointer to callback function, nullptr indicates unregister callback.
586 * @param userData Pointer to user specific data.
587 * @return Function result code.
588 *         {@link AV_ERR_OK} if the execution is successful.
589 *         {@link AV_ERR_INVALID_VAL} if input player is null or player SetOnErrorCallback failed.
590 * @since 12
591 */
592OH_AVErrCode OH_AVPlayer_SetOnErrorCallback(OH_AVPlayer *player, OH_AVPlayerOnErrorCallback callback, void *userData);
593
594#ifdef __cplusplus
595}
596#endif
597
598#endif // MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVPLAYER_H
599