2 * Copyright (C) 2016-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
9 #include "PlatformFreebsd.h"
11 #include "ServiceBroker.h"
12 #include "application/AppParams.h"
13 #include "utils/StringUtils.h"
15 #include "platform/freebsd/OptionalsReg.h"
16 #include "platform/linux/powermanagement/LinuxPowerSyscall.h"
20 #if defined(HAVE_WAYLAND)
21 #include "windowing/wayland/WinSystemWaylandEGLContextGLES.h"
24 #include "windowing/X11/WinSystemX11GLESContext.h"
27 #include "windowing/gbm/WinSystemGbmGLESContext.h"
32 #if defined(HAVE_WAYLAND)
33 #include "windowing/wayland/WinSystemWaylandEGLContextGL.h"
36 #include "windowing/X11/WinSystemX11GLContext.h"
39 #include "windowing/gbm/WinSystemGbmGLContext.h"
46 CPlatform
* CPlatform::CreateInstance()
48 return new CPlatformFreebsd();
51 bool CPlatformFreebsd::InitStageOne()
53 if (!CPlatformPosix::InitStageOne())
56 setenv("OS", "Linux", true); // for python scripts that check the OS
59 #if defined(HAVE_WAYLAND)
60 KODI::WINDOWING::WAYLAND::CWinSystemWaylandEGLContextGLES::Register();
63 KODI::WINDOWING::X11::CWinSystemX11GLESContext::Register();
66 KODI::WINDOWING::GBM::CWinSystemGbmGLESContext::Register();
71 #if defined(HAVE_WAYLAND)
72 KODI::WINDOWING::WAYLAND::CWinSystemWaylandEGLContextGL::Register();
75 KODI::WINDOWING::X11::CWinSystemX11GLContext::Register();
78 KODI::WINDOWING::GBM::CWinSystemGbmGLContext::Register();
82 CLinuxPowerSyscall::Register();
84 std::string_view sink
= CServiceBroker::GetAppParams()->GetAudioBackend();
88 OPTIONALS::ALSARegister();
90 else if (sink
== "pulseaudio")
92 OPTIONALS::PulseAudioRegister(true);
94 else if (sink
== "oss")
96 OPTIONALS::OSSRegister();
98 else if (sink
== "sndio")
100 OPTIONALS::SndioRegister();
102 else if (sink
== "alsa+pulseaudio")
104 OPTIONALS::ALSARegister();
105 OPTIONALS::PulseAudioRegister(true);
109 if (!OPTIONALS::PulseAudioRegister(false))
111 if (!OPTIONALS::ALSARegister())
113 if (!OPTIONALS::SndioRegister())
115 OPTIONALS::OSSRegister();
121 m_lirc
.reset(OPTIONALS::LircRegister());