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