Playing video.

Open the video file :

First open the video file and check if video was found :

  /* open video file */
  WVStream* stream = WV_getStream(filename);
  
  /* check video */
  int streamType = WV_getStreamType(stream);
  if(streamType != WV_STREAM_TYPE_VIDEO && streamType != WV_STREAM_TYPE_AUDIOVIDEO)
    return 0; //no video found
  

Set streaming method :

You need to describe how you want to display the video by associating the stream with a streaming object. Waave come with a standard object that display on SDL surfaces. To know how to make you own streaming objects check the waave reference. So the simpliest way is to build a streamOverlay object that stream video with SDL YUVoverlays on sdl surfaces. The NULL arg say we use the entire surface :

  /* build a streaming object for an SDL surface */
  WVStreamingObject* streamObj = WV_getStreamOverlayObj(mySDLSurface, NULL);

  
Associate the streaming object with the stream :
  /* associate streamObj with the stream */
  WV_setStreamingMethod(stream, streamObj);
  

You can now load the stream in the waave engine :

  /* load */
  WV_loadStream(stream);

Display video :

The waave engine will say you when you need to refresh the video frame by sending an WV_REFRESH_EVENT. Therefore when you reveive this event you need to call the WV_refreshVideoFrame function :

  /* check event */ 
  switch( event.type ) {
    
  /* refresh video frame */
  case WV_REFRESH_EVENT:
    WV_refreshVideoFrame(&event);
    break;

    ...

  }

Now you just to launch the play command when you want :

  /* play */
  WV_playStream(stream);