void Frameserver::Go(IVDubServerLink *ivdsl, char *name) { int server_index = -1; lpszFsname = name; // prepare the sources... if (vSrc) { if (!vSrc->setTargetFormat(g_dubOpts.video.mInputFormat)) if (!vSrc->setTargetFormat(nsVDPixmap::kPixFormat_XRGB8888)) if (!vSrc->setTargetFormat(nsVDPixmap::kPixFormat_RGB888)) if (!vSrc->setTargetFormat(nsVDPixmap::kPixFormat_XRGB1555)) if (!vSrc->setTargetFormat(nsVDPixmap::kPixFormat_Pal8)) throw MyError("The decompression codec cannot decompress to an RGB format. This is very unusual. Check that any \"Force YUY2\" options are not enabled in the codec's properties."); vSrc->streamBegin(true, false); BITMAPINFOHEADER *bmih = vSrc->getDecompressedFormat(); filters.initLinearChain(&g_listFA, (Pixel *)(bmih+1), bmih->biWidth, abs(bmih->biHeight), 24); if (filters.getFrameLag()) MessageBox(g_hWnd, "One or more filters in the filter chain has a non-zero lag. This will cause the served " "video to lag behind the audio!" , "VirtualDub warning", MB_OK); fsi.lMicrosecsPerFrame = vInfo.usPerFrame; fsi.lMicrosecsPerSrcFrame = vInfo.usPerFrameIn; fsi.flags = 0; if (filters.ReadyFilters(fsi)) throw MyError("Error readying filters."); const VBitmap *pvb = filters.LastBitmap(); VDPixmapCreateLinearLayout(mFrameLayout, nsVDPixmap::kPixFormat_RGB888, pvb->w, pvb->h, 4); VDPixmapLayoutFlipV(mFrameLayout); } if (aSrc) aSrc->streamBegin(true, false); // usurp the window VDUIFrame *pFrame = VDUIFrame::GetFrame(hwnd); mpUIFrame = pFrame; pFrame->Attach(this); guiSetTitle(hwnd, IDS_TITLE_FRAMESERVER); // create dialog box mbExit = false; if (hwndStatus = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_SERVER), hwnd, Frameserver::StatusDlgProc, (LPARAM)this)) { // hide the main window ShowWindow(hwnd, SW_HIDE); // create the frameserver server_index = ivdsl->CreateFrameServer(name, hwnd); if (server_index>=0) { // kick us into high priority SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); // enter window loop { MSG msg; while(!mbExit) { BOOL result = GetMessage(&msg, NULL, 0, 0); if (result == (BOOL)-1) break; if (!result) { PostQuitMessage(msg.wParam); break; } TranslateMessage(&msg); DispatchMessage(&msg); } } // return to normal priority SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); ivdsl->DestroyFrameServer(server_index); } if (IsWindow(hwndStatus)) DestroyWindow(hwndStatus); // show the main window ShowWindow(hwnd, SW_SHOW); } // unsubclass pFrame->Detach(); if (vSrc) { vSrc->streamEnd(); } if (server_index<0) throw MyError("Couldn't create frameserver"); }