jamesh is currently certified at Master level.

Name: James Henstridge
Member since: N/A
Last Login: 2010-02-05 06:10:07

FOAF RDF Share This

Homepage: http://www.jamesh.id.au/

Notes:

A GNOME hacker. Author of gnorpm, gnome-python, libglade, pygtk and others. Former maintainer of dia. Contributor to various gnome packages.

[New diary entry] [Planet Gnome] [Planet Ubuntu] [Technorati Profile]

Projects

Articles Posted by jamesh

Recent blog entries by jamesh

Syndication: RSS 2.0

4 Dec 2009 »

Bagels

I made some bagels last night.  It was my second time using the recipe, so things went pretty well.  The boiling process gives the crust an interesting chewy texture I haven’t seen with other bread recipes I’ve tried.

I used this recipe (half wholemeal flour, half white), but made 12 slightly larger bagels rather than the 18 the recipe suggested.  I increased the boiling and baking time a bit to compensate.  They weren’t particularly difficult to make, but the boiling process was fairly time consuming, since I could only fit three at a time into the pot.

Bagels

Syndicated 2009-12-04 04:01:20 from James Henstridge

27 Oct 2009 »

Launchpad code scanned by Ohloh

Today Ohloh finished importing the Launchpad source code and produced the first source code analysis report.  There seems to be something fishy about the reported line counts (e.g. -3,291 lines of SQL), but the commit counts and contributor list look about right.  If you’re interested in what sort of effort goes into producing an application like Launchpad, then it is worth a look.

Syndicated 2009-10-27 08:48:18 from James Henstridge

24 Jul 2009 »

Seeking in Transcoded Streams with Rygel

When looking at various UPnP media servers, one of the features I wanted was the ability to play back my music collection through my PlayStation 3.  The complicating factor is that most of my collection is encoded in Vorbis format, which is not yet supported by the PS3 (at this point, it doesn’t seem likely that it ever will).

Both MediaTomb and Rygel could handle this to an extent, transcoding the audio to raw LPCM data to send over the network.  This doesn’t require much CPU power on the server side, and only requires 1.4 Mbit/s of bandwidth, which is manageable on most home networks.  Unfortunately the only playback controls enabled in this mode are play and stop: if you want to pause, fast forward or rewind then you’re out of luck.

Given that Rygel has a fairly simple code base, I thought I’d have a go at fixing this.  The first solution I tried was the one I’ve mentioned a few times before: with uncompressed PCM data file offsets can be easily converted to sample numbers, so if the source format allows time based seeking, we can easily satisfy byte range requests.

I got a basic implementation of this working, but it was a little bit jumpy and not as stable as I’d like.  Before fully debugging it, I started looking at the mysterious DLNA options I’d copied over to get things working.  One of those was the “DLNA operation”, which was set to “range” mode.  Looking at the GUPnP header files, I noticed there was another value named “timeseek”.  When I picked this option, the HTTP requests from the PS3 changed:

GET /... HTTP/1.1
Host: ...
User-Agent: PLAYSTATION 3
Connection: Keep-Alive
Accept-Encoding: identity
TimeSeekRange.dlna.org: npt=0.00-
transferMode.dlna.org: Streaming

The pause, rewind and fast forward controls were now active, although only the pause control actually worked properly. After fast forwarding or rewinding, the PS3 would issue another HTTP request with the TimeSeekRange.dlna.org header specifying the new offset, but the playback position would reset to the start of the track when the operation completed. After a little more experimentation, I found that the playback position didn’t reset if I included TimeSeekRange.dlna.org in the response headers. Of course, I was still sending back the beginning of the track at this point but the PS3 acted as though it was playing from the new point in the song.

It wasn’t much more work to update the GStreamer calls to seek to the requested offset before playback and things worked pretty much as well as for non-transcoded files.  And since this solution didn’t involve byte offsets, it also worked for Rygel’s other transcoders.  It even worked to an extent with video files, but the delay before playback was a bit too high to make it usable — fixing that would probably require caching the GStreamer pipeline between HTTP requests.

Thoughts on DLNA

