aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoffrey McRae <gnif@xbmc.org>2012-04-25 15:58:28 +1200
committerJonathan Marshall <jmarshall@never.you.mind>2012-05-10 09:40:51 +1200
commit67638dc7a7f4139ad78773d00171b11550119fcd (patch)
treef167c80156d45beff3e8641264d05996d542f77a
parent461207b8cd4fc74543a66df5b9229e5ae38f4eea (diff)
[AE] paplayer: add GetChannelInfo to codecs
-rw-r--r--xbmc/cores/paplayer/ADPCMCodec.cpp1
-rw-r--r--xbmc/cores/paplayer/ASAPCodec.cpp1
-rw-r--r--xbmc/cores/paplayer/BXAcodec.cpp1
-rw-r--r--xbmc/cores/paplayer/CDDAcodec.cpp1
-rw-r--r--xbmc/cores/paplayer/DVDPlayerCodec.cpp7
-rw-r--r--xbmc/cores/paplayer/DVDPlayerCodec.h3
-rw-r--r--xbmc/cores/paplayer/FLACcodec.cpp25
-rw-r--r--xbmc/cores/paplayer/FLACcodec.h2
-rw-r--r--xbmc/cores/paplayer/ICodec.h13
-rw-r--r--xbmc/cores/paplayer/MP3codec.cpp14
-rw-r--r--xbmc/cores/paplayer/MP3codec.h2
-rw-r--r--xbmc/cores/paplayer/ModplugCodec.cpp1
-rw-r--r--xbmc/cores/paplayer/NSFCodec.cpp1
-rw-r--r--xbmc/cores/paplayer/OGGcodec.cpp41
-rw-r--r--xbmc/cores/paplayer/OGGcodec.h2
-rw-r--r--xbmc/cores/paplayer/SPCCodec.cpp1
-rw-r--r--xbmc/cores/paplayer/TimidityCodec.cpp1
-rw-r--r--xbmc/cores/paplayer/VGMCodec.cpp8
-rw-r--r--xbmc/cores/paplayer/WAVcodec.cpp11
-rw-r--r--xbmc/cores/paplayer/YMCodec.cpp1
20 files changed, 108 insertions, 29 deletions
diff --git a/xbmc/cores/paplayer/ADPCMCodec.cpp b/xbmc/cores/paplayer/ADPCMCodec.cpp
index 6425f0fb3d..028a88f1cf 100644
--- a/xbmc/cores/paplayer/ADPCMCodec.cpp
+++ b/xbmc/cores/paplayer/ADPCMCodec.cpp
@@ -51,6 +51,7 @@ bool ADPCMCodec::Init(const CStdString &strFile, unsigned int filecache)
m_Channels = m_dll.GetNumberOfChannels(m_adpcm);
m_SampleRate = m_dll.GetPlaybackRate(m_adpcm);
m_BitsPerSample = 16;//m_dll.GetSampleSize(m_adpcm);
+ m_DataFormat = AE_FMT_S16NE;
m_TotalTime = m_dll.GetLength(m_adpcm); // fixme?
m_iDataPos = 0;
diff --git a/xbmc/cores/paplayer/ASAPCodec.cpp b/xbmc/cores/paplayer/ASAPCodec.cpp
index 64dab26eca..98d0543464 100644
--- a/xbmc/cores/paplayer/ASAPCodec.cpp
+++ b/xbmc/cores/paplayer/ASAPCodec.cpp
@@ -58,6 +58,7 @@ bool ASAPCodec::Init(const CStdString &strFile, unsigned int filecache)
m_TotalTime = duration;
m_SampleRate = 44100;
m_BitsPerSample = 16;
+ m_DataFormat = AE_FMT_S16NE;
return true;
}
diff --git a/xbmc/cores/paplayer/BXAcodec.cpp b/xbmc/cores/paplayer/BXAcodec.cpp
index 94ba3dabe3..18d024cb27 100644
--- a/xbmc/cores/paplayer/BXAcodec.cpp
+++ b/xbmc/cores/paplayer/BXAcodec.cpp
@@ -57,6 +57,7 @@ bool BXACodec::Init(const CStdString &strFile, unsigned int filecache)
m_BitsPerSample = bxah.bitsPerSample;
m_TotalTime = bxah.durationMs;
m_Bitrate = bxah.sampleRate * bxah.channels * bxah.bitsPerSample;
+ m_DataFormat = AE_FMT_S16LE;
if (m_SampleRate == 0 || m_Channels == 0 || m_BitsPerSample == 0)
{
diff --git a/xbmc/cores/paplayer/CDDAcodec.cpp b/xbmc/cores/paplayer/CDDAcodec.cpp
index 5389378fdc..9ac727a900 100644
--- a/xbmc/cores/paplayer/CDDAcodec.cpp
+++ b/xbmc/cores/paplayer/CDDAcodec.cpp
@@ -36,6 +36,7 @@ CDDACodec::CDDACodec()
m_SampleRate = 44100;
m_Channels = 2;
m_BitsPerSample = 16;
+ m_DataFormat = AE_FMT_S16NE;
m_TotalTime = 0;
m_Bitrate = 0;
m_CodecName = "CDDA";
diff --git a/xbmc/cores/paplayer/DVDPlayerCodec.cpp b/xbmc/cores/paplayer/DVDPlayerCodec.cpp
index c6b09188c7..1ac4d67040 100644
--- a/xbmc/cores/paplayer/DVDPlayerCodec.cpp
+++ b/xbmc/cores/paplayer/DVDPlayerCodec.cpp
@@ -21,6 +21,7 @@
#include "DVDPlayerCodec.h"
#include "Util.h"
+#include "cores/AudioEngine/Utils/AEUtil.h"
#include "cores/dvdplayer/DVDInputStreams/DVDFactoryInputStream.h"
#include "cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.h"
@@ -151,10 +152,12 @@ bool DVDPlayerCodec::Init(const CStdString &strFile, unsigned int filecache)
if (ReadPCM(dummy, nSize, &nSize) == READ_ERROR)
++nErrors;
- // We always ask ffmpeg to return s16le
- m_BitsPerSample = m_pAudioCodec->GetBitsPerSample();
+ m_DataFormat = m_pAudioCodec->GetDataFormat();
+ m_BitsPerSample = CAEUtil::DataFormatToBits(m_DataFormat);
m_SampleRate = m_pAudioCodec->GetSampleRate();
+ m_EncodedSampleRate = m_pAudioCodec->GetEncodedSampleRate();
m_Channels = m_pAudioCodec->GetChannels();
+ m_ChannelInfo = m_pAudioCodec->GetChannelMap();
}
if (nErrors >= 10)
diff --git a/xbmc/cores/paplayer/DVDPlayerCodec.h b/xbmc/cores/paplayer/DVDPlayerCodec.h
index 4f0b85dedd..d610960469 100644
--- a/xbmc/cores/paplayer/DVDPlayerCodec.h
+++ b/xbmc/cores/paplayer/DVDPlayerCodec.h
@@ -40,6 +40,7 @@ public:
virtual int ReadPCM(BYTE *pBuffer, int size, int *actualsize);
virtual bool CanInit();
virtual bool CanSeek();
+ virtual CAEChannelInfo GetChannelInfo() {return m_ChannelInfo;}
void SetContentType(const CStdString &strContent);
@@ -57,6 +58,8 @@ private:
BYTE *m_decoded;
int m_nDecodedLen;
+
+ CAEChannelInfo m_ChannelInfo;
};
#endif
diff --git a/xbmc/cores/paplayer/FLACcodec.cpp b/xbmc/cores/paplayer/FLACcodec.cpp
index 5808c2fb00..ffe9b05195 100644
--- a/xbmc/cores/paplayer/FLACcodec.cpp
+++ b/xbmc/cores/paplayer/FLACcodec.cpp
@@ -30,6 +30,7 @@ FLACCodec::FLACCodec()
m_SampleRate = 0;
m_Channels = 0;
m_BitsPerSample = 0;
+ m_DataFormat = AE_FMT_INVALID;
m_TotalTime=0;
m_Bitrate = 0;
m_CodecName = "FLAC";
@@ -87,7 +88,7 @@ bool FLACCodec::Init(const CStdString &strFile, unsigned int filecache)
}
// These are filled by the metadata callback
- if (m_SampleRate==0 || m_Channels==0 || m_BitsPerSample==0 || m_TotalTime==0 || m_MaxFrameSize==0)
+ if (m_SampleRate==0 || m_Channels==0 || m_BitsPerSample==0 || m_TotalTime==0 || m_MaxFrameSize==0 || m_DataFormat == AE_FMT_INVALID)
{
CLog::Log(LOGERROR, "FLACCodec: Can't get stream info, SampleRate=%i, Channels=%i, BitsPerSample=%i, TotalTime=%"PRIu64", MaxFrameSize=%i", m_SampleRate, m_Channels, m_BitsPerSample, m_TotalTime, m_MaxFrameSize);
FreeDecoder();
@@ -313,9 +314,31 @@ void FLACCodec::DecoderMetadataCallback(const FLAC__StreamDecoder *decoder, cons
if (metadata->type==FLAC__METADATA_TYPE_STREAMINFO)
{
+ static enum AEChannel map[6][7] = {
+ {AE_CH_FC, AE_CH_NULL},
+ {AE_CH_FL, AE_CH_FR, AE_CH_NULL},
+ {AE_CH_FL, AE_CH_FR, AE_CH_FC, AE_CH_NULL},
+ {AE_CH_FL, AE_CH_FR, AE_CH_BL, AE_CH_BR, AE_CH_NULL},
+ {AE_CH_FL, AE_CH_FR, AE_CH_FC, AE_CH_BL, AE_CH_BR, AE_CH_NULL},
+ {AE_CH_FL, AE_CH_FR, AE_CH_FC, AE_CH_LFE, AE_CH_BL, AE_CH_BR, AE_CH_NULL}
+ };
+
+ /* channel counts greater then 6 are undefined */
+ if (metadata->data.stream_info.channels > 6)
+ pThis->m_ChannelInfo = CAEUtil::GuessChLayout(metadata->data.stream_info.channels);
+ else
+ pThis->m_ChannelInfo = CAEChannelInfo(map[metadata->data.stream_info.channels - 1]);
+
pThis->m_SampleRate = metadata->data.stream_info.sample_rate;
pThis->m_Channels = metadata->data.stream_info.channels;
pThis->m_BitsPerSample = metadata->data.stream_info.bits_per_sample;
+ switch(pThis->m_BitsPerSample)
+ {
+ case 8: pThis->m_DataFormat = AE_FMT_U8; break;
+ case 16: pThis->m_DataFormat = AE_FMT_S16NE; break;
+ case 24: pThis->m_DataFormat = AE_FMT_S24NE3; break;
+ case 32: pThis->m_DataFormat = AE_FMT_FLOAT; break;
+ }
pThis->m_TotalTime = (int64_t)metadata->data.stream_info.total_samples * 1000 / metadata->data.stream_info.sample_rate;
pThis->m_MaxFrameSize = metadata->data.stream_info.max_blocksize*(pThis->m_BitsPerSample/8)*pThis->m_Channels;
}
diff --git a/xbmc/cores/paplayer/FLACcodec.h b/xbmc/cores/paplayer/FLACcodec.h
index 5c7998032d..d5be6b6216 100644
--- a/xbmc/cores/paplayer/FLACcodec.h
+++ b/xbmc/cores/paplayer/FLACcodec.h
@@ -35,6 +35,7 @@ public:
virtual int64_t Seek(int64_t iSeekTime);
virtual int ReadPCM(BYTE *pBuffer, int size, int *actualsize);
virtual bool CanInit();
+ virtual CAEChannelInfo GetChannelInfo() {return m_ChannelInfo;}
private:
// I/O callbacks for the flac decoder
@@ -54,4 +55,5 @@ private:
int m_BufferSize; // size of buffer is filled with decoded audio data
int m_MaxFrameSize; // size of a single decoded frame
FLAC__StreamDecoder* m_pFlacDecoder;
+ CAEChannelInfo m_ChannelInfo;
};
diff --git a/xbmc/cores/paplayer/ICodec.h b/xbmc/cores/paplayer/ICodec.h
index 405533d0ec..c1bfecc99c 100644
--- a/xbmc/cores/paplayer/ICodec.h
+++ b/xbmc/cores/paplayer/ICodec.h
@@ -25,6 +25,9 @@
#include "utils/StdString.h"
#include "filesystem/File.h"
+#include "cores/AudioEngine/AEAudioFormat.h"
+#include "cores/AudioEngine/Utils/AEUtil.h"
+
#define READ_EOF -1
#define READ_SUCCESS 0
#define READ_ERROR 1
@@ -89,14 +92,22 @@ public:
virtual bool IsCaching() const {return false;}
virtual int GetCacheLevel() const {return -1;}
+ // GetChannelInfo()
+ // Return the channel layout and count information in an CAEChannelInfo object
+ virtual CAEChannelInfo GetChannelInfo() {return CAEUtil::GuessChLayout(m_Channels);}
int64_t m_TotalTime; // time in ms
int m_SampleRate;
+ int m_EncodedSampleRate;
int m_BitsPerSample;
- int m_Channels;
+ enum AEDataFormat m_DataFormat;
int m_Bitrate;
CStdString m_CodecName;
CReplayGain m_replayGain;
XFILE::CFile m_file;
+
+protected:
+ int m_Channels; /* remove this soon, its being deprecated */
+
};
diff --git a/xbmc/cores/paplayer/MP3codec.cpp b/xbmc/cores/paplayer/MP3codec.cpp
index a7de09b70a..c49e4893fa 100644
--- a/xbmc/cores/paplayer/MP3codec.cpp
+++ b/xbmc/cores/paplayer/MP3codec.cpp
@@ -55,6 +55,7 @@ MP3Codec::MP3Codec()
m_InputBufferPos = 0;
memset(&m_Formatdata,0,sizeof(m_Formatdata));
+ m_DataFormat = AE_FMT_S32NE;
// create our output buffer
m_OutputBufferSize = 1152*4*8; // enough for 4 frames
@@ -543,3 +544,16 @@ void MP3Codec::madx_deinit( madx_house *mxhouse )
m_dll.mad_frame_finish(&mxhouse->frame);
m_dll.mad_stream_finish(&mxhouse->stream);
}
+
+CAEChannelInfo MP3Codec::GetChannelInfo()
+{
+ static enum AEChannel map[2][3] = {
+ {AE_CH_FC, AE_CH_NULL},
+ {AE_CH_FL, AE_CH_FR , AE_CH_NULL}
+ };
+
+ if (m_Channels > 2)
+ return CAEUtil::GuessChLayout(m_Channels);
+
+ return CAEChannelInfo(map[m_Channels - 1]);
+}
diff --git a/xbmc/cores/paplayer/MP3codec.h b/xbmc/cores/paplayer/MP3codec.h
index bf2f6b5bf2..0498b5df44 100644
--- a/xbmc/cores/paplayer/MP3codec.h
+++ b/xbmc/cores/paplayer/MP3codec.h
@@ -63,6 +63,8 @@ public:
virtual int ReadPCM(BYTE *pBuffer, int size, int *actualsize);
virtual bool CanInit();
virtual bool SkipNext();
+ virtual CAEChannelInfo GetChannelInfo();
+
private:
/* TODO decoder functions */
diff --git a/xbmc/cores/paplayer/ModplugCodec.cpp b/xbmc/cores/paplayer/ModplugCodec.cpp
index 1ddd147ff4..b8420b598f 100644
--- a/xbmc/cores/paplayer/ModplugCodec.cpp
+++ b/xbmc/cores/paplayer/ModplugCodec.cpp
@@ -73,6 +73,7 @@ bool ModplugCodec::Init(const CStdString &strFile, unsigned int filecache)
m_Channels = 2;
m_SampleRate = 44100;
m_BitsPerSample = 16;
+ m_DataFormat = AE_FMT_S16NE;
m_TotalTime = (int64_t)(m_dll.ModPlug_GetLength(m_module));
return true;
diff --git a/xbmc/cores/paplayer/NSFCodec.cpp b/xbmc/cores/paplayer/NSFCodec.cpp
index 6816b2eaac..88e4c3b8c3 100644
--- a/xbmc/cores/paplayer/NSFCodec.cpp
+++ b/xbmc/cores/paplayer/NSFCodec.cpp
@@ -73,6 +73,7 @@ bool NSFCodec::Init(const CStdString &strFile, unsigned int filecache)
m_Channels = 1;
m_SampleRate = 48000;
m_BitsPerSample = 16;
+ m_DataFormat = AE_FMT_S16NE;
m_TotalTime = 4*60*1000; // fixme?
m_iDataPos = 0;
diff --git a/xbmc/cores/paplayer/OGGcodec.cpp b/xbmc/cores/paplayer/OGGcodec.cpp
index f08819ebde..120eb49ebb 100644
--- a/xbmc/cores/paplayer/OGGcodec.cpp
+++ b/xbmc/cores/paplayer/OGGcodec.cpp
@@ -32,6 +32,7 @@ OGGCodec::OGGCodec() : m_callback(m_file)
m_SampleRate = 0;
m_Channels = 0;
m_BitsPerSample = 0;
+ m_DataFormat = AE_FMT_INVALID;
m_Bitrate = 0;
m_CodecName = "OGG";
m_TimeOffset = 0.0;
@@ -115,6 +116,7 @@ bool OGGCodec::Init(const CStdString &strFile1, unsigned int filecache)
m_SampleRate = pInfo->rate;
m_Channels = pInfo->channels;
m_BitsPerSample = 16;
+ m_DataFormat = AE_FMT_S16NE;
if (item.IsInternetStream())
m_TotalTime = -1;
else
@@ -196,9 +198,6 @@ int OGGCodec::ReadPCM(BYTE *pBuffer, int size, int *actualsize)
else
*actualsize=lRead;
- if (m_Channels==6) // Only 6 channel files need remapping
- RemapChannels((short*)pBuffer, size/2); // size/2 = 16 bit samples
-
return READ_SUCCESS;
}
@@ -207,25 +206,21 @@ bool OGGCodec::CanInit()
return m_dll.CanLoad();
}
-// OGG order : L, C, R, L", R", LFE
-// Output order : L, R, L", R", C, LFE
-void OGGCodec::RemapChannels(short *SampleBuffer, int samples)
+CAEChannelInfo OGGCodec::GetChannelInfo()
{
- short r1, r2, r3, r4, r5, r6;
- for (int i = 0; i < samples; i += 6)
- {
- r1 = SampleBuffer[i];
- r2 = SampleBuffer[i+1];
- r3 = SampleBuffer[i+2];
- r4 = SampleBuffer[i+3];
- r5 = SampleBuffer[i+4];
- r6 = SampleBuffer[i+5];
- SampleBuffer[i] = r1;
- SampleBuffer[i+1] = r3;
- SampleBuffer[i+2] = r4;
- SampleBuffer[i+3] = r5;
- SampleBuffer[i+4] = r2;
- SampleBuffer[i+5] = r6;
- }
+ static enum AEChannel map[8][9] = {
+ {AE_CH_FC, AE_CH_NULL},
+ {AE_CH_FL, AE_CH_FR, AE_CH_NULL},
+ {AE_CH_FL, AE_CH_FC, AE_CH_FR, AE_CH_NULL},
+ {AE_CH_FL, AE_CH_FR, AE_CH_BL, AE_CH_BR, AE_CH_NULL},
+ {AE_CH_FL, AE_CH_FC, AE_CH_FR, AE_CH_BL, AE_CH_BR, AE_CH_NULL},
+ {AE_CH_FL, AE_CH_FC, AE_CH_FR, AE_CH_BL, AE_CH_BR, AE_CH_LFE, AE_CH_NULL},
+ {AE_CH_FL, AE_CH_FC, AE_CH_FR, AE_CH_SL, AE_CH_SR, AE_CH_BL, AE_CH_BR, AE_CH_NULL},
+ {AE_CH_FL, AE_CH_FC, AE_CH_FR, AE_CH_SL, AE_CH_SR, AE_CH_BL, AE_CH_BR, AE_CH_LFE, AE_CH_NULL}
+ };
+
+ if (m_Channels > 8)
+ return CAEUtil::GuessChLayout(m_Channels);
+
+ return CAEChannelInfo(map[m_Channels - 1]);
}
-
diff --git a/xbmc/cores/paplayer/OGGcodec.h b/xbmc/cores/paplayer/OGGcodec.h
index 541a859608..5fa1ba312f 100644
--- a/xbmc/cores/paplayer/OGGcodec.h
+++ b/xbmc/cores/paplayer/OGGcodec.h
@@ -36,10 +36,10 @@ public:
virtual int64_t Seek(int64_t iSeekTime);
virtual int ReadPCM(BYTE *pBuffer, int size, int *actualsize);
virtual bool CanInit();
+ virtual CAEChannelInfo GetChannelInfo();
private:
COggCallback m_callback;
- void RemapChannels(short *SampleBuffer, int samples);
DllVorbisfile m_dll;
OggVorbis_File m_VorbisFile;
diff --git a/xbmc/cores/paplayer/SPCCodec.cpp b/xbmc/cores/paplayer/SPCCodec.cpp
index ec247a70f7..86bd7e456b 100644
--- a/xbmc/cores/paplayer/SPCCodec.cpp
+++ b/xbmc/cores/paplayer/SPCCodec.cpp
@@ -125,6 +125,7 @@ bool SPCCodec::Init(const CStdString &strFile, unsigned int filecache)
m_SampleRate = 32000;
m_Channels = 2;
m_BitsPerSample = 16;
+ m_DataFormat = AE_FMT_S16NE;
CMusicInfoTagLoaderSPC tagLoader;
CMusicInfoTag tag;
tagLoader.Load(strFile,tag);
diff --git a/xbmc/cores/paplayer/TimidityCodec.cpp b/xbmc/cores/paplayer/TimidityCodec.cpp
index 01b7b09889..b99a22e584 100644
--- a/xbmc/cores/paplayer/TimidityCodec.cpp
+++ b/xbmc/cores/paplayer/TimidityCodec.cpp
@@ -124,6 +124,7 @@ bool TimidityCodec::Init(const CStdString &strFile, unsigned int filecache)
m_Channels = 2;
m_SampleRate = 48000;
m_BitsPerSample = 16;
+ m_DataFormat = AE_FMT_S16NE;
m_TotalTime = (int64_t)m_dll.GetLength(m_mid);
return true;
diff --git a/xbmc/cores/paplayer/VGMCodec.cpp b/xbmc/cores/paplayer/VGMCodec.cpp
index 71ff0e346e..ee018ef6de 100644
--- a/xbmc/cores/paplayer/VGMCodec.cpp
+++ b/xbmc/cores/paplayer/VGMCodec.cpp
@@ -28,6 +28,7 @@ VGMCodec::VGMCodec()
m_CodecName = "VGM";
m_vgm = 0;
m_iDataPos = -1;
+ m_DataFormat = AE_FMT_INVALID;
}
VGMCodec::~VGMCodec()
@@ -53,6 +54,13 @@ bool VGMCodec::Init(const CStdString &strFile, unsigned int filecache)
return false;
}
+ switch (m_BitsPerSample)
+ {
+ case 8: m_DataFormat = AE_FMT_U8 ; break;
+ case 16: m_DataFormat = AE_FMT_S16NE; break;
+ case 32: m_DataFormat = AE_FMT_FLOAT; break;
+ }
+
m_TotalTime = (int64_t)m_dll.GetLength(m_vgm);
return true;
diff --git a/xbmc/cores/paplayer/WAVcodec.cpp b/xbmc/cores/paplayer/WAVcodec.cpp
index 9c512838b2..40b58a02e7 100644
--- a/xbmc/cores/paplayer/WAVcodec.cpp
+++ b/xbmc/cores/paplayer/WAVcodec.cpp
@@ -48,6 +48,7 @@ WAVCodec::WAVCodec()
m_SampleRate = 0;
m_Channels = 0;
m_BitsPerSample = 0;
+ m_DataFormat = AE_FMT_INVALID;
m_iDataStart=0;
m_iDataLen=0;
m_Bitrate = 0;
@@ -98,8 +99,16 @@ bool WAVCodec::Init(const CStdString &strFile, unsigned int filecache)
m_Channels = Endian_SwapLE16(wfx.Format.nChannels );
m_BitsPerSample = Endian_SwapLE16(wfx.Format.wBitsPerSample);
+ switch(m_BitsPerSample)
+ {
+ case 8 : m_DataFormat = AE_FMT_U8 ; break;
+ case 16: m_DataFormat = AE_FMT_S16LE; break;
+ case 24: m_DataFormat = AE_FMT_S24NE3; break;
+ case 32: m_DataFormat = AE_FMT_FLOAT; break;
+ }
+
CLog::Log(LOGINFO, "WAVCodec::Init - Sample Rate: %d, Bits Per Sample: %d, Channels: %d", m_SampleRate, m_BitsPerSample, m_Channels);
- if ((m_SampleRate == 0) || (m_Channels == 0) || (m_BitsPerSample == 0))
+ if ((m_SampleRate == 0) || (m_Channels == 0) || (m_BitsPerSample == 0) || (m_DataFormat == AE_FMT_INVALID))
{
CLog::Log(LOGERROR, "WAVCodec::Init - Invalid data in WAVE header");
return false;
diff --git a/xbmc/cores/paplayer/YMCodec.cpp b/xbmc/cores/paplayer/YMCodec.cpp
index 4dbae66216..ab1ff9482e 100644
--- a/xbmc/cores/paplayer/YMCodec.cpp
+++ b/xbmc/cores/paplayer/YMCodec.cpp
@@ -50,6 +50,7 @@ bool YMCodec::Init(const CStdString &strFile, unsigned int filecache)
m_Channels = 1;
m_SampleRate = 44100;
m_BitsPerSample = 16;
+ m_DataFormat = AE_FMT_S16NE;
m_TotalTime = m_dll.GetLength(m_ym)*1000;
return true;