Difference between revisions of "Tutorial"
(→updating) |
(→Audio) |
||
(One intermediate revision by the same user not shown) | |||
Line 10: | Line 10: | ||
[http://libtheoraplayer.sourceforge.net/api/html/class_theora_video_clip.html TheoraVideoClip] *clip=mgr->createVideoClip("path/to/video/file.ogg"); | [http://libtheoraplayer.sourceforge.net/api/html/class_theora_video_clip.html TheoraVideoClip] *clip=mgr->createVideoClip("path/to/video/file.ogg"); | ||
+ | Note that on iOS and Mac if you use the AVFoundation backend, you can provide H.264 files with the ".mp4" extension. | ||
== Grabbing frames == | == Grabbing frames == | ||
Line 30: | Line 31: | ||
== Audio == | == Audio == | ||
− | Theora Playback Library features an abstracted audio interface, see [[AV Player|Audio/Video Player demo]] for more information. | + | Theora Playback Library features an abstracted audio interface, see [[Demo:AV Player|Audio/Video Player demo]] for more information. |
== Destruction == | == Destruction == |
Latest revision as of 06:26, 3 March 2013
The first thing you need to do is download the latest compiled sdk or source tarball from the Releases page.
Init
To initialise the library, create an instance of the TheoraVideoManager class:
TheoraVideoManager *mgr=new TheoraVideoManager();
Loading video
TheoraVideoClip *clip=mgr->createVideoClip("path/to/video/file.ogg");
Note that on iOS and Mac if you use the AVFoundation backend, you can provide H.264 files with the ".mp4" extension.
Grabbing frames
TheoraVideoFrame *frame=clip->getNextFrame(); if (frame) { // transfer the frame pixels to your display device, texure, graphical context or whatever you use. clip->popFrame(); // be sure to pop the frame from the frame queue when you're done }
Updating
Be sure to update the TheoraVideoManager each frame to advance the current time for playing videos:
mgr->update(time_increase);
time_increase can be computed by grabbing the current time (eg. GetTickCount() on Windows) and substracting the previous frame's time stamp from it.
Audio
Theora Playback Library features an abstracted audio interface, see Audio/Video Player demo for more information.
Destruction
When you destroy the TheoraVideoManager, all video clip objects get destroyed along with it.
delete mgr;