While it can be fun to reverse engineer things like this, it was a bit annoying to only be able to find out about the feature by reading header files written by people with access to the specification.  I can understand having interoperability and certification requirements to use the DLNA logo, but that does not require that the specifications be private.

As well as keeping the specification private, it feels like some aspects have been intentionally obfuscated, using bit fields represented in both binary and hexadecimal string representations inside the resource’s protocol info.  This might seem reasonable if it was designed for easy parsing, but you need to go through two levels of XML processing (the SOAP envelope and then the DIDL payload) to get to these flags.  Furthermore, the attributes inherited from the UPnP MediaServer specifications are all human readable so it doesn’t seem like an arbitrary choice.

On the bright side, I suppose we’re lucky they didn’t use cryptographic signatures to lock things down like Apple has with some of their protocols and file formats.

Syndicated 2009-07-24 08:46:18 from James Henstridge

6 Jul 2009 »

Watching iView with Rygel

One of the features of Rygel that I found most interesting was the external media server support.  It looked like an easy way to publish information on the network without implementing a full UPnP/DLNA media server (i.e. handling the UPnP multicast traffic, transcoding to a format that the remote system can handle, etc).

As a small test, I put together a server that exposes the ABC’s iView service to UPnP media renderers.  The result is a bit rough around the edges, but the basic functionality works.  The source can be grabbed using Bazaar:

bzr branch lp:~jamesh/+junk/rygel-iview

It needs Python, Twisted, the Python bindings for D-Bus and rtmpdump to run.  The program exports the guide via D-Bus, and uses rtmpdump to stream the shows via HTTP.  Rygel then publishes the guide via the UPnP media server protocol and provides MPEG2 versions of the streams if clients need them.

There are still a few rough edges though.  The video from iView comes as 640×480 with a 16:9 aspect ratio so has a 4:3 pixel aspect ratio, but there is nothing in the video file to indicate this (I am not sure if flash video supports this metadata).

Getting Twisted and D-Bus to cooperate

Since I’d decided to use Twisted, I needed to get it to cooperate with the D-Bus bindings for Python.  The first step here was to get both libraries using the same event loop.  This can be achieved by setting Twisted to use the glib2 reactor, and enabling the glib mainloop integration in the D-Bus bindings.

Next was enabling asynchronous D-Bus method implementations.  There is support for this in the D-Bus bindings, but has quite a different (and less convenient) API compared to Twisted.  A small decorator was enough to overcome this impedence:

from functools import wraps

import dbus.service
from twisted.internet import defer

def dbus_deferred_method(*args, **kwargs):
    def decorator(function):
        function = dbus.service.method(*args, **kwargs)(function)
        @wraps(function)
        def wrapper(*args, **kwargs):
            dbus_callback = kwargs.pop('_dbus_callback')
            dbus_errback = kwargs.pop('_dbus_errback')
            d = defer.maybeDeferred(function, *args, **kwargs)
            d.addCallbacks(
                dbus_callback, lambda failure: dbus_errback(failure.value))
        wrapper._dbus_async_callbacks = ('_dbus_callback', '_dbus_errback')
        return wrapper
    return decorator

This decorator could then be applied to methods in the same way as the @dbus.service.method method, but it would correctly handle the case where the method returns a Deferred. Unfortunately it can’t be used in conjunction with @defer.inlineCallbacks, since the D-Bus bindings don’t handle varargs functions properly. You can of course call another function or method that uses @defer.inlineCallbacks though.

The iView Guide

After coding this, it became pretty obvious why it takes so long to load up the iView flash player: it splits the guide data over almost 300 XML files.  This might make sense if it relied on most of these files remaining unchanged and stored in cache, however it also uses a cache-busting technique when requesting them (adding a random query component to the URL).

Most of these files are series description files (some for finished series with no published programs).  These files contain a title, a short description, the URL for a thumbnail image and the IDs for the programs belonging to the series.  To find out about those programs, you need to load all the channel guide XML files until you find which one contains the program.  Going in the other direction, if you’ve got a program description from the channel guide and want to know about the series it belongs to (e.g. to get the thumbnail), you need to load each series description XML file until you find the one that contains the program.  So there aren’t many opportunities to delay loading of parts of the guide.

