diff options
author | v0lt <v0lt@users.sourceforge.net> | 2012-02-24 00:33:50 +0400 |
---|---|---|
committer | v0lt <v0lt@users.sourceforge.net> | 2012-02-24 00:33:50 +0400 |
commit | d2ed638f37946d031a75d75a195ad5b4d42a1382 (patch) | |
tree | 743718e029ee72caeefb709974b32422889b97c1 /src/filters/parser/MP4Splitter/MP4Splitter.cpp | |
parent | 7ad961580ba3c810420953d3246cfb984089aa80 (diff) |
MP4Splitter: optimized PCM audio playback
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@4097 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/parser/MP4Splitter/MP4Splitter.cpp')
-rw-r--r-- | src/filters/parser/MP4Splitter/MP4Splitter.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/filters/parser/MP4Splitter/MP4Splitter.cpp b/src/filters/parser/MP4Splitter/MP4Splitter.cpp index ca123b7a0..7e7b1f17b 100644 --- a/src/filters/parser/MP4Splitter/MP4Splitter.cpp +++ b/src/filters/parser/MP4Splitter/MP4Splitter.cpp @@ -1329,12 +1329,15 @@ bool CMP4SplitterFilter::DemuxLoop() }
//
- if (track->GetType() == AP4_Track::TYPE_AUDIO && (data.GetDataSize() == 1 || data.GetDataSize() == 2)) {
+ if (track->GetType() == AP4_Track::TYPE_AUDIO && data.GetDataSize() >= 1 && data.GetDataSize() <= 16) {
WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
- int nBlockAlign = 1200;
-
- if (wfe->nBlockAlign > 2) {
+ int nBlockAlign;
+ if (wfe->nBlockAlign == 0) {
+ nBlockAlign = 1200;
+ } else if (wfe->nBlockAlign <= 16) { // for PCM (from 8bit mono to 64bit stereo), A-Law, u-Law
+ nBlockAlign = wfe->nBlockAlign * (wfe->nSamplesPerSec >> 4); // 1/16s=62.5ms
+ } else {
nBlockAlign = wfe->nBlockAlign;
pPairNext->m_value.index -= pPairNext->m_value.index % wfe->nBlockAlign;
}
|