aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xbmc/cores/AudioEngine/Utils/AEStreamInfo.cpp37
-rw-r--r--xbmc/cores/AudioEngine/Utils/AEStreamInfo.h1
2 files changed, 31 insertions, 7 deletions
diff --git a/xbmc/cores/AudioEngine/Utils/AEStreamInfo.cpp b/xbmc/cores/AudioEngine/Utils/AEStreamInfo.cpp
index a7b4077655..20c8c57165 100644
--- a/xbmc/cores/AudioEngine/Utils/AEStreamInfo.cpp
+++ b/xbmc/cores/AudioEngine/Utils/AEStreamInfo.cpp
@@ -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,24 +404,32 @@ 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;
- if (m_sampleRate == 48000 || m_sampleRate == 96000 || m_sampleRate == 192000)
- m_outputRate = 192000;
- else
- m_outputRate = 176400;
+ // sampling rate multiplied with number of channels must equal the value
+ // given by the pack function
+ m_outputRate = 192000;
if (m_dataType == STREAM_TYPE_EAC3 && m_hasSync && skip == 0)
return 0;
/* if we get here, we can sync */
m_hasSync = true;
- m_outputChannels = 8;
- m_channelMap = CAEChannelInfo(OutputMaps[1]);
+ m_outputChannels = 2;
+ m_channelMap = CAEChannelInfo(OutputMaps[0]);
m_channels = 8; /* FIXME: this should be read out of the stream */
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;
@@ -417,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;
}
diff --git a/xbmc/cores/AudioEngine/Utils/AEStreamInfo.h b/xbmc/cores/AudioEngine/Utils/AEStreamInfo.h
index 5e8b2f7ccb..f5b94dcf1c 100644
--- a/xbmc/cores/AudioEngine/Utils/AEStreamInfo.h
+++ b/xbmc/cores/AudioEngine/Utils/AEStreamInfo.h
@@ -87,6 +87,7 @@ private:
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 */