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:
authorsansnom05 <sansnom05@users.sourceforge.net>2010-12-16 16:53:08 +0300
committersansnom05 <sansnom05@users.sourceforge.net>2010-12-16 16:53:08 +0300
commitf0d88a6ff96770b10031dcc59447cca2c7dbc91c (patch)
treee188e4e733fcf6fc9b00dc349618c19f4d47a7c9 /src/filters/parser
parent5067b0b48d4d15b24669c8032b28e90e45202801 (diff)
legacy branch: merge r2662-r2759
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/branches/legacy@2778 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/parser')
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Core/Ap4AtomFactory.cpp5
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Core/Ap4EndaAtom.cpp24
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Core/Ap4EndaAtom.h33
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Core/Ap4SampleEntry.cpp8
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Core/Ap4SampleEntry.h5
-rw-r--r--src/filters/parser/MP4Splitter/MP4Splitter.cpp33
-rw-r--r--src/filters/parser/MP4Splitter/MP4Splitter.vcproj8
-rw-r--r--src/filters/parser/MP4Splitter/MP4Splitter.vcxproj2
-rw-r--r--src/filters/parser/MP4Splitter/MP4Splitter.vcxproj.filters6
-rw-r--r--src/filters/parser/MpegSplitter/MpegSplitter.cpp12
-rw-r--r--src/filters/parser/MpegSplitter/MpegSplitterFile.cpp2
11 files changed, 117 insertions, 21 deletions
diff --git a/src/filters/parser/MP4Splitter/AP4/Core/Ap4AtomFactory.cpp b/src/filters/parser/MP4Splitter/AP4/Core/Ap4AtomFactory.cpp
index dc14c9cfb..a839a0b99 100644
--- a/src/filters/parser/MP4Splitter/AP4/Core/Ap4AtomFactory.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Core/Ap4AtomFactory.cpp
@@ -69,6 +69,7 @@
#include "Ap4DataAtom.h"
#include "Ap4DcomAtom.h"
#include "Ap4CmvdAtom.h"
+#include "Ap4EndaAtom.h"
/*----------------------------------------------------------------------
| class variables
+---------------------------------------------------------------------*/
@@ -442,6 +443,10 @@ AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream,
atom = DNew AP4_CmvdAtom(size, stream, *this);
break;
+ case AP4_ATOM_TYPE_ENDA:
+ atom = DNew AP4_EndaAtom(size, stream);
+ break;
+
default:
if(parent && parent->GetType() == AP4_ATOM_TYPE_STSD && (type & 0xffff0000) == AP4_ATOM_TYPE('m', 's', 0, 0))
diff --git a/src/filters/parser/MP4Splitter/AP4/Core/Ap4EndaAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Core/Ap4EndaAtom.cpp
new file mode 100644
index 000000000..9566bc4fd
--- /dev/null
+++ b/src/filters/parser/MP4Splitter/AP4/Core/Ap4EndaAtom.cpp
@@ -0,0 +1,24 @@
+/*****************************************************************
+|
+| AP4 - enda Atom
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+
+#include "Ap4EndaAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_EndaAtom::AP4_EndaAtom
++---------------------------------------------------------------------*/
+
+AP4_EndaAtom::AP4_EndaAtom(AP4_Size size,
+ AP4_ByteStream& stream)
+ : AP4_Atom(AP4_ATOM_TYPE_ENDA)
+{
+ size -= AP4_ATOM_HEADER_SIZE;
+
+ stream.ReadUI16(m_LittleEndian);
+}
diff --git a/src/filters/parser/MP4Splitter/AP4/Core/Ap4EndaAtom.h b/src/filters/parser/MP4Splitter/AP4/Core/Ap4EndaAtom.h
new file mode 100644
index 000000000..8f673be5f
--- /dev/null
+++ b/src/filters/parser/MP4Splitter/AP4/Core/Ap4EndaAtom.h
@@ -0,0 +1,33 @@
+/*****************************************************************
+|
+| AP4 - enda Atom
+|
+ ****************************************************************/
+
+#ifndef _AP4_ENDA_ATOM_H_
+#define _AP4_ENDA_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Atom.h"
+#include "Ap4Types.h"
+
+/*----------------------------------------------------------------------
+| AP4_EndaAtom
++---------------------------------------------------------------------*/
+class AP4_EndaAtom : public AP4_Atom
+{
+public:
+ AP4_EndaAtom(AP4_Size size,
+ AP4_ByteStream& stream);
+
+ AP4_Result WriteFields(AP4_ByteStream& stream) { return AP4_FAILURE; }
+
+ AP4_Atom::Type IsLittleEndian() const { return m_LittleEndian; }
+
+private:
+ AP4_UI16 m_LittleEndian;
+};
+
+#endif // _AP4_ENDA_ATOM_H_
diff --git a/src/filters/parser/MP4Splitter/AP4/Core/Ap4SampleEntry.cpp b/src/filters/parser/MP4Splitter/AP4/Core/Ap4SampleEntry.cpp
index 059c8943c..db107ce0e 100644
--- a/src/filters/parser/MP4Splitter/AP4/Core/Ap4SampleEntry.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Core/Ap4SampleEntry.cpp
@@ -35,6 +35,7 @@
#include "Ap4TimsAtom.h"
#include "Ap4SampleDescription.h"
#include "Ap4FtabAtom.h"
+#include "Ap4EndaAtom.h"
/*----------------------------------------------------------------------
| AP4_SampleEntry::AP4_SampleEntry
+---------------------------------------------------------------------*/
@@ -364,6 +365,13 @@ AP4_AudioSampleEntry::AP4_AudioSampleEntry(AP4_Atom::Type format,
// read children atoms (ex: esds and maybe others)
ReadChildren(atom_factory, stream, size-AP4_ATOM_HEADER_SIZE-fields_size);
+
+ // read AP4_ATOM_TYPE_ENDA
+ m_LittleEndian = 0xffff;
+ if(AP4_Atom* child = GetChild(AP4_ATOM_TYPE_WAVE))
+ if(AP4_ContainerAtom* wave = dynamic_cast<AP4_ContainerAtom*>(child))
+ if (AP4_EndaAtom* endian = dynamic_cast<AP4_EndaAtom*>(wave->GetChild(AP4_ATOM_TYPE_ENDA)))
+ m_LittleEndian = endian->IsLittleEndian();
}
/*----------------------------------------------------------------------
diff --git a/src/filters/parser/MP4Splitter/AP4/Core/Ap4SampleEntry.h b/src/filters/parser/MP4Splitter/AP4/Core/Ap4SampleEntry.h
index 7220cfd58..cadbe84b3 100644
--- a/src/filters/parser/MP4Splitter/AP4/Core/Ap4SampleEntry.h
+++ b/src/filters/parser/MP4Splitter/AP4/Core/Ap4SampleEntry.h
@@ -143,6 +143,7 @@ class AP4_AudioSampleEntry : public AP4_MpegSampleEntry
AP4_UI32 GetBytesPerPacket(){ return m_BytesPerPacket; }
AP4_UI32 GetBytesPerFrame(){ return m_BytesPerFrame; }
AP4_UI32 GetBytesPerSample(){ return m_BytesPerSample; }
+ AP4_UI16 IsLittleEndian() { return m_LittleEndian; }
// methods
AP4_SampleDescription* ToSampleDescription();
@@ -167,7 +168,9 @@ protected:
AP4_UI32 m_SamplesPerPacket;
AP4_UI32 m_BytesPerPacket;
AP4_UI32 m_BytesPerFrame;
- AP4_UI32 m_BytesPerSample;
+ AP4_UI32 m_BytesPerSample;
+ // from 'enda' atom
+ AP4_UI16 m_LittleEndian;
};
/*----------------------------------------------------------------------
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);
}
}
}
diff --git a/src/filters/parser/MP4Splitter/MP4Splitter.vcproj b/src/filters/parser/MP4Splitter/MP4Splitter.vcproj
index 46fa73968..16f592b50 100644
--- a/src/filters/parser/MP4Splitter/MP4Splitter.vcproj
+++ b/src/filters/parser/MP4Splitter/MP4Splitter.vcproj
@@ -926,6 +926,14 @@
>
</File>
<File
+ RelativePath=".\AP4\Core\Ap4EndaAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Core\Ap4EndaAtom.h"
+ >
+ </File>
+ <File
RelativePath=".\AP4\Core\Ap4EsDescriptor.cpp"
>
</File>
diff --git a/src/filters/parser/MP4Splitter/MP4Splitter.vcxproj b/src/filters/parser/MP4Splitter/MP4Splitter.vcxproj
index 6cfb1d5cd..af3392fed 100644
--- a/src/filters/parser/MP4Splitter/MP4Splitter.vcxproj
+++ b/src/filters/parser/MP4Splitter/MP4Splitter.vcxproj
@@ -292,6 +292,7 @@
<ClCompile Include="AP4\Core\Ap4Descriptor.cpp" />
<ClCompile Include="AP4\Core\Ap4DescriptorFactory.cpp" />
<ClCompile Include="AP4\Core\Ap4DrefAtom.cpp" />
+ <ClCompile Include="AP4\Core\Ap4EndaAtom.cpp" />
<ClCompile Include="AP4\Core\Ap4EsDescriptor.cpp" />
<ClCompile Include="AP4\Core\Ap4EsdsAtom.cpp" />
<ClCompile Include="AP4\Core\Ap4File.cpp" />
@@ -382,6 +383,7 @@
<ClInclude Include="AP4\Core\Ap4Descriptor.h" />
<ClInclude Include="AP4\Core\Ap4DescriptorFactory.h" />
<ClInclude Include="AP4\Core\Ap4DrefAtom.h" />
+ <ClInclude Include="AP4\Core\Ap4EndaAtom.h" />
<ClInclude Include="AP4\Core\Ap4EsDescriptor.h" />
<ClInclude Include="AP4\Core\Ap4EsdsAtom.h" />
<ClInclude Include="AP4\Core\Ap4File.h" />
diff --git a/src/filters/parser/MP4Splitter/MP4Splitter.vcxproj.filters b/src/filters/parser/MP4Splitter/MP4Splitter.vcxproj.filters
index 25ee724a2..11a34b5d9 100644
--- a/src/filters/parser/MP4Splitter/MP4Splitter.vcxproj.filters
+++ b/src/filters/parser/MP4Splitter/MP4Splitter.vcxproj.filters
@@ -99,6 +99,9 @@
<ClCompile Include="AP4\Core\Ap4DrefAtom.cpp">
<Filter>AP4\Core</Filter>
</ClCompile>
+ <ClCompile Include="AP4\Core\Ap4EndaAtom.cpp">
+ <Filter>AP4\Core</Filter>
+ </ClCompile>
<ClCompile Include="AP4\Core\Ap4EsDescriptor.cpp">
<Filter>AP4\Core</Filter>
</ClCompile>
@@ -323,6 +326,9 @@
<ClInclude Include="AP4\Core\Ap4DrefAtom.h">
<Filter>AP4\Core</Filter>
</ClInclude>
+ <ClInclude Include="AP4\Core\Ap4EndaAtom.h">
+ <Filter>AP4\Core</Filter>
+ </ClInclude>
<ClInclude Include="AP4\Core\Ap4EsDescriptor.h">
<Filter>AP4\Core</Filter>
</ClInclude>
diff --git a/src/filters/parser/MpegSplitter/MpegSplitter.cpp b/src/filters/parser/MpegSplitter/MpegSplitter.cpp
index 955e5ddb1..879a773de 100644
--- a/src/filters/parser/MpegSplitter/MpegSplitter.cpp
+++ b/src/filters/parser/MpegSplitter/MpegSplitter.cpp
@@ -190,9 +190,9 @@ CString GetMediaTypeDesc(const CMediaType *_pMediaType, const CHdmvClipInfo::Str
WCHAR Temp[5];
memset(Temp, 0, sizeof(Temp));
Temp[0] = (pInfo->hdr.bmiHeader.biCompression >> 0) & 0xFF;
- Temp[1] = (pInfo->hdr.bmiHeader.biCompression >> 0) & 0xFF;
- Temp[2] = (pInfo->hdr.bmiHeader.biCompression >> 0) & 0xFF;
- Temp[3] = (pInfo->hdr.bmiHeader.biCompression >> 0) & 0xFF;
+ Temp[1] = (pInfo->hdr.bmiHeader.biCompression >> 8) & 0xFF;
+ Temp[2] = (pInfo->hdr.bmiHeader.biCompression >> 16) & 0xFF;
+ Temp[3] = (pInfo->hdr.bmiHeader.biCompression >> 24) & 0xFF;
Infos.AddTail(Temp);
}
@@ -263,9 +263,9 @@ CString GetMediaTypeDesc(const CMediaType *_pMediaType, const CHdmvClipInfo::Str
WCHAR Temp[5];
memset(Temp, 0, sizeof(Temp));
Temp[0] = (CodecType >> 0) & 0xFF;
- Temp[1] = (CodecType >> 0) & 0xFF;
- Temp[2] = (CodecType >> 0) & 0xFF;
- Temp[3] = (CodecType >> 0) & 0xFF;
+ Temp[1] = (CodecType >> 8) & 0xFF;
+ Temp[2] = (CodecType >> 16) & 0xFF;
+ Temp[3] = (CodecType >> 24) & 0xFF;
Infos.AddTail(Temp);
}
}
diff --git a/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp b/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp
index 61f1be041..5200baec4 100644
--- a/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp
+++ b/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp
@@ -161,7 +161,7 @@ HRESULT CMpegSplitterFile::Init()
else
{
// Add fake stream for "No subtitle"
- AddHdmvPGStream (NO_SUBTITLE_PID, "---");
+ //AddHdmvPGStream (NO_SUBTITLE_PID, "---");
}
}