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