www.pudn.com > w_ipp-sample-media_p_5.0.017.zip > simple_player.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) // */ // simple_player.cpp : Defines the entry point for the console application. // #if defined (WIN32) || defined (WIN64) #include#endif // WIN32 #include #include #include #include #include "vm_debug.h" #include "vm_time.h" #include "vm_sys_info.h" #include "umc_sys_info.h" #include "avsync.h" #include "codec_pipeline.h" #if defined(ARM) || defined(_ARM_) const unsigned int cuiDisplayWidth = 640; const unsigned int cuiDisplayHeight = 480; const UMC::ColorFormat cDispColorFormat = UMC::RGB565; #else // defined(ARM) || defined(_ARM_) const unsigned int cuiDisplayWidth = 800; const unsigned int cuiDisplayHeight = 600; const UMC::ColorFormat cDispColorFormat = UMC::YV12; #endif // defined(ARM) || defined(_ARM_) const unsigned long culReduceCoeff = UMC::FLAG_CCNV_CONVERT; //double cpu_use = 0; void PerfToFile(AVSync& rAVSync, AVSync::CommonCtl& r_cc, UMC :: SysInfo& m_csysinfo, vm_char* m_sz_curr_filename, vm_char* m_sz_perf_filename, int iFlag) { vm_char tmpbuf[128]={0,}; FILE* perf_file; AVSync::Stat Stat; vm_char* stream_name = NULL; //UMC :: SysInfo m_csysinfo; UMC :: sSystemInfo* m_ssysteminfo; m_ssysteminfo = (UMC::sSystemInfo *)m_csysinfo.GetSysInfo(); switch(iFlag) { case 0: perf_file = vm_file_open(m_sz_perf_filename, VM_STRING("a")); if(perf_file){ stream_name = vm_string_strrchr(m_sz_curr_filename, (int)('\\')); if(!stream_name)stream_name = m_sz_curr_filename; else stream_name++; fseek( perf_file, 0, SEEK_END); if(!ftell( perf_file)) vm_string_fprintf(perf_file, VM_STRING("Date,Time,Comp.name,OS,CPU,Num.CPU,CPU freq.,MEM,VGA,App,App description,Ver.,Streams(S) name,Status,S.Type,S.Res.,S.FR,S.BR,Video(V)Type,V.Format,V.Num,V.D/E(FpS),V.D/E(MHz),V.RR(Fps),V.S(F),Audio(A)Type,A.Freq.,A.NC,A.(BpS),A.BR,A.D/E(MHz),CPU Usage (%%),Max Cpu Usage (%%),Work.Time\n")); vm_sys_info_get_date(tmpbuf,MMDDYY); vm_string_fprintf(perf_file,VM_STRING("%s,"), tmpbuf); vm_sys_info_get_time(tmpbuf,HHMMSS); vm_string_fprintf(perf_file,VM_STRING("%s,"), tmpbuf); vm_string_fprintf(perf_file,VM_STRING("%s,"), m_ssysteminfo->computer_name); vm_string_fprintf(perf_file,VM_STRING("%s,"), m_ssysteminfo->os_name); vm_string_fprintf(perf_file,VM_STRING("%s,"), m_ssysteminfo->proc_name); vm_string_fprintf(perf_file,VM_STRING("%d,"), m_ssysteminfo->num_proc); vm_string_fprintf(perf_file,VM_STRING("%.2f,"), (double)m_ssysteminfo->cpu_freq); vm_string_fprintf(perf_file,VM_STRING("%d,"), m_ssysteminfo->phys_mem); vm_string_fprintf(perf_file,VM_STRING("%s,"), m_ssysteminfo->video_card); vm_string_fprintf(perf_file,VM_STRING("%s,"),m_ssysteminfo->program_name); vm_string_fprintf(perf_file,VM_STRING("UMC Simple Player,"));//,m_ssysteminfo->description); vm_string_fprintf(perf_file,VM_STRING(",")); // ver. of aplications vm_string_fprintf(perf_file,VM_STRING("%s,"), stream_name); vm_string_fprintf(perf_file,VM_STRING("FAIL\n")); fclose(perf_file); } break; case 1: perf_file = vm_file_open(m_sz_perf_filename, VM_STRING("r+")); if(perf_file) { fseek( perf_file, -6, SEEK_END); vm_string_fprintf(perf_file,VM_STRING("PASSED,")); UMC::Status umcRes = rAVSync.GetStat(Stat); vm_string_fprintf(perf_file,VM_STRING("%s,"), UMC::GetStreamTypeString(rAVSync.GetSystemStreamType())); vm_string_fprintf(perf_file,VM_STRING("%dx%d,"),rAVSync.GetSrcFrmWidth(),rAVSync.GetSrcFrmHeight()); vm_string_fprintf(perf_file,VM_STRING("%.2lf,"),(rAVSync.GetSrcFrmRate() ? rAVSync.GetSrcFrmRate() : 30.)); vm_string_fprintf(perf_file,VM_STRING("%d,"),rAVSync.GetSrcFrmBitRate()); vm_string_fprintf(perf_file,VM_STRING("%s,"), UMC::GetVideoTypeString(rAVSync.GetVideoStreamType())); vm_string_fprintf(perf_file,VM_STRING("%s,"), UMC::GetFormatTypeString(rAVSync.GetVideoFormatType())); vm_string_fprintf(perf_file,VM_STRING("%d,"), Stat.uiFrameNum); vm_string_fprintf(perf_file,VM_STRING("%.2lf,"), Stat.dfDecodeRate); if(Stat.dfDecodeRate) vm_string_fprintf(perf_file,VM_STRING("%.2lf,"), rAVSync.GetSrcFrmRate()?(double)(rAVSync.GetSrcFrmRate()/Stat.dfDecodeRate*(m_ssysteminfo->cpu_freq)):(30./Stat.dfDecodeRate*(m_ssysteminfo->cpu_freq))); else vm_string_fprintf(perf_file,VM_STRING("%.2lf,"), 0.0); if(Stat.dfRenderTime) vm_string_fprintf(perf_file,VM_STRING("%.2lf,"), (double)(Stat.uiFrameNum/Stat.dfRenderTime)); else vm_string_fprintf(perf_file,VM_STRING("%.2lf,"), 0.0); vm_string_fprintf(perf_file,VM_STRING("%d,"), Stat.uiSkippedNum); vm_string_fprintf(perf_file,VM_STRING("%s,"), UMC::GetAudioTypeString(rAVSync.GetAudioStreamType())); vm_string_fprintf(perf_file,VM_STRING("%d,"), rAVSync.GetAudioSmplFreq()); vm_string_fprintf(perf_file,VM_STRING("%d,"), rAVSync.GetAudioNChannel()); vm_string_fprintf(perf_file,VM_STRING("%d,"), rAVSync.GetAudioBitPerSmpl()); vm_string_fprintf(perf_file,VM_STRING("%d,"), rAVSync.GetAudioBitRate()); //if((int)Stat.dfAudioDecodeRate) vm_string_fprintf(perf_file,VM_STRING("%.2lf,"), Stat.dfAudioDecodeRate*m_ssysteminfo->cpu_freq); //else // vm_string_fprintf(perf_file,VM_STRING("%.2lf,"), 0.0); vm_string_fprintf(perf_file,VM_STRING("%.2lf,"), m_csysinfo.GetAvgCpuUsage()); vm_string_fprintf(perf_file,VM_STRING("%.2lf,"), m_csysinfo.GetMaxCpuUsage()); vm_string_fprintf(perf_file,VM_STRING("%02d:%02d:%02d,"),(int)Stat.dfRenderTime/3600,(int)(Stat.dfRenderTime)%3600/60,(int)Stat.dfRenderTime%3600%60); vm_string_fprintf(perf_file,VM_STRING("\n" )); fclose(perf_file); } break; default: break; } } UMC::Status AddPerfRecord(vm_char* szProfFileName, vm_char* szMessage, ...) { UMC::Status umcRes = UMC::UMC_OK; FILE* pFile = NULL; if (NULL != szProfFileName && 0 != szProfFileName[0]) { pFile = vm_file_open(szProfFileName, VM_STRING("a+t")); } if (NULL != pFile) { va_list vl; va_start( vl, szMessage ); vm_string_vfprintf(pFile, szMessage, vl); va_end(vl); } if (NULL != pFile) { fclose(pFile); } return umcRes; } UMC::Status PlaySingleFile(AVSync& rAVSync, AVSync::CommonCtl& r_cc, vm_char* szFileName, vm_char* szProfFileName, vm_var32 uiIterateNum, vm_char* pcStopFlag) { UMC::Status umcRes = UMC::UMC_OK; UMC :: SysInfo m_csysinfo; assert(0 < uiIterateNum); UMC::LocalReaderContext readContext; vm_string_strcpy(readContext.m_szFileName, szFileName); r_cc.pReadContext = &readContext; if (UMC::UMC_OK == umcRes && NULL != szProfFileName && 0 != szProfFileName[0]) { if (vm_string_strcmp(VM_STRING(".csv"), szProfFileName + (vm_string_strrchr(szProfFileName, (vm_char)('.')) - szProfFileName))) { umcRes = AddPerfRecord(szProfFileName, VM_STRING("Stream %s, %d iterations:\n"), szFileName, uiIterateNum); }else{ PerfToFile(rAVSync,r_cc,m_csysinfo,szFileName,szProfFileName,0); } } vm_var32 uiFrameNum = 0; double dfDecodeTime = 0.0; double dfRenderTime = 0.0; double dfAudioDecTime = 0.0; double dfAudioTime = 0.0; for (vm_var32 uiTeration = 0; UMC::UMC_OK == umcRes && uiTeration < uiIterateNum; uiTeration++) { AVSync::Stat Stat; umcRes = rAVSync.Init(r_cc); r_cc.rectDisp.bottom = rAVSync.GetDstFrmHeight(); r_cc.rectDisp.right = rAVSync.GetDstFrmWidth(); r_cc.rectRange.bottom = rAVSync.GetDstFrmHeight(); r_cc.rectRange.right = rAVSync.GetDstFrmWidth(); rAVSync.ResizeDisplay(r_cc.rectDisp,r_cc.rectRange); m_csysinfo.GetCpuUsage(); if (UMC::UMC_OK == umcRes) { umcRes = rAVSync.Start(); } vm_var32 i = 0; while (UMC::UMC_OK == umcRes && rAVSync.IsPlaying()) { #if defined(WIN32) # if defined(_WIN32_WCE) if (0 == *pcStopFlag) # else // defined(_WIN32_WCE) if (kbhit()) # endif // defined(_WIN32_WCE) { umcRes = rAVSync.Stop(); } else #endif // defined(WIN32) && !defined(_WIN32_WCE) { umcRes = rAVSync.GetStat(Stat); // if (i >= 100) { if (i < Stat.uiFramesDecoded) { if (UMC::UMC_OK == umcRes) { double dfDecTime = (Stat.dfDecodeRate) ? 1000/Stat.dfDecodeRate : 0; double dfConvertTime = (Stat.dfConversionRate) ? 1000/Stat.dfConversionRate : 0; //vm_debug_trace(-1, vm_string_printf( VM_STRING("DecRate:%.2f fps(Dec %.2fms/f + Conv %.2fms/f = %.2fms/f) RndrRate %.2ffps Audio Dec %.2fchnls \r\n"), Stat.dfDecodeRate, dfDecTime - dfConvertTime, dfConvertTime, dfDecTime, Stat.dfRenderRate, (Stat.dfAudioDecodeTime) ? Stat.dfAudioPlayTime/Stat.dfAudioDecodeTime : 0); } // i = 0; i += 100; } // i++; vm_time_sleep(300/*500*/); m_csysinfo.GetCpuUsage(); } } m_csysinfo.GetCpuUsage(); if (UMC::UMC_OK == umcRes && NULL != szProfFileName && 0 != szProfFileName[0]) { umcRes = rAVSync.GetStat(Stat); uiFrameNum += Stat.uiFramesDecoded; dfDecodeTime += Stat.dfDecodeTime; dfRenderTime += Stat.dfRenderTime; dfAudioDecTime += Stat.dfAudioDecodeTime; dfAudioTime += Stat.dfAudioPlayTime; } } if (UMC::UMC_OK == umcRes && NULL != szProfFileName && 0 != szProfFileName[0]) { if(vm_string_strcmp(VM_STRING(".csv"),szProfFileName+(vm_string_strrchr(szProfFileName, (vm_char)('.')) - szProfFileName))) AddPerfRecord(szProfFileName, VM_STRING("DecRate: %.2f fps(%.2f ms/f) Rndr rate %.2f fps Audio Dec %.2f chnls\n\n"), (dfDecodeTime) ? (double)uiFrameNum / dfDecodeTime : 0, (uiFrameNum) ? dfDecodeTime * 1000 / uiFrameNum : 0, (dfRenderTime) ? (double)uiFrameNum / dfRenderTime : 0, (dfAudioDecTime) ? dfAudioTime / dfAudioDecTime : 0); else PerfToFile(rAVSync,r_cc,m_csysinfo,szFileName,szProfFileName,1); } rAVSync.Stop(); return umcRes; } UMC::Status PlayListFromFile(AVSync& rAVSync, AVSync::CommonCtl& r_cc, vm_char* szListFileName, vm_char* szProfFileName, vm_var32 iIterateNum, vm_char* pcStopFlag) { UMC::Status umcRes = UMC::UMC_OK; FILE* pFileList = vm_file_open(szListFileName, VM_STRING("rt")); vm_char szFileName[UMC::MAXIMUM_PATH]; if (NULL == pFileList) { umcRes = UMC::UMC_BAD_STREAM; } // Clear perfomance log file if (UMC::UMC_OK == umcRes && NULL != szProfFileName && 0 != szProfFileName[0]) { if(vm_string_strcmp(VM_STRING(".csv"),szProfFileName+(vm_string_strrchr(szProfFileName, (vm_char)('.')) - szProfFileName))) { FILE* pProfFile = vm_file_open(szProfFileName, VM_STRING("wt")); if (NULL != pProfFile) { fclose(pProfFile); } else { vm_message(VM_STRING("Error!Failed to create perfomance log %s\n"), szProfFileName); umcRes = UMC::UMC_FAILED_TO_INITIALIZE; } } } while (UMC::UMC_OK == umcRes && !feof(pFileList)) { vm_char* szRes = vm_file_gets(szFileName, UMC::MAXIMUM_PATH, pFileList); if (NULL != szRes) { // cut off New Line character (0x0A) if (0xA == szFileName[vm_string_strlen(szFileName) - 1]) { szFileName[vm_string_strlen(szFileName) - 1] = 0; } umcRes = PlaySingleFile(rAVSync, r_cc, szFileName, szProfFileName, iIterateNum, pcStopFlag); } } if (NULL != pFileList) { fclose(pFileList); } return umcRes; } void PrintHelp(vm_char* szProgName) { assert(NULL != szProgName); vm_char szMessage[] = VM_STRING("Usage: %s [-s(ilent)][-b(lind)][-n(atural temp)][-p ][-i ](-l |stream)\n -f -v \n -a "); vm_message(szMessage, szProgName); } int FileNameFromParams(int argc, vm_char** argv, int iFirstParam, vm_char* szFileName) { bool bQuotes = false; assert(0 == szFileName[0]); if ('"' == argv[iFirstParam][0]) { bQuotes = true; argv[iFirstParam]++; } vm_string_strcat(szFileName, argv[iFirstParam++]); while (argc > iFirstParam && '-' != argv[iFirstParam][0]) { if (bQuotes) { vm_var32 uiLen = vm_string_strlen(szFileName); if (0 < uiLen && '"' == szFileName[uiLen - 1]) { szFileName[uiLen - 1] = 0; break; } } if ('"' == argv[iFirstParam][0]) { break; } vm_string_strcat(szFileName, VM_STRING(" ")); vm_string_strcat(szFileName, argv[iFirstParam++]); } if (bQuotes) { vm_var32 uiLen = vm_string_strlen(szFileName); if (0 < uiLen && '"' == szFileName[uiLen - 1]) { szFileName[uiLen - 1] = 0; } } return --iFirstParam; } extern "C" void vm_get_cpu_tick_init(); extern "C" unsigned int vm_get_cpu_tick(); #if defined (WIN32) && !defined(_WIN32_WCE) void GetClientRect(HWND hWnd, UMC::RECT& rDispRect, UMC::RECT& rRangeRect) { POINT pt = {0,0}; ::ClientToScreen(hWnd, &pt); ::RECT rect; ::GetClientRect(hWnd, &rect); UMC::Rect2UMCRect(rect, rDispRect); rDispRect.left += (short)pt.x; rDispRect.right += (short)pt.x; rDispRect.top += (short)(pt.y + 0); rDispRect.bottom += (short)(pt.y - 0 - 0); ::SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0); UMC::Rect2UMCRect(rect, rRangeRect); } #endif int main(int argc, vm_char* argv[]) { UMC::Status umcRes = UMC::UMC_OK; AVSync AVSync; AVSync::CommonCtl cc; #if !defined(ARM) && !defined(_ARM_) ippStaticInit(); #endif // !defined(ARM) && !defined(_ARM_) cc.cformat = cDispColorFormat; cc.ulReduceCoeff = UMC::FLAG_CCNV_CONVERT; cc.ulSplitterFlags = UMC::FLAG_VSPL_VIDEO_HEADER_REQ | UMC::AUDIO_SPLITTER | UMC::FLAG_VSPL_COMPATIBLE | UMC::VIDEO_SPLITTER; cc.ulVideoDecoderFlags = UMC::FLAG_VDEC_NO_PREVIEW | UMC::FLAG_VDEC_COMPATIBLE; cc.ulVideoRenderFlags = UMC::FLAG_VREN_REORDER; #if !defined(ARM) && !defined(_ARM_) // cc.ulVideoDecoderFlags |= UMC::FLAG_VDEC_UVMERGED; #endif // !defined(ARM) && !defined(_ARM_) cc.ulReduceCoeff = 0| UMC::FLAG_CCNV_CONVERT; cc.lInterpolation = IPPI_INTER_NN; cc.ulAudioDecoderFlags = 0; cc.ulAudioRenderFlags = 0; cc.uiPrefVideoRender = 0; cc.uiPrefAudioRender = 0; cc.uiPrefDataReader = 0; cc.pExternalInfo = NULL; cc.terminate = false; cc.performance = false; cc.repeat = false; cc.fullscr = false; cc.stick = true; cc.debug = true; cc.bSync = false; cc.step = false; cc.uiLimitVideoDecodeThreads = 0; //auto threading #ifdef WIN32 UMC::HWNDModuleContext Context; POINT Point = {0, 0}; Context.m_hWnd = ::WindowFromPoint(Point); Context.m_ColorKey = RGB(0,0,0); #endif // defined(WIN32) #ifdef LINUX32 UMC::ModuleContext Context; #endif // LINUX32 cc.pRenContext = &Context; cc.rectDisp.left = 0; cc.rectDisp.top = 0; cc.rectDisp.right = cuiDisplayWidth; cc.rectDisp.bottom = cuiDisplayHeight; cc.uiPrefVideoRender = UMC::DEF_VIDEO_RENDER; cc.uiPrefAudioRender = UMC::DEF_AUDIO_RENDER; #if defined (WIN32) && !defined(_WIN32_WCE) GetClientRect(Context.m_hWnd,cc.rectDisp,cc.rectRange); #endif // defined(WIN32) vm_char szFileName[UMC::MAXIMUM_PATH] = VM_STRING(""); vm_char szPerfLogFileName[UMC::MAXIMUM_PATH] = VM_STRING(""); vm_var32 uiIterations = 1; bool bPlayFromList = false; int i = 1; while (UMC::UMC_OK == umcRes && i < argc) { size_t stArgLen = vm_string_strlen(argv[i]); if ('-' == argv[i][0]) { switch (argv[i][1]) { case 'l': case 'L': if (2 == stArgLen) { if ((i+1) < argc) i = FileNameFromParams(argc, argv, ++i, szFileName); else { vm_message(VM_STRING("Error! Wrong usage of key (-L). Name of list-file is absent!\n")); umcRes = UMC::UMC_FAILED_TO_INITIALIZE; } } else { argv[i] += 2; i = FileNameFromParams(argc, argv, i, szFileName); } bPlayFromList = true; break; case 'p': case 'P': if (2 == stArgLen) { if ((i+1) < argc) i = FileNameFromParams(argc, argv, ++i, szPerfLogFileName); else { vm_message(VM_STRING("Error! Wrong usage of key (-p). Name of logfile is absent!\n")); umcRes = UMC::UMC_FAILED_TO_INITIALIZE; } } else { argv[i] += 2; i = FileNameFromParams(argc, argv, i, szPerfLogFileName); } break; case 'i': case 'I': if (2 == stArgLen) { i++; if (i < argc) uiIterations = vm_string_atol(argv[i]); else { vm_message(VM_STRING("Error! Wrong usage of key (-i). Number of iterations is absent!\n")); umcRes = UMC::UMC_FAILED_TO_INITIALIZE; } } else { uiIterations = vm_string_atol(argv[i] + 2); } if (0 == uiIterations) { vm_message(VM_STRING("Error! Wrong iteration number (-i) parameter!\n")); umcRes = UMC::UMC_FAILED_TO_INITIALIZE; } break; case 's': case 'S': // Turn sound off cc.ulSplitterFlags &= ~UMC::AUDIO_SPLITTER; break; case 'b': case 'B': // Turn off color conversion and displaying - decoding only cc.ulReduceCoeff = 0; break; case 'n': case 'N': // Play synchronously (in real time) even if // sound is turned off cc.bSync = true; break; case 'u': case 'U': // Decode audio but don't render it cc.ulAudioRenderFlags |= UMC::FLAG_AREN_VOID; break; case 'a': case 'A': { vm_char* szCode = NULL; // Use predefined audio render instead of selected automaticaly if (2 == stArgLen) { szCode = argv[++i]; if (i >= argc) break; } else { szCode = argv[i] + 2; } if (0 == vm_string_strcmp(szCode, VM_STRING("def"))) { cc.uiPrefAudioRender = UMC::DEF_VIDEO_RENDER; } else if (0 == vm_string_strcmp(szCode, VM_STRING("dsound"))) { cc.uiPrefAudioRender = UMC::DSOUND_AUDIO_RENDER; } else if (0 == vm_string_strcmp(szCode, VM_STRING("winmm"))) { cc.uiPrefAudioRender = UMC::WINMM_AUDIO_RENDER; } else if (0 == vm_string_strcmp(szCode, VM_STRING("oss"))) { cc.uiPrefAudioRender = UMC::OSS_AUDIO_RENDER; } else if (0 == vm_string_strcmp(szCode, VM_STRING("fw"))) { cc.uiPrefAudioRender = UMC::FW_AUDIO_RENDER; } else if (0 == vm_string_strcmp(szCode, VM_STRING("nul"))) { cc.uiPrefAudioRender = UMC::NULL_AUDIO_RENDER; } break; } case 'f': case 'F': { vm_char* szCode = NULL; // Use predefined color format instead of selected automaticaly if (2 == stArgLen) { szCode = argv[++i]; if (i >= argc) break; } else { szCode = argv[i] + 2; } if (0 == vm_string_strcmp(szCode, VM_STRING("yv12"))) { cc.cformat = UMC::YV12; } else if (0 == vm_string_strcmp(szCode, VM_STRING("yuy2"))) { cc.cformat = UMC::YUY2; } else if (0 == vm_string_strcmp(szCode, VM_STRING("rgb565"))) { cc.cformat = UMC::RGB565; } break; } case 'v': case 'V': { vm_char* szCode = NULL; // Use predefined video render instead of selected automaticaly if (2 == stArgLen) { szCode = argv[++i]; if (i >= argc) break; } else { szCode = argv[i] + 2; } if (0 == vm_string_strcmp(szCode, VM_STRING("def"))) { cc.uiPrefVideoRender = UMC::DEF_VIDEO_RENDER; } else if (0 == vm_string_strcmp(szCode, VM_STRING("dx"))) { cc.uiPrefVideoRender = UMC::DX_VIDEO_RENDER; } else if (0 == vm_string_strcmp(szCode, VM_STRING("blt"))) { cc.uiPrefVideoRender = UMC::BLT_VIDEO_RENDER; } else if (0 == vm_string_strcmp(szCode, VM_STRING("gdi"))) { cc.uiPrefVideoRender = UMC::GDI_VIDEO_RENDER; } else if (0 == vm_string_strcmp(szCode, VM_STRING("gx"))) { cc.uiPrefVideoRender = UMC::GX_VIDEO_RENDER; } else if (0 == vm_string_strcmp(szCode, VM_STRING("sdl"))) { cc.uiPrefVideoRender = UMC::SDL_VIDEO_RENDER; } else if (0 == vm_string_strcmp(szCode, VM_STRING("fb"))) { cc.uiPrefVideoRender = UMC::FB_VIDEO_RENDER; } else if (0 == vm_string_strcmp(szCode, VM_STRING("nul"))) { cc.uiPrefVideoRender = UMC::NULL_VIDEO_RENDER; } else if (0 == vm_string_strcmp(szCode, VM_STRING("fw"))) { cc.uiPrefVideoRender = UMC::FW_VIDEO_RENDER; } else if (0 == vm_string_strcmp(szCode, VM_STRING("ovl2"))) { cc.uiPrefVideoRender = UMC::OVL2_VIDEO_RENDER; cc.cformat = UMC::YV12; } break; } default: vm_message(VM_STRING("Unknown option: %s\n"), argv[i]); PrintHelp(argv[0]); umcRes = UMC::UMC_FAILED_TO_INITIALIZE; break; } } else { if (0 == szFileName[0]) { i = FileNameFromParams(argc, argv, i, szFileName); } else { vm_message(VM_STRING("Too many file names in command line - %s and %s\n"), szFileName, argv[i]); PrintHelp(argv[0]); umcRes = UMC::UMC_FAILED_TO_INITIALIZE; } } i++; } if (UMC::UMC_OK == umcRes && 0 != szFileName[0]) { if (bPlayFromList) { umcRes = PlayListFromFile(AVSync, cc, szFileName, szPerfLogFileName, uiIterations, // in case of WinCE main() function // is called by WinMain(). So to signal // to main() it's time to stop WinMAin // uses first byte of first parameter // from argv[] array. To stop playing // WinMAin sets it to zero. argv[0]); } else { umcRes = PlaySingleFile(AVSync, cc, szFileName, szPerfLogFileName, uiIterations, argv[0]); } if (UMC::UMC_UNSUPPORTED == umcRes) vm_string_printf(VM_STRING("Unsupported media format\n")); } else { if (0 == szFileName[0]) { vm_message(VM_STRING("No file to play in command line\n")); PrintHelp(argv[0]); } } return 0; }