The startup time would be a lot easier if this information was collapsed down to a smaller number of larger XML files.

Syndicated 2009-07-06 08:50:45 from James Henstridge

18 Jun 2009 »

More Rygel testing

In my last post, I said I had trouble getting Rygel’s tracker backend to function and assumed that it was expecting an older version of the API.  It turns out I was incorrect and the problem was due in part to Ubuntu specific changes to the Tracker package and the unusual way Rygel was trying to talk to Tracker.

The Tracker packages in Ubuntu remove the D-Bus service activation file for the “org.freedesktop.Tracker” bus name so that if the user has not chosen to run the service (or has killed it), it won’t be automatically activated.  Unfortunately, instead of just calling a Tracker D-Bus method, Rygel was trying to manually activate Tracker via a StartServiceByName() call.  This would fail even if Tracker was running, hence my assumption that it was a tracker API version problem.

This problem will be fixed in the next Rygel release: it will call a method on Tracker directly to see if it is available.  With that problem out of the way, I was able to try out the backend.  It was providing a lot more metadata to the PS3 so more files were playable, which was good.  Browsing folders was also much quicker than the folder back end.  There were a few problems though:

  1. Files are exposed in one of three folders: “All Images”, “All Music” or “All Videos”.  With even a moderate sized music collection, this is unmangeable.  It wasn’t clear what order the files were being displayed in either.
  2. There was quite a long delay before video playback starts.

When the folder back end fixes the metadata and speed issues, I’d be inclined to use it over the tracker back end.

Video Transcoding

Getting video transcoding working turned out to require a newer GStreamer (0.10.23), the “unstripped” ffmpeg libraries and the “bad” GStreamer plugins package from multiverse.  With those installed, things worked pretty well.  With these dependencies encoded in the packaging, it’d be pretty painless to get it set up.  Certainly much easier than setting things up in MediaTomb’s configuration file.

Syndicated 2009-06-18 16:06:19 from James Henstridge

285 older entries...

 

