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_ENCODER_H 17 #define ABS_IMAGE_ENCODER_H 18 19 #include "pixel_map.h" 20 #include "image_plugin_type.h" 21 #include "output_data_stream.h" 22 #include "plugin_service.h" 23 24 namespace OHOS { 25 namespace ImagePlugin { 26 struct PlEncodeOptions { 27 uint8_t quality = 100; 28 uint32_t numberHint = 1; 29 }; 30 31 class AbsImageEncoder { 32 public: 33 AbsImageEncoder() = default; 34 virtual ~AbsImageEncoder() = default; 35 virtual uint32_t StartEncode(OutputDataStream &outputStream, PlEncodeOptions &option) = 0; 36 virtual uint32_t AddImage(Media::PixelMap &pixelMap) = 0; 37 virtual uint32_t FinalizeEncode() = 0; 38 39 // define multiple subservices for this interface 40 static constexpr uint16_t SERVICE_DEFAULT = 0; 41 }; 42 } // namespace ImagePlugin 43 } // namespace OHOS 44 45 DECLARE_INTERFACE(OHOS::ImagePlugin::AbsImageEncoder, IMAGE_ENCODER_IID) 46 47 #endif // ABS_IMAGE_ENCODER_H 48