• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 FRAMEWORKS_SERVICES_MEDIA_CLOUD_ENHANCEMENT_INCLUDE_ENHANCEMENT_SERVICE_CALLBACK_H
17 #define FRAMEWORKS_SERVICES_MEDIA_CLOUD_ENHANCEMENT_INCLUDE_ENHANCEMENT_SERVICE_CALLBACK_H
18 
19 #include <memory>
20 #include <string>
21 
22 #include "enhancement_thread_manager.h"
23 #ifdef ABILITY_CLOUD_ENHANCEMENT_SUPPORT
24 #include "media_enhance_constants_c_api.h"
25 #include "media_enhance_handles.h"
26 #include "media_enhance_client_c_api.h"
27 #include "media_enhance_bundle_c_api.h"
28 #endif
29 
30 namespace OHOS {
31 namespace Media {
32 #define EXPORT __attribute__ ((visibility ("default")))
33 struct CloudEnhancementFileInfo {
34     int32_t fileId;
35     std::string filePath;
36     std::string displayName;
37     int32_t subtype;
38     int32_t hidden;
CloudEnhancementFileInfoCloudEnhancementFileInfo39     CloudEnhancementFileInfo() : fileId(0), filePath(""), displayName(""),
40         subtype(0), hidden(0) {}
CloudEnhancementFileInfoCloudEnhancementFileInfo41     CloudEnhancementFileInfo(int32_t fileId, std::string filePath, std::string displayName,
42         int32_t subtype, int32_t hidden) : fileId(fileId), filePath(filePath),
43         displayName(displayName), subtype(subtype), hidden(hidden) {}
44 };
45 
46 class EnhancementServiceCallback {
47 public:
48     EXPORT EnhancementServiceCallback();
49     EXPORT ~EnhancementServiceCallback();
50 
51 #ifdef ABILITY_CLOUD_ENHANCEMENT_SUPPORT
52     EXPORT static void OnSuccess(const char* photoId, MediaEnhance::MediaEnhanceBundleHandle* bundle);
53     EXPORT static void OnFailed(const char* photoId, MediaEnhance::MediaEnhanceBundleHandle* bundle);
54     EXPORT static void OnServiceReconnected();
55     EXPORT static void DealWithSuccessedTask(CloudEnhancementThreadTask& task);
56     EXPORT static void DealWithFailedTask(CloudEnhancementThreadTask& task);
57     EXPORT static void UpdateAlbumsForCloudEnhancement();
58 #endif
59 
60 private:
61 #ifdef ABILITY_CLOUD_ENHANCEMENT_SUPPORT
62     EXPORT static int32_t SaveCloudEnhancementPhoto(std::shared_ptr<CloudEnhancementFileInfo> info,
63         CloudEnhancementThreadTask& task);
64     EXPORT static int32_t CreateCloudEnhancementPhoto(int32_t sourceFileId,
65         std::shared_ptr<CloudEnhancementFileInfo> info);
66 #endif
67 };
68 } // namespace Media
69 } // namespace OHOS
70 #endif  // FRAMEWORKS_SERVICES_MEDIA_CLOUD_ENHANCEMENT_INCLUDE_ENHANCEMENT_SERVICE_CALLBACK_H