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

Method GetCurrentImage

Source/VideoRenderer.cpp:947–993  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

945}
946
947STDMETHODIMP CMpcVideoRenderer::GetCurrentImage(long *pBufferSize, long *pDIBImage)
948{
949 CheckPointer(pBufferSize, E_POINTER);
950
951 CAutoLock cVideoLock(&m_InterfaceLock);
952 CAutoLock cRendererLock(&m_RendererLock);
953 HRESULT hr;
954
955 CSize framesize;
956 long aspectX, aspectY;
957 int iRotation;
958
959 m_VideoProcessor->GetVideoSize(framesize.cx, framesize.cy);
960 m_VideoProcessor->GetAspectRatio(aspectX, aspectY);
961 iRotation = m_VideoProcessor->GetRotation();
962
963 if (aspectX > 0 && aspectY > 0) {
964 if (iRotation == 90 || iRotation == 270) {
965 framesize.cy = MulDiv(framesize.cx, aspectY, aspectX);
966 } else {
967 framesize.cx = MulDiv(framesize.cy, aspectX, aspectY);
968 }
969 }
970
971 const auto w = framesize.cx;
972 const auto h = framesize.cy;
973
974 // VFW_E_NOT_PAUSED ?
975
976 if (w <= 0 || h <= 0) {
977 return E_FAIL;
978 }
979 long size = sizeof(BITMAPINFOHEADER) + CalcDibRowPitch(w, 32) * h;
980
981 if (pDIBImage == nullptr) {
982 *pBufferSize = size;
983 return S_OK;
984 }
985
986 if (size > *pBufferSize) {
987 return E_OUTOFMEMORY;
988 }
989
990 hr = m_VideoProcessor->GetCurentImage(pDIBImage);
991
992 return hr;
993}
994
995// IBasicVideo2
996STDMETHODIMP CMpcVideoRenderer::GetPreferredAspectRatio(long *plAspectX, long *plAspectY)

Callers

nothing calls this directly

Calls 5

CalcDibRowPitchFunction · 0.85
GetAspectRatioMethod · 0.80
GetRotationMethod · 0.80
GetVideoSizeMethod · 0.45
GetCurentImageMethod · 0.45

Tested by

no test coverage detected