mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
libobs: Add API to get encoder sample rate
In case the encoder has to use a different sample rate (due to the sample rate being unsupported), we need an API function for the encoder to get the sample rate that the encoder is actually running at.
This commit is contained in:
@@ -503,6 +503,17 @@ uint32_t obs_encoder_get_height(const obs_encoder_t *encoder)
|
||||
video_output_get_height(encoder->media);
|
||||
}
|
||||
|
||||
uint32_t obs_encoder_get_sample_rate(const obs_encoder_t *encoder)
|
||||
{
|
||||
if (!encoder || !encoder->media ||
|
||||
encoder->info.type != OBS_ENCODER_AUDIO)
|
||||
return 0;
|
||||
|
||||
return encoder->samplerate != 0 ?
|
||||
encoder->samplerate :
|
||||
audio_output_get_sample_rate(encoder->media);
|
||||
}
|
||||
|
||||
void obs_encoder_set_video(obs_encoder_t *encoder, video_t *video)
|
||||
{
|
||||
const struct video_output_info *voi;
|
||||
|
||||
Reference in New Issue
Block a user