1
0

linux-pipewire.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. #if PW_CHECK_VERSION(0, 3, 60)
  27. #include "camera-portal.h"
  28. #endif
  29. OBS_DECLARE_MODULE()
  30. OBS_MODULE_USE_DEFAULT_LOCALE("linux-pipewire", "en-US")
  31. MODULE_EXPORT const char *obs_module_description(void)
  32. {
  33. return "PipeWire based sources/outputs";
  34. }
  35. bool obs_module_load(void)
  36. {
  37. obs_enter_graphics();
  38. gladLoadGL();
  39. obs_leave_graphics();
  40. pw_init(NULL, NULL);
  41. #if PW_CHECK_VERSION(0, 3, 60)
  42. camera_portal_load();
  43. #endif
  44. screencast_portal_load();
  45. return true;
  46. }
  47. void obs_module_unload(void)
  48. {
  49. screencast_portal_unload();
  50. #if PW_CHECK_VERSION(0, 3, 60)
  51. camera_portal_unload();
  52. #endif
  53. #if PW_CHECK_VERSION(0, 3, 49)
  54. pw_deinit();
  55. #endif
  56. }