64,648
社区成员
发帖
与我相关
我的任务
分享
// SHOW.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include "SHOW.h"
#include "PlayM4.h"
#pragma region Includes
#include <stdio.h>
#include <windows.h>
#pragma endregion
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
LONG *nPort;
long nPause;
// 唯一的应用程序对象
CWinApp theApp;
using namespace std;
void CALLBACK DecCBFun(long nPort, char * pBuf, long nSize, HK::FRAME_INFO * pFrameInfo, long nReserved1, long nReserved2)
{
wprintf(L"call g_DecCBFun suceess.\n");
printf("nPort=%d,nSize=%d,pFrameInfo.nWidth=%ld,pFrameInfo.nHeight=%ld,pFrameInfo.nStamp=%ld,pFrameInfo.nType=%ld,pFrameInfo.nFrameRate=%ld.\n",
nPort,nSize,pFrameInfo->nWidth,pFrameInfo->nHeight,
pFrameInfo->nStamp,pFrameInfo->nType,pFrameInfo->nFrameRate);
}
void _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
//int nRetCode = 0;
HMODULE hModule = ::GetModuleHandle(NULL);
if (hModule != NULL)
{
// 初始化 MFC 并在失败时显示错误
if (!AfxWinInit(hModule, NULL, ::GetCommandLine(), 0))
{
// TODO: 更改错误代码以符合您的需要
_tprintf(_T("错误: MFC 初始化失败\n"));
//nRetCode = 1;
}
else
{
// TODO: 在此处为应用程序的行为编写代码。
CString str;
char path[1024];
memset(path,0,1024);
int nID = 0;
sprintf_s(path,"%s","20131226_20131226155939_20131226160037_155724.mp4");
nPort = ( LONG* )malloc( sizeof( long ));
if(!HK::PlayM4_OpenFile(*nPort,path))
{
AfxMessageBox(_T("cun"));
}else{
AfxMessageBox(CString(path));
}
if(!HK::PlayM4_SetDecCallBack(*nPort, DecCBFun))
{
TRACE("PlayM4_SetDecCallBack err");
//return;
}
else{
wprintf(L"Read from the file mapping:\n");
}
if(!HK::PlayM4_Play(*nPort,NULL))
{
AfxMessageBox(_T("paly err"));
}else{
nPause = PLAY;
}
}
}
else
{
_tprintf(_T("错误: GetModuleHandle 失败\n"));
//nRetCode = 1;
}
//return nRetCode;
//return 0;
}
#pragma comment(lib,"user32")
#include <stdio.h>
#include <time.h>
#include <sys/timeb.h>
#include <windows.h>
char datestr[16];
char timestr[16];
char mss[4];
void log(char *s) {
struct tm *now;
struct timeb tb;
ftime(&tb);
now=localtime(&tb.time);
sprintf(datestr,"%04d-%02d-%02d",now->tm_year+1900,now->tm_mon+1,now->tm_mday);
sprintf(timestr,"%02d:%02d:%02d",now->tm_hour ,now->tm_min ,now->tm_sec );
sprintf(mss,"%03d",tb.millitm);
printf("%s %s.%s %s",datestr,timestr,mss,s);
}
VOID CALLBACK myTimerProc1(
HWND hwnd, // handle of window for timer messages
UINT uMsg, // WM_TIMER message
UINT idEvent, // timer identifier
DWORD dwTime // current system time
) {
log("In myTimerProc1\n");
}
VOID CALLBACK myTimerProc2(
HWND hwnd, // handle of window for timer messages
UINT uMsg, // WM_TIMER message
UINT idEvent, // timer identifier
DWORD dwTime // current system time
) {
log("In myTimerProc2\n");
}
int main() {
int i;
MSG msg;
SetTimer(NULL,0,1000,myTimerProc1);
SetTimer(NULL,0,2000,myTimerProc2);
for (i=0;i<20;i++) {
Sleep(500);
log("In main\n");
if (GetMessage(&msg,NULL,0,0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return 0;
}
//2012-07-26 17:29:06.375 In main
//2012-07-26 17:29:06.875 In myTimerProc1
//2012-07-26 17:29:07.375 In main
//2012-07-26 17:29:07.875 In myTimerProc2
//2012-07-26 17:29:08.375 In main
//2012-07-26 17:29:08.375 In myTimerProc1
//2012-07-26 17:29:08.875 In main
//2012-07-26 17:29:08.875 In myTimerProc1
//2012-07-26 17:29:09.375 In main
//2012-07-26 17:29:09.890 In myTimerProc2
//2012-07-26 17:29:10.390 In main
//2012-07-26 17:29:10.390 In myTimerProc1
//2012-07-26 17:29:10.890 In main
//2012-07-26 17:29:10.890 In myTimerProc1
//2012-07-26 17:29:11.390 In main
//2012-07-26 17:29:11.890 In myTimerProc2
//2012-07-26 17:29:12.390 In main
//2012-07-26 17:29:12.390 In myTimerProc1
//2012-07-26 17:29:12.890 In main
//2012-07-26 17:29:12.890 In myTimerProc1
//2012-07-26 17:29:13.390 In main
//2012-07-26 17:29:13.890 In myTimerProc2
//2012-07-26 17:29:14.390 In main
//2012-07-26 17:29:14.390 In myTimerProc1
//2012-07-26 17:29:14.890 In main
//2012-07-26 17:29:14.890 In myTimerProc1
//2012-07-26 17:29:15.390 In main
//2012-07-26 17:29:15.890 In myTimerProc2
//2012-07-26 17:29:16.390 In main
//2012-07-26 17:29:16.390 In myTimerProc1
//2012-07-26 17:29:16.890 In main
//2012-07-26 17:29:16.890 In myTimerProc1
//2012-07-26 17:29:17.390 In main
//2012-07-26 17:29:17.890 In myTimerProc2
//2012-07-26 17:29:18.390 In main
//2012-07-26 17:29:18.390 In myTimerProc1
//2012-07-26 17:29:18.890 In main
//2012-07-26 17:29:18.890 In myTimerProc1
//2012-07-26 17:29:19.390 In main
//2012-07-26 17:29:19.890 In myTimerProc2