obs-output.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. #ifndef OBS_OUTPUT_H
  15. #define OBS_OUTPUT_H
  16. #include "util/c99defs.h"
  17. #include "util/dstr.h"
  18. /*
  19. * ===========================================
  20. * Outputs
  21. * ===========================================
  22. *
  23. * An output takes raw audio and/or video and processes and/or outputs it
  24. * to a destination, whether that destination be a file, network, or other.
  25. *
  26. * A module with outputs needs to export these functions:
  27. * + enum_outputss
  28. *
  29. * Each individual output is then exported by it's name. For example, an
  30. * output named "myoutput" would have the following exports:
  31. * + myoutput_create
  32. * + myoutput_destroy
  33. * + myoutput_start
  34. * + myoutput_stop
  35. *
  36. * [and optionally]
  37. * + myoutput_config
  38. * + myoutput_pause
  39. *
  40. * ===========================================
  41. * Primary Exports
  42. * ===========================================
  43. * const char *enum_outputs(size_t idx);
  44. * idx: index of the output.
  45. * Return value: Output identifier name. NULL when no more available.
  46. *
  47. * ===========================================
  48. * Output Exports
  49. * ===========================================
  50. * void *[name]_create(const char *settings, output_t output);
  51. * Creates an output.
  52. *
  53. * settings: Settings of the output.
  54. * output: pointer to main output
  55. * Return value: Internal output pointer, or NULL if failed.
  56. *
  57. * ---------------------------------------------------------
  58. * void [name]_destroy(void *data);
  59. * Destroys the output.
  60. *
  61. * ---------------------------------------------------------
  62. * void [name]_update(void *data, const char *settings)
  63. * Updates the output's settings
  64. *
  65. * settings: New settings of the output
  66. *
  67. * ---------------------------------------------------------
  68. * void [name]_start(void *data)
  69. * Starts output
  70. *
  71. * ---------------------------------------------------------
  72. * void [name]_stop(void *data)
  73. * Stops output
  74. *
  75. * ===========================================
  76. * Optional Output Exports
  77. * ===========================================
  78. * void [name]_config(void *data, void *parent);
  79. * Called to configure the output.
  80. *
  81. * parent: Parent window pointer
  82. *
  83. * ---------------------------------------------------------
  84. * void [name]_pause(void *data)
  85. * Pauses output. Typically only usable for local recordings.
  86. */
  87. struct obs_output;
  88. struct output_info {
  89. const char *name;
  90. void *(*create)(const char *settings, struct obs_output *output);
  91. void (*destroy)(void *data);
  92. void (*start)(void *data);
  93. void (*stop)(void *data);
  94. /* optional */
  95. void (*config)(void *data, void *parent);
  96. void (*pause)(void *data);
  97. };
  98. struct obs_output {
  99. void *data;
  100. struct output_info callbacks;
  101. struct dstr settings;
  102. };
  103. extern bool get_output_info(void *module, const char *module_name,
  104. const char *output_name, struct output_info *info);
  105. #endif