obs-data.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 2 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. #pragma once
  15. #include "util/darray.h"
  16. #include "util/threading.h"
  17. #include "graphics/graphics.h"
  18. #include "media-io/media-io.h"
  19. #include "media-io/video-io.h"
  20. #include "media-io/audio-io.h"
  21. #include "obs.h"
  22. #include "obs-module.h"
  23. #include "obs-source.h"
  24. #include "obs-output.h"
  25. #include "obs-service.h"
  26. #define NUM_TEXTURES 2
  27. struct obs_display {
  28. swapchain_t swap; /* can be NULL if just sound */
  29. obs_source_t channels[MAX_CHANNELS];
  30. /* TODO: sound output target */
  31. };
  32. /* ------------------------------------------------------------------------- */
  33. struct obs_video {
  34. graphics_t graphics;
  35. stagesurf_t copy_surfaces[NUM_TEXTURES];
  36. texture_t render_textures[NUM_TEXTURES];
  37. texture_t output_textures[NUM_TEXTURES];
  38. effect_t default_effect;
  39. bool textures_copied[NUM_TEXTURES];
  40. bool copy_mapped;
  41. int cur_texture;
  42. video_t video;
  43. pthread_t video_thread;
  44. bool thread_initialized;
  45. uint32_t base_width;
  46. uint32_t base_height;
  47. };
  48. struct obs_audio {
  49. /* TODO: audio subsystem */
  50. audio_t audio;
  51. };
  52. /* user sources, output channels, and displays */
  53. struct obs_data {
  54. DARRAY(struct obs_display*) displays;
  55. DARRAY(struct obs_source*) sources;
  56. obs_source_t channels[MAX_CHANNELS];
  57. pthread_mutex_t sources_mutex;
  58. pthread_mutex_t displays_mutex;
  59. };
  60. struct obs_subsystem {
  61. DARRAY(struct obs_module) modules;
  62. DARRAY(struct source_info) input_types;
  63. DARRAY(struct source_info) filter_types;
  64. DARRAY(struct source_info) transition_types;
  65. DARRAY(struct output_info) output_types;
  66. DARRAY(struct service_info) service_types;
  67. media_t media;
  68. /* segmented into multiple sub-structures to keep things a bit more
  69. * clean and organized */
  70. struct obs_video video;
  71. struct obs_audio audio;
  72. struct obs_data data;
  73. };
  74. extern struct obs_subsystem *obs;
  75. extern void *obs_video_thread(void *param);