jamesh certified others as follows:

  • jamesh certified miguel as Master
  • jamesh certified DV as Journeyer
  • jamesh certified federico as Master
  • jamesh certified hp as Master
  • jamesh certified timg as Journeyer
  • jamesh certified vicious as Master
  • jamesh certified terral as Journeyer
  • jamesh certified raph as Master
  • jamesh certified itp as Journeyer
  • jamesh certified yakk as Master
  • jamesh certified mathieu as Journeyer
  • jamesh certified dcm as Master
  • jamesh certified mjs as Master
  • jamesh certified bernhard as Journeyer
  • jamesh certified MJ as Journeyer
  • jamesh certified listen as Journeyer
  • jamesh certified campd as Journeyer
  • jamesh certified advogato as Master
  • jamesh certified sopwith as Master
  • jamesh certified lupus as Journeyer
  • jamesh certified rakholh as Journeyer
  • jamesh certified asmodai as Journeyer
  • jamesh certified alex as Master
  • jamesh certified mbp as Journeyer
  • jamesh certified harold as Journeyer
  • jamesh certified Raphael as Journeyer
  • jamesh certified Radagast as Journeyer
  • jamesh certified LotR as Journeyer
  • jamesh certified goran as Journeyer
  • jamesh certified BeeWarlock as Apprentice
  • jamesh certified krylan as Apprentice
  • jamesh certified msw as Master
  • jamesh certified amk as Journeyer
  • jamesh certified lauris as Master
  • jamesh certified andersca as Master
  • jamesh certified thom as Apprentice
  • jamesh certified fdrake as Journeyer
  • jamesh certified Sarah as Apprentice
  • jamesh certified bratsche as Journeyer
  • jamesh certified jrb as Master
  • jamesh certified Telsa as Journeyer
  • jamesh certified gleblanc as Journeyer
  • jamesh certified timj as Master
  • jamesh certified martin as Master
  • jamesh certified zilch as Journeyer
  • jamesh certified jdub as Master
  • jamesh certified effbot as Master
  • jamesh certified MCArkan as Journeyer
  • jamesh certified gman as Journeyer
  • jamesh certified blizzard as Master
  • jamesh certified malcolm as Journeyer
  • jamesh certified trs80 as Apprentice
  • jamesh certified fxn as Journeyer
  • jamesh certified yosh as Master
  • jamesh certified tromey as Master
  • jamesh certified sri as Apprentice
  • jamesh certified macricht as Journeyer
  • jamesh certified RossBurton as Journeyer
  • jamesh certified fcrozat as Journeyer
  • jamesh certified kristian as Journeyer
  • jamesh certified Darin as Master
  • jamesh certified Ankh as Master
  • jamesh certified Hallski as Master
  • jamesh certified AndrewDSmart as Apprentice
  • jamesh certified hadess as Journeyer
  • jamesh certified jdahlin as Journeyer
  • jamesh certified arvind as Journeyer
  • jamesh certified kiko as Journeyer
  • jamesh certified mwh as Master
  • jamesh certified Jody as Master
  • jamesh certified louie as Master
  • jamesh certified larsrc as Journeyer
  • jamesh certified nlevitt as Journeyer
  • jamesh certified snorp as Journeyer
  • jamesh certified elanthis as Apprentice
  • jamesh certified ndw as Master
  • jamesh certified funrecords as Journeyer
  • jamesh certified mjg59 as Journeyer
  • jamesh certified mpesenti as Master
  • jamesh certified mrd as Journeyer
  • jamesh certified jmason as Master
  • jamesh certified wingo as Journeyer
  • jamesh certified msevior as Master
  • jamesh certified seb128 as Master
  • jamesh certified keybuk as Master
  • jamesh certified gicmo as Journeyer
  • jamesh certified robertc as Master
  • jamesh certified jblack as Journeyer
  • jamesh certified sivang as Apprentice
  • jamesh certified desrt as Master

