diff options
Diffstat (limited to 'avstream/sampledevicemft/basepin.h')
| -rw-r--r-- | avstream/sampledevicemft/basepin.h | 64 |
1 files changed, 45 insertions, 19 deletions
diff --git a/avstream/sampledevicemft/basepin.h b/avstream/sampledevicemft/basepin.h index faafd759..cce17d0b 100644 --- a/avstream/sampledevicemft/basepin.h +++ b/avstream/sampledevicemft/basepin.h @@ -369,7 +369,7 @@ public: __requires_lock_held(m_lock) __inline HRESULT Active() { - return (m_state == DeviceStreamState_Run)?S_OK:E_FAIL; + return (m_state == DeviceStreamState_Run)?S_OK:HRESULT_FROM_WIN32(ERROR_INVALID_STATE); } __inline DWORD streamId() { @@ -511,7 +511,7 @@ public: return m_preferredStreamState; } - void ReleaseConnectedPins(); + STDMETHOD_( VOID, ShutdownPin)(); protected: ComPtr<IMFTransform> m_spSourceTransform; /*Source Transform i.e. DevProxy*/ @@ -520,15 +520,27 @@ protected: DeviceStreamState m_preferredStreamState; ComPtr<IMFMediaType> m_spPrefferedMediaType; HANDLE m_waitInputMediaTypeWaiter; /*Set when the input media type is changed*/ + + // Helper functions +#if ((defined NTDDI_WIN10_VB) && (NTDDI_VERSION >= NTDDI_WIN10_VB)) + HRESULT ForwardSecureBuffer( + _In_ IMFSample *sample + ); +#endif }; class COutPin: public CBasePin{ public: - COutPin( _In_ ULONG id = 0, + COutPin( + _In_ ULONG id = 0, _In_opt_ CMultipinMft *pparent = NULL, - _In_ IKsControl* iksControl=NULL); + _In_ IKsControl* iksControl=NULL +#if ((defined NTDDI_WIN10_VB) && (NTDDI_VERSION >= NTDDI_WIN10_VB)) + , _In_ MFSampleAllocatorUsage allocatorUsage = MFSampleAllocatorUsage_DoesNotAllocate +#endif + ); ~COutPin(); STDMETHODIMP FlushQueues(); STDMETHODIMP AddPin( @@ -541,7 +553,7 @@ public: STDMETHODIMP GetOutputStreamInfo( _Out_ MFT_OUTPUT_STREAM_INFO *pStreamInfo ); - STDMETHODIMP ChangeMediaTypeFromInpin( + virtual STDMETHODIMP ChangeMediaTypeFromInpin( _In_ IMFMediaType *pInMediatype, _In_ IMFMediaType* pOutMediaType, _In_ DeviceStreamState state ); @@ -560,6 +572,16 @@ public: STDMETHODIMP_(VOID) SetFirstSample( _In_ BOOL ); + + STDMETHODIMP_(VOID) SetAllocator( + _In_ IMFVideoSampleAllocator* pAllocator + ); +#if ((defined NTDDI_WIN10_VB) && (NTDDI_VERSION >= NTDDI_WIN10_VB)) + MFSampleAllocatorUsage GetSampleAllocatorUsage() + { + return m_allocatorUsage; + } +#endif UINT32 GetMediatypeCount() { return (UINT32)m_listOfMediaTypes.size(); @@ -568,13 +590,17 @@ public: protected: CPinQueue * m_queue; /* Queue where the sample will be stored*/ BOOL m_firstSample; +#if ((defined NTDDI_WIN10_VB) && (NTDDI_VERSION >= NTDDI_WIN10_VB)) + MFSampleAllocatorUsage m_allocatorUsage; +#endif + wil::com_ptr_nothrow<IMFVideoSampleAllocator> m_spDefaultAllocator; + }; class CAsyncInPin: public CInPin { public: - STDMETHODIMP FlushQueues(); STDMETHODIMP SendSample( _In_ IMFSample * ); @@ -587,30 +613,19 @@ public: _In_ ULONG ulPinId, _In_ CMultipinMft *pParent) : CInPin(pAttributes, ulPinId, pParent) - , m_dwSamplesInFlight(0) - , m_hHandle(INVALID_HANDLE_VALUE) - , m_bFlushing(FALSE) , m_asyncCallback(nullptr) { - m_hHandle = CreateEvent(NULL, TRUE, TRUE, L"Async_Pin Event"); - if (m_hHandle == nullptr) - throw bad_alloc(); Init(); - } + STDMETHOD_(VOID, ShutdownPin)(); ~CAsyncInPin() { FlushQueues(); - CloseHandle(m_hHandle); - m_hHandle = INVALID_HANDLE_VALUE; } ComPtr<CDMFTAsyncCallback<CAsyncInPin,&CAsyncInPin::Invoke> > m_asyncCallback; // Callback object - HANDLE m_hHandle; // Handles to keep flush state - DWORD m_dwSamplesInFlight; // Samples in flight i.e. waiting for the callback functions to be called - BOOL m_bFlushing; //////////////////////////////////////////////////////////////////////////////////////// // End of Asynchronous callback definitions //////////////////////////////////////////////////////////////////////////////////////// @@ -628,7 +643,12 @@ class CTranslateOutPin : public COutPin { public: CTranslateOutPin(_In_ ULONG id = 0, _In_opt_ CMultipinMft *pparent = NULL, - _In_ IKsControl* iksControl = NULL) : COutPin(id, pparent, iksControl) + _In_ IKsControl* iksControl = NULL) + : COutPin(id, pparent, iksControl +#if ((defined NTDDI_WIN10_VB) && (NTDDI_VERSION >= NTDDI_WIN10_VB)) + , MFSampleAllocatorUsage_UsesCustomAllocator +#endif + ) { SetUINT32(MF_SD_VIDEO_SPHERICAL, TRUE); } @@ -639,8 +659,14 @@ public: _In_ IMFMediaType *pMediaType, _When_(ppIMFMediaTypeFull != nullptr, _Outptr_result_maybenull_) IMFMediaType **ppIMFMediaTypeFull); + STDMETHOD(ChangeMediaTypeFromInpin)( + _In_ IMFMediaType *pInMediatype, + _In_ IMFMediaType* pOutMediaType, + _In_ DeviceStreamState state); + protected: map<IMFMediaType*, IMFMediaType*> m_TranslatedMediaTypes; }; + |
