1 /*
2  * Copyright (C) 2024 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 INNER_API_MEDIA_LIBRARY_HELPER_INCLUDE_MEDIA_PHOTO_PROXY_H
17 #define INNER_API_MEDIA_LIBRARY_HELPER_INCLUDE_MEDIA_PHOTO_PROXY_H
18 
19 #include <refbase.h>
20 #include <string>
21 
22 namespace OHOS {
23 namespace Media {
24 enum class PhotoFormat : int32_t {
25     RGBA = 0,
26     JPG,
27     HEIF,
28     YUV,
29 };
30 
31 enum class PhotoQuality : int32_t {
32     HIGH = 0,
33     LOW,
34 };
35 
36 enum class DeferredProcType : int32_t {
37     BACKGROUND = 0,
38     OFFLINE,
39 };
40 
41 class PhotoProxy : public RefBase {
42 public:
PhotoProxy()43     PhotoProxy() {}
44     virtual ~PhotoProxy() = default;
45 
46     virtual std::string GetTitle() = 0;
47     virtual std::string GetExtension() = 0; // 图片后缀,例如:jpg/png
48     virtual std::string GetPhotoId() = 0; // 分段式图片id
49     virtual DeferredProcType GetDeferredProcType() = 0; // 分段式拍照类型,相机框架写入,通过媒体库直接透传回相机框架
50     virtual int32_t GetWidth() = 0;
51     virtual int32_t GetHeight() = 0;
52     virtual void *GetFileDataAddr() = 0;
53     virtual size_t GetFileSize() = 0;
54     virtual PhotoFormat GetFormat() = 0; // RGBA、JPG
55     virtual PhotoQuality GetPhotoQuality() = 0; // 后续相机框架可能通过AddPhotoProxy传入高质量图
56     virtual std::string GetBurstKey() = 0; // 一组连拍照片一个key, 32byte uuid
57     virtual bool IsCoverPhoto() = 0; // 设置封面,1表示封面
58     virtual void Release() = 0;
59     virtual double GetLatitude() = 0;
60     virtual double GetLongitude() = 0;
61     virtual int32_t GetShootingMode() = 0;
62 };
63 } // Media
64 } // OHOS
65 #endif // INNER_API_MEDIA_LIBRARY_HELPER_INCLUDE_MEDIA_PHOTO_PROXY_H