<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>char buffer to ALLEGRO_BITMAP</title>
		<link>http://www.allegro.cc/forums/view/613486</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Tue, 12 Nov 2013 09:51:02 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m trying to be able to play video (for a trailer). I&#39;m not sure I want to move to 5.1 yet (plus no available packages for it yet) and wasn&#39;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: <a href="http://sourceforge.net/projects/libtheoraplayer/">http://sourceforge.net/projects/libtheoraplayer/</a></p><p>I&#39;ve got it set up, but the issue I&#39;m running into now is how do I get the image to actually render. I read frame by frame, and call frame-&gt;getBuffer() which returns me a unsigned char pointer. This is the example I am kinda mimicking: <a href="http://sourceforge.net/p/libtheoraplayer/code/HEAD/tree/trunk/demos/av_player/av_player.cpp">http://sourceforge.net/p/libtheoraplayer/code/HEAD/tree/trunk/demos/av_player/av_player.cpp</a></p><p>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&#39;m calling (which is the main area that I have no clue if I&#39;m doing this right):</p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number">  1</span>TheoraVideoFrame <span class="k3">*</span>frame <span class="k3">=</span> vidyaClip-&gt;getNextFrame<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  2</span><span class="k1">if</span><span class="k2">(</span>frame<span class="k2">)</span>
<span class="number">  3</span><span class="k2">{</span>
<span class="number">  4</span>  <span class="c">// transfer the frame pixels to your display device, texure, graphical context or whatever you use.</span>
<span class="number">  5</span>  <a href="http://www.allegro.cc/manual/ALLEGRO_FILE"><span class="a">ALLEGRO_FILE</span></a> <span class="k3">*</span>file <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_open_memfile"><span class="a">al_open_memfile</span></a><span class="k2">(</span>frame-&gt;getBuffer<span class="k2">(</span><span class="k2">)</span>, <span class="k1">sizeof</span><span class="k2">(</span>frame-&gt;getBuffer<span class="k2">(</span><span class="k2">)</span><span class="k2">)</span>, <span class="s">"r"</span> <span class="k2">)</span><span class="k2">;</span>
<span class="number">  6</span>  <a href="http://www.allegro.cc/manual/ALLEGRO_BITMAP"><span class="a">ALLEGRO_BITMAP</span></a> <span class="k3">*</span>bitmapFrame <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_load_bitmap_f"><span class="a">al_load_bitmap_f</span></a><span class="k2">(</span>file, <span class="s">".png"</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  7</span>  <a href="http://www.allegro.cc/manual/al_draw_scaled_bitmap"><span class="a">al_draw_scaled_bitmap</span></a><span class="k2">(</span>bitmapFrame, <span class="n">0</span>, <span class="n">0</span>, <a href="http://www.allegro.cc/manual/al_get_bitmap_width"><span class="a">al_get_bitmap_width</span></a><span class="k2">(</span>bitmapFrame<span class="k2">)</span>, <a href="http://www.allegro.cc/manual/al_get_bitmap_height"><span class="a">al_get_bitmap_height</span></a><span class="k2">(</span>bitmapFrame<span class="k2">)</span>, <span class="n">0</span>, <span class="n">0</span>, WIDTH, HEIGHT, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  8</span>  vidyaClip-&gt;popFrame<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span> <span class="c">// be sure to pop the frame from the frame queue when you're done</span>
<span class="number">  9</span><span class="k2">}</span>
</div></div><p>

Further down I&#39;m doing the flip display, etc. Just to be aware, I&#39;ve tried drawing other images right there in that spot and images all work fine. But not the video frames.</p><p>Also, I&#39;m not sure if &quot;.png&quot; is right for al_load_bitmap_f. I just tried that out, but since I&#39;m being given frame data, how would that even apply or how would I know what to use?</p><p>Maybe I&#39;m doing this completely the wrong way, and if so, any help is appreciated. <img src="http://www.allegro.cc/forums/smileys/cheesy.gif" alt=":D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (tileproject)</author>
		<pubDate>Mon, 11 Nov 2013 05:17:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>A5 supports theora video I believe, and I don&#39;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...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Mon, 11 Nov 2013 05:25:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>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&#39;t the case. And libtheoraplayer is under BSD license. Not too familiar with this type of stuff though. </p><p>And is 5.1 stable enough for commercial development? :x</p><p>Edit: It seems there is a 5.1.7 binary out at <a href="http://alleg.sourceforge.net/download.html">http://alleg.sourceforge.net/download.html</a> Anyone know how stable that is?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (tileproject)</author>
		<pubDate>Mon, 11 Nov 2013 20:42:20 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The Allegro 5 license is basically a no warranty don&#39;t claim you wrote our stuff license, and there&#39;s some little blurb about bstrlib, but that&#39;s all. You have to see the libtheora license if you wanna know their policy.</p><p>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.</p><p>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.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Tue, 12 Nov 2013 00:10:09 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/613486/992355#target">tileproject</a> said:</div><div class="quote"><p> And is 5.1 stable enough for commercial development?
</p></div></div><p>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.</p><p>The &quot;unstable&quot; is more descriptive of the API... functions that were introduced in 5.1 may be renamed or modified without regard to backward compatibility.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Tue, 12 Nov 2013 01:14:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Alright. I&#39;ll go ahead and try switching to 5.1.7 tonight. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /><br />And that&#39;s great news to hear, that <b>unstable</b> is more about the syntax of the API. Thats what kept me from moving to 5.1, the fact that I thought it was <b>literally</b> unstable. <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (tileproject)</author>
		<pubDate>Tue, 12 Nov 2013 01:18:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I think this is why we used to use WIP rather than &quot;unstable&quot;.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Tue, 12 Nov 2013 09:51:02 +0000</pubDate>
	</item>
</rss>
