Grilo and Rygel

After knowing about Grilo, Bastien proposed to use it as a helper library to implement Rygel’s MediaServer D-Bus API spec. This D-Bus API specifies how content providers can expose content over D-Bus that Rygel can consume and then export to the UPnP world. Although this spec was developed for Rygel in particular, it aims to be generic enough so other applications could use it to consume content over D-Bus directly.

The idea is to decouple providers and consumers, this way one does not have to worry about the language they are written in and providers don’t have to be loaded in the consumer’s address space, instead they are communicated through D-Bus.

So, what could be Grilo‘s role in this context? As you know, Grilo is a pluggable framework that provides a single, high-level API to consume contents from various sources (Youtube, Jamendo, SHOUTcast, etc) which are implemented as plugins for the framework. As such, the role of Grilo would be that of a content provider. Juan has been working on a daemon that would use Grilo to get access to all the content exposed by the framework and expose it over D-Bus according to Rygel’s MediaServer spec. This will enable Rygel (or any other application), to get access to all this content over D-Bus.

As of today, I think only Rygel has implemented the consumer side of this API, but the idea is that in the future other applications like Totem or Rhythmbox would have plugins to consume it too. Also, since Rygel is a UPnP server, and it is feeding on Grilo through this D-Bus interface, it is also exposing Grilo’s contents to the UPnP world, so any UPnP client should be able to access these contents over UPnP thanks to Rygel. Totem for example, has a UPnP plugin already, and because of that it can consume the contents from Grilo through Rygel even when it does not implement the consumer API of the MediaServer spec.

If you are interested in more details check Juan’s post here. There you will also find a screencast showcasing a Grilo-powered daemon that’s exposing content from various of its plugins over D-Bus, then Rygel feeding on that and exposing them over UPnP, and finally Totem consuming all the content though its UPnP plugin. Of course, you may ask why wouldn’t Totem feed on D-Bus directly, well just because it has the UPnP plugin already and not the D-Bus one, but it will come ;).

Talking about that, another thing that Bastien proposed and on which we will be working too, is a set of helper libraries to ease development of content producers and consumers. On the producer side (backends) the idea would be to hide all the D-Bus stuff and provide a clean, easy to use interface for exposing content to the bus (for those not wanting to deal with D-Bus directly), and on the consumer side (frontends), we could do the same and maybe add some extra bonus stuff, like widgets to manipulate available sources and the like.

Grilo on Totem

In my last post I mentioned I was working on a Totem plugin based on Grilo, last week I put some more effort on that and I got a beta version, you can check out some pics below:

Browsing and playing  videos from Youtube
Browsing and playing videos from Youtube
Browseable sources
Browseable sources
Searching images on flickr
Searching images on flickr
Searching Guadec videos on  Youtube
Searching Guadec videos on Youtube
Browsing content from Jamendo
Browsing content from Jamendo

I have also recorded an ogv video showing the plugin at work in more detail, you can check it out here.

Also, I uploaded the code to gitorious if you feel curious about it. If you want to build the plugin from the sources check the HACKING file on the repository. Also, I suggest you build Grilo from the sources as well or wait for the release 0.1.3 which should be coming out later today.

Now to the more interesting part, the good thing about Grilo is not just the plugins, it is the fact that you can interact with them with a common API. As a matter of a fact, I could now add more plugins to Grilo and those would show up in Totem without having to code anything extra, not a single line on Totem or its Grilo plugin, it would just work: you would be able to browse the new plugins if they are browseable in the Browse view and/or you would be able to search them if they are searchable in the Search view, etc.

The plugin is not really finished, it can still use some extra work, particularly in these areas:

  • Localization support.
  • Proper user interface definition with GtkBuilder.
  • Settings persistence with GConf.
  • Usability tweaks
  • Review memory management, fix memory leaks, etc
  • More testing and general debugging.

but all in all, it is good enough already for others to try and give feedback, so if you have any, please drop me a comment! 🙂

That’s all for now, I am looking forward to seeing this on the upstream Totem at some point in the future, so if some Totem developer is reading this, please let me know how you feel about that.