Juan A. Suarez Romero <jasuarez@igalia.com>
Introduction
About me Juan A. Suárez Romero Computer engineer, Coruña University Working at Igalia since 2007 Experience in multimedia Involved in Maemo and MeeGo Co-author of MAFW
Outline 1 Current problems 2 Grilo 3 Conclusions 4 Thank you!
Current problems
Many sources of content Online/offline sources Different protocol/api Sources that do not provide content (meta-information)
Many different devices Different screen sizes Different hardware components Different platforms
Current approach Develop one application per service Each application with different UX Not easily scalable: new sources require new applications Expensive maintenance In some cases, one application attending more than one service Services of the same type (e.g., Photo storage service) Define a common layer between application and the service Not shared effort! Reinventing the wheel all time
What we need? Stop reinventing the wheel! Platform-level solution for accessing multimedia content Provide homogeneous access to all content Scalable with new sources of information Collaboration! Consistent user experience Users care about the content, not the provider
Grilo
What is Grilo? Framework focused on making discovery and browsing easy for application developers A single, high-level API for all the sources A collection plugins that provides access to the sources An extendable system to provide more plugins http://live.gnome.org/grilo
Architecture overview
Media types and Keys Collection of keys and values Several keys provided by core: title, URL, author,... Plugins can extend them with new keys Support for multiple values Support for relations between keys
Plugins and Sources Key component of the system Plugins are dynamically loaded by core Plugins create one or more sources Sources support multiple operations Browse, Search, Store, Remove,... All operations are optional
Plugins and Sources Sources perform two main roles: Provide new media content Enrich already existent media content Sources collaborate among them to solve the requests
Example of collaboration Developer wants to show content from UPnP server and play it They need the url to play, a title and a thumbnail to show 1 Perform the request through core API 2 Core checks if the requested keys are supported by the source thumbnail is not supported by UPnP source 3 Checks which sources are able to resolve thumbnail key CoverArt source is able to But it requires to know two keys: artist and album
Example of collaboration 4 Core checks if those required keys are supported by original UPnP source If not, repeat the process as in the case of thumbnail 5 Perform the request in the UPnP source with the keys requested plus the new keys 6 When the results arrive, send them to CoverArt source to include the thumbnail 7 Send the final results to application Developer only needs to deal with one provider
Implementing applications Main language is C Other languages supported through gobject introspection (Python, Javascript, Vala,... ) Support for C++ (grilomm) Some initial support for Qt/QML
Code example 1 #! / usr / b i n / python 2 3 import sys 4 from gi. repository import Grl 5 6 def main ( argv ) : 7 i f len ( argv ) < 1 : 8 print " Usage : make_list. py <search_text >" 9 return 1 10 11 Grl. i n i t ( [ ] ) 12 r e g i s t r y = Grl. Registry. g e t _d e f a u l t ( ) 13 registry. load_all_plugins ( ) 14 keys = [ Grl.METADATA_KEY_DURATION, 15 Grl. METADATA_KEY_TITLE, 16 Grl.METADATA_KEY_URL] 17 options = Grl. OperationOptions. new(none) 18 options. set_count ( 2 0 0 ) ; 19 results = Grl. multiple_search_sync (None, argv [ 0 ], keys, options ) 20 print " #EXT3MU" 21 for media in results : 22 i f isinstance ( media, Grl. MediaAudio ) : 23 print " #EXT3INF : " + s t r ( media. get_duration ( ) ) + ", " + media. g e t _ t i t l e ( ) 24 print media. get_url ( ) 25 26 i f name == " main " : 27 main ( sys. argv [ 1 : ] )
Implementing plugins Plugins must be written in C Adding support for writing plugins declaratively (in XML) Adding support for other languages (Lua)
Conclusions
Resources Wiki http://live.gnome.org/grilo Source code http://git.gnome.org/browse/grilo http://git.gnome.org/browse/grilo-plugins http://git.gnome.org/browse/grilomm IRC #grilo at irc.gnome.org Mailing list http://mail.gnome.org/mailman/listinfo/ grilo-list Do not miss our booth in ground floor (in front of Rossini room)
Thank you!
Images used in this presentation Hard Disk Icon by Mazenl77 (CC Attribution) http://www.iconspedia.com/icon/hard-disk-1600.html Memory Card Icon by Custom Icon Design Studio http://www.gettyicons.com/free-icon/103/ pretty-office-2-icon-set/free-memory-card-icon-png Vimeo, Flickr, Jamendo, YouTube and UpnP logos under copyright of their own brands