MCPcopy Create free account
hub / github.com/Nevcairiel/LAVFilters / Receive

Method Receive

common/baseclasses/vtrans.cpp:91–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89// changes, then this base class code will do everything you need.
90
91HRESULT CVideoTransformFilter::Receive(IMediaSample *pSample)
92{
93 // If the next filter downstream is the video renderer, then it may
94 // be able to operate in DirectDraw mode which saves copying the data
95 // and gives higher performance. In that case the buffer which we
96 // get from GetDeliveryBuffer will be a DirectDraw buffer, and
97 // drawing into this buffer draws directly onto the display surface.
98 // This means that any waiting for the correct time to draw occurs
99 // during GetDeliveryBuffer, and that once the buffer is given to us
100 // the video renderer will count it in its statistics as a frame drawn.
101 // This means that any decision to drop the frame must be taken before
102 // calling GetDeliveryBuffer.
103
104 ASSERT(CritCheckIn(&m_csReceive));
105 AM_MEDIA_TYPE *pmtOut, *pmt;
106#ifdef DEBUG
107 FOURCCMap fccOut;
108#endif
109 HRESULT hr;
110 ASSERT(pSample);
111 IMediaSample *pOutSample;
112
113 // If no output pin to deliver to then no point sending us data
114 ASSERT(m_pOutput != NULL);
115
116 // The source filter may dynamically ask us to start transforming from a
117 // different media type than the one we're using now. If we don't, we'll
118 // draw garbage. (typically, this is a palette change in the movie,
119 // but could be something more sinister like the compression type changing,
120 // or even the video size changing)
121
122#define rcS1 ((VIDEOINFOHEADER *)(pmt->pbFormat))->rcSource
123#define rcT1 ((VIDEOINFOHEADER *)(pmt->pbFormat))->rcTarget
124
125 pSample->GetMediaType(&pmt);
126 if (pmt != NULL && pmt->pbFormat != NULL)
127 {
128
129 // spew some debug output
130 ASSERT(!IsEqualGUID(pmt->majortype, GUID_NULL));
131#ifdef DEBUG
132 fccOut.SetFOURCC(&pmt->subtype);
133 LONG lCompression = HEADER(pmt->pbFormat)->biCompression;
134 LONG lBitCount = HEADER(pmt->pbFormat)->biBitCount;
135 LONG lStride = (HEADER(pmt->pbFormat)->biWidth * lBitCount + 7) / 8;
136 lStride = (lStride + 3) & ~3;
137 DbgLog((LOG_TRACE, 3, TEXT("*Changing input type on the fly to")));
138 DbgLog((LOG_TRACE, 3, TEXT("FourCC: %lx Compression: %lx BitCount: %ld"), fccOut.GetFOURCC(), lCompression,
139 lBitCount));
140 DbgLog((LOG_TRACE, 3, TEXT("biHeight: %ld rcDst: (%ld, %ld, %ld, %ld)"), HEADER(pmt->pbFormat)->biHeight,
141 rcT1.left, rcT1.top, rcT1.right, rcT1.bottom));
142 DbgLog((LOG_TRACE, 3, TEXT("rcSrc: (%ld, %ld, %ld, %ld) Stride: %ld"), rcS1.left, rcS1.top, rcS1.right,
143 rcS1.bottom, lStride));
144#endif
145
146 // now switch to using the new format. I am assuming that the
147 // derived filter will do the right thing when its media type is
148 // switched and streaming is restarted.

Callers

nothing calls this directly

Calls 10

CritCheckInFunction · 0.85
DeleteMediaTypeFunction · 0.85
SUCCEEDEDFunction · 0.85
SetFOURCCMethod · 0.80
GetFOURCCMethod · 0.80
GetMediaTypeMethod · 0.45
ReleaseMethod · 0.45
IsDiscontinuityMethod · 0.45
IsSyncPointMethod · 0.45
DeliverMethod · 0.45

Tested by

no test coverage detected