Skip to content

Commit

Permalink
fixed: don't crash if we can't load libmad
Browse files Browse the repository at this point in the history
  • Loading branch information
bobo1on1 committed Feb 2, 2012
1 parent f060ffa commit c10c2d5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions xbmc/cores/paplayer/MP3codec.cpp
Expand Up @@ -71,7 +71,9 @@ MP3Codec::MP3Codec()

m_HaveData = false;
flushcnt = 0;
madx_init(&mxhouse);

if (m_dll.Load())
madx_init(&mxhouse);
}

MP3Codec::~MP3Codec()
Expand All @@ -84,7 +86,8 @@ MP3Codec::~MP3Codec()
delete[] m_OutputBuffer;
m_OutputBuffer = NULL;

madx_deinit(&mxhouse);
if (m_dll.IsLoaded())
madx_deinit(&mxhouse);
}

//Eventhandler if filereader is clearedwe flush the decoder.
Expand All @@ -95,8 +98,9 @@ void MP3Codec::OnFileReaderClearEvent()

bool MP3Codec::Init(const CStdString &strFile, unsigned int filecache)
{
if (!m_dll.IsLoaded())
m_dll.Load();
if (!m_dll.Load())
return false;

// set defaults...
m_InputBufferPos = 0;
m_OutputBufferPos = 0;
Expand Down

0 comments on commit c10c2d5

Please sign in to comment.