<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="http://blog.desre.org/feed/rss2/xslt" ?><rss version="2.0"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
  <title>Impedance Mismatch</title>
  <link>http://blog.desre.org/</link>
  <atom:link href="http://blog.desre.org:82/feed/rss2" rel="self" type="application/rss+xml"/>
  <description></description>
  <language>en</language>
  <pubDate>Tue, 18 Jun 2013 06:12:27 +0200</pubDate>
  <copyright></copyright>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Dotclear</generator>
  
    
  <item>
    <title>jetpack goes mobile</title>
    <link>http://blog.desre.org/post/2009/12/11/jetpack-goes-mobile</link>
    <guid isPermaLink="false">urn:md5:625727933a94da5fa4cc27dc2f903ed2</guid>
    <pubDate>Fri, 11 Dec 2009 16:18:00 +0100</pubDate>
    <dc:creator>Fabrice</dc:creator>
        <category>mozilla</category>    
    <description>    &lt;p&gt;&lt;a hreflang=&quot;en&quot; href=&quot;https://mozillalabs.com/jetpack/&quot;&gt;Jetpack&lt;/a&gt; is a
project from Mozilla Labs that aims to ease the development of Firefox add-ons
using web technologies without the complexity of the classical add-on model.
Jetpacks are lightweight extensions, perfect for simple tasks like enhancing
the browsing experience on a site. They are very similar to Google Chrome
extensions, only better ;-)&lt;/p&gt;
&lt;p&gt;Currently available for Firefox and experimentally for Thunderbird, Jetpack
is not yet ready for Firefox Mobile aka Fennec. So I took a look at adding
support for Fennec in Jetpack since lightweight extensions seem a perfect fit
for a mobile browser.&lt;/p&gt;
&lt;p&gt;The port is not complete yet, because some UI features are unavailable in
Fennec (sidebars and menus for instance). I only adapted the statusbar support,
adding an area at the bottom of the tabstrip.&lt;/p&gt;
&lt;h2&gt;Guided Tour&lt;/h2&gt;
&lt;p&gt;Once you have this &lt;a href=&quot;http://blog.desre.org/public/jetpack/jetpack-0.6.3-all.xpi&quot;&gt;custom
Jetpack version&lt;/a&gt; installed, you'll find the entry point to the configuration
and Jetpack gallery in the Add-ons panel :&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://blog.desre.org/public/jetpack/screenshot_003.png&quot;&gt;&lt;img title=&quot;screenshot_003.png, déc. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.desre.org/public/jetpack/.screenshot_003_s.jpg&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Choosing &amp;quot;Configure Jetpack&amp;quot; opens the about:jetpack page in a new tab.
Clicking on the logo also leads to the gallery.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://blog.desre.org/public/jetpack/screenshot_004.png&quot;&gt;&lt;img title=&quot;screenshot_004.png, déc. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.desre.org/public/jetpack/.screenshot_004_s.jpg&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Let's now choose an add-on in the gallery :&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://blog.desre.org/public/jetpack/screenshot_007.png&quot;&gt;&lt;img title=&quot;screenshot_007.png, déc. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.desre.org/public/jetpack/.screenshot_007_s.jpg&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Select &amp;quot;Let me Install this unreviewed Jetpack&amp;quot; and &amp;quot;INSTALL JETPACK&amp;quot; to
install TagCounter :&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://blog.desre.org/public/jetpack/screenshot_006.png&quot;&gt;&lt;img title=&quot;screenshot_006.png, déc. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.desre.org/public/jetpack/.screenshot_006_s.jpg&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Hooray !&lt;/p&gt;
&lt;p&gt;You can also install Jetpacks published elsewhere, like &lt;a href=&quot;http://people.mozilla.org/%7Ejohnath/jetpacks/bugzilla-tweaks.html&quot;&gt;this
one&lt;/a&gt; (a bugzilla reading enhancer) :&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://blog.desre.org/public/jetpack/screenshot_010.png&quot;&gt;&lt;img title=&quot;screenshot_010.png, déc. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.desre.org/public/jetpack/.screenshot_010_s.jpg&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Since this Jetpack comes from an untrusted source, you need to opt-in before
installing :&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://blog.desre.org/public/jetpack/screenshot_011.png&quot;&gt;&lt;img title=&quot;screenshot_011.png, déc. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.desre.org/public/jetpack/.screenshot_011_s.jpg&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://blog.desre.org/public/jetpack/screenshot_012.png&quot;&gt;&lt;img title=&quot;screenshot_012.png, déc. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.desre.org/public/jetpack/.screenshot_012_s.jpg&quot; /&gt;&lt;br /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Then we can check that our Jetpacks (called &amp;quot;Features&amp;quot;) are available :&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://blog.desre.org/public/jetpack/screenshot_014.png&quot;&gt;&lt;img title=&quot;screenshot_014.png, déc. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.desre.org/public/jetpack/.screenshot_014_s.jpg&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Of course we can now put them to use ! TagCounter added a small clickable
icon in the status bar. Just select it to get a nice graphic in a new tab :&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://blog.desre.org/public/jetpack/screenshot_008.png&quot;&gt;&lt;img title=&quot;screenshot_008.png, déc. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.desre.org/public/jetpack/.screenshot_008_s.jpg&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://blog.desre.org/public/jetpack/screenshot_009.png&quot;&gt;&lt;img title=&quot;screenshot_009.png, déc. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.desre.org/public/jetpack/.screenshot_009_s.jpg&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It worked !&lt;/p&gt;
&lt;p&gt;The Bugzilla Feature doesn't add anything to the status bar : it listens to
page loads and adds useful information on the fly :&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://blog.desre.org/public/jetpack/screenshot_013.png&quot;&gt;&lt;img title=&quot;screenshot_013.png, déc. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.desre.org/public/jetpack/.screenshot_013_s.jpg&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Next steps&lt;/h2&gt;
This is a work in progress, and a lot still needs to be done, both on the
Fennec side and in Jetpack :&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Lots of UI polish, like finding a way in Fennec UI to support sidebars. And
the current status bar is not really touch-friendly yet.&lt;/li&gt;
&lt;li&gt;Jetpack relies on FUEL (or on STEEL in Thunderbird) which is lacking in
Fennec. I had to include a stripped down version implementing just what Jetpack
needed.&lt;/li&gt;
&lt;li&gt;Refactor some parts of Jetpack code to have a cleaner support of different
browsers (the tab browser in Fennec is not the same as the one in
Firefox).&lt;/li&gt;
&lt;li&gt;I was surprised to find that Jetpack was not localized at all.&lt;/li&gt;
&lt;/ul&gt;
And of course, testing, testing and some more testing !&lt;br /&gt;
&lt;br /&gt;</description>
    
    
    
          <comments>http://blog.desre.org/post/2009/12/11/jetpack-goes-mobile#comment-form</comments>
      <wfw:comment>http://blog.desre.org/post/2009/12/11/jetpack-goes-mobile#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.desre.org/feed/atom/comments/467190</wfw:commentRss>
      </item>
    
  <item>
    <title>Using GStreamer with js-ctypes</title>
    <link>http://blog.desre.org/post/2009/11/19/Using-GStreamer-with-js-ctypes</link>
    <guid isPermaLink="false">urn:md5:86bf64a310b9c480aad93e81c92b1b04</guid>
    <pubDate>Thu, 19 Nov 2009 15:08:00 +0100</pubDate>
    <dc:creator>Fabrice</dc:creator>
        <category>hackability</category><category>mozilla</category>    
    <description>    &lt;p&gt;For the next version of my Twitter client (&lt;a href=&quot;https://addons.mozilla.org/firefox/addon/12191&quot;&gt;GraffiTwit&lt;/a&gt;) I wanted to
add support for camera capture since GraffiTwit already provides a drawing
interface. On Linux the GStreamer framework is used to build pipelines of
media-handling components. Doing a single frame capture is a simple pipeline,
like this one (on a desktop linux box) :&lt;/p&gt;
&lt;pre&gt;
v4l2src ! ffmpegcolorspace ! pngenc ! filesink location=test.png
&lt;/pre&gt;
You can test it using the gst-launch tool from the gstreamer-tools package, or
use it from a C program, with two further options :&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;create each element (v4l2src, ffmpegcolorspace, etc.) and chain them
together in a bin to create the pipeline (see the &lt;a href=&quot;http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-helloworld.html&quot;&gt;
hello_world&lt;/a&gt; exemple for details).&lt;/li&gt;
&lt;li&gt;use the &lt;a href=&quot;http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstParse.html&quot;&gt;
gst_parse()&lt;/a&gt; function to create a pipeline from the same syntax used with
gst-launch.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The second method does not allow as much configuration as the first one but
is sufficient when you only need to run a relatively simple pipeline.&lt;/p&gt;
&lt;p&gt;Now we need a way to call gst_parse() from Mozilla. There is some &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=451674&quot;&gt;ongoing work&lt;/a&gt; to add
GStreamer based support to video and image tags, but since it has not landed
yet, we need to find another solution. Here we have three options :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;use nsIProcess to launch gst-launch. This is kind of ugly, and will likely
fail as gst-launch is not installed by default on many linux
distributions.&lt;/li&gt;
&lt;li&gt;write a C++ XPCOM component to encapsulate GStreamer functionnality. Not
difficult, but really not funny.&lt;/li&gt;
&lt;li&gt;use js-ctypes to access the GStreamer library directly from javascript
land.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&quot;https://developer.mozilla.org/en/JavaScript_code_modules/ctypes.jsm&quot;&gt;js-ctypes&lt;/a&gt;
is a Mozilla code module that makes it possible to call C-compatible foreign
library functions from javaScript code. This means that you don't need to write
your own XPCOM wrapper to access low-level code in your javascript code. There
are some limitations on what kind of parameters you can send and receive, so
that may or not fit your needs.&lt;/p&gt;
&lt;p&gt;It our case, we need to access the following functions from
libgstreamer-0.10.so : gst_init(), gst_parse_launch(), gst_element_set_state,
gst_element_get_state().&lt;/p&gt;
Here's the javascript code needed :&lt;br /&gt;
&lt;pre&gt;
Components.utils.import(&amp;quot;resource://gre/modules/ctypes.jsm&amp;quot;);&lt;br /&gt;
const GST_STATE_NULL                = 1;&lt;br /&gt;
const GST_STATE_PLAYING             = 4;&lt;br /&gt;
const GST_STATE_CHANGE_ASYNC        = 2;&lt;br /&gt;
let gstreamer = ctypes.open(&amp;quot;libgstreamer-0.10.so.0&amp;quot;);&lt;br /&gt;
let gst_init = gstreamer.declare(&amp;quot;gst_init&amp;quot;, ctypes.default_abi, ctypes.void_t, &lt;br /&gt;
                                 ctypes.int32_t, ctypes.int32_t);&lt;br /&gt;
let gst_parse_launch = gstreamer.declare(&amp;quot;gst_parse_launch&amp;quot;, ctypes.default_abi, ctypes.int32_t,&lt;br /&gt;
                                         ctypes.string, ctypes.int32_t);&lt;br /&gt;
let gst_element_set_state = gstreamer.declare(&amp;quot;gst_element_set_state&amp;quot;, ctypes.default_abi, ctypes.int32_t,&lt;br /&gt;
                                              ctypes.int32_t, ctypes.int32_t);&lt;br /&gt;
let gst_element_get_state = gstreamer.declare(&amp;quot;gst_element_get_state&amp;quot;, ctypes.default_abi, ctypes.int32_t,&lt;br /&gt;
                                              ctypes.int32_t, ctypes.int32_t, ctypes.int32_t, ctypes.int64_t);&lt;br /&gt;
gst_init(0, 0);&lt;br /&gt;
let pipeline = gst_parse_launch(&amp;quot;v4l2src ! ffmpegcolorspace ! pngenc ! filesink location=/tmp/test.png&amp;quot;, 0);&lt;br /&gt;
let ret = gst_element_set_state(pipeline, GST_STATE_PLAYING);&lt;br /&gt;
if (ret == GST_STATE_CHANGE_ASYNC) { // wait for state change to happen&lt;br /&gt;
  ret = gst_element_get_state(pipeline, 0, 0, -1);&lt;br /&gt;
  gst_element_set_state(pipeline, GST_STATE_NULL);&lt;br /&gt;
  gstreamer.close();&lt;br /&gt;
}
&lt;/pre&gt;
&lt;p&gt;And that's all ! Less than 21 lines of javascript.&lt;/p&gt;
&lt;p&gt;When the API sends or expects a pointer to an element, we use an opaque
int32_t datatype. This is a hack, but future version of js-ctypes are expected
to have better type support.&lt;/p&gt;
&lt;p&gt;Even if in our case this is not as good as having real support, this shows
that js-ctypes is part of the hackability of the browser. For instance, you can
use it in Jetpack...&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.desre.org/post/2009/11/19/Using-GStreamer-with-js-ctypes#comment-form</comments>
      <wfw:comment>http://blog.desre.org/post/2009/11/19/Using-GStreamer-with-js-ctypes#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.desre.org/feed/atom/comments/460936</wfw:commentRss>
      </item>
    
  <item>
    <title>Welcome !</title>
    <link>http://blog.desre.org/post/2009/09/02/first</link>
    <guid isPermaLink="false">urn:md5:ead7b2a20fe0963ff0769ba8d6588bc6</guid>
    <pubDate>Wed, 02 Sep 2009 18:04:00 +0000</pubDate>
    <dc:creator>Fabrice</dc:creator>
            
    <description>    &lt;p&gt;Hello world ;-)&lt;/p&gt;</description>
    
    
    
      </item>
    
</channel>
</rss>