Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/LAVFilters.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2012-10-20 10:54:12 +0400
committerHendrik Leppkes <h.leppkes@gmail.com>2012-10-20 10:54:12 +0400
commitff9099febfe59761565bfe73774d0cafa2fce043 (patch)
tree7ba4c4162737f5c1fe47e1a273fa5838984fb609 /decoder/LAVVideo
parent08b7ba62558667c76b885a4b1082fd66b67f8d2e (diff)
Add a HACK for SageTV's MpegDemux screwed up VC-1 timestamps.
Diffstat (limited to 'decoder/LAVVideo')
-rw-r--r--decoder/LAVVideo/LAVVideo.cpp6
-rw-r--r--decoder/LAVVideo/decoders/DecBase.h10
-rw-r--r--decoder/LAVVideo/decoders/ILAVDecoder.h1
-rw-r--r--decoder/LAVVideo/decoders/quicksync.cpp5
4 files changed, 20 insertions, 2 deletions
diff --git a/decoder/LAVVideo/LAVVideo.cpp b/decoder/LAVVideo/LAVVideo.cpp
index 6469e21b..e66e46b6 100644
--- a/decoder/LAVVideo/LAVVideo.cpp
+++ b/decoder/LAVVideo/LAVVideo.cpp
@@ -578,13 +578,15 @@ HRESULT CLAVVideo::CreateDecoder(const CMediaType *pmt)
}
}
+ BOOL bSageVC1Hack = (codec == AV_CODEC_ID_VC1) && FilterInGraph(PINDIR_INPUT, CLSID_SageTVMpegDeMux);
+
// Certain filters send VC-1 in PTS instead of DTS, so list them here
// Usually, these are MPEG systems.
BOOL bVC1DTS = (codec == AV_CODEC_ID_VC1) &&
!(FilterInGraph(PINDIR_INPUT, CLSID_MPCHCMPEGSplitter)
|| FilterInGraph(PINDIR_INPUT, CLSID_MPCHCMPEGSplitterSource)
|| FilterInGraph(PINDIR_INPUT, CLSID_MPBDReader)
- || FilterInGraph(PINDIR_INPUT, CLSID_SageTVMpegDeMux));
+ || bSageVC1Hack);
BOOL bH264IsAVI = (codec == AV_CODEC_ID_H264 && ((m_LAVPinInfoValid && (m_LAVPinInfo.flags & LAV_STREAM_FLAG_H264_DTS)) || (!m_LAVPinInfoValid && pszExtension && _wcsicmp(pszExtension, L".avi") == 0)));
BOOL bLAVSplitter = FilterInGraph(PINDIR_INPUT, CLSID_LAVSplitterSource) || FilterInGraph(PINDIR_INPUT, CLSID_LAVSplitter);
@@ -606,6 +608,8 @@ HRESULT CLAVVideo::CreateDecoder(const CMediaType *pmt)
m_dwDecodeFlags |= LAV_VIDEO_DEC_FLAG_DVD;
if (bTheoraMPCHCOgg)
m_dwDecodeFlags |= LAV_VIDEO_DEC_FLAG_NO_MT;
+ if (bSageVC1Hack)
+ m_dwDecodeFlags |= LAV_VIDEO_DEC_FLAG_SAGE_HACK;
SAFE_CO_FREE(pszExtension);
diff --git a/decoder/LAVVideo/decoders/DecBase.h b/decoder/LAVVideo/decoders/DecBase.h
index 49c2db99..81c58287 100644
--- a/decoder/LAVVideo/decoders/DecBase.h
+++ b/decoder/LAVVideo/decoders/DecBase.h
@@ -25,7 +25,7 @@
class CDecBase : public ILAVDecoder
{
public:
- CDecBase(void) : m_pSettings(NULL), m_pCallback(NULL) {}
+ CDecBase(void) : m_pSettings(NULL), m_pCallback(NULL), m_rtTimestampBuffer(0) {}
virtual ~CDecBase(void) {}
STDMETHOD(Init)() PURE;
@@ -65,10 +65,16 @@ public:
long nSize = pSample->GetActualDataLength();
m_pCallback->DVDStripPacket(pData, nSize);
+ if (m_pCallback->GetDecodeFlags() & LAV_VIDEO_DEC_FLAG_SAGE_HACK) {
+ FFSWAP(REFERENCE_TIME, rtStart, m_rtTimestampBuffer);
+ rtStop = AV_NOPTS_VALUE;
+ }
+
return Decode(pData, nSize, rtStart, rtStop, pSample->IsSyncPoint() == S_OK, pSample->IsDiscontinuity() == S_OK);
}
STDMETHODIMP Flush() {
+ m_rtTimestampBuffer = 0;
return S_OK;
};
@@ -89,4 +95,6 @@ protected:
protected:
ILAVVideoSettings *m_pSettings;
ILAVVideoCallback *m_pCallback;
+
+ REFERENCE_TIME m_rtTimestampBuffer;
};
diff --git a/decoder/LAVVideo/decoders/ILAVDecoder.h b/decoder/LAVVideo/decoders/ILAVDecoder.h
index 80505944..9269f425 100644
--- a/decoder/LAVVideo/decoders/ILAVDecoder.h
+++ b/decoder/LAVVideo/decoders/ILAVDecoder.h
@@ -209,6 +209,7 @@ interface ILAVVideoCallback
#define LAV_VIDEO_DEC_FLAG_LAVSPLITTER 0x00000008
#define LAV_VIDEO_DEC_FLAG_DVD 0x00000010
#define LAV_VIDEO_DEC_FLAG_NO_MT 0x00000020
+#define LAV_VIDEO_DEC_FLAG_SAGE_HACK 0x00000040
/**
* Check wether we're running on Vista or newer
diff --git a/decoder/LAVVideo/decoders/quicksync.cpp b/decoder/LAVVideo/decoders/quicksync.cpp
index 1d62b357..e1bf01df 100644
--- a/decoder/LAVVideo/decoders/quicksync.cpp
+++ b/decoder/LAVVideo/decoders/quicksync.cpp
@@ -430,6 +430,11 @@ STDMETHODIMP CDecQuickSync::Decode(IMediaSample *pSample)
else if (hr == VFW_S_NO_STOP_TIME)
rtStop = AV_NOPTS_VALUE;
+ if (m_pCallback->GetDecodeFlags() & LAV_VIDEO_DEC_FLAG_SAGE_HACK) {
+ FFSWAP(REFERENCE_TIME, rtStart, m_rtTimestampBuffer);
+ rtStop = AV_NOPTS_VALUE;
+ }
+
if (rtStart != AV_NOPTS_VALUE) {
rtStart += RTPADDING;
if (rtStart < 0)