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 INTERFACES_INNERKITS_NATIVE_INCLUDE_MEDIA_ASSET_H
17 #define INTERFACES_INNERKITS_NATIVE_INCLUDE_MEDIA_ASSET_H
18 
19 #include "file_asset.h"
20 #include "media_asset_base_capi.h"
21 
22 namespace OHOS {
23 namespace Media {
24 
25 class MediaAsset {
26 public:
27     virtual ~MediaAsset() = default;
28 
29 public:
30     virtual MediaLibrary_ErrorCode GetUri(const char** uri) = 0;
31     virtual MediaLibrary_ErrorCode GetMediaType(MediaLibrary_MediaType* mediaType) = 0;
32     virtual MediaLibrary_ErrorCode GetMediaSubType(MediaLibrary_MediaSubType* mediaSubType) = 0;
33     virtual MediaLibrary_ErrorCode GetDisplayName(const char** displayName) = 0;
34     virtual MediaLibrary_ErrorCode GetSize(uint32_t* size) = 0;
35     virtual MediaLibrary_ErrorCode GetDateAdded(uint32_t* dateAdded) = 0;
36     virtual MediaLibrary_ErrorCode GetDateModified(uint32_t* dateModified) = 0;
37     virtual MediaLibrary_ErrorCode GetDateAddedMs(uint32_t* dateAddedMs) = 0;
38     virtual MediaLibrary_ErrorCode GetDateModifiedMs(uint32_t* dateModifiedMs) = 0;
39     virtual MediaLibrary_ErrorCode GetDateTaken(uint32_t* dateTaken) = 0;
40     virtual MediaLibrary_ErrorCode GetDuration(uint32_t* duration) = 0;
41     virtual MediaLibrary_ErrorCode GetWidth(uint32_t* width) = 0;
42     virtual MediaLibrary_ErrorCode GetHeight(uint32_t* height) = 0;
43     virtual MediaLibrary_ErrorCode GetOrientation(uint32_t* orientation) = 0;
44     virtual MediaLibrary_ErrorCode IsFavorite(uint32_t* favorite) = 0;
45     virtual MediaLibrary_ErrorCode GetTitle(const char** title) = 0;
46 
47     virtual std::shared_ptr<FileAsset> GetFileAssetInstance() const = 0;
48 };
49 
50 class __attribute__((visibility("default"))) MediaAssetFactory {
51 public:
52     static std::shared_ptr<MediaAsset> CreateMediaAsset(std::shared_ptr<FileAsset> fileAsset);
53 private:
54     MediaAssetFactory() = default;
55     ~MediaAssetFactory() = default;
56 };
57 
58 } // Media
59 } // OHOS
60 #endif // INTERFACES_INNERKITS_NATIVE_INCLUDE_MEDIA_ASSET_H
61