mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-12-10 16:42:38 +00:00
fix testffmpeg.c build.
This commit is contained in:
@@ -726,6 +726,7 @@ static SDL_bool IsPlanarAudioFormat(enum AVSampleFormat format)
|
|||||||
|
|
||||||
static void InterleaveAudio(AVFrame *frame, const SDL_AudioSpec *spec)
|
static void InterleaveAudio(AVFrame *frame, const SDL_AudioSpec *spec)
|
||||||
{
|
{
|
||||||
|
int c, n;
|
||||||
int samplesize = SDL_AUDIO_BYTESIZE(spec->format);
|
int samplesize = SDL_AUDIO_BYTESIZE(spec->format);
|
||||||
int framesize = SDL_AUDIO_FRAMESIZE(*spec);
|
int framesize = SDL_AUDIO_FRAMESIZE(*spec);
|
||||||
Uint8 *data = (Uint8 *)SDL_malloc(frame->nb_samples * framesize);
|
Uint8 *data = (Uint8 *)SDL_malloc(frame->nb_samples * framesize);
|
||||||
@@ -734,10 +735,10 @@ static void InterleaveAudio(AVFrame *frame, const SDL_AudioSpec *spec)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* This could be optimized with SIMD and not allocating memory each time */
|
/* This could be optimized with SIMD and not allocating memory each time */
|
||||||
for (int c = 0; c < spec->channels; ++c) {
|
for (c = 0; c < spec->channels; ++c) {
|
||||||
const Uint8 *src = frame->data[c];
|
const Uint8 *src = frame->data[c];
|
||||||
Uint8 *dst = data + c * samplesize;
|
Uint8 *dst = data + c * samplesize;
|
||||||
for (int n = frame->nb_samples; n--; ) {
|
for (n = frame->nb_samples; n--; ) {
|
||||||
SDL_memcpy(dst, src, samplesize);
|
SDL_memcpy(dst, src, samplesize);
|
||||||
src += samplesize;
|
src += samplesize;
|
||||||
dst += framesize;
|
dst += framesize;
|
||||||
|
|||||||
Reference in New Issue
Block a user