| 1 | /* |
| 2 | * Copyright (C) 2010-2021 Team Kodi |
| 3 | * This file is part of Kodi - https://kodi.tv |
| 4 | * |
| 5 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 6 | * See LICENSES/README.md for more information. |
| 7 | */ |
| 8 | |
| 9 | #include "PipewireContext.h" |
| 10 | |
| 11 | #include "PipewireThreadLoop.h" |
| 12 | #include "utils/log.h" |
| 13 | |
| 14 | #include <stdexcept> |
| 15 | |
| 16 | using namespace KODI; |
| 17 | using namespace PIPEWIRE; |
| 18 | |
| 19 | CPipewireContext::CPipewireContext(CPipewireThreadLoop& loop) : m_threadLoop(loop) |
| 20 | { |
| 21 | m_context.reset(pw_context_new(loop.Get(), nullptr, 0)); |
| 22 | if (!m_context) |
| 23 | { |
| 24 | CLog::Log(LOGERROR, "CPipewireContext: failed to create context: {}", strerror(errno)); |
| 25 | throw std::runtime_error("CPipewireContext: failed to create context"); |
| 26 | } |
| 27 | } |