提交 5748aa18 编写于 作者: X Xinzheng Zhang

aout: add callback for get persecond audio callbacks

上级 ed2dbc03
......@@ -2129,7 +2129,7 @@ static int audio_open(FFPlayer *opaque, int64_t wanted_channel_layout, int wante
next_sample_rate_idx--;
wanted_spec.format = AUDIO_S16SYS;
wanted_spec.silence = 0;
wanted_spec.samples = FFMAX(SDL_AUDIO_MIN_BUFFER_SIZE, 2 << av_log2(wanted_spec.freq / SDL_AUDIO_MAX_CALLBACKS_PER_SEC));
wanted_spec.samples = FFMAX(SDL_AUDIO_MIN_BUFFER_SIZE, 2 << av_log2(wanted_spec.freq / SDL_AoutGetAudioPerSecondCallBacks(ffp->aout)));
wanted_spec.callback = sdl_audio_callback;
wanted_spec.userdata = opaque;
while (SDL_AoutOpenAudio(ffp->aout, &wanted_spec, &spec) < 0) {
......
......@@ -23,6 +23,7 @@
#include "ijksdl_aout.h"
#include <stdlib.h>
#include "ff_ffplay_def.h"
int SDL_AoutOpenAudio(SDL_Aout *aout, const SDL_AudioSpec *desired, SDL_AudioSpec *obtained)
{
......@@ -114,3 +115,12 @@ int SDL_AoutGetAudioSessionId(SDL_Aout *aout)
return 0;
}
int SDL_AoutGetAudioPerSecondCallBacks(SDL_Aout *aout)
{
if (aout) {
if (aout->func_get_audio_persecond_callbacks) {
return aout->func_get_audio_persecond_callbacks(aout);
}
}
return SDL_AUDIO_MAX_CALLBACKS_PER_SEC;
}
......@@ -48,6 +48,7 @@ struct SDL_Aout {
// optional
void (*func_set_playback_rate)(SDL_Aout *aout, float playbackRate);
int (*func_get_audio_persecond_callbacks)(SDL_Aout *aout);
// Android only
int (*func_get_audio_session_id)(SDL_Aout *aout);
......@@ -63,6 +64,7 @@ void SDL_AoutFreeP(SDL_Aout **paout);
double SDL_AoutGetLatencySeconds(SDL_Aout *aout);
void SDL_AoutSetDefaultLatencySeconds(SDL_Aout *aout, double latency);
int SDL_AoutGetAudioPerSecondCallBacks(SDL_Aout *aout);
// optional
void SDL_AoutSetPlaybackRate(SDL_Aout *aout, float playbackRate);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册