• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "render/graphics/graphics_render_engine.h"
17 #include "graphics_render_engine_impl.h"
18 
19 namespace OHOS {
20 namespace Media {
21 namespace {
22 constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, LOG_DOMAIN_VIDEOEDITOR, "Render"};
23 }
24 static std::atomic_uint64_t g_engineId{ 1 };
Create(OHNativeWindow * outputWindow)25 std::shared_ptr<IGraphicsRenderEngine> IGraphicsRenderEngine::Create(OHNativeWindow* outputWindow)
26 {
27     if (outputWindow == nullptr) {
28         MEDIA_LOGE("create graphics render engine failed, output Window is null.");
29         return nullptr;
30     }
31     auto engine = std::make_shared<GraphicsRenderEngineImpl>(g_engineId.fetch_add(1));
32     VEFError error = engine->Init(outputWindow);
33     if (error != VEFError::ERR_OK) {
34         MEDIA_LOGE("init graphics render engine failed, error: %{public}d", error);
35         return nullptr;
36     }
37     MEDIA_LOGI("init graphic render engine success");
38     return engine;
39 }
40 }
41 }