Others have certified jamesh as follows:

  • ole certified jamesh as Master
  • raph certified jamesh as Journeyer
  • goran certified jamesh as Master
  • yosh certified jamesh as Journeyer
  • campd certified jamesh as Journeyer
  • LotR certified jamesh as Journeyer
  • bernhard certified jamesh as Journeyer
  • egad certified jamesh as Journeyer
  • andrei certified jamesh as Journeyer
  • Radagast certified jamesh as Journeyer
  • Raphael certified jamesh as Master
  • faassen certified jamesh as Master
  • bombadil certified jamesh as Journeyer
  • harold certified jamesh as Journeyer
  • mathieu certified jamesh as Master
  • booch certified jamesh as Master
  • mbp certified jamesh as Master
  • feldspar certified jamesh as Journeyer
  • timj certified jamesh as Master
  • rconover certified jamesh as Journeyer
  • dcm certified jamesh as Journeyer
  • listen certified jamesh as Master
  • alex certified jamesh as Master
  • mjs certified jamesh as Master
  • jochen certified jamesh as Master
  • duncan certified jamesh as Master
  • MJ certified jamesh as Master
  • zhp certified jamesh as Master
  • lupus certified jamesh as Journeyer
  • rakholh certified jamesh as Master
  • asmodai certified jamesh as Journeyer
  • lordsutch certified jamesh as Master
  • mtearle certified jamesh as Master
  • psj certified jamesh as Master
  • camber certified jamesh as Master
  • yakk certified jamesh as Master
  • tpot certified jamesh as Master
  • taral certified jamesh as Journeyer
  • djs certified jamesh as Master
  • nils certified jamesh as Master
  • ztf certified jamesh as Master
  • mlsm certified jamesh as Journeyer
  • bagfors certified jamesh as Master
  • nelsonrn certified jamesh as Master
  • lauris certified jamesh as Master
  • rodrigo certified jamesh as Master
  • jpick certified jamesh as Master
  • jae certified jamesh as Master
  • jsheets certified jamesh as Master
  • andersca certified jamesh as Master
  • ryuch certified jamesh as Master
  • jules certified jamesh as Master
  • djcb certified jamesh as Master
  • mwh certified jamesh as Master
  • tca certified jamesh as Journeyer
  • nixnut certified jamesh as Master
  • glenn certified jamesh as Master
  • timg certified jamesh as Master
  • lerdsuwa certified jamesh as Master
  • fdrake certified jamesh as Master
  • grem certified jamesh as Master
  • sh certified jamesh as Master
  • gbowland certified jamesh as Master
  • jdub certified jamesh as Master
  • dneighbors certified jamesh as Master
  • amk certified jamesh as Journeyer
  • menthos certified jamesh as Master
  • cuenca certified jamesh as Master
  • exa certified jamesh as Master
  • hub certified jamesh as Master
  • murrayc certified jamesh as Master
  • nzkoz certified jamesh as Master
  • gleblanc certified jamesh as Master
  • baueran certified jamesh as Master
  • jonkare certified jamesh as Master
  • johnsonm certified jamesh as Master
  • baruch certified jamesh as Master
  • cwinters certified jamesh as Master
  • bratsche certified jamesh as Master
  • zilch certified jamesh as Master
  • johnnyb certified jamesh as Master
  • MCArkan certified jamesh as Master
  • ricardo certified jamesh as Master
  • Senra certified jamesh as Master
  • jao certified jamesh as Master
  • fxn certified jamesh as Master
  • trs80 certified jamesh as Master
  • gman certified jamesh as Master
  • braden certified jamesh as Master
  • walters certified jamesh as Master
  • hadess certified jamesh as Master
  • rkrishnan certified jamesh as Master
  • async certified jamesh as Master
  • sand certified jamesh as Master
  • DarthEvangelusII certified jamesh as Master
  • arvind certified jamesh as Master
  • jdahlin certified jamesh as Master
  • cactus certified jamesh as Master
  • kiko certified jamesh as Master
  • Jody certified jamesh as Master
  • edd certified jamesh as Master
  • larsrc certified jamesh as Master
  • Hallski certified jamesh as Master
  • kristian certified jamesh as Master
  • fcrozat certified jamesh as Master
  • pasky certified jamesh as Master
  • nlevitt certified jamesh as Master
  • elanthis certified jamesh as Master
  • dolphy certified jamesh as Master
  • blm certified jamesh as Master
  • rhestilow certified jamesh as Master
  • zotz certified jamesh as Master
  • Mmarquee certified jamesh as Master
  • strider certified jamesh as Master
  • mrd certified jamesh as Master
  • mdupont certified jamesh as Master
  • mpesenti certified jamesh as Master
  • polak certified jamesh as Master
  • ebf certified jamesh as Master
  • monkeyiq certified jamesh as Master
  • gobry certified jamesh as Master
  • lathiat certified jamesh as Master
  • pycage certified jamesh as Master
  • jmason certified jamesh as Master
  • gheet certified jamesh as Master
  • memeyou certified jamesh as Master
  • wingo certified jamesh as Master
  • mathrick certified jamesh as Master
  • badger certified jamesh as Master
  • gicmo certified jamesh as Master
  • e8johan certified jamesh as Master
  • lucasr certified jamesh as Master
  • jarashi certified jamesh as Master
  • nikole certified jamesh as Master
  • freax certified jamesh as Journeyer
  • pvanhoof certified jamesh as Journeyer
  • jsgotangco certified jamesh as Master
  • jblack certified jamesh as Master
  • behdad certified jamesh as Master
  • mako certified jamesh as Master
  • Burgundavia certified jamesh as Master
  • cinamod certified jamesh as Master
  • gpoo certified jamesh as Master
  • ianclatworthy certified jamesh as Master
  • yosch certified jamesh as Master
  • desrt certified jamesh as Master
  • ctrlsoft certified jamesh as Master

[ Certification disabled because you're not logged in. ]

New Advogato Features

FOAF updates: Trust rankings are now exported, making the data available to other users and websites. An external FOAF URI has been added, allowing users to link to an additional FOAF file.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!

X
Share this page