1 /* 2 * Copyright (c) 2020-2021 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 #ifndef HI_LITEPLAYER_H 17 #define HI_LITEPLAYER_H 18 19 #include "hi_demuxer.h" 20 21 /** \addtogroup PLAYER */ 22 /** @{ */ /** <!-- [PLAYER] */ 23 24 #ifdef __cplusplus 25 #if __cplusplus 26 extern "C" { 27 #endif 28 #endif /* End of #ifdef __cplusplus */ 29 30 31 /** Error information of the player */ 32 enum PlayerControlError { 33 PLAYERCONTROL_ERROR_VID_PLAY_FAIL = 0x0, /* The video fails to be played. */ 34 PLAYERCONTROL_ERROR_AUD_PLAY_FAIL, /* The audio fails to be played. */ 35 PLAYERCONTROL_ERROR_DEMUX_FAIL, /* The file fails to be played. */ 36 PLAYERCONTROL_ERROR_TIMEOUT, /* Operation timeout. For example, reading data timeout. */ 37 PLAYERCONTROL_ERROR_NOT_SUPPORT, /* The file format is not supported. */ 38 PLAYERCONTROL_ERROR_UNKNOW, /* Unknown error. */ 39 PLAYERCONTROL_ERROR_ILLEGAL_STATEACTION, /* illegal action at cur state. */ 40 PLAYERCONTROL_ERROR_BUTT, 41 }; 42 43 enum PlayerControlEvent { 44 PLAYERCONTROL_EVENT_STATE_CHANGED = 0x0, /* the player status changed */ 45 PLAYERCONTROL_EVENT_EOF, /* the player is playing the end */ 46 PLAYERCONTROL_EVENT_SOF, /* the player backward tplay to the start of file */ 47 PLAYERCONTROL_EVENT_PROGRESS, /* current playing progress. it will be called every one second. 48 the additional value that in the unit of ms is current playing time */ 49 PLAYERCONTROL_EVENT_SEEK_END, /* seek time jump, the additional value is the seek value */ 50 PLAYERCONTROL_EVENT_ERROR, /* play error */ 51 PLAYERCONTROL_FIRST_VIDEO_FRAME, 52 PLAYERCONTROL_FIRST_AUDIO_FRAME, 53 PLAYERCONTROL_EVENT_BUTT 54 }; 55 56 struct PlayerControlStreamAttr { 57 int32_t s32VidStreamId; /**< Video stream ID. */ 58 int32_t s32AudStreamId; /**< Audio stream ID. */ 59 }; 60 61 struct PlayerControlParam { 62 uint32_t u32PlayPosNotifyIntervalMs; /* Current playing Time notify interval in Ms. */ 63 uint32_t u32VideoEsBufSize; /* video es stream cache buf size.[1k,200M] unit:byte; 64 if 0,use the inner default value */ 65 uint32_t u32AudioEsBufSize; /* audio es stream cache buf size.[1k,100M] unit:byte; 66 if 0,use the inner default value */ 67 uint32_t u32VdecFrameBufCnt; /* Number of VB blocks for storing decoded image frames; 68 if 0,use the inner default value */ 69 bool bPauseMode; /* pause after first frame render mode flag, HI_FALSE:do not pause, 70 HI_TRUE:pause after first frame render. */ 71 }; 72 73 typedef void (*PlayerCtrlEeventFun)(void *player, PlayerControlEvent enEvent, const void *data); 74 75 struct PlayerCtrlCallbackParam { 76 void *player; 77 PlayerCtrlEeventFun callbackFun; 78 }; 79 80 #ifdef __cplusplus 81 #if __cplusplus 82 } 83 #endif 84 #endif /* End of #ifdef __cplusplus */ 85 86 #endif 87