Allow Opus CDDA support to be optionally disabled
Adds a `--disable-opus-cdda` flag that explicitly disables support for Ogg Opus CDDA tracks and in turn avoid the need for the Opus package dependencies such as the opusfile, opus, and ogg libraries. This feature does not alter the default operation of ./configure, which is to enable Opus CDDA support and quit if the Opus dependency package, opusfile, is not found. The user can then choose to either a) install the package or b) explicitly disable Opus support. This commit also includes: - fixes for a double-free in the MP3 close routine that was discovered during testing - a message if a CD audio track cannot be added during CDROM mounting (such as attempting to use Opus tracks when the binary does not support them). - the --disable-opus-cdda flag in our config heavy workflow
This commit is contained in:
parent
d86addb792
commit
f6060a5148
6 changed files with 44 additions and 27 deletions
|
@ -9,7 +9,6 @@ libdecoders_a_SOURCES = \
|
|||
mp3.cpp \
|
||||
mp3_seek_table.cpp \
|
||||
mp3_seek_table.h \
|
||||
opus.c \
|
||||
SDL_sound.c \
|
||||
SDL_sound.h \
|
||||
SDL_sound_internal.h \
|
||||
|
@ -21,6 +20,12 @@ libdecoders_a_SOURCES = \
|
|||
xxhash.c \
|
||||
xxhash.h
|
||||
|
||||
if USE_OPUS
|
||||
libdecoders_a_SOURCES += opus.c
|
||||
AM_CFLAGS += -DUSE_OPUS $(OPUSFILE_CFLAGS)
|
||||
LDADD += $(OPUSFILE_LIBS)
|
||||
endif
|
||||
|
||||
libdecoders_a_CXXFLAGS = \
|
||||
$(AM_CXXFLAGS) \
|
||||
$(CXXFLAGS) \
|
||||
|
|
|
@ -41,29 +41,30 @@
|
|||
#define __SDL_SOUND_INTERNAL__
|
||||
#include "SDL_sound_internal.h"
|
||||
|
||||
|
||||
/* The various decoder drivers... */
|
||||
|
||||
/* All these externs may be missing; we check SOUND_SUPPORTS_xxx before use. */
|
||||
extern const Sound_DecoderFunctions __Sound_DecoderFunctions_WAV;
|
||||
extern const Sound_DecoderFunctions __Sound_DecoderFunctions_VORBIS;
|
||||
extern const Sound_DecoderFunctions __Sound_DecoderFunctions_OPUS;
|
||||
extern const Sound_DecoderFunctions __Sound_DecoderFunctions_FLAC;
|
||||
extern const Sound_DecoderFunctions __Sound_DecoderFunctions_MP3;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int available;
|
||||
const Sound_DecoderFunctions *funcs;
|
||||
} decoder_element;
|
||||
|
||||
/* Supported decoder drivers... */
|
||||
extern const Sound_DecoderFunctions __Sound_DecoderFunctions_FLAC;
|
||||
extern const Sound_DecoderFunctions __Sound_DecoderFunctions_MP3;
|
||||
#ifdef USE_OPUS
|
||||
extern const Sound_DecoderFunctions __Sound_DecoderFunctions_OPUS;
|
||||
#endif
|
||||
extern const Sound_DecoderFunctions __Sound_DecoderFunctions_VORBIS;
|
||||
extern const Sound_DecoderFunctions __Sound_DecoderFunctions_WAV;
|
||||
|
||||
static decoder_element decoders[] =
|
||||
{
|
||||
{ 0, &__Sound_DecoderFunctions_WAV },
|
||||
{ 0, &__Sound_DecoderFunctions_VORBIS },
|
||||
{ 0, &__Sound_DecoderFunctions_OPUS },
|
||||
{ 0, &__Sound_DecoderFunctions_FLAC },
|
||||
{ 0, &__Sound_DecoderFunctions_MP3 },
|
||||
#ifdef USE_OPUS
|
||||
{ 0, &__Sound_DecoderFunctions_OPUS },
|
||||
#endif
|
||||
{ 0, &__Sound_DecoderFunctions_VORBIS },
|
||||
{ 0, &__Sound_DecoderFunctions_WAV },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
|
|
|
@ -90,15 +90,11 @@ static void MP3_close(Sound_Sample* const sample)
|
|||
{
|
||||
Sound_SampleInternal* const internal = static_cast<Sound_SampleInternal*>(sample->opaque);
|
||||
mp3_t* p_mp3 = static_cast<mp3_t*>(internal->decoder_private);
|
||||
if (p_mp3 != nullptr) {
|
||||
if (p_mp3->p_dr != nullptr) {
|
||||
drmp3_uninit(p_mp3->p_dr);
|
||||
SDL_free(p_mp3->p_dr);
|
||||
}
|
||||
// maps and vector destructors free their memory
|
||||
if (p_mp3) {
|
||||
SDL_free(p_mp3->p_dr);
|
||||
SDL_free(p_mp3);
|
||||
internal->decoder_private = nullptr;
|
||||
}
|
||||
internal->decoder_private = nullptr;
|
||||
} /* MP3_close */
|
||||
|
||||
static Uint32 MP3_read(Sound_Sample* const sample, void* buffer, Uint32 desired_frames)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue