linux-pipewire.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* linux-pipewire.c
  2. *
  3. * Copyright 2021 columbarius <[email protected]>
  4. * Copyright 2021 Georges Basile Stavracas Neto <[email protected]>
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. *
  19. * SPDX-License-Identifier: GPL-2.0-or-later
  20. */
  21. #include <obs-module.h>
  22. #include <obs-nix-platform.h>
  23. #include <glad/glad.h>
  24. #include <pipewire/pipewire.h>
  25. #include "screencast-portal.h"
  26. OBS_DECLARE_MODULE()
  27. OBS_MODULE_USE_DEFAULT_LOCALE("linux-pipewire", "en-US")
  28. MODULE_EXPORT const char *obs_module_description(void)
  29. {
  30. return "PipeWire based sources/outputs";
  31. }
  32. bool obs_module_load(void)
  33. {
  34. obs_enter_graphics();
  35. gladLoadGL();
  36. obs_leave_graphics();
  37. pw_init(NULL, NULL);
  38. screencast_portal_load();
  39. return true;
  40. }
  41. void obs_module_unload(void)
  42. {
  43. screencast_portal_unload();
  44. #if PW_CHECK_VERSION(0, 3, 49)
  45. pw_deinit();
  46. #endif
  47. }