Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

AE: handle EAC-3 substreams

  • Loading branch information...
commit 4f296f41d91ac767db3338582fcad1c014a075ad 1 parent 7a18169
Rainer Hochecker FernetMenta authored
26 xbmc/cores/AudioEngine/Utils/AEStreamInfo.cpp
View
@@ -78,6 +78,7 @@ CAEStreamInfo::CAEStreamInfo() :
m_dtsBlocks (0),
m_dtsPeriod (0),
m_fsize (0),
+ m_fsizeMain (0),
m_repeat (0),
m_substreams (0),
m_dataType (STREAM_TYPE_NULL),
@@ -287,6 +288,12 @@ unsigned int CAEStreamInfo::SyncAC3(uint8_t *data, unsigned int size)
{
unsigned int skip = 0;
+ // handle substreams
+ if (m_fsizeMain)
+ {
+ data += m_fsizeMain;
+ }
+
for (; size - skip > 7; ++skip, ++data)
{
/* search for an ac3 sync word */
@@ -335,7 +342,14 @@ unsigned int CAEStreamInfo::SyncAC3(uint8_t *data, unsigned int size)
m_sampleRate = AC3FSCod[fscod];
/* dont do extensive testing if we have not lost sync */
- if (m_dataType == STREAM_TYPE_AC3 && skip == 0)
+ /* this may be the main stream of EAC3 */
+ if (m_dataType == STREAM_TYPE_EAC3 && skip == 0)
+ {
+ m_fsizeMain = m_fsize;
+ m_fsize = 0;
+ return 0;
+ }
+ else if (m_dataType == STREAM_TYPE_AC3 && skip == 0)
return 0;
unsigned int crc_size;
@@ -390,6 +404,14 @@ unsigned int CAEStreamInfo::SyncAC3(uint8_t *data, unsigned int size)
}
m_fsize = framesize << 1;
+
+ // concatenate substream to independent stream
+ if (strmtyp == 1 && m_fsizeMain)
+ {
+ m_fsize += m_fsizeMain;
+ }
+ m_fsizeMain = 0;
+
m_repeat = MAX_EAC3_BLOCKS / blocks;
// sampling rate multiplied with number of channels must equal the value
@@ -407,6 +429,7 @@ unsigned int CAEStreamInfo::SyncAC3(uint8_t *data, unsigned int size)
m_syncFunc = &CAEStreamInfo::SyncAC3;
m_dataType = STREAM_TYPE_EAC3;
m_packFunc = &CAEPackIEC61937::PackEAC3;
+ m_fsizeMain = 0;
CLog::Log(LOGINFO, "CAEStreamInfo::SyncAC3 - E-AC3 stream detected (%d channels, %dHz)", m_channels, m_sampleRate);
return skip;
@@ -416,6 +439,7 @@ unsigned int CAEStreamInfo::SyncAC3(uint8_t *data, unsigned int size)
/* if we get here, the entire packet is invalid and we have lost sync */
CLog::Log(LOGINFO, "CAEStreamInfo::SyncAC3 - AC3 sync lost");
m_hasSync = false;
+ m_fsizeMain = 0;
return skip;
}
1  xbmc/cores/AudioEngine/Utils/AEStreamInfo.h
View
@@ -87,6 +87,7 @@ class CAEStreamInfo
unsigned int m_dtsBlocks;
unsigned int m_dtsPeriod; /* used for dtsHD */
unsigned int m_fsize;
+ unsigned int m_fsizeMain; /* used for EAC3 substreams */
unsigned int m_repeat;
int m_substreams; /* used for TrueHD */
AVCRC m_crcTrueHD[1024]; /* TrueHD crc table */
Please sign in to comment.
Something went wrong with that request. Please try again.