diff options
author | Aleksoid <aleksoid@users.sourceforge.net> | 2012-03-15 04:09:30 +0400 |
---|---|---|
committer | Aleksoid <aleksoid@users.sourceforge.net> | 2012-03-15 04:09:30 +0400 |
commit | aa38b97d615f562d9ba2bdde11ec9b26dba43e9a (patch) | |
tree | c1f4805fce55f5010351dcaad1e36897d1847872 /src/filters/parser | |
parent | 5a7aa75614e9ece7b62182298cd119d7ba6be878 (diff) |
Fix : MPCVideoDec bad playback VC1 with pulldown in MPEG-TS;
small code refactoring;
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@4147 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/parser')
5 files changed, 36 insertions, 27 deletions
diff --git a/src/filters/parser/MpegSplitter/IMpegSplitterFilter.h b/src/filters/parser/MpegSplitter/IMpegSplitterFilter.h index e5f59c48f..88f64fac3 100644 --- a/src/filters/parser/MpegSplitter/IMpegSplitterFilter.h +++ b/src/filters/parser/MpegSplitter/IMpegSplitterFilter.h @@ -50,4 +50,6 @@ public IUnknown { STDMETHOD(SetAlternativeDuration(BOOL nValue)) = 0;
STDMETHOD_(BOOL, GetAlternativeDuration()) = 0;
+
+ STDMETHOD_(int, GetMPEGType()) = 0;
};
diff --git a/src/filters/parser/MpegSplitter/MpegSplitter.cpp b/src/filters/parser/MpegSplitter/MpegSplitter.cpp index c6efa7e2b..8338e657a 100644 --- a/src/filters/parser/MpegSplitter/MpegSplitter.cpp +++ b/src/filters/parser/MpegSplitter/MpegSplitter.cpp @@ -647,7 +647,7 @@ HRESULT CMpegSplitterFilter::DemuxNextPacket(REFERENCE_TIME rtStartOffset) HRESULT hr;
BYTE b;
- if (m_pFile->m_type == CMpegSplitterFile::ps || m_pFile->m_type == CMpegSplitterFile::es) {
+ if (m_pFile->m_type == mpeg_ps || m_pFile->m_type == mpeg_es) {
if (!m_pFile->NextMpegStartCode(b)) {
return S_FALSE;
}
@@ -695,7 +695,7 @@ HRESULT CMpegSplitterFilter::DemuxNextPacket(REFERENCE_TIME rtStartOffset) }
m_pFile->Seek(pos + h.len);
}
- } else if (m_pFile->m_type == CMpegSplitterFile::ts) {
+ } else if (m_pFile->m_type == mpeg_ts) {
CMpegSplitterFile::trhdr h;
if (!m_pFile->Read(h)) {
@@ -745,7 +745,7 @@ HRESULT CMpegSplitterFilter::DemuxNextPacket(REFERENCE_TIME rtStartOffset) }
m_pFile->Seek(h.next);
- } else if (m_pFile->m_type == CMpegSplitterFile::pva) {
+ } else if (m_pFile->m_type == mpeg_pva) {
CMpegSplitterFile::pvahdr h;
if (!m_pFile->Read(h)) {
return S_FALSE;
@@ -797,7 +797,7 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) return hr;
}
- if (m_pFile->m_type == CMpegSplitterFile::ps) {
+ if (m_pFile->m_type == mpeg_ps) {
if (m_pInput && m_pInput->IsConnected() && (GetCLSID(m_pInput->GetConnected()) == GUIDFromCString(_T("{773EAEDE-D5EE-4fce-9C8F-C4F53D0A2F73}")))) { // MPC VTS Reader
pTI = GetFilterFromPin(m_pInput->GetConnected());
}
@@ -1563,6 +1563,11 @@ STDMETHODIMP_(BOOL) CMpegSplitterFilter::GetAlternativeDuration() return m_AlternativeDuration;
}
+STDMETHODIMP_(int) CMpegSplitterFilter::GetMPEGType()
+{
+ CAutoLock cAutoLock(&m_csProps);
+ return m_pFile->m_type;
+}
//
// CMpegSourceFilter
//
@@ -2031,7 +2036,7 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) BYTE* start = p->GetData();
p->SetData(start + 4, p->GetCount() - 4);
// Dolby_AC3
- } else if ((m_type == CMpegSplitterFile::ts) &&
+ } else if ((m_type == mpeg_ts) &&
(m_mt.subtype == MEDIASUBTYPE_DOLBY_AC3) &&
(static_cast<CMpegSplitterFilter*>(m_pFilter))->StreamIsTrueHD(p->TrackNumber) &&
(static_cast<CMpegSplitterFilter*>(m_pFilter))->GetTrueHD() != 2) {
diff --git a/src/filters/parser/MpegSplitter/MpegSplitter.h b/src/filters/parser/MpegSplitter/MpegSplitter.h index 095d1848a..77db82544 100644 --- a/src/filters/parser/MpegSplitter/MpegSplitter.h +++ b/src/filters/parser/MpegSplitter/MpegSplitter.h @@ -136,6 +136,8 @@ public: STDMETHODIMP SetAlternativeDuration(BOOL nValue);
STDMETHODIMP_(BOOL) GetAlternativeDuration();
+
+ STDMETHODIMP_(int) GetMPEGType();
};
class __declspec(uuid("1365BE7A-C86A-473C-9A41-C0A6E82C9FA3"))
diff --git a/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp b/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp index ea201fafd..405393872 100644 --- a/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp +++ b/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp @@ -31,7 +31,7 @@ CMpegSplitterFile::CMpegSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr, bool bIsHdmv, CHdmvClipInfo &ClipInfo, int guid_flag, bool ForcedSub, bool TrackPriority, int AC3CoreOnly, bool AlternativeDuration)
: CBaseSplitterFileEx(pAsyncReader, hr, DEFAULT_CACHE_LENGTH, false, true)
- , m_type(us)
+ , m_type(mpeg_us)
, m_rate(0)
, m_rtMin(0), m_rtMax(0)
, m_posMin(0), m_posMax(0)
@@ -55,11 +55,11 @@ HRESULT CMpegSplitterFile::Init(IAsyncReader* pAsyncReader) // get the type first
- m_type = us;
+ m_type = mpeg_us;
Seek(0);
- if (m_type == us) {
+ if (m_type == mpeg_us) {
if (BitRead(32, true) == 'TFrc') {
Seek(0x67c);
}
@@ -68,13 +68,13 @@ HRESULT CMpegSplitterFile::Init(IAsyncReader* pAsyncReader) Seek(h.next);
}
if (cnt >= limit) {
- m_type = ts;
+ m_type = mpeg_ts;
}
}
Seek(0);
- if (m_type == us) {
+ if (m_type == mpeg_us) {
if (BitRead(32, true) == 'TFrc') {
Seek(0xE80);
}
@@ -83,31 +83,31 @@ HRESULT CMpegSplitterFile::Init(IAsyncReader* pAsyncReader) Seek(h.next);
}
if (cnt >= limit) {
- m_type = ts;
+ m_type = mpeg_ts;
}
}
Seek(0);
- if (m_type == us) {
+ if (m_type == mpeg_us) {
int cnt = 0, limit = 4;
for (pvahdr h; cnt < limit && Read(h); cnt++) {
Seek(GetPos() + h.length);
}
if (cnt >= limit) {
- m_type = pva;
+ m_type = mpeg_pva;
}
}
Seek(0);
- if (m_type == us) {
+ if (m_type == mpeg_us) {
BYTE b;
- for (int i = 0; (i < 4 || GetPos() < 65536) && m_type == us && NextMpegStartCode(b); i++) {
+ for (int i = 0; (i < 4 || GetPos() < 65536) && m_type == mpeg_us && NextMpegStartCode(b); i++) {
if (b == 0xba) {
pshdr h;
if (Read(h)) {
- m_type = ps;
+ m_type = mpeg_ps;
m_rate = int(h.bitrate/8);
break;
}
@@ -117,7 +117,7 @@ HRESULT CMpegSplitterFile::Init(IAsyncReader* pAsyncReader) || b == 0xbd) { // private stream 1, 0xbd, ac3/dts/lpcm/subpic
peshdr h;
if (Read(h, b) && BitRead(24, true) == 0x000001) {
- m_type = es;
+ m_type = mpeg_es;
}
}
}
@@ -125,7 +125,7 @@ HRESULT CMpegSplitterFile::Init(IAsyncReader* pAsyncReader) Seek(0);
- if (m_type == us) {
+ if (m_type == mpeg_us) {
return E_FAIL;
}
@@ -163,7 +163,7 @@ HRESULT CMpegSplitterFile::Init(IAsyncReader* pAsyncReader) }
}
- if (m_type == ts) {
+ if (m_type == mpeg_ts) {
if (IsRandomAccess() || IsStreaming()) {
if (IsStreaming()) {
for (int i = 0; i < 20 || i < 50 && S_OK != HasMoreData(1024*100, 100); i++) {
@@ -214,7 +214,7 @@ HRESULT CMpegSplitterFile::Init(IAsyncReader* pAsyncReader) #endif
// Add fake Subtitle stream ...
- if (m_type == ts) {
+ if (m_type == mpeg_ts) {
if (m_streams[video].GetCount()) {
if (!m_bIsHdmv && m_streams[subpic].GetCount()) {
stream s;
@@ -274,7 +274,7 @@ REFERENCE_TIME CMpegSplitterFile::NextPTS(DWORD TrackNum) BYTE b;
while (GetRemaining()) {
- if (m_type == ps || m_type == es) {
+ if (m_type == mpeg_ps || m_type == mpeg_es) {
if (!NextMpegStartCode(b)) { // continue;
ASSERT(0);
break;
@@ -298,7 +298,7 @@ REFERENCE_TIME CMpegSplitterFile::NextPTS(DWORD TrackNum) Seek(pos + h.len);
}
- } else if (m_type == ts) {
+ } else if (m_type == mpeg_ts) {
trhdr h;
if (!Read(h)) {
continue;
@@ -318,7 +318,7 @@ REFERENCE_TIME CMpegSplitterFile::NextPTS(DWORD TrackNum) }
Seek(h.next);
- } else if (m_type == pva) {
+ } else if (m_type == mpeg_pva) {
pvahdr h;
if (!Read(h)) {
continue;
@@ -349,7 +349,7 @@ HRESULT CMpegSplitterFile::SearchStreams(__int64 start, __int64 stop, IAsyncRead while (GetPos() < stop) {
BYTE b;
- if (m_type == ps || m_type == es) {
+ if (m_type == mpeg_ps || m_type == mpeg_es) {
if (!NextMpegStartCode(b)) {
continue;
}
@@ -396,7 +396,7 @@ HRESULT CMpegSplitterFile::SearchStreams(__int64 start, __int64 stop, IAsyncRead Seek(pos + h.len);
}
}
- } else if (m_type == ts) {
+ } else if (m_type == mpeg_ts) {
trhdr h;
if (!Read(h)) {
continue;
@@ -454,7 +454,7 @@ HRESULT CMpegSplitterFile::SearchStreams(__int64 start, __int64 stop, IAsyncRead }
Seek(h.next);
- } else if (m_type == pva) {
+ } else if (m_type == mpeg_pva) {
pvahdr h;
if (!Read(h)) {
continue;
diff --git a/src/filters/parser/MpegSplitter/MpegSplitterFile.h b/src/filters/parser/MpegSplitter/MpegSplitterFile.h index 44ab66972..4cb92ef8d 100644 --- a/src/filters/parser/MpegSplitter/MpegSplitterFile.h +++ b/src/filters/parser/MpegSplitter/MpegSplitterFile.h @@ -52,7 +52,7 @@ public: CCritSec m_csProps;
- enum {us, ps, ts, es, pva} m_type;
+ MPEG_TYPES m_type;
REFERENCE_TIME m_rtMin, m_rtMax;
__int64 m_posMin, m_posMax;
|