MCPcopy Create free account
hub / github.com/Aleksoid1978/VideoRenderer / RenderTo

Method RenderTo

Source/SubPic/SubPicQueueImpl.cpp:105–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103// private
104
105HRESULT CSubPicQueueImpl::RenderTo(ISubPic* pSubPic, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double fps, BOOL bIsAnimated)
106{
107 CheckPointer(pSubPic, E_POINTER);
108
109 HRESULT hr = E_FAIL;
110
111 CComPtr<ISubPicProvider> pSubPicProvider;
112 if (FAILED(GetSubPicProvider(&pSubPicProvider)) || !pSubPicProvider) {
113 return hr;
114 }
115
116 hr = pSubPic->ClearDirtyRect();
117
118 SubPicDesc spd;
119 if (SUCCEEDED(hr)) {
120 hr = pSubPic->Lock(spd);
121 }
122 if (SUCCEEDED(hr)) {
123 CRect r(0,0,0,0);
124 REFERENCE_TIME rtRender = rtStart;
125 if (bIsAnimated) {
126 // This is some sort of hack to avoid rendering the wrong frame
127 // when the start time is slightly mispredicted by the queue
128 rtRender = (rtStart + rtStop) / 2;
129 } else {
130 rtRender += (rtStop - rtStart - 1);
131 }
132 hr = pSubPicProvider->Render(spd, rtRender, fps, r);
133
134 pSubPic->SetStart(rtStart);
135 pSubPic->SetStop(rtStop);
136
137 pSubPic->Unlock(r);
138 }
139
140 return hr;
141}
142
143//
144// CSubPicQueue

Callers

nothing calls this directly

Calls 6

SetStartMethod · 0.80
SetStopMethod · 0.80
ClearDirtyRectMethod · 0.45
LockMethod · 0.45
RenderMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected