Netzflocken

...was so an- und abfällt

Entries tagged "coherence"

UPnP <-> D-Bus pontoon (*)

written by dev, on 2007-09-23 19:35.

I just checked in a new version of Coherence with a provisional integration of the D-Bus message bus system.

D-Bus support within Coherence will be divided into two parts:

  1. accessing UPnP devices and services via D-Bus as a client
    • notification about the emergence of new devices and their disappearance
    • access to the API of the Coherence service clients, for instance the Browse method of the ContentDirectoryService
    • signaling of UPnP service StateVariable changes
  2. providing the backend functionality for an UPnP device
    There I’m think off two ways to achieve this:
    • a dedicated plugin for each backend that proxies the UPnP action to their respective backend method, like we do this already for instance in the Elisa backend, using Twisted Perspective Broker as RPC protocol.
    • a generic D-Bus hooking-in system, that can be used to initiate a UPnP device creation via DBus and to tell Coherence which DBus methods should be called on recieving an UPnP action request
The first part is working, lacking the signaling of the StateVariable changes though. That added it will be very,very easy to supply UPnP A/V MediaServer browsing capabilities to any D-Bus talking application. E.g. replacing the Rhythmbox Coherence UPnP plugins, which have to be in Python at the moment, with some native code.

The second one I’m still contemplating about on how to implement it in a plain and standard style, that allows an application to ask Coherence to create an UPnP device with its services - not only an A/V device, but others too, even non-standard ones - to publish so far locally restricted D-Bus services out onto the network.

* It is no full bridge yet - at least not in my opinion, at the moment it is more looking like something really simple timbered together. ;-)

Coherence talk accepted for Embedded Linux Conference - Europe 2007

written by dev, on 2007-09-21 08:02.

I just got informed that my proposal for a talk about Coherence at the Embedded Linux Conference - Europe 2007 was accepted!

The conference will be held in Linz/Austria during the 2nd and 3rd of November.

These are the messages you like to read when browsing your email during breakfast - even coffee tastes much better now. ;-)

How to use Coherence on a non networked computer?

written by dev, on 2007-09-18 20:35.

Say you want to work on your favorite UPnP software en route or even present it to somebody else.

But all you have is your laptop and no network connection. And the only interface that is up and has an IP address assigned is the loopback one, good ol’ 127.0.0.1.

Now if you start two Coherence instances and they don’t see each other, that’s due to the SSDP multicast messages, which they send out to announce their presence or to search for other UPnP devices, do not reach each other.

The chances are that no IP routing is set up. That’s quite reasonable on a system with only the loopback interface active, but UPnP - to be more precise SSDP - needs it.

The solution is to add either a route for the UPnP multicast address pointing to the loopback interface:

sudo route add 239.255.255.250 lo
or more lazy universally valid, and maybe helpful for some other software on your system too, just add a default route to it:
sudo route add default lo
as multicast packages - good citizens of the IP network - will travel the default route if not explicitly told elsewise.*

If you get networked again, do not forget to remove that route. Of course having that done automagically by e.g. the Gnome NetworkManager would be much nicer. If you know how, please leave a comment.


* Using a default route is acceptable in this situation, in your own LAN you better go for the UPnP multicast one, as with the default route the packages first will be send to what is mostly your internet gateway, and will be there injected again into your network.

new Coherence release - version 0.4.0 is out

written by dev, on 2007-07-31 21:13.

Around one year after I internally started on Coherence we made it to version 0.4.
Thanks to everybody who helped with patches, bug-reports or tests!

I think it is the last one that needs the beta label. The core is faily stable now, don’t think that there are too many quirks lurking there.

New in this release are:

  • integration of a new logging module

    logging can now be configured via the config file or through an environment variable COHERENCE_DEBUG, which overrides the config values. Usage is like:

    COHERENCE_DEBUG=*:3
    - emit INFO level messages from all modules

    COHERENCE_DEBUG=*:2,ssdp:4
    - WARNING level messages from all modules, plus debug level for the ssdp module

  • removed the dependency for SOAPpy, now using own methods and ElementTree only

  • serving cover art now to DLNA MediaRenderers
  • refinements on the object creation and the import into the MediaServers
  • an installable package for the Nokia Maemo platform on the N800, complete with all dependencies, thanks to Rob Taylor of CodeThink

  • and a lot more of the usual bugfixes and enhancements

For version 0.5.0 I have in mind

  • some first form of D-Bus integration to simplify the integration of with non-Python applications
  • rework of the client API
  • UPnP tests - and tests for Coherence itself - with the toolset micxer is working on

Lightning talk about Coherence at Guadec 2007

written by dev, on 2007-07-30 00:09.

I gave a talk about Coherence at the Guadec 2007 in Birmingham.

