|
char buffer to ALLEGRO_BITMAP |
tileproject
Member #14,888
January 2013
|
I'm trying to be able to play video (for a trailer). I'm not sure I want to move to 5.1 yet (plus no available packages for it yet) and wasn't sure on the ruling of whether the libraries/code/whatever that it uses for video rendering is completely open for commercial projects to use. So I went with: http://sourceforge.net/projects/libtheoraplayer/ I've got it set up, but the issue I'm running into now is how do I get the image to actually render. I read frame by frame, and call frame->getBuffer() which returns me a unsigned char pointer. This is the example I am kinda mimicking: http://sourceforge.net/p/libtheoraplayer/code/HEAD/tree/trunk/demos/av_player/av_player.cpp It seems to load the video as it gives me the amount of frames in the clip. And it seems to loop through trying to draw them, but I never see anything drawn. Here is the code I'm calling (which is the main area that I have no clue if I'm doing this right): 1TheoraVideoFrame *frame = vidyaClip->getNextFrame();
2if(frame)
3{
4 // transfer the frame pixels to your display device, texure, graphical context or whatever you use.
5 ALLEGRO_FILE *file = al_open_memfile(frame->getBuffer(), sizeof(frame->getBuffer()), "r" );
6 ALLEGRO_BITMAP *bitmapFrame = al_load_bitmap_f(file, ".png");
7 al_draw_scaled_bitmap(bitmapFrame, 0, 0, al_get_bitmap_width(bitmapFrame), al_get_bitmap_height(bitmapFrame), 0, 0, WIDTH, HEIGHT, 0);
8 vidyaClip->popFrame(); // be sure to pop the frame from the frame queue when you're done
9}
Further down I'm doing the flip display, etc. Just to be aware, I've tried drawing other images right there in that spot and images all work fine. But not the video frames. Also, I'm not sure if ".png" is right for al_load_bitmap_f. I just tried that out, but since I'm being given frame data, how would that even apply or how would I know what to use? Maybe I'm doing this completely the wrong way, and if so, any help is appreciated. -- Zyaga |
Edgar Reynaldo
Major Reynaldo
May 2007
|
A5 supports theora video I believe, and I don't know that getBuffer() is giving you a png file. Look at the theora docs for getBuffer. And there are binaries for Windows for 5.1.7 somewhere... My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
tileproject
Member #14,888
January 2013
|
Is the player under a license that is fine for commercial use though? Cause the way it sounded from other places I read about ffmpeg or something, that isn't the case. And libtheoraplayer is under BSD license. Not too familiar with this type of stuff though. And is 5.1 stable enough for commercial development? :x Edit: It seems there is a 5.1.7 binary out at http://alleg.sourceforge.net/download.html Anyone know how stable that is? -- Zyaga |
Edgar Reynaldo
Major Reynaldo
May 2007
|
The Allegro 5 license is basically a no warranty don't claim you wrote our stuff license, and there's some little blurb about bstrlib, but that's all. You have to see the libtheora license if you wanna know their policy. And is 5.1.7 stable? Er, yes in the sense it is a snapshot that will never change. 5.1.x is a development WIP though, so you never know when things will change. For instance, muhkuh has been putting a bunch of work into the audio addon along with Peter Wang and things may change some. They do try to preserve backwards compatibility when possible. And 5.1 has perks that 5.0 does not, like shaders and video. For video you can use ffmpeg as you discovered or you can use ogg and theora to play ogg movies. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Matthew Leverton
Supreme Loser
January 1999
|
tileproject said: And is 5.1 stable enough for commercial development? The 5.1 branch is generally more stable in terms of runtime reliability than the 5.0 branch, although some of the newest features may not be quite ready. The "unstable" is more descriptive of the API... functions that were introduced in 5.1 may be renamed or modified without regard to backward compatibility. |
tileproject
Member #14,888
January 2013
|
Alright. I'll go ahead and try switching to 5.1.7 tonight. -- Zyaga |
Thomas Fjellstrom
Member #476
June 2000
|
I think this is why we used to use WIP rather than "unstable". -- |
|