<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Brooks Andrus &#187; AIR</title>
	<atom:link href="http://www.brooksandrus.com/blog/category/air/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.brooksandrus.com/blog</link>
	<description>This is the blog of Brooks Andrus. Here, at irregular intervals, you may find digital noise centered around the activities of an early 21st century technologist. I work for TechSmith Corporation, but this web space and the views found on it are entirely my own.</description>
	<lastBuildDate>Fri, 13 May 2011 19:19:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>OSMF + Flex Example</title>
		<link>http://www.brooksandrus.com/blog/2010/02/10/osmf-flex-example/</link>
		<comments>http://www.brooksandrus.com/blog/2010/02/10/osmf-flex-example/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 18:34:35 +0000</pubDate>
		<dc:creator>brooks</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[media]]></category>
		<category><![CDATA[osmf]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://www.brooksandrus.com/blog/?p=1269</guid>
		<description><![CDATA[I&#8217;ve been checking up on OSMF (Open Source Media Framework) periodically, but found that many of their examples / samples don&#8217;t work at the moment (their APIs have been in flux). If you&#8217;re just looking for a quick way to get OSMF (v.9) up and running in Flex here&#8217;s a bit of code that should [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been checking up on <a href="http://www.opensourcemediaframework.com/">OSMF</a> (Open Source Media Framework) periodically, but found that many of their examples / samples don&#8217;t work at the moment (their APIs have been in flux). If you&#8217;re just looking for a quick way to get OSMF (v.9) up and running in Flex here&#8217;s a bit of code that should help.</p>
<p><span id="more-1269"></span></p>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt; ?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;">&lt;mx :Application xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #ff0000;">&quot;absolute&quot;</span> xmlns:containers=<span style="color: #ff0000;">&quot;org.osmf.containers.*&quot;</span> applicationComplete=<span style="color: #ff0000;">&quot;init();&quot;</span> xmlns:media=<span style="color: #ff0000;">&quot;org.osmf.media.*&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
&nbsp;
&nbsp;
    <span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span>&lt;mx :Script<span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;">&lt; !<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">            import org.osmf.display.MediaPlayerSprite;</span>
<span style="color: #000000;">            import org.osmf.layout.LayoutUtils;</span>
&nbsp;
<span style="color: #000000;">            import org.osmf.containers.MediaContainer;</span>
<span style="color: #000000;">            import org.osmf.media.MediaElement;</span>
<span style="color: #000000;">            import org.osmf.media.MediaPlayer;</span>
<span style="color: #000000;">            import org.osmf.media.URLResource;</span>
<span style="color: #000000;">            import org.osmf.utils.URL;</span>
<span style="color: #000000;">            import org.osmf.video.VideoElement;</span>
<span style="color: #000000;">            import org.osmf.net.NetLoader;</span>
&nbsp;
<span style="color: #000000;">            import mx.core.UIComponent;</span>
&nbsp;
<span style="color: #000000;">            private static const REMOTE_PROGRESSIVE:String = <span style="color: #ff0000;">&quot;http://mediapm.edgesuite.net/strobe/content/test/AFaerysTale_sylviaApostol_640_500_short.flv&quot;</span>;</span>
&nbsp;
<span style="color: #000000;">            private var mediaElement:MediaElement;</span>
<span style="color: #000000;">            private var mediaPlayer:MediaPlayer;</span>
<span style="color: #000000;">            private var container:MediaContainer;</span>
&nbsp;
<span style="color: #000000;">            private function init<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:void</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                // set up some listeners for our buttons</span>
<span style="color: #000000;">                playBtn.addEventListener<span style="color: #66cc66;">&#40;</span> MouseEvent.CLICK, playHandler, false, <span style="color: #cc66cc;">0</span>, true <span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                pauseBtn.addEventListener<span style="color: #66cc66;">&#40;</span> MouseEvent.CLICK, pauseHandler, false, <span style="color: #cc66cc;">0</span>, true <span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                seekBtn.addEventListener<span style="color: #66cc66;">&#40;</span> MouseEvent.CLICK, seekHandler, false, <span style="color: #cc66cc;">0</span>, true <span style="color: #66cc66;">&#41;</span>;</span>
&nbsp;
<span style="color: #000000;">                // First create a MediaElement and load some media </span>
<span style="color: #000000;">                mediaElement = new VideoElement<span style="color: #66cc66;">&#40;</span> new NetLoader, new URLResource<span style="color: #66cc66;">&#40;</span> new URL<span style="color: #66cc66;">&#40;</span> REMOTE_PROGRESSIVE <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;</span>
&nbsp;
<span style="color: #000000;">                // We need a DisplayObject for the video</span>
<span style="color: #000000;">                container = new MediaContainer<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </span>
<span style="color: #000000;">                // feed the display object a media element</span>
<span style="color: #000000;">                container.addMediaElement<span style="color: #66cc66;">&#40;</span> mediaElement <span style="color: #66cc66;">&#41;</span>; </span>
<span style="color: #000000;">                // Flex requires a DisplayObject to be wrapped in Flex Framework UI Abstraction</span>
<span style="color: #000000;">                videoParent.addChild<span style="color: #66cc66;">&#40;</span> container <span style="color: #66cc66;">&#41;</span>; </span>
&nbsp;
<span style="color: #000000;">                // MediaPlayer is a virtual controller. Assign it a media element and it will autoplay the media by default.</span>
<span style="color: #000000;">                mediaPlayer = new MediaPlayer<span style="color: #66cc66;">&#40;</span> mediaElement <span style="color: #66cc66;">&#41;</span>;</span>
&nbsp;
<span style="color: #000000;">                // We will manually resize the MediaContainer just for kicks</span>
<span style="color: #000000;">                LayoutUtils.setAbsoluteLayout<span style="color: #66cc66;">&#40;</span> mediaElement.metadata, <span style="color: #cc66cc;">640</span>, <span style="color: #cc66cc;">360</span> <span style="color: #66cc66;">&#41;</span>; </span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            private function playHandler<span style="color: #66cc66;">&#40;</span> e:MouseEvent <span style="color: #66cc66;">&#41;</span>:void</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                if <span style="color: #66cc66;">&#40;</span> !mediaPlayer.playing <span style="color: #66cc66;">&#41;</span></span>
<span style="color: #000000;">                <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                    mediaPlayer.play<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            private function pauseHandler<span style="color: #66cc66;">&#40;</span> e:MouseEvent <span style="color: #66cc66;">&#41;</span>:void</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                if <span style="color: #66cc66;">&#40;</span> mediaPlayer.playing <span style="color: #66cc66;">&#41;</span></span>
<span style="color: #000000;">                <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                    mediaPlayer.pause<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            private function seekHandler<span style="color: #66cc66;">&#40;</span> e:MouseEvent <span style="color: #66cc66;">&#41;</span>:void</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var val:Number =  parseFloat<span style="color: #66cc66;">&#40;</span> timeTxt.text <span style="color: #66cc66;">&#41;</span>;</span>
&nbsp;
<span style="color: #000000;">                mediaPlayer.seek<span style="color: #66cc66;">&#40;</span> val <span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">        <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;">&lt;mx :UIComponent id=<span style="color: #ff0000;">&quot;videoParent&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;">&lt;mx :Button x=<span style="color: #ff0000;">&quot;10&quot;</span> y=<span style="color: #ff0000;">&quot;400&quot;</span> label=<span style="color: #ff0000;">&quot;play&quot;</span> id=<span style="color: #ff0000;">&quot;playBtn&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;">&lt;mx :Button x=<span style="color: #ff0000;">&quot;72&quot;</span> y=<span style="color: #ff0000;">&quot;400&quot;</span> label=<span style="color: #ff0000;">&quot;pause&quot;</span> id=<span style="color: #ff0000;">&quot;pauseBtn&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;">&lt;mx :Button x=<span style="color: #ff0000;">&quot;145&quot;</span> y=<span style="color: #ff0000;">&quot;400&quot;</span> label=<span style="color: #ff0000;">&quot;seek&quot;</span> id=<span style="color: #ff0000;">&quot;seekBtn&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;">&lt;mx :TextInput x=<span style="color: #ff0000;">&quot;211&quot;</span> y=<span style="color: #ff0000;">&quot;400&quot;</span> width=<span style="color: #ff0000;">&quot;40&quot;</span> id=<span style="color: #ff0000;">&quot;timeTxt&quot;</span> text=<span style="color: #ff0000;">&quot;0&quot;</span> restrict=<span style="color: #ff0000;">&quot;0-9&quot;</span><span style="color: #7400FF;">/&gt;</span></span></pre></div></div>

<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.brooksandrus.com/blog/2010/02/10/osmf-flex-example/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
<enclosure url="http://mediapm.edgesuite.net/strobe/content/test/AFaerysTale_sylviaApostol_640_500_short.flv" length="2660334" type="video/x-flv" />
		</item>
		<item>
		<title>Getting Down and Dirty with XMP and AS3</title>
		<link>http://www.brooksandrus.com/blog/2009/04/13/getting-down-and-dirty-with-xmp-and-as3/</link>
		<comments>http://www.brooksandrus.com/blog/2009/04/13/getting-down-and-dirty-with-xmp-and-as3/#comments</comments>
		<pubDate>Mon, 13 Apr 2009 06:10:05 +0000</pubDate>
		<dc:creator>brooks</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[media]]></category>
		<category><![CDATA[metadata]]></category>
		<category><![CDATA[xmp]]></category>

		<guid isPermaLink="false">http://www.brooksandrus.com/blog/?p=1001</guid>
		<description><![CDATA[One of the best ways to get started using XMP is to take a look at how Adobe is using it to embed speech-to-text data inside video files using Adobe Premiere. As Flash Platform devs, the easiest way to get access to the XMP data in a video file created by Adobe Premiere is to [...]]]></description>
			<content:encoded><![CDATA[<p>One of the best ways to get started using <a href="http://www.adobe.com/products/xmp/">XMP</a> is to take a look at how Adobe is using it to <a href="http://www.brooksandrus.com/blog/2008/11/16/the-xmp-revolution-is-here/">embed speech-to-text data</a> inside video files using Adobe Premiere.</p>
<p>As Flash Platform devs, the easiest way to get access to the XMP data in a video file created by Adobe Premiere is to make sure you handle the onXMPData callback that NetStream fires (Flash Player 10 only). One way to do this is by extending NetStream and adding a callback handler method that looks like this:</p>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// callback handler inside a NetStream subclass dispatches a custom event that  </span>
<span style="color: #808080; font-style: italic;">// forwards the xmp data found in the callback handler</span>
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> onXMPData<span style="color: #66cc66;">&#40;</span> info:<span style="color: #0066CC;">Object</span> <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	dispatchEvent<span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> XMPEvent<span style="color: #66cc66;">&#40;</span> XMPEvent.<span style="color: #006600;">XMP_STRING</span>, info.<span style="color: #0066CC;">data</span>, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>; 
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p></code></p>
<p>Next you need to make sure you&#8217;re listening for the XMPEvent, then load the MPEG-4 AVC / F4V / FLV media:</p>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// pseudo code</span>
<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">video</span>:<span style="color: #0066CC;">NetStream</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">NetStream</span><span style="color: #66cc66;">&#40;</span> connection <span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">video</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> XMPEvent.<span style="color: #006600;">XMP_STRING</span>, xmpHandler, <span style="color: #000000; font-weight: bold;">false</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">video</span>.<span style="color: #0066CC;">play</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;h264_captions.f4v&quot;</span> <span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p></code></p>
<p>Now its time to see what XMP looks like. We&#8217;ll use the <a href="http://labs.adobe.com/technologies/xmplibrary/">AS3 XMP library</a> that Adobe has up on labs:</p>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> xmpHandler<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>:XMPEvent <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #808080; font-style: italic;">// XMPMeta is root data structure for xmp data. Pass in the xmp data</span>
	<span style="color: #808080; font-style: italic;">// we received from the NetStream callback</span>
	<span style="color: #000000; font-weight: bold;">var</span> xmp:XMPMeta = <span style="color: #000000; font-weight: bold;">new</span> XMPMeta<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>.<span style="color: #006600;">xmp</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
	 <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">xml</span>:<span style="color: #0066CC;">XML</span> = xmp.<span style="color: #006600;">serializeToXML</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	 <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">xml</span>.<span style="color: #006600;">toXMLString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p></code></p>
<p>The output of the previous trace should look something like this (full example xml available <a href="http://www.brooksandrus.com/resources/xmp.xml">here</a>):</p>
<p><img src="http://www.brooksandrus.com/jing2/xmp_sample.png" alt="XMP sample" /></p>
<p>As you can see in the example above the much of the XMP information is stored in the <a href="www.adobe.com/devnet/xmp/pdfs/XMPSpecificationPart2.pdf">Adobe Dynamic Media schema</a> that uses the xmpDM namespace.</p>
<p><img src="http://www.brooksandrus.com/jing2/xmpNamespace.png" alt="xmpDM cust XMP namespace" /></p>
<p>XMP itself builds on top of another metadata framework called <a href="http://www.w3.org/RDF/">RDF</a> (Rich Description Framework). You can think of RDF as the raw building blocks or data structures necessary to generically describe data.</p>
<p><img src="http://www.brooksandrus.com/jing2/xmpRDF.png" alt="XMP uses RDF" /></p>
<p>The gigantic mess of RDF and XMP namespace elements that need to be mixed and matched can be overwhelming, but keep yer cool&#8211;Adobe&#8217;s AS3 XMP library makes it relatively simple to parse, modify or create XMP metadata.</p>
<p>First off let&#8217;s come to a basic understanding of the core RDF elements used in XMP:</p>
<ul>
<li><strong>Description</strong> &#8211; the basic data structure of RDF, this sucka holds just about anything.</li>
<li><strong>Bag</strong> &#8211; an array structure. I just think of these as unordered all purposes arrays.</li>
<li><strong>Seq</strong> &#8211; an array structure that&#8217;s ordinal by nature.</li>
<li><strong>li</strong> &#8211; an item. If yer a Bag or Seq and aren&#8217;t just an empty vessel then plenty of these will be present.</li>
</ul>
<p>Luckily, Adobe&#8217;s AS3 XMP library has a similar ActionScript object data model:</p>
<ul>
<li><strong>XMPStruct</strong> &#8211; the core data structure of XMP.</li>
<li><strong>XMPArray</strong> &#8211; there are bag and seq flavors, but for the most part these are implicitly derived.</li>
</ul>
<p>Let&#8217;s take a look at the speech-to-text data again and see if we can piece together some of the details.</p>
<p><img src="http://www.brooksandrus.com/jing2/markers_tracks_xmp_desc.png" alt="Describing speech to text XMP data types" /></p>
<p>Now lets see how we could use this information to parse the XMP data and extract values:</p>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> xmpHandler<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>:XMPEvent <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">var</span> xmp:XMPMeta = <span style="color: #000000; font-weight: bold;">new</span> XMPMeta<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>.<span style="color: #006600;">xmp</span> <span style="color: #66cc66;">&#41;</span>;
    <span style="color: #808080; font-style: italic;">// define a namespace that will allow us to &quot;dot down&quot; into the data</span>
    <span style="color: #808080; font-style: italic;">// the XMP lib provides constants for many of the common XMP schemas</span>
    <span style="color: #000000; font-weight: bold;">var</span> xmpDM:Namespace = XMPConst.<span style="color: #006600;">xmpDM</span>; 
&nbsp;
    <span style="color: #808080; font-style: italic;">// &quot;Tracks&quot; is a Bag array containing XMPStruct types.</span>
    <span style="color: #808080; font-style: italic;">// Let's take a look at how we can parse out the values in</span>
    <span style="color: #808080; font-style: italic;">// first XMPStruct. NOTE: All XMP arrays start at 1 rather than 0.</span>
    <span style="color: #000000; font-weight: bold;">var</span> track1:XMPStruct = xmp.<span style="color: #006600;">xmpDM</span>::Tracks<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span>;
    <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span> track1.<span style="color: #006600;">xmpDM</span>::trackName <span style="color: #66cc66;">&#41;</span>;
    <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span> track1.<span style="color: #006600;">xmpDM</span>::frameRate <span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// the second struct contains the array of speech-to-text</span>
    <span style="color: #808080; font-style: italic;">// markers that we're interested in.</span>
    <span style="color: #000000; font-weight: bold;">var</span> track2:XMPStruct = xmp.<span style="color: #006600;">xmpDM</span>::Tracks<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#93;</span>;
    <span style="color: #000000; font-weight: bold;">var</span> markers:XMPArray = track2.<span style="color: #006600;">xmpDM</span>::markers;
    <span style="color: #000000; font-weight: bold;">var</span> item:XMPStruct;
&nbsp;
    <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">1</span>; i <span style="color: #66cc66;">&lt;</span> markers.<span style="color: #0066CC;">length</span> + <span style="color: #cc66cc;">1</span>; i++ <span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#123;</span>
        item = markers<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>; <span style="color: #808080; font-style: italic;">//  a reference to the current marker of type XMPStruct</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">// now we can simply look at all of the property values for each </span>
        <span style="color: #808080; font-style: italic;">// item in the array</span>
        <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;startTime: &quot;</span> + item.<span style="color: #006600;">xmpDM</span>::startTime <span style="color: #66cc66;">&#41;</span>;
        <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;duration: &quot;</span> + item.<span style="color: #006600;">xmpDM</span>::<span style="color: #0066CC;">duration</span> <span style="color: #66cc66;">&#41;</span>;
        <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;name: &quot;</span> + item.<span style="color: #006600;">xmpDM</span>::<span style="color: #0066CC;">name</span> <span style="color: #66cc66;">&#41;</span>;
        <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;speaker: &quot;</span> + item.<span style="color: #006600;">xmpDM</span>::speaker <span style="color: #66cc66;">&#41;</span>;
        <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;probability: &quot;</span> + item.<span style="color: #006600;">xmpDM</span>::probability + <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

</pre>
<p></code></p>
<p>Ok, so that wasn&#8217;t too bad was it? Armed with some basic RDF knowledge, the Adobe AS3 XMP lib actually makes it pretty easy to parse out any XMP metadata you&#8217;re likely to run into. But we can do better than that, right? Let&#8217;s use the XMP lib and our reverse engineered knowledge of the Adobe XMP Dynamic Media schema to create some XMP marker data from scratch.</p>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> createXMPMarkers<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #808080; font-style: italic;">// create an xmp object and create a namespace for the Adobe DynamicMedia schema</span>
    <span style="color: #000000; font-weight: bold;">var</span> xmp:XMPMeta = <span style="color: #000000; font-weight: bold;">new</span> XMPMeta<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">var</span> xmpDM:Namespace = XMPConst.<span style="color: #006600;">xmpDM</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// create some markers and set some properties</span>
    <span style="color: #000000; font-weight: bold;">var</span> item1:XMPStruct = <span style="color: #000000; font-weight: bold;">new</span> XMPStruct<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    item1.<span style="color: #006600;">xmpDM</span>::<span style="color: #0066CC;">name</span> = <span style="color: #ff0000;">&quot;XMP Standard Schemas&quot;</span>;
    item1.<span style="color: #006600;">xmpDM</span>::startTime = <span style="color: #cc66cc;">0</span>;
    item1.<span style="color: #006600;">xmpDM</span>::<span style="color: #0066CC;">duration</span> = <span style="color: #cc66cc;">15000</span>;
    item1.<span style="color: #006600;">xmpDM</span>::<span style="color: #0066CC;">type</span> = <span style="color: #ff0000;">&quot;Chapter&quot;</span>;
&nbsp;
    <span style="color: #000000; font-weight: bold;">var</span> item2:XMPStruct = <span style="color: #000000; font-weight: bold;">new</span> XMPStruct<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    item2.<span style="color: #006600;">xmpDM</span>::<span style="color: #0066CC;">name</span> = <span style="color: #ff0000;">&quot;Dublin Core schema&quot;</span>;
    item2.<span style="color: #006600;">xmpDM</span>::startTime = <span style="color: #cc66cc;">0</span>;
    item2.<span style="color: #006600;">xmpDM</span>::<span style="color: #0066CC;">duration</span> = <span style="color: #cc66cc;">9999</span>;
    item2.<span style="color: #006600;">xmpDM</span>::<span style="color: #0066CC;">type</span> = <span style="color: #ff0000;">&quot;Index&quot;</span>;
&nbsp;
    <span style="color: #000000; font-weight: bold;">var</span> item3:XMPStruct = <span style="color: #000000; font-weight: bold;">new</span> XMPStruct<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    item3.<span style="color: #006600;">xmpDM</span>::<span style="color: #0066CC;">name</span> = <span style="color: #ff0000;">&quot;XMP Dynamic Media schema&quot;</span>;
    item3.<span style="color: #006600;">xmpDM</span>::startTime = <span style="color: #cc66cc;">10000</span>;
    item3.<span style="color: #006600;">xmpDM</span>::<span style="color: #0066CC;">duration</span> = <span style="color: #cc66cc;">5000</span>;
    item3.<span style="color: #006600;">xmpDM</span>::<span style="color: #0066CC;">type</span> = <span style="color: #ff0000;">&quot;Index&quot;</span>;
&nbsp;
    <span style="color: #000000; font-weight: bold;">var</span> item4:XMPStruct = <span style="color: #000000; font-weight: bold;">new</span> XMPStruct<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    item4.<span style="color: #006600;">xmpDM</span>::<span style="color: #0066CC;">name</span> = <span style="color: #ff0000;">&quot;Specialized Schema&quot;</span>;
    item4.<span style="color: #006600;">xmpDM</span>::startTime = <span style="color: #cc66cc;">15001</span>;
    item4.<span style="color: #006600;">xmpDM</span>::<span style="color: #0066CC;">duration</span> = <span style="color: #cc66cc;">50000</span>;
    item4.<span style="color: #006600;">xmpDM</span>::<span style="color: #0066CC;">type</span> = <span style="color: #ff0000;">&quot;Chapter&quot;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// create an sequenced array to hold all of the markers</span>
    <span style="color: #000000; font-weight: bold;">var</span> markers:XMPArray = XMPArray.<span style="color: #006600;">newSeq</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    markers.<span style="color: #006600;">append</span><span style="color: #66cc66;">&#40;</span> item1 <span style="color: #66cc66;">&#41;</span>;
    markers.<span style="color: #006600;">append</span><span style="color: #66cc66;">&#40;</span> item2 <span style="color: #66cc66;">&#41;</span>;
    markers.<span style="color: #006600;">append</span><span style="color: #66cc66;">&#40;</span> item3 <span style="color: #66cc66;">&#41;</span>;
    markers.<span style="color: #006600;">append</span><span style="color: #66cc66;">&#40;</span> item4 <span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">//Create Tracks Struct</span>
    <span style="color: #000000; font-weight: bold;">var</span> tracks:XMPStruct = <span style="color: #000000; font-weight: bold;">new</span> XMPStruct<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    tracks.<span style="color: #006600;">xmpDM</span>::trackName = <span style="color: #ff0000;">&quot;TOC Markers&quot;</span>;
    tracks.<span style="color: #006600;">xmpDM</span>::markers = markers;
&nbsp;
    <span style="color: #808080; font-style: italic;">// Add the &quot;Tracks&quot; property to the xmp object and set its value equal to the track variable.</span>
    xmp.<span style="color: #006600;">xmpDM</span>::Tracks<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span> = tracks;
&nbsp;
    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">xml</span>:<span style="color: #0066CC;">XML</span> = xmp.<span style="color: #006600;">serializeToXML</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">xml</span>.<span style="color: #006600;">toXMLString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p></code></p>
<p>That&#8217;s it for now kids &#8211; y&#8217;all should be XMP parsing and generating machines by now. Look for an upcoming tutorial on creating and using custom XMP schemas / namespaces to store application specific metadata in your media files.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brooksandrus.com/blog/2009/04/13/getting-down-and-dirty-with-xmp-and-as3/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Bilinear Resampling, ShaderJob, Pixel Bender And Flash Player</title>
		<link>http://www.brooksandrus.com/blog/2009/03/11/bilinear-resampling-with-flash-player-and-pixel-bender/</link>
		<comments>http://www.brooksandrus.com/blog/2009/03/11/bilinear-resampling-with-flash-player-and-pixel-bender/#comments</comments>
		<pubDate>Thu, 12 Mar 2009 04:09:44 +0000</pubDate>
		<dc:creator>brooks</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[bilinear]]></category>
		<category><![CDATA[thumbgenie]]></category>
		<category><![CDATA[thumbnails]]></category>

		<guid isPermaLink="false">http://www.brooksandrus.com/blog/?p=927</guid>
		<description><![CDATA[*Update* Sometimes you&#8217;re an idiot and you spend a lot of time reinventing the wheel because you misread one little line of documentation. This is one of those times where I get to be that idiot. I invented a solution for bilinear resampling in Flash Player when I didn&#8217;t need to. You can actually get [...]]]></description>
			<content:encoded><![CDATA[<p><strong>*Update*</strong></p>
<p>Sometimes you&#8217;re an idiot and you spend a lot of time reinventing the wheel because you misread one little line of documentation. This is one of those times where I get to be that idiot. I invented a solution for bilinear resampling in Flash Player when I didn&#8217;t need to. You can actually get the same results pretty simply using just BitmapData.draw() method with smoothing on (I had read this didn&#8217;t work when down sizing), but it requires creating a temp BitmapData object if the source you&#8217;re feeding the BitmapData.draw() method is not another BitmapData object (i.e. a DisplayObject). Here&#8217;s what that scenario would look like.<br />
<code></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">            <span style="color: #808080; font-style: italic;">// source in this example is a DisplayObject</span>
            <span style="color: #000000; font-weight: bold;">var</span> temp:BitmapData = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span> sourceWidth, sourceHeight <span style="color: #66cc66;">&#41;</span>;
            temp.<span style="color: #006600;">draw</span><span style="color: #66cc66;">&#40;</span> source <span style="color: #66cc66;">&#41;</span>;
&nbsp;
            <span style="color: #000000; font-weight: bold;">var</span> output:BitmapData = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span> outputWidth, outputHeight <span style="color: #66cc66;">&#41;</span>;
&nbsp;
            <span style="color: #000000; font-weight: bold;">var</span> matrix:Matrix = <span style="color: #000000; font-weight: bold;">new</span> Matrix<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
            matrix.<span style="color: #006600;">scale</span><span style="color: #66cc66;">&#40;</span> outputWidth <span style="color: #66cc66;">/</span> sourceWidth, outputHeight <span style="color: #66cc66;">/</span> sourceHeight <span style="color: #66cc66;">&#41;</span>;
&nbsp;
            output.<span style="color: #006600;">draw</span><span style="color: #66cc66;">&#40;</span> temp, matrix, <span style="color: #000000; font-weight: bold;">null</span>, <span style="color: #000000; font-weight: bold;">null</span>, <span style="color: #000000; font-weight: bold;">null</span>, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;
            temp.<span style="color: #006600;">dispose</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p></code><br />
<span id="more-927"></span><br />
Many thanks to Felix for leaving a comment that made me question myself and go back to the problem with fresh eyes.</p>
<p>Now I can take some consolation in the fact that I actually learned a lot by going down this path. I dug in to Pixel Bender again and learned how to use ShaderJob. To that end, portions of this &#8220;tutorial&#8221; illustrate how to use a PixelBender shader and a ShaderJob together. ShaderJob, when run with the async flag (false), is as close as you can come to creating new threads in Flash&#8211;that&#8217;s some pretty neat Flash hackery.</p>
<p>So, if you find yourself reading this, you&#8217;re advised to skip down to the code included below and take a look at the embedded filter, Shader / ShaderJob portion. </p>
<p><strong>*End of Update*</strong></p>
<p>If you&#8217;re looking to generate high quality scaled bitmaps in Flash Player / AIR, you&#8217;ll need to do some form of bilinear or bicubic resampling. Why you ask? Because, Flash Player resampling is, by default, nearest neighbor and that looks, well, like ass (see evidence directly below).</p>
<p><img src="http://www.brooksandrus.com/images/nearest_neighbor_controls.jpg" alt="nearest neighbor resample" /><br />
 If you dig around long enough on the net you&#8217;ll find some AS3 libraries (Java ports) like <a href="http://www.clevr.com/blog/2008/resize-actionscript-bicubic-bilinear-interpolation/">clevrlib</a> which will do bilinear or bicubic resampling using BitmapData methods like getPixel / setPixel. As seen below, clevrlib definitely decreases jaggies and improves the legibility of text, but its extremely slow&#8211;scaling a 960&#215;540 BitmapData object to 640&#215;360 takes around 1.5 &#8211; 2 seconds for  bilinear resampling and around 3 &#8211; 5 seconds for bicubic resampling (mileage will vary based on the type of imagery and size of the picture). Also, the results, in some cases, exhibit noticeable resampling artifacts (check out the fullscreen icon in the right corner of the examples immediately below).</p>
<p><img src="http://www.brooksandrus.com/jing2/cleverlib_resampling.png" alt="cleverlib resampling" /></p>
<p>I was looking to implement bilinear resampling in <a href="http://www.brooksandrus.com/blog/thumbgenie-an-air-thumbnail-generator/">ThumbGenie</a>, but, as the old saying goes&#8211;speed kills. I just couldn&#8217;t tolerate 2 or 3 seconds to resample an image&#8211;there had to to be a better way. After a bit of thought I fell on the answer&#8211;<a href="http://labs.adobe.com/technologies/pixelbender/">PixelBender</a>. </p>
<p>Flash Player 10 PixelBender bytecode is designed to manipulate individual pixels in a bitmap super fast. In fact, it executes fast enough to apply real time filter effects to video. This seemed promising and sure enough after reading through the sdk docs and playing around for awhile (read I spent a Saturday evening trying to wrap my little melon around the issue), I was able to find a built-in PixelBender method that does bilinear sampling. Slap a parameter on that biatch (aka kernel) controlling the desired scale of the output  and little ol&#8217; me was rendering silky-smooth, scaled bitmaps out of Flash Player in mere milliseconds (8-13 milliseconds scaling a 960&#215;540 bitmap to 640&#215;360&#8211;take that suckaz).</p>
<p><img src="http://www.brooksandrus.com/images/bilinear_controls.jpg" alt="Pixel Bender bilinear resampling" /></p>
<p>Interested in chasing the same dream? Here&#8217;s, the rough outline you&#8217;ll need to follow:</p>
<ol>
<li>Create Pixel Bender kernel that does bilinear resampling.</li>
<li>Compile Pixel Bender bytecode for Flash Player 10 (.pbj file).</li>
<li>Embed PBJ bytecode in AS3 class.</li>
<li>Generate <a href="http://livedocs.adobe.com/flex/3/langref/flash/display/BitmapData.html">BitmapData</a> from a <a href="http://livedocs.adobe.com/flex/3/langref/flash/display/DisplayObject.html">DisplayObjec</a>t (BitmapData.draw( obj )).</li>
<li>Create an AS3 <a href="http://livedocs.adobe.com/flex/3/langref/flash/display/Shader.html">Shader</a> object, instantiate embedded Pixel Bender bytecode, configure Shader.</li>
<li>Create an output BitmapData object (this will hold the scaled bitmap we create.</li>
<li>Create a <a href="http://livedocs.adobe.com/flex/3/langref/flash/display/ShaderJob.html">ShaderJob</a> &#8211; this is a process that will run the Shader and return its output to an object (as opposed to being applied to a DisplayObject wrapped in a <a href="http://livedocs.adobe.com/flex/3/langref/flash/filters/ShaderFilter.html">ShaderFilter</a>).</li>
<li>Run the ShaderJob by calling the ShaderJob.start( true ) method.</li>
<li>Do something with the BitmapData thumbnail (display, push to server, or encode and save to disk)</li>
</ol>
<p>Ouch, that&#8217;s pretty painful. And believe me, I did some serious bleeding before figuring this one out&#8211;I really had to push the two or three sleep deprived brain cells I have left in order to get the job done. And well, this is just a long-winded way of saying that I&#8217;ll be providing y&#8217;all the Pixel Bender kernel (.pbk) and bytcode (.pbj) plus the AS3 implementation that I developed for <a href="http://www.brooksandrus.com/blog/thumbgenie-an-air-thumbnail-generator/">ThumbGenie</a> (just my way of saying thanks for all of the code you Flash / Flex cats so liberally share all of time).</p>
<p>Whew, you made it this far, now its time for the good stuff. Download the PixelBender source / bytecode <a href="http://www.brooksandrus.com/resources/bilinearresample.zip">here</a> and feel free to peruse / use the implementation seen below.</p>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/**
 * Copyright 2009 (c) , Brooks Andrus
 * 
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 * 
 */</span>
package com.<span style="color: #006600;">brooksandrus</span>.<span style="color: #006600;">utils</span>
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">BitmapData</span>;
    <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">DisplayObject</span>;
    <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Shader</span>;
    <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">ShaderJob</span>;
&nbsp;
    <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> BilinearResample
    <span style="color: #66cc66;">&#123;</span>
        <span style="color: #66cc66;">&#91;</span>Embed <span style="color: #66cc66;">&#40;</span> source=<span style="color: #ff0000;">&quot;../../../../assets/bilinearresample.pbj&quot;</span>, mimeType=<span style="color: #ff0000;">&quot;application/octet-stream&quot;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#93;</span>
        <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> BilinearScaling:<span style="color: #000000; font-weight: bold;">Class</span>;
&nbsp;
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> BilinearResample<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#123;</span>
            <span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
&nbsp;
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> resampleBitmap<span style="color: #66cc66;">&#40;</span> input:BitmapData, desiredWidth:<span style="color: #0066CC;">int</span>, desiredHeight:<span style="color: #0066CC;">int</span>, cleanup:<span style="color: #0066CC;">Boolean</span> = <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>:BitmapData
        <span style="color: #66cc66;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">var</span> aspectRatio:<span style="color: #0066CC;">Number</span> = input.<span style="color: #0066CC;">width</span> <span style="color: #66cc66;">/</span> input.<span style="color: #0066CC;">height</span>;
&nbsp;
            <span style="color: #000000; font-weight: bold;">var</span> factor:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">max</span><span style="color: #66cc66;">&#40;</span> input.<span style="color: #0066CC;">width</span> <span style="color: #66cc66;">/</span> desiredWidth, input.<span style="color: #0066CC;">height</span> <span style="color: #66cc66;">/</span> desiredHeight <span style="color: #66cc66;">&#41;</span>;
&nbsp;
            <span style="color: #808080; font-style: italic;">// create and configure a Shader object</span>
            <span style="color: #000000; font-weight: bold;">var</span> shader:Shader = <span style="color: #000000; font-weight: bold;">new</span> Shader<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
            shader.<span style="color: #006600;">byteCode</span> = <span style="color: #000000; font-weight: bold;">new</span> BilinearScaling<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// instantiate embedded Pixel Bender bytecode</span>
            shader.<span style="color: #0066CC;">data</span>.<span style="color: #006600;">src</span>.<span style="color: #006600;">input</span> = input; <span style="color: #808080; font-style: italic;">// supply the shader with BitmapData it will manipulate</span>
            shader.<span style="color: #0066CC;">data</span>.<span style="color: #006600;">scale</span>.<span style="color: #006600;">value</span> = <span style="color: #66cc66;">&#91;</span>factor<span style="color: #66cc66;">&#93;</span>; <span style="color: #808080; font-style: italic;">// scale factor. shader params are all stored in arrays.</span>
&nbsp;
            <span style="color: #000000; font-weight: bold;">var</span> outputWidth:<span style="color: #0066CC;">int</span>;
            <span style="color: #000000; font-weight: bold;">var</span> outputHeight:<span style="color: #0066CC;">int</span>;
&nbsp;
            <span style="color: #808080; font-style: italic;">// determine output bitmap dimensions</span>
            <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> input.<span style="color: #0066CC;">width</span> <span style="color: #66cc66;">&gt;</span> input.<span style="color: #0066CC;">height</span> <span style="color: #66cc66;">&#41;</span>
            <span style="color: #66cc66;">&#123;</span>
                outputWidth = desiredWidth;
                outputHeight = desiredWidth <span style="color: #66cc66;">/</span> aspectRatio;
            <span style="color: #66cc66;">&#125;</span>
            <span style="color: #b1b100;">else</span>
            <span style="color: #66cc66;">&#123;</span>
                outputWidth = desiredHeight <span style="color: #66cc66;">*</span> aspectRatio;
                outputHeight = desiredHeight;
            <span style="color: #66cc66;">&#125;</span>
&nbsp;
            <span style="color: #808080; font-style: italic;">// create a bitmap - our shader will return its data (an image) to this bitmap</span>
            <span style="color: #000000; font-weight: bold;">var</span> output:BitmapData = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span> outputWidth, outputHeight <span style="color: #66cc66;">&#41;</span>;
&nbsp;
            <span style="color: #808080; font-style: italic;">// shader jobs are wicked cool</span>
            <span style="color: #000000; font-weight: bold;">var</span> job:ShaderJob = <span style="color: #000000; font-weight: bold;">new</span> ShaderJob<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
            job.<span style="color: #0066CC;">target</span> = output; <span style="color: #808080; font-style: italic;">// ShaderJob returns to this object</span>
            job.<span style="color: #006600;">shader</span> = shader; <span style="color: #808080; font-style: italic;">// The Shader assigned to this job</span>
            job.<span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// true flag runs the job synchronously.</span>
&nbsp;
            <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> cleanup <span style="color: #66cc66;">&#41;</span>
            <span style="color: #66cc66;">&#123;</span>
                input.<span style="color: #006600;">dispose</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
            <span style="color: #66cc66;">&#125;</span>
&nbsp;
            <span style="color: #b1b100;">return</span> output;
        <span style="color: #66cc66;">&#125;</span>
&nbsp;
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> resampleDisplayObject<span style="color: #66cc66;">&#40;</span> source:DisplayObject, desiredWidth:<span style="color: #0066CC;">int</span>, desiredHeight:<span style="color: #0066CC;">int</span> <span style="color: #66cc66;">&#41;</span>:BitmapData
        <span style="color: #66cc66;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">var</span> aspectRatio:<span style="color: #0066CC;">Number</span> = source.<span style="color: #0066CC;">width</span> <span style="color: #66cc66;">/</span> source.<span style="color: #0066CC;">height</span>;
&nbsp;
            <span style="color: #000000; font-weight: bold;">var</span> factor:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">max</span><span style="color: #66cc66;">&#40;</span> source.<span style="color: #0066CC;">width</span> <span style="color: #66cc66;">/</span> desiredWidth, source.<span style="color: #0066CC;">height</span> <span style="color: #66cc66;">/</span> desiredHeight <span style="color: #66cc66;">&#41;</span>;
&nbsp;
            <span style="color: #000000; font-weight: bold;">var</span> input:BitmapData = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span> source.<span style="color: #0066CC;">width</span>, source.<span style="color: #0066CC;">height</span>, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;
            input.<span style="color: #006600;">draw</span><span style="color: #66cc66;">&#40;</span> source <span style="color: #66cc66;">&#41;</span>;
&nbsp;
            <span style="color: #808080; font-style: italic;">// configure the shader</span>
            <span style="color: #000000; font-weight: bold;">var</span> shader:Shader = <span style="color: #000000; font-weight: bold;">new</span> Shader<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
            shader.<span style="color: #006600;">byteCode</span> = <span style="color: #000000; font-weight: bold;">new</span> BilinearScaling<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
            shader.<span style="color: #0066CC;">data</span>.<span style="color: #006600;">src</span>.<span style="color: #006600;">input</span> = input;
            shader.<span style="color: #0066CC;">data</span>.<span style="color: #006600;">scale</span>.<span style="color: #006600;">value</span> = <span style="color: #66cc66;">&#91;</span>factor<span style="color: #66cc66;">&#93;</span>; <span style="color: #808080; font-style: italic;">// scale factor. shader params are all stored in arrays.</span>
&nbsp;
            <span style="color: #000000; font-weight: bold;">var</span> outputWidth:<span style="color: #0066CC;">int</span>;
            <span style="color: #000000; font-weight: bold;">var</span> outputHeight:<span style="color: #0066CC;">int</span>;
&nbsp;
            <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> input.<span style="color: #0066CC;">width</span> <span style="color: #66cc66;">&gt;</span> input.<span style="color: #0066CC;">height</span> <span style="color: #66cc66;">&#41;</span>
            <span style="color: #66cc66;">&#123;</span>
                outputWidth = desiredWidth;
                outputHeight = desiredWidth <span style="color: #66cc66;">/</span> aspectRatio;
            <span style="color: #66cc66;">&#125;</span>
            <span style="color: #b1b100;">else</span>
            <span style="color: #66cc66;">&#123;</span>
                outputWidth = desiredHeight <span style="color: #66cc66;">*</span> aspectRatio;
                outputHeight = desiredHeight;
            <span style="color: #66cc66;">&#125;</span>
&nbsp;
            <span style="color: #000000; font-weight: bold;">var</span> output:BitmapData = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span> outputWidth, outputHeight <span style="color: #66cc66;">&#41;</span>;
&nbsp;
            <span style="color: #000000; font-weight: bold;">var</span> job:ShaderJob = <span style="color: #000000; font-weight: bold;">new</span> ShaderJob<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
            job.<span style="color: #0066CC;">target</span> = output;
            job.<span style="color: #006600;">shader</span> = shader;
            job.<span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// true flag runs the job synchronously.</span>
&nbsp;
            input.<span style="color: #006600;">dispose</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
            <span style="color: #b1b100;">return</span> output;
        <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.brooksandrus.com/blog/2009/03/11/bilinear-resampling-with-flash-player-and-pixel-bender/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>ThumbGenie 1.1.0 Now Generates Embed Code</title>
		<link>http://www.brooksandrus.com/blog/2009/02/23/thumbgenie-110-now-generates-embed-code/</link>
		<comments>http://www.brooksandrus.com/blog/2009/02/23/thumbgenie-110-now-generates-embed-code/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 14:11:46 +0000</pubDate>
		<dc:creator>brooks</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[h.264]]></category>
		<category><![CDATA[Jing]]></category>
		<category><![CDATA[jing pro]]></category>
		<category><![CDATA[mpeg4-avc]]></category>
		<category><![CDATA[thumbgenie]]></category>
		<category><![CDATA[thumbnails]]></category>

		<guid isPermaLink="false">http://www.brooksandrus.com/blog/?p=886</guid>
		<description><![CDATA[I updated ThumbGenie over the weekend to support generation of embed code. Now, every time you create a thumbnail from an MPEG4-AVC file or SWF embed code will be generated. ThumbGenie ships with a default &#8220;object / embed&#8221; code template, but you can easily modify or replace the template with your own code. I created [...]]]></description>
			<content:encoded><![CDATA[<p>I updated <a href="http://www.brooksandrus.com/blog/thumbgenie-an-air-thumbnail-generator/">ThumbGenie</a> over the weekend to support generation of embed code. Now, every time you create a thumbnail from an MPEG4-AVC file or SWF embed code will be generated. ThumbGenie ships with a default &#8220;object / embed&#8221; code template, but you can easily modify or replace the template with your own code.<span id="more-886"></span></p>
<p>I created a short video that explains how embed code generation works and what you need to modify or replace the sample template code.<br />
Go fullscreen <img class="jing-fullscreen-icon" src="http://www.brooksandrus.com/media/jing_fullscreen_icon.png" alt="fullscreen icon" /> to see the video in full 1:1 pixel clarity.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_player_1176799611"
			class="flashmovie"
			width="640"
			height="360">
	<param name="movie" value="http://www.brooksandrus.com/media/player.swf" />
	<param name="flashvars" value="content=http://www.brooksandrus.com/media/thumbgenie_embed_code.mp4&amp;thumb=http://www.brooksandrus.com/media/thumbgenie_embed_code.jpg&amp;windowbox=true&amp;analytics=UA-6435642-1&amp;showbranding=true&amp;containerwidth=640&amp;containerheight=360" />
	<param name="allowfullscreen" value="true" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.brooksandrus.com/media/player.swf"
			name="fm_player_1176799611"
			width="640"
			height="360">
		<param name="flashvars" value="content=http://www.brooksandrus.com/media/thumbgenie_embed_code.mp4&amp;thumb=http://www.brooksandrus.com/media/thumbgenie_embed_code.jpg&amp;windowbox=true&amp;analytics=UA-6435642-1&amp;showbranding=true&amp;containerwidth=640&amp;containerheight=360" />
		<param name="allowfullscreen" value="true" />
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
<p><a href="http://www.brooksandrus.com/media/thumbgenie_embed_code.mp4">Download</a> video.</p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object><br />
</p>
<p>If you&#8217;re using <a href="http://www.brooksandrus.com/blog/2009/01/19/jing-pro-ftp-a-complete-solution/">Jing Pro + FTP</a> the ability to generate thumbnails and embed code should significantly enhance your blogging workflow. Here&#8217;s a short example of how I use ThumbGenie in my workflow.<br />
Go fullscreen <img class="jing-fullscreen-icon" src="http://www.brooksandrus.com/media/jing_fullscreen_icon.png" alt="fullscreen icon" /> to see the video in full 1:1 pixel clarity.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_player_1860978800"
			class="flashmovie"
			width="640"
			height="360">
	<param name="movie" value="http://www.brooksandrus.com/media/player.swf" />
	<param name="flashvars" value="content=http://www.brooksandrus.com/media/thumbgenie_blog_workflow.mov&amp;thumb=http://www.brooksandrus.com/media/thumbgenie_blog_workflow.jpg&amp;windowbox=true&amp;analytics=UA-6435642-1&amp;showbranding=true&amp;containerwidth=640&amp;containerheight=360" />
	<param name="allowfullscreen" value="true" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.brooksandrus.com/media/player.swf"
			name="fm_player_1860978800"
			width="640"
			height="360">
		<param name="flashvars" value="content=http://www.brooksandrus.com/media/thumbgenie_blog_workflow.mov&amp;thumb=http://www.brooksandrus.com/media/thumbgenie_blog_workflow.jpg&amp;windowbox=true&amp;analytics=UA-6435642-1&amp;showbranding=true&amp;containerwidth=640&amp;containerheight=360" />
		<param name="allowfullscreen" value="true" />
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
<p><a href="http://www.brooksandrus.com/media/thumbgenie_blog_workflow.mov">Download</a> video.</p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>If you&#8217;re interested in generating thumbnails from MPEG4-AVC files or SWF files created by Jing hit the install badge below. After installing, head over to <a href="http://www.brooksandrus.com/blog/thumbgenie-an-air-thumbnail-generator/">ThumbGenie central</a> to view some helpful videos.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_AIRInstallBadge_216389461"
			class="flashmovie"
			width="215"
			height="180">
	<param name="movie" value="http://www.brooksandrus.com/thumbgenie/AIRInstallBadge.swf" />
	<param name="flashvars" value="airversion=1.5&amp;appname=ThumbGenie&amp;image=http://www.brooksandrus.com/thumbgenie/thumbgenie_badge.png&amp;appurl=http://www.brooksandrus.com/thumbgenie/thumbgenie_1.3.0.air&amp;appid=com.brooksandrus.air.thumbgenie&amp;pubid=A3C411C2D522700600AC8D2902787FED2272C2C5.1&amp;appversion=1.3.0" />
	<param name="bgcolor" value="#333333" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.brooksandrus.com/thumbgenie/AIRInstallBadge.swf"
			name="fm_AIRInstallBadge_216389461"
			width="215"
			height="180">
		<param name="flashvars" value="airversion=1.5&amp;appname=ThumbGenie&amp;image=http://www.brooksandrus.com/thumbgenie/thumbgenie_badge.png&amp;appurl=http://www.brooksandrus.com/thumbgenie/thumbgenie_1.3.0.air&amp;appid=com.brooksandrus.air.thumbgenie&amp;pubid=A3C411C2D522700600AC8D2902787FED2272C2C5.1&amp;appversion=1.3.0" />
		<param name="bgcolor" value="#333333" />
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
]]></content:encoded>
			<wfw:commentRss>http://www.brooksandrus.com/blog/2009/02/23/thumbgenie-110-now-generates-embed-code/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
<enclosure url="http://www.brooksandrus.com/media/thumbgenie_blog_workflow.mov" length="22054636" type="video/quicktime" />
<enclosure url="http://www.brooksandrus.com/media/thumbgenie_embed_code.mp4" length="20781654" type="video/mp4" />
		</item>
		<item>
		<title>ThumbGenie: An AIR Thumbnail Generator for MPEG4-AVC / SWF Files</title>
		<link>http://www.brooksandrus.com/blog/2009/02/18/thumbgenie-an-air-thumbnail-generator-for-mpeg4-avc-swf-files/</link>
		<comments>http://www.brooksandrus.com/blog/2009/02/18/thumbgenie-an-air-thumbnail-generator-for-mpeg4-avc-swf-files/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 07:25:21 +0000</pubDate>
		<dc:creator>brooks</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Jing]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[thumbnails]]></category>

		<guid isPermaLink="false">http://www.brooksandrus.com/blog/?p=841</guid>
		<description><![CDATA[One of the not so nice aspects of hosting your own Jing / Jing Pro videos is generating thumbnails that can be used for the &#8220;click-to-play&#8221; screen that viewers initiate video playback with. My current thumbnail workflow works something like this: Capture video. Save video to local disk (desktop). Open video with QuickTime Pro ($30). [...]]]></description>
			<content:encoded><![CDATA[<p>One of the not so nice aspects of hosting your own Jing / Jing Pro videos is generating thumbnails that can be used for the &#8220;click-to-play&#8221; screen that viewers initiate video playback with. My current thumbnail workflow works something like this:</p>
<ol>
<li>Capture video.</li>
<li>Save video to local disk (desktop).</li>
<li>Open video with QuickTime Pro ($30).</li>
<li>Select a video frame and Choose QuickTime&#8217;s &#8220;Export Movie as Bitmap&#8221; option.</li>
<li>Open .bmp file generated by QuickTime Pro in Fireworks (beaucoup $$$).</li>
<li>Resize image in Fireworks to fit my embed dimensions (embed dimensions are different than video dimensions).</li>
<li>Export out JPEG file (.jpg) with some compression applied (trade quality for size).</li>
</ol>
<p>Jing&#8217;s supposed to be all about the easy, but the workflow above is decidedly not. It shouldn&#8217;t be that hard to generate thumbnail images from your JIng videos and it shouldn&#8217;t be ultra expensive. Enter <a href="http://www.brooksandrus.com/blog/thumbgenie-an-air-thumbnail-generator/">ThumbGenie</a>, an AIR application, written by moi, that allows you to load MPEG4-AVC or SWF files, select a video frame and generate a thumbnail image as either a JPEG or PNG file. Wait, it gets better. You can apply JPEG compression and scale the exported image down. Best of all its completely <a href="http://en.wikipedia.org/wiki/Gratis_versus_Libre">free, as in beer</a>. So what are you waiting for, <a href="http://www.brooksandrus.com/blog/thumbgenie-an-air-thumbnail-generator/">download</a> ThumbGenie and start generating thumbnails pronto!</p>
<p>If you head over to <a href="http://www.brooksandrus.com/blog/thumbgenie-an-air-thumbnail-generator/">ThumbGenie central</a> you&#8217;ll find some helpful &#8220;getting started&#8221; videos as well as the installer badge.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_AIRInstallBadge_1929813190"
			class="flashmovie"
			width="215"
			height="180">
	<param name="movie" value="http://www.brooksandrus.com/thumbgenie/AIRInstallBadge.swf" />
	<param name="flashvars" value="airversion=1.5&amp;appname=ThumbGenie&amp;image=http://www.brooksandrus.com/thumbgenie/thumbgenie_badge.png&amp;appurl=http://www.brooksandrus.com/thumbgenie/thumbgenie_1.3.0.air&amp;appid=com.brooksandrus.air.thumbgenie&amp;pubid=A3C411C2D522700600AC8D2902787FED2272C2C5.1&amp;appversion=1.3.0" />
	<param name="bgcolor" value="#333333" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.brooksandrus.com/thumbgenie/AIRInstallBadge.swf"
			name="fm_AIRInstallBadge_1929813190"
			width="215"
			height="180">
		<param name="flashvars" value="airversion=1.5&amp;appname=ThumbGenie&amp;image=http://www.brooksandrus.com/thumbgenie/thumbgenie_badge.png&amp;appurl=http://www.brooksandrus.com/thumbgenie/thumbgenie_1.3.0.air&amp;appid=com.brooksandrus.air.thumbgenie&amp;pubid=A3C411C2D522700600AC8D2902787FED2272C2C5.1&amp;appversion=1.3.0" />
		<param name="bgcolor" value="#333333" />
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
]]></content:encoded>
			<wfw:commentRss>http://www.brooksandrus.com/blog/2009/02/18/thumbgenie-an-air-thumbnail-generator-for-mpeg4-avc-swf-files/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Flex Basics &#8211; The Script Tag</title>
		<link>http://www.brooksandrus.com/blog/2009/01/29/video-flex-basics-the-script-tag/</link>
		<comments>http://www.brooksandrus.com/blog/2009/01/29/video-flex-basics-the-script-tag/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 19:41:20 +0000</pubDate>
		<dc:creator>brooks</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[mx:script]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://www.brooksandrus.com/blog/?p=723</guid>
		<description><![CDATA[Grasping the simple things is often the hardest part to getting up and running with Flex. For example, a friend of mine who I&#8217;ve been trying to pull over from the dark side (.Net guy) asked, &#8220;I&#8217;ve got an MXML Application with a button in it that I&#8217;d like to bind to a method&#8211;where&#8217;s the [...]]]></description>
			<content:encoded><![CDATA[<p>Grasping the simple things is often the hardest part to getting up and running with Flex. For example, a friend of mine who I&#8217;ve been trying to pull over from the dark side (.Net guy) asked, &#8220;I&#8217;ve got an MXML Application with a button in it that I&#8217;d like to bind to a method&#8211;where&#8217;s the code behind.&#8221; </p>
<p>The simple answer of course is to point him to the &#8220;script&#8221; tag (let&#8217;s just forget code behind support was ever added to Flex). Rather than typing up a long winded response I made a quick and dirty <a href="http://www.jingproject.com/">Jing</a> video to &#8220;show him around&#8221; Flex&#8217;s script tag (no deep explanation, I&#8217;m just teaching by &#8220;doing&#8221;).<br />
<span id="more-723"></span>Go fullscreen <img class="jing-fullscreen-icon" src="http://www.brooksandrus.com/media/jing_fullscreen_icon.png" alt="fullscreen icon" /> to see the video in full 1:1 pixel clarity.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_player_113119208"
			class="flashmovie"
			width="640"
			height="360">
	<param name="movie" value="http://www.brooksandrus.com/media/player.swf" />
	<param name="flashvars" value="content=http://www.brooksandrus.com/media/flex_script_tag_basics.mp4&amp;thumb=http://www.brooksandrus.com/media/flex_script_tag_basics.jpg&amp;windowbox=true&amp;analytics=UA-6435642-1&amp;showbranding=true&amp;containerwidth=640&amp;containerheight=360" />
	<param name="allowfullscreen" value="true" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.brooksandrus.com/media/player.swf"
			name="fm_player_113119208"
			width="640"
			height="360">
		<param name="flashvars" value="content=http://www.brooksandrus.com/media/flex_script_tag_basics.mp4&amp;thumb=http://www.brooksandrus.com/media/flex_script_tag_basics.jpg&amp;windowbox=true&amp;analytics=UA-6435642-1&amp;showbranding=true&amp;containerwidth=640&amp;containerheight=360" />
		<param name="allowfullscreen" value="true" />
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
<p><a href="http://www.brooksandrus.com/media/flex_script_tag_basics.mp4">Download</a> video.</p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
]]></content:encoded>
			<wfw:commentRss>http://www.brooksandrus.com/blog/2009/01/29/video-flex-basics-the-script-tag/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.brooksandrus.com/media/flex_script_tag_basics.mp4" length="13494493" type="video/mp4" />
		</item>
		<item>
		<title>Pixel Bender + Video = Killer Runtime Effects</title>
		<link>http://www.brooksandrus.com/blog/2009/01/19/pixel-bender-effects-video-killer-runtime-effects/</link>
		<comments>http://www.brooksandrus.com/blog/2009/01/19/pixel-bender-effects-video-killer-runtime-effects/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 19:16:49 +0000</pubDate>
		<dc:creator>brooks</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[effects]]></category>
		<category><![CDATA[pixel bender]]></category>

		<guid isPermaLink="false">http://www.brooksandrus.com/blog/?p=708</guid>
		<description><![CDATA[I&#8217;ve been playing with Pixel Bender a bit and noticed that there weren&#8217;t really any examples (I could find) that illustrated effects being applied to video. So I gathered together a whole slew of kernels from the interweb, downloaded a copy of Dancing Matt and shoehorned them into a media player that allows you to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing with <a href="http://labs.adobe.com/technologies/pixelbender/">Pixel Bender</a> a bit and noticed that there weren&#8217;t really any examples (I could find) that illustrated effects being applied to video. So I gathered together a whole slew of kernels from the interweb, <a href="http://www.stridegum.com/#/mattsplace/">downloaded</a> a copy of <a href="http://www.wherethehellismatt.com/?fbid=Lbe8Q_sX5bU">Dancing Matt</a> and shoehorned them into a media player that allows you to select and apply the effects during video playback. <span id="more-708"></span></p>
<p>Instructions: Press the &#8220;play&#8221; button, then select the effect you&#8217;d like to see applied to the video.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_yamp_test_455366801"
			class="flashmovie"
			width="640"
			height="360">
	<param name="movie" value="http://www.brooksandrus.com/media/yamp_test.swf" />
	<param name="flashvars" value="content=http://www.brooksandrus.com/media/dancing2008_720p.mp4&amp;thumb=http://www.brooksandrus.com/media/dancing2008_720p.jpg&amp;containerwidth=640&amp;containerheight=360" />
	<param name="allowfullscreen" value="true" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.brooksandrus.com/media/yamp_test.swf"
			name="fm_yamp_test_455366801"
			width="640"
			height="360">
		<param name="flashvars" value="content=http://www.brooksandrus.com/media/dancing2008_720p.mp4&amp;thumb=http://www.brooksandrus.com/media/dancing2008_720p.jpg&amp;containerwidth=640&amp;containerheight=360" />
		<param name="allowfullscreen" value="true" />
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>The ten thousand dollar question is what&#8217;s the value outside of gratuitous eye candy? It seems that in some cases you might want to apply a particular stylistic treatment (wouldn&#8217;t it be great if the cartoon effect that ships with After Effects would compile for Flash Player). There&#8217;s also the opportunity to animate the filters and create some really killer transition effects&#8211;anyone with a media player component or video editing / mashup RIA ought to see the potential there. And that&#8217;s just the tip of the iceberg, I&#8217;m sure there are far grander ideas being born as I write this.</p>
<p>FYI &#8211; All of the filters were gathered up out on the interweb (<a href="http://www.mikechambers.com/blog/2008/09/17/pixel-bender-tv-scanline-filter/">mesh</a>, <a href="http://www.adobe.com/cfusion/exchange/index.cfm?event=productHome&#038;exc=26&#038;loc=en_us">exchange</a>, <a href="http://pixelero.wordpress.com/">pixelero</a>).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brooksandrus.com/blog/2009/01/19/pixel-bender-effects-video-killer-runtime-effects/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
<enclosure url="http://www.brooksandrus.com/media/dancing2008_720p.mp4" length="55081525" type="video/mp4" />
		</item>
		<item>
		<title>F4V Does Not Support Cue Points</title>
		<link>http://www.brooksandrus.com/blog/2008/12/07/f4v-does-not-support-cue-points/</link>
		<comments>http://www.brooksandrus.com/blog/2008/12/07/f4v-does-not-support-cue-points/#comments</comments>
		<pubDate>Mon, 08 Dec 2008 04:58:18 +0000</pubDate>
		<dc:creator>brooks</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[cue points]]></category>
		<category><![CDATA[f4v]]></category>
		<category><![CDATA[h.264]]></category>
		<category><![CDATA[mpeg-4-avc]]></category>

		<guid isPermaLink="false">http://www.brooksandrus.com/blog/?p=634</guid>
		<description><![CDATA[Despite appearances&#8230; F4V files (otherwise known as MPEG4-AVC / h.264 + a special Flash only file extension) DO NOT SUPPORT CUE POINTS. Unfortunately, no good tooling support for timed text tracks replaces them.]]></description>
			<content:encoded><![CDATA[<p>Despite appearances&#8230;</p>
<p><img src="http://www.brooksandrus.com/jing2/misleading_cuepoint_interface.png" alt="misleading cue point ui" /></p>
<p>F4V files (otherwise known as MPEG4-AVC / h.264 + a special Flash only file extension) DO NOT SUPPORT CUE POINTS. Unfortunately, no good tooling support for timed text tracks replaces them.</p>
<p><a href="http://kb.adobe.com/selfservice/viewContent.do?externalId=kb405265&#038;sliceId=2"><img src="http://www.brooksandrus.com/jing2/f4v_cuepoints_kb.png" alt="F4V Cue Points Knowledge Base Article" /></a></p>
<p><a href="http://help.adobe.com/en_US/AdobeMediaEncoder/4.0/WSC039D82B-0C0E-4c53-BEBA-4C6C4B400160.html"><img src="http://www.brooksandrus.com/jing2/no_cuepoints_f4v.png" alt="No Cue Points for F4V" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.brooksandrus.com/blog/2008/12/07/f4v-does-not-support-cue-points/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>F4V is Retarded</title>
		<link>http://www.brooksandrus.com/blog/2008/12/07/f4v-is-retarded/</link>
		<comments>http://www.brooksandrus.com/blog/2008/12/07/f4v-is-retarded/#comments</comments>
		<pubDate>Sun, 07 Dec 2008 20:44:47 +0000</pubDate>
		<dc:creator>brooks</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[h.264]]></category>
		<category><![CDATA[m4v]]></category>
		<category><![CDATA[mpeg-4-avc]]></category>
		<category><![CDATA[standards]]></category>

		<guid isPermaLink="false">http://www.brooksandrus.com/blog/?p=619</guid>
		<description><![CDATA[
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_player_869015589"
			class="flashmovie"
			width="640"
			height="360">
	<param name="movie" value="http://www.brooksandrus.com/media/player.swf" />
	<param name="flashvars" value="content=http://www.brooksandrus.com/media/f4v_sucks.mp4&amp;thumb=http://www.brooksandrus.com/media/f4v_sucks.jpg&amp;windowbox=true&amp;analytics=UA-6435642-1&amp;showbranding=true&amp;containerwidth=640&amp;containerheight=360" />
	<param name="allowfullscreen" value="true" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.brooksandrus.com/media/player.swf"
			name="fm_player_869015589"
			width="640"
			height="360">
		<param name="flashvars" value="content=http://www.brooksandrus.com/media/f4v_sucks.mp4&amp;thumb=http://www.brooksandrus.com/media/f4v_sucks.jpg&amp;windowbox=true&amp;analytics=UA-6435642-1&amp;showbranding=true&amp;containerwidth=640&amp;containerheight=360" />
		<param name="allowfullscreen" value="true" />
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object> Why F4V is the wrong decision: Destroys one of the great promises of MPEG4-AVC / h.264&#8211;interoperability. No single file deployment (closely tied to interoperability). I certainly imagine a world where a single piece of media [...]]]></description>
			<content:encoded><![CDATA[
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_player_962278352"
			class="flashmovie"
			width="640"
			height="360">
	<param name="movie" value="http://www.brooksandrus.com/media/player.swf" />
	<param name="flashvars" value="content=http://www.brooksandrus.com/media/f4v_sucks.mp4&amp;thumb=http://www.brooksandrus.com/media/f4v_sucks.jpg&amp;windowbox=true&amp;analytics=UA-6435642-1&amp;showbranding=true&amp;containerwidth=640&amp;containerheight=360" />
	<param name="allowfullscreen" value="true" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.brooksandrus.com/media/player.swf"
			name="fm_player_962278352"
			width="640"
			height="360">
		<param name="flashvars" value="content=http://www.brooksandrus.com/media/f4v_sucks.mp4&amp;thumb=http://www.brooksandrus.com/media/f4v_sucks.jpg&amp;windowbox=true&amp;analytics=UA-6435642-1&amp;showbranding=true&amp;containerwidth=640&amp;containerheight=360" />
		<param name="allowfullscreen" value="true" />
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>Why F4V is the wrong decision:</p>
<ul>
<li>Destroys one of the great promises of MPEG4-AVC / h.264&#8211;interoperability.</li>
<li>No single file deployment (closely tied to interoperability). I certainly imagine a world where a single piece of media can be posted on the web, downloaded and played back through Flash Player, iPhone / iPod, QuickTime, Apple TV, etc. Gone should be the days of providing different files for different browsers, plugins or mobile devices.</li>
<li>Effectively reduces the usefulness the existing MPEG4-AVC / h.264 ecosystem. The MPEG4 spec urges .mp4 be used as the file extension and many vendors just refuse to work with something that has a different file extension.</li>
<li>You lose out on much of the existing intelligent rss enclosure handling. Blogging platforms and plugins will recognize the .mp4 extension and auto-generate enclosures (very useful for delivering to feed readers and mobile devices).</li>
<li>F4V just muddles the codec picture even more. Take a look at any of the encoder dialogs in CS4 and you&#8217;ll see a confusing slew of options (flv, f4v, h.264, h.264 blu-ray, etc.). Hell, I even heard an instructor in one of the MAX hands on sessions, urge students to steer clear of h.264 encodings since that was just HD / blu-ray stuff. He actually was pushing flv (pretty bizarre for an AfterEffects class).</li>
</ul>
<p>I&#8217;m not trying to be a jerk, there are definite reasons Adobe may have chosen to use F4V:</p>
<ul>
<li>Apple did it (M4V). Yep, Apple screwed the pooch as well.</li>
<li>It&#8217;s easy to associate file extensions with default application handlers (i.e. AMP is the default media player for *.flv and *.f4v files).</li>
<li>Allows for a unique mime-type (Flash Player gets associated with a specific file type on servers).</li>
<li>OS file choosers allow filtering by extension.</li>
<li>F4V clearly establishes a file as compatible with the parts of the MPEG4 spec supported by Flash Player. This has the obvious advantage of visual associations / assumptions and might assist descriptions in documentation and marketing.</li>
</ul>
<p><img src="http://www.brooksandrus.com/jing2/f4v_muddled_options.png" alt="" /></p>
<p>I guess I feel like there should be some sort of primary directive: &#8220;thou shalt not damage interoperability.&#8221; Any time you&#8217;re thinking of messing with the spec it should be examined through this lens. As valid as some of the reasoning for using F4V is, it fails, IMHO, when compared to the primary directive. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.brooksandrus.com/blog/2008/12/07/f4v-is-retarded/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
<enclosure url="http://www.brooksandrus.com/media/f4v_sucks.mp4" length="20490338" type="video/mp4" />
		</item>
		<item>
		<title>Day Three MAXies</title>
		<link>http://www.brooksandrus.com/blog/2008/11/20/day-three-maxies/</link>
		<comments>http://www.brooksandrus.com/blog/2008/11/20/day-three-maxies/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 07:22:10 +0000</pubDate>
		<dc:creator>brooks</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[max]]></category>
		<category><![CDATA[pixel bender]]></category>
		<category><![CDATA[tlf]]></category>
		<category><![CDATA[xmp]]></category>

		<guid isPermaLink="false">http://www.brooksandrus.com/blog/?p=552</guid>
		<description><![CDATA[The final day of a conference is always brutal. Multiple nights of vendor supplied beer, limited sleep, and a steady river of technical information lead to, well, a sore ass and a limited attention span. Despite this the final day of MAX 08 was solid for moi. Here&#8217;s the round up. I was blown away [...]]]></description>
			<content:encoded><![CDATA[<p>The final day of a conference is always brutal. Multiple nights of vendor supplied beer, limited sleep, and a steady river of technical information lead to, well, a sore ass and a limited attention span. Despite this the final day of MAX 08 was solid for moi. Here&#8217;s the round up.</p>
<p>I was blown away by the morning session on the Flash Platform&#8217;s new text engine. It seems the InDesign team has been hard at work on an AS3 framework called TLF that will be released to labs this Friday. TLF provides enormous framework agnostic (works with Flex or Flash) layout capabilities built on top of Flash Player&#8217;s low-level APIs. Very cool stuff that definitely builds on Flash Player&#8217;s legend as a cutting edge experience-delivery runtime. </p>
<p>It&#8217;s areas like this where you really see the enormous payoff from the Adobe / Macromedia merger. Not many people in the world have the deep typographic and layout knowledge necessary to fully utilize the low level text API&#8217;s exposed in Flash Player 10. Adobe, however, has deep roots in type with everything from print drivers, to document formats designed for consistent cross-platform type rendering, to best-of-breed layout tooling. There&#8217;s scary potential for the platform when you consider they&#8217;ve already delivered Pixel Bender shader effects and are sitting on top of serious video tooling / expertise.</p>
<p>Next I sat in a fantastic <a href="http://labs.adobe.com/technologies/pixelbender/">Pixel Bender</a> lab put on by the <a href="http://blogs.adobe.com/kevin.goldsmith/adobe_image_foundation/">AIF</a> crew. These guys ran the best code oriented lab I&#8217;ve ever sat in. I wish I could describe code as clearly and efficiently as these cats&#8211;I&#8217;d be a code super hero, or an even larger pain in the ass to other developers. Regardless, I should note there&#8217;s killer tooling built up around Pixel Bender. A shader language with a code hinting IDE, debugging, breakpoints and export of pbj (bytecode Flash Player 10 runs). Slick stuff&#8211;the little girlies over at Adobe should be proud.</p>
<p>I also got to sit in another session on <a href="http://www.adobe.com/products/xmp/">XMP</a> with some silly name like, &#8220;Use XMP Metadata to Label, Track, and Manage Assets within Creative Suite.&#8221; I&#8217;m hoping it was the designerish name that scared everyone off&#8211;less than 15 people were in the session. That&#8217;s seriously disappointing my fellow meta-nerds. Regardless, Gunar (a Sr. PM with Adobe) gave a super articulate overview of what XMP is, it&#8217;s alignment with various industry standards and how it provides tangible benefits throughout the create, edit, publish, deploy and consumption lifecycle. Good stuff that should be mandatory viewing for the lot of you (if only so you can mock my meta fetish).</p>
<p>That&#8217;s a wrap for MAX day three. If I get a chance I&#8217;ll type up some additional thoughts on the long plane ride home.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brooksandrus.com/blog/2008/11/20/day-three-maxies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MAX Sneaks &#8211; MeerMeer Rocks!</title>
		<link>http://www.brooksandrus.com/blog/2008/11/18/max-sneaks-meermeer-rocks/</link>
		<comments>http://www.brooksandrus.com/blog/2008/11/18/max-sneaks-meermeer-rocks/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 03:20:02 +0000</pubDate>
		<dc:creator>brooks</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[max]]></category>
		<category><![CDATA[sneaks]]></category>

		<guid isPermaLink="false">http://www.brooksandrus.com/blog/?p=537</guid>
		<description><![CDATA[Dear MeerMeer. You had me at onion skin. Adobe has a web service that will compare web pages, rendered back to you from the server via a virtualization farm, as they appear on multiple OS and browser combinations. Not only that, it will onion skin differences and allow you to debug between &#8220;frozen states&#8221; and [...]]]></description>
			<content:encoded><![CDATA[<p>Dear MeerMeer. You had me at onion skin. Adobe has a web service that will compare web pages, rendered back to you from the server via a virtualization farm, as they appear on multiple OS and browser combinations. Not only that, it will onion skin differences and allow you to debug between &#8220;frozen states&#8221; and the server. Amazing. I&#8217;ve seen some cool shite tonight, but this one might be the most practical.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brooksandrus.com/blog/2008/11/18/max-sneaks-meermeer-rocks/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Day One MAXies</title>
		<link>http://www.brooksandrus.com/blog/2008/11/18/day-one-maxies/</link>
		<comments>http://www.brooksandrus.com/blog/2008/11/18/day-one-maxies/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 02:32:03 +0000</pubDate>
		<dc:creator>brooks</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.brooksandrus.com/blog/?p=530</guid>
		<description><![CDATA[Every conference has its share of turds and gems. Trying to stay glass half full, here were the list of gems I witnessed from day one at MAX. Ely Greenfield &#8211; As the Oracle might say, &#8220;he&#8217;s got the gift.&#8221; I&#8217;d love some time in an osmosis chamber with this cat&#8211;it&#8217;d be guaranteed to take [...]]]></description>
			<content:encoded><![CDATA[<p>Every conference has its share of turds and gems. Trying to stay glass half full, here were the list of gems I witnessed from day one at MAX.</p>
<p><a href="http://www.quietlyscheming.com/blog/">Ely Greenfield</a> &#8211; As<a href="http://en.wikipedia.org/wiki/The_Oracle_(The_Matrix)"> the Oracle</a> might say, &#8220;he&#8217;s got the gift.&#8221; I&#8217;d love some time in an osmosis chamber with this cat&#8211;it&#8217;d be guaranteed to take some of the dumb off.</p>
<p>Ryan Taylor. Had a fantastic session on Pixel Bender. Spoke articulately in code (difficult). I&#8217;m no expert now, but he broke it down and made it approachable and desirable. I&#8217;d go back for more. Check out <a href="http://www.boostworthy.com/blog/">his blog</a>.</p>
<p>Maria Shriver &#8211; keynote was ho hum. Huge production value, but the overall story seemed, well, <a href="http://www.bit-101.com/blog/?p=1695">less than ground breaking</a>. Shriver stole the show&#8211;charismatic and raised to lead (I&#8217;m an anti-class American, but she was in a league of her own). Wave was undeserving of the spotlight and CoCoMo feels like something that <a href="http://www.redmonk.com/cote/2008/11/17/adobemax-day001/">didn&#8217;t sell but has been repackaged as a PaaS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brooksandrus.com/blog/2008/11/18/day-one-maxies/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Loser Gets Shipped Off to Microsoft</title>
		<link>http://www.brooksandrus.com/blog/2008/11/18/loser-gets-shipped-off-to-microsoft/</link>
		<comments>http://www.brooksandrus.com/blog/2008/11/18/loser-gets-shipped-off-to-microsoft/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 02:18:51 +0000</pubDate>
		<dc:creator>brooks</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.brooksandrus.com/blog/?p=528</guid>
		<description><![CDATA[Going out on a limb, but the best line from the MAX 08 Sneaks has to be: &#8220;Adobe devs who get the most applause get an iPod. Loser gets shipped off to Microsoft.&#8221; Good clean fun. ;-)]]></description>
			<content:encoded><![CDATA[<p>Going out on a limb, but the best line from the MAX 08 Sneaks has to be:</p>
<p>&#8220;Adobe devs who get the most applause get an iPod. Loser gets shipped off to Microsoft.&#8221; </p>
<p>Good clean fun. ;-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brooksandrus.com/blog/2008/11/18/loser-gets-shipped-off-to-microsoft/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Oh Me, Oh My &#8211; YouTube Supports 720p</title>
		<link>http://www.brooksandrus.com/blog/2008/11/18/oh-me-oh-my-youtube-supports-720p/</link>
		<comments>http://www.brooksandrus.com/blog/2008/11/18/oh-me-oh-my-youtube-supports-720p/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 02:15:26 +0000</pubDate>
		<dc:creator>brooks</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.brooksandrus.com/blog/?p=525</guid>
		<description><![CDATA[Caught this info via a Ryan Stewart tweet last week. Looks like YouTube supports up to 720p video if the source video is high enough quality. Good to know. The real question is WTF Google? Why don&#8217;t we know what exactly all the requirements are? For instance, I work for a company that would be [...]]]></description>
			<content:encoded><![CDATA[<p>Caught this info via a <a href="http://twitter.com/ryanstewart">Ryan Stewart</a> tweet last week. Looks like YouTube supports up to 720p video if the source video is high enough quality.</p>
<p><a href="http://www.kottke.org/08/11/high-quality-youtube-video-hack"><img src="http://www.brooksandrus.com/jing/youtube_720p.png" alt="youtube_720p.png" /></a></p>
<p>Good to know. The real question is WTF Google? Why don&#8217;t we know what exactly all the requirements are? For instance, I work for a company that would be very interested in knowing how to achieve pass through upload (we encode video to YouTube&#8217;s specs and then upload and thereby skip the YouTube encoding step&#8211;saving time and YouTube CPU). If you, YouTube, insist on being the 800 lbs. gorilla, its high time you were WAY MORE TRANSPARENT. I want a legit service that&#8217;s not so opaque and has real features instead of hacks posted on blogs. Just my two cents. ;-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brooksandrus.com/blog/2008/11/18/oh-me-oh-my-youtube-supports-720p/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Adobe MAX 2008 Keynote Pics</title>
		<link>http://www.brooksandrus.com/blog/2008/11/18/adobe-max-2008-keynote-pics/</link>
		<comments>http://www.brooksandrus.com/blog/2008/11/18/adobe-max-2008-keynote-pics/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 16:06:08 +0000</pubDate>
		<dc:creator>brooks</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.brooksandrus.com/blog/?p=521</guid>
		<description><![CDATA[I&#8217;m a bit behind, but below the fold you&#8217;ll find some pics from the keynote.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a bit behind, but below the fold you&#8217;ll find some pics from the keynote.</p>
<p><img src="http://www.brooksandrus.com/images/max08/MAX08-keynote-12.jpg" alt="MAX08" /></p>
<p><span id="more-521"></span><img src="http://www.brooksandrus.com/images/max08/MAX08-keynote-1.jpg" alt="MAX08" /></p>
<p><img src="http://www.brooksandrus.com/images/max08/MAX08-keynote-2.jpg" alt="MAX08" /></p>
<p><img src="http://www.brooksandrus.com/images/max08/MAX08-keynote-3.jpg" alt="MAX08" /></p>
<p><img src="http://www.brooksandrus.com/images/max08/MAX08-keynote-4.jpg" alt="MAX08" /></p>
<p><img src="http://www.brooksandrus.com/images/max08/MAX08-keynote-5.jpg" alt="MAX08" /></p>
<p><img src="http://www.brooksandrus.com/images/max08/MAX08-keynote-6.jpg" alt="MAX08" /></p>
<p><img src="http://www.brooksandrus.com/images/max08/MAX08-keynote-7.jpg" alt="MAX08" /></p>
<p><img src="http://www.brooksandrus.com/images/max08/MAX08-keynote-8.jpg" alt="MAX08" /></p>
<p><img src="http://www.brooksandrus.com/images/max08/MAX08-keynote-9.jpg" alt="MAX08" /></p>
<p><img src="http://www.brooksandrus.com/images/max08/MAX08-keynote-10.jpg" alt="MAX08" /></p>
<p><img src="http://www.brooksandrus.com/images/max08/MAX08-keynote-11.jpg" alt="MAX08" /></p>
<p><img src="http://www.brooksandrus.com/images/max08/MAX08-keynote-13.jpg" alt="MAX08" /></p>
<p><img src="http://www.brooksandrus.com/images/max08/MAX08-keynote-14.jpg" alt="MAX08" /></p>
<p><img src="http://www.brooksandrus.com/images/max08/MAX08-keynote-15.jpg" alt="MAX08" /></p>
<p><img src="http://www.brooksandrus.com/images/max08/MAX08-keynote-16.jpg" alt="MAX08" /></p>
<p><img src="http://www.brooksandrus.com/images/max08/MAX08-keynote-17.jpg" alt="MAX08" /></p>
<p><img src="http://www.brooksandrus.com/images/max08/MAX08-keynote-18.jpg" alt="MAX08" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.brooksandrus.com/blog/2008/11/18/adobe-max-2008-keynote-pics/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The XMP Revolution is Here</title>
		<link>http://www.brooksandrus.com/blog/2008/11/16/the-xmp-revolution-is-here/</link>
		<comments>http://www.brooksandrus.com/blog/2008/11/16/the-xmp-revolution-is-here/#comments</comments>
		<pubDate>Sun, 16 Nov 2008 06:45:25 +0000</pubDate>
		<dc:creator>brooks</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://www.brooksandrus.com/blog/?p=483</guid>
		<description><![CDATA[I was testing some MPEG4-AVC playback code the other day and ran into a Flash Player runtime exception I hadn&#8217;t ever seen before: Hmph. An onXMPData callback&#8211;that piqued my interest. I&#8217;ve long been a fan of metadata and XMP in particular (it takes a special type of nerd to have the meta love), so when [...]]]></description>
			<content:encoded><![CDATA[<p>I was testing some MPEG4-AVC playback code the other day and ran into a Flash Player runtime exception I hadn&#8217;t ever seen before:</p>
<p><img src="http://www.brooksandrus.com/jing/fp10_xmpcallback_error.png" alt="fp10_xmpcallback_error.png" /></p>
<p>Hmph. An onXMPData callback&#8211;that piqued my interest. I&#8217;ve long been a fan of metadata and <a href="http://en.wikipedia.org/wiki/Extensible_Metadata_Platform">XMP</a> in particular (it takes a special type of nerd to have the meta love), so when I saw this error the wheels began to turn immediately. I had been testing a lot of video files lately, but this particular piece of content was created with After Effects CS4. This made me think that the long and slow roll out of <a href="http://www.adobe.com/products/xmp/">XMP</a> into the Adobe suite was finally here and I wanted to know what exactly they were doing.</p>
<p><span id="more-483"></span>Fist things first, I fired up Flex, set a breakpoint and loaded the After Effects created video file into my MPEG4-AVC player. The short video below describes what I found inside the onXMPData callback.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_player_863827515"
			class="flashmovie"
			width="640"
			height="360">
	<param name="movie" value="http://www.brooksandrus.com/media/player.swf" />
	<param name="flashvars" value="content=http://www.brooksandrus.com/media/xmp_metadata.mp4&amp;thumb=http://www.brooksandrus.com/media/xmp_metadata.jpg&amp;windowbox=true&amp;analytics=UA-6435642-1&amp;showbranding=true&amp;containerwidth=640&amp;containerheight=360" />
	<param name="allowfullscreen" value="true" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.brooksandrus.com/media/player.swf"
			name="fm_player_863827515"
			width="640"
			height="360">
		<param name="flashvars" value="content=http://www.brooksandrus.com/media/xmp_metadata.mp4&amp;thumb=http://www.brooksandrus.com/media/xmp_metadata.jpg&amp;windowbox=true&amp;analytics=UA-6435642-1&amp;showbranding=true&amp;containerwidth=640&amp;containerheight=360" />
		<param name="allowfullscreen" value="true" />
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>But wait, there&#8217;s more, using XMP extends beyond standard file info and saving a video file&#8217;s editing history. Case in point, Premiere Pro CS4 has a killer &#8220;speech to text&#8221; transcription feature. The transcription text is stored as XMP within the video file. This allows Premiere and other tools to accurately search for this data within a file (powers the search feature inside of Premiere and Bridge). As a special bonus, Flash Player 10 provides the same data in its onXMPData callback. Check the short video below to see what this XMP data looks like inside of Flash Player.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_player_1391113013"
			class="flashmovie"
			width="640"
			height="360">
	<param name="movie" value="http://www.brooksandrus.com/media/player.swf" />
	<param name="flashvars" value="content=http://www.brooksandrus.com/media/xmptranscr.mp4&amp;thumb=http://www.brooksandrus.com/media/xmptranscr.jpg&amp;windowbox=true&amp;analytics=UA-6435642-1&amp;showbranding=true&amp;containerwidth=640&amp;containerheight=360" />
	<param name="allowfullscreen" value="true" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.brooksandrus.com/media/player.swf"
			name="fm_player_1391113013"
			width="640"
			height="360">
		<param name="flashvars" value="content=http://www.brooksandrus.com/media/xmptranscr.mp4&amp;thumb=http://www.brooksandrus.com/media/xmptranscr.jpg&amp;windowbox=true&amp;analytics=UA-6435642-1&amp;showbranding=true&amp;containerwidth=640&amp;containerheight=360" />
		<param name="allowfullscreen" value="true" />
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>The implications of XMP were big enough, but the inclusion of the onXMPData callback in Flash Player 10 makes this a monster if you develop for the platform. Imagine how much more information there is at our fingertips; the ability to tap into the data, connect context, establish relationships and, ultimately, to create lean-forward experiences. It leaves, this lil&#8217; ol&#8217; geek giddy as a schoolgirl.</p>
<p>Now if only I can wrangle a few devs at work into writing XMP into the video files that TechSmith tooling creates. I&#8217;m talking cursor info, open application info, html links, captioning, callouts, quizing, the works. I&#8217;d literally be swimming in data and that my friends would make me one dangerous hombre (at least in my own mind). </p>
<p>Finally, content creation vendors should absolutely be aware that XMP is an open and extensible standard Adobe is attempting to promote in the industry. The spec is published and they even provide an <a href="http://www.adobe.com/devnet/xmp/">XMP SDK</a> for C++ and Java which allows you to read and inject XMP metadata into a variety of media file formats including <a href="http://blogs.adobe.com/jnack/2007/03/new_opensource.html">JPEG, PSD, TIFF, AVI, WAV, MPEG, MP3, MOV, INDD, PS, EPS and PNG</a>. By the way Adobe, get cracking on providing an AS3 XMP library that we can use in AIR apps. <a href="http://www.mikechambers.com/blog/2008/11/13/growl-support-for-adobe-air-applications/">Growl</a> is nice, but a library for reading and injecting XMP would bring down the house for meta-nerds (this is me grovelling).</p>
<p>P.S. In an effort to stuff an insane amount of video into a single post, or just in case you&#8217;re interested in learning how Premiere&#8217;s speech to text capabilities work check out the Adobe TV screencast below.</p>
<p><embed src="http://tv.adobe.com/Embed.swf" quality="high" bgcolor="#000000" width="640" height="385" name="AdobeTVPlayer" play="true" loop="false" quality="high" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" flashVars="v=~b64~aHR0cDovL2Fkb2JlLmVkZ2Vib3NzLm5ldC9mbGFzaC9hZG9iZS9hZG9iZXR2Mi9sZWFybl9wcmVtaWVyZV9wcm9fY3M0L2xydmlkNDA3MF9wci5mbHY/cnNzX2ZlZWRpZD0xNjAwJnhtbHZlcnM9Mg==&#038;w=640&#038;h=385"></embed></p>
]]></content:encoded>
			<wfw:commentRss>http://www.brooksandrus.com/blog/2008/11/16/the-xmp-revolution-is-here/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
<enclosure url="http://www.brooksandrus.com/media/xmp_metadata.mp4" length="3453073" type="video/mp4" />
<enclosure url="http://www.brooksandrus.com/media/xmptranscr.mp4" length="1562914" type="video/mp4" />
		</item>
		<item>
		<title>Yes, the h.264 Specification is Freely Available</title>
		<link>http://www.brooksandrus.com/blog/2008/11/15/yes-the-h264-specification-is-freely-available/</link>
		<comments>http://www.brooksandrus.com/blog/2008/11/15/yes-the-h264-specification-is-freely-available/#comments</comments>
		<pubDate>Sun, 16 Nov 2008 03:51:45 +0000</pubDate>
		<dc:creator>brooks</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://www.brooksandrus.com/blog/?p=497</guid>
		<description><![CDATA[I&#8217;ve done quite a bit of research on MPEG4-AVC / h.264 over the last year, but one thing that always seemed to bug me was that I couldn&#8217;t seem to find a freely available version of the spec anywhere. I&#8217;d hoped to find something on the ISO site, and I did, but it they&#8217;re charging [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve done quite a bit of research on <a href="http://en.wikipedia.org/wiki/H.264">MPEG4-AVC / h.264</a> over the last year, but one thing that always seemed to bug me was that I couldn&#8217;t seem to find a freely available version of the spec anywhere. I&#8217;d hoped to find something on the ISO site, and I did, but it they&#8217;re charging for the pdf. Now in my book paying cash to read a spec stinks, seems contrary to the purpose of a standard and, well, just isn&#8217;t something I&#8217;m going to do, so I just slid by soaking up crumbs where I could find them.</p>
<p><a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=50726"><img src="http://www.brooksandrus.com/jing/iso_charges_for_spec.png" alt="iso_charges_for_spec.png" /></a></p>
<p>To be fair there&#8217;s little chance I&#8217;ll actually understand the spec, so crumbs are probably appropriate. Reading level aside, I thought I was SOL until stumbling onto a link to <a href="http://www.itu.int/rec/dologin_pub.asp?lang=e&amp;id=T-REC-H.264-200305-S!!PDF-E&amp;type=items">the spec</a> at the ITU-T site. For those who aren&#8217;t aware the MPEG4-AVC (ISO) / <a href="http://www.itu.int/rec/T-REC-H.264">h.264 (ITU-T) spec</a> was jointly developed by the ITU-T and ISO/IEC Moving Picture Experts Group. The result is the exact same spec with different names (MPEG4 Part 10 / AVC vs. h.264) and, it turns out, completely different policies on whether to charge for the spec.</p>
<p>Now that we&#8217;ve cleared that up, I can get back to blankly staring at the spec until sleep or ADD overwhelms me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brooksandrus.com/blog/2008/11/15/yes-the-h264-specification-is-freely-available/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Improve Flash MPEG-4 AVC Seeking With Binary Search</title>
		<link>http://www.brooksandrus.com/blog/2008/11/12/improve-flash-mpeg-4-avc-seeking-with-binary-search/</link>
		<comments>http://www.brooksandrus.com/blog/2008/11/12/improve-flash-mpeg-4-avc-seeking-with-binary-search/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 16:22:01 +0000</pubDate>
		<dc:creator>brooks</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.brooksandrus.com/blog/?p=435</guid>
		<description><![CDATA[Like most video nerds I&#8217;ve been working with MPEG-4 AVC (h.264) in Flash Player, but the release of Flash Player 10 has introduced some challenges. For example, there&#8217;s a Flash Player bug which causes Internet Explorer 6 / 7 to crash when seeking between the first two indexed keyframes in an MPEG-4 AVC encoded file [...]]]></description>
			<content:encoded><![CDATA[<p>Like most video nerds I&#8217;ve been working with MPEG-4 AVC (h.264) in Flash Player, but the release of Flash Player 10 has introduced some challenges. For example, there&#8217;s a Flash Player bug which causes Internet Explorer 6 / 7 to crash when seeking between the first two indexed keyframes in an MPEG-4 AVC encoded file (<a href="https://bugs.adobe.com/jira/browse/FP-913">see the submitted bug on Jira</a>). That&#8217;s a pretty nasty bug and something which wasn&#8217;t happening in Flash Player 9.0.115, but like all things there&#8217;s a silver lining. I started looking at how I might be able to write my NetStream seeking algorithm so that it eliminated, or at least mitigated the crashing. </p>
<p><span id="more-435"></span>Starting with Flash Player 9.0.115, the metadata callback that NetStream fires contains an array of seekpoint objects listing valid seekpoints and their byte offsets (a seekpoint object looks like this: { time: 0.00, offset: 36 }). This information is useful for a number of reasons, but in this case I was looking at improving seeking efficiency. A NetStream.seek operation is a relatively intense operation, so the idea was that instead of just handing NetStream a time (based on the position of a dragged progress slider) I&#8217;d find a valid time in the seekpoints array at or before the requested time. And this my friends led me to something called <a href="http://www.fredosaurus.com/notes-cpp/algorithms/searching/binarysearch.html">binary search</a>&#8211;a fast way to find a value within a sorted array of values. </p>
<p>Binary search is grade school stuff for legit computer scientists and lots of languages have some form of binary search built into them. However, I&#8217;m just a Flash hacker with a poly-sci degree and ActionScript doesn&#8217;t have a binary search method built into it so I had to wrap my little melon around the concept and come up with a solution. Here it is in all its gory glory&#8211;a binary search class for finding a seekpoint or the upper and lower bounds between which a requested seek falls. Feel free to use, lose or improve.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/**
 * Copyright 2007-2008 (c) , Brooks Andrus
 * 
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 *
 * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 * 
 */</span>
package com.<span style="color: #006600;">brooksandrus</span>.<span style="color: #006600;">utils</span>
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> BinarySearch
    <span style="color: #66cc66;">&#123;</span>
        <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _upperBounds:<span style="color: #0066CC;">int</span>;
        <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _lowerBounds:<span style="color: #0066CC;">int</span>;
&nbsp;
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> BinarySearch<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#123;</span>
&nbsp;
        <span style="color: #66cc66;">&#125;</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">/**
         * Recursively scans through an array of seekpoints to find a requested time. 
         * If the value is found within the array of seekpoints the index at which 
         * the value is found is returned. If an exact match is not found, -1 is returned 
         * and the the upper and lower indices between which the value falls are set 
         * (so you can determine the closest indice, or seek to to the nearest indexed 
         * time behind or forward in the array of seekpoints.
         * 
         * Seekpoints array must be sorted.
         * 
         * @param value  the requested seek time to find
         * @param range the array of seekpoints collected from an MPEG-4 AVC NetStream metadata event
         * @param the low index within the range we'd like to scan
         * @param the high index within the range we'd like to scan
         * 
         */</span>
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> search<span style="color: #66cc66;">&#40;</span> value:<span style="color: #0066CC;">Number</span>, range:<span style="color: #0066CC;">Array</span>, low:<span style="color: #0066CC;">int</span>, high:<span style="color: #0066CC;">int</span> <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">int</span>
        <span style="color: #66cc66;">&#123;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> high == low <span style="color: #66cc66;">&#41;</span>
            <span style="color: #66cc66;">&#123;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> range<span style="color: #66cc66;">&#91;</span>high<span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">time</span> == value <span style="color: #66cc66;">&#41;</span>
                <span style="color: #66cc66;">&#123;</span>
                    _lowerBounds = low;
                    <span style="color: #b1b100;">return</span> value
                <span style="color: #66cc66;">&#125;</span>
                <span style="color: #b1b100;">else</span>
                <span style="color: #66cc66;">&#123;</span>
                    _lowerBounds = low - <span style="color: #cc66cc;">1</span>;
                    <span style="color: #b1b100;">return</span> -<span style="color: #cc66cc;">1</span>;
                <span style="color: #66cc66;">&#125;</span>
            <span style="color: #66cc66;">&#125;</span>
&nbsp;
            <span style="color: #000000; font-weight: bold;">var</span> median:<span style="color: #0066CC;">int</span> = <span style="color: #66cc66;">&#40;</span> low + high <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span>;
&nbsp;
            <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> range<span style="color: #66cc66;">&#91;</span>median<span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">time</span> <span style="color: #66cc66;">&gt;</span> value <span style="color: #66cc66;">&#41;</span>
            <span style="color: #66cc66;">&#123;</span>
                _upperBounds = median;
                <span style="color: #b1b100;">return</span> search<span style="color: #66cc66;">&#40;</span> value, range, low, median <span style="color: #66cc66;">&#41;</span>;
            <span style="color: #66cc66;">&#125;</span>
            <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> range<span style="color: #66cc66;">&#91;</span>median<span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">time</span> <span style="color: #66cc66;">&lt;</span> value <span style="color: #66cc66;">&#41;</span>
            <span style="color: #66cc66;">&#123;</span>
                _lowerBounds = median + <span style="color: #cc66cc;">1</span>;
                <span style="color: #b1b100;">return</span> search<span style="color: #66cc66;">&#40;</span> value, range, median + <span style="color: #cc66cc;">1</span>, high <span style="color: #66cc66;">&#41;</span>;
            <span style="color: #66cc66;">&#125;</span>
            <span style="color: #b1b100;">else</span>
            <span style="color: #66cc66;">&#123;</span>
                _upperBounds = median;
                _lowerBounds = median;
                <span style="color: #b1b100;">return</span> median;
            <span style="color: #66cc66;">&#125;</span>
        <span style="color: #66cc66;">&#125;</span>
&nbsp;
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> lowerBounds<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">int</span>
        <span style="color: #66cc66;">&#123;</span>
            <span style="color: #b1b100;">return</span> _lowerBounds;
        <span style="color: #66cc66;">&#125;</span>
&nbsp;
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> upperBounds<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">int</span>
        <span style="color: #66cc66;">&#123;</span>
            <span style="color: #b1b100;">return</span> _upperBounds;
        <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Oh, and in case you&#8217;re wondering, it did help mitigate the IE browser crash a great deal. </p>
<p><strong>*Update*</strong></p>
<p>I had provided some before and after links which illustrated the difference in IE crashing. In hindsight this probably wasn&#8217;t the smartest move so I&#8217;ve removed the links. If you really want to watch IE go down in flames hit the Jira link above.</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.brooksandrus.com/blog/2008/11/12/improve-flash-mpeg-4-avc-seeking-with-binary-search/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>AIRhead: What Exactly Is ClipboardFormats.URL_FORMAT?</title>
		<link>http://www.brooksandrus.com/blog/2008/09/16/airhead-what-exactly-is-clipboardformatsurl_format/</link>
		<comments>http://www.brooksandrus.com/blog/2008/09/16/airhead-what-exactly-is-clipboardformatsurl_format/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 06:57:46 +0000</pubDate>
		<dc:creator>brooks</dc:creator>
				<category><![CDATA[AIR]]></category>

		<guid isPermaLink="false">http://www.brooksandrus.com/blog/?p=393</guid>
		<description><![CDATA[Maybe its just my contrarian nature resisting stack overflow, but I think I&#8217;m going to kick it old school for the time being and stick to posting my stupid programming questions and pathetic hacks on my own personal blog. After all I&#8217;ve got like 3 readers and I don&#8217;t work in some swank NYC development [...]]]></description>
			<content:encoded><![CDATA[<p>Maybe its just my contrarian nature resisting <a href="http://stackoverflow.com/">stack overflow</a>, but I think I&#8217;m going to kick it old school for the time being and stick to posting my stupid programming questions and pathetic hacks on my own personal blog. After all I&#8217;ve got like 3 readers and I don&#8217;t work in some swank NYC development shop so I&#8217;m pretty sure these people aren&#8217;t reading because of some cult of personality (read: do you really need my readership too Spolsky&#8211;come on). </p>
<p><span id="more-393"></span>Seriously, do I actually need to go to a single site to get programming questions answered? I thought that&#8217;s what Google was for? I just wonder how long before the trolls and zealots burn the site down. Last time I checked nerds generally refused to interact with each other unless leading WoW raids,  making crusty remarks on some semi-exclusive IRC channel, or stampeding on Slashdot. :-)</p>
<p>As such, in the spirit of <a href="http://www.youtube.com/user/phillipk">PK (Phillip Kerman)</a> I ask Why? Why is there a damn ClipboardFormats.URL_FORMAT constant? For the life of me I can&#8217;t figure out what this actually represents. I haven&#8217;t been able to stick anything on the clipboard that gets an affirmative back when Clipboard.hasFormat( ClipboardFormats.URL_FORMAT ) is the test. Has anyone ever seen this used in the wild? Any idea why the documentation even bothers listing it? Is it just a placeholder? A native AS3 object (URLRequest)?</p>
<p><img src="http://www.brooksandrus.com/jing/url_format_clipboard_1.png" alt="url_format_clipboard_1.png" /></p>
<p>Holy cow this sort of thing bothers me. It&#8217;s enough to keep me up late at night blogging and watching bad movies or making fun of some hopelessly nerdy site like stackoverlow. I mean how pathetic and lame is that? </p>
<p>&#8230;if you&#8217;ve got answers leave &#8216;em in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brooksandrus.com/blog/2008/09/16/airhead-what-exactly-is-clipboardformatsurl_format/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>AIRhead: OS Specific Accelerator Key Weirdness</title>
		<link>http://www.brooksandrus.com/blog/2008/09/15/airhead-os-specific-accelerator-key-weirdness/</link>
		<comments>http://www.brooksandrus.com/blog/2008/09/15/airhead-os-specific-accelerator-key-weirdness/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 01:56:41 +0000</pubDate>
		<dc:creator>brooks</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.brooksandrus.com/blog/?p=389</guid>
		<description><![CDATA[Warning Nerd Post&#8211;disregard if you&#8217;re not an AIRhead. I&#8217;ve been working on a little AIR app and had a helluva time trying to get a NativeMenuItem keyboard shortcut set up for &#8220;Save As&#8221; functionality. The thing is I wasn&#8217;t trying to do anything difficult. I was setting the keyboardEquivalent to lower case &#8220;s&#8221; and then [...]]]></description>
			<content:encoded><![CDATA[<p>Warning Nerd Post&#8211;disregard if you&#8217;re not an AIRhead. I&#8217;ve been working on a little AIR app and had a helluva time trying to get a NativeMenuItem keyboard shortcut set up for &#8220;Save As&#8221; functionality. The thing is I wasn&#8217;t trying to do anything difficult. I was setting the <strong>keyboardEquivalent</strong> to lower case &#8220;s&#8221; and then explicitly setting the <strong>keyEquivalentModifiers</strong> to COMMAND + SHIFT on OS X or CONTROL + SHIFT on Windows. Things were peachy on OS X, but not so great on Windows (XP is all I tested). On Windows the caps lock must be on (despite the lowercase key equivalent). So after dropping the f-bomb a handful of times, debating whether to gouge my own eyeballs out and tweeting my rage I seriously dug into the documentation looking for an answer.</p>
<p><span id="more-389"></span><img src="http://www.brooksandrus.com/jing/accelerator_key_madness.png" alt="accelerator_key_madness.png" /></p>
<p>It wasn&#8217;t easy, but after giving up on the language reference (what I like to think of as help) I started digging through the additional help / getting started materials. Sure enough, there was a rather cryptic hint of unexpected cross platform weirdness (aka AIR inconsistency). Turns out you need to explicitly set the accelerator modifiers for OS X and then use an uppercase letter for Windows and let AIR / OS automatically add the modifiers (some very warped thinking if you ask me). </p>
<p><img src="http://www.brooksandrus.com/jing/2008-09-15_2055.png" alt="2008-09-15_2055.png" /></p>
<p>Call me crazy, but I thought AIR was supposed to eliminate all this OS twilight zone time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brooksandrus.com/blog/2008/09/15/airhead-os-specific-accelerator-key-weirdness/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

