Fixed big endian issue for ogg files.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1175 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hiker 2007-07-12 02:08:34 +00:00
parent bfa6844c45
commit 097254958c
2 changed files with 9 additions and 3 deletions

View File

@ -33,7 +33,6 @@ AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_PROG_INSTALL
dnl ===============================
dnl Check for MS Windows environment
dnl ================================
@ -195,6 +194,9 @@ case "${host}" in
if test x$have_vorbisfile_hdr = xyes -a x$have_ogg_hdr = xyes; then
AC_DEFINE([HAVE_OGGVORBIS], 1, [Defined when Ogg Vorbis is available])
SUMMARY="$SUMMARY\nWe have Ogg Vorbis support."
# ov_read for ogg music needs endianness flag. This macro defines
# WORDS_BIGENDIAN if it's a big endian machine. See music_ogg.cpp
AC_C_BIGENDIAN
fi
fi
else

View File

@ -252,14 +252,18 @@ void MusicOggStream::update()
bool MusicOggStream::streamIntoBuffer(ALuint buffer)
{
char pcm[BUFFER_SIZE];
int bigendianp = 0;
#ifdef WORDS_BIGENDIAN
int isBigEndian = 1;
#else
int isBigEndian = 0;
#endif
int size = 0;
int portion;
int result;
while(size < BUFFER_SIZE)
{
result = ov_read(&m_oggStream, pcm + size, BUFFER_SIZE - size, bigendianp, 2, 1, &portion);
result = ov_read(&m_oggStream, pcm + size, BUFFER_SIZE - size, isBigEndian, 2, 1, &portion);
if(result > 0)
size += result;