Game Development Community

Pause/unpause support for Ogg Theora playback

by Jon Frisby · 04/02/2006 (10:28 am) · 3 comments

Download Code File

First, you need to apply the patch that adds pause/unpause support in the general audio code. Without that patch, this code will not compile cleanly -- and even if you DO get it to compile (by commenting out references to alxPause/alxUnpause) you'll only be able to pause Ogg Theora videos that have no audio track. In order to pause videos that have an audio track, this patch is absolutely required:

www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=9385

Second, apply the attached patch. This can be done on Linux, MacOS X, or Cygwin by going into your T2D directory (one level above your engine directory) and typing this command:
patch -p1 < /path/to/theoraPatch_20060307.patch

If you don't have access to the patch command you can review the .patch file and apply the changes manually. Lines beginning with a "-" should be removed, lines beginning with a "+" should be added, and context is provided as to where those lines are located in a given file.

Recompile your engine, and you should be good to go.

To test the functionality out, open the Gui editor, and create a GuiTheoraCtrl instance. Set the playback file to an Ogg Theora file. Expand the object heirarchy on the right so you can see the numeric ID of the GuiTheoraCtrl. This may be something like "1910". While the video is playing, open the console and enter this command:
1910.pause();
The video (and audio, if present) should pause.
Now type this command:
1910.unpause();
The video (and audio) should resume smoothly.

I've personally tested this patch on MacOS X, and Thomas Bennett was kind enough to help me ensure that it worked correctly on Windows. It should also work fine on Linux but this has not been tested.

-JF

#1
11/20/2006 (12:01 am)
good resource!!
but can you show how to manually merge this resource?

any idea to play from certain position?
thanks.
#2
01/27/2011 (7:08 am)
The download link is broken:/
Is it possible for you to upload it again? This seems like exactly the resource I'm looking for.
#3
01/27/2011 (10:15 am)
Hrm. DL link works for me...

However, for now I'll post the file elsewhere (this link will go away sooner or later):

http://mrjoy.com/uploads/9385.addpauseseekaudio.zip

-JF