Skip to content

Commit

Permalink
Fixed building Mac OS X opus support
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Oct 26, 2018
1 parent 26db2ed commit f8d12a6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 6 additions & 4 deletions Xcode/SDL_mixer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
/* Begin PBXBuildFile section */
0448E8AE108B937A00C9D3EA /* native_midi_macosx.c in Sources */ = {isa = PBXBuildFile; fileRef = 0448E8AD108B937A00C9D3EA /* native_midi_macosx.c */; };
0448E8AF108B937A00C9D3EA /* native_midi_macosx.c in Sources */ = {isa = PBXBuildFile; fileRef = 0448E8AD108B937A00C9D3EA /* native_midi_macosx.c */; };
630FBD7720D52063009867AB /* Opus.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 630FBD7620D52063009867AB /* Opus.framework */; };
630FBD7D20D5206E009867AB /* OpusFile.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 630FBD7C20D5206E009867AB /* OpusFile.framework */; };
630FBD8320D52105009867AB /* music_opus.c in Sources */ = {isa = PBXBuildFile; fileRef = 630FBD8220D52105009867AB /* music_opus.c */; };
630FBD8520D5211F009867AB /* music_opus.h in Headers */ = {isa = PBXBuildFile; fileRef = 630FBD8420D5211F009867AB /* music_opus.h */; };
63CD6ADC20D52DE20096FB34 /* Opus.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 630FBD7620D52063009867AB /* Opus.framework */; };
Expand Down Expand Up @@ -198,8 +196,6 @@
AA6442D3175B181D00A2125A /* AudioUnit.framework in Frameworks */,
AA6442D5175B185800A2125A /* CoreServices.framework in Frameworks */,
BE1FA90207AF96B2004B6283 /* SDL2.framework in Frameworks */,
630FBD7720D52063009867AB /* Opus.framework in Frameworks */,
630FBD7D20D5206E009867AB /* OpusFile.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -658,6 +654,7 @@
MUSIC_OGG,
MUSIC_FLAC,
MUSIC_OPUS,
"OPUS_HEADER=\"<opusfile.h>\"",
);
INFOPLIST_FILE = "Info-Framework.plist";
INSTALL_PATH = "@rpath";
Expand All @@ -672,6 +669,8 @@
mpg123,
"-weak_framework",
Vorbis,
"-weak_framework",
OpusFile,
);
PRODUCT_BUNDLE_IDENTIFIER = "org.libsdl.SDL2-mixer";
WRAPPER_EXTENSION = framework;
Expand Down Expand Up @@ -700,6 +699,7 @@
MUSIC_OGG,
MUSIC_FLAC,
MUSIC_OPUS,
"OPUS_HEADER=\"<opusfile.h>\"",
);
INFOPLIST_FILE = "Info-Framework.plist";
INSTALL_PATH = "@rpath";
Expand All @@ -714,6 +714,8 @@
mpg123,
"-weak_framework",
Vorbis,
"-weak_framework",
OpusFile,
);
PRODUCT_BUNDLE_IDENTIFIER = "org.libsdl.SDL2-mixer";
WRAPPER_EXTENSION = framework;
Expand Down
6 changes: 5 additions & 1 deletion music_opus.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@

#include "music_opus.h"

#if defined(OPUS_HEADER)
#include OPUS_HEADER
#else
#include <opus/opusfile.h>
#endif

typedef struct {
int loaded;
Expand Down Expand Up @@ -65,7 +69,7 @@ static int OPUS_Load(void)
extern OggOpusFile *op_open_callbacks(void *,const OpusFileCallbacks *,const unsigned char *,size_t,int *) __attribute__((weak_import));
if (op_open_callbacks == NULL) {
/* Missing weakly linked framework */
Mix_SetError("Missing Opus.framework");
Mix_SetError("Missing OpusFile.framework");
return -1;
}
#endif
Expand Down

0 comments on commit f8d12a6

Please sign in to comment.