1 /* 2 * Copyright (c) 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 INTERFACES_INNER_API_ALGORITHM_METADATA_GENERATOR_H 17 #define INTERFACES_INNER_API_ALGORITHM_METADATA_GENERATOR_H 18 19 #include <atomic> 20 #include <memory> 21 #include <optional> 22 #include "external_window.h" 23 #include "algorithm_common.h" 24 25 namespace OHOS { 26 namespace Media { 27 namespace VideoProcessingEngine { 28 class __attribute__((visibility("default"))) MetadataGenerator { 29 public: 30 /* * 31 * @brief Create a MetadataGenerator object. 32 * @syscap 33 * @return pointer of the MetadataGenerator object. 34 * @since 11 35 */ 36 static std::shared_ptr<MetadataGenerator> Create(); 37 static std::shared_ptr<MetadataGenerator> Create(std::shared_ptr<OpenGLContext> openglContext); 38 39 /* * 40 * @brief 设置参数 41 * @syscap 42 * @param parameter 输入参数 43 * @return 返回错误码VPEAlgoErrCode 44 * @since 11 45 */ 46 virtual VPEAlgoErrCode SetParameter(const MetadataGeneratorParameter ¶meter) = 0; 47 48 /* * 49 * @brief 查询参数 50 * @syscap 51 * @param parameter 输出参数 52 * @return 返回错误码VPEAlgoErrCode 53 * @since 11 54 */ 55 virtual VPEAlgoErrCode GetParameter(MetadataGeneratorParameter ¶meter) const = 0; 56 57 /* * 58 * @brief 用于解码后视频帧、sdr和单层hdr图片元数据生成。 59 * @syscap 60 * @param input 输入图片,生成的元数据写入该image 61 * @return 返回错误码VPEAlgoErrCode 62 * @since 11 63 */ 64 virtual VPEAlgoErrCode Process(const sptr<SurfaceBuffer> &input) = 0; 65 66 protected: 67 virtual ~MetadataGenerator() = default; 68 }; 69 70 extern "C" int32_t MetadataGeneratorCreate(int32_t* instance); 71 72 extern "C" int32_t MetadataGeneratorProcessImage(int32_t instance, OHNativeWindowBuffer* inputImage); 73 74 extern "C" int32_t MetadataGeneratorDestroy(int32_t* instance); 75 76 } // namespace VideoProcessingEngine 77 } // namespace Media 78 } // namespace OHOS 79 80 #endif // INTERFACES_INNER_API_ALGORITHM_METADATA_GENERATOR_H 81