<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Jit Ghosh's WebLog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/jitghosh/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/jitghosh/feed.xml</link>
    <description>Musings of a Windows client developer...</description>
    <lastBuildDate>Tue, 16 Apr 2019 05:12:37 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Capturing a Bitmap (using the BitmapEncoder/BitmapDecoder)</title>
      <link>https://docs.microsoft.com/archive/blogs/jitghosh/capturing-a-bitmap-using-the-bitmapencoderbitmapdecoder</link>
      <pubDate>Fri, 13 Jul 2012 21:05:50 GMT</pubDate>
      <dc:creator><![CDATA[Jit Ghosh]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jitghosh/2012/07/13/capturing-a-bitmap-using-the-bitmapencoderbitmapdecoder/</guid>
      <description><![CDATA[I was recently working on a Windows Metro app, where we needed to capture a user’s scribble on an...]]></description>
      <content:encoded><![CDATA[<p><font size="3">I was recently working on a Windows Metro app, where we needed to capture a user’s scribble on an image background as a composite bitmap. The scenario was this :</font></p>  <ol>   <li><font size="3">Display a bitmap on screen.</font></li>    <li><font size="3">Let the user scribble something on the image using a pen, mouse or touch.</font></li>    <li><font size="3">Display the scribble while it is being made. </font></li>    <li><font size="3">Let the user save a new bitmap with the scribble overlayed on top of the original.</font></li> </ol>  <p><font size="3"></font></p>  <p><font size="3">1 through 3 were fairly easy to implement. In my case, a canvas with a bitmap background, <a href="http://msdn.microsoft.com/en-us/library/windows/apps/xaml/jj150606.aspx">handling pointer events</a> and drawing some lines based on pointer positions being reported through the WinRT’s pointer API’s – that was it. It was #4 that required some work.</font></p>  <p><font size="3">But before we get there – let’s take a look at the easy parts (#1,#2 and #3) . The XAML is trivial.</font></p>  <pre class="csharpcode"><font size="3"><span class="kwrd">&lt;</span><span class="html">Grid</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">Grid.RowDefinitions</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">RowDefinition</span> <span class="attr">Height</span><span class="kwrd">=&quot;*&quot;</span><span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">RowDefinition</span> <span class="attr">Height</span><span class="kwrd">=&quot;Auto&quot;</span><span class="kwrd">/&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">Grid.RowDefinitions</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">Canvas</span> <span class="attr">Height</span><span class="kwrd">=&quot;535&quot;</span> <span class="attr">Width</span><span class="kwrd">=&quot;800&quot;</span> <span class="attr">x:Name</span><span class="kwrd">=&quot;inkCanvas&quot;</span>
            <span class="attr">PointerMoved</span><span class="kwrd">=&quot;inkCanvas_PointerMoved_1&quot;</span> 
            <span class="attr">PointerPressed</span><span class="kwrd">=&quot;inkCanvas_PointerPressed_1&quot;</span> 
            <span class="attr">PointerReleased</span><span class="kwrd">=&quot;inkCanvas_PointerReleased_1&quot;</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">Canvas.Background</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">ImageBrush</span> <span class="attr">ImageSource</span><span class="kwrd">=&quot;/Assets/ChichenItza.jpg&quot;</span><span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">Canvas.Background</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">Canvas</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">Button</span> <span class="attr">x:Name</span><span class="kwrd">=&quot;btnSave&quot;</span> <span class="attr">Content</span><span class="kwrd">=&quot;Save&quot;</span> 
          <span class="attr">Tapped</span><span class="kwrd">=&quot;btnSave_Tapped_1&quot;</span> <span class="attr">Grid</span>.<span class="attr">Row</span><span class="kwrd">=&quot;1&quot;</span> 
          <span class="attr">HorizontalAlignment</span><span class="kwrd">=&quot;Center&quot;</span> <span class="attr">Margin</span><span class="kwrd">=&quot;0,0,0,75&quot;</span><span class="kwrd">/&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">Grid</span><span class="kwrd">&gt;</span></font></pre>


<pre class="csharpcode"><font size="3"><span class="kwrd"> </span></font></pre>


<p><font size="3">The canvas with the ImageBrush as the background served as the “scribble” area. To keep things simple for this post, I just included the image in the app as a resource. The Button when tapped, initiates code to save the composite bitmap off.</font></p>

<pre class="csharpcode"><font size="3"></font></pre>

<pre class="csharpcode"><font size="3">Point _previousPosition = <span class="kwrd">default</span>(Point);
SolidColorBrush _stroke = <span class="kwrd">new</span> SolidColorBrush(Colors.Red);
<span class="kwrd">bool</span> _pressed = <span class="kwrd">false</span>;

<span class="kwrd">private</span> <span class="kwrd">void</span> inkCanvas_PointerPressed_1(<span class="kwrd">object</span> sender,
  PointerRoutedEventArgs e)
{
  _previousPosition = e.GetCurrentPoint(inkCanvas).Position;  
  _pressed = <span class="kwrd">true</span>;
}

<span class="kwrd">private</span> <span class="kwrd">void</span> inkCanvas_PointerReleased_1(<span class="kwrd">object</span> sender,
  PointerRoutedEventArgs e)
{
  <span class="kwrd">if</span> (_pressed)
    _pressed = <span class="kwrd">false</span>;
}

<span class="kwrd">private</span> <span class="kwrd">void</span> inkCanvas_PointerMoved_1(<span class="kwrd">object</span> sender,
  PointerRoutedEventArgs e)
{
  <span class="kwrd">if</span> (!_pressed) <span class="kwrd">return</span>;
  var positions = e.GetIntermediatePoints(inkCanvas).
    Select(ppt =&gt; ppt.Position);

  <span class="kwrd">foreach</span> (Point pt <span class="kwrd">in</span> positions)
  {
        
    inkCanvas.Children.Add(
      <span class="kwrd">new</span> Line() { X1 = _previousPosition.X, 
        Y1 = _previousPosition.Y, 
        X2 = pt.X, 
        Y2 = pt.Y, 
        Stroke = _stroke, 
        StrokeThickness = 2 } 
      );
    _previousPosition = pt;
  } 
}
</font></pre>


<p><font size="3">Listed above is all the code we need to track the pointer and render the scribble. I start tracking every time the pointer is pressed down, and stop every time the pointer is released – keeping track using the _pressed variable. While the pointer is pressed, for each PointerMoved event,&#160; I get all the positions that the pointer has traversed through between the last occurrence of this event and this one(reported through the <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br242064.aspx">GetIntermediatePoints()</a> API), and draw a Line connecting each pair of positions starting with the last position that the pointer was at before this PointerMoved event. The _previousPosition variable keeps a track of the last position. In case you are wondering – GetIntermediatePoints() returns a collection of <a href="https://aka.ms/rad5lr">PointerPoint</a> instances – so the Select() is to project them to a collection of Point instances.</font></p>

<p><font size="3">Image below shows what’s rendered on screen.</font></p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/39/00/metablogapi/4188.image_2.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-39-00-metablogapi/4188.image_5F00_2.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/39/00/metablogapi/3515.image_thumb.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-39-00-metablogapi/3515.image_5F00_thumb.png" width="692" height="460" /></a></p>

<p><font size="3"> Now on to the real issue at hand(#4) -&#160; how to save this as a single bitmap. </font></p>

<p><font size="3">Before we dive into the API’s let’s talk a little bit about bitmaps. A bitmap is essentially a matrix of pixels – so a&#160; bitmap with a width of 400 and a height of 300 can be thought of as a matrix with 400 columns and 300 rows with each cell(row/column intersection) representing a pixel. </font><font size="3">Each pixel in turn represents a resultant color as some combination of the three basic colors (Blue, Green and Red) and an alpha channel(transparency) value. So in a 8 bit byte representation, each pixel can be thought of as a 4 byte integer with each of the 3 bytes representing a color value (from 0 – 255) and the 4th byte representing alpha (again 0 – 255). The order of these bytes can vary – so the bytes in a pixel could for instance be in the&#160; BGRA order or the RGBA order – something you need to take into account when manipulating images. </font></p>

<p><font size="3">Another thing to be aware of is that the pixel data in a bitmap can often be represented as a flattened array of pixels. The way this works in WinRT is by taking each row of pixels (starting with the topmost) and concatenating them together. So if we had a 3 x 3 bitmap (yes that’s mostly useless <img class="wlEmoticon wlEmoticon-smile" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/39/00/metablogapi/8080.wlEmoticon-smile_2.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-39-00-metablogapi/8080.wlEmoticon_2D00_smile_5F00_2.png" />) like so:</font></p>

<table cellspacing="0" cellpadding="2" width="209" border="0"><tbody>
    <tr>
      <td valign="top" width="81">
        <blockquote style="margin-right: 0px;" dir="ltr">
          <p>P11</p>
        </blockquote>
      </td>

      <td valign="top" width="73">
        <blockquote style="margin-right: 0px;" dir="ltr">
          <p>P12</p>
        </blockquote>
      </td>

      <td valign="top" width="53">
        <blockquote style="margin-right: 0px;" dir="ltr">
          <p>P13</p>
        </blockquote>
      </td>
    </tr>

    <tr>
      <td valign="top" width="81">
        <blockquote style="margin-right: 0px;" dir="ltr">
          <p>P21</p>
        </blockquote>
      </td>

      <td valign="top" width="73">
        <blockquote style="margin-right: 0px;" dir="ltr">
          <p>P22</p>
        </blockquote>
      </td>

      <td valign="top" width="53">
        <blockquote style="margin-right: 0px;" dir="ltr">
          <p>P23</p>
        </blockquote>
      </td>
    </tr>

    <tr>
      <td valign="top" width="81">
        <blockquote style="margin-right: 0px;" dir="ltr">
          <p>P31</p>
        </blockquote>
      </td>

      <td valign="top" width="73">
        <blockquote style="margin-right: 0px;" dir="ltr">
          <p>P32</p>
        </blockquote>
      </td>

      <td valign="top" width="53">
        <blockquote style="margin-right: 0px;" dir="ltr">
          <p>P33</p>
        </blockquote>
      </td>
    </tr>
  </tbody></table>

<p>&#160;</p>

<p><font size="3">when flattened, the array would be [ P11,P12,P13,P21,P22,P23,P31,P32,P33]. </font></p>

<p><font size="3">Armed with this knowledge, I applied the following basic thinking to solve the problem – record all the positions that the pointer traverses. When the user tries to save, get the raw pixels for the background image, change the pixels that match the coordinates for the recorded pointer positions to a color value of your choice (like the red stroke I used to render) and then save the resultant bitmap – and presto !</font></p>

<p><font size="3">For raw pixel manipulation, WinRT provides a <a href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.graphics.imaging.bitmapdecoder.aspx">BitmapDecoder</a> and a <a href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.graphics.imaging.bitmapencoder.aspx">BitmapEncoder</a> type that prove out to be very useful. BitmapDecoder can take a bitmap and provide you with the array of pixels (flattened like we discussed before) for the bitmap, BitmapEncoder can accept an array of pixels and save it out as a bitmap and both types can work with most of the industry standard image compression schemes (JPEG, PNG, TIFF, BMP etc.). </font></p>

<p><strong><font size="3">[NOTE : T</font><font size="3">hese types have a fairly rich API and can be useful in many ways when it comes to image handling. I will only discuss the portions pertaining to this post – I do intend to detail their full functionality out in a future post soon. In the meantime, do read about them at the Windows 8 Dev Center].</font></strong></p>

<p>&#160;</p>

<p><font size="3">So I changed my code (changes in bold) as below:</font></p>

<pre class="csharpcode"><font size="3">Point _previousPosition = <span class="kwrd">default</span>(Point);
SolidColorBrush _stroke = <span class="kwrd">new</span> SolidColorBrush(Colors.Red);
<strong>List&lt;List&lt;Point&gt;&gt; _allPoints = <span class="kwrd">new</span> List&lt;List&lt;Point&gt;&gt;();</strong>
<span class="kwrd">bool</span> _pressed = <span class="kwrd">false</span>;

<span class="kwrd">private</span> <span class="kwrd">void</span> inkCanvas_PointerMoved_1(<span class="kwrd">object</span> sender, 
  PointerRoutedEventArgs e)
{
  <span class="kwrd">if</span> (!_pressed) <span class="kwrd">return</span>;
  var positions = e.GetIntermediatePoints(inkCanvas).
    Select(ppt =&gt; ppt.Position);
  <span class="kwrd">foreach</span> (Point pt <span class="kwrd">in</span> positions)
  {
         
    inkCanvas.Children.Add(
      <span class="kwrd">new</span> Line() { 
        X1 = _previousPosition.X, 
        Y1 = _previousPosition.Y, 
        X2 = pt.X, Y2 = pt.Y, 
        Stroke = _stroke, 
        StrokeThickness = 2 } 
      );
    _previousPosition = pt;
  }
  <strong>_allPoints.Last().AddRange(positions);</strong>
}

<span class="kwrd">private</span> <span class="kwrd">void</span> inkCanvas_PointerPressed_1(<span class="kwrd">object</span> sender, 
  PointerRoutedEventArgs e)
{
  _previousPosition = e.GetCurrentPoint(inkCanvas).Position;
  <strong>_allPoints.Add(<span class="kwrd">new</span> List&lt;Point&gt;());
  _allPoints.Last().Add(_previousPosition);</strong>

      
  _pressed = <span class="kwrd">true</span>;
}

<span class="kwrd">private</span> async <span class="kwrd">void</span> inkCanvas_PointerReleased_1(<span class="kwrd">object</span> sender, 
  PointerRoutedEventArgs e)
{
  <span class="kwrd">if</span> (_pressed)
    _pressed = <span class="kwrd">false</span>;
}

<span class="kwrd">private</span> async <span class="kwrd">void</span> SaveBitmapAsync()
{
 <strong> List&lt;<span class="kwrd">byte</span>&gt; _pixelData = <span class="kwrd">null</span>;</strong>
  <span class="rem">//convert the source bitmap to a pixel array</span>
  <strong>var srcfile = await StorageFile.GetFileFromApplicationUriAsync(
    <span class="kwrd">new</span> Uri(<span class="str">&quot;ms-appx:///assets/ChichenItza.jpg&quot;</span>));

  BitmapDecoder decoder = <span class="kwrd">null</span>;
  <span class="kwrd">using</span> (IRandomAccessStream stm = 
    await srcfile.OpenAsync(FileAccessMode.Read))
  {
    decoder = await BitmapDecoder.CreateAsync(
      BitmapDecoder.JpegDecoderId, stm);
    _pixelData = (await decoder.GetPixelDataAsync()).
        DetachPixelData().ToList();
  };</strong> 

  <span class="rem"><strong><font size="5">//do our pixel manipulation here</font></strong></span>

  <span class="rem">//write it back</span>
  <strong>var destfile = await KnownFolders.PicturesLibrary.CreateFileAsync(
    <span class="kwrd">string</span>.Format(<span class="str">&quot;{0}_signature.jpg&quot;</span>, 
    DateTimeOffset.Now.ToString(<span class="str">&quot;MM_dd_yy_hh_mm_ss&quot;</span>)), 
    CreationCollisionOption.ReplaceExisting);
  <span class="kwrd">using</span> (IRandomAccessStream stm = 
    await destfile.OpenAsync(FileAccessMode.ReadWrite))
  {
    BitmapEncoder encoder = await BitmapEncoder.CreateAsync(
      BitmapEncoder.JpegEncoderId, stm);
    encoder.SetPixelData(
      decoder.BitmapPixelFormat, 
      BitmapAlphaMode.Straight, 
      800, 535, decoder.DpiX, decoder.DpiY, 
      _pixelData.ToArray());

    await encoder.FlushAsync();</strong>
  };
}
 
<span class="kwrd">private</span> async <span class="kwrd">void</span> btnSave_Tapped_1(<span class="kwrd">object</span> sender, TappedRoutedEventArgs e)
{
  await SaveBitmapAsync();
}</font><font size="2"> </font></pre>

<p><font size="3">Every time the user lifts the pointer we can consider a “stroke” to be completed. So as the pointer is pressed I create a new List&lt;Point&gt; and add it to the tail of a List&lt;List&lt;Point&gt;&gt; representing my collection of strokes, and as the pointer&#160; moves, I record the positions in the newly created list. </font></p>

<p><font size="3">The SaveBitmapAsync() method is what gets invoked when the user taps the Save button. In there I start by creating a new BitmapDecoder (note the static creation method), load the image <a href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.storagefile.aspx">StorageFile</a> (stored as a resource in my app), open the file to a random access stream, and use the decoder to get the pixel array (call GetPixelDataAsync() that returns a <a href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.graphics.imaging.pixeldataprovider.aspx">PixelDataProvider</a> which in turn returns the flattened pixel array through a call to DetachPixelData()).&#160;&#160; Once my pixel manipulation is done, I create a BitmapEncoder (again a static factory method to create), create a file (name it with the current date/time to avoid name collision) in the local Pictures folder, and save the manipulated pixel array into the file (actually a random access writeable stream obtained from the file) using the same pixel format and DPI settings as obtained for the original image via the decoder. </font></p>

<p><font size="3">Now all that was left was to color the pixels based on my recorded pointer positions. I will not bore you with all my trials here, </font><font size="3">but I soon realized that there was an error in my basic thinking. Recording the pointer positions and applying them was not enough – since the WinRT pointer API’s do not report every pixel your pointer was traversing through ( and for good reasons since a) the UI thread will simply not be able to keep up with it and b) you simply do not need that kind of accuracy for any app specific input targeting). The image below shows the result of this erroneous thinking, in the faint dotted representation of my original scribble – since I only plotted the recorded pointer positions. </font></p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/39/00/metablogapi/7737.07_13_12_11_04_57_signature_2.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-39-00-metablogapi/7737.07_5F00_13_5F00_12_5F00_11_5F00_04_5F00_57_5F00_signature_5F00_2.jpg"><img title="07_13_12_11_04_57_signature" style="display: inline; background-image: none;" border="0" alt="07_13_12_11_04_57_signature" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/39/00/metablogapi/6758.07_13_12_11_04_57_signature_thumb.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-39-00-metablogapi/6758.07_5F00_13_5F00_12_5F00_11_5F00_04_5F00_57_5F00_signature_5F00_thumb.jpg" width="676" height="452" />&#160;</a></p>

<p>&#160;</p>

<p><font size="3">If you are wondering why we do not see this in the first image – recall that when rendering on screen, we actually join the recorded positions with a Line – so any gaps are covered. </font><font size="3">So that brings me to the last piece of the puzzle. I needed to do in saving what I was doing in rendering(by drawing those lines). To do that I needed to interpolate extra points between each pair of recorded points to get enough “density” such that the scribble no longer looked that disjointed, and I decided to use <a href="http://en.wikipedia.org/wiki/Linear_interpolation">linear interpolation</a>.</font></p>

<p><font size="3"><strong>[Note : Methods of interpolation used in the general problem of curve fitting vary in degrees of error (since they are in fact all approximations), and linear interpolation is considered to be a relatively less accurate method. However it is the easiest to implement, and since the difference between the boundary points that we were interpolating for were very small to begin with, linear interpolation seemed to work well in my case. You may consider advanced Interpolation methods (like spline interpolation) if you feel like being mathematically adventurous. ]</strong></font></p>

<p><font size="3"></font>&#160;</p>

<pre class="csharpcode"><font size="3"><span class="kwrd">private</span> <span class="kwrd">void</span> Interpolate(Point pFrom, Point pTo, 
  <span class="kwrd">ref</span> List&lt;Point&gt; results)
{
  var xDiff = Math.Abs((pTo.X - pFrom.X));
  var yDiff = Math.Abs((pTo.Y - pFrom.Y));

  <span class="kwrd">if</span> (xDiff &lt; 1 &amp;&amp; yDiff &lt; 1) <span class="kwrd">return</span>; <span class="rem">//we stop </span>

  <span class="kwrd">if</span> (yDiff &gt; xDiff) <span class="rem">//interpolate along the x-axis</span>
  {
    Point p0 = pFrom.Y &lt; pTo.Y ? pFrom : pTo;
    Point p1 = pFrom.Y &lt; pTo.Y ? pTo : pFrom;

    <span class="kwrd">double</span> y = (yDiff / 2) + Math.Min(pFrom.Y, pTo.Y);
    Point newPt = <span class="kwrd">new</span> Point(p0.X + (y - p0.Y) * 
      ((p1.X - p0.X) / (p1.Y - p0.Y)), y);
    results.Add(newPt);
    Interpolate(pFrom, newPt, <span class="kwrd">ref</span> results);
    Interpolate(newPt, pTo, <span class="kwrd">ref</span> results);
  }
  <span class="kwrd">else</span> <span class="rem">//interpolate along y-axis</span>
  {
    Point p0 = pFrom.X &lt; pTo.X ? pFrom : pTo;
    Point p1 = pFrom.X &lt; pTo.X ? pTo : pFrom;

    <span class="kwrd">double</span> x = (xDiff / 2) + Math.Min(pFrom.X, pTo.X);
    Point newPt = <span class="kwrd">new</span> Point(x, p0.Y + (x - p0.X) * 
      ((p1.Y - p0.Y) / (p1.X - p0.X)));
    results.Add(newPt);
    Interpolate(pFrom, newPt, <span class="kwrd">ref</span> results);
    Interpolate(newPt, pTo, <span class="kwrd">ref</span> results);
  }
}</font></pre>


<p><font size="3">The Interpolate() method takes in two points and recursively interpolates points in between. At each recursion level it checks the distance between the points, and interpolates along the axis that will result in the largest sample size. It also stops recursion when the points in question have a difference of less than 1 logical pixel along both coordinates. To understand this better, please visit the hyperlink earlier on linear interpolation.</font></p>

<p><font size="3">Now my SaveBitmapAsync() method looks like this:</font></p>

<pre class="csharpcode"><font size="3"><span class="kwrd">private</span> async <span class="kwrd">void</span> SaveBitmapAsync()
{
  List&lt;<span class="kwrd">byte</span>&gt; _pixelData = <span class="kwrd">null</span>;
  <span class="rem">//convert the source bitmap to a pixel array</span>
  var srcfile = await StorageFile.GetFileFromApplicationUriAsync(
    <span class="kwrd">new</span> Uri(<span class="str">&quot;ms-appx:///assets/ChichenItza.jpg&quot;</span>));

  BitmapDecoder decoder = <span class="kwrd">null</span>;
  <span class="kwrd">using</span> (IRandomAccessStream stm = 
    await srcfile.OpenAsync(FileAccessMode.Read))
  {
    decoder = await BitmapDecoder.CreateAsync(
      BitmapDecoder.JpegDecoderId, stm);
    _pixelData = (await decoder.GetPixelDataAsync()).
        DetachPixelData().ToList();
  }; 

  <span class="rem">//do our pixel manipulation here</span>
  <strong>List&lt;Point&gt; all = _allPoints.Select(stroke =&gt;
  {
    var interpolationresults = stroke.SelectMany((pt, idx) =&gt;
    {

      List&lt;Point&gt; result = <span class="kwrd">new</span> List&lt;Point&gt;();
      <span class="kwrd">if</span> (idx + 1 == stroke.Count) <span class="kwrd">return</span> result;
      Interpolate(stroke[idx], stroke[idx + 1], <span class="kwrd">ref</span> result);
      <span class="kwrd">return</span> result;
    }).ToList();
    <span class="kwrd">return</span> stroke.Concat(interpolationresults).ToList();
  }).SelectMany(list =&gt; list).ToList();



  <span class="kwrd">foreach</span> (Point p <span class="kwrd">in</span> all)
  {
    <span class="kwrd">int</span> idx = (<span class="kwrd">int</span>)(800 * ((<span class="kwrd">int</span>)p.Y - 1) + p.X) * 4;
    _pixelData[idx] = Colors.Red.B;
    _pixelData[idx + 1] = Colors.Red.G;
    _pixelData[idx + 2] = Colors.Red.R;
    _pixelData[idx + 3] = Colors.Red.A;
  }</strong>
  <span class="rem">//write it back</span>
  var destfile = await KnownFolders.PicturesLibrary.CreateFileAsync(
    <span class="kwrd">string</span>.Format(<span class="str">&quot;{0}_signature.jpg&quot;</span>, 
    DateTimeOffset.Now.ToString(<span class="str">&quot;MM_dd_yy_hh_mm_ss&quot;</span>)), 
    CreationCollisionOption.ReplaceExisting);
  <span class="kwrd">using</span> (IRandomAccessStream stm = 
    await destfile.OpenAsync(FileAccessMode.ReadWrite))
  {
    BitmapEncoder encoder = await BitmapEncoder.CreateAsync(
      BitmapEncoder.JpegEncoderId, stm);
    encoder.SetPixelData(
      decoder.BitmapPixelFormat, 
      BitmapAlphaMode.Straight, 
      800, 535, decoder.DpiX, decoder.DpiY, 
      _pixelData.ToArray());

    await encoder.FlushAsync();
  };
}</font></pre>


<p><font size="3">Note the portion in bold. We run a query through our collection of strokes (with each stroke being a collection of Points), and for each pair of points in each stroke, we interpolate intermediate points using the Interpolate() method. We finally create a flattened collection of all the points – including the points originally recorded, and the points we interpolated. Now for each of these Points, we find the corresponding pixel in the flattened pixel array (note how we find the index – since we know the width of the image to be 800 and each pixel is actually 4 bytes), and we change the 4 bytes representing the pixel to reflect the color Red (using a BGRA order). Here is a final saved image:</font></p>

<p><font size="3"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/39/00/metablogapi/0572.07_13_12_11_36_14_signature_2.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-39-00-metablogapi/0572.07_5F00_13_5F00_12_5F00_11_5F00_36_5F00_14_5F00_signature_5F00_2.jpg"><img title="07_13_12_11_36_14_signature" style="display: inline; background-image: none;" border="0" alt="07_13_12_11_36_14_signature" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/39/00/metablogapi/1055.07_13_12_11_36_14_signature_thumb.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-39-00-metablogapi/1055.07_5F00_13_5F00_12_5F00_11_5F00_36_5F00_14_5F00_signature_5F00_thumb.jpg" width="747" height="500" /></a></font></p>

<p><font size="3">Better – right ? You may still notice the stroke to be a little thinner – that is because while rendering I was using a stroke thickness of 2. If you want to implement a stroke thickness greater than 1,you can change the pixel manipulation code to color immediately neighboring pixels as well.</font></p>

<p><font size="3">Note that this solution is still fairly immature and has a lot of room for improvement. The pixel manipulation and interpolation code is embarrassingly parallelizable, and should be. You might also consider implementing this in C++ (and use&#160; <a href="http://blogs.msdn.com/b/vcblog/archive/2011/06/15/introducing-amp.aspx">C++ AMP</a>) to not only parallelize but do so on the GPU. Also handling stroke thicknesses, higher resolution images (more processing –&gt;more reason to parallelize) etc. can add to the complexity. </font></p>

<p><font size="3">But hopefully this will give you a starting point if you face a similar problem. More next time !!</font></p>

<p><font size="3">- Jit</font></p>

<p>&#160;</p>

<p>&#160;</p>

<pre class="csharpcode">&#160;</pre>]]></content:encoded>
    </item>
    <item>
      <title>Here we go again…</title>
      <link>https://docs.microsoft.com/archive/blogs/jitghosh/here-we-go-again</link>
      <pubDate>Fri, 13 Jul 2012 21:02:51 GMT</pubDate>
      <dc:creator><![CDATA[Jit Ghosh]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jitghosh/2012/07/13/here-we-go-again/</guid>
      <description><![CDATA[It has been a long hiatus from blogging for me. So here goes another attempt to restart the...]]></description>
      <content:encoded><![CDATA[<p><font size="4"></font></p>  <p align="justify"><font size="3">It has been a long hiatus from blogging for me. So here goes another attempt to restart the process. </font></p> <font size="3"></font>  <p align="justify"></p> <font size="3"></font>  <p align="justify"><font size="3">Quite a bit has changed in the past few years, but a lot remains unchanged. I am still at Microsoft, still working for Developer Evangelism and still loving every minute of it. Technologically speaking though, my focus has shifted quite a bit. When I made the last entry to this blog, I was focused on digital media technologies and solutions, specifically client side video centric experiences utilizing technologies like Silverlight and video streaming using Smooth Streaming. While my interest in video continues, for the past 18 months or so I have been able to go back to working with and evangelizing my original “love” – the Windows Client platform, related developer technologies and application design and development. </font></p> <font size="3"></font>  <p align="justify"></p> <font size="3"></font>  <p align="justify"><font size="3">So for the next period of activity on this blog (for however long that might continue), I will be sharing my experiences of working with Windows 8, especially related to developing Metro style applications. I am more conversant with XAML,C# and C++ than I am with the HTML5, JavaScript family of technologies – so when it is about code (which it is mostly going to be) – my samples will be using the former set of languages and markup syntax. </font></p> <font size="3"></font>  <p align="justify"></p> <font size="3"></font>  <p align="justify"><font size="3">I look forward to sharing with you all as I myself learn more about this wonderful new platform !!</font></p> <font size="3"></font>  <p align="justify">&#160;</p> <font size="3"></font>  <p align="justify"><font size="3">Enjoy,</font></p> <font size="3"></font>  <p align="justify">&#160;</p> <font size="3"></font>  <p align="justify"><font size="3">- Jit</font></p>]]></content:encoded>
    </item>
    <item>
      <title>Silverlight Developer Vacancy at a Microsoft Media Service Partner – Interested ?</title>
      <link>https://docs.microsoft.com/archive/blogs/jitghosh/silverlight-developer-vacancy-at-a-microsoft-media-service-partner-interested</link>
      <pubDate>Mon, 07 Dec 2009 19:07:09 GMT</pubDate>
      <dc:creator><![CDATA[Jit Ghosh]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jitghosh/2009/12/07/silverlight-developer-vacancy-at-a-microsoft-media-service-partner-interested/</guid>
      <description><![CDATA[A premium media service partner Origin Digital (http://www.origindigital.com) who I work with...]]></description>
      <content:encoded><![CDATA[<p>A premium media service partner Origin Digital (<a href="http://www.origindigital.com">http://www.origindigital.com</a>) who I work with regularly is looking for a contracting position to be filled right away in northern NJ. They require superior Silverlight development skills. </p>  <p>&#160;</p>  <p>If interested please send your resume to <a href="mailto:tfrench@origindigital.com">tfrench@origindigital.com</a> directly. Please do not send them to me, or respond to this entry with your resume. </p>]]></content:encoded>
    </item>
    <item>
      <title>TimeCode Ranges from Windows Media Metadata</title>
      <link>https://docs.microsoft.com/archive/blogs/jitghosh/timecode-ranges-from-windows-media-metadata</link>
      <pubDate>Sat, 14 Nov 2009 11:46:23 GMT</pubDate>
      <dc:creator><![CDATA[Jit Ghosh]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jitghosh/2009/11/14/timecode-ranges-from-windows-media-metadata/</guid>
      <description><![CDATA[As a follow up to my previous post , I have updated the code to add the ability to extract SMPTE...]]></description>
      <content:encoded><![CDATA[<p>As a follow up to my previous <a href="http://blogs.msdn.com/jitghosh/archive/2009/11/07/windows-media-metadata-in-managed-code-and-by-extension-silverlight.aspx" target="_blank">post</a> , I have updated the code to add the ability to extract SMPTE timecode ranges.&#160; </p>  <p>&#160;</p>  <p>The WMMetadataReader class (in WMMetadataReader.h) now has a public method like below:</p>  <p><strong>System::Collections::Generic::List&lt;SMPTETimeCodeRange^&gt;^ GetSMPTERanges(String^ FilePath, int StreamIndex);</strong> </p>  <p>&#160;</p>  <p>This allows you to explicitly get the time code ranges, for a specific video stream in a WMV file. If you want all the metadata, the GetStreamMetadata() method on the same class, now also calls the above method internally, and returns the time code ranges packaged in the WMStream.TimeCodeRanges property. The SMPTETimeCodeRange type is shown below.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jitghosh/WindowsLiveWriter/TimeCodeRangesfromWindowsMediaMetadata_CF65/SMPTETimeCodeRange_4.png" original-url="http://blogs.msdn.com/blogfiles/jitghosh/WindowsLiveWriter/TimeCodeRangesfromWindowsMediaMetadata_CF65/SMPTETimeCodeRange_4.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="SMPTETimeCodeRange" border="0" alt="SMPTETimeCodeRange" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jitghosh/WindowsLiveWriter/TimeCodeRangesfromWindowsMediaMetadata_CF65/SMPTETimeCodeRange_thumb_1.png" original-url="http://blogs.msdn.com/blogfiles/jitghosh/WindowsLiveWriter/TimeCodeRangesfromWindowsMediaMetadata_CF65/SMPTETimeCodeRange_thumb_1.png" width="223" height="209" /></a> </p>  <p>&#160;</p>  <p>&#160;</p>  <p>Note that the RangeNumber property stores the index of the range, in case the file has multiple time code ranges. The Start and the End property are of type string, and exposes the time code in the standard “hh:mm:ss:ff” format. To manipulate these time codes, convert them to absolute times or to otherwise work with them, you can use the very excellent TimeCode class from <a href="http://blog.johndeutscher.com/2009/02/18/smpte-12m-timecode-support-for-silverlight/" target="_blank">John Deutscher</a>. </p>  <p>I have uploaded a new zip with the modified code <a href="http://cid-60bb739cbf5d117b.skydrive.live.com/self.aspx/Blog%20Attachments/WindowsMediaMetadataInManagedCode/ASFMetadata.zip" target="_blank">here</a>.</p>]]></content:encoded>
    </item>
    <item>
      <title>2nd Edition of our Silverlight Recipes book is now available…</title>
      <link>https://docs.microsoft.com/archive/blogs/jitghosh/2nd-edition-of-our-silverlight-recipes-book-is-now-available</link>
      <pubDate>Sat, 14 Nov 2009 09:36:50 GMT</pubDate>
      <dc:creator><![CDATA[Jit Ghosh]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jitghosh/2009/11/14/2nd-edition-of-our-silverlight-recipes-book-is-now-available/</guid>
      <description><![CDATA[&#160;  Rob and I worked hard on updating this for SL 3. If you do happen to purchase it, please...]]></description>
      <content:encoded><![CDATA[<p><a href="http://www.amazon.com/Silverlight-Recipes-Solution-Approach-Problem-Solution/dp/1430224355/ref=sr_1_3?ie=UTF8&amp;s=books&amp;qid=1258219709&amp;sr=8-3" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="SLRecipes" border="0" alt="SLRecipes" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jitghosh/WindowsLiveWriter/2ndEditionofourSilverlightRecipesbookisn_B161/SLRecipes_3.png" original-url="http://blogs.msdn.com/blogfiles/jitghosh/WindowsLiveWriter/2ndEditionofourSilverlightRecipesbookisn_B161/SLRecipes_3.png" width="187" height="244" /></a> </p>  <p>&#160;</p>  <p><a href="http://blogs.msdn.com/robcamer/" target="_blank">Rob</a> and I worked hard on updating this for SL 3. If you do happen to purchase it, please let us know if you like the format, the topics and any thoughts on how we can improve. We are about to start early work on the next edition for Silverlight 4 – your feedback will be highly appreciated.</p>  <p>Enjoy!!</p>]]></content:encoded>
    </item>
    <item>
      <title>Windows Media Metadata in Managed Code (and by extension - Silverlight)</title>
      <link>https://docs.microsoft.com/archive/blogs/jitghosh/windows-media-metadata-in-managed-code-and-by-extension-silverlight</link>
      <pubDate>Sat, 07 Nov 2009 16:34:00 GMT</pubDate>
      <dc:creator><![CDATA[Jit Ghosh]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jitghosh/2009/11/07/windows-media-metadata-in-managed-code-and-by-extension-silverlight/</guid>
      <description><![CDATA[I have encountered several inquiries about accessing the metadata embedded in Windows Media file...]]></description>
      <content:encoded><![CDATA[<P>I have encountered several inquiries about accessing the metadata embedded in Windows Media file headers from Silverlight. Unfortunately Silverlight does not expose this information out of the box. The only way you can access this is by utilizing the Windows Media Format SDK. </P>
<P>The Format SDK exposes its functionality in COM and requires you to write your code in C++. The nice thing about Visual C++, is that the C++ compiler allows you to author mixed mode assemblies i.e. one assembly containing both CLR types as well as code that is completely unmanaged, both authored in C++. Using this feature you could author a set of CLR targeted wrappers in C++ that interact with the Format SDK to expose select metadata to the managed world. Once you are done with that step, you can host this code in a Windows Service, a WCF service&nbsp;or some other form of server side component accessible over HTTP/TCP, and then have your Silverlight code interact with that service to get the metadata over the wire.</P>
<P>Attached is some code that I authored recently, that allows you to get started in that direction. You will find the code <STRONG><A href="http://cid-60bb739cbf5d117b.skydrive.live.com/self.aspx/Blog%20Attachments/WindowsMediaMetadataInManagedCode/ASFMetadata.zip" mce_href="http://cid-60bb739cbf5d117b.skydrive.live.com/self.aspx/Blog%20Attachments/WindowsMediaMetadataInManagedCode/ASFMetadata.zip">here</A></STRONG>.</P>
<P>In the rest of the post I will give you some details on the code. To better understand (and modify if necessary) the source, you may need some familiarity with authoring managed code with C++, the basics of COM in C++, and the Windows Media Format SDK.</P>
<P>Windows Media Files contain a lot of information in the header. The requests I have most often encountered are for the following:</P>
<UL>
<LI><STRONG>File Level Metadata Attributes and Per Stream Metadata Attributes</STRONG>: A Windows Media file can contain multiple streams of different types including video streams, audio streams, text streams etc. The header may contain metadata attributes defined for the entire file, as well for each individual stream in the file. </LI>
<LI><STRONG>Frame Rate for the video streams in the file</STRONG> </LI>
<LI><STRONG>Embedded SMPTE Timecode ranges for the video streams</STRONG> </LI></UL>
<P>In the attached solution, you will find three projects – the WMShim and the WMShimManagedClasses projects produce assemblies that you will need to reference in your code to extract the metadata from the file. The third project named WMShimTestHarness contains a simple WPF application that shows you how to extract metadata using the classes in the previous two assemblies.</P>
<P>The class diagram below shows&nbsp; the managed types that I use to define the metadata that the C++ code extracts (these types are defined in C#, in the MetadataDataContracts.cs file, in the WMShimManagedClasses project). Since the goal is to extract the metadata and have it be accessible remotely, these types are defined as data contracts to make them easily serializable.</P>
<P>&nbsp;<A href="http://cid-60bb739cbf5d117b.skydrive.live.com/self.aspx/Blog%20Attachments/WindowsMediaMetadataInManagedCode/ClassDiagram1.png" mce_href="http://cid-60bb739cbf5d117b.skydrive.live.com/self.aspx/Blog%20Attachments/WindowsMediaMetadataInManagedCode/ClassDiagram1.png">&nbsp;<IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=ClassDiagram1 border=0 alt=ClassDiagram1 src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jitghosh/WindowsLiveWriter/WindowsMediaMetadatainManagedCode_10E44/ClassDiagram1_b0ae3819-7348-487e-b8e9-c6bc31f02668.png" original-url="http://blogs.msdn.com/blogfiles/jitghosh/WindowsLiveWriter/WindowsMediaMetadatainManagedCode_10E44/ClassDiagram1_b0ae3819-7348-487e-b8e9-c6bc31f02668.png" width=872 height=433 mce_src="http://blogs.msdn.com/blogfiles/jitghosh/WindowsLiveWriter/WindowsMediaMetadatainManagedCode_10E44/ClassDiagram1_b0ae3819-7348-487e-b8e9-c6bc31f02668.png"> </A></P>
<P>The <STRONG>WMMetadataAttribute</STRONG> type defines a single metadata attribute and its value. The <STRONG>Name</STRONG> property contains the actual Windows Media metadata field name, and <STRONG>Label</STRONG> (where possible) contains a more friendly name explaining the field. The <STRONG>PropertyType</STRONG> contains string name for the CLR type that is best suited to represent the <STRONG>Value</STRONG> in managed code, and the <STRONG>Unit</STRONG> (where applicable) contains a string literal defining the unit of measurement(like bps for bitrate).</P>
<P>The<STRONG> WMStream</STRONG> type defines a stream, and the <STRONG>Attributes</STRONG> property returns a collection of <STRONG>WMMetadataAttribute</STRONG> instances for a specific stream or at the file level.</P>
<UL>
<LI><STRONG>StreamType</STRONG>&nbsp; contains one of the following values : “File”, “Video”, “Audio”, “Text”, “Script”, “Image”, “File Transfer” or “Unknown”. Each of these string literals are meant to represent a valid media type or subtype as described by the Format SDK (see <A title=http://msdn.microsoft.com/en-us/library/dd757532(VS.85).aspx href="http://msdn.microsoft.com/en-us/library/dd757532(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd757532(VS.85).aspx">http://msdn.microsoft.com/en-us/library/dd757532(VS.85).aspx</A> ) that can be used to define a stream type. The exceptions are the values “File” used to describe file level metadata (it is not actually a stream, I just reuse the WMStream type – too lazy to build another type to represent a file) and the value “Unknown” in case there is some weird stuff going on. </LI>
<LI><STRONG>FrameRate</STRONG> &amp; <STRONG>TimeCodeRanges</STRONG> are meaningful only for video streams </LI>
<LI>For file level metadata <STRONG>BitRate</STRONG>, <STRONG>FrameRate</STRONG>, <STRONG>TimeCodeRanges</STRONG> are not meaningful, and <STRONG>StreamIndex</STRONG> and <STRONG>StreamNumber</STRONG> are set to 0. </LI></UL>
<P>The primary C++ class that is central to the extraction functionality is named <STRONG>WMMetadataReader</STRONG>, defined in WMMetadataReader.h in the WMShim project. </P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P><PRE style="BORDER-BOTTOM: #cecece 1px solid; BORDER-LEFT: #cecece 1px solid; PADDING-BOTTOM: 5px; BACKGROUND-COLOR: #dadada; MIN-HEIGHT: 40px; PADDING-LEFT: 5px; WIDTH: 800px; PADDING-RIGHT: 5px; OVERFLOW: auto; BORDER-TOP: #cecece 1px solid; BORDER-RIGHT: #cecece 1px solid; PADDING-TOP: 5px"><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px"><SPAN style="COLOR: #0000ff">public</SPAN> ref <SPAN style="COLOR: #0000ff">class</SPAN> WMMetadataReader
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">  {
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">  <SPAN style="COLOR: #0000ff">public</SPAN>:
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">    WMMetadataReader(<SPAN style="COLOR: #0000ff">void</SPAN>){} 
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px"></PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">    <SPAN style="COLOR: #008000">/** 
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">    Get the number of streams in a media file
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px"></PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">    FilePath: Absolute file path 
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px"></PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">    Return: Stream count
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">    **/</SPAN>
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">    <SPAN style="COLOR: #0000ff">unsigned</SPAN> <SPAN style="COLOR: #0000ff">int</SPAN> GetStreamCount(String^ MediaFilePath);
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px"></PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">    <SPAN style="COLOR: #008000">/** 
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">    Get the metadata for a specific stream in a media file
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px"></PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">    FilePath: Absolute file path
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">    RFCLangIdentifier: string literal for the language identifier - "en-us" etc.
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">    StreamIdx: 1 based Stream Index, Pass 0 for file level metadata
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px"></PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">    Return: WMStream instance
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">    **/</SPAN>
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">    WMStream^ GetStreamMetadata(String^ FilePath,String^ RFCLangIdentifier, <SPAN style="COLOR: #0000ff">unsigned</SPAN> <SPAN style="COLOR: #0000ff">int</SPAN> StreamIdx);
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px"></PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">    <SPAN style="COLOR: #008000">/** 
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">    Get the framerate for a video stream
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px"></PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">    FilePath: Absolute file path 
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">    StreamIdx: 1 based Stream Index
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px"></PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">    Return: Frame rate, 0 for non-video streams
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">    **/</SPAN>
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">    <SPAN style="COLOR: #0000ff">double</SPAN> GetFrameRate(String^ FilePath, <SPAN style="COLOR: #0000ff">unsigned</SPAN> <SPAN style="COLOR: #0000ff">int</SPAN> StreamIndex);
</PRE><SPAN style="COLOR: #008000"><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px"></PRE></SPAN><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">  }</PRE></PRE>
<P>The code above shows the public methods on WMMetadataReader- the code comments will tell you what each method does. The easiest way to extract metadata for a media file is to call the GetStreamCount() method to get the # of streams, and then call GetStreamMetadata() once for each Stream. Remember to pass a 1 based StreamIdx value for the actual streams, and pass 0 to get the file level metadata. The C# code snippet below will give you an idea – as we loop through the streams and get the metadata for each, we just add them to a List named streams, that we will use eventually else where in our code.</P><PRE style="BORDER-BOTTOM: #cecece 1px solid; BORDER-LEFT: #cecece 1px solid; PADDING-BOTTOM: 5px; BACKGROUND-COLOR: #dadada; MIN-HEIGHT: 40px; PADDING-LEFT: 5px; WIDTH: 800px; PADDING-RIGHT: 5px; OVERFLOW: auto; BORDER-TOP: #cecece 1px solid; BORDER-RIGHT: #cecece 1px solid; PADDING-TOP: 5px"><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">WMShim.WMMetadataReader rdr = <SPAN style="COLOR: #0000ff">new</SPAN> WMShim.WMMetadataReader();
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px"><SPAN style="COLOR: #0000ff">int</SPAN> StreamCount = (<SPAN style="COLOR: #0000ff">int</SPAN>)rdr.GetStreamCount(FilePath);
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">List&lt;WMStream&gt; streams = <SPAN style="COLOR: #0000ff">new</SPAN> List&lt;WMStream&gt;(StreamCount + 1);
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px"><SPAN style="COLOR: #0000ff">for</SPAN> (<SPAN style="COLOR: #0000ff">int</SPAN> idx = 0; idx &lt;= StreamCount; idx++)
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">{
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">  streams.Add(rdr.GetStreamMetadata(ofd.FileName, "<SPAN style="COLOR: #8b0000">en-us</SPAN>", (<SPAN style="COLOR: #0000ff">uint</SPAN>)idx));
</PRE><PRE style="BACKGROUND-COLOR: #dadada; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 13px">}</PRE></PRE>
<P>Below are screen shots from the WPF test harness that is also in the attached code. The above C# code snippet is actually from that app. The two screen shot shows the video stream metadata and the file level metadata from a wmv file named Dust_To_Glory.wmv.</P>
<TABLE border=0 cellSpacing=0 cellPadding=2 width=435>
<TBODY>
<TR>
<TD vAlign=top width=218><A href="http://cid-60bb739cbf5d117b.skydrive.live.com/self.aspx/Blog%20Attachments/WindowsMediaMetadataInManagedCode/snap1.png" mce_href="http://cid-60bb739cbf5d117b.skydrive.live.com/self.aspx/Blog%20Attachments/WindowsMediaMetadataInManagedCode/snap1.png"><IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=snap1 border=0 alt=snap1 src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jitghosh/WindowsLiveWriter/WindowsMediaMetadatainManagedCode_10E44/snap1_3.png" original-url="http://blogs.msdn.com/blogfiles/jitghosh/WindowsLiveWriter/WindowsMediaMetadatainManagedCode_10E44/snap1_3.png" width=567 height=678 mce_src="http://blogs.msdn.com/blogfiles/jitghosh/WindowsLiveWriter/WindowsMediaMetadatainManagedCode_10E44/snap1_3.png"></A> </TD>
<TD vAlign=top width=215><A href="http://cid-60bb739cbf5d117b.skydrive.live.com/self.aspx/Blog%20Attachments/WindowsMediaMetadataInManagedCode/snap2.png" mce_href="http://cid-60bb739cbf5d117b.skydrive.live.com/self.aspx/Blog%20Attachments/WindowsMediaMetadataInManagedCode/snap2.png"><IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: 0px" title=snap2 border=0 alt=snap2 align=right src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jitghosh/WindowsLiveWriter/WindowsMediaMetadatainManagedCode_10E44/snap2_3.png" original-url="http://blogs.msdn.com/blogfiles/jitghosh/WindowsLiveWriter/WindowsMediaMetadatainManagedCode_10E44/snap2_3.png" width=567 height=678 mce_src="http://blogs.msdn.com/blogfiles/jitghosh/WindowsLiveWriter/WindowsMediaMetadatainManagedCode_10E44/snap2_3.png"></A> </TD></TR></TBODY></TABLE>
<P>If you look through the code you will notice that I do not supply any code to extract SMPTE Timecode ranges yet. I am still finalizing that code – I will have another post with an attachment here in a few days.</P>
<P>A few notes about the attached code:</P>
<P>- The code was built on 64 bit Windows 7 using Visual Studio 2008</P>
<P>- The WMShim C++ project was built targeting the x64 platform. So do make sure that you have the x64 compilers and tools for C++ installed as a part of your VS 2008 installation. If you want to retarget WMShim to a 32 bit platform instead, just change the platform to Win32 in your Project|Properties dialog and recompile.</P>
<P>- If you want to run the code on Windows Server, you will need to enable the “Desktop Experience” feature. This puts the necessary windows media components on the server (they are not there by default – unlike the Windows client desktop OS platforms).</P>
<P><STRONG></STRONG></P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P>Until the next post then !!</P>]]></content:encoded>
    </item>
    <item>
      <title>IIS Media Services 3.0 Released!!</title>
      <link>https://docs.microsoft.com/archive/blogs/jitghosh/iis-media-services-3-0-released</link>
      <pubDate>Tue, 13 Oct 2009 06:56:12 GMT</pubDate>
      <dc:creator><![CDATA[Jit Ghosh]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jitghosh/2009/10/13/iis-media-services-3-0-released/</guid>
      <description><![CDATA[The IIS Media Services team just released the IIS Media Services 3.0 suite of technologies. This is...]]></description>
      <content:encoded><![CDATA[<p>The IIS Media Services team just released the IIS Media Services 3.0 suite of technologies. This is pretty big release for us – with Live Smooth Streaming possibly being the coolest part of it. If you are watching the NBC Sunday Night Football on the web, then you have seen Live Smooth Streaming in action. You you have not – you must check it out <a href="http://nbcsports.msnbc.com/id/26393211">here</a>.</p>  <p>To install and try out IIS Media Services 3.0 , download it via the Web Platform Installer <a href="http://www.iis.net/media">here</a>.</p>  <p>So what’s in IIS Media Services 3.0 ?</p>  <p><a href="http://learn.iis.net/page.aspx/627/smooth-streaming/">Smooth Streaming</a> and <a href="http://learn.iis.net/page.aspx/628/live-smooth-streaming/">Live Smooth Streaming</a> for adaptive streaming of media over HTTP</p>  <p><a href="http://learn.iis.net/page.aspx/630/bit-rate-throttling/">Bit Rate Throttling</a> for controlling bandwidth spent in delivering media</p>  <p><a href="http://learn.iis.net/page.aspx/629/web-playlists/">Web Playlists</a> for controlled and sequenced delivery of media</p>  <p><a href="http://blogs.iis.net/vsood/archive/2009/10/12/iis-advanced-logging-1-0-released.aspx">Advanced Logging</a> for logging both on the client and the server</p>  <p><a href="http://learn.iis.net/page.aspx/621/edge-caching-for-media-delivery/">Application Request Routing</a> to provide edge caching.</p>  <p>&#160;</p>  <p>Another notable bit of software that was just put out there (albeit still in beta) is the <a href="http://blogs.iis.net/vsood/archive/2009/10/09/iis-smooth-streaming-player-development-kit-1-0-beta-1-released.aspx">Smooth Streaming Player Development Kit</a>. If you are a Silverlight developer, and are looking to extend the same programming model of the Silverlight MediaElement to the world of Smooth Streaming, then the SmoothStreamingMediaElement (SSME) component contained in this kit will make your life really easy. The SSME exposes a ton of additional rich functionality to take advantage of the Smooth Streaming platform and file formats – do check it out !!</p>  <p>&#160;</p>  <p>I will be blogging more on some of this stuff in the coming weeks – ta for now !!</p>]]></content:encoded>
    </item>
    <item>
      <title>Silverlight 3 is now officially released!!</title>
      <link>https://docs.microsoft.com/archive/blogs/jitghosh/silverlight-3-is-now-officially-released</link>
      <pubDate>Fri, 10 Jul 2009 13:25:49 GMT</pubDate>
      <dc:creator><![CDATA[Jit Ghosh]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jitghosh/2009/07/10/silverlight-3-is-now-officially-released/</guid>
      <description><![CDATA[WooHoo!! Go read more about it in Scott’s blog here. I will be positing my own experiences and...]]></description>
      <content:encoded><![CDATA[<p>WooHoo!! Go read more about it in Scott’s blog <a href="http://weblogs.asp.net/scottgu/archive/2009/07/10/silverlight-3-released.aspx">here</a>. I will be positing my own experiences and thoughts in the coming days. </p>  <p>&#160;</p>  <p>Learn more and download at <a title="http://silverlight.net/GetStarted/" href="http://silverlight.net/GetStarted/">http://silverlight.net/GetStarted/</a></p>  <p>&#160;</p>  <p>Enjoy!!</p>]]></content:encoded>
    </item>
    <item>
      <title>Architect Council Webcasts</title>
      <link>https://docs.microsoft.com/archive/blogs/jitghosh/architect-council-webcasts</link>
      <pubDate>Tue, 26 May 2009 21:50:11 GMT</pubDate>
      <dc:creator><![CDATA[Jit Ghosh]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jitghosh/2009/05/26/architect-council-webcasts/</guid>
      <description><![CDATA[The Microsoft Patterns &amp; Practices team, in collaboration with members of the Microsoft...]]></description>
      <content:encoded><![CDATA[<p>The Microsoft Patterns &amp; Practices team, in collaboration with members of the Microsoft Developer Evangelism team (my uber team that is) is putting together a series of webcasts titled “Pragmatic Patterns for Architects” . I would vote “must attend” for these. Below are more details:</p>  <p>&#160;</p>  <h3>ARCHITECT COUNCIL | Pragmatic Patterns for Architects</h3>  <p>“Cloud computing will supersede traditional IT”, “SOA will enable business agility”, “my way or the highway”, etc. We’ve all heard this type of proclamations before, as many look to the “next big things” in technology to exact sweeping changes and solve many issues; truth is, <b>technologies and tools aren’t as instrumental in influencing progress, as the design and discipline in applying them to specific issues.</b> When used appropriately, technologies and tools can be powerful enablers that bring about change.</p>  <p>One of the things we hear a lot working with the community is a desire for more guidance about how to use the technology instead of just talking about features and functions.&#160; <b>To address this, our team has put together a series of live webcasts on June 9<sup>th</sup> – 11<sup>th</sup> which will focus on guidance and patterns for some of today’s hottest topics.&#160; </b></p>  <p><b></b></p>  <p><b>DAY 1 – June 9, 2009 at Noon PST</b></p>  <p><b>Patterns for Moving to the Cloud</b></p>  <p><i>Larry Clarkin &amp; Wade Wegner</i></p>  <p>Everything that you read these days seems to suggest that you should be moving to the cloud. But where do you start? Which applications and services should be moving to the cloud? How do you build the bridge between on-premises and the cloud? And more importantly, what should you be looking out for along the way? In this session, learn architectural patterns and factors for moving to the cloud. Based on real-world projects, the session explores building block services, patterns for exposing applications, and challenges involving identity, data federation, and management. This session provides the tools and knowledge to determine whether cloud computing is right for you, and where to start.</p>  <p><b>DAY 2 – June 10, 2009 at Noon PST</b></p>  <p><b>Building Silverlight &amp; WPF Applications with Prism<i> </i></b></p>  <p><i>David Hill</i></p>  <p>Prism provides guidance, via design patterns, to help you build robust, flexible and modular Silverlight and WPF applications. These patterns support unit testing, separation of concerns, loose coupling and the ability to share application logic between Silverlight and WPF applications. Prism includes source code for the library itself, extensive documentation, and a sample application that shows how the patterns work together in a real-world application. It also includes a Visual Studio add-in to help you easily share code between WPF and Silverlight. This session provides an overview of Prism, and shows how you can use Prism to design and build composite Silverlight applications.</p>  <p><b>DAY 3 – June 11, 2009 at Noon PST</b></p>  <p><b>Patterns for Parallel Computing</b></p>  <p><i>David Chou</i></p>  <p>With recent advances in cloud computing, service-oriented architectures, distributed computing, server virtualization, multi-core processors; we are now seeing parallel computing techniques being implemented across the spectrum. It’s moving towards mainstream applications such as internet-scale web applications, massive data processing, graphics rendering, but the myriad of choices also present a number of questions on when and how to utilize parallel computing. This session explores the architectural patterns and trade-offs between different forms of parallel computing including: approaches for utilizing them to improve application performance, optimizing the use of existing infrastructure, and applying concurrency towards day-to-day enterprise information processing needs.</p>  <h3>WEBCAST AGENDA</h3>  <table border="1" cellspacing="0" cellpadding="0"><tbody>     <tr>       <td valign="top" width="121">         <p><b> 11:45 AM (PST)</b></p>       </td>        <td valign="top" width="216">         <p><b>Open for Dial-in </b><b></b></p>       </td>     </tr>      <tr>       <td valign="top" width="121">         <p><b> 12:00 PM (PST)</b></p>       </td>        <td valign="top" width="216">         <p><b>Day’s Content</b></p>       </td>     </tr>      <tr>       <td valign="top" width="121">         <p><b> 12:50 PM (PST)</b></p>       </td>        <td valign="top" width="216">         <p><b>Q&amp;A</b></p>       </td>     </tr>      <tr>       <td valign="top" width="121">         <p><b> 01:00 PM (PST)</b></p>       </td>        <td valign="top" width="216">         <p><b>Raffle and Close</b></p>       </td>     </tr>   </tbody></table>  <h3>REGISTER </h3>  <h3>To register, please click on the link below for each day: </h3>  <h3></h3>  <table border="1" cellspacing="0" cellpadding="0"><tbody>     <tr>       <td valign="top" width="10%">&#160;</td>        <td valign="top" width="16%">         <p><b>Title</b></p>       </td>        <td valign="top" width="13%">         <p><b>Event ID</b></p>       </td>        <td valign="top" width="59%">         <p><b>Link to Register</b></p>       </td>     </tr>      <tr>       <td valign="top" width="10%">         <p><b>Day 1 6/9/09</b></p>       </td>        <td valign="top" width="16%">         <p>Patterns for Moving to the Cloud</p>       </td>        <td valign="top" width="13%">         <p>1032416875 </p>       </td>        <td valign="top" width="59%">         <p><a href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032416875&amp;EventCategory=2&amp;culture=en-US&amp;CountryCode=US">http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032416875&amp;EventCategory=2&amp;culture=en-US&amp;CountryCode=US</a></p>       </td>     </tr>      <tr>       <td valign="top" width="10%">         <p><b>Day 2 6/10/09</b></p>       </td>        <td valign="top" width="16%">         <p>Building Silverlight &amp; WPF Applications with Prism<i> </i></p>       </td>        <td valign="top" width="13%">         <p>1032416983</p>       </td>        <td valign="top" width="59%">         <p><a href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032416983&amp;EventCategory=2&amp;culture=en-US&amp;CountryCode=US">http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032416983&amp;EventCategory=2&amp;culture=en-US&amp;CountryCode=US</a></p>       </td>     </tr>      <tr>       <td valign="top" width="10%">         <p><b>Day 3 6/11/09</b></p>       </td>        <td valign="top" width="16%">         <p>Patterns for Parallel Computing</p>       </td>        <td valign="top" width="13%">         <p>1032416984</p>       </td>        <td valign="top" width="59%">         <p><a href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032416984&amp;EventCategory=2&amp;culture=en-US&amp;CountryCode=US">http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032416984&amp;EventCategory=2&amp;culture=en-US&amp;CountryCode=US</a></p>       </td>     </tr>   </tbody></table>  <h3></h3>  <h3><i>We will email you with the LIVEMEETING information and log-in detail a few days before the actual event. We will use the email address you provide in the registration. Thanks!</i></h3>  <h3>SPEAKER BIOS</h3>  <p><b>Larry Clarkin - SR ARCHITECT EVANGELIST, Microsoft</b></p>  <p><b></b></p>  <p><b>Wade Wegner - SR ARCHITECT EVANGELIST, Microsoft</b></p>  <p>Architect in the Developer &amp; Platform Evangelism division at Microsoft, tasked to collaborate with organizations in the advanced and emergent areas of enterprise architecture, SOA, Web 2.0, and cloud computing, as well as to support decision makers on defining technology adoption strategies. You can reach Wade at his blog <a href="http://www.architectingwith.net/">http://www.architectingwith.net/</a> or through twitter at <a href="https://twitter.com/wadewegner">https://twitter.com/wadewegner</a>.</p>  <p><b></b></p>  <p><b>David Hill – PRINCIPAL ARCHITECT, Microsoft Patterns &amp; Practices Team</b></p>  <p><b>David Chou – ARCHITECT, Microsoft</b></p>  <p>Architect in the Developer &amp; Platform Evangelism organization at Microsoft, focused on collaborating with enterprises and organizations in many areas such as cloud computing, SOA, Web, RIA, distributed systems, security, etc., and supporting decision makers on defining evolutionary strategies in architecture. Drawing on experiences from his previous jobs at Sun Microsystems and Accenture, David enjoys helping customers create value from using objective and pragmatic approaches to define IT strategies, roadmaps, and solution architectures.</p>]]></content:encoded>
    </item>
    <item>
      <title>MTV &amp; Silverlight 3 at NAB 2009</title>
      <link>https://docs.microsoft.com/archive/blogs/jitghosh/mtv-silverlight-3-at-nab-2009</link>
      <pubDate>Mon, 27 Apr 2009 18:37:02 GMT</pubDate>
      <dc:creator><![CDATA[Jit Ghosh]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jitghosh/2009/04/27/mtv-silverlight-3-at-nab-2009/</guid>
      <description><![CDATA[NAB 2009 rocked !!  It was exhausting working the booth, standing on my feet all day, talking to so...]]></description>
      <content:encoded><![CDATA[<p>NAB 2009 rocked !!</p>  <p>It was exhausting working the booth, standing on my feet all day, talking to so many people over the course of four days, but it was so exciting at the same time. We showed many cool things at the Microsoft booth, including Silverlight 3, IIS 7 Smooth Streaming, our Fast search engine, our Advertising solutions, a ton of solutions from our partners, and last but not the least – some very interesting open source starter kits that my team built, and that I will blog about in coming posts. </p>  <p>But I am especially excited about a specific application I was directly involved in. </p>  <p>Viacom/<a href="http://www.mtv.com/">MTV</a> announced a web based Digital Asset Management Workflow application completely built in Silverlight 3 (of course using the beta bits for now) and .Net 3.5. This is very cool, not just because it is an early adoption of Silverlight 3, but because :</p>  <p>- It is a great proof point that Silverlight is not just for consumer facing scenarios on the web, but is equally suited for more rigorous applications in broadcast media workflow.</p>  <p>- It is one of the first production applications to use the h.264 playback capabilities being enabled in Silverlight 3. MTV creates all their proxies as QuickTime .mov files, with the essence encoded using h.264 compression, either in SD or in HD resolutions. Since QT is essentially a variant of the MP4 container structure, and SL 3 supports parsing MP4 and decoding h.264 natively, we could playback all of MTV’s QT content natively in SL3, without any further transcoding. This was a huge win-win for all involved both from a time and cost perspective.</p>  <p>I provided some of the necessary technology guidance to a joint team from Microsoft, <a href="http://www.vertigo.com/">Vertigo</a> and MTV in implementing the solution. </p>  <p>You can read more about the general press release from Viacom CIO Joe Simon <a href="http://www.microsoft.com/serviceproviders/resources/viacom-making-content-work.mspx">here</a> and about the specific case study <a href="http://www.microsoft.com/casestudies/casestudy.aspx?casestudyid=4000004088">here</a>.</p>]]></content:encoded>
    </item>
  </channel>
</rss>