Skip to content

Commit

Permalink
AE: refactor AEStreamInfo and remove some bullshit coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
FernetMenta committed Nov 16, 2015
1 parent 400ce99 commit 3f44006
Show file tree
Hide file tree
Showing 6 changed files with 226 additions and 208 deletions.
14 changes: 7 additions & 7 deletions xbmc/cores/AudioEngine/Utils/AEBitstreamPacker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ CAEBitstreamPacker::~CAEBitstreamPacker()

void CAEBitstreamPacker::Pack(CAEStreamInfo &info, uint8_t* data, int size)
{
switch (info.GetDataType())
switch (info.m_type)
{
case CAEStreamInfo::STREAM_TYPE_TRUEHD:
PackTrueHD(info, data, size);
Expand All @@ -69,20 +69,20 @@ void CAEBitstreamPacker::Pack(CAEStreamInfo &info, uint8_t* data, int size)

case CAEStreamInfo::STREAM_TYPE_DTSHD_CORE:
case CAEStreamInfo::STREAM_TYPE_DTS_512:
m_dataSize = CAEPackIEC61937::PackDTS_512(data, size, m_packedBuffer, info.IsLittleEndian());
m_dataSize = CAEPackIEC61937::PackDTS_512(data, size, m_packedBuffer, info.m_dataIsLE);
break;

case CAEStreamInfo::STREAM_TYPE_DTS_1024:
m_dataSize = CAEPackIEC61937::PackDTS_1024(data, size, m_packedBuffer, info.IsLittleEndian());
m_dataSize = CAEPackIEC61937::PackDTS_1024(data, size, m_packedBuffer, info.m_dataIsLE);
break;

case CAEStreamInfo::STREAM_TYPE_DTS_2048:
m_dataSize = CAEPackIEC61937::PackDTS_2048(data, size, m_packedBuffer, info.IsLittleEndian());
m_dataSize = CAEPackIEC61937::PackDTS_2048(data, size, m_packedBuffer, info.m_dataIsLE);
break;

default:
/* pack the data into an IEC61937 frame */
CAEPackIEC61937::PackFunc pack = info.GetPackFunc();
CAEPackIEC61937::PackFunc pack = info.m_packFunc;
if (pack)
m_dataSize = pack(data, size, m_packedBuffer);
}
Expand Down Expand Up @@ -158,12 +158,12 @@ void CAEBitstreamPacker::PackDTSHD(CAEStreamInfo &info, uint8_t* data, int size)
m_dtsHD[sizeof(dtshd_start_code) + 1] = ((uint16_t)size & 0x00FF);
memcpy(m_dtsHD + sizeof(dtshd_start_code) + 2, data, size);

m_dataSize = CAEPackIEC61937::PackDTSHD(m_dtsHD, dataSize, m_packedBuffer, info.GetDTSPeriod());
m_dataSize = CAEPackIEC61937::PackDTSHD(m_dtsHD, dataSize, m_packedBuffer, info.m_dtsPeriod);
}

void CAEBitstreamPacker::PackEAC3(CAEStreamInfo &info, uint8_t* data, int size)
{
unsigned int framesPerBurst = info.GetEAC3BlocksDiv();
unsigned int framesPerBurst = info.m_repeat;

if (m_eac3FramesPerBurst != framesPerBurst)
{
Expand Down
8 changes: 4 additions & 4 deletions xbmc/cores/AudioEngine/Utils/AEBitstreamPacker.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ class CAEBitstreamPacker
CAEBitstreamPacker();
~CAEBitstreamPacker();

void Pack(CAEStreamInfo &info, uint8_t* data, int size);
uint8_t* GetBuffer();
void Pack(CAEStreamInfo &info, uint8_t* data, int size);
uint8_t* GetBuffer();
unsigned int GetSize ();

private:
void PackTrueHD(CAEStreamInfo &info, uint8_t* data, int size);
void PackDTSHD (CAEStreamInfo &info, uint8_t* data, int size);
void PackEAC3 (CAEStreamInfo &info, uint8_t* data, int size);
void PackDTSHD(CAEStreamInfo &info, uint8_t* data, int size);
void PackEAC3(CAEStreamInfo &info, uint8_t* data, int size);

/* we keep the trueHD and dtsHD buffers seperate so that we can handle a fast stream switch */
uint8_t *m_trueHD;
Expand Down
Loading

0 comments on commit 3f44006

Please sign in to comment.