Bink SDK 1.5v

# BinkNextFrame

The function BinkNextFrame moves to the next video frame in the Bink file.

    void BinkNextFrame(
      HBINK bink
    );

#### In Parameters

bink
  Specifies the Bink handle.

#### Discussion

This function actually moves you to the next frame. It is usually called after you have decompressed the frame with BinkDoFrame and have blitted it onto the screen. This function is should be the last function in your playback logic before the BinkWait delay loop. Make sure that you always call this function before waiting in your BinkWait loop, or your playback will be jerky. For example, this is an example of good playback logic:

`

    for( i=0 ; ; i++ ){  BinkDoFrame( bink );  BinkNextFrame( bink );        //***** Good, notice how this line is before the BinkWait delay loop
      while ( BinkWait( bink ) ) ;  //***** Good, notice how this line is after the BinkNextFrame call}

`

This is an example of incorrect playback logic:

`

    for( i=0 ; ; i++ ){                             //***** THIS IS AN INCORRECT PLAYBACK LOOP!  BinkDoFrame( bink );  while (BinkWait( bink ) ) ; //***** WRONG!! THIS SHOULD BE AFTER BINKNEXTFRAME  BinkNextFrame( bink );      //***** WRONG!! THIS SHOULD BE BEFORE THE BINKWAIT LOOP}

`

Note that if you call this function on the last frame of a Bink file, then Bink will loop around back to the first frame. This means that if you are only playing your animations once (not looping them), then you need to add extra logic to avoid calling this function for the very last frame (otherwise there will be a delay at the end of your videos while Bink seeks back to the beginning of the file). For example, a simple playback loop that only plays the Bink file once would look like this:

`

    for( i=0 ; ; i++ ){  BinkDoFrame( bink );  if ( i == bink->Frames )  // Break out of loop before BinkNextFrame if at the end of the file    break;
      BinkNextFrame( bink );  while ( BinkWait( bink ) ) ;}

`

Group: Bink API
Related Sections: Bink Video Playback, Critical File I/O handling in Bink
Related Functions: BinkDoFrame, BinkWait
Related Basic Types: HBINK, void

For technical support, e-mail Bink1@radgametools.com
© Copyright 1994-2003 RAD Game Tools, Inc. All Rights Reserved.