summaryrefslogtreecommitdiff
path: root/avstream/sampledevicemft/multipinmft.cpp
diff options
context:
space:
mode:
authorJoel Corley <[email protected]>2018-06-29 19:19:18 -0700
committerJoel Corley <[email protected]>2018-06-29 19:19:18 -0700
commit30ddbb997660fa4ae3608759b9d2d0789774ccdc (patch)
treed656c50cea303cb554460d529038fe5364634b01 /avstream/sampledevicemft/multipinmft.cpp
parent6c1981b8504329521343ad00f32daa847fa6083a (diff)
Update AVStream / Camera samples for RS4.
Diffstat (limited to 'avstream/sampledevicemft/multipinmft.cpp')
-rw-r--r--avstream/sampledevicemft/multipinmft.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/avstream/sampledevicemft/multipinmft.cpp b/avstream/sampledevicemft/multipinmft.cpp
index 4b9a10e2..5a3bb933 100644
--- a/avstream/sampledevicemft/multipinmft.cpp
+++ b/avstream/sampledevicemft/multipinmft.cpp
@@ -27,6 +27,7 @@ CMultipinMft::CMultipinMft()
m_filterInWarmStart(false)
#if defined (MF_DEVICEMFT_PHTOTOCONFIRMATION)
, m_spPhotoConfirmationCallback(nullptr)
+ , m_firePhotoConfirmation(FALSE)
#endif
{
HRESULT hr = S_OK;
@@ -156,6 +157,9 @@ done:
--*/
+// This Sample will create a grayscale for known media types. Please remove MF_DEVICEMFT_ADD_GRAYSCALER_ to remove the grayscaler
+// This sample also has photo confirmation enabled remove DMF_DEVICEMFT_PHTOTOCONFIRMATION to remove photo confirmation
+
STDMETHODIMP CMultipinMft::InitializeTransform (
_In_ IMFAttributes *pAttributes
)
@@ -681,6 +685,8 @@ STDMETHODIMP CMultipinMft::ProcessInput(
DMFTCHECKHR_GOTO( inPin->SendSample( pSample ), done );
done:
DMFTRACE( DMFT_GENERAL, TRACE_LEVEL_INFORMATION, "%!FUNC! exiting %x = %!HRESULT!", hr, hr );
+ // Workaround A Bug in the pipeline which is incorrectly not releasing the sample
+ SAFE_RELEASE(pSample);
return hr;
}
@@ -723,22 +729,24 @@ output pins and populate the corresponding MFT_OUTPUT_DATA_BUFFER with the sampl
pdwStatus ) ) )
{
gotOne = true;
- // Do photo confirmation if enabled
+ // Do photo confirmation if enabled off the preview stream only
#if defined (MF_DEVICEMFT_PHTOTOCONFIRMATION)
- BOOL pIsImagePin = FALSE;
+ BOOL pIsPreviewPin = FALSE;
if (pOutputSamples[i].pSample &&
IsPhotoConfirmationEnabled() &&
- (SUCCEEDED(CheckImagePin(static_cast<IMFAttributes*>(poPin), &pIsImagePin)) && pIsImagePin))
+ ((SUCCEEDED(CheckPreviewPin(static_cast<IMFAttributes*>(poPin), &pIsPreviewPin)) && pIsPreviewPin) &&
+ InterlockedCompareExchange(reinterpret_cast<PLONG>(&m_firePhotoConfirmation),FALSE,TRUE)))
{
+ // Please note photo confirmation should always be fired off the preview stream.
ComPtr<IMFMediaType> spMediaType;
if (SUCCEEDED(poPin->getMediaType(spMediaType.GetAddressOf())))
{
// Do Photo confirmation
ProcessCapturePhotoConfirmationCallBack(spMediaType.Get(), pOutputSamples[i].pSample);
+ m_firePhotoConfirmation = FALSE;
}
}
#endif
-
}
}
if (gotOne)
@@ -1071,6 +1079,9 @@ STDMETHODIMP CMultipinMft::KsProperty(
else
{
DMFTRACE(DMFT_GENERAL, TRACE_LEVEL_INFORMATION, "%!FUNC! Take Single Photo Trigger");
+#if defined (MF_DEVICEMFT_PHTOTOCONFIRMATION)
+ InterlockedExchange(reinterpret_cast<PLONG>(&m_firePhotoConfirmation),TRUE);
+#endif
}
}
}