So I checked the API reference for libtheoraplayer and found out that there is support for loading from memory, just that it is not so direct. So with a little coding, I've implemented both the original(from libtheoraplayer) load from TheoraDataSource, and a simplified load from data(by providing a pointer and data size).
What is SFMLTheora?
Basically, it's a few classes for loading theora(ogg/ogv) video files using the libtheoraplayer(http://sourceforge.net/apps/mediawiki/libtheoraplayer/index.php?title=Main_Page) and displaying it using the SFML library(http://www.sfml-dev.org/).
Discussion in SFML forums:
http://www.sfml-dev.org/forum/viewtopic.php?p=29049
Latest version:
1.2.9
Last update:
08/09/2011 - Fixed support for SFML 1.6.
Download (comes with an example on how to use it):
Newer version available: http://www.zorexxlkl.com/2011/09/sfmltheora-13.html
Short tutorial:
Just thought of making a short tutorial.
SFMLTheora is very easy and straight forward to use, first, create an Video instance:
SFMLTheora::Video* testVid = new SFMLTheora::Video();
if (testVid == NULL)
return 1;testVid->Init();Starting from SFMLTheora 1.1.1, Init() is automatically called in LoadClip() if it hasn't been called yet.
Then load your video:
testVid->LoadClip("bunny.ogg");Now, in your game loop, add this line:
testVid->Update(sfApp.GetFrameTime()); or, for SFML2 as of 24/5/2011 (time is in Uint32 milliseconds instead of float seconds):
testVid->Update(sfApp.GetFrameTime() / 1000.0f); or, if you use a fixed framerate (e.g. 60 fps):
testVid->Update(1.0f / 60.0f);Draw it! (in your game loop where you draw other things)
renderWindow.Draw(*testVid);Finally, when you're done with it, delete it:
delete testVid;
testVid = NULL;That's all! It's just that simple.
Screenshot:

That's pretty good news! SFML is getting very good with this kind of stuff!
ReplyDeleteYup, I like how flexible SFML is.
ReplyDeleteI'm currently working on another game that also uses SFML. I'll post updates on it when I've done enough, please look forward to it! ;)
Hello, when I compile with SFMLTheora I get many errors, can you help please? I use codeblocks.
ReplyDeletehttp://i55.tinypic.com/35d9s9f.png
Thanks.
Hi, I've uploaded SFMLTheora 1.2.5 which fixes the friend class error, and the deleting void* warning. If there's still errors, please send the full list of errors to my email at kerlilow_at_gmail_dot_com.
ReplyDelete