dynamic_ogg.c
changeset 617 87116a42526e
parent 601 05123263dab3
child 621 944412baab72
     1.1 --- a/dynamic_ogg.c	Tue May 21 21:09:26 2013 -0700
     1.2 +++ b/dynamic_ogg.c	Tue May 21 21:21:23 2013 -0700
     1.3 @@ -26,105 +26,105 @@
     1.4  #include "dynamic_ogg.h"
     1.5  
     1.6  vorbis_loader vorbis = {
     1.7 -	0, NULL
     1.8 +    0, NULL
     1.9  };
    1.10  
    1.11  #ifdef OGG_DYNAMIC
    1.12  int Mix_InitOgg()
    1.13  {
    1.14 -	if ( vorbis.loaded == 0 ) {
    1.15 -		vorbis.handle = SDL_LoadObject(OGG_DYNAMIC);
    1.16 -		if ( vorbis.handle == NULL ) {
    1.17 -			return -1;
    1.18 -		}
    1.19 -		vorbis.ov_clear =
    1.20 -			(int (*)(OggVorbis_File *))
    1.21 -			SDL_LoadFunction(vorbis.handle, "ov_clear");
    1.22 -		if ( vorbis.ov_clear == NULL ) {
    1.23 -			SDL_UnloadObject(vorbis.handle);
    1.24 -			return -1;
    1.25 -		}
    1.26 -		vorbis.ov_info =
    1.27 -			(vorbis_info *(*)(OggVorbis_File *,int))
    1.28 -			SDL_LoadFunction(vorbis.handle, "ov_info");
    1.29 -		if ( vorbis.ov_info == NULL ) {
    1.30 -			SDL_UnloadObject(vorbis.handle);
    1.31 -			return -1;
    1.32 -		}
    1.33 -		vorbis.ov_open_callbacks =
    1.34 -			(int (*)(void *, OggVorbis_File *, char *, long, ov_callbacks))
    1.35 -			SDL_LoadFunction(vorbis.handle, "ov_open_callbacks");
    1.36 -		if ( vorbis.ov_open_callbacks == NULL ) {
    1.37 -			SDL_UnloadObject(vorbis.handle);
    1.38 -			return -1;
    1.39 -		}
    1.40 -		vorbis.ov_pcm_total =
    1.41 -			(ogg_int64_t (*)(OggVorbis_File *,int))
    1.42 -			SDL_LoadFunction(vorbis.handle, "ov_pcm_total");
    1.43 -		if ( vorbis.ov_pcm_total == NULL ) {
    1.44 -			SDL_UnloadObject(vorbis.handle);
    1.45 -			return -1;
    1.46 -		}
    1.47 -		vorbis.ov_read =
    1.48 +    if ( vorbis.loaded == 0 ) {
    1.49 +        vorbis.handle = SDL_LoadObject(OGG_DYNAMIC);
    1.50 +        if ( vorbis.handle == NULL ) {
    1.51 +            return -1;
    1.52 +        }
    1.53 +        vorbis.ov_clear =
    1.54 +            (int (*)(OggVorbis_File *))
    1.55 +            SDL_LoadFunction(vorbis.handle, "ov_clear");
    1.56 +        if ( vorbis.ov_clear == NULL ) {
    1.57 +            SDL_UnloadObject(vorbis.handle);
    1.58 +            return -1;
    1.59 +        }
    1.60 +        vorbis.ov_info =
    1.61 +            (vorbis_info *(*)(OggVorbis_File *,int))
    1.62 +            SDL_LoadFunction(vorbis.handle, "ov_info");
    1.63 +        if ( vorbis.ov_info == NULL ) {
    1.64 +            SDL_UnloadObject(vorbis.handle);
    1.65 +            return -1;
    1.66 +        }
    1.67 +        vorbis.ov_open_callbacks =
    1.68 +            (int (*)(void *, OggVorbis_File *, char *, long, ov_callbacks))
    1.69 +            SDL_LoadFunction(vorbis.handle, "ov_open_callbacks");
    1.70 +        if ( vorbis.ov_open_callbacks == NULL ) {
    1.71 +            SDL_UnloadObject(vorbis.handle);
    1.72 +            return -1;
    1.73 +        }
    1.74 +        vorbis.ov_pcm_total =
    1.75 +            (ogg_int64_t (*)(OggVorbis_File *,int))
    1.76 +            SDL_LoadFunction(vorbis.handle, "ov_pcm_total");
    1.77 +        if ( vorbis.ov_pcm_total == NULL ) {
    1.78 +            SDL_UnloadObject(vorbis.handle);
    1.79 +            return -1;
    1.80 +        }
    1.81 +        vorbis.ov_read =
    1.82  #ifdef OGG_USE_TREMOR
    1.83 -			(long (*)(OggVorbis_File *,char *,int,int *))
    1.84 +            (long (*)(OggVorbis_File *,char *,int,int *))
    1.85  #else
    1.86 -			(long (*)(OggVorbis_File *,char *,int,int,int,int,int *))
    1.87 +            (long (*)(OggVorbis_File *,char *,int,int,int,int,int *))
    1.88  #endif
    1.89 -			SDL_LoadFunction(vorbis.handle, "ov_read");
    1.90 -		if ( vorbis.ov_read == NULL ) {
    1.91 -			SDL_UnloadObject(vorbis.handle);
    1.92 -			return -1;
    1.93 -		}
    1.94 -		vorbis.ov_time_seek =
    1.95 +            SDL_LoadFunction(vorbis.handle, "ov_read");
    1.96 +        if ( vorbis.ov_read == NULL ) {
    1.97 +            SDL_UnloadObject(vorbis.handle);
    1.98 +            return -1;
    1.99 +        }
   1.100 +        vorbis.ov_time_seek =
   1.101  #ifdef OGG_USE_TREMOR
   1.102 -			(long (*)(OggVorbis_File *,ogg_int64_t))
   1.103 +            (long (*)(OggVorbis_File *,ogg_int64_t))
   1.104  #else
   1.105 -			(int (*)(OggVorbis_File *,double))
   1.106 +            (int (*)(OggVorbis_File *,double))
   1.107  #endif
   1.108 -			SDL_LoadFunction(vorbis.handle, "ov_time_seek");
   1.109 -		if ( vorbis.ov_time_seek == NULL ) {
   1.110 -			SDL_UnloadObject(vorbis.handle);
   1.111 -			return -1;
   1.112 -		}
   1.113 -	}
   1.114 -	++vorbis.loaded;
   1.115 +            SDL_LoadFunction(vorbis.handle, "ov_time_seek");
   1.116 +        if ( vorbis.ov_time_seek == NULL ) {
   1.117 +            SDL_UnloadObject(vorbis.handle);
   1.118 +            return -1;
   1.119 +        }
   1.120 +    }
   1.121 +    ++vorbis.loaded;
   1.122  
   1.123 -	return 0;
   1.124 +    return 0;
   1.125  }
   1.126  void Mix_QuitOgg()
   1.127  {
   1.128 -	if ( vorbis.loaded == 0 ) {
   1.129 -		return;
   1.130 -	}
   1.131 -	if ( vorbis.loaded == 1 ) {
   1.132 -		SDL_UnloadObject(vorbis.handle);
   1.133 -	}
   1.134 -	--vorbis.loaded;
   1.135 +    if ( vorbis.loaded == 0 ) {
   1.136 +        return;
   1.137 +    }
   1.138 +    if ( vorbis.loaded == 1 ) {
   1.139 +        SDL_UnloadObject(vorbis.handle);
   1.140 +    }
   1.141 +    --vorbis.loaded;
   1.142  }
   1.143  #else
   1.144  int Mix_InitOgg()
   1.145  {
   1.146 -	if ( vorbis.loaded == 0 ) {
   1.147 -		vorbis.ov_clear = ov_clear;
   1.148 -		vorbis.ov_info = ov_info;
   1.149 -		vorbis.ov_open_callbacks = ov_open_callbacks;
   1.150 -		vorbis.ov_pcm_total = ov_pcm_total;
   1.151 -		vorbis.ov_read = ov_read;
   1.152 -		vorbis.ov_time_seek = ov_time_seek;
   1.153 -	}
   1.154 -	++vorbis.loaded;
   1.155 +    if ( vorbis.loaded == 0 ) {
   1.156 +        vorbis.ov_clear = ov_clear;
   1.157 +        vorbis.ov_info = ov_info;
   1.158 +        vorbis.ov_open_callbacks = ov_open_callbacks;
   1.159 +        vorbis.ov_pcm_total = ov_pcm_total;
   1.160 +        vorbis.ov_read = ov_read;
   1.161 +        vorbis.ov_time_seek = ov_time_seek;
   1.162 +    }
   1.163 +    ++vorbis.loaded;
   1.164  
   1.165 -	return 0;
   1.166 +    return 0;
   1.167  }
   1.168  void Mix_QuitOgg()
   1.169  {
   1.170 -	if ( vorbis.loaded == 0 ) {
   1.171 -		return;
   1.172 -	}
   1.173 -	if ( vorbis.loaded == 1 ) {
   1.174 -	}
   1.175 -	--vorbis.loaded;
   1.176 +    if ( vorbis.loaded == 0 ) {
   1.177 +        return;
   1.178 +    }
   1.179 +    if ( vorbis.loaded == 1 ) {
   1.180 +    }
   1.181 +    --vorbis.loaded;
   1.182  }
   1.183  #endif /* OGG_DYNAMIC */
   1.184