• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 AVMETADATAHELPER_SERVICE_SERVER_H
17 #define AVMETADATAHELPER_SERVICE_SERVER_H
18 
19 #include <mutex>
20 #include "i_avmetadatahelper_service.h"
21 #include "i_avmetadatahelper_engine.h"
22 #include "nocopyable.h"
23 #include "uri_helper.h"
24 #include "task_queue.h"
25 
26 namespace OHOS {
27 namespace Media {
28 class AVMetadataHelperServer : public IAVMetadataHelperService, public NoCopyable {
29 public:
30     static std::shared_ptr<IAVMetadataHelperService> Create();
31     AVMetadataHelperServer();
32     virtual ~AVMetadataHelperServer();
33 
34     int32_t SetSource(const std::string &uri, int32_t usage) override;
35     int32_t SetSource(int32_t fd, int64_t offset, int64_t size, int32_t usage) override;
36     std::string ResolveMetadata(int32_t key) override;
37     std::unordered_map<int32_t, std::string> ResolveMetadata() override;
38     std::shared_ptr<AVSharedMemory> FetchArtPicture() override;
39     std::shared_ptr<AVSharedMemory> FetchFrameAtTime(int64_t timeUs,
40         int32_t option, const OutputConfiguration &param) override;
41     void Release() override;
42 private:
43     std::shared_ptr<IAVMetadataHelperEngine> avMetadataHelperEngine_ = nullptr;
44     std::mutex mutex_;
45     std::unique_ptr<UriHelper> uriHelper_;
46     TaskQueue taskQue_;
47 };
48 } // namespace Media
49 } // namespace OHOS
50 #endif // AVMETADATAHELPER_SERVICE_SERVER_H
51