1 /* 2 * Copyright (C) 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 PLAYBIN_MSG_DEFINE_H 17 #define PLAYBIN_MSG_DEFINE_H 18 19 #include <functional> 20 #include <any> 21 22 namespace OHOS { 23 namespace Media { 24 /** 25 * Keep consistent with the define at player.h 26 */ 27 enum PlayBinMsgType : int32_t { 28 PLAYBIN_MSG_ERROR = 0, 29 PLAYBIN_MSG_SEEKDONE = 1, 30 PLAYBIN_MSG_SPEEDDONE, 31 PLAYBIN_MSG_BITRATEDONE, 32 PLAYBIN_MSG_EOS, 33 PLAYBIN_MSG_STATE_CHANGE, 34 PLAYBIN_MSG_POSITION_UPDATE, 35 PLAYBIN_MSG_SUBTYPE, 36 PLAYBIN_MSG_AUDIO_SINK, 37 PLAYBIN_MSG_EXTRA_FORMAT, 38 PLAYBIN_MSG_ASYNC_DONE, 39 }; 40 41 enum PlayBinMsgErrorSubType : int32_t { 42 PLAYBIN_SUB_MSG_ERROR_NO_MESSAGE = 0, 43 PLAYBIN_SUB_MSG_ERROR_WITH_MESSAGE = 1, 44 }; 45 46 enum PlayBinMsgPositionUpdateSubType : int32_t { 47 PLAYBIN_SUB_MSG_POSITION_UPDATE_FORCE = 0, 48 PLAYBIN_SUB_MSG_POSITION_UPDATE_UNFORCE = 1, 49 }; 50 51 enum PlayBinMsgSubType : int32_t { 52 PLAYBIN_SUB_MSG_UNKONWN = 0, 53 PLAYBIN_SUB_MSG_VIDEO_RENDING_START, 54 PLAYBIN_SUB_MSG_BUFFERING_START, 55 PLAYBIN_SUB_MSG_BUFFERING_END, 56 PLAYBIN_SUB_MSG_VIDEO_SIZE_CHANGED, 57 PLAYBIN_SUB_MSG_BUFFERING_PERCENT, 58 PLAYBIN_SUB_MSG_BUFFERING_TIME, 59 PLAYBIN_SUB_MSG_BUFFERING_USED_MQ_NUM, 60 PLAYBIN_SUB_MSG_VIDEO_RENDERING_START, 61 PLAYBIN_SUB_MSG_BITRATE_COLLECT, 62 PLAYBIN_SUB_MSG_VIDEO_ROTATION, 63 PLAYBIN_SUB_MSG_WARNING, 64 PLAYBIN_SUB_MSG_IS_LIVE_STREAM, 65 PLAYBIN_SUB_MSG_SUBTITLE_UPDATED, 66 PLAYBIN_SUB_MSG_AUDIO_CHANGED, 67 PLAYBIN_SUB_MSG_SUBTITLE_CHANGED, 68 PLAYBIN_SUB_MSG_DEFAULE_TRACK, 69 PLAYBIN_SUB_MSG_TRACK_DONE, 70 PLAYBIN_SUB_MSG_ADD_SUBTITLE_DONE, 71 PLAYBIN_SUB_MSG_ONERROR, 72 PLAYBIN_SUB_MSG_TRACK_NUM_UPDATE, 73 PLAYBIN_SUB_MSG_TRACK_INFO_UPDATE, 74 PLAYBIN_SUB_MSG_EXTEND_START = 0x1000, 75 }; 76 77 enum PlayBinMsgAudioSink : int32_t { 78 PLAYBIN_MSG_INTERRUPT_EVENT, 79 }; 80 81 enum PlayBinState : int32_t { 82 PLAYBIN_STATE_ERROR, 83 PLAYBIN_STATE_IDLE, 84 PLAYBIN_STATE_INITIALIZED, 85 PLAYBIN_STATE_PREPARING, 86 PLAYBIN_STATE_PREPARED, 87 PLAYBIN_STATE_PLAYING, 88 PLAYBIN_STATE_PAUSED, 89 PLAYBIN_STATE_STOPPED, 90 PLAYBIN_STATE_PLAYBACK_COMPLETE, 91 }; 92 93 struct PlayBinMessage { 94 int32_t type; // info, error 95 int32_t subType; // detail type 96 int32_t code; 97 std::any extra; 98 }; 99 100 using PlayBinMsgNotifier = std::function<void(const PlayBinMessage &)>; 101 } // namespace Media 102 } // namespace OHOS 103 #endif // PLAYBIN_MSG_DEFINE_H