mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-10-24 23:33:47 +08:00
libos: Add obs_get_audio_info2()
The `obs_audio_info2` struct is used in libobs for resetting audio, however there is a need for obtaining the additional fields present in the struct beyond `obs_audio_info`.
This commit is contained in:
committed by
Ryan Foster
parent
689c0094b8
commit
c67ea47406
@@ -1609,6 +1609,23 @@ bool obs_get_audio_info(struct obs_audio_info *oai)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool obs_get_audio_info2(struct obs_audio_info2 *oai2)
|
||||
{
|
||||
struct obs_core_audio *audio = &obs->audio;
|
||||
struct obs_audio_info oai;
|
||||
|
||||
if (!obs_get_audio_info(&oai) || !oai2 || !audio->audio) {
|
||||
return false;
|
||||
} else {
|
||||
oai2->samples_per_sec = oai.samples_per_sec;
|
||||
oai2->speakers = oai.speakers;
|
||||
oai2->fixed_buffering = audio->fixed_buffer;
|
||||
oai2->max_buffering_ms =
|
||||
audio->max_buffering_ticks * AUDIO_OUTPUT_FRAMES * SEC_TO_MSEC / (int)oai2->samples_per_sec;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool obs_enum_source_types(size_t idx, const char **id)
|
||||
{
|
||||
if (idx >= obs->source_types.num)
|
||||
|
||||
@@ -440,6 +440,12 @@ EXPORT void obs_set_video_levels(float sdr_white_level, float hdr_nominal_peak_l
|
||||
/** Gets the current audio settings, returns false if no audio */
|
||||
EXPORT bool obs_get_audio_info(struct obs_audio_info *oai);
|
||||
|
||||
/**
|
||||
* Gets the v2 audio settings that includes buffering information.
|
||||
* Returns false if no audio.
|
||||
*/
|
||||
EXPORT bool obs_get_audio_info2(struct obs_audio_info2 *oai2);
|
||||
|
||||
/**
|
||||
* Opens a plugin module directly from a specific path.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user