1 /* 2 * Copyright (c) 2023-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 #ifndef HISTREAMER_MEDIA_UTILS_H 17 #define HISTREAMER_MEDIA_UTILS_H 18 19 #include "i_player_engine.h" 20 #include "common/status.h" 21 #include "meta/media_types.h" 22 enum class PlayerStateId { 23 IDLE = 0, 24 INIT = 1, 25 PREPARING = 2, 26 READY = 3, 27 PAUSE = 4, 28 PLAYING = 5, 29 STOPPED = 6, 30 EOS = 7, 31 ERROR = 8, 32 }; 33 34 namespace OHOS { 35 namespace Media { 36 std::string __attribute__((visibility("default"))) GetClientBundleName(int32_t uid); 37 int32_t __attribute__((visibility("default"))) GetApiInfo(int32_t uid); 38 std::string __attribute__((visibility("default"))) GetBundleResourceLabel(std::string bundleName); 39 int __attribute__((visibility("default"))) TransStatus(Status status); 40 PlayerStates __attribute__((visibility("default"))) TransStateId2PlayerState(PlayerStateId state); 41 Plugins::SeekMode __attribute__((visibility("default"))) Transform2SeekMode(PlayerSeekMode mode); 42 const std::string& __attribute__((visibility("default"))) StringnessPlayerState(PlayerStates state); 43 float __attribute__((visibility("default"))) TransformPlayRate2Float(PlaybackRateMode rateMode); 44 inline PlaybackRateMode __attribute__((visibility("default"))) TransformFloat2PlayRate(float rate); 45 double __attribute__((visibility("default"))) ChangeModeToSpeed(const PlaybackRateMode& mode); 46 bool __attribute__((visibility("default"))) IsEnableOptimizeDecode(); 47 bool __attribute__((visibility("default"))) IsAppEnableRenderFirstFrame(int32_t uid); 48 bool __attribute__((visibility("default"))) GetPackageName(const char *key, std::string &value); 49 std::unordered_map<std::string, std::string> __attribute__((visibility("default"))) GetScreenCaptureSystemParam(); 50 constexpr double SPEED_0_75_X = 0.75; 51 constexpr double SPEED_1_00_X = 1.00; 52 constexpr double SPEED_1_25_X = 1.25; 53 constexpr double SPEED_1_75_X = 1.75; 54 constexpr double SPEED_2_00_X = 2.00; 55 } // namespace Media 56 } // namespace OHOS 57 58 #endif // HISTREAMER_MEDIA_UTILS_H