diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-10-14 02:01:56 +0400 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-10-14 02:01:56 +0400 |
commit | 9e0fc237abf4bb4ebca9212f93e1fed1f5919881 (patch) | |
tree | 992a0dd12984ed7d3bbc5d4a429c2fc6e0cbc956 /src/filters/parser/MP4Splitter/MP4Splitter.cpp | |
parent | 76944d559efee2ff95a636c9a0939bfa1cec43e3 (diff) |
Added support for "in24", "in32", "fl32", "fl64" both big-endian and little-endian) in .mov files
Patch by v0lt
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@2686 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/parser/MP4Splitter/MP4Splitter.cpp')
-rw-r--r-- | src/filters/parser/MP4Splitter/MP4Splitter.cpp | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/src/filters/parser/MP4Splitter/MP4Splitter.cpp b/src/filters/parser/MP4Splitter/MP4Splitter.cpp index ac543fb29..b395e590a 100644 --- a/src/filters/parser/MP4Splitter/MP4Splitter.cpp +++ b/src/filters/parser/MP4Splitter/MP4Splitter.cpp @@ -466,22 +466,23 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) AP4_Atom* atom = item->GetData();
AP4_Atom::Type type = atom->GetType();
+ DWORD fourcc;
if((type & 0xffff0000) == AP4_ATOM_TYPE('m', 's', 0, 0))
{
- type &= 0xffff;
+ fourcc = type & 0xffff;
}
else if(type == AP4_ATOM_TYPE__MP3)
{
- type = 0x0055;
+ fourcc = 0x0055;
}
else if((type == AP4_ATOM_TYPE__AC3) || (type == AP4_ATOM_TYPE_SAC3))
{
- type = 0x2000;
+ fourcc = 0x2000;
}
else
{
- type =
+ fourcc =
((type >> 24) & 0x000000ff) |
((type >> 8) & 0x0000ff00) |
((type << 8) & 0x00ff0000) |
@@ -491,26 +492,26 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) if(AP4_VisualSampleEntry* vse = dynamic_cast<AP4_VisualSampleEntry*>(atom))
{
mt.majortype = MEDIATYPE_Video;
- mt.subtype = FOURCCMap(type);
+ mt.subtype = FOURCCMap(fourcc);
mt.formattype = FORMAT_VideoInfo;
vih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER)+db.GetDataSize());
memset(vih, 0, mt.FormatLength());
vih->bmiHeader.biSize = sizeof(vih->bmiHeader);
vih->bmiHeader.biWidth = (LONG)vse->GetWidth();
vih->bmiHeader.biHeight = (LONG)vse->GetHeight();
- vih->bmiHeader.biCompression = type;
- vih->bmiHeader.biBitCount = (LONG)vse->GetDepth();
+ vih->bmiHeader.biCompression = fourcc;
+ vih->bmiHeader.biBitCount = (LONG)vse->GetDepth();
memcpy(vih+1, db.GetData(), db.GetDataSize());
mts.Add(mt);
char buff[5];
- memcpy(buff, &type, 4);
+ memcpy(buff, &fourcc, 4);
buff[4] = 0;
strlwr((char*)&buff);
AP4_Atom::Type typelwr = *(AP4_Atom::Type*)buff;
- if(typelwr != type)
+ if(typelwr != fourcc)
{
mt.subtype = FOURCCMap(vih->bmiHeader.biCompression = typelwr);
mts.Add(mt);
@@ -519,7 +520,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) strupr((char*)&buff);
AP4_Atom::Type typeupr = *(AP4_Atom::Type*)buff;
- if(typeupr != type)
+ if(typeupr != fourcc)
{
mt.subtype = FOURCCMap(vih->bmiHeader.biCompression = typeupr);
mts.Add(mt);
@@ -529,12 +530,18 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) }
else if(AP4_AudioSampleEntry* ase = dynamic_cast<AP4_AudioSampleEntry*>(atom))
{
+ if (ase->IsLittleEndian()==1)
+ {
+ if (type==AP4_ATOM_TYPE_IN24 || type==AP4_ATOM_TYPE_IN32 ||
+ type==AP4_ATOM_TYPE_FL32 || type==AP4_ATOM_TYPE_FL64)
+ fourcc = type; //reverse fourcc
+ }
mt.majortype = MEDIATYPE_Audio;
- mt.subtype = FOURCCMap(type);
+ mt.subtype = FOURCCMap(fourcc);
mt.formattype = FORMAT_WaveFormatEx;
wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(sizeof(WAVEFORMATEX) + db.GetDataSize());
memset(wfe, 0, mt.FormatLength());
- if(!(type & 0xffff0000)) wfe->wFormatTag = (WORD)type;
+ if(!(fourcc & 0xffff0000)) wfe->wFormatTag = (WORD)fourcc;
wfe->nSamplesPerSec = ase->GetSampleRate();
wfe->nChannels = ase->GetChannelCount();
wfe->wBitsPerSample = ase->GetSampleSize();
@@ -545,7 +552,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) mts.Add(mt);
break;
}else{
- TRACE(_T("Unknow MP4 Steam %x") , type);
+ TRACE(_T("Unknow MP4 Steam %x") , fourcc);
}
}
}
|