Moved detect_music_type() into the Mix_LoadMusic_RW() function
authorSam Lantinga <slouken@libsdl.org>
Sat, 05 Oct 2019 10:33:14 -0700
changeset 95111e76f76d5ff
parent 950 d4f1ccbad974
child 952 c951ed864a0f
Moved detect_music_type() into the Mix_LoadMusic_RW() function
mixer.c
     1.1 --- a/mixer.c	Fri Oct 04 18:00:42 2019 -0700
     1.2 +++ b/mixer.c	Sat Oct 05 10:33:14 2019 -0700
     1.3 @@ -527,9 +527,10 @@
     1.4      struct _MusicFragment *next;
     1.5  } MusicFragment;
     1.6  
     1.7 -static SDL_AudioSpec *Mix_LoadMusic_RW(Mix_MusicType music_type, SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len)
     1.8 +static SDL_AudioSpec *Mix_LoadMusic_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len)
     1.9  {
    1.10      int i;
    1.11 +	Mix_MusicType music_type;
    1.12      Mix_MusicInterface *interface = NULL;
    1.13      void *music = NULL;
    1.14      Sint64 start;
    1.15 @@ -538,6 +539,7 @@
    1.16      int count = 0;
    1.17      int fragment_size;
    1.18  
    1.19 +	music_type = detect_music_type(src);
    1.20      if (!load_music_type(music_type) || !open_music_type(music_type)) {
    1.21          return NULL;
    1.22      }
    1.23 @@ -720,7 +722,7 @@
    1.24      } else if (SDL_memcmp(magic, "Crea", 4) == 0) {
    1.25          loaded = Mix_LoadVOC_RW(src, freesrc, &wavespec, (Uint8 **)&chunk->abuf, &chunk->alen);
    1.26      } else {
    1.27 -        loaded = Mix_LoadMusic_RW(detect_music_type(src), src, freesrc, &wavespec, (Uint8 **)&chunk->abuf, &chunk->alen);
    1.28 +        loaded = Mix_LoadMusic_RW(src, freesrc, &wavespec, (Uint8 **)&chunk->abuf, &chunk->alen);
    1.29      }
    1.30      if (!loaded) {
    1.31          /* The individual loaders have closed src if needed */