1 /*
2 * Copyright (c) 2023 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 #include "utils.h"
17 #include <algorithm>
18 #include <iterator>
19 #include "vpe_log.h"
20
21 namespace OHOS {
22 namespace Media {
23 namespace VideoProcessingEngine {
24 namespace Extension {
25
DoRegisterExtensions(uintptr_t addr,Utils::RegisterExtensionFunc func)26 void DoRegisterExtensions(uintptr_t addr, Utils::RegisterExtensionFunc func)
27 {
28 CHECK_AND_RETURN_LOG(func, "Register function is invalid");
29 auto extensionList = reinterpret_cast<ExtensionList *>(addr);
30 CHECK_AND_RETURN_LOG(extensionList != nullptr, "Extensionlist is nullptr");
31 auto extensions = func();
32 std::copy(extensions.begin(), extensions.end(), std::back_inserter(*extensionList));
33
34 VPE_LOGD("%{public}zu extensions loaded", extensions.size());
35 return;
36 }
37 } // namespace Extension
38 } // namespace VideoProcessingEngine
39 } // namespace Media
40 } // namespace OHOS
41