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 ABS_IMAGE_FORMAT_AGENT_H 17 #define ABS_IMAGE_FORMAT_AGENT_H 18 19 #include <string> 20 #include "image_plugin_type.h" 21 #include "plugin_service.h" 22 23 namespace OHOS { 24 namespace ImagePlugin { 25 class AbsImageFormatAgent { 26 public: 27 // get the image encoded format supported by this class. 28 virtual std::string GetFormatType() = 0; 29 30 // get the header size of the encoded format. 31 // it is used to determine the size of the image data that 32 // needs to be passed to the function of CheckFormat(). 33 virtual uint32_t GetHeaderSize() = 0; 34 35 // check if the image is in this encoded format, if it returns true. 36 virtual bool CheckFormat(const void *headerData, uint32_t dataSize) = 0; 37 38 // define multiple subservices for this interface. 39 static constexpr uint16_t SERVICE_DEFAULT = 0; 40 }; 41 } // namespace ImagePlugin 42 } // namespace OHOS 43 44 DECLARE_INTERFACE(OHOS::ImagePlugin::AbsImageFormatAgent, IMAGE_FORMAT_AGENT_IID) 45 46 #endif // ABS_IMAGE_FORMAT_AGENT_H 47