Skip to content

Commit

Permalink
[AE] paplayer: drop ReadSamples/HasFloatData from codecs
Browse files Browse the repository at this point in the history
  • Loading branch information
Geoffrey McRae authored and Jonathan Marshall committed May 9, 2012
1 parent 08b78c8 commit 461207b
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 39 deletions.
10 changes: 0 additions & 10 deletions xbmc/cores/paplayer/ICodec.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,6 @@ class ICodec
// the data has been exhausted, and READ_ERROR on error.
virtual int ReadPCM(BYTE *pBuffer, int size, int *actualsize)=0;

// ReadSamples()
// Decodes audio into floats (normalized to 1) into pBuffer up to numsamples samples.
// The actual amount of returned samples is given in actualsamples. Samples are
// total samples (ie distributed over channels).
// Returns READ_SUCCESS on success. Returns READ_EOF when the data has been exhausted,
// and READ_ERROR on error.
virtual int ReadSamples(float *pBuffer, int numsamples, int *actualsamples) { return READ_ERROR; };

// CanInit()
// Should return true if the codec can be initialized
// eg. check if a dll needed for the codec exists
Expand All @@ -97,8 +89,6 @@ class ICodec
virtual bool IsCaching() const {return false;}
virtual int GetCacheLevel() const {return -1;}

// true if we can retrieve normalized float data immediately
virtual bool HasFloatData() const { return false; }

int64_t m_TotalTime; // time in ms
int m_SampleRate;
Expand Down
7 changes: 0 additions & 7 deletions xbmc/cores/paplayer/MP3codec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,6 @@ int64_t MP3Codec::Seek(int64_t iSeekTime)
return iSeekTime;
}

int MP3Codec::ReadSamples(float *pBuffer, int numsamples, int *actualsamples)
{
int result = ReadPCM((BYTE *)pBuffer, numsamples * sizeof(float), actualsamples);
*actualsamples /= sizeof(float);
return result;
}

int MP3Codec::Read(int size, bool init)
{
int inputBufferToRead = (int)(m_InputBufferSize - m_InputBufferPos);
Expand Down
2 changes: 0 additions & 2 deletions xbmc/cores/paplayer/MP3codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,8 @@ class MP3Codec : public CachingCodec
virtual bool CanSeek();
virtual int64_t Seek(int64_t iSeekTime);
virtual int ReadPCM(BYTE *pBuffer, int size, int *actualsize);
virtual int ReadSamples(float *pBuffer, int numsamples, int *actualsamples);
virtual bool CanInit();
virtual bool SkipNext();
virtual bool HasFloatData() const { return m_BitsPerSampleInternal == 32; };
private:

/* TODO decoder functions */
Expand Down
17 changes: 0 additions & 17 deletions xbmc/cores/paplayer/WAVcodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ WAVCodec::WAVCodec()
m_SampleRate = 0;
m_Channels = 0;
m_BitsPerSample = 0;
m_bHasFloat = false;
m_iDataStart=0;
m_iDataLen=0;
m_Bitrate = 0;
Expand Down Expand Up @@ -115,7 +114,6 @@ bool WAVCodec::Init(const CStdString &strFile, unsigned int filecache)
case WAVE_FORMAT_PCM:
CLog::Log(LOGINFO, "WAVCodec::Init - WAVE_FORMAT_PCM detected");
m_ChannelMask = 0;
m_bHasFloat = false;
break;

case WAVE_FORMAT_IEEE_FLOAT:
Expand All @@ -127,7 +125,6 @@ bool WAVCodec::Init(const CStdString &strFile, unsigned int filecache)
}

m_ChannelMask = 0;
m_bHasFloat = true;
break;

case WAVE_FORMAT_EXTENSIBLE:
Expand All @@ -145,7 +142,6 @@ bool WAVCodec::Init(const CStdString &strFile, unsigned int filecache)
if (memcmp(&wfx.SubFormat, &KSDATAFORMAT_SUBTYPE_PCM, sizeof(GUID)) == 0)
{
CLog::Log(LOGINFO, "WAVCodec::Init - SubFormat KSDATAFORMAT_SUBTYPE_PCM Detected");
m_bHasFloat = false;
}
else if (memcmp(&wfx.SubFormat, &KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, sizeof(GUID)) == 0)
{
Expand All @@ -155,7 +151,6 @@ bool WAVCodec::Init(const CStdString &strFile, unsigned int filecache)
CLog::Log(LOGERROR, "WAVCodec::Init - Only 32bit Float is supported");
return false;
}
m_bHasFloat = true;
}
else
{
Expand Down Expand Up @@ -263,18 +258,6 @@ int WAVCodec::ReadPCM(BYTE *pBuffer, int size, int *actualsize)
return READ_ERROR;
}

int WAVCodec::ReadSamples(float *pBuffer, int numsamples, int *actualsamples)
{
int ret = READ_ERROR;
*actualsamples = 0;
if (m_bHasFloat)
{
ret = ReadPCM((BYTE*)pBuffer, numsamples * (m_BitsPerSample >> 3), actualsamples);
*actualsamples /= (m_BitsPerSample >> 3);
}
return ret;
}

bool WAVCodec::CanInit()
{
return true;
Expand Down
3 changes: 0 additions & 3 deletions xbmc/cores/paplayer/WAVcodec.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,9 @@ class WAVCodec : public CachingCodec
virtual void DeInit();
virtual int64_t Seek(int64_t iSeekTime);
virtual int ReadPCM(BYTE *pBuffer, int size, int *actualsize);
virtual int ReadSamples(float *pBuffer, int numsamples, int *actualsamples);
virtual bool CanInit();
virtual bool HasFloatData() const { return m_bHasFloat; }

private:
bool m_bHasFloat;
uint32_t m_iDataStart;
uint32_t m_iDataLen;
DWORD m_ChannelMask;
Expand Down

0 comments on commit 461207b

Please sign in to comment.