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:
authorXhmikosR <xhmikosr@users.sourceforge.net>2010-04-09 18:12:59 +0400
committerXhmikosR <xhmikosr@users.sourceforge.net>2010-04-09 18:12:59 +0400
commitefbc9d9043ff8ff92716ddd00a5f61412d535593 (patch)
tree8f3e621f756cf1f5b4d64d97964c7e7abd8aaf08 /src/filters/parser/AviSplitter
parentdf6b139a6d9027156f614b68687e039e3a5854db (diff)
revert r1783
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1785 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/parser/AviSplitter')
-rw-r--r--src/filters/parser/AviSplitter/AviFile.cpp1051
-rw-r--r--src/filters/parser/AviSplitter/AviFile.h90
-rw-r--r--src/filters/parser/AviSplitter/AviReportWnd.cpp558
-rw-r--r--src/filters/parser/AviSplitter/AviReportWnd.h45
-rw-r--r--src/filters/parser/AviSplitter/AviSplitter.cpp1296
-rw-r--r--src/filters/parser/AviSplitter/AviSplitter.h62
-rw-r--r--src/filters/parser/AviSplitter/resource.h2
-rw-r--r--src/filters/parser/AviSplitter/stdafx.cpp8
-rw-r--r--src/filters/parser/AviSplitter/stdafx.h8
9 files changed, 1524 insertions, 1596 deletions
diff --git a/src/filters/parser/AviSplitter/AviFile.cpp b/src/filters/parser/AviSplitter/AviFile.cpp
index 95bf6bea3..7b610a505 100644
--- a/src/filters/parser/AviSplitter/AviFile.cpp
+++ b/src/filters/parser/AviSplitter/AviFile.cpp
@@ -6,618 +6,607 @@
//
CAviFile::CAviFile(IAsyncReader* pAsyncReader, HRESULT& hr)
- : CBaseSplitterFile(pAsyncReader, hr)
+ : CBaseSplitterFile(pAsyncReader, hr)
{
- if(FAILED(hr)) return;
- m_isamv = false;
- hr = Init();
+ if(FAILED(hr)) return;
+ m_isamv = false;
+ hr = Init();
}
-template<typename T>
+template<typename T>
HRESULT CAviFile::Read(T& var, int offset)
{
- memset(&var, 0, sizeof(var));
- HRESULT hr = ByteRead((BYTE*)&var + offset, sizeof(var) - offset);
- return hr;
+ memset(&var, 0, sizeof(var));
+ HRESULT hr = ByteRead((BYTE*)&var + offset, sizeof(var) - offset);
+ return hr;
}
HRESULT CAviFile::Init()
{
- Seek(0);
- DWORD dw[3];
- if(S_OK != Read(dw) || dw[0] != FCC('RIFF') || (dw[2] != FCC('AVI ') && dw[2] != FCC('AVIX') && dw[2] != FCC('AMV ')))
- return E_FAIL;
-
- m_isamv = (dw[2] == FCC('AMV '));
- Seek(0);
- HRESULT hr = Parse(0, GetLength());
- if(m_movis.GetCount() == 0) // FAILED(hr) is allowed as long as there was a movi chunk found
- return E_FAIL;
-
- if(m_avih.dwStreams == 0 && m_strms.GetCount() > 0)
- m_avih.dwStreams = m_strms.GetCount();
-
- if(m_avih.dwStreams != m_strms.GetCount())
- return E_FAIL;
-
- for(int i = 0; i < (int)m_avih.dwStreams; i++)
- {
- strm_t* s = m_strms[i];
- if(s->strh.fccType != FCC('auds')) continue;
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)s->strf.GetData();
- if(wfe->wFormatTag == 0x55 && wfe->nBlockAlign == 1152
- && s->strh.dwScale == 1 && s->strh.dwRate != wfe->nSamplesPerSec)
- {
- // correcting encoder bugs...
- s->strh.dwScale = 1152;
- s->strh.dwRate = wfe->nSamplesPerSec;
- }
- }
-
- if(!m_isamv && (FAILED(BuildIndex())))
- EmptyIndex();
-
- return S_OK;
+ Seek(0);
+ DWORD dw[3];
+ if(S_OK != Read(dw) || dw[0] != FCC('RIFF') || (dw[2] != FCC('AVI ') && dw[2] != FCC('AVIX') && dw[2] != FCC('AMV ')))
+ return E_FAIL;
+
+ m_isamv = (dw[2] == FCC('AMV '));
+ Seek(0);
+ HRESULT hr = Parse(0, GetLength());
+ if(m_movis.GetCount() == 0) // FAILED(hr) is allowed as long as there was a movi chunk found
+ return E_FAIL;
+
+ if(m_avih.dwStreams == 0 && m_strms.GetCount() > 0)
+ m_avih.dwStreams = m_strms.GetCount();
+
+ if(m_avih.dwStreams != m_strms.GetCount())
+ return E_FAIL;
+
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ {
+ strm_t* s = m_strms[i];
+ if(s->strh.fccType != FCC('auds')) continue;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)s->strf.GetData();
+ if(wfe->wFormatTag == 0x55 && wfe->nBlockAlign == 1152
+ && s->strh.dwScale == 1 && s->strh.dwRate != wfe->nSamplesPerSec)
+ {
+ // correcting encoder bugs...
+ s->strh.dwScale = 1152;
+ s->strh.dwRate = wfe->nSamplesPerSec;
+ }
+ }
+
+ if (!m_isamv && (FAILED(BuildIndex())))
+ EmptyIndex();
+
+ return S_OK;
}
HRESULT CAviFile::BuildAMVIndex()
{
- strm_t::chunk NewChunk;
- ULONG ulType;
- ULONG ulSize;
-
- memset(&NewChunk, 0, sizeof(strm_t::chunk));
- while((Read(ulType) == S_OK) && (Read(ulSize) == S_OK))
- {
- switch(ulType)
- {
- case FCC('00dc'): // 01bw : JPeg
- NewChunk.size = ulSize;
- NewChunk.filepos = GetPos();
- NewChunk.orgsize = ulSize;
- NewChunk.fKeyFrame = true;
- m_strms[0]->cs.Add(NewChunk);
- break;
- case FCC('01wb') : // 00dc : Audio
- NewChunk.size = ulSize;
- NewChunk.orgsize = ulSize;
- NewChunk.fKeyFrame = true;
- NewChunk.filepos = GetPos();
- m_strms[1]->cs.Add(NewChunk);
- break;
- }
- Seek(GetPos() + ulSize);
- }
-
- TRACE("Video packet : %d Audio packet :%d\n", m_strms[0]->cs.GetCount(), m_strms[1]->cs.GetCount());
- return S_OK;
+ strm_t::chunk NewChunk;
+ ULONG ulType;
+ ULONG ulSize;
+
+ memset (&NewChunk, 0, sizeof(strm_t::chunk));
+ while((Read(ulType) == S_OK) && (Read(ulSize) == S_OK))
+ {
+ switch (ulType)
+ {
+ case FCC('00dc'): // 01bw : JPeg
+ NewChunk.size = ulSize;
+ NewChunk.filepos = GetPos();
+ NewChunk.orgsize = ulSize;
+ NewChunk.fKeyFrame = true;
+ m_strms[0]->cs.Add (NewChunk);
+ break;
+ case FCC('01wb') : // 00dc : Audio
+ NewChunk.size = ulSize;
+ NewChunk.orgsize = ulSize;
+ NewChunk.fKeyFrame = true;
+ NewChunk.filepos = GetPos();
+ m_strms[1]->cs.Add (NewChunk);
+ break;
+ }
+ Seek(GetPos() + ulSize);
+ }
+
+ TRACE ("Video packet : %d Audio packet :%d\n", m_strms[0]->cs.GetCount(), m_strms[1]->cs.GetCount());
+ return S_OK;
}
HRESULT CAviFile::Parse(DWORD parentid, __int64 end)
{
- HRESULT hr = S_OK;
-
- CAutoPtr<strm_t> strm;
-
- while(S_OK == hr && GetPos() < end)
- {
- UINT64 pos = GetPos();
-
- DWORD id = 0, size;
- if(S_OK != Read(id) || id == 0)
- return E_FAIL;
-
- if(id == FCC('RIFF') || id == FCC('LIST'))
- {
- if(S_OK != Read(size) || S_OK != Read(id))
- return E_FAIL;
-
- if(m_isamv) size = end - GetPos() - 8; // No size set in AVM : guess end of file...
- size += (size & 1) + 8;
-
- TRACE(_T("CAviFile::Parse(..): LIST '%c%c%c%c'\n"),
- TCHAR((id >> 0) & 0xff),
- TCHAR((id >> 8) & 0xff),
- TCHAR((id >> 16) & 0xff),
- TCHAR((id >> 24) & 0xff));
-
- if(id == FCC('movi'))
- {
- m_movis.AddTail(pos);
- if(m_isamv) BuildAMVIndex();
- }
- else
- {
- hr = Parse(id, pos + size);
- }
- }
- else
- {
- if(S_OK != Read(size))
- return E_FAIL;
-
- TRACE(_T("CAviFile::Parse(..): '%c%c%c%c'\n"),
- TCHAR((id >> 0) & 0xff),
- TCHAR((id >> 8) & 0xff),
- TCHAR((id >> 16) & 0xff),
- TCHAR((id >> 24) & 0xff));
-
- if(parentid == FCC('INFO') && size > 0)
- {
- switch(id)
- {
- case FCC('IARL'): // Archival Location. Indicates where the subject of the file is archived.
- case FCC('IART'): // Artist. Lists the artist of the original subject of the file; for example, “Michaelangelo.”
- case FCC('ICMS'): // Commissioned. Lists the name of the person or organization that commissioned the subject of the file; for example, “Pope Julian II.”
- case FCC('ICMT'): // Comments. Provides general comments about the file or the subject of the file. If the comment is several sentences long, end each sentence with a period. Do not include new-line characters.
- case FCC('ICOP'): // Copyright. Records the copyright information for the file; for example, “Copyright Encyclopedia International 1991.” If there are multiple copyrights, separate them by a semicolon followed by a space.
- case FCC('ICRD'): // Creation date. Specifies the date the subject of the file was created. List dates in year-month-day format, padding one-digit months and days with a zero on the left; for example, “1553-05-03” for May 3, 1553.
- case FCC('ICRP'): // Cropped. Describes whether an image has been cropped and, if so, how it was cropped; for example, “lower-right corner.”
- case FCC('IDIM'): // Dimensions. Specifies the size of the original subject of the file; for example, “8.5 in h, 11 in w.”
- case FCC('IDPI'): // Dots Per Inch. Stores dots per inch setting of the digitizer used to produce the file, such as “300.”
- case FCC('IENG'): // Engineer. Stores the name of the engineer who worked on the file. If there are multiple engineers, separate the names by a semicolon and a blank; for example, “Smith, John; Adams, Joe.”
- case FCC('IGNR'): // Genre. Describes the original work, such as “landscape,” “portrait,” “still life,” etc.
- case FCC('IKEY'): // Keywords. Provides a list of keywords that refer to the file or subject of the file. Separate multiple keywords with a semicolon and a blank; for example, “Seattle; aerial view; scenery.”
- case FCC('ILGT'): // Lightness. Describes the changes in lightness settings on the digitizer required to produce the file. Note that the format of this information depends on hardware used.
- case FCC('IMED'): // Medium. Describes the original subject of the file, such as “computer image,” “drawing,” “lithograph,” and so on.
- case FCC('INAM'): // Name. Stores the title of the subject of the file, such as “Seattle From Above.”
- case FCC('IPLT'): // Palette Setting. Specifies the number of colors requested when digitizing an image, such as “256.”
- case FCC('IPRD'): // Product. Specifies the name of the title the file was originally intended for, such as “Encyclopedia of Pacific Northwest Geography.”
- case FCC('ISBJ'): // Subject. Describes the contents of the file, such as “Aerial view of Seattle.”
- case FCC('ISFT'): // Software. Identifies the name of the software package used to create the file, such as “Microsoft WaveEdit.”
- case FCC('ISHP'): // Sharpness. Identifies the changes in sharpness for the digitizer required to produce the file (the format depends on the hardware used).
- case FCC('ISRC'): // Source. Identifies the name of the person or organization who supplied the original subject of the file; for example, “Trey Research.”
- case FCC('ISRF'): // Source Form. Identifies the original form of the material that was digitized, such as “slide,” “paper,” “map,” and so on. This is not necessarily the same as IMED.
- case FCC('ITCH'): // Technician. Identifies the technician who digitized the subject file; for example, “Smith, John.”
- {
- CStringA str;
- if(S_OK != ByteRead((BYTE*)str.GetBufferSetLength(size), size)) return E_FAIL;
- m_info[id] = str;
- break;
- }
- }
- }
-
- switch(id)
- {
- case FCC('amvh'):
- case FCC('avih'):
- m_avih.fcc = id;
- m_avih.cb = size;
- if(S_OK != Read(m_avih, 8)) return E_FAIL;
- break;
- case FCC('strh'):
- if(!strm) strm.Attach(DNew strm_t());
- strm->strh.fcc = FCC('strh');
- strm->strh.cb = size;
- if(S_OK != Read(strm->strh, 8)) return E_FAIL;
- if(m_isamv)
- {
- // First alway video, second always audio
- strm->strh.fccType = m_strms.GetCount() == 0 ? FCC('vids') : FCC('amva');
- strm->strh.dwRate = m_avih.dwReserved[0] * 1000; // dwReserved[0] = fps!
- strm->strh.dwScale = 1000;
- }
- break;
- case FCC('strn'):
- if(S_OK != ByteRead((BYTE*)strm->strn.GetBufferSetLength(size), size)) return E_FAIL;
- break;
- case FCC('strf'):
- if(!strm) strm.Attach(DNew strm_t());
- strm->strf.SetCount(size);
- if(S_OK != ByteRead(strm->strf.GetData(), size)) return E_FAIL;
- if(m_isamv)
- {
- if(strm->strh.fccType == FCC('vids'))
- {
- strm->strf.SetCount(sizeof(BITMAPINFOHEADER));
- BITMAPINFOHEADER* pbmi = &((BITMAPINFO*)strm->strf.GetData())->bmiHeader;
- pbmi->biSize = sizeof(BITMAPINFOHEADER);
- pbmi->biHeight = m_avih.dwHeight;
- pbmi->biWidth = m_avih.dwWidth;
- pbmi->biCompression = FCC('AMVV');
- pbmi->biPlanes = 1;
- pbmi->biBitCount = 24;
- pbmi->biSizeImage = pbmi->biHeight * pbmi->biWidth * (pbmi->biBitCount / 8);
- }
- m_strms.Add(strm);
- }
-
- break;
- case FCC('indx'):
- if(!strm) strm.Attach(DNew strm_t());
- ASSERT(strm->indx == NULL);
- AVISUPERINDEX* pSuperIndex;
- if(size < MAXDWORD - 8)
- {
- // Fix buffer overrun vulnerability : http://www.vulnhunt.com/advisories/CAL-20070912-1_Multiple_vendor_produce_handling_AVI_file_vulnerabilities.txt
- TRY
- {
- pSuperIndex = (AVISUPERINDEX*)DNew unsigned char [(size_t)(size + 8)];
- }
- CATCH(CMemoryException, e)
- {
- pSuperIndex = NULL;
- }
- END_CATCH
- if(pSuperIndex)
- {
- strm->indx.Attach(pSuperIndex);
- strm->indx->fcc = FCC('indx');
- strm->indx->cb = size;
- if(S_OK != ByteRead((BYTE*)(AVISUPERINDEX*)strm->indx + 8, size)) return E_FAIL;
- ASSERT(strm->indx->wLongsPerEntry == 4 && strm->indx->bIndexType == AVI_INDEX_OF_INDEXES);
- }
- }
- break;
- case FCC('dmlh'):
- if(S_OK != Read(m_dmlh)) return E_FAIL;
- break;
- case FCC('vprp'):
+ HRESULT hr = S_OK;
+
+ CAutoPtr<strm_t> strm;
+
+ while(S_OK == hr && GetPos() < end)
+ {
+ UINT64 pos = GetPos();
+
+ DWORD id = 0, size;
+ if(S_OK != Read(id) || id == 0)
+ return E_FAIL;
+
+ if(id == FCC('RIFF') || id == FCC('LIST'))
+ {
+ if(S_OK != Read(size) || S_OK != Read(id))
+ return E_FAIL;
+
+ if (m_isamv) size = end - GetPos() - 8; // No size set in AVM : guess end of file...
+ size += (size&1) + 8;
+
+ TRACE(_T("CAviFile::Parse(..): LIST '%c%c%c%c'\n"),
+ TCHAR((id>>0)&0xff),
+ TCHAR((id>>8)&0xff),
+ TCHAR((id>>16)&0xff),
+ TCHAR((id>>24)&0xff));
+
+ if(id == FCC('movi'))
+ {
+ m_movis.AddTail(pos);
+ if (m_isamv) BuildAMVIndex();
+ }
+ else
+ {
+ hr = Parse(id, pos + size);
+ }
+ }
+ else
+ {
+ if(S_OK != Read(size))
+ return E_FAIL;
+
+ TRACE(_T("CAviFile::Parse(..): '%c%c%c%c'\n"),
+ TCHAR((id>>0)&0xff),
+ TCHAR((id>>8)&0xff),
+ TCHAR((id>>16)&0xff),
+ TCHAR((id>>24)&0xff));
+
+ if(parentid == FCC('INFO') && size > 0)
+ {
+ switch(id)
+ {
+ case FCC('IARL'): // Archival Location. Indicates where the subject of the file is archived.
+ case FCC('IART'): // Artist. Lists the artist of the original subject of the file; for example, “Michaelangelo.”
+ case FCC('ICMS'): // Commissioned. Lists the name of the person or organization that commissioned the subject of the file; for example, “Pope Julian II.”
+ case FCC('ICMT'): // Comments. Provides general comments about the file or the subject of the file. If the comment is several sentences long, end each sentence with a period. Do not include new-line characters.
+ case FCC('ICOP'): // Copyright. Records the copyright information for the file; for example, “Copyright Encyclopedia International 1991.” If there are multiple copyrights, separate them by a semicolon followed by a space.
+ case FCC('ICRD'): // Creation date. Specifies the date the subject of the file was created. List dates in year-month-day format, padding one-digit months and days with a zero on the left; for example, “1553-05-03” for May 3, 1553.
+ case FCC('ICRP'): // Cropped. Describes whether an image has been cropped and, if so, how it was cropped; for example, “lower-right corner.”
+ case FCC('IDIM'): // Dimensions. Specifies the size of the original subject of the file; for example, “8.5 in h, 11 in w.”
+ case FCC('IDPI'): // Dots Per Inch. Stores dots per inch setting of the digitizer used to produce the file, such as “300.”
+ case FCC('IENG'): // Engineer. Stores the name of the engineer who worked on the file. If there are multiple engineers, separate the names by a semicolon and a blank; for example, “Smith, John; Adams, Joe.”
+ case FCC('IGNR'): // Genre. Describes the original work, such as “landscape,” “portrait,” “still life,” etc.
+ case FCC('IKEY'): // Keywords. Provides a list of keywords that refer to the file or subject of the file. Separate multiple keywords with a semicolon and a blank; for example, “Seattle; aerial view; scenery.”
+ case FCC('ILGT'): // Lightness. Describes the changes in lightness settings on the digitizer required to produce the file. Note that the format of this information depends on hardware used.
+ case FCC('IMED'): // Medium. Describes the original subject of the file, such as “computer image,” “drawing,” “lithograph,” and so on.
+ case FCC('INAM'): // Name. Stores the title of the subject of the file, such as “Seattle From Above.”
+ case FCC('IPLT'): // Palette Setting. Specifies the number of colors requested when digitizing an image, such as “256.”
+ case FCC('IPRD'): // Product. Specifies the name of the title the file was originally intended for, such as “Encyclopedia of Pacific Northwest Geography.”
+ case FCC('ISBJ'): // Subject. Describes the contents of the file, such as “Aerial view of Seattle.”
+ case FCC('ISFT'): // Software. Identifies the name of the software package used to create the file, such as “Microsoft WaveEdit.”
+ case FCC('ISHP'): // Sharpness. Identifies the changes in sharpness for the digitizer required to produce the file (the format depends on the hardware used).
+ case FCC('ISRC'): // Source. Identifies the name of the person or organization who supplied the original subject of the file; for example, “Trey Research.”
+ case FCC('ISRF'): // Source Form. Identifies the original form of the material that was digitized, such as “slide,” “paper,” “map,” and so on. This is not necessarily the same as IMED.
+ case FCC('ITCH'): // Technician. Identifies the technician who digitized the subject file; for example, “Smith, John.”
+ {
+ CStringA str;
+ if(S_OK != ByteRead((BYTE*)str.GetBufferSetLength(size), size)) return E_FAIL;
+ m_info[id] = str;
+ break;
+ }
+ }
+ }
+
+ switch(id)
+ {
+ case FCC('amvh'):
+ case FCC('avih'):
+ m_avih.fcc = id;
+ m_avih.cb = size;
+ if(S_OK != Read(m_avih, 8)) return E_FAIL;
+ break;
+ case FCC('strh'):
+ if(!strm) strm.Attach(DNew strm_t());
+ strm->strh.fcc = FCC('strh');
+ strm->strh.cb = size;
+ if(S_OK != Read(strm->strh, 8)) return E_FAIL;
+ if (m_isamv)
+ {
+ // First alway video, second always audio
+ strm->strh.fccType = m_strms.GetCount() == 0 ? FCC('vids') : FCC('amva');
+ strm->strh.dwRate = m_avih.dwReserved[0]*1000; // dwReserved[0] = fps!
+ strm->strh.dwScale = 1000;
+ }
+ break;
+ case FCC('strn'):
+ if(S_OK != ByteRead((BYTE*)strm->strn.GetBufferSetLength(size), size)) return E_FAIL;
+ break;
+ case FCC('strf'):
+ if(!strm) strm.Attach(DNew strm_t());
+ strm->strf.SetCount(size);
+ if(S_OK != ByteRead(strm->strf.GetData(), size)) return E_FAIL;
+ if (m_isamv)
+ {
+ if (strm->strh.fccType == FCC('vids'))
+ {
+ strm->strf.SetCount(sizeof(BITMAPINFOHEADER));
+ BITMAPINFOHEADER* pbmi = &((BITMAPINFO*)strm->strf.GetData())->bmiHeader;
+ pbmi->biSize = sizeof(BITMAPINFOHEADER);
+ pbmi->biHeight = m_avih.dwHeight;
+ pbmi->biWidth = m_avih.dwWidth;
+ pbmi->biCompression = FCC('AMVV');
+ pbmi->biPlanes = 1;
+ pbmi->biBitCount = 24;
+ pbmi->biSizeImage = pbmi->biHeight * pbmi->biWidth * (pbmi->biBitCount/8);
+ }
+ m_strms.Add(strm);
+ }
+
+ break;
+ case FCC('indx'):
+ if(!strm) strm.Attach(DNew strm_t());
+ ASSERT(strm->indx == NULL);
+ AVISUPERINDEX* pSuperIndex;
+ if (size < MAXDWORD-8)
+ {
+ // Fix buffer overrun vulnerability : http://www.vulnhunt.com/advisories/CAL-20070912-1_Multiple_vendor_produce_handling_AVI_file_vulnerabilities.txt
+ TRY
+ {
+ pSuperIndex = (AVISUPERINDEX*)DNew unsigned char [(size_t)(size + 8)];
+ }
+ CATCH (CMemoryException, e)
+ {
+ pSuperIndex = NULL;
+ }
+ END_CATCH
+ if (pSuperIndex)
+ {
+ strm->indx.Attach(pSuperIndex);
+ strm->indx->fcc = FCC('indx');
+ strm->indx->cb = size;
+ if(S_OK != ByteRead((BYTE*)(AVISUPERINDEX*)strm->indx + 8, size)) return E_FAIL;
+ ASSERT(strm->indx->wLongsPerEntry == 4 && strm->indx->bIndexType == AVI_INDEX_OF_INDEXES);
+ }
+ }
+ break;
+ case FCC('dmlh'):
+ if(S_OK != Read(m_dmlh)) return E_FAIL;
+ break;
+ case FCC('vprp'):
// if(S_OK != Read(m_vprp)) return E_FAIL;
- break;
- case FCC('idx1'):
- ASSERT(m_idx1 == NULL);
- m_idx1.Attach((AVIOLDINDEX*)DNew BYTE[size + 8]);
- m_idx1->fcc = FCC('idx1');
- m_idx1->cb = size;
- if(S_OK != ByteRead((BYTE*)(AVIOLDINDEX*)m_idx1 + 8, size)) return E_FAIL;
- break;
- default :
- TRACE(_T("CAviFile::Parse(..): unknown tag '%c%c%c%c'\n"),
- TCHAR((id >> 0) & 0xff),
- TCHAR((id >> 8) & 0xff),
- TCHAR((id >> 16) & 0xff),
- TCHAR((id >> 24) & 0xff));
- break;
- }
-
- size += (size & 1) + 8;
- }
-
- Seek(pos + size);
- }
-
- if(strm) m_strms.Add(strm);
-
- return hr;
+ break;
+ case FCC('idx1'):
+ ASSERT(m_idx1 == NULL);
+ m_idx1.Attach((AVIOLDINDEX*)DNew BYTE[size + 8]);
+ m_idx1->fcc = FCC('idx1');
+ m_idx1->cb = size;
+ if(S_OK != ByteRead((BYTE*)(AVIOLDINDEX*)m_idx1 + 8, size)) return E_FAIL;
+ break;
+ default :
+ TRACE(_T("CAviFile::Parse(..): unknown tag '%c%c%c%c'\n"),
+ TCHAR((id>>0)&0xff),
+ TCHAR((id>>8)&0xff),
+ TCHAR((id>>16)&0xff),
+ TCHAR((id>>24)&0xff));
+ break;
+ }
+
+ size += (size&1) + 8;
+ }
+
+ Seek(pos + size);
+ }
+
+ if(strm) m_strms.Add(strm);
+
+ return hr;
}
REFERENCE_TIME CAviFile::GetTotalTime()
{
- REFERENCE_TIME t = 0/*10i64*m_avih.dwMicroSecPerFrame*m_avih.dwTotalFrames*/;
+ REFERENCE_TIME t = 0/*10i64*m_avih.dwMicroSecPerFrame*m_avih.dwTotalFrames*/;
- for(int i = 0; i < (int)m_avih.dwStreams; i++)
- {
- strm_t* s = m_strms[i];
- REFERENCE_TIME t2 = s->GetRefTime(s->cs.GetCount(), s->totalsize);
- t = max(t, t2);
- }
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ {
+ strm_t* s = m_strms[i];
+ REFERENCE_TIME t2 = s->GetRefTime(s->cs.GetCount(), s->totalsize);
+ t = max(t, t2);
+ }
- if(t == 0) t = 10i64 * m_avih.dwMicroSecPerFrame * m_avih.dwTotalFrames;
+ if(t == 0) t = 10i64*m_avih.dwMicroSecPerFrame*m_avih.dwTotalFrames;
- return(t);
+ return(t);
}
HRESULT CAviFile::BuildIndex()
{
- EmptyIndex();
-
- int nSuperIndexes = 0;
-
- for(int i = 0; i < (int)m_avih.dwStreams; i++)
- {
- strm_t* s = m_strms[i];
- if(s->indx && s->indx->nEntriesInUse > 0) nSuperIndexes++;
- }
-
- if(nSuperIndexes == m_avih.dwStreams)
- {
- for(int i = 0; i < (int)m_avih.dwStreams; i++)
- {
- strm_t* s = m_strms[i];
-
- AVISUPERINDEX* idx = (AVISUPERINDEX*)s->indx;
-
- DWORD nEntriesInUse = 0;
-
- for(int j = 0; j < (int)idx->nEntriesInUse; j++)
- {
- Seek(idx->aIndex[j].qwOffset);
-
- AVISTDINDEX stdidx;
- if(S_OK != ByteRead((BYTE*)&stdidx, FIELD_OFFSET(AVISTDINDEX, aIndex)))
- {
- EmptyIndex();
- return E_FAIL;
- }
-
- nEntriesInUse += stdidx.nEntriesInUse;
- }
-
- s->cs.SetCount(nEntriesInUse);
-
- DWORD frame = 0;
- UINT64 size = 0;
-
- for(int j = 0; j < (int)idx->nEntriesInUse; j++)
- {
- Seek(idx->aIndex[j].qwOffset);
-
- CAutoPtr<AVISTDINDEX> p((AVISTDINDEX*)DNew BYTE[idx->aIndex[j].dwSize]);
- if(!p || S_OK != ByteRead((BYTE*)(AVISTDINDEX*)p, idx->aIndex[j].dwSize))
- {
- EmptyIndex();
- return E_FAIL;
- }
-
- for(int k = 0, l = 0; k < (int)p->nEntriesInUse; k++)
- {
- s->cs[frame].size = size;
- s->cs[frame].filepos = p->qwBaseOffset + p->aIndex[k].dwOffset;
- s->cs[frame].fKeyFrame = !(p->aIndex[k].dwSize & AVISTDINDEX_DELTAFRAME)
- || s->strh.fccType == FCC('auds');
- s->cs[frame].fChunkHdr = false;
- s->cs[frame].orgsize = p->aIndex[k].dwSize & AVISTDINDEX_SIZEMASK;
-
- if(m_idx1)
- {
- s->cs[frame].filepos -= 8;
- s->cs[frame].fChunkHdr = true;
- }
-
- frame++;
- size += s->GetChunkSize(p->aIndex[k].dwSize & AVISTDINDEX_SIZEMASK);
- }
- }
-
- s->totalsize = size;
- }
- }
- else if(AVIOLDINDEX* idx = m_idx1)
- {
- int len = idx->cb / sizeof(idx->aIndex[0]);
-
- UINT64 offset = m_movis.GetHead() + 8;
-
- for(int i = 0; i < (int)m_avih.dwStreams; i++)
- {
- strm_t* s = m_strms[i];
-
- int nFrames = 0;
-
- for(int j = 0; j < len; j++)
- {
- if(TRACKNUM(idx->aIndex[j].dwChunkId) == i)
- nFrames++;
- }
-
- s->cs.SetCount(nFrames);
-
- DWORD frame = 0;
- UINT64 size = 0;
-
- for(int j = 0, k = 0; j < len; j++)
- {
- DWORD TrackNumber = TRACKNUM(idx->aIndex[j].dwChunkId);
-
- if(TrackNumber == i)
- {
- if(j == 0 && idx->aIndex[j].dwOffset > offset)
- {
- DWORD id;
- Seek(offset + idx->aIndex[j].dwOffset);
- Read(id);
- if(id != idx->aIndex[j].dwChunkId)
- {
- TRACE(_T("WARNING: CAviFile::Init() detected absolute chunk addressing in \'idx1\'"));
- offset = 0;
- }
- }
-
- s->cs[frame].size = size;
- s->cs[frame].filepos = offset + idx->aIndex[j].dwOffset;
- s->cs[frame].fKeyFrame = !!(idx->aIndex[j].dwFlags & AVIIF_KEYFRAME)
- || s->strh.fccType == FCC('auds') // FIXME: some audio index is without any kf flag
- || frame == 0; // grrr
- s->cs[frame].fChunkHdr = j == len - 1 || idx->aIndex[j].dwOffset != idx->aIndex[j+1].dwOffset;
- s->cs[frame].orgsize = idx->aIndex[j].dwSize;
-
- frame++;
- size += s->GetChunkSize(idx->aIndex[j].dwSize);
- }
- }
-
- s->totalsize = size;
- }
- }
-
- m_idx1.Free();
- for(int i = 0; i < (int)m_avih.dwStreams; i++)
- m_strms[i]->indx.Free();
-
- return S_OK;
+ EmptyIndex();
+
+ int nSuperIndexes = 0;
+
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ {
+ strm_t* s = m_strms[i];
+ if(s->indx && s->indx->nEntriesInUse > 0) nSuperIndexes++;
+ }
+
+ if(nSuperIndexes == m_avih.dwStreams)
+ {
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ {
+ strm_t* s = m_strms[i];
+
+ AVISUPERINDEX* idx = (AVISUPERINDEX*)s->indx;
+
+ DWORD nEntriesInUse = 0;
+
+ for(int j = 0; j < (int)idx->nEntriesInUse; j++)
+ {
+ Seek(idx->aIndex[j].qwOffset);
+
+ AVISTDINDEX stdidx;
+ if(S_OK != ByteRead((BYTE*)&stdidx, FIELD_OFFSET(AVISTDINDEX, aIndex)))
+ {
+ EmptyIndex();
+ return E_FAIL;
+ }
+
+ nEntriesInUse += stdidx.nEntriesInUse;
+ }
+
+ s->cs.SetCount(nEntriesInUse);
+
+ DWORD frame = 0;
+ UINT64 size = 0;
+
+ for(int j = 0; j < (int)idx->nEntriesInUse; j++)
+ {
+ Seek(idx->aIndex[j].qwOffset);
+
+ CAutoPtr<AVISTDINDEX> p((AVISTDINDEX*)DNew BYTE[idx->aIndex[j].dwSize]);
+ if(!p || S_OK != ByteRead((BYTE*)(AVISTDINDEX*)p, idx->aIndex[j].dwSize))
+ {
+ EmptyIndex();
+ return E_FAIL;
+ }
+
+ for(int k = 0, l = 0; k < (int)p->nEntriesInUse; k++)
+ {
+ s->cs[frame].size = size;
+ s->cs[frame].filepos = p->qwBaseOffset + p->aIndex[k].dwOffset;
+ s->cs[frame].fKeyFrame = !(p->aIndex[k].dwSize&AVISTDINDEX_DELTAFRAME)
+ || s->strh.fccType == FCC('auds');
+ s->cs[frame].fChunkHdr = false;
+ s->cs[frame].orgsize = p->aIndex[k].dwSize&AVISTDINDEX_SIZEMASK;
+
+ if(m_idx1)
+ {
+ s->cs[frame].filepos -= 8;
+ s->cs[frame].fChunkHdr = true;
+ }
+
+ frame++;
+ size += s->GetChunkSize(p->aIndex[k].dwSize&AVISTDINDEX_SIZEMASK);
+ }
+ }
+
+ s->totalsize = size;
+ }
+ }
+ else if(AVIOLDINDEX* idx = m_idx1)
+ {
+ int len = idx->cb/sizeof(idx->aIndex[0]);
+
+ UINT64 offset = m_movis.GetHead() + 8;
+
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ {
+ strm_t* s = m_strms[i];
+
+ int nFrames = 0;
+
+ for(int j = 0; j < len; j++)
+ {
+ if(TRACKNUM(idx->aIndex[j].dwChunkId) == i)
+ nFrames++;
+ }
+
+ s->cs.SetCount(nFrames);
+
+ DWORD frame = 0;
+ UINT64 size = 0;
+
+ for(int j = 0, k = 0; j < len; j++)
+ {
+ DWORD TrackNumber = TRACKNUM(idx->aIndex[j].dwChunkId);
+
+ if(TrackNumber == i)
+ {
+ if(j == 0 && idx->aIndex[j].dwOffset > offset)
+ {
+ DWORD id;
+ Seek(offset + idx->aIndex[j].dwOffset);
+ Read(id);
+ if(id != idx->aIndex[j].dwChunkId)
+ {
+ TRACE(_T("WARNING: CAviFile::Init() detected absolute chunk addressing in \'idx1\'"));
+ offset = 0;
+ }
+ }
+
+ s->cs[frame].size = size;
+ s->cs[frame].filepos = offset + idx->aIndex[j].dwOffset;
+ s->cs[frame].fKeyFrame = !!(idx->aIndex[j].dwFlags&AVIIF_KEYFRAME)
+ || s->strh.fccType == FCC('auds') // FIXME: some audio index is without any kf flag
+ || frame == 0; // grrr
+ s->cs[frame].fChunkHdr = j == len-1 || idx->aIndex[j].dwOffset != idx->aIndex[j+1].dwOffset;
+ s->cs[frame].orgsize = idx->aIndex[j].dwSize;
+
+ frame++;
+ size += s->GetChunkSize(idx->aIndex[j].dwSize);
+ }
+ }
+
+ s->totalsize = size;
+ }
+ }
+
+ m_idx1.Free();
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ m_strms[i]->indx.Free();
+
+ return S_OK;
}
void CAviFile::EmptyIndex()
{
- for(int i = 0; i < (int)m_avih.dwStreams; i++)
- {
- strm_t* s = m_strms[i];
- s->cs.RemoveAll();
- s->totalsize = 0;
- }
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ {
+ strm_t* s = m_strms[i];
+ s->cs.RemoveAll();
+ s->totalsize = 0;
+ }
}
bool CAviFile::IsInterleaved(bool fKeepInfo)
{
- if(m_strms.GetCount() < 2)
- return(true);
- /*
- if(m_avih.dwFlags&AVIF_ISINTERLEAVED) // not reliable, nandub can write f*cked up files and still sets it
- return(true);
- */
- for(int i = 0; i < (int)m_avih.dwStreams; i++)
- m_strms[i]->cs2.SetCount(m_strms[i]->cs.GetCount());
-
- DWORD* curchunks = DNew DWORD[m_avih.dwStreams];
- UINT64* cursizes = DNew UINT64[m_avih.dwStreams];
-
- memset(curchunks, 0, sizeof(DWORD)*m_avih.dwStreams);
- memset(cursizes, 0, sizeof(UINT64)*m_avih.dwStreams);
-
- int end = 0;
-
- while(1)
- {
- UINT64 fpmin = _I64_MAX;
-
- DWORD n = -1;
- for(int i = 0; i < (int)m_avih.dwStreams; i++)
- {
- int curchunk = curchunks[i];
- CAtlArray<strm_t::chunk>& cs = m_strms[i]->cs;
- if(curchunk >= cs.GetCount()) continue;
+ if(m_strms.GetCount() < 2)
+ return(true);
+/*
+ if(m_avih.dwFlags&AVIF_ISINTERLEAVED) // not reliable, nandub can write f*cked up files and still sets it
+ return(true);
+*/
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ m_strms[i]->cs2.SetCount(m_strms[i]->cs.GetCount());
+
+ DWORD* curchunks = DNew DWORD[m_avih.dwStreams];
+ UINT64* cursizes = DNew UINT64[m_avih.dwStreams];
+
+ memset(curchunks, 0, sizeof(DWORD)*m_avih.dwStreams);
+ memset(cursizes, 0, sizeof(UINT64)*m_avih.dwStreams);
+
+ int end = 0;
+
+ while(1)
+ {
+ UINT64 fpmin = _I64_MAX;
+
+ DWORD n = -1;
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ {
+ int curchunk = curchunks[i];
+ CAtlArray<strm_t::chunk>& cs = m_strms[i]->cs;
+ if(curchunk >= cs.GetCount()) continue;
UINT64 fp = cs[curchunk].filepos;
- if(fp < fpmin)
- {
- fpmin = fp;
- n = i;
- }
- }
- if(n == -1) break;
-
- strm_t* s = m_strms[n];
- DWORD& curchunk = curchunks[n];
- UINT64& cursize = cursizes[n];
-
- if(!s->IsRawSubtitleStream())
- {
- strm_t::chunk2& cs2 = s->cs2[curchunk];
- cs2.t = (DWORD)(s->GetRefTime(curchunk, cursize) >> 13); // for comparing later it is just as good as /10000 to get a near [ms] accuracy
+ if(fp < fpmin) {fpmin = fp; n = i;}
+ }
+ if(n == -1) break;
+
+ strm_t* s = m_strms[n];
+ DWORD& curchunk = curchunks[n];
+ UINT64& cursize = cursizes[n];
+
+ if(!s->IsRawSubtitleStream())
+ {
+ strm_t::chunk2& cs2 = s->cs2[curchunk];
+ cs2.t = (DWORD)(s->GetRefTime(curchunk, cursize)>>13); // for comparing later it is just as good as /10000 to get a near [ms] accuracy
// cs2.t = (DWORD)(s->GetRefTime(curchunk, cursize)/10000);
- cs2.n = end++;
- }
+ cs2.n = end++;
+ }
- cursize = s->cs[curchunk].size;
- curchunk++;
- }
+ cursize = s->cs[curchunk].size;
+ curchunk++;
+ }
- memset(curchunks, 0, sizeof(DWORD)*m_avih.dwStreams);
+ memset(curchunks, 0, sizeof(DWORD)*m_avih.dwStreams);
- strm_t::chunk2 cs2last = { -1, 0};
+ strm_t::chunk2 cs2last = {-1, 0};
- bool fInterleaved = true;
+ bool fInterleaved = true;
- while(fInterleaved)
- {
- strm_t::chunk2 cs2min = {LONG_MAX, LONG_MAX};
+ while(fInterleaved)
+ {
+ strm_t::chunk2 cs2min = {LONG_MAX, LONG_MAX};
- int n = -1;
- for(int i = 0; i < (int)m_avih.dwStreams; i++)
- {
- int curchunk = curchunks[i];
- if(curchunk >= m_strms[i]->cs2.GetCount()) continue;
- strm_t::chunk2& cs2 = m_strms[i]->cs2[curchunk];
- if(cs2.t < cs2min.t)
- {
- cs2min = cs2;
- n = i;
- }
- }
- if(n == -1) break;
+ int n = -1;
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ {
+ int curchunk = curchunks[i];
+ if(curchunk >= m_strms[i]->cs2.GetCount()) continue;
+ strm_t::chunk2& cs2 = m_strms[i]->cs2[curchunk];
+ if(cs2.t < cs2min.t) {cs2min = cs2; n = i;}
+ }
+ if(n == -1) break;
- curchunks[n]++;
+ curchunks[n]++;
- if(cs2last.t >= 0 && abs((int)cs2min.n - (int)cs2last.n) >= 1000)
- fInterleaved = false;
+ if(cs2last.t >= 0 && abs((int)cs2min.n - (int)cs2last.n) >= 1000)
+ fInterleaved = false;
- cs2last = cs2min;
- }
+ cs2last = cs2min;
+ }
- delete [] curchunks;
- delete [] cursizes;
+ delete [] curchunks;
+ delete [] cursizes;
- if(fInterleaved && !fKeepInfo)
- {
- // this is not needed anymore, let's save a little memory then
- for(int i = 0; i < (int)m_avih.dwStreams; i++)
- m_strms[i]->cs2.RemoveAll();
- }
+ if(fInterleaved && !fKeepInfo)
+ {
+ // this is not needed anymore, let's save a little memory then
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ m_strms[i]->cs2.RemoveAll();
+ }
- return(fInterleaved);
+ return(fInterleaved);
}
REFERENCE_TIME CAviFile::strm_t::GetRefTime(DWORD frame, UINT64 size)
{
- float dframe = frame;
+ float dframe = frame;
- if(strh.fccType == FCC('auds'))
- {
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)strf.GetData();
+ if(strh.fccType == FCC('auds'))
+ {
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)strf.GetData();
- dframe = wfe->nBlockAlign ? 1.0f * size / wfe->nBlockAlign : 0;
- }
+ dframe = wfe->nBlockAlign ? 1.0f * size / wfe->nBlockAlign : 0;
+ }
- float scale_per_rate = strh.dwRate ? 1.0f * strh.dwScale / strh.dwRate : 0;
+ float scale_per_rate = strh.dwRate ? 1.0f * strh.dwScale / strh.dwRate : 0;
- return (REFERENCE_TIME)(scale_per_rate * dframe * 10000000 + 0.5f);
+ return (REFERENCE_TIME)(scale_per_rate * dframe * 10000000 + 0.5f);
}
int CAviFile::strm_t::GetFrame(REFERENCE_TIME rt)
{
- int frame = -1;
+ int frame = -1;
- float rate_per_scale = strh.dwScale ? 1.0f * strh.dwRate / strh.dwScale : 0;
+ float rate_per_scale = strh.dwScale ? 1.0f * strh.dwRate / strh.dwScale : 0;
- if(strh.fccType == FCC('auds'))
- {
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)strf.GetData();
+ if(strh.fccType == FCC('auds'))
+ {
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)strf.GetData();
- __int64 size = (__int64)(rate_per_scale * wfe->nBlockAlign * rt / 10000000 + 0.5f);
+ __int64 size = (__int64)(rate_per_scale * wfe->nBlockAlign * rt / 10000000 + 0.5f);
- for(frame = 0; frame < cs.GetCount(); frame++)
- {
- if(cs[frame].size > size)
- {
- frame--;
- break;
- }
- }
- }
- else
- {
- frame = (int)(rate_per_scale * rt / 10000000 + 0.5f);
- }
+ for(frame = 0; frame < cs.GetCount(); frame++)
+ {
+ if(cs[frame].size > size)
+ {
+ frame--;
+ break;
+ }
+ }
+ }
+ else
+ {
+ frame = (int)(rate_per_scale * rt / 10000000 + 0.5f);
+ }
- if(frame >= cs.GetCount()) frame = cs.GetCount() - 1;
+ if(frame >= cs.GetCount()) frame = cs.GetCount()-1;
- return frame;
+ return frame;
}
int CAviFile::strm_t::GetKeyFrame(REFERENCE_TIME rt)
{
- int i = GetFrame(rt);
- for(; i > 0; i--)
- {
- if(cs[i].fKeyFrame) break;
- }
- return(i);
+ int i = GetFrame(rt);
+ for(; i > 0; i--) {if(cs[i].fKeyFrame) break;}
+ return(i);
}
DWORD CAviFile::strm_t::GetChunkSize(DWORD size)
{
- if(strh.fccType == FCC('auds'))
- {
- WORD nBlockAlign = ((WAVEFORMATEX*)strf.GetData())->nBlockAlign;
- size = nBlockAlign ? (size + (nBlockAlign - 1)) / nBlockAlign * nBlockAlign : 0; // round up for nando's vbr hack
- }
+ if(strh.fccType == FCC('auds'))
+ {
+ WORD nBlockAlign = ((WAVEFORMATEX*)strf.GetData())->nBlockAlign;
+ size = nBlockAlign ? (size + (nBlockAlign-1)) / nBlockAlign * nBlockAlign : 0; // round up for nando's vbr hack
+ }
- return size;
+ return size;
}
bool CAviFile::strm_t::IsRawSubtitleStream()
{
- return strh.fccType == FCC('txts') && cs.GetCount() == 1;
+ return strh.fccType == FCC('txts') && cs.GetCount() == 1;
}
diff --git a/src/filters/parser/AviSplitter/AviFile.h b/src/filters/parser/AviSplitter/AviFile.h
index 5d7a8ddb0..6ef8cf9d3 100644
--- a/src/filters/parser/AviSplitter/AviFile.h
+++ b/src/filters/parser/AviSplitter/AviFile.h
@@ -5,62 +5,50 @@
class CAviFile : public CBaseSplitterFile
{
- HRESULT Init();
- HRESULT Parse(DWORD parentid, __int64 end);
- HRESULT BuildAMVIndex();
+ HRESULT Init();
+ HRESULT Parse(DWORD parentid, __int64 end);
+ HRESULT BuildAMVIndex();
public:
- CAviFile(IAsyncReader* pAsyncReader, HRESULT& hr);
+ CAviFile(IAsyncReader* pAsyncReader, HRESULT& hr);
- //using CBaseSplitterFile::Read;
- template<typename T> HRESULT Read(T& var, int offset = 0);
+ //using CBaseSplitterFile::Read;
+ template<typename T> HRESULT Read(T& var, int offset = 0);
- AVIMAINHEADER m_avih;
- struct ODMLExtendedAVIHeader
- {
- DWORD dwTotalFrames;
- } m_dmlh;
+ AVIMAINHEADER m_avih;
+ struct ODMLExtendedAVIHeader {DWORD dwTotalFrames;} m_dmlh;
// VideoPropHeader m_vprp;
- struct strm_t
- {
- AVISTREAMHEADER strh;
- CAtlArray<BYTE> strf;
- CStringA strn;
- CAutoPtr<AVISUPERINDEX> indx;
- struct chunk
- {
- UINT64 fKeyFrame: 1, fChunkHdr: 1, size: 62;
- UINT64 filepos;
- DWORD orgsize;
- };
- CAtlArray<chunk> cs;
- UINT64 totalsize;
- REFERENCE_TIME GetRefTime(DWORD frame, UINT64 size);
- int GetTime(DWORD frame, UINT64 size);
- int GetFrame(REFERENCE_TIME rt);
- int GetKeyFrame(REFERENCE_TIME rt);
- DWORD GetChunkSize(DWORD size);
- bool IsRawSubtitleStream();
-
- // tmp
- struct chunk2
- {
- DWORD t;
- DWORD n;
- };
- CAtlArray<chunk2> cs2;
- };
- CAutoPtrArray<strm_t> m_strms;
- CAtlMap<DWORD, CStringA> m_info;
- CAutoPtr<AVIOLDINDEX> m_idx1;
-
- CAtlList<UINT64> m_movis;
- bool m_isamv;
-
- REFERENCE_TIME GetTotalTime();
- HRESULT BuildIndex();
- void EmptyIndex();
- bool IsInterleaved(bool fKeepInfo = false);
+ struct strm_t
+ {
+ AVISTREAMHEADER strh;
+ CAtlArray<BYTE> strf;
+ CStringA strn;
+ CAutoPtr<AVISUPERINDEX> indx;
+ struct chunk {UINT64 fKeyFrame:1, fChunkHdr:1, size:62; UINT64 filepos; DWORD orgsize;};
+ CAtlArray<chunk> cs;
+ UINT64 totalsize;
+ REFERENCE_TIME GetRefTime(DWORD frame, UINT64 size);
+ int GetTime(DWORD frame, UINT64 size);
+ int GetFrame(REFERENCE_TIME rt);
+ int GetKeyFrame(REFERENCE_TIME rt);
+ DWORD GetChunkSize(DWORD size);
+ bool IsRawSubtitleStream();
+
+ // tmp
+ struct chunk2 {DWORD t; DWORD n;};
+ CAtlArray<chunk2> cs2;
+ };
+ CAutoPtrArray<strm_t> m_strms;
+ CAtlMap<DWORD, CStringA> m_info;
+ CAutoPtr<AVIOLDINDEX> m_idx1;
+
+ CAtlList<UINT64> m_movis;
+ bool m_isamv;
+
+ REFERENCE_TIME GetTotalTime();
+ HRESULT BuildIndex();
+ void EmptyIndex();
+ bool IsInterleaved(bool fKeepInfo = false);
};
#define TRACKNUM(fcc) (10*((fcc&0xff)-0x30) + (((fcc>>8)&0xff)-0x30))
diff --git a/src/filters/parser/AviSplitter/AviReportWnd.cpp b/src/filters/parser/AviSplitter/AviReportWnd.cpp
index 76e1a0ab4..95a20c668 100644
--- a/src/filters/parser/AviSplitter/AviReportWnd.cpp
+++ b/src/filters/parser/AviSplitter/AviReportWnd.cpp
@@ -7,165 +7,165 @@
CAviReportWnd::CAviReportWnd()
{
- m_font.CreateFont(12, 0, 0, 0, 400, 0, 0, 0, 1, 0, 0, 0, 0, _T("MS Shell Dlg"));
+ m_font.CreateFont(12, 0, 0, 0, 400, 0, 0, 0, 1, 0, 0, 0, 0, _T("MS Shell Dlg"));
}
bool CAviReportWnd::DoModal(CAviFile* pAF, bool fHideChecked, bool fShowWarningText)
{
- m_nChunks = 0;
- m_rtDur = 0;
+ m_nChunks = 0;
+ m_rtDur = 0;
- for(int i = 0; i < (int)pAF->m_avih.dwStreams; i++)
- {
- int cnt = pAF->m_strms[i]->cs2.GetCount();
- if(cnt <= 0) continue;
- CAviFile::strm_t::chunk2& c2 = pAF->m_strms[i]->cs2[cnt-1];
- m_nChunks = max(m_nChunks, c2.n);
- m_rtDur = max(m_rtDur, (REFERENCE_TIME)c2.t << 13);
- }
+ for(int i = 0; i < (int)pAF->m_avih.dwStreams; i++)
+ {
+ int cnt = pAF->m_strms[i]->cs2.GetCount();
+ if(cnt <= 0) continue;
+ CAviFile::strm_t::chunk2& c2 = pAF->m_strms[i]->cs2[cnt-1];
+ m_nChunks = max(m_nChunks, c2.n);
+ m_rtDur = max(m_rtDur, (REFERENCE_TIME)c2.t<<13);
+ }
- CRect r, r2;
- GetDesktopWindow()->GetWindowRect(r);
- r.DeflateRect(r.Width() / 4, r.Height() / 4);
+ CRect r, r2;
+ GetDesktopWindow()->GetWindowRect(r);
+ r.DeflateRect(r.Width()/4, r.Height()/4);
- LPCTSTR wndclass = AfxRegisterWndClass(
- CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS,
- AfxGetApp()->LoadStandardCursor(IDC_ARROW),
- (HBRUSH)(COLOR_BTNFACE + 1), 0);
+ LPCTSTR wndclass = AfxRegisterWndClass(
+ CS_VREDRAW|CS_HREDRAW|CS_DBLCLKS,
+ AfxGetApp()->LoadStandardCursor(IDC_ARROW),
+ (HBRUSH)(COLOR_BTNFACE + 1), 0);
- CreateEx(0, wndclass, TITLE, WS_POPUPWINDOW | WS_CAPTION | WS_CLIPCHILDREN, r, NULL, 0);
+ CreateEx(0, wndclass, TITLE, WS_POPUPWINDOW|WS_CAPTION|WS_CLIPCHILDREN, r, NULL, 0);
- CRect cr;
- GetClientRect(cr);
- cr.DeflateRect(10, 10);
+ CRect cr;
+ GetClientRect(cr);
+ cr.DeflateRect(10, 10);
- SetFont(&m_font, FALSE);
+ SetFont(&m_font, FALSE);
- CDC* pDC = GetDC();
- CFont* pOldFont = pDC->SelectObject(&m_font);
+ CDC* pDC = GetDC();
+ CFont* pOldFont = pDC->SelectObject(&m_font);
- //
+ //
- CString str(
- _T("This AVI file was not prepared for sequential reading, the alternative ")
- _T("'Avi Splitter' will now let the default one handle it. ")
- _T("The complete reinterleaving of this file is strongly recommended before ")
- _T("burning it onto a slow media like cd-rom."));
+ CString str(
+ _T("This AVI file was not prepared for sequential reading, the alternative ")
+ _T("'Avi Splitter' will now let the default one handle it. ")
+ _T("The complete reinterleaving of this file is strongly recommended before ")
+ _T("burning it onto a slow media like cd-rom."));
- r = cr;
+ r = cr;
- pDC->DrawText(str, r, DT_WORDBREAK | DT_CALCRECT);
- r.right = cr.right;
+ pDC->DrawText(str, r, DT_WORDBREAK|DT_CALCRECT);
+ r.right = cr.right;
- m_message.Create(str, WS_CHILD | WS_VISIBLE, r, this);
- m_message.SetFont(&m_font, FALSE);
+ m_message.Create(str, WS_CHILD|WS_VISIBLE, r, this);
+ m_message.SetFont(&m_font, FALSE);
- //
+ //
- r.SetRect(cr.left, r.bottom + 10, cr.right, cr.bottom);
+ r.SetRect(cr.left, r.bottom + 10, cr.right, cr.bottom);
- str = _T("Do not show this dialog again (hold Shift to re-enable it)");
+ str = _T("Do not show this dialog again (hold Shift to re-enable it)");
- pDC->DrawText(str, r, DT_WORDBREAK | DT_CALCRECT);
- r.right = cr.right;
+ pDC->DrawText(str, r, DT_WORDBREAK|DT_CALCRECT);
+ r.right = cr.right;
- m_checkbox.Create(str, WS_CHILD | WS_VISIBLE | BS_CHECKBOX | BS_AUTOCHECKBOX, r, this, IDC_DONOTSHOWAGAINCHECK);
- m_checkbox.SetFont(&m_font, FALSE);
+ m_checkbox.Create(str, WS_CHILD|WS_VISIBLE|BS_CHECKBOX|BS_AUTOCHECKBOX, r, this, IDC_DONOTSHOWAGAINCHECK);
+ m_checkbox.SetFont(&m_font, FALSE);
- CheckDlgButton(IDC_DONOTSHOWAGAINCHECK, fHideChecked ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(IDC_DONOTSHOWAGAINCHECK, fHideChecked?BST_CHECKED:BST_UNCHECKED);
- //
+ //
- if(!fShowWarningText)
- {
- m_message.ShowWindow(SW_HIDE);
- m_checkbox.ShowWindow(SW_HIDE);
- r = cr;
- }
- else
- {
- r.SetRect(cr.left, r.bottom + 10, cr.right, cr.bottom);
- }
+ if(!fShowWarningText)
+ {
+ m_message.ShowWindow(SW_HIDE);
+ m_checkbox.ShowWindow(SW_HIDE);
+ r = cr;
+ }
+ else
+ {
+ r.SetRect(cr.left, r.bottom + 10, cr.right, cr.bottom);
+ }
- m_graph.Create(pAF, r, this);
+ m_graph.Create(pAF, r, this);
- //
+ //
- pDC->SelectObject(pOldFont);
- ReleaseDC(pDC);
+ pDC->SelectObject(pOldFont);
+ ReleaseDC(pDC);
- SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
- SetForegroundWindow();
- ShowWindow(SW_SHOWNORMAL);
+ SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
+ SetForegroundWindow();
+ ShowWindow(SW_SHOWNORMAL);
- return !!RunModalLoop();
+ return !!RunModalLoop();
}
IMPLEMENT_DYNCREATE(CAviReportWnd, CWnd)
BEGIN_MESSAGE_MAP(CAviReportWnd, CWnd)
- ON_WM_CLOSE()
- ON_WM_MOUSEMOVE()
+ ON_WM_CLOSE()
+ ON_WM_MOUSEMOVE()
END_MESSAGE_MAP()
void CAviReportWnd::OnClose()
{
- EndModalLoop(IsDlgButtonChecked(IDC_DONOTSHOWAGAINCHECK));
- __super::OnClose();
+ EndModalLoop(IsDlgButtonChecked(IDC_DONOTSHOWAGAINCHECK));
+ __super::OnClose();
}
void CAviReportWnd::OnMouseMove(UINT nFlags, CPoint p)
{
- MapWindowPoints(&m_graph, &p, 1);
-
- CRect r, r2;
- m_graph.GetClientRect(r);
- r2 = r;
- r.bottom -= GRAPHFOOTER;
- r2.top = r.bottom;
-
- if(r.PtInRect(p))
- {
- SetCapture();
-
- int x = p.x - r.left;
- int y = r.bottom - p.y;
-
- REFERENCE_TIME rt = m_rtDur * x / r.Width();
- int chunk = (int)(1.0 * m_nChunks * y / r.Height());
-
- rt /= 10000;
- int ms = (int)(rt % 1000);
- rt /= 1000;
- int s = (int)(rt % 60);
- rt /= 60;
- int m = (int)(rt % 60);
- rt /= 60;
- int h = (int)(rt);
-
- CString str;
- str.Format(_T("%s (%d - %d:%02d:%02d.%03d)"), TITLE, chunk, h, m, s, ms);
- SetWindowText(str);
- }
- else if(r2.PtInRect(p))
- {
- SetCapture();
-
- int dist = m_graph.GetChunkDist(p.x - r2.left);
- CString str;
- str.Format(_T("%s (chunk distance: %d"), TITLE, dist);
- if(dist >= 1000) str += _T(" - over the limit!");
- str += ")";
- SetWindowText(str);
- }
- else if(GetCapture() == this)
- {
- SetWindowText(TITLE);
-
- ReleaseCapture();
- }
-
- __super::OnMouseMove(nFlags, p);
+ MapWindowPoints(&m_graph, &p, 1);
+
+ CRect r, r2;
+ m_graph.GetClientRect(r);
+ r2 = r;
+ r.bottom -= GRAPHFOOTER;
+ r2.top = r.bottom;
+
+ if(r.PtInRect(p))
+ {
+ SetCapture();
+
+ int x = p.x - r.left;
+ int y = r.bottom - p.y;
+
+ REFERENCE_TIME rt = m_rtDur * x / r.Width();
+ int chunk = (int)(1.0 * m_nChunks * y / r.Height());
+
+ rt /= 10000;
+ int ms = (int)(rt%1000);
+ rt /= 1000;
+ int s = (int)(rt%60);
+ rt /= 60;
+ int m = (int)(rt%60);
+ rt /= 60;
+ int h = (int)(rt);
+
+ CString str;
+ str.Format(_T("%s (%d - %d:%02d:%02d.%03d)"), TITLE, chunk, h, m, s, ms);
+ SetWindowText(str);
+ }
+ else if(r2.PtInRect(p))
+ {
+ SetCapture();
+
+ int dist = m_graph.GetChunkDist(p.x - r2.left);
+ CString str;
+ str.Format(_T("%s (chunk distance: %d"), TITLE, dist);
+ if(dist >= 1000) str += _T(" - over the limit!");
+ str += ")";
+ SetWindowText(str);
+ }
+ else if(GetCapture() == this)
+ {
+ SetWindowText(TITLE);
+
+ ReleaseCapture();
+ }
+
+ __super::OnMouseMove(nFlags, p);
}
//////////////
@@ -176,187 +176,169 @@ CAviPlotterWnd::CAviPlotterWnd()
bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd)
{
- if(!CreateEx(WS_EX_CLIENTEDGE, _T("STATIC"), _T(""), WS_CHILD | WS_VISIBLE, r, pParentWnd, 0))
- return(false);
-
- GetClientRect(r);
- int w = r.Width();
- int h = r.Height() - GRAPHFOOTER;
-
- CDC* pDC = GetDC();
- m_dc.CreateCompatibleDC(pDC);
- m_bm.CreateCompatibleBitmap(pDC, r.Width(), r.Height());
- ReleaseDC(pDC);
-
- CBitmap* pOldBitmap = m_dc.SelectObject(&m_bm);
-
- m_dc.FillSolidRect(r, 0);
-
- {
- CPen pen(PS_DOT, 1, 0x008000);
- CPen* pOldPen = m_dc.SelectObject(&pen);
- for(int y = 0, dy = max(h / 10, 1); y < h; y += dy)
- {
- if(y == 0) continue;
- m_dc.MoveTo(0, y);
- m_dc.LineTo(w, y);
- }
- for(int x = 0, dx = max(w / 10, 1); x < w; x += dx)
- {
- if(x == 0) continue;
- m_dc.MoveTo(x, 0);
- m_dc.LineTo(x, w);
- }
- m_dc.SelectObject(pOldPen);
- }
-
- {
- CPen pen(PS_SOLID, 1, 0x00ff00);
- CPen* pOldPen = m_dc.SelectObject(&pen);
- m_dc.MoveTo(15, 30);
- m_dc.LineTo(15, 2);
- m_dc.LineTo(19, 10);
- m_dc.LineTo(11, 10);
- m_dc.LineTo(15, 2);
- m_dc.MoveTo(w - 30 - 10, h - 15);
- m_dc.LineTo(w - 2 - 10, h - 15);
- m_dc.LineTo(w - 10 - 10, h - 19);
- m_dc.LineTo(w - 10 - 10, h - 11);
- m_dc.LineTo(w - 2 - 10, h - 15);
- m_dc.SelectObject(pOldPen);
-
- m_dc.SetTextColor(0x008000);
- m_dc.TextOut(20, 10, _T("Chunk"));
-
- CSize size = m_dc.GetTextExtent(_T("Time"));
- m_dc.TextOut(w - size.cx - 10, h - size.cy - 20, _T("Time"));
- }
-
- COLORREF clr[] = {0x0000ff, 0xff0000, 0x40ffff, 0xff40ff, 0xffff40, 0xffffff};
-
- for(int i = 0, y = 40, dy = m_dc.GetTextExtent(_T("Stream N")).cy + 1; i < (int)pAF->m_avih.dwStreams; i++, y += dy)
- {
- m_dc.SetTextColor(clr[i%pAF->m_avih.dwStreams]);
- m_dc.SetBkMode(TRANSPARENT);
- CString str;
- str.Format(_T("Stream %d"), i);
- m_dc.TextOut(10, y, str);
- }
-
- DWORD nmax = 0, tmax = 0;
-
- for(int i = 0; i < (int)pAF->m_avih.dwStreams; i++)
- {
- int cnt = pAF->m_strms[i]->cs2.GetCount();
- if(cnt <= 0) continue;
- CAviFile::strm_t::chunk2& c2 = pAF->m_strms[i]->cs2[cnt-1];
- nmax = max(nmax, c2.n);
- tmax = max(tmax, c2.t);
- }
-
- if(nmax > 0 && tmax > 0)
- {
- CAtlArray<CPen> pen;
- pen.SetCount(pAF->m_avih.dwStreams);
- for(int i = 0; i < pen.GetCount(); i++)
- pen[i].CreatePen(PS_SOLID, 2, clr[i]);
-
- CAtlArray<CPoint> pp;
- pp.SetCount(pAF->m_avih.dwStreams);
- for(int i = 0; i < pen.GetCount(); i++)
- pp[i].SetPoint(-1, -1);
-
- m_chunkdist.SetCount(w);
- memset(m_chunkdist.GetData(), 0, sizeof(int)*w);
-
- DWORD* curchunks = DNew DWORD[pAF->m_avih.dwStreams];
- memset(curchunks, 0, sizeof(DWORD)*pAF->m_avih.dwStreams);
-
- CAviFile::strm_t::chunk2 cs2last = { -1, 0};
-
- while(1)
- {
- CAviFile::strm_t::chunk2 cs2min = {LONG_MAX, LONG_MAX};
-
- int n = -1;
- for(int i = 0; i < (int)pAF->m_avih.dwStreams; i++)
- {
- int curchunk = curchunks[i];
- if(curchunk >= pAF->m_strms[i]->cs2.GetCount()) continue;
- CAviFile::strm_t::chunk2& cs2 = pAF->m_strms[i]->cs2[curchunk];
- if(cs2.t < cs2min.t)
- {
- cs2min = cs2;
- n = i;
- }
- }
- if(n == -1) break;
-
-
- CPoint p;
- p.x = (int)(1.0 * w * cs2min.t / tmax);
- p.y = (int)(h - 1.0 * h * cs2min.n / nmax);
- if(pp[n] != p)
- {
- CPen* pOldPen = m_dc.SelectObject(&pen[n]);
- if(pp[n] == CPoint(-1, -1)) m_dc.MoveTo(p);
- else
- {
- m_dc.MoveTo(pp[n]);
- m_dc.LineTo(p);
- }
- m_dc.SelectObject(pOldPen);
- pp[n] = p;
- }
-
- int dist = abs((int)cs2min.n - (int)cs2last.n);
-
- if(cs2last.t >= 0 /*&& dist >= 1000*/)
- {
- if(p.x >= 0 && p.x < w)
- {
- m_chunkdist[p.x] = max(m_chunkdist[p.x], dist);
- }
- }
-
- curchunks[n]++;
- cs2last = cs2min;
- }
-
- CPen red(PS_SOLID, 1, 0x0000ff);
- CPen green(PS_SOLID, 1, 0x00ff00);
-
- for(int x = 0; x < w; x++)
- {
- CPen* pOldPen = m_dc.SelectObject(m_chunkdist[x] >= 1000 ? &red : &green);
- m_dc.MoveTo(x, h);
- m_dc.LineTo(x, h + GRAPHFOOTER);
- m_dc.SelectObject(pOldPen);
- }
-
- delete [] curchunks;
- }
-
- m_dc.SelectObject(pOldBitmap);
-
- return(true);
+ if(!CreateEx(WS_EX_CLIENTEDGE, _T("STATIC"), _T(""), WS_CHILD|WS_VISIBLE, r, pParentWnd, 0))
+ return(false);
+
+ GetClientRect(r);
+ int w = r.Width();
+ int h = r.Height() - GRAPHFOOTER;
+
+ CDC* pDC = GetDC();
+ m_dc.CreateCompatibleDC(pDC);
+ m_bm.CreateCompatibleBitmap(pDC, r.Width(), r.Height());
+ ReleaseDC(pDC);
+
+ CBitmap* pOldBitmap = m_dc.SelectObject(&m_bm);
+
+ m_dc.FillSolidRect(r, 0);
+
+ {
+ CPen pen(PS_DOT, 1, 0x008000);
+ CPen* pOldPen = m_dc.SelectObject(&pen);
+ for(int y = 0, dy = max(h/10,1); y < h; y += dy) {if(y == 0) continue; m_dc.MoveTo(0, y); m_dc.LineTo(w, y);}
+ for(int x = 0, dx = max(w/10,1); x < w; x += dx) {if(x == 0) continue; m_dc.MoveTo(x, 0); m_dc.LineTo(x, w);}
+ m_dc.SelectObject(pOldPen);
+ }
+
+ {
+ CPen pen(PS_SOLID, 1, 0x00ff00);
+ CPen* pOldPen = m_dc.SelectObject(&pen);
+ m_dc.MoveTo(15, 30);
+ m_dc.LineTo(15, 2);
+ m_dc.LineTo(19, 10);
+ m_dc.LineTo(11, 10);
+ m_dc.LineTo(15, 2);
+ m_dc.MoveTo(w-30-10, h-15);
+ m_dc.LineTo(w-2-10, h-15);
+ m_dc.LineTo(w-10-10, h-19);
+ m_dc.LineTo(w-10-10, h-11);
+ m_dc.LineTo(w-2-10, h-15);
+ m_dc.SelectObject(pOldPen);
+
+ m_dc.SetTextColor(0x008000);
+ m_dc.TextOut(20, 10, _T("Chunk"));
+
+ CSize size = m_dc.GetTextExtent(_T("Time"));
+ m_dc.TextOut(w - size.cx - 10, h - size.cy - 20, _T("Time"));
+ }
+
+ COLORREF clr[] = {0x0000ff,0xff0000,0x40ffff,0xff40ff,0xffff40,0xffffff};
+
+ for(int i = 0, y = 40, dy = m_dc.GetTextExtent(_T("Stream N")).cy + 1; i < (int)pAF->m_avih.dwStreams; i++, y += dy)
+ {
+ m_dc.SetTextColor(clr[i%pAF->m_avih.dwStreams]);
+ m_dc.SetBkMode(TRANSPARENT);
+ CString str;
+ str.Format(_T("Stream %d"), i);
+ m_dc.TextOut(10, y, str);
+ }
+
+ DWORD nmax = 0, tmax = 0;
+
+ for(int i = 0; i < (int)pAF->m_avih.dwStreams; i++)
+ {
+ int cnt = pAF->m_strms[i]->cs2.GetCount();
+ if(cnt <= 0) continue;
+ CAviFile::strm_t::chunk2& c2 = pAF->m_strms[i]->cs2[cnt-1];
+ nmax = max(nmax, c2.n);
+ tmax = max(tmax, c2.t);
+ }
+
+ if(nmax > 0 && tmax > 0)
+ {
+ CAtlArray<CPen> pen;
+ pen.SetCount(pAF->m_avih.dwStreams);
+ for(int i = 0; i < pen.GetCount(); i++)
+ pen[i].CreatePen(PS_SOLID, 2, clr[i]);
+
+ CAtlArray<CPoint> pp;
+ pp.SetCount(pAF->m_avih.dwStreams);
+ for(int i = 0; i < pen.GetCount(); i++)
+ pp[i].SetPoint(-1, -1);
+
+ m_chunkdist.SetCount(w);
+ memset(m_chunkdist.GetData(), 0, sizeof(int)*w);
+
+ DWORD* curchunks = DNew DWORD[pAF->m_avih.dwStreams];
+ memset(curchunks, 0, sizeof(DWORD)*pAF->m_avih.dwStreams);
+
+ CAviFile::strm_t::chunk2 cs2last = {-1, 0};
+
+ while(1)
+ {
+ CAviFile::strm_t::chunk2 cs2min = {LONG_MAX, LONG_MAX};
+
+ int n = -1;
+ for(int i = 0; i < (int)pAF->m_avih.dwStreams; i++)
+ {
+ int curchunk = curchunks[i];
+ if(curchunk >= pAF->m_strms[i]->cs2.GetCount()) continue;
+ CAviFile::strm_t::chunk2& cs2 = pAF->m_strms[i]->cs2[curchunk];
+ if(cs2.t < cs2min.t) {cs2min = cs2; n = i;}
+ }
+ if(n == -1) break;
+
+
+ CPoint p;
+ p.x = (int)(1.0 * w * cs2min.t / tmax);
+ p.y = (int)(h - 1.0 * h * cs2min.n / nmax);
+ if(pp[n] != p)
+ {
+ CPen* pOldPen = m_dc.SelectObject(&pen[n]);
+ if(pp[n] == CPoint(-1, -1)) m_dc.MoveTo(p);
+ else {m_dc.MoveTo(pp[n]); m_dc.LineTo(p);}
+ m_dc.SelectObject(pOldPen);
+ pp[n] = p;
+ }
+
+ int dist = abs((int)cs2min.n - (int)cs2last.n);
+
+ if(cs2last.t >= 0 /*&& dist >= 1000*/)
+ {
+ if(p.x >= 0 && p.x < w)
+ {
+ m_chunkdist[p.x] = max(m_chunkdist[p.x], dist);
+ }
+ }
+
+ curchunks[n]++;
+ cs2last = cs2min;
+ }
+
+ CPen red(PS_SOLID, 1, 0x0000ff);
+ CPen green(PS_SOLID, 1, 0x00ff00);
+
+ for(int x = 0; x < w; x++)
+ {
+ CPen* pOldPen = m_dc.SelectObject(m_chunkdist[x] >= 1000 ? &red : &green);
+ m_dc.MoveTo(x, h);
+ m_dc.LineTo(x, h + GRAPHFOOTER);
+ m_dc.SelectObject(pOldPen);
+ }
+
+ delete [] curchunks;
+ }
+
+ m_dc.SelectObject(pOldBitmap);
+
+ return(true);
}
IMPLEMENT_DYNCREATE(CAviPlotterWnd, CWnd)
BEGIN_MESSAGE_MAP(CAviPlotterWnd, CWnd)
- ON_WM_PAINT()
+ ON_WM_PAINT()
END_MESSAGE_MAP()
void CAviPlotterWnd::OnPaint()
{
- CPaintDC dc(this); // device context for painting
+ CPaintDC dc(this); // device context for painting
- CRect r;
- GetClientRect(r);
+ CRect r;
+ GetClientRect(r);
- CBitmap* pOld = m_dc.SelectObject(&m_bm);
- dc.BitBlt(0, 0, r.Width(), r.Height(), &m_dc, 0, 0, SRCCOPY);
- m_dc.SelectObject(pOld);
+ CBitmap* pOld = m_dc.SelectObject(&m_bm);
+ dc.BitBlt(0, 0, r.Width(), r.Height(), &m_dc, 0, 0, SRCCOPY);
+ m_dc.SelectObject(pOld);
}
diff --git a/src/filters/parser/AviSplitter/AviReportWnd.h b/src/filters/parser/AviSplitter/AviReportWnd.h
index cd30807e0..cd5c3b331 100644
--- a/src/filters/parser/AviSplitter/AviReportWnd.h
+++ b/src/filters/parser/AviSplitter/AviReportWnd.h
@@ -4,47 +4,44 @@
class CAviPlotterWnd : public CStatic
{
- DECLARE_DYNCREATE(CAviPlotterWnd)
+ DECLARE_DYNCREATE(CAviPlotterWnd)
private:
- CDC m_dc;
- CBitmap m_bm;
+ CDC m_dc;
+ CBitmap m_bm;
- CAtlArray<int> m_chunkdist;
+ CAtlArray<int> m_chunkdist;
public:
- CAviPlotterWnd();
- bool Create(CAviFile* pAF, CRect r, CWnd* pParentWnd);
+ CAviPlotterWnd();
+ bool Create(CAviFile* pAF, CRect r, CWnd* pParentWnd);
- int GetChunkDist(int x)
- {
- return x >= 0 && x < m_chunkdist.GetCount() ? m_chunkdist[x] : 0;
- }
+ int GetChunkDist(int x) {return x >= 0 && x < m_chunkdist.GetCount() ? m_chunkdist[x] : 0;}
- DECLARE_MESSAGE_MAP()
- afx_msg void OnPaint();
+ DECLARE_MESSAGE_MAP()
+ afx_msg void OnPaint();
};
class CAviReportWnd : public CWnd
{
- DECLARE_DYNCREATE(CAviReportWnd)
+ DECLARE_DYNCREATE(CAviReportWnd)
protected:
- CFont m_font;
- CStatic m_message;
- CButton m_checkbox;
- CAviPlotterWnd m_graph;
+ CFont m_font;
+ CStatic m_message;
+ CButton m_checkbox;
+ CAviPlotterWnd m_graph;
- int m_nChunks;
- REFERENCE_TIME m_rtDur;
+ int m_nChunks;
+ REFERENCE_TIME m_rtDur;
public:
- CAviReportWnd();
- bool DoModal(CAviFile* pAF, bool fHideChecked, bool fShowWarningText);
+ CAviReportWnd();
+ bool DoModal(CAviFile* pAF, bool fHideChecked, bool fShowWarningText);
- DECLARE_MESSAGE_MAP()
- afx_msg void OnClose();
- afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+ DECLARE_MESSAGE_MAP()
+ afx_msg void OnClose();
+ afx_msg void OnMouseMove(UINT nFlags, CPoint point);
};
diff --git a/src/filters/parser/AviSplitter/AviSplitter.cpp b/src/filters/parser/AviSplitter/AviSplitter.cpp
index a34593187..d31561221 100644
--- a/src/filters/parser/AviSplitter/AviSplitter.cpp
+++ b/src/filters/parser/AviSplitter/AviSplitter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -29,8 +29,8 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
{
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_Avi},
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_Avi},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
};
const AMOVIESETUP_PIN sudpPins[] =
@@ -41,39 +41,39 @@ const AMOVIESETUP_PIN sudpPins[] =
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CAviSplitterFilter), L"MPC - Avi Splitter", MERIT_NORMAL + 1, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CAviSourceFilter), L"MPC - Avi Source", MERIT_NORMAL + 1, 0, NULL, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CAviSplitterFilter), L"MPC - Avi Splitter", MERIT_NORMAL+1, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CAviSourceFilter), L"MPC - Avi Source", MERIT_NORMAL+1, 0, NULL, CLSID_LegacyAmFilterCategory},
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CAviSplitterFilter>, NULL, &sudFilter[0]},
- {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CAviSourceFilter>, NULL, &sudFilter[1]},
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CAviSplitterFilter>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CAviSourceFilter>, NULL, &sudFilter[1]},
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- CAtlList<CString> chkbytes;
- chkbytes.AddTail(_T("0,4,,52494646,8,4,,41564920")); // 'RIFF' ... 'AVI '
- chkbytes.AddTail(_T("0,4,,52494646,8,4,,41564958")); // 'RIFF' ... 'AVIX'
- chkbytes.AddTail(_T("0,4,,52494646,8,4,,414D5620")); // 'RIFF' ... 'AMV '
-
- RegisterSourceFilter(
- CLSID_AsyncReader,
- MEDIASUBTYPE_Avi,
- chkbytes,
- _T(".avi"), _T(".divx"), _T(".vp6"), _T(".amv"), NULL);
-
- return AMovieDllRegisterServer2(TRUE);
+ CAtlList<CString> chkbytes;
+ chkbytes.AddTail(_T("0,4,,52494646,8,4,,41564920")); // 'RIFF' ... 'AVI '
+ chkbytes.AddTail(_T("0,4,,52494646,8,4,,41564958")); // 'RIFF' ... 'AVIX'
+ chkbytes.AddTail(_T("0,4,,52494646,8,4,,414D5620")); // 'RIFF' ... 'AMV '
+
+ RegisterSourceFilter(
+ CLSID_AsyncReader,
+ MEDIASUBTYPE_Avi,
+ chkbytes,
+ _T(".avi"), _T(".divx"), _T(".vp6"), _T(".amv"), NULL);
+
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
// UnRegisterSourceFilter(MEDIASUBTYPE_Avi);
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
@@ -81,27 +81,27 @@ extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
class CAviSplitterApp : public CWinApp
{
public:
- CAviSplitterApp() {}
-
- BOOL InitInstance()
- {
- if(!__super::InitInstance()) return FALSE;
- DllEntryPoint(m_hInstance, DLL_PROCESS_ATTACH, 0);
- return TRUE;
- }
-
- BOOL ExitInstance()
- {
- DllEntryPoint(m_hInstance, DLL_PROCESS_DETACH, 0);
- return __super::ExitInstance();
- }
-
- void SetDefaultRegistryKey()
- {
- SetRegistryKey(_T("Gabest"));
- }
-
- DECLARE_MESSAGE_MAP()
+ CAviSplitterApp() {}
+
+ BOOL InitInstance()
+ {
+ if(!__super::InitInstance()) return FALSE;
+ DllEntryPoint(m_hInstance, DLL_PROCESS_ATTACH, 0);
+ return TRUE;
+ }
+
+ BOOL ExitInstance()
+ {
+ DllEntryPoint(m_hInstance, DLL_PROCESS_DETACH, 0);
+ return __super::ExitInstance();
+ }
+
+ void SetDefaultRegistryKey()
+ {
+ SetRegistryKey(_T("Gabest"));
+ }
+
+ DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(CAviSplitterApp, CWinApp)
@@ -116,737 +116,709 @@ CAviSplitterApp theApp;
//
CAviSplitterFilter::CAviSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CBaseSplitterFilter(NAME("CAviSplitterFilter"), pUnk, phr, __uuidof(this))
- , m_timeformat(TIME_FORMAT_MEDIA_TIME)
+ : CBaseSplitterFilter(NAME("CAviSplitterFilter"), pUnk, phr, __uuidof(this))
+ , m_timeformat(TIME_FORMAT_MEDIA_TIME)
{
}
STDMETHODIMP CAviSplitterFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv, E_POINTER);
- *ppv = NULL;
+ *ppv = NULL;
- return
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
{
- CheckPointer(pAsyncReader, E_POINTER);
+ CheckPointer(pAsyncReader, E_POINTER);
- HRESULT hr = E_FAIL;
+ HRESULT hr = E_FAIL;
- m_pFile.Free();
- m_tFrame.Free();
+ m_pFile.Free();
+ m_tFrame.Free();
- m_pFile.Attach(DNew CAviFile(pAsyncReader, hr));
- if(!m_pFile) return E_OUTOFMEMORY;
+ m_pFile.Attach(DNew CAviFile(pAsyncReader, hr));
+ if(!m_pFile) return E_OUTOFMEMORY;
- bool fShiftDown = !!(::GetKeyState(VK_SHIFT) & 0x8000);
- bool fShowWarningText = !m_pFile->IsInterleaved(fShiftDown);
+ bool fShiftDown = !!(::GetKeyState(VK_SHIFT)&0x8000);
+ bool fShowWarningText = !m_pFile->IsInterleaved(fShiftDown);
- if(SUCCEEDED(hr) && (fShowWarningText || fShiftDown))
- {
+ if(SUCCEEDED(hr) && (fShowWarningText || fShiftDown))
+ {
#ifdef REGISTER_FILTER
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
#endif
- bool fHideWarning = !!AfxGetApp()->GetProfileInt(_T("Settings"), _T("HideAviSplitterWarning"), 0);
-
- if(!fHideWarning && !dynamic_cast<CAviSourceFilter*>(this) || fShiftDown)
- {
- CAviReportWnd wnd;
- fHideWarning = wnd.DoModal(m_pFile, fHideWarning, fShowWarningText);
- AfxGetApp()->WriteProfileInt(_T("Settings"), _T("HideAviSplitterWarning"), fHideWarning);
- }
-
- if(fShowWarningText) hr = E_FAIL;
- }
-
- if(FAILED(hr))
- {
- m_pFile.Free();
- return hr;
- }
-
- m_rtNewStart = m_rtCurrent = 0;
- m_rtNewStop = m_rtStop = m_rtDuration = m_pFile->GetTotalTime();
-
- bool fHasIndex = false;
-
- for(DWORD i = 0; !fHasIndex && i < m_pFile->m_strms.GetCount(); i++)
- if(m_pFile->m_strms[i]->cs.GetCount() > 0)
- fHasIndex = true;
-
- for(DWORD i = 0; i < m_pFile->m_strms.GetCount(); i++)
- {
- CAviFile::strm_t* s = m_pFile->m_strms[i];
-
- if(fHasIndex && s->cs.GetCount() == 0) continue;
-
- CMediaType mt;
- CAtlArray<CMediaType> mts;
-
- CStringW name, label;
-
- if(s->strh.fccType == FCC('vids'))
- {
- label = L"Video";
-
- ASSERT(s->strf.GetCount() >= sizeof(BITMAPINFOHEADER));
-
- BITMAPINFOHEADER* pbmi = &((BITMAPINFO*)s->strf.GetData())->bmiHeader;
-
- mt.majortype = MEDIATYPE_Video;
- mt.subtype = FOURCCMap(pbmi->biCompression);
- mt.formattype = FORMAT_VideoInfo;
- VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + s->strf.GetCount() - sizeof(BITMAPINFOHEADER));
- memset(mt.Format(), 0, mt.FormatLength());
- memcpy(&pvih->bmiHeader, s->strf.GetData(), s->strf.GetCount());
- if(s->strh.dwRate > 0) pvih->AvgTimePerFrame = 10000000i64 * s->strh.dwScale / s->strh.dwRate;
- switch(pbmi->biCompression)
- {
- case BI_RGB:
- case BI_BITFIELDS:
- mt.subtype =
- pbmi->biBitCount == 1 ? MEDIASUBTYPE_RGB1 :
- pbmi->biBitCount == 4 ? MEDIASUBTYPE_RGB4 :
- pbmi->biBitCount == 8 ? MEDIASUBTYPE_RGB8 :
- pbmi->biBitCount == 16 ? MEDIASUBTYPE_RGB565 :
- pbmi->biBitCount == 24 ? MEDIASUBTYPE_RGB24 :
- pbmi->biBitCount == 32 ? MEDIASUBTYPE_ARGB32 :
- MEDIASUBTYPE_NULL;
- break;
+ bool fHideWarning = !!AfxGetApp()->GetProfileInt(_T("Settings"), _T("HideAviSplitterWarning"), 0);
+
+ if(!fHideWarning && !dynamic_cast<CAviSourceFilter*>(this) || fShiftDown)
+ {
+ CAviReportWnd wnd;
+ fHideWarning = wnd.DoModal(m_pFile, fHideWarning, fShowWarningText);
+ AfxGetApp()->WriteProfileInt(_T("Settings"), _T("HideAviSplitterWarning"), fHideWarning);
+ }
+
+ if(fShowWarningText) hr = E_FAIL;
+ }
+
+ if(FAILED(hr)) {m_pFile.Free(); return hr;}
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = m_rtDuration = m_pFile->GetTotalTime();
+
+ bool fHasIndex = false;
+
+ for(DWORD i = 0; !fHasIndex && i < m_pFile->m_strms.GetCount(); i++)
+ if(m_pFile->m_strms[i]->cs.GetCount() > 0)
+ fHasIndex = true;
+
+ for(DWORD i = 0; i < m_pFile->m_strms.GetCount(); i++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[i];
+
+ if(fHasIndex && s->cs.GetCount() == 0) continue;
+
+ CMediaType mt;
+ CAtlArray<CMediaType> mts;
+
+ CStringW name, label;
+
+ if(s->strh.fccType == FCC('vids'))
+ {
+ label = L"Video";
+
+ ASSERT(s->strf.GetCount() >= sizeof(BITMAPINFOHEADER));
+
+ BITMAPINFOHEADER* pbmi = &((BITMAPINFO*)s->strf.GetData())->bmiHeader;
+
+ mt.majortype = MEDIATYPE_Video;
+ mt.subtype = FOURCCMap(pbmi->biCompression);
+ mt.formattype = FORMAT_VideoInfo;
+ VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + s->strf.GetCount() - sizeof(BITMAPINFOHEADER));
+ memset(mt.Format(), 0, mt.FormatLength());
+ memcpy(&pvih->bmiHeader, s->strf.GetData(), s->strf.GetCount());
+ if(s->strh.dwRate > 0) pvih->AvgTimePerFrame = 10000000i64 * s->strh.dwScale / s->strh.dwRate;
+ switch(pbmi->biCompression)
+ {
+ case BI_RGB: case BI_BITFIELDS: mt.subtype =
+ pbmi->biBitCount == 1 ? MEDIASUBTYPE_RGB1 :
+ pbmi->biBitCount == 4 ? MEDIASUBTYPE_RGB4 :
+ pbmi->biBitCount == 8 ? MEDIASUBTYPE_RGB8 :
+ pbmi->biBitCount == 16 ? MEDIASUBTYPE_RGB565 :
+ pbmi->biBitCount == 24 ? MEDIASUBTYPE_RGB24 :
+ pbmi->biBitCount == 32 ? MEDIASUBTYPE_ARGB32 :
+ MEDIASUBTYPE_NULL;
+ break;
// case BI_RLE8: mt.subtype = MEDIASUBTYPE_RGB8; break;
// case BI_RLE4: mt.subtype = MEDIASUBTYPE_RGB4; break;
- }
-
- if(s->cs.GetCount() && pvih->AvgTimePerFrame > 0)
- {
- __int64 size = 0;
- for(int i = 0; i < s->cs.GetCount(); i++)
- size += s->cs[i].orgsize;
- pvih->dwBitRate = size * 8 / s->cs.GetCount() * 10000000i64 / pvih->AvgTimePerFrame;
- }
-
- mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
- ? s->strh.dwSuggestedBufferSize * 3 / 2
- : (pvih->bmiHeader.biWidth * pvih->bmiHeader.biHeight * 4));
- mts.Add(mt);
- }
- else if(s->strh.fccType == FCC('auds') || s->strh.fccType == FCC('amva'))
- {
- label = L"Audio";
-
- ASSERT(s->strf.GetCount() >= sizeof(WAVEFORMATEX)
- || s->strf.GetCount() == sizeof(PCMWAVEFORMAT));
+ }
+
+ if(s->cs.GetCount() && pvih->AvgTimePerFrame > 0)
+ {
+ __int64 size = 0;
+ for(int i = 0; i < s->cs.GetCount(); i++)
+ size += s->cs[i].orgsize;
+ pvih->dwBitRate = size*8 / s->cs.GetCount() * 10000000i64 / pvih->AvgTimePerFrame;
+ }
+
+ mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
+ ? s->strh.dwSuggestedBufferSize*3/2
+ : (pvih->bmiHeader.biWidth*pvih->bmiHeader.biHeight*4));
+ mts.Add(mt);
+ }
+ else if(s->strh.fccType == FCC('auds') || s->strh.fccType == FCC('amva'))
+ {
+ label = L"Audio";
+
+ ASSERT(s->strf.GetCount() >= sizeof(WAVEFORMATEX)
+ || s->strf.GetCount() == sizeof(PCMWAVEFORMAT));
WAVEFORMATEX* pwfe = (WAVEFORMATEX*)s->strf.GetData();
- if(pwfe->nBlockAlign == 0) continue;
-
- mt.majortype = MEDIATYPE_Audio;
- if(m_pFile->m_isamv)
- mt.subtype = FOURCCMap(MAKEFOURCC('A', 'M', 'V', 'A'));
- else
- mt.subtype = FOURCCMap(pwfe->wFormatTag);
- mt.formattype = FORMAT_WaveFormatEx;
- mt.SetFormat(s->strf.GetData(), max(s->strf.GetCount(), sizeof(WAVEFORMATEX)));
- pwfe = (WAVEFORMATEX*)mt.Format();
- if(s->strf.GetCount() == sizeof(PCMWAVEFORMAT)) pwfe->cbSize = 0;
- if(pwfe->wFormatTag == WAVE_FORMAT_PCM) pwfe->nBlockAlign = pwfe->nChannels * pwfe->wBitsPerSample >> 3;
- if(pwfe->wFormatTag == WAVE_FORMAT_EXTENSIBLE) mt.subtype = FOURCCMap(WAVE_FORMAT_PCM); // audio renderer doesn't accept fffe in the subtype
- mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
- ? s->strh.dwSuggestedBufferSize * 3 / 2
- : (pwfe->nChannels * pwfe->nSamplesPerSec * 32 >> 3));
- mts.Add(mt);
- }
- else if(s->strh.fccType == FCC('mids'))
- {
- label = L"Midi";
-
- mt.majortype = MEDIATYPE_Midi;
- mt.subtype = MEDIASUBTYPE_NULL;
- mt.formattype = FORMAT_None;
- mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
- ? s->strh.dwSuggestedBufferSize * 3 / 2
- : (1024 * 1024));
- mts.Add(mt);
- }
- else if(s->strh.fccType == FCC('txts'))
- {
- label = L"Text";
-
- mt.majortype = MEDIATYPE_Text;
- mt.subtype = MEDIASUBTYPE_NULL;
- mt.formattype = FORMAT_None;
- mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
- ? s->strh.dwSuggestedBufferSize * 3 / 2
- : (1024 * 1024));
- mts.Add(mt);
- }
- else if(s->strh.fccType == FCC('iavs'))
- {
- label = L"Interleaved";
-
- ASSERT(s->strh.fccHandler == FCC('dvsd'));
-
- mt.majortype = MEDIATYPE_Interleaved;
- mt.subtype = FOURCCMap(s->strh.fccHandler);
- mt.formattype = FORMAT_DvInfo;
- mt.SetFormat(s->strf.GetData(), max(s->strf.GetCount(), sizeof(DVINFO)));
- mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
- ? s->strh.dwSuggestedBufferSize * 3 / 2
- : (1024 * 1024));
- mts.Add(mt);
- }
-
- if(mts.IsEmpty())
- {
- TRACE(_T("CAviSourceFilter: Unsupported stream (%d)\n"), i);
- continue;
- }
-
- //Put filename at front sometime(eg. ~temp.avi) will cause filter graph
- //stop check this pin. Not sure the reason exactly. but it happens.
- //If you know why, please emailto: tomasen@gmail.com
- if(s->strn.IsEmpty())
- name.Format(L"%s %d", label , i);
- else
- name.Format(L"%s %d %s", label , i , CStringW(s->strn));
-
- HRESULT hr;
-
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CAviSplitterOutputPin(mts, name, this, this, &hr));
- AddOutputPin(i, pPinOut);
- }
-
- POSITION pos = m_pFile->m_info.GetStartPosition();
- while(pos)
- {
- DWORD fcc;
- CStringA value;
- m_pFile->m_info.GetNextAssoc(pos, fcc, value);
+ if(pwfe->nBlockAlign == 0) continue;
+
+ mt.majortype = MEDIATYPE_Audio;
+ if (m_pFile->m_isamv)
+ mt.subtype = FOURCCMap(MAKEFOURCC('A','M','V','A'));
+ else
+ mt.subtype = FOURCCMap(pwfe->wFormatTag);
+ mt.formattype = FORMAT_WaveFormatEx;
+ mt.SetFormat(s->strf.GetData(), max(s->strf.GetCount(), sizeof(WAVEFORMATEX)));
+ pwfe = (WAVEFORMATEX*)mt.Format();
+ if(s->strf.GetCount() == sizeof(PCMWAVEFORMAT)) pwfe->cbSize = 0;
+ if(pwfe->wFormatTag == WAVE_FORMAT_PCM) pwfe->nBlockAlign = pwfe->nChannels*pwfe->wBitsPerSample>>3;
+ if(pwfe->wFormatTag == WAVE_FORMAT_EXTENSIBLE) mt.subtype = FOURCCMap(WAVE_FORMAT_PCM); // audio renderer doesn't accept fffe in the subtype
+ mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
+ ? s->strh.dwSuggestedBufferSize*3/2
+ : (pwfe->nChannels*pwfe->nSamplesPerSec*32>>3));
+ mts.Add(mt);
+ }
+ else if(s->strh.fccType == FCC('mids'))
+ {
+ label = L"Midi";
+
+ mt.majortype = MEDIATYPE_Midi;
+ mt.subtype = MEDIASUBTYPE_NULL;
+ mt.formattype = FORMAT_None;
+ mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
+ ? s->strh.dwSuggestedBufferSize*3/2
+ : (1024*1024));
+ mts.Add(mt);
+ }
+ else if(s->strh.fccType == FCC('txts'))
+ {
+ label = L"Text";
+
+ mt.majortype = MEDIATYPE_Text;
+ mt.subtype = MEDIASUBTYPE_NULL;
+ mt.formattype = FORMAT_None;
+ mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
+ ? s->strh.dwSuggestedBufferSize*3/2
+ : (1024*1024));
+ mts.Add(mt);
+ }
+ else if(s->strh.fccType == FCC('iavs'))
+ {
+ label = L"Interleaved";
+
+ ASSERT(s->strh.fccHandler == FCC('dvsd'));
+
+ mt.majortype = MEDIATYPE_Interleaved;
+ mt.subtype = FOURCCMap(s->strh.fccHandler);
+ mt.formattype = FORMAT_DvInfo;
+ mt.SetFormat(s->strf.GetData(), max(s->strf.GetCount(), sizeof(DVINFO)));
+ mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
+ ? s->strh.dwSuggestedBufferSize*3/2
+ : (1024*1024));
+ mts.Add(mt);
+ }
+
+ if(mts.IsEmpty())
+ {
+ TRACE(_T("CAviSourceFilter: Unsupported stream (%d)\n"), i);
+ continue;
+ }
+
+ //Put filename at front sometime(eg. ~temp.avi) will cause filter graph
+ //stop check this pin. Not sure the reason exactly. but it happens.
+ //If you know why, please emailto: tomasen@gmail.com
+ if(s->strn.IsEmpty())
+ name.Format(L"%s %d", label , i);
+ else
+ name.Format(L"%s %d %s", label , i , CStringW(s->strn) );
+
+ HRESULT hr;
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CAviSplitterOutputPin(mts, name, this, this, &hr));
+ AddOutputPin(i, pPinOut);
+ }
+
+ POSITION pos = m_pFile->m_info.GetStartPosition();
+ while(pos)
+ {
+ DWORD fcc;
+ CStringA value;
+ m_pFile->m_info.GetNextAssoc(pos, fcc, value);
switch(fcc)
- {
- case FCC('INAM'):
- SetProperty(L"TITL", CStringW(value));
- break;
- case FCC('IART'):
- SetProperty(L"AUTH", CStringW(value));
- break;
- case FCC('ICOP'):
- SetProperty(L"CPYR", CStringW(value));
- break;
- case FCC('ISBJ'):
- SetProperty(L"DESC", CStringW(value));
- break;
- }
- }
-
- m_tFrame.Attach(DNew DWORD[m_pFile->m_avih.dwStreams]);
-
- return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
+ {
+ case FCC('INAM'): SetProperty(L"TITL", CStringW(value)); break;
+ case FCC('IART'): SetProperty(L"AUTH", CStringW(value)); break;
+ case FCC('ICOP'): SetProperty(L"CPYR", CStringW(value)); break;
+ case FCC('ISBJ'): SetProperty(L"DESC", CStringW(value)); break;
+ }
+ }
+
+ m_tFrame.Attach(DNew DWORD[m_pFile->m_avih.dwStreams]);
+
+ return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
}
bool CAviSplitterFilter::DemuxInit()
{
- if(!m_pFile) return(false);
+ if(!m_pFile) return(false);
- // reindex if needed
+ // reindex if needed
- bool fReIndex = false;
+ bool fReIndex = false;
- for(int i = 0; i < (int)m_pFile->m_avih.dwStreams && !fReIndex; i++)
- {
- if(m_pFile->m_strms[i]->cs.GetCount() == 0 && GetOutputPin(i))
- fReIndex = true;
- }
+ for(int i = 0; i < (int)m_pFile->m_avih.dwStreams && !fReIndex; i++)
+ {
+ if(m_pFile->m_strms[i]->cs.GetCount() == 0 && GetOutputPin(i))
+ fReIndex = true;
+ }
- if(fReIndex)
- {
- m_pFile->EmptyIndex();
+ if(fReIndex)
+ {
+ m_pFile->EmptyIndex();
- m_fAbort = false;
- m_nOpenProgress = 0;
+ m_fAbort = false;
+ m_nOpenProgress = 0;
- m_rtDuration = 0;
+ m_rtDuration = 0;
- CAutoVectorPtr<UINT64> pSize;
- pSize.Allocate(m_pFile->m_avih.dwStreams);
- memset((UINT64*)pSize, 0, sizeof(UINT64)*m_pFile->m_avih.dwStreams);
- m_pFile->Seek(0);
+ CAutoVectorPtr<UINT64> pSize;
+ pSize.Allocate(m_pFile->m_avih.dwStreams);
+ memset((UINT64*)pSize, 0, sizeof(UINT64)*m_pFile->m_avih.dwStreams);
+ m_pFile->Seek(0);
ReIndex(m_pFile->GetLength(), pSize);
- if(m_fAbort) m_pFile->EmptyIndex();
+ if(m_fAbort) m_pFile->EmptyIndex();
- m_fAbort = false;
- m_nOpenProgress = 100;
- }
+ m_fAbort = false;
+ m_nOpenProgress = 100;
+ }
- return(true);
+ return(true);
}
HRESULT CAviSplitterFilter::ReIndex(__int64 end, UINT64* pSize)
{
- HRESULT hr = S_OK;
+ HRESULT hr = S_OK;
- while(S_OK == hr && m_pFile->GetPos() < end && SUCCEEDED(hr) && !m_fAbort)
- {
- __int64 pos = m_pFile->GetPos();
+ while(S_OK == hr && m_pFile->GetPos() < end && SUCCEEDED(hr) && !m_fAbort)
+ {
+ __int64 pos = m_pFile->GetPos();
- DWORD id = 0, size;
- if(S_OK != m_pFile->Read(id) || id == 0)
- return E_FAIL;
+ DWORD id = 0, size;
+ if(S_OK != m_pFile->Read(id) || id == 0)
+ return E_FAIL;
- if(id == FCC('RIFF') || id == FCC('LIST'))
- {
- if(S_OK != m_pFile->Read(size) || S_OK != m_pFile->Read(id))
- return E_FAIL;
+ if(id == FCC('RIFF') || id == FCC('LIST'))
+ {
+ if(S_OK != m_pFile->Read(size) || S_OK != m_pFile->Read(id))
+ return E_FAIL;
- size += (size & 1) + 8;
+ size += (size&1) + 8;
- if(id == FCC('AVI ') || id == FCC('AVIX') || id == FCC('movi') || id == FCC('rec '))
- hr = ReIndex(pos + size, pSize);
- }
- else
- {
- if(S_OK != m_pFile->Read(size))
- return E_FAIL;
+ if(id == FCC('AVI ') || id == FCC('AVIX') || id == FCC('movi') || id == FCC('rec '))
+ hr = ReIndex(pos + size, pSize);
+ }
+ else
+ {
+ if(S_OK != m_pFile->Read(size))
+ return E_FAIL;
- DWORD TrackNumber = TRACKNUM(id);
+ DWORD TrackNumber = TRACKNUM(id);
- if(TrackNumber < m_pFile->m_strms.GetCount())
- {
- CAviFile::strm_t* s = m_pFile->m_strms[TrackNumber];
+ if(TrackNumber < m_pFile->m_strms.GetCount())
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[TrackNumber];
- WORD type = TRACKTYPE(id);
+ WORD type = TRACKTYPE(id);
- if(type == 'db' || type == 'dc' || /*type == 'pc' ||*/ type == 'wb'
- || type == 'iv' || type == '__' || type == 'xx')
- {
- CAviFile::strm_t::chunk c;
- c.filepos = pos;
- c.size = pSize[TrackNumber];
- c.orgsize = size;
- c.fKeyFrame = size > 0; // TODO: find a better way...
- c.fChunkHdr = true;
- s->cs.Add(c);
+ if(type == 'db' || type == 'dc' || /*type == 'pc' ||*/ type == 'wb'
+ || type == 'iv' || type == '__' || type == 'xx')
+ {
+ CAviFile::strm_t::chunk c;
+ c.filepos = pos;
+ c.size = pSize[TrackNumber];
+ c.orgsize = size;
+ c.fKeyFrame = size > 0; // TODO: find a better way...
+ c.fChunkHdr = true;
+ s->cs.Add(c);
- pSize[TrackNumber] += s->GetChunkSize(size);
+ pSize[TrackNumber] += s->GetChunkSize(size);
- REFERENCE_TIME rt = s->GetRefTime(s->cs.GetCount() - 1, pSize[TrackNumber]);
- m_rtDuration = max(rt, m_rtDuration);
- }
- }
+ REFERENCE_TIME rt = s->GetRefTime(s->cs.GetCount()-1, pSize[TrackNumber]);
+ m_rtDuration = max(rt, m_rtDuration);
+ }
+ }
- size += (size & 1) + 8;
- }
+ size += (size&1) + 8;
+ }
- m_pFile->Seek(pos + size);
+ m_pFile->Seek(pos + size);
- m_nOpenProgress = m_pFile->GetPos() * 100 / m_pFile->GetLength();
+ 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);
- }
- }
+ DWORD cmd;
+ if(CheckRequest(&cmd))
+ {
+ if(cmd == CMD_EXIT) m_fAbort = true;
+ else Reply(S_OK);
+ }
+ }
- return hr;
+ return hr;
}
void CAviSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
{
- memset((DWORD*)m_tFrame, 0, sizeof(DWORD)*m_pFile->m_avih.dwStreams);
- m_pFile->Seek(0);
-
- DbgLog((LOG_TRACE, 0, _T("Seek: %I64d"), rt / 10000));
-
- if(rt > 0)
- {
- UINT64 minfp = _I64_MAX;
-
- for(int j = 0; j < (int)m_pFile->m_strms.GetCount(); j++)
- {
- CAviFile::strm_t* s = m_pFile->m_strms[j];
-
- int f = s->GetKeyFrame(rt);
- UINT64 fp = f >= 0 ? s->cs[f].filepos : m_pFile->GetLength();
-
- if(!s->IsRawSubtitleStream())
- minfp = min(minfp, fp);
- }
-
- for(int j = 0; j < (int)m_pFile->m_strms.GetCount(); j++)
- {
- CAviFile::strm_t* s = m_pFile->m_strms[j];
-
- for(int i = 0; i < s->cs.GetCount(); i++)
- {
- CAviFile::strm_t::chunk& c = s->cs[i];
- if(c.filepos >= minfp)
- {
- m_tFrame[j] = i;
- break;
- }
- }
- }
-
- DbgLog((LOG_TRACE, 0, _T("minfp: %I64d"), minfp));
- }
+ memset((DWORD*)m_tFrame, 0, sizeof(DWORD)*m_pFile->m_avih.dwStreams);
+ m_pFile->Seek(0);
+
+ DbgLog((LOG_TRACE, 0, _T("Seek: %I64d"), rt/10000));
+
+ if(rt > 0)
+ {
+ UINT64 minfp = _I64_MAX;
+
+ for(int j = 0; j < (int)m_pFile->m_strms.GetCount(); j++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[j];
+
+ int f = s->GetKeyFrame(rt);
+ UINT64 fp = f >= 0 ? s->cs[f].filepos : m_pFile->GetLength();
+
+ if(!s->IsRawSubtitleStream())
+ minfp = min(minfp, fp);
+ }
+
+ for(int j = 0; j < (int)m_pFile->m_strms.GetCount(); j++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[j];
+
+ for(int i = 0; i < s->cs.GetCount(); i++)
+ {
+ CAviFile::strm_t::chunk& c = s->cs[i];
+ if(c.filepos >= minfp)
+ {
+ m_tFrame[j] = i;
+ break;
+ }
+ }
+ }
+
+ DbgLog((LOG_TRACE, 0, _T("minfp: %I64d"), minfp));
+ }
}
bool CAviSplitterFilter::DemuxLoop()
{
- HRESULT hr = S_OK;
-
- int nTracks = (int)m_pFile->m_strms.GetCount();
-
- CAtlArray<BOOL> fDiscontinuity;
- fDiscontinuity.SetCount(nTracks);
- memset(fDiscontinuity.GetData(), 0, nTracks * sizeof(bool));
-
- while(SUCCEEDED(hr) && !CheckRequest(NULL))
- {
- int minTrack = nTracks;
- UINT64 minFilePos = _I64_MAX;
-
- for(int i = 0; i < nTracks; i++)
- {
- CAviFile::strm_t* s = m_pFile->m_strms[i];
-
- DWORD f = m_tFrame[i];
- if(f >= (DWORD)s->cs.GetCount()) continue;
-
- bool fUrgent = s->IsRawSubtitleStream();
-
- if(fUrgent || s->cs[f].filepos < minFilePos)
- {
- minTrack = i;
- minFilePos = s->cs[f].filepos;
- }
-
- if(fUrgent) break;
- }
-
- if(minTrack == nTracks)
- break;
-
- DWORD& f = m_tFrame[minTrack];
-
- do
- {
- CAviFile::strm_t* s = m_pFile->m_strms[minTrack];
-
- m_pFile->Seek(s->cs[f].filepos);
-
- DWORD size = 0;
-
- if(s->cs[f].fChunkHdr)
- {
- DWORD id = 0;
- if(S_OK != m_pFile->Read(id) || id == 0 || minTrack != TRACKNUM(id)
- || S_OK != m_pFile->Read(size))
- {
- fDiscontinuity[minTrack] = true;
- break;
- }
-
- UINT64 expectedsize = -1;
- expectedsize = f < (DWORD)s->cs.GetCount() - 1
- ? s->cs[f+1].size - s->cs[f].size
- : s->totalsize - s->cs[f].size;
-
- if(expectedsize != s->GetChunkSize(size))
- {
- fDiscontinuity[minTrack] = true;
- // ASSERT(0);
- break;
- }
- }
- else
- {
- size = s->cs[f].orgsize;
- }
-
- CAutoPtr<Packet> p(DNew Packet());
-
- p->TrackNumber = minTrack;
- p->bSyncPoint = (BOOL)s->cs[f].fKeyFrame;
- p->bDiscontinuity = fDiscontinuity[minTrack];
- p->rtStart = s->GetRefTime(f, s->cs[f].size);
- p->rtStop = s->GetRefTime(f + 1, f + 1 < (DWORD)s->cs.GetCount() ? s->cs[f+1].size : s->totalsize);
-
- p->SetCount(size);
- if(S_OK != (hr = m_pFile->ByteRead(p->GetData(), p->GetCount())))
- return(true); // break;
- /*
- DbgLog((LOG_TRACE, 0, _T("%d (%d): %I64d - %I64d, %I64d - %I64d (size = %d)"),
- minTrack, (int)p->bSyncPoint,
- (p->rtStart)/10000, (p->rtStop)/10000,
- (p->rtStart-m_rtStart)/10000, (p->rtStop-m_rtStart)/10000,
- size));
- */
- hr = DeliverPacket(p);
-
- fDiscontinuity[minTrack] = false;
- }
- while(0);
-
- f++;
- }
-
- return(true);
+ HRESULT hr = S_OK;
+
+ int nTracks = (int)m_pFile->m_strms.GetCount();
+
+ CAtlArray<BOOL> fDiscontinuity;
+ fDiscontinuity.SetCount(nTracks);
+ memset(fDiscontinuity.GetData(), 0, nTracks*sizeof(bool));
+
+ while(SUCCEEDED(hr) && !CheckRequest(NULL))
+ {
+ int minTrack = nTracks;
+ UINT64 minFilePos = _I64_MAX;
+
+ for(int i = 0; i < nTracks; i++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[i];
+
+ DWORD f = m_tFrame[i];
+ if(f >= (DWORD)s->cs.GetCount()) continue;
+
+ bool fUrgent = s->IsRawSubtitleStream();
+
+ if(fUrgent || s->cs[f].filepos < minFilePos)
+ {
+ minTrack = i;
+ minFilePos = s->cs[f].filepos;
+ }
+
+ if(fUrgent) break;
+ }
+
+ if(minTrack == nTracks)
+ break;
+
+ DWORD& f = m_tFrame[minTrack];
+
+ do
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[minTrack];
+
+ m_pFile->Seek(s->cs[f].filepos);
+
+ DWORD size = 0;
+
+ if(s->cs[f].fChunkHdr)
+ {
+ DWORD id = 0;
+ if(S_OK != m_pFile->Read(id) || id == 0 || minTrack != TRACKNUM(id)
+ || S_OK != m_pFile->Read(size))
+ {
+ fDiscontinuity[minTrack] = true;
+ break;
+ }
+
+ UINT64 expectedsize = -1;
+ expectedsize = f < (DWORD)s->cs.GetCount()-1
+ ? s->cs[f+1].size - s->cs[f].size
+ : s->totalsize - s->cs[f].size;
+
+ if(expectedsize != s->GetChunkSize(size))
+ {
+ fDiscontinuity[minTrack] = true;
+ // ASSERT(0);
+ break;
+ }
+ }
+ else
+ {
+ size = s->cs[f].orgsize;
+ }
+
+ CAutoPtr<Packet> p(DNew Packet());
+
+ p->TrackNumber = minTrack;
+ p->bSyncPoint = (BOOL)s->cs[f].fKeyFrame;
+ p->bDiscontinuity = fDiscontinuity[minTrack];
+ p->rtStart = s->GetRefTime(f, s->cs[f].size);
+ p->rtStop = s->GetRefTime(f+1, f+1 < (DWORD)s->cs.GetCount() ? s->cs[f+1].size : s->totalsize);
+
+ p->SetCount(size);
+ if(S_OK != (hr = m_pFile->ByteRead(p->GetData(), p->GetCount())))
+ return(true); // break;
+/*
+ DbgLog((LOG_TRACE, 0, _T("%d (%d): %I64d - %I64d, %I64d - %I64d (size = %d)"),
+ minTrack, (int)p->bSyncPoint,
+ (p->rtStart)/10000, (p->rtStop)/10000,
+ (p->rtStart-m_rtStart)/10000, (p->rtStop-m_rtStart)/10000,
+ size));
+*/
+ hr = DeliverPacket(p);
+
+ fDiscontinuity[minTrack] = false;
+ }
+ while(0);
+
+ f++;
+ }
+
+ return(true);
}
// IMediaSeeking
STDMETHODIMP CAviSplitterFilter::GetDuration(LONGLONG* pDuration)
{
- CheckPointer(pDuration, E_POINTER);
- CheckPointer(m_pFile, VFW_E_NOT_CONNECTED);
-
- if(m_timeformat == TIME_FORMAT_FRAME)
- {
- for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++)
- {
- CAviFile::strm_t* s = m_pFile->m_strms[i];
- if(s->strh.fccType == FCC('vids'))
- {
- *pDuration = s->cs.GetCount();
- return S_OK;
- }
- }
-
- return E_UNEXPECTED;
- }
-
- return __super::GetDuration(pDuration);
+ CheckPointer(pDuration, E_POINTER);
+ CheckPointer(m_pFile, VFW_E_NOT_CONNECTED);
+
+ if(m_timeformat == TIME_FORMAT_FRAME)
+ {
+ for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[i];
+ if(s->strh.fccType == FCC('vids'))
+ {
+ *pDuration = s->cs.GetCount();
+ return S_OK;
+ }
+ }
+
+ return E_UNEXPECTED;
+ }
+
+ return __super::GetDuration(pDuration);
}
//
STDMETHODIMP CAviSplitterFilter::IsFormatSupported(const GUID* pFormat)
{
- CheckPointer(pFormat, E_POINTER);
- HRESULT hr = __super::IsFormatSupported(pFormat);
- if(S_OK == hr) return hr;
- return *pFormat == TIME_FORMAT_FRAME ? S_OK : S_FALSE;
+ CheckPointer(pFormat, E_POINTER);
+ HRESULT hr = __super::IsFormatSupported(pFormat);
+ if(S_OK == hr) return hr;
+ return *pFormat == TIME_FORMAT_FRAME ? S_OK : S_FALSE;
}
STDMETHODIMP CAviSplitterFilter::GetTimeFormat(GUID* pFormat)
{
- CheckPointer(pFormat, E_POINTER);
- *pFormat = m_timeformat;
- return S_OK;
+ CheckPointer(pFormat, E_POINTER);
+ *pFormat = m_timeformat;
+ return S_OK;
}
STDMETHODIMP CAviSplitterFilter::IsUsingTimeFormat(const GUID* pFormat)
{
- CheckPointer(pFormat, E_POINTER);
- return *pFormat == m_timeformat ? S_OK : S_FALSE;
+ CheckPointer(pFormat, E_POINTER);
+ return *pFormat == m_timeformat ? S_OK : S_FALSE;
}
STDMETHODIMP CAviSplitterFilter::SetTimeFormat(const GUID* pFormat)
{
- CheckPointer(pFormat, E_POINTER);
- if(S_OK != IsFormatSupported(pFormat)) return E_FAIL;
- m_timeformat = *pFormat;
- return S_OK;
+ CheckPointer(pFormat, E_POINTER);
+ if(S_OK != IsFormatSupported(pFormat)) return E_FAIL;
+ m_timeformat = *pFormat;
+ return S_OK;
}
STDMETHODIMP CAviSplitterFilter::GetStopPosition(LONGLONG* pStop)
{
- CheckPointer(pStop, E_POINTER);
- if(FAILED(__super::GetStopPosition(pStop))) return E_FAIL;
- if(m_timeformat == TIME_FORMAT_MEDIA_TIME) return S_OK;
- LONGLONG rt = *pStop;
- if(FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_FRAME, rt, &TIME_FORMAT_MEDIA_TIME))) return E_FAIL;
- return S_OK;
+ CheckPointer(pStop, E_POINTER);
+ if(FAILED(__super::GetStopPosition(pStop))) return E_FAIL;
+ if(m_timeformat == TIME_FORMAT_MEDIA_TIME) return S_OK;
+ LONGLONG rt = *pStop;
+ if(FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_FRAME, rt, &TIME_FORMAT_MEDIA_TIME))) return E_FAIL;
+ return S_OK;
}
STDMETHODIMP CAviSplitterFilter::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat)
{
- CheckPointer(pTarget, E_POINTER);
-
- const GUID& SourceFormat = pSourceFormat ? *pSourceFormat : m_timeformat;
- const GUID& TargetFormat = pTargetFormat ? *pTargetFormat : m_timeformat;
-
- if(TargetFormat == SourceFormat)
- {
- *pTarget = Source;
- return S_OK;
- }
- else if(TargetFormat == TIME_FORMAT_FRAME && SourceFormat == TIME_FORMAT_MEDIA_TIME)
- {
- for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++)
- {
- CAviFile::strm_t* s = m_pFile->m_strms[i];
- if(s->strh.fccType == FCC('vids'))
- {
- *pTarget = s->GetFrame(Source);
- return S_OK;
- }
- }
- }
- else if(TargetFormat == TIME_FORMAT_MEDIA_TIME && SourceFormat == TIME_FORMAT_FRAME)
- {
- for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++)
- {
- CAviFile::strm_t* s = m_pFile->m_strms[i];
- if(s->strh.fccType == FCC('vids'))
- {
- if(Source < 0 || Source >= s->cs.GetCount()) return E_FAIL;
- CAviFile::strm_t::chunk& c = s->cs[(int)Source];
- *pTarget = s->GetRefTime((DWORD)Source, c.size);
- return S_OK;
- }
- }
- }
-
- return E_FAIL;
+ CheckPointer(pTarget, E_POINTER);
+
+ const GUID& SourceFormat = pSourceFormat ? *pSourceFormat : m_timeformat;
+ const GUID& TargetFormat = pTargetFormat ? *pTargetFormat : m_timeformat;
+
+ if(TargetFormat == SourceFormat)
+ {
+ *pTarget = Source;
+ return S_OK;
+ }
+ else if(TargetFormat == TIME_FORMAT_FRAME && SourceFormat == TIME_FORMAT_MEDIA_TIME)
+ {
+ for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[i];
+ if(s->strh.fccType == FCC('vids'))
+ {
+ *pTarget = s->GetFrame(Source);
+ return S_OK;
+ }
+ }
+ }
+ else if(TargetFormat == TIME_FORMAT_MEDIA_TIME && SourceFormat == TIME_FORMAT_FRAME)
+ {
+ for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[i];
+ if(s->strh.fccType == FCC('vids'))
+ {
+ if(Source < 0 || Source >= s->cs.GetCount()) return E_FAIL;
+ CAviFile::strm_t::chunk& c = s->cs[(int)Source];
+ *pTarget = s->GetRefTime((DWORD)Source, c.size);
+ return S_OK;
+ }
+ }
+ }
+
+ return E_FAIL;
}
STDMETHODIMP CAviSplitterFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop)
{
- HRESULT hr;
- if(FAILED(hr = __super::GetPositions(pCurrent, pStop)) || m_timeformat != TIME_FORMAT_FRAME)
- return hr;
+ HRESULT hr;
+ if(FAILED(hr = __super::GetPositions(pCurrent, pStop)) || m_timeformat != TIME_FORMAT_FRAME)
+ return hr;
- if(pCurrent)
- if(FAILED(ConvertTimeFormat(pCurrent, &TIME_FORMAT_FRAME, *pCurrent, &TIME_FORMAT_MEDIA_TIME))) return E_FAIL;
- if(pStop)
- if(FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_FRAME, *pStop, &TIME_FORMAT_MEDIA_TIME))) return E_FAIL;
+ if(pCurrent)
+ if(FAILED(ConvertTimeFormat(pCurrent, &TIME_FORMAT_FRAME, *pCurrent, &TIME_FORMAT_MEDIA_TIME))) return E_FAIL;
+ if(pStop)
+ if(FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_FRAME, *pStop, &TIME_FORMAT_MEDIA_TIME))) return E_FAIL;
- return S_OK;
+ return S_OK;
}
HRESULT CAviSplitterFilter::SetPositionsInternal(void* id, LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags)
{
- if(m_timeformat != TIME_FORMAT_FRAME)
- return __super::SetPositionsInternal(id, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
-
- if(!pCurrent && !pStop
- || (dwCurrentFlags & AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning
- && (dwStopFlags & AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning)
- return S_OK;
-
- REFERENCE_TIME
- rtCurrent = m_rtCurrent,
- rtStop = m_rtStop;
-
- if((dwCurrentFlags & AM_SEEKING_PositioningBitsMask)
- && FAILED(ConvertTimeFormat(&rtCurrent, &TIME_FORMAT_FRAME, rtCurrent, &TIME_FORMAT_MEDIA_TIME)))
- return E_FAIL;
- if((dwStopFlags & AM_SEEKING_PositioningBitsMask)
- && FAILED(ConvertTimeFormat(&rtStop, &TIME_FORMAT_FRAME, rtStop, &TIME_FORMAT_MEDIA_TIME)))
- return E_FAIL;
-
- if(pCurrent)
- switch(dwCurrentFlags & AM_SEEKING_PositioningBitsMask)
- {
- case AM_SEEKING_NoPositioning:
- break;
- case AM_SEEKING_AbsolutePositioning:
- rtCurrent = *pCurrent;
- break;
- case AM_SEEKING_RelativePositioning:
- rtCurrent = rtCurrent + *pCurrent;
- break;
- case AM_SEEKING_IncrementalPositioning:
- rtCurrent = rtCurrent + *pCurrent;
- break;
- }
-
- if(pStop)
- switch(dwStopFlags & AM_SEEKING_PositioningBitsMask)
- {
- case AM_SEEKING_NoPositioning:
- break;
- case AM_SEEKING_AbsolutePositioning:
- rtStop = *pStop;
- break;
- case AM_SEEKING_RelativePositioning:
- rtStop += *pStop;
- break;
- case AM_SEEKING_IncrementalPositioning:
- rtStop = rtCurrent + *pStop;
- break;
- }
-
- if((dwCurrentFlags & AM_SEEKING_PositioningBitsMask)
- && pCurrent)
- if(FAILED(ConvertTimeFormat(pCurrent, &TIME_FORMAT_MEDIA_TIME, rtCurrent, &TIME_FORMAT_FRAME))) return E_FAIL;
- if((dwStopFlags & AM_SEEKING_PositioningBitsMask)
- && pStop)
- if(FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_MEDIA_TIME, rtStop, &TIME_FORMAT_FRAME))) return E_FAIL;
-
- return __super::SetPositionsInternal(id, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
+ if(m_timeformat != TIME_FORMAT_FRAME)
+ return __super::SetPositionsInternal(id, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
+
+ if(!pCurrent && !pStop
+ || (dwCurrentFlags&AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning
+ && (dwStopFlags&AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning)
+ return S_OK;
+
+ REFERENCE_TIME
+ rtCurrent = m_rtCurrent,
+ rtStop = m_rtStop;
+
+ if((dwCurrentFlags&AM_SEEKING_PositioningBitsMask)
+ && FAILED(ConvertTimeFormat(&rtCurrent, &TIME_FORMAT_FRAME, rtCurrent, &TIME_FORMAT_MEDIA_TIME)))
+ return E_FAIL;
+ if((dwStopFlags&AM_SEEKING_PositioningBitsMask)
+ && FAILED(ConvertTimeFormat(&rtStop, &TIME_FORMAT_FRAME, rtStop, &TIME_FORMAT_MEDIA_TIME)))
+ return E_FAIL;
+
+ if(pCurrent)
+ switch(dwCurrentFlags&AM_SEEKING_PositioningBitsMask)
+ {
+ case AM_SEEKING_NoPositioning: break;
+ case AM_SEEKING_AbsolutePositioning: rtCurrent = *pCurrent; break;
+ case AM_SEEKING_RelativePositioning: rtCurrent = rtCurrent + *pCurrent; break;
+ case AM_SEEKING_IncrementalPositioning: rtCurrent = rtCurrent + *pCurrent; break;
+ }
+
+ if(pStop)
+ switch(dwStopFlags&AM_SEEKING_PositioningBitsMask)
+ {
+ case AM_SEEKING_NoPositioning: break;
+ case AM_SEEKING_AbsolutePositioning: rtStop = *pStop; break;
+ case AM_SEEKING_RelativePositioning: rtStop += *pStop; break;
+ case AM_SEEKING_IncrementalPositioning: rtStop = rtCurrent + *pStop; break;
+ }
+
+ if((dwCurrentFlags&AM_SEEKING_PositioningBitsMask)
+ && pCurrent)
+ if(FAILED(ConvertTimeFormat(pCurrent, &TIME_FORMAT_MEDIA_TIME, rtCurrent, &TIME_FORMAT_FRAME))) return E_FAIL;
+ if((dwStopFlags&AM_SEEKING_PositioningBitsMask)
+ && pStop)
+ if(FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_MEDIA_TIME, rtStop, &TIME_FORMAT_FRAME))) return E_FAIL;
+
+ return __super::SetPositionsInternal(id, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
}
// IKeyFrameInfo
STDMETHODIMP CAviSplitterFilter::GetKeyFrameCount(UINT& nKFs)
{
- if(!m_pFile) return E_UNEXPECTED;
+ if(!m_pFile) return E_UNEXPECTED;
- HRESULT hr = S_OK;
+ HRESULT hr = S_OK;
- nKFs = 0;
+ nKFs = 0;
- for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++)
- {
- CAviFile::strm_t* s = m_pFile->m_strms[i];
- if(s->strh.fccType != FCC('vids')) continue;
+ for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[i];
+ if(s->strh.fccType != FCC('vids')) continue;
- for(int j = 0; j < s->cs.GetCount(); j++)
- {
- CAviFile::strm_t::chunk& c = s->cs[j];
- if(c.fKeyFrame) nKFs++;
- }
+ for(int j = 0; j < s->cs.GetCount(); j++)
+ {
+ CAviFile::strm_t::chunk& c = s->cs[j];
+ if(c.fKeyFrame) nKFs++;
+ }
- if(nKFs == s->cs.GetCount())
- hr = S_FALSE;
+ if(nKFs == s->cs.GetCount())
+ hr = S_FALSE;
- break;
- }
+ break;
+ }
- return hr;
+ return hr;
}
STDMETHODIMP CAviSplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs)
{
- CheckPointer(pFormat, E_POINTER);
- CheckPointer(pKFs, E_POINTER);
+ CheckPointer(pFormat, E_POINTER);
+ CheckPointer(pKFs, E_POINTER);
- if(!m_pFile) return E_UNEXPECTED;
- if(*pFormat != TIME_FORMAT_MEDIA_TIME && *pFormat != TIME_FORMAT_FRAME) return E_INVALIDARG;
+ if(!m_pFile) return E_UNEXPECTED;
+ if(*pFormat != TIME_FORMAT_MEDIA_TIME && *pFormat != TIME_FORMAT_FRAME) return E_INVALIDARG;
- UINT nKFsTmp = 0;
+ UINT nKFsTmp = 0;
- for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++)
- {
- CAviFile::strm_t* s = m_pFile->m_strms[i];
- if(s->strh.fccType != FCC('vids')) continue;
+ for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[i];
+ if(s->strh.fccType != FCC('vids')) continue;
- bool fConvertToRefTime = !!(*pFormat == TIME_FORMAT_MEDIA_TIME);
+ bool fConvertToRefTime = !!(*pFormat == TIME_FORMAT_MEDIA_TIME);
- for(int j = 0; j < s->cs.GetCount() && nKFsTmp < nKFs; j++)
- {
- if(s->cs[j].fKeyFrame)
- pKFs[nKFsTmp++] = fConvertToRefTime ? s->GetRefTime(j, s->cs[j].size) : j;
- }
+ for(int j = 0; j < s->cs.GetCount() && nKFsTmp < nKFs; j++)
+ {
+ if(s->cs[j].fKeyFrame)
+ pKFs[nKFsTmp++] = fConvertToRefTime ? s->GetRefTime(j, s->cs[j].size) : j;
+ }
- break;
- }
+ break;
+ }
- nKFs = nKFsTmp;
+ nKFs = nKFsTmp;
- return S_OK;
+ return S_OK;
}
//
@@ -854,10 +826,10 @@ STDMETHODIMP CAviSplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENCE_TIM
//
CAviSourceFilter::CAviSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CAviSplitterFilter(pUnk, phr)
+ : CAviSplitterFilter(pUnk, phr)
{
- m_clsid = __uuidof(this);
- m_pInput.Free();
+ m_clsid = __uuidof(this);
+ m_pInput.Free();
}
//
@@ -865,29 +837,29 @@ CAviSourceFilter::CAviSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
//
CAviSplitterOutputPin::CAviSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
- : CBaseSplitterOutputPin(mts, pName, pFilter, pLock, phr)
+ : CBaseSplitterOutputPin(mts, pName, pFilter, pLock, phr)
{
}
HRESULT CAviSplitterOutputPin::CheckConnect(IPin* pPin)
{
- int iPosition = 0;
- CMediaType mt;
- while(S_OK == GetMediaType(iPosition++, &mt))
- {
- if(mt.majortype == MEDIATYPE_Video
- && (mt.subtype == FOURCCMap(FCC('IV32'))
- || mt.subtype == FOURCCMap(FCC('IV31'))
- || mt.subtype == FOURCCMap(FCC('IF09'))))
- {
- CLSID clsid = GetCLSID(GetFilterFromPin(pPin));
- if(clsid == CLSID_VideoMixingRenderer || clsid == CLSID_OverlayMixer)
- return E_FAIL;
- }
-
- mt.InitMediaType();
- }
-
- return __super::CheckConnect(pPin);
+ int iPosition = 0;
+ CMediaType mt;
+ while(S_OK == GetMediaType(iPosition++, &mt))
+ {
+ if(mt.majortype == MEDIATYPE_Video
+ && (mt.subtype == FOURCCMap(FCC('IV32'))
+ || mt.subtype == FOURCCMap(FCC('IV31'))
+ || mt.subtype == FOURCCMap(FCC('IF09'))))
+ {
+ CLSID clsid = GetCLSID(GetFilterFromPin(pPin));
+ if(clsid == CLSID_VideoMixingRenderer || clsid == CLSID_OverlayMixer)
+ return E_FAIL;
+ }
+
+ mt.InitMediaType();
+ }
+
+ return __super::CheckConnect(pPin);
}
diff --git a/src/filters/parser/AviSplitter/AviSplitter.h b/src/filters/parser/AviSplitter/AviSplitter.h
index d8e59040b..f3e0c50cf 100644
--- a/src/filters/parser/AviSplitter/AviSplitter.h
+++ b/src/filters/parser/AviSplitter/AviSplitter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -30,57 +30,57 @@ class CAviFile;
class CAviSplitterOutputPin : public CBaseSplitterOutputPin
{
public:
- CAviSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ CAviSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
- HRESULT CheckConnect(IPin* pPin);
+ HRESULT CheckConnect(IPin* pPin);
};
[uuid("9736D831-9D6C-4E72-B6E7-560EF9181001")]
class CAviSplitterFilter : public CBaseSplitterFilter
{
- CAutoVectorPtr<DWORD> m_tFrame;
+ CAutoVectorPtr<DWORD> m_tFrame;
protected:
- CAutoPtr<CAviFile> m_pFile;
- HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+ CAutoPtr<CAviFile> m_pFile;
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
- bool DemuxInit();
- void DemuxSeek(REFERENCE_TIME rt);
- bool DemuxLoop();
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
- HRESULT ReIndex(__int64 end, UINT64* pSize);
+ HRESULT ReIndex(__int64 end, UINT64* pSize);
public:
- CAviSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ CAviSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
- DECLARE_IUNKNOWN;
+ DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- // IMediaSeeking
+ // IMediaSeeking
- STDMETHODIMP GetDuration(LONGLONG* pDuration);
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
- // TODO: this is too ugly, integrate this with the baseclass somehow
- GUID m_timeformat;
- STDMETHODIMP IsFormatSupported(const GUID* pFormat);
- STDMETHODIMP GetTimeFormat(GUID* pFormat);
- STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat);
- STDMETHODIMP SetTimeFormat(const GUID* pFormat);
- STDMETHODIMP GetStopPosition(LONGLONG* pStop);
- STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat);
- STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop);
+ // TODO: this is too ugly, integrate this with the baseclass somehow
+ GUID m_timeformat;
+ STDMETHODIMP IsFormatSupported(const GUID* pFormat);
+ STDMETHODIMP GetTimeFormat(GUID* pFormat);
+ STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat);
+ STDMETHODIMP SetTimeFormat(const GUID* pFormat);
+ STDMETHODIMP GetStopPosition(LONGLONG* pStop);
+ STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat);
+ STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop);
- HRESULT SetPositionsInternal(void* id, LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
+ HRESULT SetPositionsInternal(void* id, LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
- // IKeyFrameInfo
+ // IKeyFrameInfo
- STDMETHODIMP GetKeyFrameCount(UINT& nKFs);
- STDMETHODIMP GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs);
+ STDMETHODIMP GetKeyFrameCount(UINT& nKFs);
+ STDMETHODIMP GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs);
};
[uuid("CEA8DEFF-0AF7-4DB9-9A38-FB3C3AEFC0DE")]
class CAviSourceFilter : public CAviSplitterFilter
{
public:
- CAviSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ CAviSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
};
diff --git a/src/filters/parser/AviSplitter/resource.h b/src/filters/parser/AviSplitter/resource.h
index 80a8d5879..f29274003 100644
--- a/src/filters/parser/AviSplitter/resource.h
+++ b/src/filters/parser/AviSplitter/resource.h
@@ -3,7 +3,7 @@
// Used by AviSplitter.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/parser/AviSplitter/stdafx.cpp b/src/filters/parser/AviSplitter/stdafx.cpp
index 793af597c..c356f5dba 100644
--- a/src/filters/parser/AviSplitter/stdafx.cpp
+++ b/src/filters/parser/AviSplitter/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/AviSplitter/stdafx.h b/src/filters/parser/AviSplitter/stdafx.h
index ec6ed9d77..5f53f59b5 100644
--- a/src/filters/parser/AviSplitter/stdafx.h
+++ b/src/filters/parser/AviSplitter/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/