265 __inout_opt LPUNKNOWN pUnk,
267 __inout HRESULT *phr,
271 m_bModifiesData(bModifiesData)
281 ( __in_opt LPCSTR
pName,
282 __inout_opt LPUNKNOWN pUnk,
284 __inout HRESULT *phr,
288 m_bModifiesData(bModifiesData)
364 UNREFERENCED_PARAMETER(pReceivePin);
371 return VFW_E_NOT_IN_GRAPH;
384 if (dir == PINDIR_OUTPUT) {
391 ASSERT(dir == PINDIR_INPUT);
416 ( IMemAllocator *pAlloc
417 , __inout ALLOCATOR_PROPERTIES *pProperties
420 ALLOCATOR_PROPERTIES Request, Actual;
424 if (m_pInput->IsConnected()) {
428 hr = InputPin()->PeekAllocator()->GetProperties(&Request);
437 ZeroMemory(&Request,
sizeof(Request));
438 Request.cBuffers = 1;
439 Request.cbBuffer = 1;
445 Request.cBuffers, Request.cbBuffer));
451 pProperties->cBuffers = Request.cBuffers;
452 pProperties->cbBuffer = Request.cbBuffer;
453 pProperties->cbAlign = Request.cbAlign;
454 if (pProperties->cBuffers<=0) {pProperties->cBuffers = 1; }
455 if (pProperties->cbBuffer<=0) {pProperties->cbBuffer = 1; }
456 hr = pAlloc->SetProperties(pProperties, &Actual);
464 Actual.cBuffers, Actual.cbBuffer, Actual.cbAlign));
468 if ( (Request.cBuffers > Actual.cBuffers)
469 || (Request.cbBuffer > Actual.cbBuffer)
470 || (Request.cbAlign > Actual.cbAlign)
484 IMediaSample * pDest;
487 REFERENCE_TIME tStart, tStop;
488 const BOOL bTime = S_OK == pSource->GetTime( &tStart, &tStop);
493 , bTime ? &tStart :
NULL 494 , bTime ? &tStop :
NULL 503 IMediaSample2 *pSample2;
504 if (SUCCEEDED(pDest->QueryInterface(IID_IMediaSample2, (
void **)&pSample2))) {
505 HRESULT hrProps = pSample2->SetProperties(
506 FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, pbBuffer),
509 if (FAILED(hrProps)) {
515 pDest->SetTime(&tStart, &tStop);
518 if (S_OK == pSource->IsSyncPoint()) {
519 pDest->SetSyncPoint(TRUE);
522 pDest->SetDiscontinuity(TRUE);
524 if (S_OK == pSource->IsPreroll()) {
525 pDest->SetPreroll(TRUE);
529 AM_MEDIA_TYPE *pMediaType;
530 if (S_OK == pSource->GetMediaType(&pMediaType)) {
531 pDest->SetMediaType(pMediaType);
540 REFERENCE_TIME TimeStart, TimeEnd;
541 if (pSource->GetMediaTime(&TimeStart,&TimeEnd) == NOERROR) {
542 pDest->SetMediaTime(&TimeStart,&TimeEnd);
547 const long lDataLength = pSource->GetActualDataLength();
548 if (FAILED(pDest->SetActualDataLength(lDataLength))) {
555 BYTE *pSourceBuffer, *pDestBuffer;
556 long lSourceSize = pSource->GetSize();
557 long lDestSize = pDest->GetSize();
559 ASSERT(lDestSize >= lSourceSize && lDestSize >= lDataLength);
561 if (FAILED(pSource->GetPointer(&pSourceBuffer)) ||
562 FAILED(pDest->GetPointer(&pDestBuffer)) ||
563 lDestSize < lDataLength ||
568 ASSERT(lDestSize == 0 || pSourceBuffer !=
NULL && pDestBuffer !=
NULL);
586 if (pProps->dwStreamId != AM_STREAM_MEDIA) {
598 pSample =
Copy(pSample);
662 ( __in_opt LPCTSTR pObjectName
664 , __inout HRESULT *phr
665 , __in_opt LPCWSTR
pName 672 , m_pTIPFilter(pFilter)
675 , TEXT(
"CTransInPlaceInputPin::CTransInPlaceInputPin")));
705 ->GetAllocator( ppAllocator );
728 IMemAllocator * pAllocator,
752 IMemAllocator *pOutputAllocator =
756 if (pOutputAllocator ==
NULL) {
764 pOutputAllocator->Release();
767 if (pAllocator == pOutputAllocator) {
769 }
else if(SUCCEEDED(
hr)) {
771 ALLOCATOR_PROPERTIES Props, Actual;
772 hr = pAllocator->GetProperties(&Props);
774 hr = pOutputAllocator->SetProperties(&Props, &Actual);
777 if ( (Props.cBuffers > Actual.cBuffers)
778 || (Props.cbBuffer > Actual.cbBuffer)
779 || (Props.cbAlign > Actual.cbAlign)
788 ->NotifyAllocator( pOutputAllocator, FALSE );
793 ->NotifyAllocator( pAllocator, bReadOnly );
803 pAllocator->AddRef();
822 return VFW_E_NOT_CONNECTED;
837 if (
hr!=S_OK)
return hr;
886 __in_opt LPCTSTR pObjectName,
888 __inout HRESULT * phr,
889 __in_opt LPCWSTR pPinName)
894 m_pTIPFilter(pFilter)
897 , TEXT(
"CTransInPlaceOutputPin::CTransInPlaceOutputPin")));
908 return VFW_E_NOT_CONNECTED;
929 return VFW_E_TYPE_NOT_ACCEPTED;
936 if (
hr!=S_OK)
return hr;
951 pAllocator->AddRef();
friend class CTransInPlaceOutputPin
__out IMemAllocator * PeekAllocator() const
#define ValidateReadPtr(p, cb)
IMemAllocator * m_pAllocator
HRESULT CompleteConnect(IPin *pReceivePin)
CTransInPlaceFilter(__in_opt LPCTSTR, __inout_opt LPUNKNOWN, REFCLSID clsid, __inout HRESULT *, bool bModifiesData=true)
friend class CTransInPlaceInputPin
__out CTransInPlaceOutputPin * OutputPin() const
HRESULT CheckMediaType(const CMediaType *pmt)
HRESULT ReconnectPin(IPin *pPin, __in_opt AM_MEDIA_TYPE const *pmt)
void SetAllocator(IMemAllocator *pAllocator)
virtual HRESULT Transform(IMediaSample *pSample) PURE
virtual HRESULT Deliver(IMediaSample *)
virtual HRESULT CompleteConnect(IPin *pReceivePin)
#define ValidateReadWritePtr(p, cb)
CTransInPlaceOutputPin(__in_opt LPCTSTR pObjectName, __inout CTransInPlaceFilter *pFilter, __inout HRESULT *phr, __in_opt LPCWSTR pName)
__out_opt IMediaSample * Copy(IMediaSample *pSource)
STDAPI CreateMemoryAllocator(__deref_out IMemAllocator **ppAllocator)
void WINAPI DeleteMediaType(__inout_opt AM_MEDIA_TYPE *pmt)
__out_opt IMemInputPin * ConnectedIMemInputPin()
HRESULT CompleteConnect(PIN_DIRECTION dir, IPin *pReceivePin)
virtual HRESULT CompleteConnect(IPin *pReceivePin)
HRESULT DecideBufferSize(IMemAllocator *, __inout ALLOCATOR_PROPERTIES *)
HRESULT NotifyEvent(long EventCode, LONG_PTR EventParam1, LONG_PTR EventParam2)
virtual HRESULT Receive(IMediaSample *pSample)
CTransInPlaceFilter *const m_pTIPFilter
#define CheckPointer(p, ret)
virtual CBasePin * GetPin(int n)
STDMETHODIMP EnumMediaTypes(__deref_out IEnumMediaTypes **ppEnum)
BOOL UsingDifferentAllocators() const