1 /* 2 * Copyright (c) 2022 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 HDI_VIDEO_COMPOSITION_H 17 #define HDI_VIDEO_COMPOSITION_H 18 #include <unordered_map> 19 #include "hdi_composer.h" 20 namespace OHOS { 21 namespace HDI { 22 namespace DISPLAY { 23 class HdiVideoComposition : public HdiComposition { 24 public: 25 int32_t Init(void) override; 26 int32_t SetLayers(std::vector<HdiLayer *> &layers, HdiLayer &clientLayer) override; 27 int32_t Apply(bool modeSet) override; ~HdiVideoComposition()28 ~HdiVideoComposition() override {} 29 30 private: 31 static constexpr const char *VO_LAYER_LIB_NAME = "libdisplay_layer_video.z.so"; 32 static constexpr const char *VO_LAYER_FUNC_INIT = "LayerInitialize"; 33 static constexpr const char *VO_LAYER_FUNC_DEINIT = "LayerUninitialize"; 34 35 int32_t VideoModuleInit(void); 36 bool CanHandle(HdiLayer &hdiLayer); 37 void InitGfxSurface(ISurface &surface, HdiLayerBuffer &buffer); 38 uint32_t CreateVideoLayerForHdiLayer(HdiLayer &hdiLayer); 39 uint32_t GetVoLayerId(HdiLayer &hdiLayer); 40 void CLoseUnUsedLayer(std::vector<HdiLayer *> &layers); 41 std::unordered_map<uint32_t, uint32_t> layerMaps_; 42 LayerFuncs *layerFuncs_ = nullptr; 43 void *videoModule_ = nullptr; 44 }; 45 } // namespace OHOS 46 } // namespace HDI 47 } // namespace DISPLAY 48 49 #endif // HDI_VIDEO_COMPOSITION_H