VDPosition guiPositionHandleCommand(WPARAM wParam, IVDPositionControl *pc) { if (!inputVideoAVI) return -1; switch(HIWORD(wParam)) { case PCN_START: pc->SetPosition(inputVideoAVI->getStart()); return inputVideoAVI->getStart(); case PCN_BACKWARD: { VDPosition pos = pc->GetPosition(); if (pos > inputVideoAVI->getStart()) { pc->SetPosition(pos - 1); return pos - 1; } } break; case PCN_FORWARD: { VDPosition pos = pc->GetPosition(); if (pos < inputVideoAVI->getEnd()) { pc->SetPosition(pos + 1); return pos + 1; } } break; case PCN_END: pc->SetPosition(inputVideoAVI->getEnd()); return inputVideoAVI->getEnd(); case PCN_KEYPREV: { VDPosition lSample = inputVideoAVI->prevKey(pc->GetPosition()); if (lSample < 0) lSample = inputVideoAVI->getStart(); pc->SetPosition(lSample); return lSample; } break; case PCN_KEYNEXT: { VDPosition lSample = inputVideoAVI->nextKey(pc->GetPosition()); if (lSample < 0) lSample = inputVideoAVI->getEnd(); pc->SetPosition(lSample); return lSample; } break; } return -1; }
void guiPositionInitFromStream(IVDPositionControl *pc) { if (!inputVideoAVI) return; const VDFraction videoRate(inputVideoAVI->getRate()); pc->SetRange(inputVideoAVI->getStart(), inputVideoAVI->getEnd()); pc->SetFrameRate(videoRate); }
void guiPositionBlit(HWND hWndClipping, VDPosition lFrame, int w, int h) { if (lFrame<0) return; try { BITMAPINFOHEADER *dcf; if (!inputVideoAVI) SendMessage(hWndClipping, CCM_BLITFRAME2, 0, (LPARAM)NULL); else { dcf = inputVideoAVI->getDecompressedFormat(); if (lFrame < inputVideoAVI->getStart() || lFrame >= inputVideoAVI->getEnd()) SendMessage(hWndClipping, CCM_BLITFRAME2, 0, (LPARAM)NULL); else { Pixel32 *tmpmem; const void *pFrame = inputVideoAVI->getFrame(lFrame); int dch = abs(dcf->biHeight); if (w>0 && h>0 && w!=dcf->biWidth && h != dch && (tmpmem = new Pixel32[((w+1)&~1)*h + ((dcf->biWidth+1)&~1)*dch])) { VBitmap vbt(tmpmem, w, h, 32); VBitmap vbs(tmpmem+((w+1)&~1)*h, dcf->biWidth, dch, 32); VBitmap srcbm((void *)pFrame, dcf); vbs.BitBlt(0, 0, &srcbm, 0, 0, -1, -1); vbt.StretchBltBilinearFast(0, 0, w, h, &vbs, 0, 0, vbs.w, vbs.h); VDPixmap px(VDAsPixmap(vbt)); SendMessage(hWndClipping, CCM_BLITFRAME2, 0, (LPARAM)&px); delete[] tmpmem; } else SendMessage(hWndClipping, CCM_BLITFRAME2, 0, (LPARAM)&inputVideoAVI->getTargetFormat()); } } } catch(const MyError&) { _RPT0(0,"Exception!!!\n"); } }