BOOLEAN BinkPollFlics(void) { UINT32 uiCount; BOOLEAN fFlicStatus=FALSE; DDSURFACEDESC SurfaceDescription; BINKFLIC *pBink=NULL; UINT32 uiCopyToBufferFlags = guiBinkPixelFormat; //loop through all the open flics for(uiCount=0; uiCount < BINK_NUM_FLICS; uiCount++) { pBink = &BinkList[uiCount]; if( pBink->uiFlags & BINK_FLIC_PLAYING ) { fFlicStatus = TRUE; //do we still have to wait for the frame to be finished being displayed if( !( BinkWait( pBink->BinkHandle ) ) ) { DDLockSurface( pBink->lpDDS, NULL, &SurfaceDescription, 0, NULL); BinkDoFrame( pBink->BinkHandle ); BinkCopyToBuffer( pBink->BinkHandle, SurfaceDescription.lpSurface, SurfaceDescription.lPitch, pBink->BinkHandle->Height, pBink->uiLeft, pBink->uiTop, uiCopyToBufferFlags ); DDUnlockSurface( pBink->lpDDS, SurfaceDescription.lpSurface); // Check to see if the flic is done the last frame if( pBink->BinkHandle->FrameNum == ( pBink->BinkHandle->Frames-1 ) ) { // If flic is looping, reset frame to 0 if( pBink->uiFlags & BINK_FLIC_LOOP) { BinkGoto( pBink->BinkHandle, 0, 0 ); } else if( pBink->uiFlags & BINK_FLIC_AUTOCLOSE) { BinkCloseFlic( pBink ); } } else { BinkNextFrame( BinkList[uiCount].BinkHandle ); } } } } return( fFlicStatus ); }
/*----------------------------------------------------------------------------- Name : binkNextFrame Description : advance to next frame of the Bink video file Inputs : Outputs : Return : ----------------------------------------------------------------------------*/ static void binkNextFrame(void) { if (WaitForSingleObject(binkSemaphore, 0) == WAIT_FAILED) { return; } BinkDoFrame(bnk); binkUpdate = TRUE; if (bnk->FrameNum == (bnk->Frames - 1)) { binkStopNow = TRUE; } else { BinkNextFrame(bnk); } ReleaseSemaphore(binkSemaphore, 1, NULL); }
void ITextureVideo::UpdateImage() { #if USE_BINK if (Bink /*&& !BinkWait( Bink )*/) { BinkDoFrame( Bink ); BinkCopyToBuffer( Bink, m_pBuffer.GetData(), m_pBuffer.GetFormat()*m_pBuffer.GetWidth(), Bink->Height, 0,0, BINKSURFACE24R ); if (m_pTextureManager) m_pTextureManager->SetTextureData(this,m_pBuffer); //printf("Process bink\n"); BinkNextFrame( Bink ); } #endif }
static void Show_next_frame( HBINK bink, HBINKBUFFER bink_buffer, HWND window ) { // // Decompress the Bink frame. // BinkDoFrame( bink ); // // Lock the BinkBuffer so that we can copy the decompressed frame into it. // if ( BinkBufferLock( bink_buffer ) ) { // // Copy the decompressed frame into the BinkBuffer (this might be on-screen). // BinkCopyToBuffer( bink, bink_buffer->Buffer, bink_buffer->BufferPitch, bink_buffer->Height, 0,0, bink_buffer->SurfaceType); // // Unlock the BinkBuffer. // BinkBufferUnlock( bink_buffer ); } // // Tell the BinkBuffer to blit the pixels onto the screen (if the // BinkBuffer is using an off-screen blitting style). // BinkBufferBlit( bink_buffer, bink->FrameRects, BinkGetRects( bink, bink_buffer->SurfaceType ) ); // // Are we at the end of the movie? // if ( bink->FrameNum == bink->Frames ) { // // Yup, close the window. // DestroyWindow( window ); } else { // // Nope, advance to the next frame. // BinkNextFrame( bink ); } }