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