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 I_STANDARD_AVMETADATAHELPER_SERVICE_H
17 #define I_STANDARD_AVMETADATAHELPER_SERVICE_H
18 
19 #include "ipc_types.h"
20 #include "iremote_broker.h"
21 #include "iremote_proxy.h"
22 #include "iremote_stub.h"
23 #include "i_avmetadatahelper_service.h"
24 #include "buffer/avsharedmemory.h"
25 
26 namespace OHOS {
27 namespace Media {
28 class IStandardAVMetadataHelperService : public IRemoteBroker {
29 public:
30     virtual ~IStandardAVMetadataHelperService() = default;
31     virtual int32_t SetSource(const std::string &uri, int32_t usage) = 0;
32     virtual int32_t SetSource(int32_t fd, int64_t offset, int64_t size, int32_t usage) = 0;
33     virtual int32_t SetSource(const sptr<IRemoteObject> &object) = 0;
34     virtual std::string ResolveMetadata(int32_t key) = 0;
35     virtual std::unordered_map<int32_t, std::string> ResolveMetadataMap() = 0;
36     virtual std::shared_ptr<Meta> GetAVMetadata() = 0;
37     virtual std::shared_ptr<AVSharedMemory> FetchArtPicture() = 0;
38     virtual std::shared_ptr<AVSharedMemory> FetchFrameAtTime(
39         int64_t timeUs, int32_t option, const OutputConfiguration &param) = 0;
40     virtual std::shared_ptr<AVBuffer> FetchFrameYuv(
41         int64_t timeUs, int32_t option, const OutputConfiguration &param) = 0;
42     virtual void Release() = 0;
43     virtual int32_t DestroyStub() = 0;
44     virtual int32_t SetHelperCallback() = 0;
45     virtual int32_t SetListenerObject(const sptr<IRemoteObject> &object) = 0;
46     virtual int32_t GetTimeByFrameIndex(uint32_t index, uint64_t &time) = 0;
47     virtual int32_t GetFrameIndexByTime(uint64_t time, uint32_t &index) = 0;
48 
49     /**
50      * IPC code ID
51      */
52     enum AVMetadataHelperServiceMsg {
53         SET_URI_SOURCE = 0,
54         SET_FD_SOURCE,
55         SET_MEDIA_DATA_SRC_OBJ,
56         RESOLVE_METADATA,
57         RESOLVE_METADATA_MAP,
58         FETCH_ALBUM_COVER,
59         FETCH_FRAME_AT_TIME,
60         FETCH_FRAME_YUV,
61         RELEASE,
62         DESTROY,
63         SET_CALLBACK,
64         SET_LISTENER_OBJ,
65         GET_AVMETADATA,
66         GET_TIME_BY_FRAME_INDEX,
67         GET_FRAME_INDEX_BY_TIME,
68         MAX_IPC_ID,
69     };
70 
71     DECLARE_INTERFACE_DESCRIPTOR(u"IStandardAVMetadataHelperService");
72 };
73 } // namespace Media
74 } // namespace OHOS
75 #endif // I_STANDARD_AVMETADATAHELPER_SERVICE_H
76