The intention of the talk was to give a quick overview about DLNA/UPnP and to spread the word to the Gnome developers that there is something that allows an easy connection of their own software.

You can get the slides from the Coherence site.

The talk itself went reasonable well - mostly due to the fact that Jono, keeper of the chicken watch, was very, very generous with the assigned time for it.

So if you have missed it there or just want to know a bit more about DLNA and UPnP, and why I think it is important to use these stacks within Linux multimedia applications, grab it while the electronic ink is still stabilizing.

PS: I was asked if I could to a more detailed talk, so maybe there will be one next year at the Fosdem in Brussels.

Coherence 0.1.0 release

written by dev, on 2007-02-16 00:40.

I did it!

Today I tagged the 0.1.0 release of Coherence and made it public with an entry in the Python Cheeseshop, and it got downloaded already several dozen times.

During the next days the new Elisa release will get announced too, using now, aside from the UPnP MediaServer, Coherence for the UPnP client too.

Somehow I’m now waiting in suspense for new bug reports – not too many I hope , feature requests and new ideas on what to change, to improve or to enhance.

Things that are on the list for the next releases:

  • improve the web UI so we get closer to a web-based UPnP ControlPoint
    Coherence-cp-20070216
    For now we just show all found devices, but thanks to Athena at least in real time when they announce or log off themself.
  • testing of other devices, a first step into the Intel UPnP Device Spy direction
  • “port” Coherence to the Maemo platform, so we’ll can use the UPnP MediaServer and the UPnP MediaRenderer on the Nokia N800
  • switching to Flickrpc - Ross Burtons Twisted based Flickr library
  • start with a DAAP->UPnP bridge and export in a first step DAAP provided content via UPnP

Coherence in conjunction with Media Streamer on a Nokia N800

written by dev, on 2007-02-05 21:58.

N800Thanks to Nokias generosity I now have the possibility to test Coherence with and against the UPnP stack shipped with the N800 and used e.g. by Media Streamer or Canola and the UPnP plugin for the gnome-vfs layer.

So far I used the file manger application and Media Streamer, and there have been pleasant and promising results.

The Coherence powered devices are spotted by the N800 and the content retrieval from the MediaServers - even the Flickr one - works fine.

N800 media streamer screenshot

Albeit from the file manger application which seems to circle sometimes.

The GStreamer MediaRenderer backend is recognized too and can be controlled, with the restriction that the Media Streamer UI does not follow the state changes. I’m still unsure whether this is on behalf of Coherence or on the Media Streamer side, but whatever it is, it can’t be anything more than a mere nothing.

Meaning we are probably only one little bug apart from being able to control Elisa with the N800.

Regarding Media Streamer acting itself as a controllable MediaRenderer, there it is fallen a bit short of my expectations, as it doesn’t provide anything at all – neither controlling nor eventing.

That’s definitily another good reason to get Coherence up and running on the Maemo platform.

PS: If your are like me looking for something to take a screenshot on the N800, I have been lucky with load-applet-run, and I was told @ irc://freenode.net/#maemo that the Maemo screen grabber together with the osso-screenshot-tool should work too.

XBox 360 UPnP client and Coherence in communication therapy

written by dev, on 2007-01-31 18:25.

The XBox 360 UPnP client is a little bit peculiar and finicky regarding its dealings – well, actually it only wants to talk to its really close friends, the Windows Media Player 11 and the Windows Media Connect server.

With a lot of patient care from Tristan Seligmann and a yet unknown contributor we managed to win its confidence and now that poor little thing has started to talk via UPnP to Coherence – and requests so far audio and image files from the MediaServer, even from the Flickr backend.

To be honest, it was more the devotedness of Coherence than the willingness of the XBox that made this happen, especially when it came to the UPnP idiom spoken in the suburbs of Seattle, but anyway it is a nice thing to see this cagey behaviour come to an end.

And what’s even greater to see is Coherence being of real use for somebody outside and furthermore getting something back!

accessing Flickr the UPnP way

written by dev, on 2007-01-20 21:46.

As a follow-up to my last post about the GStreamer backend for Coherence I’m happy to announce now the Coherence Flickr UPnP A/V MediaServer backend.

What does it do:

  1. it connects to Flickr via the Flickr API and enquires a list of interesting photos for the most recent day
  2. it provides that list via the ContentDirectory service to other UPnP A/V enabled devices

So if you have such a multi-functional home-automation touch-panel like mine or one of these tvs with a build-in UPnP A/V client you can now enjoy an ever changing stream of photos coming to your living room.

Of course there will be Flickr enabled picture frames popping up from every manufacturer climbing on the bandwagon - which will definitly have their right to exist, especially if they are used in a isolated environment - but if you are in a connected home it sounds unreasonable to supply configuration to every device all over the place.

