【文件属性】:
文件名称:按每帧显示图像
文件大小:450KB
文件格式:ZIP
更新时间:2015-02-04 06:16:01
按每帧显示图像
UINT PlayVideo( LPVOID pParam )
{
int i;//,j;
BOOL bPlay = g_bPlay;
BOOL bEof = FALSE;
CYUVviewerDlg *pWin = (CYUVviewerDlg *)pParam;
UINT picsize = pWin->m_nWidth*pWin->m_nHeight;
int timespan = 1000/atoi(pWin->m_sFrameRate);
if(g_nCurrentFrame < g_nStartFrame) g_nCurrentFrame = g_nStartFrame;
if(g_nCurrentFrame > g_nEndFrame) g_nCurrentFrame = g_nEndFrame;
for(i=0; im_iCount; i++)
{
pWin->m_pFile[i]->Seek(g_nCurrentFrame*picsize*3/2, SEEK_SET);
pWin->m_pWnd[i]->nPicShowOrder = g_nCurrentFrame;
}
HANDLE hPlayTemp1 = OpenMutex(MUTEX_ALL_ACCESS,FALSE,"Play");
while(g_nCurrentFrame >= g_nStartFrame && g_nCurrentFrame <= g_nEndFrame && !bEof)
{
DWORD t2=GetTickCount();
g_nFrameNumber = g_nCurrentFrame;//j;
if ( WAIT_OBJECT_0 == WaitForSingleObject(hPlayTemp1,INFINITE) )
ReleaseMutex( hPlayTemp1 );
for(i=0; im_iCount; i++)
{
pWin->m_pFile[i]->Seek(g_nCurrentFrame*picsize*3/2, SEEK_SET);
if(picsize != pWin->m_pFile[i]->Read(pWin->m_pWnd[i]->Y,picsize))
{
AfxMessageBox("Get to end of file");
bEof = TRUE;
break;
}
if(1)//bColorImage)
{
if(picsize/4 != pWin->m_pFile[i]->Read(pWin->m_pWnd[i]->Cb,picsize/4))
{
AfxMessageBox("Get to end of file");
bEof = TRUE;
break;
}
if(picsize/4 != pWin->m_pFile[i]->Read(pWin->m_pWnd[i]->Cr,picsize/4))
{
AfxMessageBox("Get to end of file");
bEof = TRUE;
break;
}
}
pWin->m_pWnd[i]->InvalidateRect (NULL,FALSE);
pWin->m_pWnd[i]->UpdateWindow ();
pWin->m_pWnd[i]->nPicShowOrder=g_nCurrentFrame;
}
if(g_bReversePlay == FALSE)
g_nCurrentFrame++;
else
g_nCurrentFrame--;
int t1=GetTickCount()-t2;
if(t1 < timespan)
Sleep(timespan - t1); // sleep time in milliseconds
}
pWin->m_pWinThread = NULL;
AfxEndThread(0);
return 1;
}
【文件预览】:
YUVviewer_src_vc6
----YUVviewer.aps(119KB)
----resource.h(2KB)
----YUVviewer.dsw(541B)
----Debug()
--------YUVviewer.exe(1.45MB)
----ChildWindow.cpp(7KB)
----YUVviewer.cpp(3KB)
----YUVviewer.ncb(49KB)
----YUVviewer.opt(49KB)
----ReadMe.txt(2KB)
----ChildWindow.h(3KB)
----YUVviewerDlg.cpp(22KB)
----res()
--------YUVviewer.ico(97KB)
----Convert.h(1KB)
----StdAfx.cpp(211B)
----YUVviewer.h(1KB)
----YUVviewerDlg.h(3KB)
----YUVviewer.dsp(4KB)
----YUVviewer.plg(252B)
----StdAfx.h(999B)
----YUVviewer.rc(9KB)
----cscc.lib(6KB)