📄 video_enc_con_wce4.cpp
字号:
/* ///////////////////////////////////////////////////////////////////////////////// INTEL CORPORATION PROPRIETARY INFORMATION// This software is supplied under the terms of a license agreement or// nondisclosure agreement with Intel Corporation and may not be copied// or disclosed except in accordance with the terms of that agreement.// Copyright(c) 2001-2005 Intel Corporation. All Rights Reserved.//// Intel(R) Integrated Performance Primitives// Video Coding (ippvc)//*/// video_enc_con_wce4.cpp : Defines the entry point for the application.//#if defined (WIN32) || defined _WIN32_WCE#include <windows.h>#include "vm_types.h"#include "umc_thread.h"int main(int argc, vm_char* argv[]);intParseCmdLine(vm_char* lpCmdLine, vm_char** pszArgv, int& riArgc){ int iRes = 0; riArgc = 0; vm_char cPrevChar = ' '; int iStrLen = vm_string_strlen(lpCmdLine); for (int i = 0; i < iStrLen; i++) { switch (lpCmdLine[i]) { case ' ': case '\t': if (' ' != cPrevChar && NULL != pszArgv) { lpCmdLine[i] = 0; } cPrevChar = ' '; break; default: if (' ' == cPrevChar) { if (NULL != pszArgv) { pszArgv[riArgc] = &(lpCmdLine[i]); } riArgc++; } cPrevChar = lpCmdLine[i]; break; } } return iRes;}static const vm_char *szWindowClassString = VM_STRING("Intel(R) UMC Video Encoder Dummy Window");voidCreateDumyWindow(HINSTANCE hInst, HWND& rhWnd){ WNDCLASS wc; wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpszMenuName = NULL; wc.lpfnWndProc = (WNDPROC) DefWindowProc; wc.cbClsExtra = 0; wc.cbWndExtra = 8; wc.hInstance = hInst; wc.hIcon = 0; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wc.lpszMenuName = 0; wc.lpszClassName = szWindowClassString; ::RegisterClass(&wc); rhWnd = CreateWindow(szWindowClassString, szWindowClassString, WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInst, NULL); ShowWindow(rhWnd, SW_SHOW);}voidCloseDummyWindow(HINSTANCE hInst, HWND hWnd){ ::DestroyWindow(hWnd); ::UnregisterClass(szWindowClassString, hInst);}struct MainParams{ int argc; vm_char** argv; int iRes;};unsigned int MainCallback(void* pvParams){ MainParams* pParams = reinterpret_cast<MainParams*>(pvParams); pParams->iRes = main(pParams->argc, pParams->argv); return pParams->iRes;}int WINAPIWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow){ int iRes = 0; // Count the number of parameters int iArgc = 1; // 1 is program name iRes = ParseCmdLine(lpCmdLine, NULL, iArgc); // Get module file name and pass it to main as a first parameter vm_char szFileName[MAX_PATH]; if (0 == iRes) { iRes = GetModuleFileName(hInstance, szFileName, MAX_PATH); if (0 != iRes) { iArgc++; // add program file name parameter iRes = 0; } else { iRes = -1; } } // Allocate array of string pointers to keep poiners to args vm_char** pArgv = NULL; if (0 == iRes && 0 != iArgc) { pArgv = new vm_char*[iArgc]; if (NULL == pArgv) { iRes = -1; } } if (0 == iRes) { pArgv[0] = szFileName; // Set up program name as first parameter if (1 < iArgc) { // Get pointers to other parameters iRes = ParseCmdLine(lpCmdLine, &pArgv[1], iArgc); iArgc++; } } if (0 == iRes) { MainParams Params; Params.argc = iArgc; Params.argv = pArgv; Params.iRes = 0; UMC::Thread MainThread; HWND hWnd = 0; CreateDumyWindow(hInstance, hWnd); SetTimer(hWnd, 1, 100, 0); UMC::Status umcRes = MainThread.Create(MainCallback, &Params); if (UMC::UMC_OK == umcRes) { MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); if (!MainThread.IsValid()) { PostQuitMessage(0); } // Signal to the main() function that ti's time to stop if (WM_SYSKEYDOWN == msg.message || WM_KEYDOWN == msg.message#if defined(MT_WILSON) && msg.wParam != 228 && // MtWilson brightness down msg.wParam != 227 && // MtWilson brightness up msg.wParam != 174 && // MtWilson volume down msg.wParam != 175 // MtWilson volume up#endif // MT_WILSON ) { pArgv[0][0] = 0; } } } CloseDummyWindow(hInstance, hWnd); } delete pArgv; return iRes;}#endif // defined (WIN32) || defined _WIN32_WCE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -