Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fixed bug #385
Removed C runtime dependency for file I/O - fixes opening Ogg Vorbis files
on Windows with different versions of the C runtime.
- Loading branch information
Showing
with
8 additions
and
30 deletions.
-
+2
−0
CHANGES
-
+6
−30
music_ogg.c
|
|
@@ -1,4 +1,6 @@ |
|
|
1.2.8: |
|
|
Sam Lantinga - Sat Jul 14 21:05:09 PDT 2007 |
|
|
* Fixed opening Ogg Vorbis files using different C runtimes on Windows |
|
|
Philippe Simons - Sat Jul 14 20:33:17 PDT 2007 |
|
|
* Added support for Ogg Vorbis playback with Tremor (an integer decoder) |
|
|
Sam Lantinga - Sat Jul 14 07:02:09 PDT 2007 |
|
|
|
@@ -55,38 +55,14 @@ void OGG_setvolume(OGG_music *music, int volume) |
|
|
/* Load an OGG stream from the given file */ |
|
|
OGG_music *OGG_new(const char *file) |
|
|
{ |
|
|
OGG_music *music; |
|
|
FILE *fp; |
|
|
|
|
|
music = (OGG_music *)malloc(sizeof *music); |
|
|
if ( music ) { |
|
|
/* Initialize the music structure */ |
|
|
memset(music, 0, (sizeof *music)); |
|
|
OGG_stop(music); |
|
|
OGG_setvolume(music, MIX_MAX_VOLUME); |
|
|
music->section = -1; |
|
|
SDL_RWops *rw; |
|
|
|
|
|
if ( Mix_InitOgg() < 0 ) { |
|
|
return(NULL); |
|
|
} |
|
|
fp = fopen(file, "rb"); |
|
|
if ( fp == NULL ) { |
|
|
free(music); |
|
|
Mix_QuitOgg(); |
|
|
SDL_SetError("Couldn't open %s", file); |
|
|
return(NULL); |
|
|
} |
|
|
if ( vorbis.ov_open(fp, &music->vf, NULL, 0) < 0 ) { |
|
|
fclose(fp); |
|
|
free(music); |
|
|
Mix_QuitOgg(); |
|
|
SDL_SetError("Not an Ogg Vorbis audio stream"); |
|
|
return(NULL); |
|
|
} |
|
|
} else { |
|
|
SDL_OutOfMemory(); |
|
|
rw = SDL_RWFromFile(file, "rb"); |
|
|
if ( rw == NULL ) { |
|
|
SDL_SetError("Couldn't open %s", file); |
|
|
return NULL; |
|
|
} |
|
|
return(music); |
|
|
return OGG_new_RW(rw); |
|
|
} |
|
|
|
|
|
|
|
|
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.