MCPcopy Create free account
hub / github.com/CasparCG/server / init

Function init

src/modules/html/html.cpp:224–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

222}
223
224void init(const core::module_dependencies& dependencies)
225{
226 dependencies.producer_registry->register_producer_factory(L"HTML Producer", html::create_producer);
227
228 CefMainArgs main_args;
229 g_cef_executor = std::make_unique<executor>(L"cef");
230 bool result = g_cef_executor->invoke([&] {
231#ifdef WIN32
232 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
233#endif
234 const bool enable_gpu = env::properties().get(L"configuration.html.enable-gpu", false);
235
236 CefSettings settings;
237 settings.command_line_args_disabled = false;
238 settings.no_sandbox = true;
239 settings.remote_debugging_port = env::properties().get(L"configuration.html.remote-debugging-port", 0);
240 settings.windowless_rendering_enabled = true;
241
242 auto cache_path = env::properties().get(L"configuration.html.cache-path", L"cef-cache");
243 if (!cache_path.empty()) {
244 if (!boost::filesystem::path(cache_path).is_absolute()) {
245 cache_path = caspar::env::initial_folder() + L"/" + cache_path;
246 }
247 CASPAR_LOG(info) << L"[html] Using CEF cache path: " << cache_path;
248 CefString(&settings.cache_path).FromWString(cache_path);
249 }
250
251 return CefInitialize(main_args, settings, CefRefPtr<CefApp>(new renderer_application(enable_gpu)), nullptr);
252 });
253
254 if (!result) {
255 CASPAR_LOG(error) << "[html] Failed to initialize CEF";
256 return;
257 }
258
259 g_cef_executor->begin_invoke([&] { CefRunMessageLoop(); });
260 dependencies.cg_registry->register_cg_producer(
261 L"html",
262 {L".html"},
263 [](const spl::shared_ptr<core::frame_producer>& producer) { return spl::make_shared<html_cg_proxy>(producer); },
264 [](const core::frame_producer_dependencies& dependencies, const std::wstring& filename) {
265 return html::create_cg_producer(dependencies, {filename});
266 },
267 false);
268}
269
270void uninit()
271{

Callers

nothing calls this directly

Calls 7

create_cg_producerFunction · 0.85
emptyMethod · 0.80
begin_invokeMethod · 0.80
invokeMethod · 0.45
getMethod · 0.45
register_cg_producerMethod · 0.45

Tested by

no test coverage detected