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:
authorpovaddict <povaddict@users.sourceforge.net>2010-02-10 02:16:44 +0300
committerpovaddict <povaddict@users.sourceforge.net>2010-02-10 02:16:44 +0300
commit726a91b12a7524e45e7a901c9e4883af5b1bffe6 (patch)
treef5d25e3b2e84c92f4901280c73d5d3d7e6c3cd19 /src/filters/parser/matroskasplitter
parent02183f6e47ad4ea1057de9950482f291f2ae4290 (diff)
Rename several directories to use MixedCase instead of lowercase.
They now mostly match the case used in #includes, and they're consistent with the names of the .h files they contain. git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1648 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/parser/matroskasplitter')
-rw-r--r--src/filters/parser/matroskasplitter/MatroskaFile.cpp1198
-rw-r--r--src/filters/parser/matroskasplitter/MatroskaFile.h475
-rw-r--r--src/filters/parser/matroskasplitter/MatroskaSplitter.cpp1386
-rw-r--r--src/filters/parser/matroskasplitter/MatroskaSplitter.def7
-rw-r--r--src/filters/parser/matroskasplitter/MatroskaSplitter.h121
-rw-r--r--src/filters/parser/matroskasplitter/MatroskaSplitter.rc105
-rw-r--r--src/filters/parser/matroskasplitter/MatroskaSplitter.vcproj747
-rw-r--r--src/filters/parser/matroskasplitter/resource.h14
-rw-r--r--src/filters/parser/matroskasplitter/stdafx.cpp29
-rw-r--r--src/filters/parser/matroskasplitter/stdafx.h45
10 files changed, 0 insertions, 4127 deletions
diff --git a/src/filters/parser/matroskasplitter/MatroskaFile.cpp b/src/filters/parser/matroskasplitter/MatroskaFile.cpp
deleted file mode 100644
index 141a232ab..000000000
--- a/src/filters/parser/matroskasplitter/MatroskaFile.cpp
+++ /dev/null
@@ -1,1198 +0,0 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "stdafx.h"
-#include "MatroskaFile.h"
-#include "../../../DSUtil/DSUtil.h"
-#include "../../../zlib/zlib.h"
-
-#define DOCTYPE _T("matroska")
-#define DOCTYPEVERSION 2
-
-static void LOG(LPCTSTR fmt, ...)
-{
- va_list args;
- va_start(args, fmt);
- if(FILE* f = _tfopen(_T("c:\\matroskasplitterlog.txt"), _T("at")))
- {
- fseek(f, 0, 2);
- _vftprintf(f, fmt, args);
- fclose(f);
- }
- va_end(args);
-}
-
-using namespace MatroskaReader;
-
-#define BeginChunk \
- CheckPointer(pMN0, E_POINTER); \
-\
- CAutoPtr<CMatroskaNode> pMN = pMN0->Child(); \
- if(!pMN) return S_FALSE; \
-\
- do \
- { \
- switch(pMN->m_id) \
- { \
-
-#define EndChunk \
- } \
- } \
- while(pMN->Next()); \
-\
- return S_OK; \
-
-static void bswap(BYTE* s, int len)
-{
- for(BYTE* d = s + len-1; s < d; s++, d--)
- *s ^= *d, *d ^= *s, *s ^= *d;
-}
-
-//
-// CMatroskaFile
-//
-
-CMatroskaFile::CMatroskaFile(IAsyncReader* pAsyncReader, HRESULT& hr)
- : CBaseSplitterFile(pAsyncReader, hr, DEFAULT_CACHE_LENGTH, false)
- , m_rtOffset(0)
-{
- if(FAILED(hr)) return;
- hr = Init();
-}
-
-HRESULT CMatroskaFile::Init()
-{
- DWORD dw;
- if(FAILED(Read(dw)) || dw != 0x1A45DFA3)
- return E_FAIL;
-
- CMatroskaNode Root(this);
- if(FAILED(Parse(&Root)))
- return E_FAIL;
-
- CAutoPtr<CMatroskaNode> pSegment, pCluster;
- if((pSegment = Root.Child(0x18538067))
- && (pCluster = pSegment->Child(0x1F43B675)))
- {
- Cluster c0;
- c0.ParseTimeCode(pCluster);
- m_rtOffset = m_segment.GetRefTime(c0.TimeCode);
- }
-
- return S_OK;
-}
-
-template <class T>
-HRESULT CMatroskaFile::Read(T& var)
-{
- HRESULT hr = ByteRead((BYTE*)&var, sizeof(var));
- if(S_OK == hr) bswap((BYTE*)&var, sizeof(var));
- return hr;
-}
-
-HRESULT CMatroskaFile::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0x1A45DFA3:
- m_ebml.Parse(pMN);
- if(m_ebml.DocType != DOCTYPE || m_ebml.DocTypeReadVersion > DOCTYPEVERSION)
- return E_FAIL;
- break;
- case 0x18538067: if(m_segment.SegmentInfo.SegmentUID.IsEmpty()) m_segment.ParseMinimal(pMN); break;
- EndChunk
-}
-
-//
-
-HRESULT EBML::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0x4286: EBMLVersion.Parse(pMN); break;
- case 0x42F7: EBMLReadVersion.Parse(pMN); break;
- case 0x42F2: EBMLMaxIDLength.Parse(pMN); break;
- case 0x42F3: EBMLMaxSizeLength.Parse(pMN); break;
- case 0x4282: DocType.Parse(pMN); break;
- case 0x4287: DocTypeVersion.Parse(pMN); break;
- case 0x4285: DocTypeReadVersion.Parse(pMN); break;
- EndChunk
-}
-
-HRESULT Segment::Parse(CMatroskaNode* pMN0)
-{
- pos = pMN0->GetPos();
-
- BeginChunk
- case 0x1549A966: SegmentInfo.Parse(pMN); break;
- case 0x114D9B74: MetaSeekInfo.Parse(pMN); break;
- case 0x1654AE6B: Tracks.Parse(pMN); break;
- case 0x1F43B675: Clusters.Parse(pMN); break;
- case 0x1C53BB6B: Cues.Parse(pMN); break;
- case 0x1941A469: Attachments.Parse(pMN); break;
- case 0x1043A770: Chapters.Parse(pMN); break;
-// case 0x1254C367: Tags.Parse(pMN); break;
- EndChunk
-}
-
-HRESULT Segment::ParseMinimal(CMatroskaNode* pMN0)
-{
- CheckPointer(pMN0, E_POINTER);
-
- pos = pMN0->GetPos();
- len = pMN0->m_len;
-
- CAutoPtr<CMatroskaNode> pMN = pMN0->Child();
- if(!pMN) return S_FALSE;
-
- int n = 0;
-
- do
- {
- switch(pMN->m_id)
- {
- case 0x1549A966: SegmentInfo.Parse(pMN); n++; break;
- case 0x114D9B74: MetaSeekInfo.Parse(pMN); n++; break;
- case 0x1654AE6B: Tracks.Parse(pMN); n++; break;
- case 0x1C53BB6B: Cues.Parse(pMN); break;
- }
- }
- while(n < 3 && pMN->Next());
-
- if(!pMN->IsRandomAccess())
- {
- return S_OK;
- }
-
- while(MatroskaReader::QWORD pos = pMN->FindPos(0x114D9B74, pMN->GetPos()))
- {
- pMN->SeekTo(pos);
- pMN->Parse();
- if(pMN->m_id != 0x114D9B74) {ASSERT(0); break;}
- MetaSeekInfo.Parse(pMN);
- }
-
- if(n == 3)
- {
- if(Cues.IsEmpty() && (pMN = pMN0->Child(0x1C53BB6B, false)))
- {
- do {Cues.Parse(pMN);} while(pMN->Next(true));
- }
-
- if(Chapters.IsEmpty() && (pMN = pMN0->Child(0x1043A770, false)))
- {
- do {Chapters.Parse(pMN); /*BIG UGLY HACK:*/ break;} while(pMN->Next(true));
- }
-
- if(Attachments.IsEmpty() && (pMN = pMN0->Child(0x1941A469, false)))
- {
- do {Attachments.Parse(pMN); /*BIG UGLY HACK:*/ break;} while (pMN->Next(true));
- }
- }
-
- return S_OK;
-}
-
-UINT64 Segment::GetMasterTrack()
-{
- UINT64 TrackNumber = 0, AltTrackNumber = 0;
-
- POSITION pos1 = Tracks.GetHeadPosition();
- while(pos1 && TrackNumber == 0)
- {
- Track* pT = Tracks.GetNext(pos1);
-
- POSITION pos2 = pT->TrackEntries.GetHeadPosition();
- while(pos2 && TrackNumber == 0)
- {
- TrackEntry* pTE = pT->TrackEntries.GetNext(pos2);
-
- if(pTE->TrackType == TrackEntry::TypeVideo)
- {
- TrackNumber = pTE->TrackNumber;
- break;
- }
- else if(pTE->TrackType == TrackEntry::TypeAudio && AltTrackNumber == 0)
- {
- AltTrackNumber = pTE->TrackNumber;
- }
- }
- }
-
- if(TrackNumber == 0) TrackNumber = AltTrackNumber;
- if(TrackNumber == 0) TrackNumber = 1;
-
- return TrackNumber;
-}
-
-ChapterAtom* ChapterAtom::FindChapterAtom(UINT64 id)
-{
- if(ChapterUID == id)
- return(this);
-
- POSITION pos = ChapterAtoms.GetHeadPosition();
- while(pos)
- {
- ChapterAtom* ca = ChapterAtoms.GetNext(pos)->FindChapterAtom(id);
- if(ca) return ca;
- }
-
- return(NULL);
-}
-
-ChapterAtom* Segment::FindChapterAtom(UINT64 id, int nEditionEntry)
-{
- POSITION pos1 = Chapters.GetHeadPosition();
- while(pos1)
- {
- Chapter* c = Chapters.GetNext(pos1);
-
- POSITION pos2 = c->EditionEntries.GetHeadPosition();
- while(pos2)
- {
- EditionEntry* ee = c->EditionEntries.GetNext(pos2);
-
- if(nEditionEntry-- == 0)
- {
- return id == 0 ? ee : ee->FindChapterAtom(id);
- }
- }
- }
-
- return(NULL);
-}
-
-HRESULT Info::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0x73A4: SegmentUID.Parse(pMN); break;
- case 0x7384: SegmentFilename.Parse(pMN); break;
- case 0x3CB923: PrevUID.Parse(pMN); break;
- case 0x3C83AB: PrevFilename.Parse(pMN); break;
- case 0x3EB923: NextUID.Parse(pMN); break;
- case 0x3E83BB: NextFilename.Parse(pMN); break;
- case 0x2AD7B1: TimeCodeScale.Parse(pMN); break;
- case 0x4489: Duration.Parse(pMN); break;
- case 0x4461: DateUTC.Parse(pMN); break;
- case 0x7BA9: Title.Parse(pMN); break;
- case 0x4D80: MuxingApp.Parse(pMN); break;
- case 0x5741: WritingApp.Parse(pMN); break;
- EndChunk
-}
-
-HRESULT Seek::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0x4DBB: SeekHeads.Parse(pMN); break;
- EndChunk
-}
-
-HRESULT SeekHead::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0x53AB: SeekID.Parse(pMN); break;
- case 0x53AC: SeekPosition.Parse(pMN); break;
- EndChunk
-}
-
-HRESULT Track::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0xAE: TrackEntries.Parse(pMN); break;
- EndChunk
-}
-
-HRESULT TrackEntry::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0xD7: TrackNumber.Parse(pMN); break;
- case 0x73C5: TrackUID.Parse(pMN); break;
- case 0x83: TrackType.Parse(pMN); break;
- case 0xB9: FlagEnabled.Parse(pMN); break;
- case 0x88: FlagDefault.Parse(pMN); break;
- case 0x9C: FlagLacing.Parse(pMN); break;
- case 0x6DE7: MinCache.Parse(pMN); break;
- case 0x6DF8: MaxCache.Parse(pMN); break;
- case 0x536E: Name.Parse(pMN); break;
- case 0x22B59C: Language.Parse(pMN); break;
- case 0x86: CodecID.Parse(pMN); break;
- case 0x63A2: CodecPrivate.Parse(pMN); break;
- case 0x258688: CodecName.Parse(pMN); break;
- case 0x3A9697: CodecSettings.Parse(pMN); break;
- case 0x3B4040: CodecInfoURL.Parse(pMN); break;
- case 0x26B240: CodecDownloadURL.Parse(pMN); break;
- case 0xAA: CodecDecodeAll.Parse(pMN); break;
- case 0x6FAB: TrackOverlay.Parse(pMN); break;
- case 0x23E383: case 0x2383E3: DefaultDuration.Parse(pMN); break;
- case 0x23314F: TrackTimecodeScale.Parse(pMN); break;
- case 0xE0: if(S_OK == v.Parse(pMN)) DescType |= DescVideo; break;
- case 0xE1: if(S_OK == a.Parse(pMN)) DescType |= DescAudio; break;
- case 0x6D80: ces.Parse(pMN); break;
- EndChunk
-}
-
-static int cesort(const void* a, const void* b)
-{
- UINT64 ce1 = ((ContentEncoding*)a)->ContentEncodingOrder;
- UINT64 ce2 = ((ContentEncoding*)b)->ContentEncodingOrder;
-
- return (int)ce1 - (int)ce2;
-}
-
-bool TrackEntry::Expand(CBinary& data, UINT64 Scope)
-{
- if(ces.ce.GetCount() == 0) return(true);
-
- CAtlArray<ContentEncoding*> cearray;
- POSITION pos = ces.ce.GetHeadPosition();
- while(pos) cearray.Add(ces.ce.GetNext(pos));
- qsort(cearray.GetData(), cearray.GetCount(), sizeof(ContentEncoding*), cesort);
-
- for(int i = cearray.GetCount()-1; i >= 0; i--)
- {
- ContentEncoding* ce = cearray[i];
-
- if(!(ce->ContentEncodingScope & Scope))
- continue;
-
- if(ce->ContentEncodingType == ContentEncoding::Compression)
- {
- if(!data.Decompress(ce->cc))
- return(false);
- }
- else if(ce->ContentEncodingType == ContentEncoding::Encryption)
- {
- // TODO
- return(false);
- }
- }
-
- return(true);
-}
-
-HRESULT Video::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0x9A: FlagInterlaced.Parse(pMN); break;
- case 0x53B8: StereoMode.Parse(pMN); break;
- case 0xB0: PixelWidth.Parse(pMN); break;
- case 0xBA: PixelHeight.Parse(pMN); break;
- case 0x54B0: DisplayWidth.Parse(pMN); break;
- case 0x54BA: DisplayHeight.Parse(pMN); break;
- case 0x54B2: DisplayUnit.Parse(pMN); break;
- case 0x54B3: AspectRatioType.Parse(pMN); break;
- case 0x2EB524: ColourSpace.Parse(pMN); break;
- case 0x2FB523: GammaValue.Parse(pMN); break;
- case 0x2383E3: FramePerSec.Parse(pMN); break;
- EndChunk
-}
-
-HRESULT Audio::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0xB5: SamplingFrequency.Parse(pMN); break;
- case 0x78B5: OutputSamplingFrequency.Parse(pMN); break;
- case 0x9F: Channels.Parse(pMN); break;
- case 0x7D7B: ChannelPositions.Parse(pMN); break;
- case 0x6264: BitDepth.Parse(pMN); break;
- EndChunk
-}
-
-HRESULT ContentEncodings::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0x6240: ce.Parse(pMN); break;
- EndChunk
-}
-
-HRESULT ContentEncoding::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0x5031: ContentEncodingOrder.Parse(pMN); break;
- case 0x5032: ContentEncodingScope.Parse(pMN); break;
- case 0x5033: ContentEncodingType.Parse(pMN); break;
- case 0x5034: cc.Parse(pMN); break;
- case 0x5035: ce.Parse(pMN); break;
- EndChunk
-}
-
-HRESULT ContentCompression::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0x4254: ContentCompAlgo.Parse(pMN); break;
- case 0x4255: ContentCompSettings.Parse(pMN); break;
- EndChunk
-}
-
-HRESULT ContentEncryption::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0x47e1: ContentEncAlgo.Parse(pMN); break;
- case 0x47e2: ContentEncKeyID.Parse(pMN); break;
- case 0x47e3: ContentSignature.Parse(pMN); break;
- case 0x47e4: ContentSigKeyID.Parse(pMN); break;
- case 0x47e5: ContentSigAlgo.Parse(pMN); break;
- case 0x47e6: ContentSigHashAlgo.Parse(pMN); break;
- EndChunk
-}
-
-HRESULT Cluster::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0xE7: TimeCode.Parse(pMN); break;
- case 0xA7: Position.Parse(pMN); break;
- case 0xAB: PrevSize.Parse(pMN); break;
- case 0xA0: BlockGroups.Parse(pMN, true); break;
- case 0xA3: SimpleBlocks.Parse(pMN, true); break;
- EndChunk
-}
-
-HRESULT Cluster::ParseTimeCode(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0xE7: TimeCode.Parse(pMN); return S_OK;
- EndChunk
-}
-
-HRESULT BlockGroup::Parse(CMatroskaNode* pMN0, bool fFull)
-{
- BeginChunk
- case 0xA1: Block.Parse(pMN, fFull); break;
- case 0xA2: /* TODO: multiple virt blocks? */; break;
- case 0x9B: BlockDuration.Parse(pMN); break;
- case 0xFA: ReferencePriority.Parse(pMN); break;
- case 0xFB: ReferenceBlock.Parse(pMN); break;
- case 0xFD: ReferenceVirtual.Parse(pMN); break;
- case 0xA4: CodecState.Parse(pMN); break;
- case 0xE8: TimeSlices.Parse(pMN); break;
- case 0x75A1: if(fFull) ba.Parse(pMN); break;
- EndChunk
-}
-
-HRESULT SimpleBlock::Parse(CMatroskaNode* pMN, bool fFull)
-{
- pMN->SeekTo(pMN->m_start);
-
- TrackNumber.Parse(pMN);
- CShort s; s.Parse(pMN); TimeCode.Set(s);
- Lacing.Parse(pMN);
-
- if(!fFull) return S_OK;
-
- CAtlList<MatroskaReader::QWORD> lens;
- MatroskaReader::QWORD tlen = 0;
- MatroskaReader::QWORD FrameSize;
- BYTE FramesInLaceLessOne;
-
- switch((Lacing & 0x06) >> 1)
- {
- case 0:
- // No lacing
- lens.AddTail((pMN->m_start+pMN->m_len) - (pMN->GetPos()+tlen));
- break;
- case 1:
- // Xiph lacing
- BYTE n;
- pMN->Read(n);
- while(n-- > 0)
- {
- BYTE b;
- MatroskaReader::QWORD len = 0;
- do {pMN->Read(b); len += b;} while(b == 0xff);
- lens.AddTail(len);
- tlen += len;
- }
- lens.AddTail((pMN->m_start+pMN->m_len) - (pMN->GetPos()+tlen));
- break;
- case 2:
- // Fixed-size lacing
- pMN->Read(FramesInLaceLessOne);
- FramesInLaceLessOne++;
- FrameSize = ((pMN->m_start+pMN->m_len) - (pMN->GetPos()+tlen)) / FramesInLaceLessOne;
- while(FramesInLaceLessOne-- > 0)
- lens.AddTail(FrameSize);
- break;
- case 3:
- // EBML lacing
- pMN->Read(FramesInLaceLessOne);
-
- CLength FirstFrameSize;
- FirstFrameSize.Parse(pMN);
- lens.AddTail(FirstFrameSize);
- FramesInLaceLessOne--;
- tlen = FirstFrameSize;
-
- CSignedLength DiffSize;
- FrameSize = FirstFrameSize;
- while(FramesInLaceLessOne--)
- {
- DiffSize.Parse(pMN);
- FrameSize += DiffSize;
- lens.AddTail(FrameSize);
- tlen += FrameSize;
- }
- lens.AddTail((pMN->m_start+pMN->m_len) - (pMN->GetPos()+tlen));
- break;
- }
-
- POSITION pos = lens.GetHeadPosition();
- while(pos)
- {
- MatroskaReader::QWORD len = lens.GetNext(pos);
- CAutoPtr<CBinary> p(DNew CBinary());
- p->SetCount((INT_PTR)len);
- pMN->Read(p->GetData(), len);
- BlockData.AddTail(p);
- }
-
- return S_OK;
-}
-
-HRESULT BlockAdditions::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0xA6: bm.Parse(pMN); break;
- EndChunk
-}
-
-HRESULT BlockMore::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0xEE: BlockAddID.Parse(pMN); break;
- case 0xA5: BlockAdditional.Parse(pMN); break;
- EndChunk
-}
-
-HRESULT TimeSlice::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0xCC: LaceNumber.Parse(pMN); break;
- case 0xCD: FrameNumber.Parse(pMN); break;
- case 0xCE: Delay.Parse(pMN); break;
- case 0xCF: Duration.Parse(pMN); break;
- EndChunk
-}
-
-HRESULT Cue::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0xBB: CuePoints.Parse(pMN); break;
- EndChunk
-}
-
-HRESULT CuePoint::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0xB3: CueTime.Parse(pMN); break;
- case 0xB7: CueTrackPositions.Parse(pMN); break;
- EndChunk
-}
-
-HRESULT CueTrackPosition::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0xF7: CueTrack.Parse(pMN); break;
- case 0xF1: CueClusterPosition.Parse(pMN); break;
- case 0x5387: CueBlockNumber.Parse(pMN); break;
- case 0xEA: CueCodecState.Parse(pMN); break;
- case 0xDB: CueReferences.Parse(pMN); break;
- EndChunk
-}
-
-HRESULT CueReference::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0x96: CueRefTime.Parse(pMN); break;
- case 0x97: CueRefCluster.Parse(pMN); break;
- case 0x535F: CueRefNumber.Parse(pMN); break;
- case 0xEB: CueRefCodecState.Parse(pMN); break;
- EndChunk
-}
-
-HRESULT Attachment::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0x61A7: AttachedFiles.Parse(pMN); break;
- EndChunk
-}
-
-HRESULT AttachedFile::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0x467E: FileDescription.Parse(pMN); break;
- case 0x466E: FileName.Parse(pMN); break;
- case 0x4660: FileMimeType.Parse(pMN); break;
- case 0x465C: // binary
- FileDataLen = (INT_PTR)pMN->m_len;
- FileDataPos = pMN->m_start;
- break;
- case 0x46AE: FileUID.Parse(pMN); break;
- EndChunk
-}
-
-HRESULT Chapter::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0x45B9: EditionEntries.Parse(pMN); break;
- EndChunk
-}
-
-HRESULT EditionEntry::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0xB6: ChapterAtoms.Parse(pMN); break;
- EndChunk
-}
-
-HRESULT ChapterAtom::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0x73C4: ChapterUID.Parse(pMN); break;
- case 0x91: ChapterTimeStart.Parse(pMN); break;
- case 0x92: ChapterTimeEnd.Parse(pMN); break;
-// case 0x8F: // TODO
- case 0x80: ChapterDisplays.Parse(pMN); break;
- case 0xB6: ChapterAtoms.Parse(pMN); break;
- case 0x98: ChapterFlagHidden.Parse(pMN); break;
- case 0x4598: ChapterFlagEnabled.Parse(pMN); break;
- EndChunk
-}
-
-HRESULT ChapterDisplay::Parse(CMatroskaNode* pMN0)
-{
- BeginChunk
- case 0x85: ChapString.Parse(pMN); break;
- case 0x437C: ChapLanguage.Parse(pMN); break;
- case 0x437E: ChapCountry.Parse(pMN); break;
- EndChunk
-}
-
-//
-
-HRESULT CBinary::Parse(CMatroskaNode* pMN)
-{
- ASSERT(pMN->m_len <= INT_MAX);
- SetCount((INT_PTR)pMN->m_len);
- return pMN->Read(GetData(), pMN->m_len);
-}
-
-bool CBinary::Compress(ContentCompression& cc)
-{
- if(cc.ContentCompAlgo == ContentCompression::ZLIB)
- {
- int res;
- z_stream c_stream;
-
- c_stream.zalloc = (alloc_func)0;
- c_stream.zfree = (free_func)0;
- c_stream.opaque = (voidpf)0;
-
- if(Z_OK != (res = deflateInit(&c_stream, 9)))
- return(false);
-
- c_stream.next_in = GetData();
- c_stream.avail_in = GetCount();
-
- BYTE* dst = NULL;
- int n = 0;
- do
- {
- dst = (BYTE*)realloc(dst, ++n*10);
- c_stream.next_out = &dst[(n-1)*10];
- c_stream.avail_out = 10;
- if(Z_OK != (res = deflate(&c_stream, Z_FINISH)) && Z_STREAM_END != res)
- {
- free(dst);
- return(false);
- }
- }
- while(0 == c_stream.avail_out && Z_STREAM_END != res);
-
- deflateEnd(&c_stream);
-
- SetCount(c_stream.total_out);
- memcpy(GetData(), dst, GetCount());
-
- free(dst);
-
- return(true);
- }
-
- return(false);
-}
-
-bool CBinary::Decompress(ContentCompression& cc)
-{
- if(cc.ContentCompAlgo == ContentCompression::ZLIB)
- {
- int res;
- z_stream d_stream;
-
- d_stream.zalloc = (alloc_func)0;
- d_stream.zfree = (free_func)0;
- d_stream.opaque = (voidpf)0;
-
- if(Z_OK != (res = inflateInit(&d_stream)))
- return(false);
-
- d_stream.next_in = GetData();
- d_stream.avail_in = GetCount();
-
- BYTE* dst = NULL;
- int n = 0;
- do
- {
- dst = (unsigned char *)realloc(dst, ++n*1000);
- d_stream.next_out = &dst[(n-1)*1000];
- d_stream.avail_out = 1000;
- if(Z_OK != (res = inflate(&d_stream, Z_NO_FLUSH)) && Z_STREAM_END != res)
- {
- free(dst);
- return(false);
- }
- }
- while(0 == d_stream.avail_out && 0 != d_stream.avail_in && Z_STREAM_END != res);
-
- inflateEnd(&d_stream);
-
- SetCount(d_stream.total_out);
- memcpy(GetData(), dst, GetCount());
-
- free(dst);
-
- return(true);
- }
- else if(cc.ContentCompAlgo == ContentCompression::HDRSTRIP)
- {
- InsertArrayAt(0, &cc.ContentCompSettings);
- }
-
- return(false);
-}
-
-HRESULT CANSI::Parse(CMatroskaNode* pMN)
-{
- Empty();
-
- MatroskaReader::QWORD len = pMN->m_len;
- CHAR c;
- while(len-- > 0 && SUCCEEDED(pMN->Read(c)))
- *this += c;
-
- return(len == -1 ? S_OK : E_FAIL);
-}
-
-HRESULT CUTF8::Parse(CMatroskaNode* pMN)
-{
- Empty();
- CAutoVectorPtr<BYTE> buff;
- if(!buff.Allocate((UINT)pMN->m_len + 1) || S_OK != pMN->Read(buff, pMN->m_len))
- return E_FAIL;
- buff[pMN->m_len] = 0;
- CStringW::operator = (UTF8To16((LPCSTR)(BYTE*)buff));
- return S_OK;
-}
-
-HRESULT CUInt::Parse(CMatroskaNode* pMN)
-{
- m_val = 0;
- for(int i = 0; i < (int)pMN->m_len; i++)
- {
- m_val <<= 8;
- HRESULT hr = pMN->Read(*(BYTE*)&m_val);
- if(FAILED(hr)) return hr;
- }
- m_fValid = true;
- return S_OK;
-}
-
-HRESULT CInt::Parse(CMatroskaNode* pMN)
-{
- m_val = 0;
- for(int i = 0; i < (int)pMN->m_len; i++)
- {
- HRESULT hr = pMN->Read(*((BYTE*)&m_val+7-i));
- if(FAILED(hr)) return hr;
- }
- m_val >>= (8-pMN->m_len)*8;
- m_fValid = true;
- return S_OK;
-}
-
-HRESULT CFloat::Parse(CMatroskaNode* pMN)
-{
- HRESULT hr = E_FAIL;
- m_val = 0;
-
- if(pMN->m_len == 4)
- {
- float val = 0;
- hr = pMN->Read(val);
- m_val = val;
- } else if(pMN->m_len == 8) {
- hr = pMN->Read(m_val);
- }
- if(SUCCEEDED(hr))
- m_fValid = true;
- return hr;
-}
-
-
-template<class T, class BASE>
-HRESULT CSimpleVar<T, BASE>::Parse(CMatroskaNode* pMN)
-{
- m_val = 0;
- m_fValid = true;
- return pMN->Read(m_val);
-}
-
-HRESULT CID::Parse(CMatroskaNode* pMN)
-{
- m_val = 0;
-
- BYTE b = 0;
- HRESULT hr = pMN->Read(b);
- if(FAILED(hr)) return hr;
-
- int nMoreBytes = 0;
-
- if((b&0x80) == 0x80) {m_val = b&0xff; nMoreBytes = 0;}
- else if((b&0xc0) == 0x40) {m_val = b&0x7f; nMoreBytes = 1;}
- else if((b&0xe0) == 0x20) {m_val = b&0x3f; nMoreBytes = 2;}
- else if((b&0xf0) == 0x10) {m_val = b&0x1f; nMoreBytes = 3;}
- else return E_FAIL;
-
- while(nMoreBytes-- > 0)
- {
- m_val <<= 8;
- hr = pMN->Read(*(BYTE*)&m_val);
- if(FAILED(hr)) return hr;
- }
-
- m_fValid = true;
-
- return S_OK;
-}
-
-HRESULT CLength::Parse(CMatroskaNode* pMN)
-{
- m_val = 0;
-
- BYTE b = 0;
- HRESULT hr = pMN->Read(b);
- if(FAILED(hr)) return hr;
-
- int nMoreBytes = 0, nMoreBytesTmp = 0;
-
- if((b&0x80) == 0x80) {m_val = b&0x7f; nMoreBytes = 0;}
- else if((b&0xc0) == 0x40) {m_val = b&0x3f; nMoreBytes = 1;}
- else if((b&0xe0) == 0x20) {m_val = b&0x1f; nMoreBytes = 2;}
- else if((b&0xf0) == 0x10) {m_val = b&0x0f; nMoreBytes = 3;}
- else if((b&0xf8) == 0x08) {m_val = b&0x07; nMoreBytes = 4;}
- else if((b&0xfc) == 0x04) {m_val = b&0x03; nMoreBytes = 5;}
- else if((b&0xfe) == 0x02) {m_val = b&0x01; nMoreBytes = 6;}
- else if((b&0xff) == 0x01) {m_val = b&0x00; nMoreBytes = 7;}
- else return E_FAIL;
-
- nMoreBytesTmp = nMoreBytes;
-
- MatroskaReader::QWORD UnknownSize = (1i64<<(7*(nMoreBytes+1)))-1;
-
- while(nMoreBytes-- > 0)
- {
- m_val <<= 8;
- hr = pMN->Read(*(BYTE*)&m_val);
- if(FAILED(hr)) return hr;
- }
-
- if(m_val == UnknownSize)
- {
- m_val = pMN->GetLength() - pMN->GetPos();
- TRACE(_T("CLength: Unspecified chunk size at %I64d (corrected to %I64d)\n"), pMN->GetPos(), m_val);
- }
-
- if(m_fSigned)
- m_val -= (UnknownSize >> 1);
-
- m_fValid = true;
-
- return S_OK;
-}
-/*
-HRESULT CSignedLength::Parse(CMatroskaNode* pMN)
-{
-// HRESULT hr = __super::Parse(pMN);
-// if(FAILED(hr)) return hr;
-
- m_val = 0;
-
- BYTE b = 0;
- HRESULT hr = pMN->Read(b);
- if(FAILED(hr)) return hr;
-
- int nMoreBytes = 0, nMoreBytesTmp = 0;
-
- if((b&0x80) == 0x80) {m_val = b&0x7f; nMoreBytes = 0;}
- else if((b&0xc0) == 0x40) {m_val = b&0x3f; nMoreBytes = 1;}
- else if((b&0xe0) == 0x20) {m_val = b&0x1f; nMoreBytes = 2;}
- else if((b&0xf0) == 0x10) {m_val = b&0x0f; nMoreBytes = 3;}
- else if((b&0xf8) == 0x08) {m_val = b&0x07; nMoreBytes = 4;}
- else if((b&0xfc) == 0x04) {m_val = b&0x03; nMoreBytes = 5;}
- else if((b&0xfe) == 0x02) {m_val = b&0x01; nMoreBytes = 6;}
- else if((b&0xff) == 0x01) {m_val = b&0x00; nMoreBytes = 7;}
- else return E_FAIL;
-
- nMoreBytesTmp = nMoreBytes;
-
- MatroskaReader::QWORD UnknownSize = (1i64<<(7*(nMoreBytes+1)))-1;
-
- while(nMoreBytes-- > 0)
- {
- m_val <<= 8;
- hr = pMN->Read(*(BYTE*)&m_val);
- if(FAILED(hr)) return hr;
- }
-
- if(m_val == UnknownSize)
- {
- m_val = pMN->GetLength() - pMN->GetPos();
- TRACE(_T("CLength: Unspecified chunk size at %I64d (corrected to %I64d)\n"), pMN->GetPos(), m_val);
- }
-
- m_val -= (UnknownSize >> 1);
-
- m_fValid = true;
-
- return S_OK;
-}
-*/
-template<class T>
-HRESULT CNode<T>::Parse(CMatroskaNode* pMN)
-{
- CAutoPtr<T> p(DNew T());
- HRESULT hr = E_OUTOFMEMORY;
- if(!p || FAILED(hr = p->Parse(pMN))) return hr;
- AddTail(p);
- return S_OK;
-}
-
-HRESULT CBlockGroupNode::Parse(CMatroskaNode* pMN, bool fFull)
-{
- CAutoPtr<BlockGroup> p(DNew BlockGroup());
- HRESULT hr = E_OUTOFMEMORY;
- if(!p || FAILED(hr = p->Parse(pMN, fFull))) return hr;
- AddTail(p);
- return S_OK;
-}
-
-HRESULT CSimpleBlockNode::Parse(CMatroskaNode* pMN, bool fFull)
-{
- CAutoPtr<SimpleBlock> p(DNew SimpleBlock());
- HRESULT hr = E_OUTOFMEMORY;
- if(!p || FAILED(hr = p->Parse(pMN, fFull))) return hr;
- AddTail(p);
- return S_OK;
-}
-
-///////////////////////////////
-
-CMatroskaNode::CMatroskaNode(CMatroskaFile* pMF)
- : m_pMF(pMF)
- , m_pParent(NULL)
-{
- ASSERT(m_pMF);
- m_start = m_filepos = 0;
- m_len.Set(m_pMF ? m_pMF->GetLength() : 0);
-}
-
-CMatroskaNode::CMatroskaNode(CMatroskaNode* pParent)
- : m_pMF(pParent->m_pMF)
- , m_pParent(pParent)
-{
- Parse();
-}
-
-HRESULT CMatroskaNode::Parse()
-{
- m_filepos = GetPos();
- if(FAILED(m_id.Parse(this)) || FAILED(m_len.Parse(this)))
- return E_FAIL;
- m_start = GetPos();
- return S_OK;
-}
-
-CAutoPtr<CMatroskaNode> CMatroskaNode::Child(DWORD id, bool fSearch)
-{
- if(m_len == 0) return CAutoPtr<CMatroskaNode>();
- SeekTo(m_start);
- CAutoPtr<CMatroskaNode> pMN(DNew CMatroskaNode(this));
- if(id && !pMN->Find(id, fSearch)) pMN.Free();
- return pMN;
-}
-
-bool CMatroskaNode::Next(bool fSame)
-{
- if(!m_pParent)
- return(false);
-
- CID id = m_id;
-
- while(m_start+m_len < m_pParent->m_start+m_pParent->m_len)
- {
- SeekTo(m_start+m_len);
-
- if(FAILED(Parse()))
- {
- if(!Resync())
- return(false);
- }
-
- if(!fSame || m_id == id)
- return(true);
- }
-
- return(false);
-}
-
-bool CMatroskaNode::Find(DWORD id, bool fSearch)
-{
- MatroskaReader::QWORD pos = m_pParent && m_pParent->m_id == 0x18538067 /*segment?*/
- ? FindPos(id)
- : 0;
-
- if(pos)
- {
- SeekTo(pos);
- Parse();
- }
- else if(fSearch)
- {
- while(m_id != id && Next());
- }
-
- return(m_id == id);
-}
-
-void CMatroskaNode::SeekTo(MatroskaReader::QWORD pos) {m_pMF->Seek(pos);}
-MatroskaReader::QWORD CMatroskaNode::GetPos() {return m_pMF->GetPos();}
-MatroskaReader::QWORD CMatroskaNode::GetLength() {return m_pMF->GetLength();}
-template <class T>
-HRESULT CMatroskaNode::Read(T& var) {return m_pMF->Read(var);}
-HRESULT CMatroskaNode::Read(BYTE* pData, MatroskaReader::QWORD len) {return m_pMF->ByteRead(pData, len);}
-
-MatroskaReader::QWORD CMatroskaNode::FindPos(DWORD id, MatroskaReader::QWORD start)
-{
- Segment& sm = m_pMF->m_segment;
-
- POSITION pos = sm.MetaSeekInfo.GetHeadPosition();
- while(pos)
- {
- Seek* s = sm.MetaSeekInfo.GetNext(pos);
-
- POSITION pos2 = s->SeekHeads.GetHeadPosition();
- while(pos2)
- {
- SeekHead* sh = s->SeekHeads.GetNext(pos2);
- if(sh->SeekID == id && sh->SeekPosition+sm.pos >= start)
- return sh->SeekPosition+sm.pos;
- }
- }
-
- return 0;
-}
-
-CAutoPtr<CMatroskaNode> CMatroskaNode::Copy()
-{
- CAutoPtr<CMatroskaNode> pNewNode(DNew CMatroskaNode(m_pMF));
- pNewNode->m_pParent = m_pParent;
- pNewNode->m_id.Set(m_id);
- pNewNode->m_len.Set(m_len);
- pNewNode->m_filepos = m_filepos;
- pNewNode->m_start = m_start;
- return(pNewNode);
-}
-
-CAutoPtr<CMatroskaNode> CMatroskaNode::GetFirstBlock()
-{
- CAutoPtr<CMatroskaNode> pNode = Child();
- do {if(pNode->m_id == 0xA0 || pNode->m_id == 0xA3) return pNode;}
- while(pNode->Next());
- return CAutoPtr<CMatroskaNode>();
-}
-
-bool CMatroskaNode::NextBlock()
-{
- if(!m_pParent)
- return(false);
-
- CID id = m_id;
-
- while(m_start+m_len < m_pParent->m_start+m_pParent->m_len)
- {
- SeekTo(m_start+m_len);
-
- if(FAILED(Parse()))
- {
- if(!Resync())
- return(false);
- }
-
- if(m_id == 0xA0 || m_id == 0xA3)
- return(true);
- }
-
- return(false);
-}
-
-bool CMatroskaNode::Resync()
-{
- if(m_pParent->m_id == 0x18538067) /*segment?*/
- {
- SeekTo(m_filepos);
-
- for(BYTE b = 0; S_OK == Read(b); b = 0)
- {
- if((b&0xf0) != 0x10)
- continue;
-
- DWORD dw = b;
- Read((BYTE*)&dw+1, 3);
- bswap((BYTE*)&dw, 4);
-
- switch(dw)
- {
- case 0x1549A966: // SegmentInfo
- case 0x114D9B74: // MetaSeekInfo
- case 0x1654AE6B: // Tracks
- case 0x1F43B675: // Clusters
- case 0x1C53BB6B: // Cues
- case 0x1941A469: // Attachments
- case 0x1043A770: // Chapters
- case 0x1254C367: // Tags
- SeekTo(GetPos()-4);
- return(SUCCEEDED(Parse()));
- default:
- SeekTo(GetPos()-3);
- break;
- }
- }
- }
-
- return(false);
-}
diff --git a/src/filters/parser/matroskasplitter/MatroskaFile.h b/src/filters/parser/matroskasplitter/MatroskaFile.h
deleted file mode 100644
index 4d6d7562b..000000000
--- a/src/filters/parser/matroskasplitter/MatroskaFile.h
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#pragma once
-
-#include <atlbase.h>
-#include <atlcoll.h>
-#include "../BaseSplitter/BaseSplitter.h"
-
-namespace MatroskaReader
-{
- class CMatroskaNode;
-
- typedef unsigned __int64 QWORD;
-
- class CANSI : public CStringA {public: HRESULT Parse(CMatroskaNode* pMN);};
- class CUTF8 : public CStringW {public: HRESULT Parse(CMatroskaNode* pMN);};
-
- template<class T, class BASE>
- class CSimpleVar
- {
- protected:
- T m_val;
- bool m_fValid;
- public:
- CSimpleVar(T val = 0) : m_val(val), m_fValid(false) {}
- BASE& operator = (const BASE& v) {m_val = v.m_val; m_fValid = true; return(*this);}
- BASE& operator = (T val) {m_val = val; m_fValid = true; return(*this);}
- operator T() {return m_val;}
- BASE& Set(T val) {m_val = val; m_fValid = true; return(*(BASE*)this);}
- bool IsValid() {return m_fValid;}
- virtual HRESULT Parse(CMatroskaNode* pMN);
- };
-
- class CUInt : public CSimpleVar<UINT64, CUInt> {public: HRESULT Parse(CMatroskaNode* pMN);};
- class CInt : public CSimpleVar<INT64, CInt> {public: HRESULT Parse(CMatroskaNode* pMN);};
- class CByte : public CSimpleVar<BYTE, CByte> {};
- class CShort : public CSimpleVar<short, CShort> {};
- class CFloat : public CSimpleVar<double, CFloat> {public: HRESULT Parse(CMatroskaNode* pMN);};
- class CID : public CSimpleVar<DWORD, CID> {public: HRESULT Parse(CMatroskaNode* pMN);};
- class CLength : public CSimpleVar<UINT64, CLength> {bool m_fSigned; public: CLength(bool fSigned = false) : m_fSigned(fSigned) {} HRESULT Parse(CMatroskaNode* pMN);};
- class CSignedLength : public CLength {public: CSignedLength() : CLength(true) {}};
-
- class ContentCompression;
-
- class CBinary : public CAtlArray<BYTE>
- {
- public:
- CBinary& operator = (const CBinary& b) {Copy(b); return(*this);}
- CStringA ToString() {return CStringA((LPCSTR)GetData(), GetCount());}
- bool Compress(ContentCompression& cc), Decompress(ContentCompression& cc);
- HRESULT Parse(CMatroskaNode* pMN);
- };
-
- template<class T>
- class CNode : public CAutoPtrList<T> {public: HRESULT Parse(CMatroskaNode* pMN);};
-
- class EBML
- {
- public:
- CUInt EBMLVersion, EBMLReadVersion;
- CUInt EBMLMaxIDLength, EBMLMaxSizeLength;
- CANSI DocType;
- CUInt DocTypeVersion, DocTypeReadVersion;
-
- HRESULT Parse(CMatroskaNode* pMN);
- };
-
- class Info
- {
- public:
- CBinary SegmentUID, PrevUID, NextUID;
- CUTF8 SegmentFilename, PrevFilename, NextFilename;
- CUInt TimeCodeScale; // [ns], default: 1.000.000
- CFloat Duration;
- CInt DateUTC;
- CUTF8 Title, MuxingApp, WritingApp;
-
- Info() {TimeCodeScale.Set(1000000ui64);}
- HRESULT Parse(CMatroskaNode* pMN);
- };
-
- class SeekHead
- {
- public:
- CID SeekID;
- CUInt SeekPosition;
-
- HRESULT Parse(CMatroskaNode* pMN);
- };
-
- class Seek
- {
- public:
- CNode<SeekHead> SeekHeads;
-
- HRESULT Parse(CMatroskaNode* pMN);
- };
-
- class TimeSlice
- {
- public:
- CUInt LaceNumber, FrameNumber;
- CUInt Delay, Duration;
-
- HRESULT Parse(CMatroskaNode* pMN);
- };
-
- class SimpleBlock
- {
- public:
- CLength TrackNumber;
- CInt TimeCode;
- CByte Lacing;
- CAutoPtrList<CBinary> BlockData;
-
- HRESULT Parse(CMatroskaNode* pMN, bool fFull);
- };
-
- class BlockMore
- {
- public:
- CInt BlockAddID;
- CBinary BlockAdditional;
-
- BlockMore() {BlockAddID.Set(1);}
- HRESULT Parse(CMatroskaNode* pMN);
- };
-
- class BlockAdditions
- {
- public:
- CNode<BlockMore> bm;
-
- HRESULT Parse(CMatroskaNode* pMN);
- };
-
- class BlockGroup
- {
- public:
- SimpleBlock Block;
-// BlockVirtual
- CUInt BlockDuration;
- CUInt ReferencePriority;
- CInt ReferenceBlock;
- CInt ReferenceVirtual;
- CBinary CodecState;
- CNode<TimeSlice> TimeSlices;
- BlockAdditions ba;
-
- HRESULT Parse(CMatroskaNode* pMN, bool fFull);
- };
-
- class CBlockGroupNode : public CNode<BlockGroup>
- {
- public:
- HRESULT Parse(CMatroskaNode* pMN, bool fFull);
- };
-
- class CSimpleBlockNode : public CNode<SimpleBlock>
- {
- public:
- HRESULT Parse(CMatroskaNode* pMN, bool fFull);
- };
-
- class Cluster
- {
- public:
- CUInt TimeCode, Position, PrevSize;
- CBlockGroupNode BlockGroups;
- CSimpleBlockNode SimpleBlocks;
-
- HRESULT Parse(CMatroskaNode* pMN);
- HRESULT ParseTimeCode(CMatroskaNode* pMN);
- };
-
- class Video
- {
- public:
- CUInt FlagInterlaced, StereoMode;
- CUInt PixelWidth, PixelHeight, DisplayWidth, DisplayHeight, DisplayUnit;
- CUInt AspectRatioType;
- CUInt ColourSpace;
- CFloat GammaValue;
- CFloat FramePerSec;
-
- HRESULT Parse(CMatroskaNode* pMN);
- };
-
- class Audio
- {
- public:
- CFloat SamplingFrequency;
- CFloat OutputSamplingFrequency;
- CUInt Channels;
- CBinary ChannelPositions;
- CUInt BitDepth;
-
- Audio() {SamplingFrequency.Set(8000.0); Channels.Set(1);}
- HRESULT Parse(CMatroskaNode* pMN);
- };
-
- class ContentCompression
- {
- public:
- CUInt ContentCompAlgo; enum {ZLIB, BZLIB, LZO1X, HDRSTRIP};
- CBinary ContentCompSettings;
-
- ContentCompression() {ContentCompAlgo.Set(ZLIB);}
- HRESULT Parse(CMatroskaNode* pMN);
- };
-
- class ContentEncryption
- {
- public:
- CUInt ContentEncAlgo; enum {UNKE, DES, THREEDES, TWOFISH, BLOWFISH, AES};
- CBinary ContentEncKeyID, ContentSignature, ContentSigKeyID;
- CUInt ContentSigAlgo; enum {UNKS, RSA};
- CUInt ContentSigHashAlgo; enum {UNKSH, SHA1_160, MD5};
-
- ContentEncryption() {ContentEncAlgo.Set(0); ContentSigAlgo.Set(0); ContentSigHashAlgo.Set(0);}
- HRESULT Parse(CMatroskaNode* pMN);
- };
-
- class ContentEncoding
- {
- public:
- CUInt ContentEncodingOrder;
- CUInt ContentEncodingScope; enum {AllFrameContents = 1, TracksPrivateData = 2};
- CUInt ContentEncodingType; enum {Compression, Encryption};
- ContentCompression cc;
- ContentEncryption ce;
-
- ContentEncoding() {ContentEncodingOrder.Set(0); ContentEncodingScope.Set(AllFrameContents); ContentEncodingType.Set(Compression);}
- HRESULT Parse(CMatroskaNode* pMN);
- };
-
- class ContentEncodings
- {
- public:
- CNode<ContentEncoding> ce;
-
- ContentEncodings() {}
- HRESULT Parse(CMatroskaNode* pMN);
- };
-
- class TrackEntry
- {
- public:
- enum {TypeVideo = 1, TypeAudio = 2, TypeComplex = 3, TypeLogo = 0x10, TypeSubtitle = 0x11, TypeControl = 0x20};
- CUInt TrackNumber, TrackUID, TrackType;
- CUInt FlagEnabled, FlagDefault, FlagLacing;
- CUInt MinCache, MaxCache;
- CUTF8 Name;
- CANSI Language;
- CBinary CodecID;
- CBinary CodecPrivate;
- CUTF8 CodecName;
- CUTF8 CodecSettings;
- CANSI CodecInfoURL;
- CANSI CodecDownloadURL;
- CUInt CodecDecodeAll;
- CUInt TrackOverlay;
- CUInt DefaultDuration;
- CFloat TrackTimecodeScale;
- enum {NoDesc = 0, DescVideo = 1, DescAudio = 2};
- int DescType;
- Video v;
- Audio a;
- ContentEncodings ces;
- TrackEntry() {DescType = NoDesc; FlagEnabled.Set(1); FlagDefault.Set(1); FlagLacing.Set(1); }
- HRESULT Parse(CMatroskaNode* pMN);
-
- bool Expand(CBinary& data, UINT64 Scope);
- };
-
- class Track
- {
- public:
- CNode<TrackEntry> TrackEntries;
-
- HRESULT Parse(CMatroskaNode* pMN);
- };
-
- class CueReference
- {
- public:
- CUInt CueRefTime, CueRefCluster, CueRefNumber, CueRefCodecState;
-
- HRESULT Parse(CMatroskaNode* pMN);
- };
-
- class CueTrackPosition
- {
- public:
- CUInt CueTrack, CueClusterPosition, CueBlockNumber, CueCodecState;
- CNode<CueReference> CueReferences;
-
- HRESULT Parse(CMatroskaNode* pMN);
- };
-
- class CuePoint
- {
- public:
- CUInt CueTime;
- CNode<CueTrackPosition> CueTrackPositions;
-
- HRESULT Parse(CMatroskaNode* pMN);
- };
-
- class Cue
- {
- public:
- CNode<CuePoint> CuePoints;
-
- HRESULT Parse(CMatroskaNode* pMN);
- };
-
- class AttachedFile
- {
- public:
- CUTF8 FileDescription;
- CUTF8 FileName;
- CANSI FileMimeType;
- QWORD FileDataPos, FileDataLen; // BYTE* FileData
- CUInt FileUID;
-
- AttachedFile() {FileDataPos = FileDataLen = 0;}
- HRESULT Parse(CMatroskaNode* pMN);
- };
-
- class Attachment
- {
- public:
- CNode<AttachedFile> AttachedFiles;
-
- HRESULT Parse(CMatroskaNode* pMN);
- };
-
- class ChapterDisplay
- {
- public:
- CUTF8 ChapString;
- CANSI ChapLanguage;
- CANSI ChapCountry;
-
- ChapterDisplay() {ChapLanguage.CStringA::operator = ("eng");}
- HRESULT Parse(CMatroskaNode* pMN);
- };
-
- class ChapterAtom
- {
- public:
- CUInt ChapterUID;
- CUInt ChapterTimeStart, ChapterTimeEnd, ChapterFlagHidden, ChapterFlagEnabled;
-// CNode<CUInt> ChapterTracks; // TODO
- CNode<ChapterDisplay> ChapterDisplays;
- CNode<ChapterAtom> ChapterAtoms;
-
- ChapterAtom() {ChapterUID.Set(rand());ChapterFlagHidden.Set(0);ChapterFlagEnabled.Set(1);}
- HRESULT Parse(CMatroskaNode* pMN);
- ChapterAtom* FindChapterAtom(UINT64 id);
- };
-
- class EditionEntry : public ChapterAtom
- {
- public:
- HRESULT Parse(CMatroskaNode* pMN);
- };
-
- class Chapter
- {
- public:
- CNode<EditionEntry> EditionEntries;
-
- HRESULT Parse(CMatroskaNode* pMN);
- };
-
- class Segment
- {
- public:
- QWORD pos, len;
- Info SegmentInfo;
- CNode<Seek> MetaSeekInfo;
- CNode<Cluster> Clusters;
- CNode<Track> Tracks;
- CNode<Cue> Cues;
- CNode<Attachment> Attachments;
- CNode<Chapter> Chapters;
- // TODO: Chapters
- // TODO: Tags
-
- HRESULT Parse(CMatroskaNode* pMN);
- HRESULT ParseMinimal(CMatroskaNode* pMN);
-
- UINT64 GetMasterTrack();
-
- REFERENCE_TIME GetRefTime(INT64 t) {return t*(REFERENCE_TIME)(SegmentInfo.TimeCodeScale)/100;}
- ChapterAtom* FindChapterAtom(UINT64 id, int nEditionEntry = 0);
- };
-
- class CMatroskaFile : public CBaseSplitterFile
- {
- public:
- CMatroskaFile(IAsyncReader* pAsyncReader, HRESULT& hr);
- virtual ~CMatroskaFile() {}
-
- HRESULT Init();
-
- //using CBaseSplitterFile::Read;
- template <class T> HRESULT Read(T& var);
-
- EBML m_ebml;
- Segment m_segment;
- REFERENCE_TIME m_rtOffset;
-
- HRESULT Parse(CMatroskaNode* pMN);
- };
-
- class CMatroskaNode
- {
- CMatroskaNode* m_pParent;
- CMatroskaFile* m_pMF;
-
- bool Resync();
-
- public:
- CID m_id;
- CLength m_len;
- QWORD m_filepos, m_start;
-
- HRESULT Parse();
-
- public:
- CMatroskaNode(CMatroskaFile* pMF); // creates the root
- CMatroskaNode(CMatroskaNode* pParent);
-
- CMatroskaNode* Parent() {return m_pParent;}
- CAutoPtr<CMatroskaNode> Child(DWORD id = 0, bool fSearch = true);
- bool Next(bool fSame = false);
- bool Find(DWORD id, bool fSearch = true);
-
- QWORD FindPos(DWORD id, QWORD start = 0);
-
- void SeekTo(QWORD pos);
- QWORD GetPos(), GetLength();
- template <class T> HRESULT Read(T& var);
- HRESULT Read(BYTE* pData, QWORD len);
-
- CAutoPtr<CMatroskaNode> Copy();
-
- CAutoPtr<CMatroskaNode> GetFirstBlock();
- bool NextBlock();
-
- bool IsRandomAccess() {return m_pMF->IsRandomAccess();}
- };
-}
diff --git a/src/filters/parser/matroskasplitter/MatroskaSplitter.cpp b/src/filters/parser/matroskasplitter/MatroskaSplitter.cpp
deleted file mode 100644
index 0e636c0da..000000000
--- a/src/filters/parser/matroskasplitter/MatroskaSplitter.cpp
+++ /dev/null
@@ -1,1386 +0,0 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "StdAfx.h"
-#include <mmreg.h>
-#include "MatroskaSplitter.h"
-#include "../../../DSUtil/DSUtil.h"
-
-#include <initguid.h>
-#include <moreuuids.h>
-
-using namespace MatroskaReader;
-
-#ifdef REGISTER_FILTER
-
-const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
-{
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_Matroska},
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL}
-};
-
-const AMOVIESETUP_PIN sudpPins[] =
-{
- {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
- {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, 0, NULL}
-};
-
-const AMOVIESETUP_FILTER sudFilter[] =
-{
- {&__uuidof(CMatroskaSplitterFilter), L"MPC - Matroska Splitter", MERIT_NORMAL, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CMatroskaSourceFilter), L"MPC - Matroska Source", MERIT_NORMAL, 0, NULL, CLSID_LegacyAmFilterCategory},
-};
-
-CFactoryTemplate g_Templates[] =
-{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CMatroskaSplitterFilter>, NULL, &sudFilter[0]},
- {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CMatroskaSourceFilter>, NULL, &sudFilter[1]},
-};
-
-int g_cTemplates = countof(g_Templates);
-
-STDAPI DllRegisterServer()
-{
- RegisterSourceFilter(
- CLSID_AsyncReader,
- MEDIASUBTYPE_Matroska,
- _T("0,4,,1A45DFA3"),
- _T(".mkv"), _T(".mka"), _T(".mks"), NULL);
-
- return AMovieDllRegisterServer2(TRUE);
-}
-
-STDAPI DllUnregisterServer()
-{
- UnRegisterSourceFilter(MEDIASUBTYPE_Matroska);
-
- return AMovieDllRegisterServer2(FALSE);
-}
-
-#include "../../FilterApp.h"
-
-CFilterApp theApp;
-
-#endif
-
-//
-// CMatroskaSplitterFilter
-//
-
-CMatroskaSplitterFilter::CMatroskaSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CBaseSplitterFilter(NAME("CMatroskaSplitterFilter"), pUnk, phr, __uuidof(this))
-{
-}
-
-CMatroskaSplitterFilter::~CMatroskaSplitterFilter()
-{
-}
-
-STDMETHODIMP CMatroskaSplitterFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
-{
- CheckPointer(ppv, E_POINTER);
-
- return
- QI(ITrackInfo)
- __super::NonDelegatingQueryInterface(riid, ppv);
-}
-
-#include <vector>
-
-HRESULT CMatroskaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
-{
- CheckPointer(pAsyncReader, E_POINTER);
-
- HRESULT hr = E_FAIL;
-
- m_pFile.Free();
- m_pTrackEntryMap.RemoveAll();
- m_pOrderedTrackArray.RemoveAll();
-
- CAtlArray<CMatroskaSplitterOutputPin*> pinOut;
- CAtlArray<TrackEntry*> pinOutTE;
-
- m_pFile.Attach(DNew CMatroskaFile(pAsyncReader, hr));
- if(!m_pFile) return E_OUTOFMEMORY;
- if(FAILED(hr)) {m_pFile.Free(); return hr;}
-
- m_rtNewStart = m_rtCurrent = 0;
- m_rtNewStop = m_rtStop = m_rtDuration = 0;
-
- int iVideo = 1, iAudio = 1, iSubtitle = 1;
-
- POSITION pos = m_pFile->m_segment.Tracks.GetHeadPosition();
- while(pos)
- {
- Track* pT = m_pFile->m_segment.Tracks.GetNext(pos);
-
- POSITION pos2 = pT->TrackEntries.GetHeadPosition();
- while(pos2)
- {
- TrackEntry* pTE = pT->TrackEntries.GetNext(pos2);
-
- bool isSub = false;
-
- if(!pTE->Expand(pTE->CodecPrivate, ContentEncoding::TracksPrivateData))
- continue;
-
- CStringA CodecID = pTE->CodecID.ToString();
-
- CStringW Name;
- Name.Format(L"Output %I64d", (UINT64)pTE->TrackNumber);
-
- CMediaType mt;
- CAtlArray<CMediaType> mts;
-
- mt.SetSampleSize(1);
-
- if(pTE->TrackType == TrackEntry::TypeVideo)
- {
- Name.Format(L"Video %d", iVideo++);
-
- mt.majortype = MEDIATYPE_Video;
-
- if(CodecID == "V_MS/VFW/FOURCC")
- {
- mt.formattype = FORMAT_VideoInfo;
- VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + pTE->CodecPrivate.GetCount() - sizeof(BITMAPINFOHEADER));
- memset(mt.Format(), 0, mt.FormatLength());
- memcpy(&pvih->bmiHeader, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
- mt.subtype = FOURCCMap(pvih->bmiHeader.biCompression);
- switch(pvih->bmiHeader.biCompression)
- {
- case BI_RGB: case BI_BITFIELDS: mt.subtype =
- pvih->bmiHeader.biBitCount == 1 ? MEDIASUBTYPE_RGB1 :
- pvih->bmiHeader.biBitCount == 4 ? MEDIASUBTYPE_RGB4 :
- pvih->bmiHeader.biBitCount == 8 ? MEDIASUBTYPE_RGB8 :
- pvih->bmiHeader.biBitCount == 16 ? MEDIASUBTYPE_RGB565 :
- pvih->bmiHeader.biBitCount == 24 ? MEDIASUBTYPE_RGB24 :
- pvih->bmiHeader.biBitCount == 32 ? MEDIASUBTYPE_ARGB32 :
- MEDIASUBTYPE_NULL;
- break;
-// case BI_RLE8: mt.subtype = MEDIASUBTYPE_RGB8; break;
-// case BI_RLE4: mt.subtype = MEDIASUBTYPE_RGB4; break;
- }
- mts.Add(mt);
- }
- else if(CodecID == "V_UNCOMPRESSED")
- {
- }
- else if(CodecID.Find("V_MPEG4/ISO/AVC") == 0 && pTE->CodecPrivate.GetCount() >= 6)
- {
- BYTE sps = pTE->CodecPrivate[5] & 0x1f;
-
- std::vector<BYTE> avcC;
- for(int i = 0, j = pTE->CodecPrivate.GetCount(); i < j; i++)
- avcC.push_back(pTE->CodecPrivate[i]);
-
- std::vector<BYTE> sh;
-
- unsigned jj = 6;
-
- while (sps--) {
- if (jj + 2 > avcC.size())
- goto avcfail;
- unsigned spslen = ((unsigned)avcC[jj] << 8) | avcC[jj+1];
- if (jj + 2 + spslen > avcC.size())
- goto avcfail;
- unsigned cur = sh.size();
- sh.resize(cur + spslen + 2, 0);
- std::copy(avcC.begin() + jj, avcC.begin() + jj + 2 + spslen,sh.begin() + cur);
- jj += 2 + spslen;
- }
-
- if (jj + 1 > avcC.size())
- continue;
-
- unsigned pps = avcC[jj++];
-
- while (pps--) {
- if (jj + 2 > avcC.size())
- goto avcfail;
- unsigned ppslen = ((unsigned)avcC[jj] << 8) | avcC[jj+1];
- if (jj + 2 + ppslen > avcC.size())
- goto avcfail;
- unsigned cur = sh.size();
- sh.resize(cur + ppslen + 2, 0);
- std::copy(avcC.begin() + jj, avcC.begin() + jj + 2 + ppslen, sh.begin() + cur);
- jj += 2 + ppslen;
- }
-
- goto avcsuccess;
-avcfail:
- continue;
-avcsuccess:
-
- CAtlArray<BYTE> data;
- data.SetCount(sh.size());
- std::copy(sh.begin(), sh.end(), data.GetData());
-
- mt.subtype = FOURCCMap('1CVA');
- mt.formattype = FORMAT_MPEG2Video;
- MPEG2VIDEOINFO* pm2vi = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + data.GetCount());
- memset(mt.Format(), 0, mt.FormatLength());
- pm2vi->hdr.bmiHeader.biSize = sizeof(pm2vi->hdr.bmiHeader);
- pm2vi->hdr.bmiHeader.biWidth = (LONG)pTE->v.PixelWidth;
- pm2vi->hdr.bmiHeader.biHeight = (LONG)pTE->v.PixelHeight;
- pm2vi->hdr.bmiHeader.biCompression = '1CVA';
- pm2vi->hdr.bmiHeader.biPlanes = 1;
- pm2vi->hdr.bmiHeader.biBitCount = 24;
- pm2vi->dwProfile = pTE->CodecPrivate[1];
- pm2vi->dwLevel = pTE->CodecPrivate[3];
- pm2vi->dwFlags = (pTE->CodecPrivate[4] & 3) + 1;
- BYTE* pSequenceHeader = (BYTE*)pm2vi->dwSequenceHeader;
- memcpy(pSequenceHeader, data.GetData(), data.GetCount());
- pm2vi->cbSequenceHeader = data.GetCount();
- mts.Add(mt);
- }
- else if(CodecID.Find("V_MPEG4/") == 0)
- {
- mt.subtype = FOURCCMap('V4PM');
- mt.formattype = FORMAT_MPEG2Video;
- MPEG2VIDEOINFO* pm2vi = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + pTE->CodecPrivate.GetCount());
- memset(mt.Format(), 0, mt.FormatLength());
- pm2vi->hdr.bmiHeader.biSize = sizeof(pm2vi->hdr.bmiHeader);
- pm2vi->hdr.bmiHeader.biWidth = (LONG)pTE->v.PixelWidth;
- pm2vi->hdr.bmiHeader.biHeight = (LONG)pTE->v.PixelHeight;
- pm2vi->hdr.bmiHeader.biCompression = 'V4PM';
- pm2vi->hdr.bmiHeader.biPlanes = 1;
- pm2vi->hdr.bmiHeader.biBitCount = 24;
- BYTE* pSequenceHeader = (BYTE*)pm2vi->dwSequenceHeader;
- memcpy(pSequenceHeader, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
- pm2vi->cbSequenceHeader = pTE->CodecPrivate.GetCount();
- mts.Add(mt);
- }
- else if(CodecID.Find("V_REAL/RV") == 0)
- {
- mt.subtype = FOURCCMap('00VR' + ((CodecID[9]-0x30)<<16));
- mt.formattype = FORMAT_VideoInfo;
- VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + pTE->CodecPrivate.GetCount());
- memset(mt.Format(), 0, mt.FormatLength());
- memcpy(mt.Format() + sizeof(VIDEOINFOHEADER), pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
- pvih->bmiHeader.biSize = sizeof(pvih->bmiHeader);
- pvih->bmiHeader.biWidth = (LONG)pTE->v.PixelWidth;
- pvih->bmiHeader.biHeight = (LONG)pTE->v.PixelHeight;
- pvih->bmiHeader.biCompression = mt.subtype.Data1;
- mts.Add(mt);
- }
- else if(CodecID == "V_DIRAC")
- {
- mt.subtype = MEDIASUBTYPE_DiracVideo;
- mt.formattype = FORMAT_DiracVideoInfo;
- DIRACINFOHEADER* dvih = (DIRACINFOHEADER*)mt.AllocFormatBuffer(FIELD_OFFSET(DIRACINFOHEADER, dwSequenceHeader) + pTE->CodecPrivate.GetCount());
- memset(mt.Format(), 0, mt.FormatLength());
- dvih->hdr.bmiHeader.biSize = sizeof(dvih->hdr.bmiHeader);
- dvih->hdr.bmiHeader.biWidth = (LONG)pTE->v.PixelWidth;
- dvih->hdr.bmiHeader.biHeight = (LONG)pTE->v.PixelHeight;
- dvih->hdr.dwPictAspectRatioX = dvih->hdr.bmiHeader.biWidth;
- dvih->hdr.dwPictAspectRatioY = dvih->hdr.bmiHeader.biHeight;
-
- BYTE* pSequenceHeader = (BYTE*)dvih->dwSequenceHeader;
- memcpy(pSequenceHeader, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
- dvih->cbSequenceHeader = pTE->CodecPrivate.GetCount();
-
- mts.Add(mt);
- }
- else if(CodecID == "V_MPEG2")
- {
- BYTE* seqhdr = pTE->CodecPrivate.GetData();
- DWORD len = pTE->CodecPrivate.GetCount();
- int w = pTE->v.PixelWidth;
- int h = pTE->v.PixelHeight;
-
- if(MakeMPEG2MediaType(mt, seqhdr, len, w, h))
- mts.Add(mt);
- }
- else if(CodecID == "V_THEORA")
- {
- BYTE* thdr = pTE->CodecPrivate.GetData() + 3;
-
- mt.majortype = MEDIATYPE_Video;
- mt.subtype = FOURCCMap('OEHT');
- mt.formattype = FORMAT_MPEG2_VIDEO;
- MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(sizeof(MPEG2VIDEOINFO) + pTE->CodecPrivate.GetCount());
- memset(mt.Format(), 0, mt.FormatLength());
- vih->hdr.bmiHeader.biSize = sizeof(vih->hdr.bmiHeader);
- vih->hdr.bmiHeader.biWidth = *(WORD*)&thdr[10] >> 4;
- vih->hdr.bmiHeader.biHeight = *(WORD*)&thdr[12] >> 4;
- vih->hdr.bmiHeader.biCompression = 'OEHT';
- vih->hdr.bmiHeader.biPlanes = 1;
- vih->hdr.bmiHeader.biBitCount = 24;
- int nFpsNum = (thdr[22]<<24)|(thdr[23]<<16)|(thdr[24]<<8)|thdr[25];
- int nFpsDenum = (thdr[26]<<24)|(thdr[27]<<16)|(thdr[28]<<8)|thdr[29];
- if(nFpsNum) vih->hdr.AvgTimePerFrame = (REFERENCE_TIME)(10000000.0 * nFpsDenum / nFpsNum);
- vih->hdr.dwPictAspectRatioX = (thdr[14]<<16)|(thdr[15]<<8)|thdr[16];
- vih->hdr.dwPictAspectRatioY = (thdr[17]<<16)|(thdr[18]<<8)|thdr[19];
- mt.bFixedSizeSamples = 0;
-
- vih->cbSequenceHeader = pTE->CodecPrivate.GetCount();
- memcpy (&vih->dwSequenceHeader, pTE->CodecPrivate.GetData(), vih->cbSequenceHeader);
-
- mts.Add(mt);
- }
-/*
- else if(CodecID == "V_DSHOW/MPEG1VIDEO") // V_MPEG1
- {
- mt.majortype = MEDIATYPE_Video;
- mt.subtype = MEDIASUBTYPE_MPEG1Payload;
- mt.formattype = FORMAT_MPEGVideo;
- MPEG1VIDEOINFO* pm1vi = (MPEG1VIDEOINFO*)mt.AllocFormatBuffer(pTE->CodecPrivate.GetCount());
- memcpy(pm1vi, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
- mt.SetSampleSize(pm1vi->hdr.bmiHeader.biWidth*pm1vi->hdr.bmiHeader.biHeight*4);
- mts.Add(mt);
- }
-*/
- REFERENCE_TIME AvgTimePerFrame = 0;
-
- if(pTE->v.FramePerSec > 0)
- AvgTimePerFrame = (REFERENCE_TIME)(10000000i64 / pTE->v.FramePerSec);
- else if(pTE->DefaultDuration > 0)
- AvgTimePerFrame = (REFERENCE_TIME)pTE->DefaultDuration / 100;
-
- if(AvgTimePerFrame)
- {
- for(int i = 0; i < mts.GetCount(); i++)
- {
- if(mts[i].formattype == FORMAT_VideoInfo
- || mts[i].formattype == FORMAT_VideoInfo2
- || mts[i].formattype == FORMAT_MPEG2Video)
- {
- ((VIDEOINFOHEADER*)mts[i].Format())->AvgTimePerFrame = AvgTimePerFrame;
- }
- }
- }
-
- if(pTE->v.DisplayWidth != 0 && pTE->v.DisplayHeight != 0)
- {
- for(int i = 0; i < mts.GetCount(); i++)
- {
- if(mts[i].formattype == FORMAT_VideoInfo)
- {
- DWORD vih1 = FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader);
- DWORD vih2 = FIELD_OFFSET(VIDEOINFOHEADER2, bmiHeader);
- DWORD bmi = mts[i].FormatLength() - FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader);
- mt.formattype = FORMAT_VideoInfo2;
- mt.AllocFormatBuffer(vih2 + bmi);
- memcpy(mt.Format(), mts[i].Format(), vih1);
- memset(mt.Format() + vih1, 0, vih2 - vih1);
- memcpy(mt.Format() + vih2, mts[i].Format() + vih1, bmi);
- ((VIDEOINFOHEADER2*)mt.Format())->dwPictAspectRatioX = (DWORD)pTE->v.DisplayWidth;
- ((VIDEOINFOHEADER2*)mt.Format())->dwPictAspectRatioY = (DWORD)pTE->v.DisplayHeight;
- mts.InsertAt(i++, mt);
- }
- else if(mts[i].formattype == FORMAT_MPEG2Video)
- {
- ((MPEG2VIDEOINFO*)mts[i].Format())->hdr.dwPictAspectRatioX = (DWORD)pTE->v.DisplayWidth;
- ((MPEG2VIDEOINFO*)mts[i].Format())->hdr.dwPictAspectRatioY = (DWORD)pTE->v.DisplayHeight;
- }
- }
- }
- }
- else if(pTE->TrackType == TrackEntry::TypeAudio)
- {
- Name.Format(L"Audio %d", iAudio++);
-
- mt.majortype = MEDIATYPE_Audio;
- mt.formattype = FORMAT_WaveFormatEx;
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(sizeof(WAVEFORMATEX));
- memset(wfe, 0, mt.FormatLength());
- wfe->nChannels = (WORD)pTE->a.Channels;
- wfe->nSamplesPerSec = (DWORD)pTE->a.SamplingFrequency;
- wfe->wBitsPerSample = (WORD)pTE->a.BitDepth;
- wfe->nBlockAlign = (WORD)((wfe->nChannels * wfe->wBitsPerSample) / 8);
- wfe->nAvgBytesPerSec = wfe->nSamplesPerSec * wfe->nBlockAlign;
- mt.SetSampleSize(256000);
-
- static CAtlMap<CStringA, int, CStringElementTraits<CStringA> > id2ft;
-
- if(id2ft.IsEmpty())
- {
- id2ft["A_MPEG/L3"] = WAVE_FORMAT_MP3;
- id2ft["A_MPEG/L2"] = WAVE_FORMAT_MPEG;
- id2ft["A_AC3"] = WAVE_FORMAT_DOLBY_AC3;
- id2ft["A_DTS"] = WAVE_FORMAT_DVD_DTS;
- id2ft["A_EAC3"] = WAVE_FORMAT_DOLBY_AC3;
- id2ft["A_PCM/INT/LIT"] = WAVE_FORMAT_PCM;
- id2ft["A_PCM/FLOAT/IEEE"] = WAVE_FORMAT_IEEE_FLOAT;
- id2ft["A_AAC"] = -WAVE_FORMAT_AAC;
- id2ft["A_FLAC"] = -WAVE_FORMAT_FLAC;
- id2ft["A_WAVPACK4"] = -WAVE_FORMAT_WAVPACK4;
- id2ft["A_TTA1"] = WAVE_FORMAT_TTA1;
- id2ft["A_TRUEHD"] = WAVE_FORMAT_DOLBY_AC3;
- id2ft["A_MLP"] = WAVE_FORMAT_DOLBY_AC3;
- }
-
- int wFormatTag;
- if(id2ft.Lookup(CodecID, wFormatTag))
- {
- if(wFormatTag < 0)
- {
- wFormatTag = -wFormatTag;
- wfe->cbSize = pTE->CodecPrivate.GetCount();
- wfe = (WAVEFORMATEX*)mt.ReallocFormatBuffer(sizeof(WAVEFORMATEX) + pTE->CodecPrivate.GetCount());
- memcpy(wfe + 1, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
- }
-
- mt.subtype = FOURCCMap(wfe->wFormatTag = wFormatTag);
- mts.Add(mt);
-
- if(wFormatTag == WAVE_FORMAT_FLAC)
- {
- mt.subtype = MEDIASUBTYPE_FLAC_FRAMED;
- mts.InsertAt(0, mt);
- }
- }
- else if(CodecID == "A_VORBIS")
- {
- BYTE* p = pTE->CodecPrivate.GetData();
- CAtlArray<int> sizes;
- for(BYTE n = *p++; n > 0; n--)
- {
- int size = 0;
- do {size += *p;} while(*p++ == 0xff);
- sizes.Add(size);
- }
-
- int totalsize = 0;
- for(int i = 0; i < sizes.GetCount(); i++)
- totalsize += sizes[i];
-
- sizes.Add(pTE->CodecPrivate.GetCount() - (p - pTE->CodecPrivate.GetData()) - totalsize);
- totalsize += sizes[sizes.GetCount()-1];
-
- if(sizes.GetCount() == 3)
- {
- mt.subtype = MEDIASUBTYPE_Vorbis2;
- mt.formattype = FORMAT_VorbisFormat2;
- VORBISFORMAT2* pvf2 = (VORBISFORMAT2*)mt.AllocFormatBuffer(sizeof(VORBISFORMAT2) + totalsize);
- memset(pvf2, 0, mt.FormatLength());
- pvf2->Channels = (WORD)pTE->a.Channels;
- pvf2->SamplesPerSec = (DWORD)pTE->a.SamplingFrequency;
- pvf2->BitsPerSample = (DWORD)pTE->a.BitDepth;
- BYTE* p2 = mt.Format() + sizeof(VORBISFORMAT2);
- for(int i = 0; i < sizes.GetCount(); p += sizes[i], p2 += sizes[i], i++)
- memcpy(p2, p, pvf2->HeaderSize[i] = sizes[i]);
-
- mts.Add(mt);
- }
-
- mt.subtype = MEDIASUBTYPE_Vorbis;
- mt.formattype = FORMAT_VorbisFormat;
- VORBISFORMAT* vf = (VORBISFORMAT*)mt.AllocFormatBuffer(sizeof(VORBISFORMAT));
- memset(vf, 0, mt.FormatLength());
- vf->nChannels = (WORD)pTE->a.Channels;
- vf->nSamplesPerSec = (DWORD)pTE->a.SamplingFrequency;
- vf->nMinBitsPerSec = vf->nMaxBitsPerSec = vf->nAvgBitsPerSec = -1;
- mts.Add(mt);
- }
- else if(CodecID == "A_MS/ACM")
- {
- wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(pTE->CodecPrivate.GetCount());
- memcpy(wfe, (WAVEFORMATEX*)pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
- mt.subtype = FOURCCMap(wfe->wFormatTag);
- mts.Add(mt);
- }
- else if(CodecID.Find("A_AAC/") == 0)
- {
- mt.subtype = FOURCCMap(wfe->wFormatTag = WAVE_FORMAT_AAC);
- wfe = (WAVEFORMATEX*)mt.ReallocFormatBuffer(sizeof(WAVEFORMATEX) + 5);
- wfe->cbSize = 2;
-
- int profile;
-
- if(CodecID.Find("/MAIN") > 0) profile = 0;
- else if(CodecID.Find("/SBR") > 0) profile = -1;
- else if(CodecID.Find("/LC") > 0) profile = 1;
- else if(CodecID.Find("/SSR") > 0) profile = 2;
- else if(CodecID.Find("/LTP") > 0) profile = 3;
- else continue;
-
- WORD cbSize = MakeAACInitData((BYTE*)(wfe + 1), profile, wfe->nSamplesPerSec, pTE->a.Channels);
-
- mts.Add(mt);
-
- if(profile < 0)
- {
- wfe->cbSize = cbSize;
- wfe->nSamplesPerSec *= 2;
- wfe->nAvgBytesPerSec *= 2;
-
- mts.InsertAt(0, mt);
- }
- }
- else if(CodecID.Find("A_REAL/") == 0 && CodecID.GetLength() >= 11)
- {
- mt.subtype = FOURCCMap((DWORD)CodecID[7]|((DWORD)CodecID[8]<<8)|((DWORD)CodecID[9]<<16)|((DWORD)CodecID[10]<<24));
- mt.bTemporalCompression = TRUE;
- wfe->cbSize = pTE->CodecPrivate.GetCount();
- wfe = (WAVEFORMATEX*)mt.ReallocFormatBuffer(sizeof(WAVEFORMATEX) + pTE->CodecPrivate.GetCount());
- memcpy(wfe + 1, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
- wfe->cbSize = 0; // IMPORTANT: this is screwed, but cbSize has to be 0 and the extra data from codec priv must be after WAVEFORMATEX
- mts.Add(mt);
- }
- }
- else if(pTE->TrackType == TrackEntry::TypeSubtitle)
- {
- if(iSubtitle == 1) InstallFonts();
-
- Name.Format(L"Subtitle %d", iSubtitle++);
-
- mt.SetSampleSize(1);
-
- if(CodecID == "S_TEXT/ASCII")
- {
- mt.majortype = MEDIATYPE_Text;
- mt.subtype = MEDIASUBTYPE_NULL;
- mt.formattype = FORMAT_None;
- mts.Add(mt);
- isSub = true;
- }
- else
- {
- mt.majortype = MEDIATYPE_Subtitle;
- mt.formattype = FORMAT_SubtitleInfo;
- SUBTITLEINFO* psi = (SUBTITLEINFO*)mt.AllocFormatBuffer(sizeof(SUBTITLEINFO) + pTE->CodecPrivate.GetCount());
- memset(psi, 0, mt.FormatLength());
- strncpy(psi->IsoLang, pTE->Language, countof(psi->IsoLang)-1);
- wcsncpy(psi->TrackName, pTE->Name, countof(psi->TrackName)-1);
- memcpy(mt.pbFormat + (psi->dwOffset = sizeof(SUBTITLEINFO)), pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
-
- mt.subtype =
- CodecID == "S_TEXT/UTF8" ? MEDIASUBTYPE_UTF8 :
- CodecID == "S_TEXT/SSA" || CodecID == "S_SSA" ? MEDIASUBTYPE_SSA :
- CodecID == "S_TEXT/ASS" || CodecID == "S_ASS" ? MEDIASUBTYPE_ASS :
- CodecID == "S_TEXT/SSF" || CodecID == "S_SSF" ? MEDIASUBTYPE_SSF :
- CodecID == "S_TEXT/USF" || CodecID == "S_USF" ? MEDIASUBTYPE_USF :
- CodecID == "S_VOBSUB" ? MEDIASUBTYPE_VOBSUB :
- MEDIASUBTYPE_NULL;
-
- if(mt.subtype != MEDIASUBTYPE_NULL) {
- mts.Add(mt);
- isSub = true;
- }
- }
- }
-
- if(mts.IsEmpty())
- {
- TRACE(_T("CMatroskaSourceFilter: Unsupported TrackType %s (%I64d)\n"), CString(CodecID), (UINT64)pTE->TrackType);
- continue;
- }
-
- Name = CStringW(pTE->Language.IsEmpty() ? L"English" : CStringW(ISO6392ToLanguage(pTE->Language)))
- + (pTE->Name.IsEmpty() ? L"" : L", " + pTE->Name)
- + (L" (" + Name + L")");
-
- HRESULT hr;
-
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CMatroskaSplitterOutputPin((int)pTE->MinCache, pTE->DefaultDuration/100, mts, Name, this, this, &hr));
- if(!pTE->Name.IsEmpty()) pPinOut->SetProperty(L"NAME", pTE->Name);
- if(pTE->Language.GetLength() == 3) pPinOut->SetProperty(L"LANG", CStringW(CString(pTE->Language)));
-
- if (!isSub) {
- pinOut.InsertAt((iVideo+iAudio-3),DNew CMatroskaSplitterOutputPin((int)pTE->MinCache, pTE->DefaultDuration/100, mts, Name, this, this, &hr),1);
- pinOutTE.InsertAt((iVideo+iAudio-3),pTE,1);
- } else {
- pinOut.Add(DNew CMatroskaSplitterOutputPin((int)pTE->MinCache, pTE->DefaultDuration/100, mts, Name, this, this, &hr));
- pinOutTE.Add(pTE);
- }
-
- }
- }
-
- for(int i = 0; i < pinOut.GetCount(); i++) {
-
- CAutoPtr<CBaseSplitterOutputPin> pPinOut;
- pPinOut.Attach(pinOut[i]);
- TrackEntry* pTE = pinOutTE[i];
-
- AddOutputPin((DWORD)pTE->TrackNumber, pPinOut);
- m_pTrackEntryMap[(DWORD)pTE->TrackNumber] = pTE;
- m_pOrderedTrackArray.Add(pTE);
- }
-
-
- Info& info = m_pFile->m_segment.SegmentInfo;
-
- if(m_pFile->IsRandomAccess())
- {
- m_rtDuration = (REFERENCE_TIME)(info.Duration * info.TimeCodeScale / 100);
- }
-
- m_rtNewStop = m_rtStop = m_rtDuration;
-
-#ifdef DEBUG
- /*
- for(int i = 1, j = GetChapterCount(CHAPTER_ROOT_ID); i <= j; i++)
- {
- UINT id = GetChapterId(CHAPTER_ROOT_ID, i);
- struct ChapterElement ce;
- BOOL b = GetChapterInfo(id, &ce);
- BSTR bstr = GetChapterStringInfo(id, "eng", "");
- if(bstr) ::SysFreeString(bstr);
- }
- */
-#endif
-
- SetProperty(L"TITL", info.Title);
- // TODO
-
- // resources
-
- {
- POSITION pos = m_pFile->m_segment.Attachments.GetHeadPosition();
- while(pos)
- {
- Attachment* pA = m_pFile->m_segment.Attachments.GetNext(pos);
-
- POSITION pos = pA->AttachedFiles.GetHeadPosition();
- while(pos)
- {
- AttachedFile* pF = pA->AttachedFiles.GetNext(pos);
-
- CAtlArray<BYTE> pData;
- pData.SetCount(pF->FileDataLen);
- m_pFile->Seek(pF->FileDataPos);
- if(SUCCEEDED(m_pFile->ByteRead(pData.GetData(), pData.GetCount())))
- ResAppend(pF->FileName, pF->FileDescription, CStringW(pF->FileMimeType), pData.GetData(), pData.GetCount());
- }
- }
- }
-
- // chapters
-
- if(ChapterAtom* caroot = m_pFile->m_segment.FindChapterAtom(0))
- {
- CStringA str;
- str.ReleaseBufferSetLength(GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SISO639LANGNAME, str.GetBuffer(3), 3));
- CStringA ChapLanguage = CStringA(ISO6391To6392(str));
- if(ChapLanguage.GetLength() < 3) ChapLanguage = "eng";
-
- SetupChapters(ChapLanguage, caroot);
- }
-
- return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
-}
-
-void CMatroskaSplitterFilter::SetupChapters(LPCSTR lng, ChapterAtom* parent, int level)
-{
- CStringW tabs('+', level);
-
- if(!tabs.IsEmpty()) tabs += ' ';
-
- POSITION pos = parent->ChapterAtoms.GetHeadPosition();
- while(pos)
- {
- // ChapUID zero not allow by Matroska specs
- UINT64 ChapUID = parent->ChapterAtoms.GetNext(pos)->ChapterUID;
- ChapterAtom* ca = (ChapUID == 0) ? NULL : m_pFile->m_segment.FindChapterAtom(ChapUID);
-
- if(ca)
- {
- CStringW name, first;
-
- POSITION pos = ca->ChapterDisplays.GetHeadPosition();
- while(pos)
- {
- ChapterDisplay* cd = ca->ChapterDisplays.GetNext(pos);
- if(first.IsEmpty()) first = cd->ChapString;
- if(cd->ChapLanguage == lng) name = cd->ChapString;
- }
-
- name = tabs + (!name.IsEmpty() ? name : first);
-
- ChapAppend(ca->ChapterTimeStart / 100 - m_pFile->m_rtOffset, name);
-
- if(!ca->ChapterAtoms.IsEmpty())
- {
- SetupChapters(lng, ca, level+1);
- }
- }
- }
-
-}
-
-void CMatroskaSplitterFilter::InstallFonts()
-{
- POSITION pos = m_pFile->m_segment.Attachments.GetHeadPosition();
- while(pos)
- {
- Attachment* pA = m_pFile->m_segment.Attachments.GetNext(pos);
-
- POSITION p2 = pA->AttachedFiles.GetHeadPosition();
- while(p2)
- {
- AttachedFile* pF = pA->AttachedFiles.GetNext(p2);
-
- if(pF->FileMimeType == "application/x-truetype-font")
- {
- // assume this is a font resource
-
- if(BYTE* pData = DNew BYTE[(UINT)pF->FileDataLen])
- {
- m_pFile->Seek(pF->FileDataPos);
-
- if(SUCCEEDED(m_pFile->ByteRead(pData, pF->FileDataLen)))
- m_fontinst.InstallFont(pData, (UINT)pF->FileDataLen);
-
- delete [] pData;
- }
- }
- }
- }
-}
-
-void CMatroskaSplitterFilter::SendVorbisHeaderSample()
-{
- HRESULT hr;
-
- POSITION pos = m_pTrackEntryMap.GetStartPosition();
- while(pos)
- {
- DWORD TrackNumber = 0;
- TrackEntry* pTE = NULL;
- m_pTrackEntryMap.GetNextAssoc(pos, TrackNumber, pTE);
-
- CBaseSplitterOutputPin* pPin = GetOutputPin(TrackNumber);
-
- if(!(pTE && pPin && pPin->IsConnected()))
- continue;
-
- if(pTE->CodecID.ToString() == "A_VORBIS" && pPin->CurrentMediaType().subtype == MEDIASUBTYPE_Vorbis
- && pTE->CodecPrivate.GetCount() > 0)
- {
- BYTE* ptr = pTE->CodecPrivate.GetData();
-
- CAtlList<int> sizes;
- long last = 0;
- for(BYTE n = *ptr++; n > 0; n--)
- {
- int size = 0;
- do {size += *ptr;} while(*ptr++ == 0xff);
- sizes.AddTail(size);
- last += size;
- }
- sizes.AddTail(pTE->CodecPrivate.GetCount() - (ptr - pTE->CodecPrivate.GetData()) - last);
-
- hr = S_OK;
-
- POSITION pos = sizes.GetHeadPosition();
- while(pos && SUCCEEDED(hr))
- {
- long len = sizes.GetNext(pos);
-
- CAutoPtr<Packet> p(DNew Packet());
- p->TrackNumber = (DWORD)pTE->TrackNumber;
- p->rtStart = 0; p->rtStop = 1;
- p->bSyncPoint = FALSE;
-
- p->SetData(ptr, len);
- ptr += len;
-
- hr = DeliverPacket(p);
- }
-
- if(FAILED(hr))
- TRACE(_T("ERROR: Vorbis initialization failed for stream %I64d\n"), TrackNumber);
- }
- }
-}
-
-bool CMatroskaSplitterFilter::DemuxInit()
-{
- CMatroskaNode Root(m_pFile);
- if(!m_pFile
- || !(m_pSegment = Root.Child(0x18538067))
- || !(m_pCluster = m_pSegment->Child(0x1F43B675)))
- return(false);
-
- // reindex if needed
-
- if(m_pFile->IsRandomAccess() && m_pFile->m_segment.Cues.GetCount() == 0)
- {
- m_nOpenProgress = 0;
- m_pFile->m_segment.SegmentInfo.Duration.Set(0);
-
- UINT64 TrackNumber = m_pFile->m_segment.GetMasterTrack();
-
- CAutoPtr<Cue> pCue(DNew Cue());
-
- do
- {
- Cluster c;
- c.ParseTimeCode(m_pCluster);
-
- m_pFile->m_segment.SegmentInfo.Duration.Set((float)c.TimeCode - m_pFile->m_rtOffset/10000);
-
- CAutoPtr<CuePoint> pCuePoint(DNew CuePoint());
- CAutoPtr<CueTrackPosition> pCueTrackPosition(DNew CueTrackPosition());
- pCuePoint->CueTime.Set(c.TimeCode);
- pCueTrackPosition->CueTrack.Set(TrackNumber);
- pCueTrackPosition->CueClusterPosition.Set(m_pCluster->m_filepos - m_pSegment->m_start);
- pCuePoint->CueTrackPositions.AddTail(pCueTrackPosition);
- pCue->CuePoints.AddTail(pCuePoint);
-
- m_nOpenProgress = m_pFile->GetPos()*100/m_pFile->GetLength();
-
- DWORD cmd;
- if(CheckRequest(&cmd))
- {
- if(cmd == CMD_EXIT) m_fAbort = true;
- else Reply(S_OK);
- }
- }
- while(!m_fAbort && m_pCluster->Next(true));
-
- m_nOpenProgress = 100;
-
- if(!m_fAbort) m_pFile->m_segment.Cues.AddTail(pCue);
-
- m_fAbort = false;
- }
-
- m_pCluster.Free();
- m_pBlock.Free();
-
- return(true);
-}
-
-void CMatroskaSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
-{
- m_pCluster = m_pSegment->Child(0x1F43B675);
- m_pBlock.Free();
-
- if(rt > 0)
- {
- rt += m_pFile->m_rtOffset;
-
- MatroskaReader::QWORD lastCueClusterPosition = -1;
-
- Segment& s = m_pFile->m_segment;
-
- UINT64 TrackNumber = s.GetMasterTrack();
-
- POSITION pos1 = s.Cues.GetHeadPosition();
- while(pos1)
- {
- Cue* pCue = s.Cues.GetNext(pos1);
-
- POSITION pos2 = pCue->CuePoints.GetTailPosition();
- while(pos2)
- {
- CuePoint* pCuePoint = pCue->CuePoints.GetPrev(pos2);
-
- if(rt < s.GetRefTime(pCuePoint->CueTime))
- continue;
-
- POSITION pos3 = pCuePoint->CueTrackPositions.GetHeadPosition();
- while(pos3)
- {
- CueTrackPosition* pCueTrackPositions = pCuePoint->CueTrackPositions.GetNext(pos3);
-
- if(TrackNumber != pCueTrackPositions->CueTrack)
- continue;
-
- if(lastCueClusterPosition == pCueTrackPositions->CueClusterPosition)
- continue;
-
- lastCueClusterPosition = pCueTrackPositions->CueClusterPosition;
-
- m_pCluster->SeekTo(m_pSegment->m_start + pCueTrackPositions->CueClusterPosition);
- m_pCluster->Parse();
-
- bool fFoundKeyFrame = false;
-/*
- if(pCueTrackPositions->CueBlockNumber > 0)
- {
- // TODO: CueBlockNumber only tells the block num of the track and not for all mixed in the cluster
- m_nLastBlock = (int)pCueTrackPositions->CueBlockNumber;
- fFoundKeyFrame = true;
- }
- else
-*/
- {
- Cluster c;
- c.ParseTimeCode(m_pCluster);
-
- if(CAutoPtr<CMatroskaNode> pBlock = m_pCluster->GetFirstBlock())
- {
- bool fPassedCueTime = false;
-
- do
- {
- CBlockGroupNode bgn;
-
- if(pBlock->m_id == 0xA0)
- {
- bgn.Parse(pBlock, true);
- }
- else if(pBlock->m_id == 0xA3)
- {
- CAutoPtr<BlockGroup> bg(DNew BlockGroup());
- bg->Block.Parse(pBlock, true);
- if(!(bg->Block.Lacing & 0x80)) bg->ReferenceBlock.Set(0); // not a kf
- bgn.AddTail(bg);
- }
-
- POSITION pos4 = bgn.GetHeadPosition();
- while(!fPassedCueTime && pos4)
- {
- BlockGroup* bg = bgn.GetNext(pos4);
-
- if(bg->Block.TrackNumber == pCueTrackPositions->CueTrack && rt < s.GetRefTime(c.TimeCode + bg->Block.TimeCode)
- || rt + 5000000i64 < s.GetRefTime(c.TimeCode + bg->Block.TimeCode)) // allow 500ms difference between tracks, just in case intreleaving wasn't that much precise
- {
- fPassedCueTime = true;
- }
- else if(bg->Block.TrackNumber == pCueTrackPositions->CueTrack && !bg->ReferenceBlock.IsValid())
- {
- fFoundKeyFrame = true;
- m_pBlock = pBlock->Copy();
- }
- }
- }
- while(!fPassedCueTime && pBlock->NextBlock());
- }
- }
-
- if(fFoundKeyFrame)
- pos1 = pos2 = pos3 = NULL;
- }
- }
- }
-
- if(!m_pBlock)
- {
- m_pCluster = m_pSegment->Child(0x1F43B675);
- }
- }
-}
-
-bool CMatroskaSplitterFilter::DemuxLoop()
-{
- HRESULT hr = S_OK;
-
- SendVorbisHeaderSample(); // HACK: init vorbis decoder with the headers
-
- do
- {
- Cluster c;
- c.ParseTimeCode(m_pCluster);
-
- if(!m_pBlock) m_pBlock = m_pCluster->GetFirstBlock();
- if(!m_pBlock) continue;
-
- do
- {
- CBlockGroupNode bgn;
-
- if(m_pBlock->m_id == 0xA0)
- {
- bgn.Parse(m_pBlock, true);
- }
- else if(m_pBlock->m_id == 0xA3)
- {
- CAutoPtr<BlockGroup> bg(DNew BlockGroup());
- bg->Block.Parse(m_pBlock, true);
- if(!(bg->Block.Lacing & 0x80)) bg->ReferenceBlock.Set(0); // not a kf
- bgn.AddTail(bg);
- }
-
- while(bgn.GetCount() && SUCCEEDED(hr))
- {
- CAutoPtr<MatroskaPacket> p(DNew MatroskaPacket());
- p->bg = bgn.RemoveHead();
-
- p->bSyncPoint = !p->bg->ReferenceBlock.IsValid();
- p->TrackNumber = (DWORD)p->bg->Block.TrackNumber;
-
- TrackEntry* pTE = m_pTrackEntryMap[p->TrackNumber];
- if(!pTE) continue;
-
- p->rtStart = m_pFile->m_segment.GetRefTime((REFERENCE_TIME)c.TimeCode + p->bg->Block.TimeCode);
- p->rtStop = p->rtStart + (p->bg->BlockDuration.IsValid() ? m_pFile->m_segment.GetRefTime(p->bg->BlockDuration) : 1);
-
- // Fix subtitle with duration = 0
- if(pTE->TrackType == TrackEntry::TypeSubtitle && !p->bg->BlockDuration.IsValid())
- {
- p->bg->BlockDuration.Set(1); // just setting it to be valid
- p->rtStop = p->rtStart;
- }
-
- POSITION pos = p->bg->Block.BlockData.GetHeadPosition();
- while(pos)
- {
- CBinary* pb = p->bg->Block.BlockData.GetNext(pos);
- pTE->Expand(*pb, ContentEncoding::AllFrameContents);
- }
-
- // HACK
- p->rtStart -= m_pFile->m_rtOffset;
- p->rtStop -= m_pFile->m_rtOffset;
-
- hr = DeliverPacket(p);
- }
- }
- while(m_pBlock->NextBlock() && SUCCEEDED(hr) && !CheckRequest(NULL));
-
- m_pBlock.Free();
- }
- while(m_pFile->GetPos() < m_pFile->m_segment.pos + m_pFile->m_segment.len
- && m_pCluster->Next(true) && SUCCEEDED(hr) && !CheckRequest(NULL));
-
- m_pCluster.Free();
-
- return(true);
-}
-
-// IKeyFrameInfo
-
-STDMETHODIMP CMatroskaSplitterFilter::GetKeyFrameCount(UINT& nKFs)
-{
- if(!m_pFile) return E_UNEXPECTED;
-
- HRESULT hr = S_OK;
-
- nKFs = 0;
-
- POSITION pos = m_pFile->m_segment.Cues.GetHeadPosition();
- while(pos) nKFs += m_pFile->m_segment.Cues.GetNext(pos)->CuePoints.GetCount();
-
- return hr;
-}
-
-STDMETHODIMP CMatroskaSplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs)
-{
- CheckPointer(pFormat, E_POINTER);
- CheckPointer(pKFs, E_POINTER);
-
- if(!m_pFile) return E_UNEXPECTED;
- if(*pFormat != TIME_FORMAT_MEDIA_TIME) return E_INVALIDARG;
-
- UINT nKFsTmp = 0;
-
- POSITION pos1 = m_pFile->m_segment.Cues.GetHeadPosition();
- while(pos1 && nKFsTmp < nKFs)
- {
- Cue* pCue = m_pFile->m_segment.Cues.GetNext(pos1);
-
- POSITION pos2 = pCue->CuePoints.GetHeadPosition();
- while(pos2 && nKFsTmp < nKFs)
- pKFs[nKFsTmp++] = m_pFile->m_segment.GetRefTime(pCue->CuePoints.GetNext(pos2)->CueTime);
- }
-
- nKFs = nKFsTmp;
-
- return S_OK;
-}
-
-//
-// CMatroskaSourceFilter
-//
-
-CMatroskaSourceFilter::CMatroskaSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CMatroskaSplitterFilter(pUnk, phr)
-{
- m_clsid = __uuidof(this);
- m_pInput.Free();
-}
-
-//
-// CMatroskaSplitterOutputPin
-//
-
-CMatroskaSplitterOutputPin::CMatroskaSplitterOutputPin(
- int nMinCache, REFERENCE_TIME rtDefaultDuration,
- CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
- : CBaseSplitterOutputPin(mts, pName, pFilter, pLock, phr)
- , m_nMinCache(nMinCache), m_rtDefaultDuration(rtDefaultDuration)
-{
- m_nMinCache = 1;//max(m_nMinCache, 1);
-}
-
-CMatroskaSplitterOutputPin::~CMatroskaSplitterOutputPin()
-{
-}
-
-HRESULT CMatroskaSplitterOutputPin::DeliverEndFlush()
-{
- {
- CAutoLock cAutoLock(&m_csQueue);
- m_packets.RemoveAll();
- m_rob.RemoveAll();
- m_tos.RemoveAll();
- }
-
- return __super::DeliverEndFlush();
-}
-
-HRESULT CMatroskaSplitterOutputPin::DeliverEndOfStream()
-{
- CAutoLock cAutoLock(&m_csQueue);
-
- // send out the last remaining packets from the queue
-
- while(m_rob.GetCount())
- {
- MatroskaPacket* mp = m_rob.RemoveHead();
- if(m_rob.GetCount() && !mp->bg->BlockDuration.IsValid())
- mp->rtStop = m_rob.GetHead()->rtStart;
- else if(m_rob.GetCount() == 0 && m_rtDefaultDuration > 0)
- mp->rtStop = mp->rtStart + m_rtDefaultDuration;
-
- timeoverride to = {mp->rtStart, mp->rtStop};
- m_tos.AddTail(to);
- }
-
- while(m_packets.GetCount())
- {
- HRESULT hr = DeliverBlock(m_packets.RemoveHead());
- if(hr != S_OK) return hr;
- }
-
- return __super::DeliverEndOfStream();
-}
-
-HRESULT CMatroskaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
-{
- MatroskaPacket* mp = dynamic_cast<MatroskaPacket*>(p.m_p);
- if(!mp) return __super::DeliverPacket(p);
-
- // don't try to understand what's happening here, it's magic
-
- CAutoLock cAutoLock(&m_csQueue);
-
- CAutoPtr<MatroskaPacket> p2;
- p.Detach();
- p2.Attach(mp);
- m_packets.AddTail(p2);
-
- POSITION pos = m_rob.GetTailPosition();
- for(int i = m_nMinCache-1; i > 0 && pos && mp->bg->ReferencePriority < m_rob.GetAt(pos)->bg->ReferencePriority; i--)
- m_rob.GetPrev(pos);
-
- if(!pos) m_rob.AddHead(mp);
- else m_rob.InsertAfter(pos, mp);
-
- mp = NULL;
-
- if(m_rob.GetCount() == m_nMinCache+1)
- {
- ASSERT(m_nMinCache > 0);
- pos = m_rob.GetHeadPosition();
- MatroskaPacket* mp1 = m_rob.GetNext(pos);
- MatroskaPacket* mp2 = m_rob.GetNext(pos);
- if(!mp1->bg->BlockDuration.IsValid())
- {
- mp1->bg->BlockDuration.Set(1); // just to set it valid
-
- if(mp1->rtStart >= mp2->rtStart)
- {
-/* CString str;
- str.Format(_T("mp1->rtStart (%I64d) >= mp2->rtStart (%I64d)!!!\n"), mp1->rtStart, mp2->rtStart);
- AfxMessageBox(str);
-*/
- // TRACE(_T("mp1->rtStart (%I64d) >= mp2->rtStart (%I64d)!!!\n"), mp1->rtStart, mp2->rtStart);
- }
- else
- {
- mp1->rtStop = mp2->rtStart;
- }
- }
- }
-
- while(m_packets.GetCount())
- {
- mp = m_packets.GetHead();
- if(!mp->bg->BlockDuration.IsValid()) break;
-
- mp = m_rob.RemoveHead();
- timeoverride to = {mp->rtStart, mp->rtStop};
- m_tos.AddTail(to);
-
- HRESULT hr = DeliverBlock(m_packets.RemoveHead());
- if(hr != S_OK) return hr;
- }
-
- return S_OK;
-}
-
-HRESULT CMatroskaSplitterOutputPin::DeliverBlock(MatroskaPacket* p)
-{
- HRESULT hr = S_FALSE;
-
- if(m_tos.GetCount())
- {
- timeoverride to = m_tos.RemoveHead();
-// if(p->TrackNumber == 2)
- TRACE(_T("(track=%d) %I64d, %I64d -> %I64d, %I64d (buffcnt=%d)\n"),
- p->TrackNumber, p->rtStart, p->rtStop, to.rtStart, to.rtStop,
- QueueCount());
-/**/
- p->rtStart = to.rtStart;
- p->rtStop = to.rtStop;
- }
-
- REFERENCE_TIME
- rtStart = p->rtStart,
- rtDelta = (p->rtStop - p->rtStart) / p->bg->Block.BlockData.GetCount(),
- rtStop = p->rtStart + rtDelta;
-
- POSITION pos = p->bg->Block.BlockData.GetHeadPosition();
- while(pos)
- {
- CAutoPtr<Packet> tmp(DNew Packet());
- tmp->TrackNumber = p->TrackNumber;
- tmp->bDiscontinuity = p->bDiscontinuity;
- tmp->bSyncPoint = p->bSyncPoint;
- tmp->rtStart = rtStart;
- tmp->rtStop = rtStop;
- tmp->Copy(*p->bg->Block.BlockData.GetNext(pos));
- if(S_OK != (hr = DeliverPacket(tmp))) break;
-
- rtStart += rtDelta;
- rtStop += rtDelta;
-
- p->bSyncPoint = false;
- p->bDiscontinuity = false;
- }
-
- if(m_mt.subtype == FOURCCMap(WAVE_FORMAT_WAVPACK4))
- {
- POSITION pos = p->bg->ba.bm.GetHeadPosition();
- while(pos)
- {
- const BlockMore* bm = p->bg->ba.bm.GetNext(pos);
- CAutoPtr<Packet> tmp(DNew Packet());
- tmp->TrackNumber = p->TrackNumber;
- tmp->bDiscontinuity = false;
- tmp->bSyncPoint = false;
- tmp->rtStart = p->rtStart;
- tmp->rtStop = p->rtStop;
- tmp->Copy(bm->BlockAdditional);
- if(S_OK != (hr = DeliverPacket(tmp))) break;
- }
- }
-
- return hr;
-}
-
-// ITrackInfo
-
-TrackEntry* CMatroskaSplitterFilter::GetTrackEntryAt(UINT aTrackIdx)
-{
- if(aTrackIdx < 0 || aTrackIdx >= m_pOrderedTrackArray.GetCount())
- return NULL;
- return m_pOrderedTrackArray[aTrackIdx];
-}
-
-STDMETHODIMP_(UINT) CMatroskaSplitterFilter::GetTrackCount()
-{
- return m_pTrackEntryMap.GetCount();
-}
-
-STDMETHODIMP_(BOOL) CMatroskaSplitterFilter::GetTrackInfo(UINT aTrackIdx, struct TrackElement* pStructureToFill)
-{
- TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL)
- return FALSE;
-
- pStructureToFill->FlagDefault = !!pTE->FlagDefault;
- pStructureToFill->FlagLacing = !!pTE->FlagLacing;
- strncpy(pStructureToFill->Language, pTE->Language, 3);
- if(pStructureToFill->Language[0] == '\0')
- strncpy(pStructureToFill->Language, "eng", 3);
- pStructureToFill->Language[3] = '\0';
- pStructureToFill->MaxCache = (UINT)pTE->MaxCache;
- pStructureToFill->MinCache = (UINT)pTE->MinCache;
- pStructureToFill->Type = (BYTE)pTE->TrackType;
- return TRUE;
-}
-
-STDMETHODIMP_(BOOL) CMatroskaSplitterFilter::GetTrackExtendedInfo(UINT aTrackIdx, void* pStructureToFill)
-{
- TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL)
- return FALSE;
-
- if(pTE->TrackType == TrackEntry::TypeVideo)
- {
- TrackExtendedInfoVideo* pTEIV = (TrackExtendedInfoVideo*)pStructureToFill;
- pTEIV->AspectRatioType = (BYTE)pTE->v.AspectRatioType;
- pTEIV->DisplayUnit = (BYTE)pTE->v.DisplayUnit;
- pTEIV->DisplayWidth = (UINT)pTE->v.DisplayWidth;
- pTEIV->DisplayHeight = (UINT)pTE->v.DisplayHeight;
- pTEIV->Interlaced = !!pTE->v.FlagInterlaced;
- pTEIV->PixelWidth = (UINT)pTE->v.PixelWidth;
- pTEIV->PixelHeight = (UINT)pTE->v.PixelHeight;
- } else if(pTE->TrackType == TrackEntry::TypeAudio) {
- TrackExtendedInfoAudio* pTEIA = (TrackExtendedInfoAudio*)pStructureToFill;
- pTEIA->BitDepth = (UINT)pTE->a.BitDepth;
- pTEIA->Channels = (UINT)pTE->a.Channels;
- pTEIA->OutputSamplingFrequency = pTE->a.OutputSamplingFrequency;
- pTEIA->SamplingFreq = pTE->a.SamplingFrequency;
- } else {
- return FALSE;
- }
-
- return TRUE;
-}
-
-STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackName(UINT aTrackIdx)
-{
- TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL)
- return NULL;
- return pTE->Name.AllocSysString();
-}
-
-STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecID(UINT aTrackIdx)
-{
- TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL)
- return NULL;
- return pTE->CodecID.ToString().AllocSysString();
-}
-
-STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecName(UINT aTrackIdx)
-{
- TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL)
- return NULL;
- return pTE->CodecName.AllocSysString();
-}
-
-STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecInfoURL(UINT aTrackIdx)
-{
- TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL)
- return NULL;
- return pTE->CodecInfoURL.AllocSysString();
-}
-
-STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecDownloadURL(UINT aTrackIdx)
-{
- TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL)
- return NULL;
- return pTE->CodecDownloadURL.AllocSysString();
-}
diff --git a/src/filters/parser/matroskasplitter/MatroskaSplitter.def b/src/filters/parser/matroskasplitter/MatroskaSplitter.def
deleted file mode 100644
index 3562761e9..000000000
--- a/src/filters/parser/matroskasplitter/MatroskaSplitter.def
+++ /dev/null
@@ -1,7 +0,0 @@
-LIBRARY "MatroskaSplitter.ax"
-
-EXPORTS
- DllCanUnloadNow PRIVATE
- DllGetClassObject PRIVATE
- DllRegisterServer PRIVATE
- DllUnregisterServer PRIVATE
diff --git a/src/filters/parser/matroskasplitter/MatroskaSplitter.h b/src/filters/parser/matroskasplitter/MatroskaSplitter.h
deleted file mode 100644
index 05eb7d814..000000000
--- a/src/filters/parser/matroskasplitter/MatroskaSplitter.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#pragma once
-
-#include <atlbase.h>
-#include <atlcoll.h>
-#include "MatroskaFile.h"
-#include "../BaseSplitter/BaseSplitter.h"
-#include <ITrackInfo.h>
-
-class MatroskaPacket : public Packet
-{
-protected:
- int GetDataSize()
- {
- int size = 0;
- POSITION pos = bg->Block.BlockData.GetHeadPosition();
- while(pos) {size += bg->Block.BlockData.GetNext(pos)->GetCount();}
- return size;
- }
-public:
- CAutoPtr<MatroskaReader::BlockGroup> bg;
-};
-
-class CMatroskaSplitterOutputPin : public CBaseSplitterOutputPin
-{
- HRESULT DeliverBlock(MatroskaPacket* p);
-
- int m_nMinCache;
- REFERENCE_TIME m_rtDefaultDuration;
-
- CCritSec m_csQueue;
- CAutoPtrList<MatroskaPacket> m_packets;
- CAtlList<MatroskaPacket*> m_rob;
-
- typedef struct {REFERENCE_TIME rtStart, rtStop;} timeoverride;
- CAtlList<timeoverride> m_tos;
-
-protected:
- HRESULT DeliverPacket(CAutoPtr<Packet> p);
-
-public:
- CMatroskaSplitterOutputPin(
- int nMinCache, REFERENCE_TIME rtDefaultDuration,
- CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
- virtual ~CMatroskaSplitterOutputPin();
-
- HRESULT DeliverEndFlush();
- HRESULT DeliverEndOfStream();
-};
-
-[uuid("149D2E01-C32E-4939-80F6-C07B81015A7A")]
-class CMatroskaSplitterFilter : public CBaseSplitterFilter, public ITrackInfo
-{
- void SetupChapters(LPCSTR lng, MatroskaReader::ChapterAtom* parent, int level = 0);
- void InstallFonts();
- void SendVorbisHeaderSample();
-
- CAutoPtr<MatroskaReader::CMatroskaNode> m_pSegment, m_pCluster, m_pBlock;
-
-protected:
- CAutoPtr<MatroskaReader::CMatroskaFile> m_pFile;
- HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
-
- CAtlMap<DWORD, MatroskaReader::TrackEntry*> m_pTrackEntryMap;
- CAtlArray<MatroskaReader::TrackEntry* > m_pOrderedTrackArray;
- MatroskaReader::TrackEntry* GetTrackEntryAt(UINT aTrackIdx);
-
- bool DemuxInit();
- void DemuxSeek(REFERENCE_TIME rt);
- bool DemuxLoop();
-
-public:
- CMatroskaSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
- virtual ~CMatroskaSplitterFilter();
-
- DECLARE_IUNKNOWN;
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
-
- // IKeyFrameInfo
-
- STDMETHODIMP GetKeyFrameCount(UINT& nKFs);
- STDMETHODIMP GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs);
-
- // ITrackInfo
-
- STDMETHODIMP_(UINT) GetTrackCount();
- STDMETHODIMP_(BOOL) GetTrackInfo(UINT aTrackIdx, struct TrackElement* pStructureToFill);
- STDMETHODIMP_(BOOL) GetTrackExtendedInfo(UINT aTrackIdx, void* pStructureToFill);
- STDMETHODIMP_(BSTR) GetTrackName(UINT aTrackIdx);
- STDMETHODIMP_(BSTR) GetTrackCodecID(UINT aTrackIdx);
- STDMETHODIMP_(BSTR) GetTrackCodecName(UINT aTrackIdx);
- STDMETHODIMP_(BSTR) GetTrackCodecInfoURL(UINT aTrackIdx);
- STDMETHODIMP_(BSTR) GetTrackCodecDownloadURL(UINT aTrackIdx);
-};
-
-[uuid("0A68C3B5-9164-4a54-AFAF-995B2FF0E0D4")]
-class CMatroskaSourceFilter : public CMatroskaSplitterFilter
-{
-public:
- CMatroskaSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
-};
diff --git a/src/filters/parser/matroskasplitter/MatroskaSplitter.rc b/src/filters/parser/matroskasplitter/MatroskaSplitter.rc
deleted file mode 100644
index 85947ca85..000000000
--- a/src/filters/parser/matroskasplitter/MatroskaSplitter.rc
+++ /dev/null
@@ -1,105 +0,0 @@
-// Microsoft Visual C++ generated resource script.
-//
-#include "resource.h"
-#include "..\..\..\..\include\Version.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "afxres.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif //_WIN32
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_REV,VERSION_PATCH
- PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_REV,VERSION_PATCH
- FILEFLAGSMASK 0x17L
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x7L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "Comments", "http://sourceforge.net/projects/mpc-hc/"
- VALUE "CompanyName", "MPC-HC Team"
- VALUE "FileDescription", "Matroska Splitter"
- VALUE "FileVersion", "1, 1, 0, 0"
- VALUE "InternalName", "Matroska Splitter"
- VALUE "LegalCopyright", "Copyright (C) 2002-2010 see AUTHORS file"
- VALUE "OriginalFilename", "MatroskaSplitter.ax"
- VALUE "ProductName", "Matroska Splitter"
- VALUE "ProductVersion", "1, 1, 0, 0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
- "#include ""afxres.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-#endif // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
-
diff --git a/src/filters/parser/matroskasplitter/MatroskaSplitter.vcproj b/src/filters/parser/matroskasplitter/MatroskaSplitter.vcproj
deleted file mode 100644
index d66127807..000000000
--- a/src/filters/parser/matroskasplitter/MatroskaSplitter.vcproj
+++ /dev/null
@@ -1,747 +0,0 @@
-<?xml version="1.0" encoding="windows-1250"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9,00"
- Name="MatroskaSplitter"
- ProjectGUID="{3F5EA225-F4B7-4413-AEB3-4E4E5751E438}"
- RootNamespace="MatroskaSplitter"
- Keyword="Win32Proj"
- TargetFrameworkVersion="131072"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug Unicode lib|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="..\..\..\common.vsprops;..\..\..\debug.vsprops"
- UseOfMFC="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalOptions="/MP"
- AdditionalIncludeDirectories="..\..\..\..\include;..\..\BaseClasses"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="..\..\..\..\lib\$(ProjectName)DU.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug Unicode lib|x64"
- OutputDirectory="$(PlatformName)\$(ConfigurationName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="4"
- InheritedPropertySheets="..\..\..\common.vsprops;..\..\..\debug.vsprops"
- UseOfMFC="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalOptions="/MP"
- AdditionalIncludeDirectories="..\..\..\..\include;..\..\BaseClasses"
- PreprocessorDefinitions="_WIN64;_DEBUG;_LIB"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="..\..\..\..\lib64\$(ProjectName)DU.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release Unicode lib|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="..\..\..\common.vsprops;..\..\..\release.vsprops"
- UseOfMFC="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalOptions="/MP"
- AdditionalIncludeDirectories="..\..\..\..\include;..\..\BaseClasses"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
- BufferSecurityCheck="true"
- EnableEnhancedInstructionSet="1"
- DisableSpecificWarnings="4244"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="..\..\..\..\lib\$(ProjectName)RU.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release Unicode lib|x64"
- OutputDirectory="$(PlatformName)\$(ConfigurationName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="4"
- InheritedPropertySheets="..\..\..\common.vsprops;..\..\..\release.vsprops"
- UseOfMFC="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalOptions="/MP"
- AdditionalIncludeDirectories="..\..\..\..\include;..\..\BaseClasses"
- PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
- BufferSecurityCheck="true"
- EnableEnhancedInstructionSet="0"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="..\..\..\..\lib64\$(ProjectName)RU.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug Unicode|Win32"
- ConfigurationType="2"
- InheritedPropertySheets="..\..\..\common.vsprops;..\..\..\debug.vsprops"
- UseOfMFC="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..\..\..\..\include;..\..\BaseClasses"
- PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- RegisterOutput="true"
- AdditionalDependencies="zlibD.lib strmbaseDU.lib dsutilDU.lib basesplitterDU.lib Winmm.lib"
- OutputFile="$(OutDir)\$(ProjectName).ax"
- AdditionalLibraryDirectories="..\..\..\..\lib"
- ModuleDefinitionFile="$(ProjectName).def"
- DelayLoadDLLs=""
- SubSystem="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- EmbedManifest="false"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug Unicode|x64"
- OutputDirectory="$(PlatformName)\$(ConfigurationName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="2"
- InheritedPropertySheets="..\..\..\common.vsprops;..\..\..\debug.vsprops"
- UseOfMFC="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..\..\..\..\include;..\..\BaseClasses"
- PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="zlibD.lib strmbaseDU.lib dsutilDU.lib basesplitterDU.lib Winmm.lib"
- OutputFile="$(OutDir)\$(ProjectName).ax"
- AdditionalLibraryDirectories="..\..\..\..\lib64"
- ModuleDefinitionFile="$(ProjectName).def"
- DelayLoadDLLs=""
- SubSystem="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- EmbedManifest="false"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release Unicode|Win32"
- ConfigurationType="2"
- InheritedPropertySheets="..\..\..\common.vsprops;..\..\..\release.vsprops"
- UseOfMFC="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..\..\..\..\include;..\..\BaseClasses"
- PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
- BufferSecurityCheck="true"
- EnableEnhancedInstructionSet="1"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="zlibR.lib strmbaseRU.lib dsutilRU.lib basesplitterRU.lib Winmm.lib"
- OutputFile="..\..\..\..\bin\x86\$(ProjectName).ax"
- AdditionalLibraryDirectories="..\..\..\..\lib"
- ModuleDefinitionFile="$(ProjectName).def"
- GenerateDebugInformation="true"
- SubSystem="2"
- LargeAddressAware="2"
- RandomizedBaseAddress="2"
- DataExecutionPrevention="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release Unicode|x64"
- OutputDirectory="$(PlatformName)\$(ConfigurationName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="2"
- InheritedPropertySheets="..\..\..\common.vsprops;..\..\..\release.vsprops"
- UseOfMFC="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..\..\..\..\include;..\..\BaseClasses"
- PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
- BufferSecurityCheck="true"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="zlibR.lib strmbaseRU.lib dsutilRU.lib basesplitterRU.lib Winmm.lib"
- OutputFile="..\..\..\..\bin\x64\$(ProjectName).ax"
- AdditionalLibraryDirectories="..\..\..\..\lib64"
- ModuleDefinitionFile="$(ProjectName).def"
- GenerateDebugInformation="true"
- SubSystem="2"
- LargeAddressAware="2"
- RandomizedBaseAddress="2"
- DataExecutionPrevention="2"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
- >
- <File
- RelativePath=".\MatroskaFile.cpp"
- >
- </File>
- <File
- RelativePath="MatroskaSplitter.cpp"
- >
- </File>
- <File
- RelativePath="MatroskaSplitter.def"
- >
- </File>
- <File
- RelativePath="stdafx.cpp"
- >
- <FileConfiguration
- Name="Debug Unicode lib|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Unicode lib|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release Unicode lib|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release Unicode lib|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Unicode|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Unicode|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release Unicode|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release Unicode|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"
- />
- </FileConfiguration>
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc"
- >
- <File
- RelativePath=".\MatroskaFile.h"
- >
- </File>
- <File
- RelativePath="MatroskaSplitter.h"
- >
- </File>
- <File
- RelativePath=".\resource.h"
- >
- <FileConfiguration
- Name="Debug Unicode lib|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Unicode lib|x64"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release Unicode lib|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release Unicode lib|x64"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="stdafx.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
- >
- <File
- RelativePath=".\MatroskaSplitter.rc"
- >
- <FileConfiguration
- Name="Debug Unicode lib|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCResourceCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Unicode lib|x64"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCResourceCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release Unicode lib|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCResourceCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release Unicode lib|x64"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCResourceCompilerTool"
- />
- </FileConfiguration>
- </File>
- </Filter>
- </Files>
- <Globals>
- <Global
- Name="DevPartner_IsInstrumented"
- Value="0"
- />
- </Globals>
-</VisualStudioProject>
diff --git a/src/filters/parser/matroskasplitter/resource.h b/src/filters/parser/matroskasplitter/resource.h
deleted file mode 100644
index 1cd7111d9..000000000
--- a/src/filters/parser/matroskasplitter/resource.h
+++ /dev/null
@@ -1,14 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by MatroskaSplitter.rc
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 101
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1001
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/src/filters/parser/matroskasplitter/stdafx.cpp b/src/filters/parser/matroskasplitter/stdafx.cpp
deleted file mode 100644
index c3b346d99..000000000
--- a/src/filters/parser/matroskasplitter/stdafx.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-// stdafx.cpp : source file that includes just the standard includes
-// MatroskaSplitter.pch will be the pre-compiled header
-// stdafx.obj will contain the pre-compiled type information
-
-#include "stdafx.h"
-
-// TODO: reference any additional headers you need in STDAFX.H
-// and not in this file
diff --git a/src/filters/parser/matroskasplitter/stdafx.h b/src/filters/parser/matroskasplitter/stdafx.h
deleted file mode 100644
index 5f53f59b5..000000000
--- a/src/filters/parser/matroskasplitter/stdafx.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-// stdafx.h : include file for standard system include files,
-// or project specific include files that are used frequently, but
-// are changed infrequently
-//
-
-#pragma once
-#include "../../../DSUtil/SharedInclude.h"
-
-#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
-#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
-
-#ifndef VC_EXTRALEAN
-#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
-#endif
-
-#include <afx.h>
-#include <afxwin.h> // MFC core and standard components
-
-// TODO: reference additional headers your program requires here
-
-#include <dshow.h>
-#include <streams.h>
-#include <dvdmedia.h>
-#include "../../../DSUtil/DSUtil.h"