linux-pipewire.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 <pipewire/pipewire.h>
  24. #include "pipewire-capture.h"
  25. OBS_DECLARE_MODULE()
  26. OBS_MODULE_USE_DEFAULT_LOCALE("linux-pipewire", "en-US")
  27. MODULE_EXPORT const char *obs_module_description(void)
  28. {
  29. return "PipeWire based sources/outputs";
  30. }
  31. bool obs_module_load(void)
  32. {
  33. pw_init(NULL, NULL);
  34. // OBS PipeWire Screen Capture
  35. switch (obs_get_nix_platform()) {
  36. #ifdef ENABLE_WAYLAND
  37. case OBS_NIX_PLATFORM_WAYLAND:
  38. #endif
  39. case OBS_NIX_PLATFORM_X11_EGL:
  40. pipewire_capture_load();
  41. break;
  42. case OBS_NIX_PLATFORM_X11_GLX:
  43. break;
  44. }
  45. return true;
  46. }
  47. void obs_module_unload(void)
  48. {
  49. #if PW_CHECK_VERSION(0, 3, 49)
  50. pw_deinit();
  51. #endif
  52. }