obs-display.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /******************************************************************************
  2. Copyright (C) 2013 by Hugh Bailey <[email protected]>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ******************************************************************************/
  14. #include "obs.h"
  15. #include "obs-data.h"
  16. display_t display_create(obs_t obs, struct gs_init_data *graphics_data)
  17. {
  18. struct obs_display *display = bmalloc(sizeof(struct obs_display));
  19. memset(display, 0, sizeof(struct obs_display));
  20. if (graphics_data) {
  21. display->swap = gs_create_swapchain(graphics_data);
  22. if (!display->swap) {
  23. display_destroy(display);
  24. return NULL;
  25. }
  26. }
  27. return display;
  28. }
  29. void display_destroy(display_t display)
  30. {
  31. if (display) {
  32. swapchain_destroy(display->swap);
  33. bfree(display);
  34. }
  35. }
  36. source_t display_getsource(display_t display)
  37. {
  38. return display->source;
  39. }
  40. void display_setsource(display_t display, source_t source)
  41. {
  42. display->source = source;
  43. }