Hence the charm of these few lines of Python code lies in its possibility to make Coherence the one-stop-shopping media gateway.

I’ll add a few more features over the next days:

  • enquire user, group or tag based photo lists
  • optionally only show photos in landscape format
  • define picture quality to download
  • make the number of photos returned configurable, currently it is limited to 100
  • recheck with the Flickr service every e.g. 180 minutes and fetch new photo urls
  • maybe act as a proxy to Flickr for devices which are not able to connect to something outside the home lan

And something I would like to add too, but this will take some more time, is a mapping between the UPnP ContentDirectory ImportResource() and CreateObject()/MoveObject()/… actions to the Flickr upload API.

glueing together GStreamers playbin and Coherences UPnP A/V MediaRenderer

written by dev, on 2007-01-11 14:28.

In an attempt to work on the documentation and as a practice finding the words to explain how Coherence ticks I’ll try to throw some light on how the GStreamer playbin backend and Coherence are glued together to form an UPnP A/V MediaRenderer device.

A device in UPnP speak is a logical something - a grouping of services. A MediaRenderer as an example needs to support

  • a RenderingControl service, which is responsible for adjustment of volume, loudness, brightness,…
  • a ConnectionManager service, used to enumerate and select the transfer protocol (http, rtsp/rtp,…) and
    data format (mp3, ogg,…) to be used for transferring the content
  • an AVTransport service, optional - depending on the transfer protocols the ConnectionManager supports. But if available used to specify the content to be played, start/stop/pause a playback, seek in the content stream,…

These services can be controlled and queried with so called Actions, e.g. SetVolume() and GetVolume(), and hold their current state in so called StateVariables, e.g. Volume. A call to SetVolume() sets the volume value on the actual rendering engine and reflects that change in the variable Volume. And a call to GetVolume() retrieves the value from that variable. Furthermore a service is supposed to propagate the values of these variables on change to interested parties, e.g. to an UPnP ControlPoint.

Now one of the basic principles of Coherence is to seal off the backend – the actual rendering engine, in this case the GStreamer playbin – from the UPnP related tasks (and later from the D*AP ones) as much as possible.

This means that a backend should only need to

  1. tell Coherence what kind of device(s) it wants to resemble, e.g. a MediaRenderer
  2. define specific conditions, e.g. that is supports only decoding of mp3 content
  3. provide methods Coherence can access when an action is called that has effects on the backend engine, e.g. a volume change
  4. inform Coherence about state changes, e.g. the end of the media content is reached and playback has stopped

Everything else is the job of Coherence:

  • propagate the device on the network (SSDP/MSEARCH)
  • generate the necessary device and service descriptions with reasonable defaults, corresponding to the backends capabilities
  • provide the control interfaces to the actions the services have
  • handle all event subscription and propagation tasks (GENA)

This means also, that all actions with no effects on the backend engine are handled completely within Coherence, like an action that retrieves only a variable value. Of course a backend can override this if it wants to, but basically there is no need to do it.

In our GStreamer playbin case this (simplified) looks like this:

class Player:

    """ see item 1. above """
    implements = ['MediaRenderer']

    """ see item 2. above """
    vendor_value_defaults = {'RenderingControl': {'A_ARG_TYPE_Channel':'Master'},
                             'ConnectionManager': {'SinkProtocolInfo', 'http-get:*:audio/mpeg:*'}}
    vendor_range_defaults = {'RenderingControl': {'Volume': {'maximum':100}}}

    def __init__(self, device):
        self.player = gst.element_factory_make("playbin", "myplayer")
        self.device= device

    def set_volume(self, volume):
        """ here the actual volume change takes place """
        """ gstreamer playbin has a volume range from 0.0-10.0 """
        self.player.set_property('volume', float(volume)/10)

         """ feed back the new state - our item 4. """
        rcs_id = self.device.connection_manager_server.lookup_rcs_id(self.current_connection_id)
        self.device.rendering_control_server.set_variable(rcs_id, 'Volume', volume)

    def upnp_SetVolume(self, *args, **kwargs):
    """ that's a method referred in item 3. """
        InstanceID = int(kwargs['InstanceID'])
        Channel = kwargs['Channel']
        DesiredVolume = int(kwargs['DesiredVolume'])
        self.set_volume(DesiredVolume)
        return {}

This is not perfect and not final yet and there will be some changes especially in the way how item 4. is handled. But the purpose of that backend is among other things to straighten out the bumpiness of these glue points.

And btw., in this backend the engine is embedded, but as stated in an earlier post, there is absolutly no reason why instead of calling self.player.set_property to set the volume this couldn’t be some ipc call (xml-rpc, dbus, Twisted PB,…) or an IR/ZigBee/ZWave signal emitted.