diff options
author | Underground78 <underground78@users.sourceforge.net> | 2014-05-30 16:18:15 +0400 |
---|---|---|
committer | Underground78 <underground78@users.sourceforge.net> | 2014-06-04 23:15:03 +0400 |
commit | 2c9f57f85c9a5c870c3f182248d7482a519faad1 (patch) | |
tree | fd82e7390d785f88d6985960e07debd5fd9de5a1 /src/filters/transform | |
parent | 25ad8dec38d65bceef826f1c7d70422705c656f7 (diff) |
VSFilter: Be more careful when using IMediaSample2 interface.
Diffstat (limited to 'src/filters/transform')
-rw-r--r-- | src/filters/transform/VSFilter/DirectVobSubFilter.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/filters/transform/VSFilter/DirectVobSubFilter.cpp b/src/filters/transform/VSFilter/DirectVobSubFilter.cpp index 87392c783..35d2f7d06 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<IMediaSample2> pOut;
+ CComPtr<IMediaSample> pOut;
BYTE* pDataOut = nullptr;
- if (FAILED(hr = GetDeliveryBuffer(spd.w, spd.h, (IMediaSample**)&pOut))
+ if (FAILED(hr = GetDeliveryBuffer(spd.w, spd.h, &pOut))
|| FAILED(hr = pOut->GetPointer(&pDataOut))) {
return hr;
}
@@ -262,12 +262,16 @@ 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);
+ CComQIPtr<IMediaSample2> pIn2 = pIn;
+ CComQIPtr<IMediaSample2> pOut2 = pOut;
+ if (pIn2 && pOut2) {
+ AM_SAMPLE2_PROPERTIES inputProps;
+ if (SUCCEEDED(pIn2->GetProperties(sizeof(inputProps), (BYTE*)&inputProps))) {
+ AM_SAMPLE2_PROPERTIES outProps;
+ if (SUCCEEDED(pOut2->GetProperties(sizeof(outProps), (BYTE*)&outProps))) {
+ outProps.dwTypeSpecificFlags = inputProps.dwTypeSpecificFlags;
+ pOut2->SetProperties(sizeof(outProps), (BYTE*)&outProps);
+ }
}
}
|