diff options
author | kasper93 <kasper93@gmail.com> | 2014-04-14 17:07:44 +0400 |
---|---|---|
committer | kasper93 <kasper93@gmail.com> | 2014-05-03 00:41:14 +0400 |
commit | 42536aba621a1dd48555481e726f52ec4e8b1f91 (patch) | |
tree | 32a90ca5372f5e4c4cf19e0d49ad78c0d70f00d4 /src/filters/transform | |
parent | de0c6509bbbf9a0fc1f350af31408392ddc997f2 (diff) |
VSFilter: Pass through dwTypeSpecificFlags and dwInterlaceFlags.
This fixes interlaced videos.
Fixes #2671
Diffstat (limited to 'src/filters/transform')
3 files changed, 15 insertions, 10 deletions
diff --git a/src/filters/transform/BaseVideoFilter/BaseVideoFilter.cpp b/src/filters/transform/BaseVideoFilter/BaseVideoFilter.cpp index 8fda39662..1cdedbb20 100644 --- a/src/filters/transform/BaseVideoFilter/BaseVideoFilter.cpp +++ b/src/filters/transform/BaseVideoFilter/BaseVideoFilter.cpp @@ -577,6 +577,8 @@ HRESULT CBaseVideoFilter::GetMediaType(int iPosition, CMediaType* pmt) bihOut.biCompression = fmts[iPosition / 2].biCompression;
bihOut.biSizeImage = w * h * bihOut.biBitCount >> 3;
+ const CMediaType& mt = m_pInput->CurrentMediaType();
+
if (iPosition & 1) {
pmt->formattype = FORMAT_VideoInfo;
VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
@@ -591,13 +593,9 @@ HRESULT CBaseVideoFilter::GetMediaType(int iPosition, CMediaType* pmt) vih->bmiHeader = bihOut;
vih->dwPictAspectRatioX = arx;
vih->dwPictAspectRatioY = ary;
- if (IsVideoInterlaced()) {
- vih->dwInterlaceFlags = AMINTERLACE_IsInterlaced | AMINTERLACE_DisplayModeBobOrWeave;
- }
+ vih->dwInterlaceFlags = ((VIDEOINFOHEADER2*)mt.Format())->dwInterlaceFlags;
}
- CMediaType& mt = m_pInput->CurrentMediaType();
-
// these fields have the same field offset in all four structs
((VIDEOINFOHEADER*)pmt->Format())->AvgTimePerFrame = ((VIDEOINFOHEADER*)mt.Format())->AvgTimePerFrame;
((VIDEOINFOHEADER*)pmt->Format())->dwBitRate = ((VIDEOINFOHEADER*)mt.Format())->dwBitRate;
@@ -607,9 +605,8 @@ HRESULT CBaseVideoFilter::GetMediaType(int iPosition, CMediaType* pmt) if (!vsfilter) {
// copy source and target rectangles from input pin
- CMediaType& pmtInput = m_pInput->CurrentMediaType();
VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->Format();
- VIDEOINFOHEADER* vihInput = (VIDEOINFOHEADER*)pmtInput.Format();
+ VIDEOINFOHEADER* vihInput = (VIDEOINFOHEADER*)mt.Format();
ASSERT(vih);
if (vihInput && (vihInput->rcSource.right != 0) && (vihInput->rcSource.bottom != 0)) {
diff --git a/src/filters/transform/BaseVideoFilter/BaseVideoFilter.h b/src/filters/transform/BaseVideoFilter/BaseVideoFilter.h index 97927a785..df78467db 100644 --- a/src/filters/transform/BaseVideoFilter/BaseVideoFilter.h +++ b/src/filters/transform/BaseVideoFilter/BaseVideoFilter.h @@ -50,7 +50,6 @@ protected: virtual void GetOutputSize(int& w, int& h, int& arx, int& ary, int& RealWidth, int& RealHeight, int& vsfilter) {}
virtual HRESULT Transform(IMediaSample* pIn) = 0;
- virtual bool IsVideoInterlaced() { return false; }
virtual void GetOutputFormats(int& nNumber, VIDEO_OUTPUT_FORMATS** ppFormats);
bool ConnectionWhitelistedForExtendedFormat();
diff --git a/src/filters/transform/VSFilter/DirectVobSubFilter.cpp b/src/filters/transform/VSFilter/DirectVobSubFilter.cpp index 60fd909e0..c26cffcf4 100644 --- a/src/filters/transform/VSFilter/DirectVobSubFilter.cpp +++ b/src/filters/transform/VSFilter/DirectVobSubFilter.cpp @@ -248,9 +248,9 @@ HRESULT CDirectVobSubFilter::Transform(IMediaSample* pIn) //
- CComPtr<IMediaSample> pOut;
+ CComPtr<IMediaSample2> pOut;
BYTE* pDataOut = nullptr;
- if (FAILED(hr = GetDeliveryBuffer(spd.w, spd.h, &pOut))
+ if (FAILED(hr = GetDeliveryBuffer(spd.w, spd.h, (IMediaSample**)&pOut))
|| FAILED(hr = pOut->GetPointer(&pDataOut))) {
return hr;
}
@@ -262,6 +262,15 @@ HRESULT CDirectVobSubFilter::Transform(IMediaSample* pIn) pOut->SetSyncPoint(pIn->IsSyncPoint() == S_OK);
pOut->SetPreroll(pIn->IsPreroll() == S_OK);
+ AM_SAMPLE2_PROPERTIES inputProps;
+ if (SUCCEEDED(((IMediaSample2*)pIn)->GetProperties(sizeof(inputProps), (BYTE*)&inputProps))) {
+ AM_SAMPLE2_PROPERTIES outProps;
+ if (SUCCEEDED(pOut->GetProperties(sizeof(outProps), (BYTE*)&outProps))) {
+ outProps.dwTypeSpecificFlags = inputProps.dwTypeSpecificFlags;
+ pOut->SetProperties(sizeof(outProps), (BYTE*)&outProps);
+ }
+ }
+
//
BITMAPINFOHEADER bihOut;
|