Fixed compiling on older versions of ALSA
authorSam Lantinga <slouken@libsdl.org>
Fri, 28 Oct 2016 17:00:37 -0700
changeset 1056135fee69e84df
parent 10560 5d9ad1fd5acd
child 10562 b48d8a98e261
Fixed compiling on older versions of ALSA
src/audio/alsa/SDL_alsa_audio.c
     1.1 --- a/src/audio/alsa/SDL_alsa_audio.c	Fri Oct 28 16:47:06 2016 -0700
     1.2 +++ b/src/audio/alsa/SDL_alsa_audio.c	Fri Oct 28 17:00:37 2016 -0700
     1.3 @@ -91,8 +91,10 @@
     1.4  static int (*ALSA_snd_device_name_hint) (int, const char *, void ***);
     1.5  static char* (*ALSA_snd_device_name_get_hint) (const void *, const char *);
     1.6  static int (*ALSA_snd_device_name_free_hint) (void **);
     1.7 +#ifdef SND_CHMAP_API_VERSION
     1.8  static snd_pcm_chmap_t* (*ALSA_snd_pcm_get_chmap) (snd_pcm_t *);
     1.9  static int (*ALSA_snd_pcm_chmap_print) (const snd_pcm_chmap_t *map, size_t maxlen, char *buf);
    1.10 +#endif
    1.11  
    1.12  #ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
    1.13  #define snd_pcm_hw_params_sizeof ALSA_snd_pcm_hw_params_sizeof
    1.14 @@ -157,8 +159,10 @@
    1.15      SDL_ALSA_SYM(snd_device_name_hint);
    1.16      SDL_ALSA_SYM(snd_device_name_get_hint);
    1.17      SDL_ALSA_SYM(snd_device_name_free_hint);
    1.18 +#ifdef SND_CHMAP_API_VERSION
    1.19      SDL_ALSA_SYM(snd_pcm_get_chmap);
    1.20      SDL_ALSA_SYM(snd_pcm_chmap_print);
    1.21 +#endif
    1.22  
    1.23      return 0;
    1.24  }
    1.25 @@ -559,8 +563,10 @@
    1.26      SDL_AudioFormat test_format = 0;
    1.27      unsigned int rate = 0;
    1.28      unsigned int channels = 0;
    1.29 +#ifdef SND_CHMAP_API_VERSION
    1.30      snd_pcm_chmap_t *chmap;
    1.31      char chmap_str[64];
    1.32 +#endif
    1.33  
    1.34      /* Initialize all variables that we clean on shutdown */
    1.35      this->hidden = (struct SDL_PrivateAudioData *)
    1.36 @@ -657,6 +663,7 @@
    1.37       * Assume original swizzling, until proven otherwise.
    1.38       */
    1.39      this->hidden->swizzle_func = swizzle_alsa_channels;
    1.40 +#ifdef SND_CHMAP_API_VERSION
    1.41      chmap = ALSA_snd_pcm_get_chmap(pcm_handle);
    1.42      if (chmap) {
    1.43          ALSA_snd_pcm_chmap_print(chmap, sizeof(chmap_str), chmap_str);
    1.44 @@ -666,6 +673,7 @@
    1.45          }
    1.46          free(chmap);
    1.47      }
    1.48 +#endif /* SND_CHMAP_API_VERSION */
    1.49  
    1.50      /* Set the number of channels */
    1.51      status = ALSA_snd_pcm_hw_params_set_channels(pcm_handle, hwparams,