static BOOL Video_OnCreate(HWND hWindow, LPCREATESTRUCT lpCreateStruct) /***********************************************************************/ { BOOL fRemap; LPVIDEO lpVideo; if ( !(lpVideo = (LPVIDEO)AllocX( sizeof(VIDEO), GMEM_ZEROINIT|GMEM_SHARE )) ) return( FALSE ); SetWindowLong( hWindow, GWL_DATAPTR, (long)lpVideo ); ITEMID id; if ( !(id = GetWindowWord( hWindow, GWW_ICONID )) ) id = GET_WINDOW_ID( hWindow ); lpVideo->lpAllShots = Video_GetShotData( id, &lpVideo->iNumShots, &fRemap ); lpVideo->lCurrentShot = lpVideo->lPrevShot = (lDefaultShot ? lDefaultShot : 1 ); lDefaultShot = 0; lpVideo->lPrevFrame = 0; // Remap the shot table to make all entries sequential if (fRemap) Video_RemapShotTable( hWindow ); Video_CheckDumpShotTable(id, lpVideo->lpAllShots, lpVideo->iNumShots); LPSHOT lpShot = Video_GetShotPtr( lpVideo, lpVideo->lCurrentShot ); return( Video_Open( hWindow, lpVideo, (lpShot ? lpShot->wDisk : 1), (lpShot ? lpShot->lStartFrame : 0) ) ); }
void Video_Init() { Video_Open(); Video_Set_Para(); Buffer_Init(); Video_Streamon(); }
void Video_GotoShot( HWND hWindow, LPVIDEO lpVideo, SHOTID lShot, long lCount, int iFrames, int iEventCode ) /***********************************************************************/ { LPSHOT lpShot; if ( !(lpShot = Video_GetShot( lpVideo, lShot, lCount )) ) { MCIStop( lpVideo->hDevice, YES/*bWait*/ ); MCIPlay( lpVideo->hDevice, hWindow/*Notify Myself*/ ); return; } if ( lpShot->wDisk != lpVideo->wDisk ) if ( !Video_Open( hWindow, lpVideo, lpShot->wDisk, lpShot->lStartFrame ) ) return; if ( lpShot->lShotID != lpVideo->lCurrentShot || !iEventCode ) { // if the shot is changing, or a NULL event code... // Send the notification message if the shot is changing lpShot->iLastEvent = iEventCode; LPPSHOT lppShot = &lpShot; FORWARD_WM_COMMAND( GetParent(hWindow), GET_WINDOW_ID(hWindow), LOWORD(lppShot), HIWORD(lppShot), SendMessage ); if ( !(*lppShot) ) // if the application rejects this shot... return; // get out, and whatever is playing keeps playing // Set the previous shot variables, unless we could cause an infinite loop if ( lpShot->bGoesPrev ) { LPSHOT lpCurrentShot = Video_GetShotPtr( lpVideo, lpVideo->lCurrentShot ); if ( lpCurrentShot && !lpCurrentShot->bGoesPrev ) { lpVideo->lPrevFrame = MCIGetPosition( lpVideo->hDevice ); lpVideo->lPrevShot = lpVideo->lCurrentShot; } } lpVideo->lCurrentShot = lpShot->lShotID; } // Calculate the lFrom and lTo frames long lTo = lpShot->lEndFrame; long lFrom = lpShot->lStartFrame; if ( iFrames > 0 ) lFrom = max( lTo - iFrames, lFrom ); if ( lpShot->lIndentFrames ) { // If indention is being used... lFrom += lpShot->lIndentFrames; lpShot->lIndentFrames = 0; if ( lFrom > lTo ) lFrom = lTo; } else // Clear any disabled hotspot flags Video_ShotEnableHotspots( lpVideo, lpShot ); MCIStop( lpVideo->hDevice, YES/*bWait*/ ); MCIPlay( lpVideo->hDevice, hWindow/*Notify Myself*/, lFrom, lTo ); lpVideo->lLastShotToPlay = lpVideo->lCurrentShot; }