1

In my team, we develop UI to our Embedded Linux system (kernel version 4.19) using SDL (version 1.2). The board we run on is Amlogic A113X.

When we try to load SDL_mixer on our "regular" Ubuntu machines, everything works beautifully, on the board SDL_mixer fails to load.

SDL_mixer is wrapped within a AudioPlayer class which uses PIMPL to make the SDL dependency hidden in a cpp file.

relevant code:

void AudioPlayerImpl::throw_sdl_exception(const char* method_name){
    auto error_message = std::string("AudioPlayerImpl::") + method_name + ", " + SDL_GetError();
    throw std::runtime_error(error_message);
}


AudioPlayerImpl::AudioPlayerImpl()  :
    m_audio_context(nullptr),
    m_working(true),
    m_stop_music_requested(false){
    const auto code = ::Mix_Init(MIX_INIT_MP3);
    if (code & MIX_INIT_MP3 != MIX_INIT_MP3) {
        throw_sdl_exception("AudioPlayerImpl");
    }

    if (Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, 2, 4096) != 0) {
        throw_sdl_exception("AudioPlayerImpl");
    }

    m_audio_worker = std::thread([this]{
        work_loop();
    });
}

error:

AudioPlayerImpl::AudioPlayerImpl, Mixer not built with MP3 support

Auditional info: Both ALSA and mpg123 exists in /usr/lib

Any direction what to do next? as far as I know, libmpg123 is the dependency SDL uses to play mp3, and that dependency is in the right place.

David Haim
  • 25,446
  • 3
  • 44
  • 78
  • 2
    Your SDL_mixer have mp3 support disabled on build time (either explicitly via configure flags or depencency wasn't available at the time). You can only fix that by rebuilding SDL_mixer, keeping an eye on configure output regarding mp3 support. – keltar Aug 22 '19 at 12:54
  • hi @keltar , thanks for your suggestion! what are the configure flags I need to look at? can you name them so I research them? thanks! – David Haim Aug 22 '19 at 13:00
  • `./configure --enable-music-mp3`, for what I can tell. And look at output of configure. Is no configuration errors reported, make and install resulting library (look for install paths though!). – keltar Aug 22 '19 at 15:12

0 Answers0