libobs: Add raw audio callback function

This complements the already existing raw video callback function.
master
Clayton Groeneveld 2021-11-17 01:01:46 -06:00 committed by Jim
parent 6a0348cf64
commit d45e92c10c
3 changed files with 36 additions and 0 deletions

View File

@ -473,6 +473,18 @@ Video, Audio, and Graphics
:param callback: The callback that receives raw video frames.
:param param: The private data associated with the callback.
---------------------
.. function:: void obs_add_raw_audio_callback(size_t mix_idx, const struct audio_convert_info *conversion, audio_output_callback_t callback, void *param)
void obs_remove_raw_raw_callback(size_t track, audio_output_callback_t callback, void *param)
Adds/removes a raw audio callback. Allows the ability to obtain raw
audio data without necessarily using an output.
:param mix_idx: Specifies audio track to get data from.
:param conversion: Specifies conversion requirements. Can be NULL.
:param callback: The callback that receives raw audio data.
:param param: The private data associated with the callback.
Primary signal/procedure handlers
---------------------------------

View File

@ -2389,6 +2389,22 @@ void obs_remove_raw_video_callback(void (*callback)(void *param,
stop_raw_video(video->video, callback, param);
}
void obs_add_raw_audio_callback(size_t mix_idx,
const struct audio_convert_info *conversion,
audio_output_callback_t callback, void *param)
{
struct obs_core_audio *audio = &obs->audio;
audio_output_connect(audio, mix_idx, conversion, callback, param);
}
void obs_remove_raw_audio_callback(size_t mix_idx,
audio_output_callback_t callback,
void *param)
{
struct obs_core_audio *audio = &obs->audio;
audio_output_disconnect(audio, mix_idx, callback, param);
}
void obs_apply_private_data(obs_data_t *settings)
{
if (!settings)

View File

@ -768,6 +768,14 @@ EXPORT void obs_add_raw_video_callback(
EXPORT void obs_remove_raw_video_callback(
void (*callback)(void *param, struct video_data *frame), void *param);
EXPORT void
obs_add_raw_audio_callback(size_t mix_idx,
const struct audio_convert_info *conversion,
audio_output_callback_t callback, void *param);
EXPORT void obs_remove_raw_audio_callback(size_t mix_idx,
audio_output_callback_t callback,
void *param);
EXPORT uint64_t obs_get_video_frame_time(void);
EXPORT double obs_get_active_fps(void);