1049e185fSopenharmony_ci/*
2049e185fSopenharmony_ci * Copyright (C) 2023 Huawei Device Co., Ltd.
3049e185fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4049e185fSopenharmony_ci * you may not use this file except in compliance with the License.
5049e185fSopenharmony_ci * You may obtain a copy of the License at
6049e185fSopenharmony_ci *
7049e185fSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8049e185fSopenharmony_ci *
9049e185fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10049e185fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11049e185fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12049e185fSopenharmony_ci * See the License for the specific language governing permissions and
13049e185fSopenharmony_ci * limitations under the License.
14049e185fSopenharmony_ci */
15049e185fSopenharmony_ci
16049e185fSopenharmony_ci/**
17049e185fSopenharmony_ci * @addtogroup AVPlayer
18049e185fSopenharmony_ci * @{
19049e185fSopenharmony_ci *
20049e185fSopenharmony_ci * @brief Provides APIs of Playback capability for Media Source.
21049e185fSopenharmony_ci *
22049e185fSopenharmony_ci * @Syscap SystemCapability.Multimedia.Media.AVPlayer
23049e185fSopenharmony_ci * @since 11
24049e185fSopenharmony_ci * @version 1.0
25049e185fSopenharmony_ci */
26049e185fSopenharmony_ci
27049e185fSopenharmony_ci/**
28049e185fSopenharmony_ci * @file avplayer_base.h
29049e185fSopenharmony_ci *
30049e185fSopenharmony_ci * @brief Defines the structure and enumeration for Media AVPlayer.
31049e185fSopenharmony_ci *
32049e185fSopenharmony_ci * @kit MediaKit
33049e185fSopenharmony_ci * @library libavplayer.so
34049e185fSopenharmony_ci * @since 11
35049e185fSopenharmony_ci * @version 1.0
36049e185fSopenharmony_ci */
37049e185fSopenharmony_ci
38049e185fSopenharmony_ci#ifndef MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVPLAYER_BASH_H
39049e185fSopenharmony_ci#define MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVPLAYER_BASH_H
40049e185fSopenharmony_ci
41049e185fSopenharmony_ci#include <stdint.h>
42049e185fSopenharmony_ci
43049e185fSopenharmony_ci#include "native_avformat.h"
44049e185fSopenharmony_ci
45049e185fSopenharmony_ci#ifdef __cplusplus
46049e185fSopenharmony_ciextern "C" {
47049e185fSopenharmony_ci#endif
48049e185fSopenharmony_ci
49049e185fSopenharmony_citypedef struct OH_AVPlayer OH_AVPlayer;
50049e185fSopenharmony_citypedef struct NativeWindow OHNativeWindow;
51049e185fSopenharmony_ci
52049e185fSopenharmony_ci/**
53049e185fSopenharmony_ci * @brief Player States
54049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
55049e185fSopenharmony_ci * @since 11
56049e185fSopenharmony_ci * @version 1.0
57049e185fSopenharmony_ci */
58049e185fSopenharmony_citypedef enum AVPlayerState {
59049e185fSopenharmony_ci    /* idle states */
60049e185fSopenharmony_ci    AV_IDLE = 0,
61049e185fSopenharmony_ci    /* initialized states */
62049e185fSopenharmony_ci    AV_INITIALIZED = 1,
63049e185fSopenharmony_ci    /* prepared states */
64049e185fSopenharmony_ci    AV_PREPARED = 2,
65049e185fSopenharmony_ci    /* playing states */
66049e185fSopenharmony_ci    AV_PLAYING = 3,
67049e185fSopenharmony_ci    /* paused states */
68049e185fSopenharmony_ci    AV_PAUSED = 4,
69049e185fSopenharmony_ci    /* stopped states */
70049e185fSopenharmony_ci    AV_STOPPED = 5,
71049e185fSopenharmony_ci    /* Play to the end states */
72049e185fSopenharmony_ci    AV_COMPLETED = 6,
73049e185fSopenharmony_ci    /* released states */
74049e185fSopenharmony_ci    AV_RELEASED = 7,
75049e185fSopenharmony_ci    /* error states */
76049e185fSopenharmony_ci    AV_ERROR = 8,
77049e185fSopenharmony_ci} AVPlayerState;
78049e185fSopenharmony_ci
79049e185fSopenharmony_ci/**
80049e185fSopenharmony_ci * @brief Player Seek Mode
81049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
82049e185fSopenharmony_ci * @since 11
83049e185fSopenharmony_ci * @version 1.0
84049e185fSopenharmony_ci */
85049e185fSopenharmony_citypedef enum AVPlayerSeekMode {
86049e185fSopenharmony_ci    /* sync to keyframes after the time point. */
87049e185fSopenharmony_ci    AV_SEEK_NEXT_SYNC = 0,
88049e185fSopenharmony_ci    /* sync to keyframes before the time point. */
89049e185fSopenharmony_ci    AV_SEEK_PREVIOUS_SYNC,
90049e185fSopenharmony_ci    /**
91049e185fSopenharmony_ci     * @brief Sync to frames closest to the time point.
92049e185fSopenharmony_ci     * @syscap SystemCapability.Multimedia.Media.AVPlayer
93049e185fSopenharmony_ci     * @since 12
94049e185fSopenharmony_ci     */
95049e185fSopenharmony_ci    AV_SEEK_CLOSEST = 2,
96049e185fSopenharmony_ci} AVPlayerSeekMode;
97049e185fSopenharmony_ci
98049e185fSopenharmony_ci/**
99049e185fSopenharmony_ci * @brief Player Switch Mode
100049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
101049e185fSopenharmony_ci * @since 12
102049e185fSopenharmony_ci * @version 1.0
103049e185fSopenharmony_ci */
104049e185fSopenharmony_citypedef enum AVPlayerSwitchMode {
105049e185fSopenharmony_ci    /* sync to keyframes after the time point. */
106049e185fSopenharmony_ci    AV_SWITCH_SOOMTH = 0,
107049e185fSopenharmony_ci    /* sync to keyframes before the time point. */
108049e185fSopenharmony_ci    AV_SWITCH_SEGMENT,
109049e185fSopenharmony_ci    /**
110049e185fSopenharmony_ci     * @brief sync to the closest frame of the given timestamp.
111049e185fSopenharmony_ci     * @since 12
112049e185fSopenharmony_ci     */
113049e185fSopenharmony_ci    AV_SWITCH_CLOSEST = 2,
114049e185fSopenharmony_ci} AVPlayerSwitchMode;
115049e185fSopenharmony_ci
116049e185fSopenharmony_ci/**
117049e185fSopenharmony_ci * @brief Playback Speed
118049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
119049e185fSopenharmony_ci * @since 11
120049e185fSopenharmony_ci * @version 1.0
121049e185fSopenharmony_ci */
122049e185fSopenharmony_citypedef enum AVPlaybackSpeed {
123049e185fSopenharmony_ci    /* Video playback at 0.75x normal speed */
124049e185fSopenharmony_ci    AV_SPEED_FORWARD_0_75_X,
125049e185fSopenharmony_ci    /* Video playback at normal speed */
126049e185fSopenharmony_ci    AV_SPEED_FORWARD_1_00_X,
127049e185fSopenharmony_ci    /* Video playback at 1.25x normal speed */
128049e185fSopenharmony_ci    AV_SPEED_FORWARD_1_25_X,
129049e185fSopenharmony_ci    /* Video playback at 1.75x normal speed */
130049e185fSopenharmony_ci    AV_SPEED_FORWARD_1_75_X,
131049e185fSopenharmony_ci    /* Video playback at 2.0x normal speed */
132049e185fSopenharmony_ci    AV_SPEED_FORWARD_2_00_X,
133049e185fSopenharmony_ci    /**
134049e185fSopenharmony_ci     * @brief Video playback at 0.5x normal speed.
135049e185fSopenharmony_ci     * @syscap SystemCapability.Multimedia.Media.AVPlayer
136049e185fSopenharmony_ci     * @since 12
137049e185fSopenharmony_ci     */
138049e185fSopenharmony_ci    AV_SPEED_FORWARD_0_50_X,
139049e185fSopenharmony_ci    /**
140049e185fSopenharmony_ci     * @brief Video playback at 1.5x normal speed.
141049e185fSopenharmony_ci     * @syscap SystemCapability.Multimedia.Media.AVPlayer
142049e185fSopenharmony_ci     * @since 12
143049e185fSopenharmony_ci     */
144049e185fSopenharmony_ci    AV_SPEED_FORWARD_1_50_X,
145049e185fSopenharmony_ci    /**
146049e185fSopenharmony_ci     * @brief Video playback at 3.0x normal speed.
147049e185fSopenharmony_ci     * @syscap SystemCapability.Multimedia.Media.AVPlayer
148049e185fSopenharmony_ci     * @since 13
149049e185fSopenharmony_ci    */
150049e185fSopenharmony_ci    AV_SPEED_FORWARD_3_00_X,
151049e185fSopenharmony_ci    /**
152049e185fSopenharmony_ci     * @brief Video playback at 0.25x normal speed.
153049e185fSopenharmony_ci     * @syscap SystemCapability.Multimedia.Media.AVPlayer
154049e185fSopenharmony_ci     * @since 13
155049e185fSopenharmony_ci    */
156049e185fSopenharmony_ci    AV_SPEED_FORWARD_0_25_X,
157049e185fSopenharmony_ci    /**
158049e185fSopenharmony_ci     * @brief Video playback at 0.125x normal speed.
159049e185fSopenharmony_ci     * @syscap SystemCapability.Multimedia.Media.AVPlayer
160049e185fSopenharmony_ci     * @since 13
161049e185fSopenharmony_ci    */
162049e185fSopenharmony_ci    AV_SPEED_FORWARD_0_125_X,
163049e185fSopenharmony_ci} AVPlaybackSpeed;
164049e185fSopenharmony_ci
165049e185fSopenharmony_ci/**
166049e185fSopenharmony_ci * @brief Player OnInfo Type
167049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
168049e185fSopenharmony_ci * @since 11
169049e185fSopenharmony_ci * @version 1.0
170049e185fSopenharmony_ci */
171049e185fSopenharmony_citypedef enum AVPlayerOnInfoType {
172049e185fSopenharmony_ci    /* return the message when seeking done. */
173049e185fSopenharmony_ci    AV_INFO_TYPE_SEEKDONE = 0,
174049e185fSopenharmony_ci    /* return the message when speeding done. */
175049e185fSopenharmony_ci    AV_INFO_TYPE_SPEEDDONE = 1,
176049e185fSopenharmony_ci    /* return the message when select bitrate done */
177049e185fSopenharmony_ci    AV_INFO_TYPE_BITRATEDONE = 2,
178049e185fSopenharmony_ci    /* return the message when playback is end of steam. */
179049e185fSopenharmony_ci    AV_INFO_TYPE_EOS = 3,
180049e185fSopenharmony_ci    /* return the message when PlayerStates changed. */
181049e185fSopenharmony_ci    AV_INFO_TYPE_STATE_CHANGE = 4,
182049e185fSopenharmony_ci    /* return the current posion of playback automatically. */
183049e185fSopenharmony_ci    AV_INFO_TYPE_POSITION_UPDATE = 5,
184049e185fSopenharmony_ci    /* return the playback message. */
185049e185fSopenharmony_ci    AV_INFO_TYPE_MESSAGE = 6,
186049e185fSopenharmony_ci    /* return the message when volume changed. */
187049e185fSopenharmony_ci    AV_INFO_TYPE_VOLUME_CHANGE = 7,
188049e185fSopenharmony_ci    /* return the message when video size is first known or updated. */
189049e185fSopenharmony_ci    AV_INFO_TYPE_RESOLUTION_CHANGE = 8,
190049e185fSopenharmony_ci    /* return multiqueue buffering time. */
191049e185fSopenharmony_ci    AV_INFO_TYPE_BUFFERING_UPDATE = 9,
192049e185fSopenharmony_ci    /* return hls bitrate.
193049e185fSopenharmony_ci       Bitrate is to convert data into uint8_t array storage,
194049e185fSopenharmony_ci       which needs to be forcibly converted to uint32_t through offset access. */
195049e185fSopenharmony_ci    AV_INFO_TYPE_BITRATE_COLLECT = 10,
196049e185fSopenharmony_ci    /* return the message when audio focus changed. */
197049e185fSopenharmony_ci    AV_INFO_TYPE_INTERRUPT_EVENT = 11,
198049e185fSopenharmony_ci    /* return the duration of playback. */
199049e185fSopenharmony_ci    AV_INFO_TYPE_DURATION_UPDATE = 12,
200049e185fSopenharmony_ci    /* return the playback is live stream. */
201049e185fSopenharmony_ci    AV_INFO_TYPE_IS_LIVE_STREAM = 13,
202049e185fSopenharmony_ci    /* return the message when track changes. */
203049e185fSopenharmony_ci    AV_INFO_TYPE_TRACKCHANGE = 14,
204049e185fSopenharmony_ci    /* return the message when subtitle track info updated. */
205049e185fSopenharmony_ci    AV_INFO_TYPE_TRACK_INFO_UPDATE = 15,
206049e185fSopenharmony_ci    /* return the subtitle of playback. */
207049e185fSopenharmony_ci    AV_INFO_TYPE_SUBTITLE_UPDATE = 16,
208049e185fSopenharmony_ci    /** Return the reason when the audio output device changes. When this info is reported, the extra param of
209049e185fSopenharmony_ci     * {@link OH_AVPlayerOnInfo} is the same as {@OH_AudioStream_DeviceChangeReason} in audio framework.
210049e185fSopenharmony_ci     */
211049e185fSopenharmony_ci    AV_INFO_TYPE_AUDIO_OUTPUT_DEVICE_CHANGE = 17,
212049e185fSopenharmony_ci} AVPlayerOnInfoType;
213049e185fSopenharmony_ci
214049e185fSopenharmony_ci/**
215049e185fSopenharmony_ci * @brief Player Buffering Type
216049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
217049e185fSopenharmony_ci * @since 12
218049e185fSopenharmony_ci * @version 1.0
219049e185fSopenharmony_ci */
220049e185fSopenharmony_citypedef enum AVPlayerBufferingType {
221049e185fSopenharmony_ci    /** Indicates the buffer to start buffering. */
222049e185fSopenharmony_ci    AVPLAYER_BUFFERING_START = 1,
223049e185fSopenharmony_ci
224049e185fSopenharmony_ci    /** Indicates the buffer to end buffering and start playback. */
225049e185fSopenharmony_ci    AVPLAYER_BUFFERING_END,
226049e185fSopenharmony_ci
227049e185fSopenharmony_ci    /** Indicates the current buffering percentage of the buffer. */
228049e185fSopenharmony_ci    AVPLAYER_BUFFERING_PERCENT,
229049e185fSopenharmony_ci
230049e185fSopenharmony_ci    /** Indicates how long the buffer cache data can be played. */
231049e185fSopenharmony_ci    AVPLAYER_BUFFERING_CACHED_DURATION,
232049e185fSopenharmony_ci} AVPlayerBufferingType;
233049e185fSopenharmony_ci
234049e185fSopenharmony_ci/**
235049e185fSopenharmony_ci * @brief Key to get state, value type is int32_t.
236049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
237049e185fSopenharmony_ci * @since 12
238049e185fSopenharmony_ci * @version 1.0
239049e185fSopenharmony_ci */
240049e185fSopenharmony_ciextern const char* OH_PLAYER_STATE;
241049e185fSopenharmony_ci
242049e185fSopenharmony_ci/**
243049e185fSopenharmony_ci * @brief Key to get state change reason, value type is int32_t.
244049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
245049e185fSopenharmony_ci * @since 12
246049e185fSopenharmony_ci * @version 1.0
247049e185fSopenharmony_ci */
248049e185fSopenharmony_ciextern const char* OH_PLAYER_STATE_CHANGE_REASON;
249049e185fSopenharmony_ci
250049e185fSopenharmony_ci/**
251049e185fSopenharmony_ci * @brief Key to get volume, value type is float.
252049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
253049e185fSopenharmony_ci * @since 12
254049e185fSopenharmony_ci * @version 1.0
255049e185fSopenharmony_ci */
256049e185fSopenharmony_ciextern const char* OH_PLAYER_VOLUME;
257049e185fSopenharmony_ci
258049e185fSopenharmony_ci/**
259049e185fSopenharmony_ci * @brief Key to get bitrate count, value type is uint32_t array.
260049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
261049e185fSopenharmony_ci * @since 12
262049e185fSopenharmony_ci * @version 1.0
263049e185fSopenharmony_ci */
264049e185fSopenharmony_ciextern const char* OH_PLAYER_BITRATE_ARRAY;
265049e185fSopenharmony_ci
266049e185fSopenharmony_ci/**
267049e185fSopenharmony_ci * @brief Key to get audio interrupt type, value type is int32_t.
268049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
269049e185fSopenharmony_ci * @since 12
270049e185fSopenharmony_ci * @version 1.0
271049e185fSopenharmony_ci */
272049e185fSopenharmony_ciextern const char* OH_PLAYER_AUDIO_INTERRUPT_TYPE;
273049e185fSopenharmony_ci
274049e185fSopenharmony_ci/**
275049e185fSopenharmony_ci * @brief Key to get audio interrupt force, value type is int32_t.
276049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
277049e185fSopenharmony_ci * @since 12
278049e185fSopenharmony_ci * @version 1.0
279049e185fSopenharmony_ci */
280049e185fSopenharmony_ciextern const char* OH_PLAYER_AUDIO_INTERRUPT_FORCE;
281049e185fSopenharmony_ci
282049e185fSopenharmony_ci/**
283049e185fSopenharmony_ci * @brief Key to get audio interrupt hint, value type is int32_t.
284049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
285049e185fSopenharmony_ci * @since 12
286049e185fSopenharmony_ci * @version 1.0
287049e185fSopenharmony_ci */
288049e185fSopenharmony_ciextern const char* OH_PLAYER_AUDIO_INTERRUPT_HINT;
289049e185fSopenharmony_ci
290049e185fSopenharmony_ci/**
291049e185fSopenharmony_ci * @brief Key to get audio device change reason, value type is int32_t.
292049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
293049e185fSopenharmony_ci * @since 12
294049e185fSopenharmony_ci * @version 1.0
295049e185fSopenharmony_ci */
296049e185fSopenharmony_ciextern const char* OH_PLAYER_AUDIO_DEVICE_CHANGE_REASON;
297049e185fSopenharmony_ci
298049e185fSopenharmony_ci/**
299049e185fSopenharmony_ci * @brief Key to get buffering type, value type is AVPlayerBufferingType.
300049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
301049e185fSopenharmony_ci * @since 12
302049e185fSopenharmony_ci * @version 1.0
303049e185fSopenharmony_ci */
304049e185fSopenharmony_ciextern const char* OH_PLAYER_BUFFERING_TYPE;
305049e185fSopenharmony_ci
306049e185fSopenharmony_ci/**
307049e185fSopenharmony_ci * @brief Key to get buffering value, value type is int32_t.
308049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
309049e185fSopenharmony_ci * @since 12
310049e185fSopenharmony_ci * @version 1.0
311049e185fSopenharmony_ci */
312049e185fSopenharmony_ciextern const char* OH_PLAYER_BUFFERING_VALUE;
313049e185fSopenharmony_ci
314049e185fSopenharmony_ci/**
315049e185fSopenharmony_ci * @brief Key to get seek position, value type is int32_t.
316049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
317049e185fSopenharmony_ci * @since 12
318049e185fSopenharmony_ci */
319049e185fSopenharmony_ciextern const char* OH_PLAYER_SEEK_POSITION;
320049e185fSopenharmony_ci
321049e185fSopenharmony_ci/**
322049e185fSopenharmony_ci * @brief Key to get playback speed, value type is AVPlaybackSpeed.
323049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
324049e185fSopenharmony_ci * @since 12
325049e185fSopenharmony_ci */
326049e185fSopenharmony_ciextern const char* OH_PLAYER_PLAYBACK_SPEED;
327049e185fSopenharmony_ci
328049e185fSopenharmony_ci/**
329049e185fSopenharmony_ci * @brief Key to get bitrate, value type is uint32_t.
330049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
331049e185fSopenharmony_ci * @since 12
332049e185fSopenharmony_ci */
333049e185fSopenharmony_ciextern const char* OH_PLAYER_BITRATE;
334049e185fSopenharmony_ci
335049e185fSopenharmony_ci/**
336049e185fSopenharmony_ci * @brief Key to get current position, value type is int32_t.
337049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
338049e185fSopenharmony_ci * @since 12
339049e185fSopenharmony_ci */
340049e185fSopenharmony_ciextern const char* OH_PLAYER_CURRENT_POSITION;
341049e185fSopenharmony_ci
342049e185fSopenharmony_ci/**
343049e185fSopenharmony_ci * @brief Key to get duration, value type is int64_t.
344049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
345049e185fSopenharmony_ci * @since 12
346049e185fSopenharmony_ci */
347049e185fSopenharmony_ciextern const char* OH_PLAYER_DURATION;
348049e185fSopenharmony_ci
349049e185fSopenharmony_ci/**
350049e185fSopenharmony_ci * @brief Key to get video width, value type is int32_t.
351049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
352049e185fSopenharmony_ci * @since 12
353049e185fSopenharmony_ci */
354049e185fSopenharmony_ciextern const char* OH_PLAYER_VIDEO_WIDTH;
355049e185fSopenharmony_ci
356049e185fSopenharmony_ci/**
357049e185fSopenharmony_ci * @brief Key to get video height, value type is int32_t.
358049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
359049e185fSopenharmony_ci * @since 12
360049e185fSopenharmony_ci */
361049e185fSopenharmony_ciextern const char* OH_PLAYER_VIDEO_HEIGHT;
362049e185fSopenharmony_ci
363049e185fSopenharmony_ci/**
364049e185fSopenharmony_ci * @brief Key to get message type, value type is int32_t.
365049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
366049e185fSopenharmony_ci * @since 12
367049e185fSopenharmony_ci */
368049e185fSopenharmony_ciextern const char* OH_PLAYER_MESSAGE_TYPE;
369049e185fSopenharmony_ci
370049e185fSopenharmony_ci/**
371049e185fSopenharmony_ci * @brief Key to get is live stream, value type is int32_t.
372049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
373049e185fSopenharmony_ci * @since 12
374049e185fSopenharmony_ci */
375049e185fSopenharmony_ciextern const char* OH_PLAYER_IS_LIVE_STREAM;
376049e185fSopenharmony_ci
377049e185fSopenharmony_ci/**
378049e185fSopenharmony_ci * @brief Called when a player message or alarm is received.
379049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
380049e185fSopenharmony_ci * @param player The pointer to an OH_AVPlayer instance.
381049e185fSopenharmony_ci * @param type Indicates the information type. For details, see {@link AVPlayerOnInfoType}.
382049e185fSopenharmony_ci * @param extra Indicates other information, for example, the start time position of a playing file.
383049e185fSopenharmony_ci * @since 11
384049e185fSopenharmony_ci * @deprecated since 12
385049e185fSopenharmony_ci * @useinstead {@link OH_AVPlayerOnInfoCallback}
386049e185fSopenharmony_ci * @version 1.0
387049e185fSopenharmony_ci */
388049e185fSopenharmony_citypedef void (*OH_AVPlayerOnInfo)(OH_AVPlayer *player, AVPlayerOnInfoType type, int32_t extra);
389049e185fSopenharmony_ci
390049e185fSopenharmony_ci/**
391049e185fSopenharmony_ci * @brief Called when a player info event is received.
392049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
393049e185fSopenharmony_ci * @param player The pointer to an OH_AVPlayer instance.
394049e185fSopenharmony_ci * @param type Indicates the information type. For details, see {@link AVPlayerOnInfoType}.
395049e185fSopenharmony_ci * @param infoBody Indicates the information parameters, only valid in callback function.
396049e185fSopenharmony_ci * @param userData Pointer to user specific data.
397049e185fSopenharmony_ci * @since 12
398049e185fSopenharmony_ci */
399049e185fSopenharmony_citypedef void (*OH_AVPlayerOnInfoCallback)(OH_AVPlayer *player, AVPlayerOnInfoType type, OH_AVFormat* infoBody,
400049e185fSopenharmony_ci    void *userData);
401049e185fSopenharmony_ci
402049e185fSopenharmony_ci/**
403049e185fSopenharmony_ci * @brief Called when an error occurred for versions above api9
404049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
405049e185fSopenharmony_ci * @param player The pointer to an OH_AVPlayer instance.
406049e185fSopenharmony_ci * @param errorCode Error code.
407049e185fSopenharmony_ci * @param errorMsg Error message.
408049e185fSopenharmony_ci * @since 11
409049e185fSopenharmony_ci * @deprecated since 12
410049e185fSopenharmony_ci * @useinstead {@link OH_AVPlayerOnInfoCallback} {@link OH_AVPlayerOnError}
411049e185fSopenharmony_ci * @version 1.0
412049e185fSopenharmony_ci */
413049e185fSopenharmony_citypedef void (*OH_AVPlayerOnError)(OH_AVPlayer *player, int32_t errorCode, const char *errorMsg);
414049e185fSopenharmony_ci
415049e185fSopenharmony_ci/**
416049e185fSopenharmony_ci * @brief Called when an error occurred.
417049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
418049e185fSopenharmony_ci * @param player The pointer to an OH_AVPlayer instance.
419049e185fSopenharmony_ci * @param errorCode Error code.
420049e185fSopenharmony_ci * @param errorMsg Error message, only valid in callback function.
421049e185fSopenharmony_ci * @param userData Pointer to user specific data.
422049e185fSopenharmony_ci * @since 12
423049e185fSopenharmony_ci */
424049e185fSopenharmony_citypedef void (*OH_AVPlayerOnErrorCallback)(OH_AVPlayer *player, int32_t errorCode, const char *errorMsg,
425049e185fSopenharmony_ci    void *userData);
426049e185fSopenharmony_ci
427049e185fSopenharmony_ci/**
428049e185fSopenharmony_ci * @brief A collection of all callback function pointers in OH_AVPlayer. Register an instance of this
429049e185fSopenharmony_ci * structure to the OH_AVPlayer instance, and process the information reported through the callback to ensure the
430049e185fSopenharmony_ci * normal operation of OH_AVPlayer.
431049e185fSopenharmony_ci * @syscap SystemCapability.Multimedia.Media.AVPlayer
432049e185fSopenharmony_ci * @param onInfo Monitor OH_AVPlayer operation information, refer to {@link OH_AVPlayerOnInfo}
433049e185fSopenharmony_ci * @param onError Monitor OH_AVPlayer operation errors, refer to {@link OH_AVPlayerOnError}
434049e185fSopenharmony_ci * @since 11
435049e185fSopenharmony_ci * @deprecated since 12
436049e185fSopenharmony_ci * @useinstead {@link OH_AVPlayerOnInfoCallback} {@link OH_AVPlayerOnErrorCallback}
437049e185fSopenharmony_ci * @version 1.0
438049e185fSopenharmony_ci */
439049e185fSopenharmony_citypedef struct AVPlayerCallback {
440049e185fSopenharmony_ci    OH_AVPlayerOnInfo onInfo = nullptr;
441049e185fSopenharmony_ci    OH_AVPlayerOnError onError = nullptr;
442049e185fSopenharmony_ci} AVPlayerCallback;
443049e185fSopenharmony_ci
444049e185fSopenharmony_ci#ifdef __cplusplus
445049e185fSopenharmony_ci}
446049e185fSopenharmony_ci#endif
447049e185fSopenharmony_ci#endif // MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVPLAYER_BASH_H
448