Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksoid <aleksoid@users.sourceforge.net>2010-09-12 15:17:45 +0400
committerAleksoid <aleksoid@users.sourceforge.net>2010-09-12 15:17:45 +0400
commitb0f32c592869890027adb029c1203d4b8c0ceafa (patch)
tree72d4493e3a831d83f9a6451a22ccb3e94f8a7ee2 /src/filters/parser/MP4Splitter
parent5b7e70c988a3698b8adc5b638bf962ad2cc205d3 (diff)
Update code for QT PCM:
cleaned and optimized; added support for 'in24', 'fl64' and 8-bit 'sowt'; small corrections in MP4Splitter. Thanks to V0lt to patch. git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@2531 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/parser/MP4Splitter')
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Core/Ap4Atom.h3
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Core/Ap4AtomFactory.cpp4
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Core/Ap4SampleEntry.cpp32
-rw-r--r--src/filters/parser/MP4Splitter/MP4Splitter.cpp4
4 files changed, 37 insertions, 6 deletions
diff --git a/src/filters/parser/MP4Splitter/AP4/Core/Ap4Atom.h b/src/filters/parser/MP4Splitter/AP4/Core/Ap4Atom.h
index daa6f766b..85cffdaf3 100644
--- a/src/filters/parser/MP4Splitter/AP4/Core/Ap4Atom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Core/Ap4Atom.h
@@ -253,8 +253,10 @@ const AP4_Atom::Type AP4_ATOM_TYPE_QDMC = AP4_ATOM_TYPE('Q','D','M','C');
const AP4_Atom::Type AP4_ATOM_TYPE_QDM2 = AP4_ATOM_TYPE('Q','D','M','2');
const AP4_Atom::Type AP4_ATOM_TYPE_TWOS = AP4_ATOM_TYPE('t','w','o','s');
const AP4_Atom::Type AP4_ATOM_TYPE_SOWT = AP4_ATOM_TYPE('s','o','w','t');
+const AP4_Atom::Type AP4_ATOM_TYPE_IN24 = AP4_ATOM_TYPE('i','n','2','4');
const AP4_Atom::Type AP4_ATOM_TYPE_IN32 = AP4_ATOM_TYPE('i','n','3','2');
const AP4_Atom::Type AP4_ATOM_TYPE_FL32 = AP4_ATOM_TYPE('f','l','3','2');
+const AP4_Atom::Type AP4_ATOM_TYPE_FL64 = AP4_ATOM_TYPE('f','l','6','4');
const AP4_Atom::Type AP4_ATOM_TYPE_CHPL = AP4_ATOM_TYPE('c','h','p','l');
const AP4_Atom::Type AP4_ATOM_TYPE_NAM = AP4_ATOM_TYPE(169,'n','a','m');
const AP4_Atom::Type AP4_ATOM_TYPE_ART = AP4_ATOM_TYPE(169,'A','R','T');
@@ -267,6 +269,7 @@ const AP4_Atom::Type AP4_ATOM_TYPE_GEN = AP4_ATOM_TYPE(169,'g','e','n');
const AP4_Atom::Type AP4_ATOM_TYPE_TRKN = AP4_ATOM_TYPE('t','r','k','n');
const AP4_Atom::Type AP4_ATOM_TYPE_DATA = AP4_ATOM_TYPE('d','a','t','a');
const AP4_Atom::Type AP4_ATOM_TYPE_WAVE = AP4_ATOM_TYPE('w','a','v','e');
+const AP4_Atom::Type AP4_ATOM_TYPE_ENDA = AP4_ATOM_TYPE('e','n','d','a');
const AP4_Atom::Type AP4_ATOM_TYPE_CMOV = AP4_ATOM_TYPE('c','m','o','v');
const AP4_Atom::Type AP4_ATOM_TYPE_DCOM = AP4_ATOM_TYPE('d','c','o','m');
const AP4_Atom::Type AP4_ATOM_TYPE_CMVD = AP4_ATOM_TYPE('c','m','v','d');
diff --git a/src/filters/parser/MP4Splitter/AP4/Core/Ap4AtomFactory.cpp b/src/filters/parser/MP4Splitter/AP4/Core/Ap4AtomFactory.cpp
index 5998b93f5..9b109516f 100644
--- a/src/filters/parser/MP4Splitter/AP4/Core/Ap4AtomFactory.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Core/Ap4AtomFactory.cpp
@@ -407,11 +407,13 @@ AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream,
case AP4_ATOM_TYPE_IMA4:
case AP4_ATOM_TYPE_QDMC:
case AP4_ATOM_TYPE_QDM2:
+ case AP4_ATOM_TYPE_RAW:
case AP4_ATOM_TYPE_TWOS:
case AP4_ATOM_TYPE_SOWT:
+ case AP4_ATOM_TYPE_IN24:
case AP4_ATOM_TYPE_IN32:
case AP4_ATOM_TYPE_FL32:
- case AP4_ATOM_TYPE_RAW:
+ case AP4_ATOM_TYPE_FL64:
case AP4_ATOM_TYPE_ALAW:
case AP4_ATOM_TYPE_ULAW:
atom = DNew AP4_AudioSampleEntry(type, size, stream, *this);
diff --git a/src/filters/parser/MP4Splitter/AP4/Core/Ap4SampleEntry.cpp b/src/filters/parser/MP4Splitter/AP4/Core/Ap4SampleEntry.cpp
index 85d4a88dd..24714df9b 100644
--- a/src/filters/parser/MP4Splitter/AP4/Core/Ap4SampleEntry.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Core/Ap4SampleEntry.cpp
@@ -328,6 +328,36 @@ AP4_AudioSampleEntry::AP4_AudioSampleEntry(AP4_Atom::Type format,
// read fields
ReadFields(stream);
+ /////////////////////////////////////////////////////////////////////////////////////////////////
+ //hack to support the formats using more than 16 bits per sample
+ //in the future will have to be moved to MP4Splitter.cpp
+ if(m_DescriptionVersion == 1 && m_SampleSize == 16){
+ //QuickTime File Format Specification->Sound Sample Description (Version 1)->Bytes per packet
+ m_SampleSize = m_BytesPerPacket * 8;
+ }
+ //
+ //hack to get the correct WAVEFORMATEX in MP4Splitter.cpp
+ //need more information about audio formats used in older movs (QuickTime 2.x).
+ if(m_DescriptionVersion == 0)
+ {
+ switch( format )
+ {
+ case AP4_ATOM_TYPE_RAW:
+ case AP4_ATOM_TYPE_TWOS:
+ case AP4_ATOM_TYPE_SOWT:
+ //m_SamplesPerPacket = 1;
+ //m_BytesPerPacket = m_SampleSize / 8;
+ m_BytesPerFrame = m_ChannelCount * m_SampleSize / 8;
+ break;
+ case AP4_ATOM_TYPE_IMA4:
+ m_BytesPerFrame = m_ChannelCount * 34;
+ break;
+ }
+ //if (m_SampleSize == 8) m_BytesPerSample = 1;
+ //else m_BytesPerSample = 2;
+ }
+ /////////////////////////////////////////////////////////////////////////////////////////////////
+
// must be called after m_DescriptionVersion was already set
AP4_Size fields_size = GetFieldsSize();
@@ -385,8 +415,6 @@ AP4_AudioSampleEntry::ReadFields(AP4_ByteStream& stream)
{
stream.ReadUI32(m_SamplesPerPacket);
stream.ReadUI32(m_BytesPerPacket);
- //QuickTime File Format Specification->Sound Sample Description (Version 1)->Bytes per packet
- if (m_SampleSize == 16) {m_SampleSize = m_BytesPerPacket * 8;}
stream.ReadUI32(m_BytesPerFrame);
stream.ReadUI32(m_BytesPerSample);
}
diff --git a/src/filters/parser/MP4Splitter/MP4Splitter.cpp b/src/filters/parser/MP4Splitter/MP4Splitter.cpp
index 722c7f110..ac543fb29 100644
--- a/src/filters/parser/MP4Splitter/MP4Splitter.cpp
+++ b/src/filters/parser/MP4Splitter/MP4Splitter.cpp
@@ -539,9 +539,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
wfe->nChannels = ase->GetChannelCount();
wfe->wBitsPerSample = ase->GetSampleSize();
wfe->nBlockAlign = ase->GetBytesPerFrame();
- if(wfe->nBlockAlign == 0)
- wfe->nBlockAlign = wfe->wBitsPerSample / 8;
- wfe->nAvgBytesPerSec = wfe->wBitsPerSample * wfe->nSamplesPerSec / 8;
+ wfe->nAvgBytesPerSec = wfe->nSamplesPerSec * wfe->nChannels * wfe->wBitsPerSample / 8;
wfe->cbSize = db.GetDataSize();
memcpy(wfe+1, db.GetData(), db.GetDataSize());
mts.Add(mt);