reference-outputs.rst 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809
  1. Output API Reference (obs_output_t)
  2. ===================================
  3. Outputs allow the ability to output the currently rendering audio/video.
  4. Streaming and recording are two common examples of outputs, but not the
  5. only types of outputs. Outputs can receive the raw data or receive
  6. encoded data. The `libobs/obs-output.h`_ file is the dedicated header
  7. for implementing outputs
  8. .. type:: obs_output_t
  9. A reference-counted output object.
  10. .. type:: obs_weak_output_t
  11. A weak reference to an output object.
  12. .. code:: cpp
  13. #include <obs.h>
  14. Output Definition Structure (obs_output_info)
  15. ---------------------------------------------
  16. .. type:: struct obs_output_info
  17. Output definition structure.
  18. .. member:: const char *obs_output_info.id
  19. Unique string identifier for the source (required).
  20. .. member:: uint32_t obs_output_info.flags
  21. Output capability flags (required).
  22. (Author's note: This should be renamed to "capability_flags")
  23. A bitwise OR combination of one or more of the following values:
  24. - **OBS_OUTPUT_VIDEO** - Can output video.
  25. - **OBS_OUTPUT_AUDIO** - Can output audio.
  26. - **OBS_OUTPUT_AV** - Combines OBS_OUTPUT_VIDEO and OBS_OUTPUT_AUDIO.
  27. - **OBS_OUTPUT_ENCODED** - Output is encoded.
  28. When this capability flag is used, the output must have encoders
  29. assigned to it via the :c:func:`obs_output_set_video_encoder()`
  30. and/or :c:func:`obs_output_set_audio_encoder()` functions in order
  31. to be started.
  32. - **OBS_OUTPUT_SERVICE** - Output requires a service object.
  33. When this capability flag is used, the output must have a service
  34. assigned to it via the :c:func:`obs_output_set_service()` function
  35. in order to be started.
  36. This is usually used with live streaming outputs that stream to
  37. specific services.
  38. - **OBS_OUTPUT_MULTI_TRACK** - Output supports multiple audio tracks.
  39. When this capability flag is used, specifies that this output
  40. supports multiple encoded audio tracks simultaneously.
  41. .. member:: const char *(*obs_output_info.get_name)(void *type_data)
  42. Get the translated name of the output type.
  43. :param type_data: The type_data variable of this structure
  44. :return: The translated name of the output type
  45. .. member:: void *(*obs_output_info.create)(obs_data_t *settings, obs_output_t *output)
  46. Creates the implementation data for the output.
  47. :param settings: Settings to initialize the output with
  48. :param output: Output that this data is associated with
  49. :return: The implementation data associated with this output
  50. .. member:: void (*obs_output_info.destroy)(void *data)
  51. Destroys the implementation data for the output.
  52. .. member:: bool (*obs_output_info.start)(void *data)
  53. Starts the output. If needed, this function can spawn a thread,
  54. return *true* immediately, and then signal for failure later.
  55. :return: *true* if successful or deferring to a signal to indicate
  56. failure, *false* on failure to start
  57. .. member:: void (*obs_output_info.stop)(void *data, uint64_t ts)
  58. Requests an output to stop at a specified time. The *ts* parameter
  59. indicates when the stop should occur. Output will actually stop when
  60. either the :c:func:`obs_output_end_data_capture()` or
  61. :c:func:`obs_output_signal_stop()` functions are called. If *ts* is
  62. 0, an immediate stop was requested.
  63. :param ts: The timestamp to stop. If 0, the output should attempt to
  64. stop immediately rather than wait for any more data to
  65. process
  66. .. member:: void (*obs_output_info.raw_video)(void *data, struct video_data *frame)
  67. This is called when the output receives raw video data. Only applies
  68. to outputs that are not encoded.
  69. :param frame: The raw video frame
  70. .. member:: void (*obs_output_info.raw_audio)(void *data, struct audio_data *frames)
  71. This is called when the output recieves raw audio data. Only applies
  72. to outputs that are not encoded.
  73. **This callback must be used with single-track raw outputs.**
  74. :param frames: The raw audio frames
  75. .. member:: void (*obs_output_info.raw_audio2)(void *data, size_t idx, struct audio_data *frames)
  76. This is called when the output recieves raw audio data. Only applies
  77. to outputs that are not encoded.
  78. **This callback must be used with multi-track raw outputs.**
  79. :param idx: The audio track index
  80. :param frames: The raw audio frames
  81. .. member:: void (*obs_output_info.encoded_packet)(void *data, struct encoder_packet *packet)
  82. This is called when the output receives encoded video/audio data.
  83. Only applies to outputs that are encoded. Packets will always be
  84. given in monotonic timestamp order.
  85. :param packet: The video or audio packet
  86. .. member:: void (*obs_output_info.update)(void *data, obs_data_t *settings)
  87. Updates the settings for this output.
  88. (Optional)
  89. :param settings: New settings for this output
  90. .. member:: void (*obs_output_info.get_defaults)(obs_data_t *settings)
  91. void (*obs_output_info.get_defaults2)(void *type_data, obs_data_t *settings)
  92. Sets the default settings for this output.
  93. (Optional)
  94. :param settings: Default settings. Call obs_data_set_default*
  95. functions on this object to set default setting
  96. values
  97. .. member:: obs_properties_t *(*obs_output_info.get_properties)(void *data)
  98. obs_properties_t *(*obs_output_info.get_properties2)(void *data, void *type_data)
  99. Gets the property information of this output.
  100. (Optional)
  101. :return: The properties of the output
  102. .. member:: void (*obs_output_info.pause)(void *data)
  103. Pauses the output (if the output supports pausing).
  104. (Author's note: This is currently unimplemented)
  105. (Optional)
  106. .. member:: uint64_t (*obs_output_info.get_total_bytes)(void *data)
  107. Returns the number of total bytes processed by this output.
  108. (Optional)
  109. :return: Total bytes processed by this output since it started
  110. .. member:: int (*obs_output_info.get_dropped_frames)(void *data)
  111. Returns the number of dropped frames.
  112. (Optional)
  113. :return: Number of dropped frames due to network congestion by this
  114. output since it started
  115. .. member:: void *obs_output_info.type_data
  116. void (*obs_output_info.free_type_data)(void *type_data)
  117. Private data associated with this entry. Note that this is not the
  118. same as the implementation data; this is used to differentiate
  119. between two different types if the same callbacks are used for more
  120. than one different type.
  121. (Optional)
  122. .. member:: float (*obs_output_info.get_congestion)(void *data)
  123. This function is used to indicate how currently congested the output
  124. is. Useful for visualizing how much data is backed up on streaming
  125. outputs.
  126. (Optional)
  127. :return: Current congestion value (0.0f..1.0f)
  128. .. member:: int (*obs_output_info.get_connect_time_ms)(void *data)
  129. This function is used to determine how many milliseconds it took to
  130. connect to its current server.
  131. (Optional)
  132. :return: Milliseconds it took to connect to its current server
  133. .. member:: const char *obs_output_info.encoded_video_codecs
  134. const char *obs_output_info.encoded_audio_codecs
  135. This variable specifies which codecs are supported by an encoded
  136. output, separated by semicolon.
  137. (Optional, though recommended)
  138. .. _output_signal_handler_reference:
  139. Output Signals
  140. --------------
  141. **start** (ptr output)
  142. Called when the output starts.
  143. **stop** (ptr output, int code)
  144. Called when the output stops.
  145. :Parameters: - **code** - Can be one of the following values:
  146. | OBS_OUTPUT_SUCCESS - Successfuly stopped
  147. | OBS_OUTPUT_BAD_PATH - The specified path was invalid
  148. | OBS_OUTPUT_CONNECT_FAILED - Failed to connect to a server
  149. | OBS_OUTPUT_INVALID_STREAM - Invalid stream path
  150. | OBS_OUTPUT_ERROR - Generic error
  151. | OBS_OUTPUT_DISCONNECTED - Unexpectedly disconnected
  152. | OBS_OUTPUT_UNSUPPORTED - The settings, video/audio format, or codecs are unsupported by this output
  153. | OBS_OUTPUT_NO_SPACE - Ran out of disk space
  154. **starting** (ptr output)
  155. Called when the output is starting.
  156. **stopping** (ptr output)
  157. Called when the output is stopping.
  158. **activate** (ptr output)
  159. Called when the output activates (starts capturing data).
  160. **deactivate** (ptr output)
  161. Called when the output deactivates (stops capturing data).
  162. **reconnect** (ptr output)
  163. Called when the output is reconnecting.
  164. **reconnect_success** (ptr output)
  165. Called when the output has successfully reconnected.
  166. General Output Functions
  167. ------------------------
  168. .. function:: void obs_register_output(struct obs_output_info *info)
  169. Registers an output type. Typically used in
  170. :c:func:`obs_module_load()` or in the program's initialization phase.
  171. ---------------------
  172. .. function:: const char *obs_output_get_display_name(const char *id)
  173. Calls the :c:member:`obs_output_info.get_name` callback to get the
  174. translated display name of an output type.
  175. :param id: The output type string identifier
  176. :return: The translated display name of an output type
  177. ---------------------
  178. .. function:: obs_output_t *obs_output_create(const char *id, const char *name, obs_data_t *settings, obs_data_t *hotkey_data)
  179. Creates an output with the specified settings.
  180. The "output" context is used for anything related to outputting the
  181. final video/audio mix (E.g. streaming or recording). Use
  182. obs_output_release to release it.
  183. :param id: The output type string identifier
  184. :param name: The desired name of the output. If this is
  185. not unique, it will be made to be unique
  186. :param settings: The settings for the output, or *NULL* if
  187. none
  188. :param hotkey_data: Saved hotkey data for the output, or *NULL*
  189. if none
  190. :return: A reference to the newly created output, or
  191. *NULL* if failed
  192. ---------------------
  193. .. function:: void obs_output_addref(obs_output_t *output)
  194. void obs_output_release(obs_output_t *output)
  195. Adds/releases a reference to an output. When the last reference is
  196. released, the output is destroyed.
  197. ---------------------
  198. .. function:: obs_weak_output_t *obs_output_get_weak_output(obs_output_t *output)
  199. obs_output_t *obs_weak_output_get_output(obs_weak_output_t *weak)
  200. These functions are used to get a weak reference from a strong output
  201. reference, or a strong output reference from a weak reference. If
  202. the output is destroyed, *obs_weak_output_get_output* will return
  203. *NULL*.
  204. ---------------------
  205. .. function:: void obs_weak_output_addref(obs_weak_output_t *weak)
  206. void obs_weak_output_release(obs_weak_output_t *weak)
  207. Adds/releases a weak reference to an output.
  208. ---------------------
  209. .. function:: const char *obs_output_get_name(const obs_output_t *output)
  210. :return: The name of the output
  211. ---------------------
  212. .. function:: bool obs_output_start(obs_output_t *output)
  213. Starts the output.
  214. :return: *true* if output successfuly started, *false* otherwise. If
  215. the output failed to start,
  216. :c:func:`obs_output_get_last_error()` may contain a specific
  217. error string related to the reason
  218. ---------------------
  219. .. function:: void obs_output_stop(obs_output_t *output)
  220. Requests the output to stop. The output will wait until all data is
  221. sent up until the time the call was made, then when the output has
  222. successfully stopped, it will send the "stop" signal. See
  223. :ref:`output_signal_handler_reference` for more information on output
  224. signals.
  225. ---------------------
  226. .. function:: void obs_output_set_delay(obs_output_t *output, uint32_t delay_sec, uint32_t flags)
  227. Sets the current output delay, in seconds (if the output supports delay)
  228. If delay is currently active, it will set the delay value, but will not
  229. affect the current delay, it will only affect the next time the output is
  230. activated.
  231. :param delay_sec: Amount to delay the output, in seconds
  232. :param flags: | Can be 0 or a combination of one of the following values:
  233. | OBS_OUTPUT_DELAY_PRESERVE - On reconnection, start where it left of on reconnection. Note however that this option will consume extra memory to continually increase delay while waiting to reconnect
  234. ---------------------
  235. .. function:: uint32_t obs_output_get_delay(const obs_output_t *output)
  236. Gets the currently set delay value, in seconds.
  237. ---------------------
  238. .. function:: uint32_t obs_output_get_active_delay(const obs_output_t *output)
  239. If delay is active, gets the currently active delay value, in
  240. seconds. The active delay can increase if the
  241. OBS_OUTPUT_DELAY_PRESERVE flag was set when setting a delay.
  242. ---------------------
  243. .. function:: void obs_output_force_stop(obs_output_t *output)
  244. Attempts to get the output to stop immediately without waiting for
  245. data to send.
  246. ---------------------
  247. .. function:: bool obs_output_active(const obs_output_t *output)
  248. :return: *true* if the output is currently active, *false* otherwise
  249. ---------------------
  250. .. function:: obs_data_t *obs_output_defaults(const char *id)
  251. :return: An incremented reference to the output's default settings
  252. ---------------------
  253. .. function:: obs_properties_t *obs_output_properties(const obs_output_t *output)
  254. obs_properties_t *obs_get_output_properties(const char *id)
  255. Use these functions to get the properties of an output or output
  256. type. Properties are optionally used (if desired) to automatically
  257. generate user interface widgets to allow users to update settings.
  258. :return: The properties list for a specific existing output. Free
  259. with :c:func:`obs_properties_destroy()`
  260. ---------------------
  261. .. function:: void obs_output_update(obs_output_t *output, obs_data_t *settings)
  262. Updates the settings for this output context.
  263. ---------------------
  264. .. function:: bool obs_output_can_pause(const obs_output_t *output)
  265. :return: *true* if the output can be paused, *false* otherwise
  266. ---------------------
  267. .. function:: void obs_output_pause(obs_output_t *output)
  268. Pause an output (if supported by the output).
  269. (Author's Note: Not yet implemented)
  270. ---------------------
  271. .. function:: obs_data_t *obs_output_get_settings(const obs_output_t *output)
  272. :return: An incremented reference to the output's settings
  273. ---------------------
  274. .. function:: signal_handler_t *obs_output_get_signal_handler(const obs_output_t *output)
  275. :return: The signal handler of the output
  276. ---------------------
  277. .. function:: proc_handler_t *obs_output_get_proc_handler(const obs_output_t *output)
  278. :return: The procedure handler of the output
  279. ---------------------
  280. .. function:: void obs_output_set_media(obs_output_t *output, video_t *video, audio_t *audio)
  281. Sets the current video/audio handlers for the output (typically
  282. :c:func:`obs_get_video()` and :c:func:`obs_get_audio()`). Only used
  283. with raw outputs so they can catch the raw video/audio frames.
  284. ---------------------
  285. .. function:: video_t *obs_output_video(const obs_output_t *output)
  286. audio_t *obs_output_audio(const obs_output_t *output)
  287. Gets the current video/audio handlers for the output.
  288. ---------------------
  289. .. function:: void obs_output_set_mixer(obs_output_t *output, size_t mixer_idx)
  290. size_t obs_output_get_mixer(const obs_output_t *output)
  291. Sets/gets the current audio mixer for non-encoded outputs. For
  292. multi-track outputs, this would be the equivalent of setting the mask
  293. only for the specified mixer index.
  294. ---------------------
  295. .. function:: void obs_output_set_mixers(obs_output_t *output, size_t mixers)
  296. size_t obs_output_get_mixers(const obs_output_t *output)
  297. Sets/gets the current audio mixers (via mask) for non-encoded
  298. multi-track outputs. If used with single-track outputs, the
  299. single-track output will use either the first set mixer track in the
  300. bitmask, or the first track if none is set in the bitmask.
  301. ---------------------
  302. .. function:: void obs_output_set_video_encoder(obs_output_t *output, obs_encoder_t *encoder)
  303. void obs_output_set_audio_encoder(obs_output_t *output, obs_encoder_t *encoder, size_t idx)
  304. Sets the video/audio encoders for an encoded output.
  305. :param encoder: The video/audio encoder
  306. :param idx: The audio encoder index if the output supports
  307. multiple audio streams at once
  308. ---------------------
  309. .. function:: obs_encoder_t *obs_output_get_video_encoder(const obs_output_t *output)
  310. obs_encoder_t *obs_output_get_audio_encoder(const obs_output_t *output, size_t idx)
  311. Gets the video/audio encoders for an encoded output.
  312. :param idx: The audio encoder index if the output supports
  313. multiple audio streams at once
  314. :return: The video/audio encoder. The reference is not
  315. incremented
  316. ---------------------
  317. .. function:: void obs_output_set_service(obs_output_t *output, obs_service_t *service)
  318. obs_service_t *obs_output_get_service(const obs_output_t *output)
  319. Sets/gets the service for outputs that require services (such as RTMP
  320. outputs). *obs_output_get_service* does not return an incremented
  321. reference.
  322. ---------------------
  323. .. function:: void obs_output_set_reconnect_settings(obs_output_t *output, int retry_count, int retry_sec);
  324. Sets the auto-reconnect settings for outputs that support it. The
  325. retry time will double on each retry to prevent overloading services.
  326. :param retry_count: Maximum retry count. Set to 0 to disable
  327. reconnecting
  328. :param retry_sec: Starting retry wait duration, in seconds
  329. ---------------------
  330. .. function:: uint64_t obs_output_get_total_bytes(const obs_output_t *output)
  331. :return: Total bytes sent/processed
  332. ---------------------
  333. .. function:: int obs_output_get_frames_dropped(const obs_output_t *output)
  334. :return: Number of frames that were dropped due to network congestion
  335. ---------------------
  336. .. function:: int obs_output_get_total_frames(const obs_output_t *output)
  337. :return: Total frames sent/processed
  338. ---------------------
  339. .. function:: void obs_output_set_preferred_size(obs_output_t *output, uint32_t width, uint32_t height)
  340. Sets the preferred scaled resolution for this output. Set width and height
  341. to 0 to disable scaling.
  342. If this output uses an encoder, it will call obs_encoder_set_scaled_size on
  343. the encoder before the stream is started. If the encoder is already active,
  344. then this function will trigger a warning and do nothing.
  345. ---------------------
  346. .. function:: uint32_t obs_output_get_width(const obs_output_t *output)
  347. uint32_t obs_output_get_height(const obs_output_t *output)
  348. :return: The width/height of the output
  349. ---------------------
  350. .. function:: float obs_output_get_congestion(obs_output_t *output)
  351. :return: The congestion value. This value is used to visualize the
  352. current congestion of a network output. For example, if
  353. there is no congestion, the value will be 0.0f, if it's
  354. fully congested, the value will be 1.0f
  355. ---------------------
  356. .. function:: int obs_output_get_connect_time_ms(obs_output_t *output)
  357. :return: How long the output took to connect to a server, in
  358. milliseconds
  359. ---------------------
  360. .. function:: bool obs_output_reconnecting(const obs_output_t *output)
  361. :return: *true* if the output is currently reconnecting to a server,
  362. *false* otherwise
  363. ---------------------
  364. .. function:: const char *obs_output_get_supported_video_codecs(const obs_output_t *output)
  365. const char *obs_output_get_supported_audio_codecs(const obs_output_t *output)
  366. :return: Supported video/audio codecs of an encoded output, separated
  367. by semicolen
  368. ---------------------
  369. .. function:: uint32_t obs_output_get_flags(const obs_output_t *output)
  370. uint32_t obs_get_output_flags(const char *id)
  371. :return: The output capability flags
  372. ---------------------
  373. Functions used by outputs
  374. -------------------------
  375. .. function:: void obs_output_set_last_error(obs_output_t *output, const char *message)
  376. const char *obs_output_get_last_error(obs_output_t *output)
  377. Sets/gets the translated error message that is presented to a user in
  378. case of disconnection, inability to connect, etc.
  379. ---------------------
  380. .. function:: void obs_output_set_video_conversion(obs_output_t *output, const struct video_scale_info *conversion)
  381. Optionally sets the video conversion information. Only used by raw
  382. outputs.
  383. Relevant data types used with this function:
  384. .. code:: cpp
  385. enum video_format {
  386. VIDEO_FORMAT_NONE,
  387. /* planar 420 format */
  388. VIDEO_FORMAT_I420, /* three-plane */
  389. VIDEO_FORMAT_NV12, /* two-plane, luma and packed chroma */
  390. /* packed 422 formats */
  391. VIDEO_FORMAT_YVYU,
  392. VIDEO_FORMAT_YUY2, /* YUYV */
  393. VIDEO_FORMAT_UYVY,
  394. /* packed uncompressed formats */
  395. VIDEO_FORMAT_RGBA,
  396. VIDEO_FORMAT_BGRA,
  397. VIDEO_FORMAT_BGRX,
  398. VIDEO_FORMAT_Y800, /* grayscale */
  399. /* planar 4:4:4 */
  400. VIDEO_FORMAT_I444,
  401. };
  402. enum video_colorspace {
  403. VIDEO_CS_DEFAULT,
  404. VIDEO_CS_601,
  405. VIDEO_CS_709,
  406. };
  407. enum video_range_type {
  408. VIDEO_RANGE_DEFAULT,
  409. VIDEO_RANGE_PARTIAL,
  410. VIDEO_RANGE_FULL
  411. };
  412. struct video_scale_info {
  413. enum video_format format;
  414. uint32_t width;
  415. uint32_t height;
  416. enum video_range_type range;
  417. enum video_colorspace colorspace;
  418. };
  419. ---------------------
  420. .. function:: void obs_output_set_audio_conversion(obs_output_t *output, const struct audio_convert_info *conversion)
  421. Optionally sets the audio conversion information. Only used by raw
  422. outputs.
  423. Relevant data types used with this function:
  424. .. code:: cpp
  425. enum audio_format {
  426. AUDIO_FORMAT_UNKNOWN,
  427. AUDIO_FORMAT_U8BIT,
  428. AUDIO_FORMAT_16BIT,
  429. AUDIO_FORMAT_32BIT,
  430. AUDIO_FORMAT_FLOAT,
  431. AUDIO_FORMAT_U8BIT_PLANAR,
  432. AUDIO_FORMAT_16BIT_PLANAR,
  433. AUDIO_FORMAT_32BIT_PLANAR,
  434. AUDIO_FORMAT_FLOAT_PLANAR,
  435. };
  436. enum speaker_layout {
  437. SPEAKERS_UNKNOWN,
  438. SPEAKERS_MONO,
  439. SPEAKERS_STEREO,
  440. SPEAKERS_2POINT1,
  441. SPEAKERS_QUAD,
  442. SPEAKERS_4POINT1,
  443. SPEAKERS_5POINT1,
  444. SPEAKERS_5POINT1_SURROUND,
  445. SPEAKERS_7POINT1,
  446. SPEAKERS_7POINT1_SURROUND,
  447. SPEAKERS_SURROUND,
  448. };
  449. struct audio_convert_info {
  450. uint32_t samples_per_sec;
  451. enum audio_format format;
  452. enum speaker_layout speakers;
  453. };
  454. ---------------------
  455. .. function:: bool obs_output_can_begin_data_capture(const obs_output_t *output, uint32_t flags)
  456. Determines whether video/audio capture (encoded or raw) is able to
  457. start. Call this before initializing any output data to ensure that
  458. the output can start.
  459. :param flags: Set to 0 to initialize both audio/video, otherwise a
  460. bitwise OR combination of OBS_OUTPUT_VIDEO and/or
  461. OBS_OUTPUT_AUDIO
  462. :return: *true* if data capture can begin
  463. ---------------------
  464. .. function:: bool obs_output_initialize_encoders(obs_output_t *output, uint32_t flags)
  465. Initializes any encoders/services associated with the output. This
  466. must be called for encoded outputs before calling
  467. :c:func:`obs_output_begin_data_capture()`.
  468. :param flags: Set to 0 to initialize both audio/video, otherwise a
  469. bitwise OR combination of OBS_OUTPUT_VIDEO and/or
  470. OBS_OUTPUT_AUDIO
  471. :return: *true* if successful, *false* otherwise
  472. ---------------------
  473. .. function:: bool obs_output_begin_data_capture(obs_output_t *output, uint32_t flags)
  474. Begins data capture from raw media or encoders. This is typically
  475. when the output actually activates (starts) internally. Video/audio
  476. data will start being sent to the callbacks of the output.
  477. :param flags: Set to 0 to initialize both audio/video, otherwise a
  478. bitwise OR combination of OBS_OUTPUT_VIDEO and/or
  479. OBS_OUTPUT_AUDIO
  480. :return: *true* if successful, *false* otherwise. Typically the
  481. return value does not need to be checked if
  482. :c:func:`obs_output_can_begin_data_capture()` was
  483. called
  484. ---------------------
  485. .. function:: void obs_output_end_data_capture(obs_output_t *output)
  486. Ends data capture of an output. This is typically when the output
  487. actually intentionally deactivates (stops). Video/audio data will
  488. stop being sent to the callbacks of the output. The output will
  489. trigger the "stop" signal with the OBS_OUTPUT_SUCCESS code to
  490. indicate that the output has stopped successfully. See
  491. :ref:`output_signal_handler_reference` for more information on output
  492. signals.
  493. ---------------------
  494. .. function:: void obs_output_signal_stop(obs_output_t *output, int code)
  495. Ends data capture of an output with an output code, indicating that
  496. the output stopped unexpectedly. This is typically used if for
  497. example the server was disconnected for some reason, or if there was
  498. an error saving to file. The output will trigger the "stop" signal
  499. with the the desired code to indicate that the output has stopped
  500. successfully. See :ref:`output_signal_handler_reference` for more
  501. information on output signals.
  502. :c:func:`obs_output_set_last_error()` may be used in conjunction with
  503. these error codes to optionally relay more detailed error information
  504. to the user
  505. :param code: | Can be one of the following values:
  506. | OBS_OUTPUT_SUCCESS - Successfuly stopped
  507. | OBS_OUTPUT_BAD_PATH - The specified path was invalid
  508. | OBS_OUTPUT_CONNECT_FAILED - Failed to connect to a server
  509. | OBS_OUTPUT_INVALID_STREAM - Invalid stream path
  510. | OBS_OUTPUT_ERROR - Generic error
  511. | OBS_OUTPUT_DISCONNECTED - Unexpectedly disconnected
  512. | OBS_OUTPUT_UNSUPPORTED - The settings, video/audio format, or codecs are unsupported by this output
  513. | OBS_OUTPUT_NO_SPACE - Ran out of disk space
  514. .. ---------------------------------------------------------------------------
  515. .. _libobs/obs-output.h: https://github.com/jp9000/obs-studio/blob/master/libobs/obs-output.h