Writing multimedia applications with Grilo (GUADEC 2013)

Preview:

DESCRIPTION

By Juan A. Suarez. Grilo is a framework that helps developers to retrieve multimedia content from different sources, both local and online, using a single and common API to browse, search and finally get the results. Nowadays Grilo is used by different applications inside the GNOME project: Totem, Rygel, Rythmbox, and in new coming applications like gnome-music and gnome-photos (this one in a next version). The aim of this talk is to check the requirements these different applications have to access the content, and how Grilo helps to fulfil them. We will see also other use-cases that can be solved with Grilo, which for sure be helpful for other developments.

Citation preview

static void_g_digicam_manager_class_init (GDigicamManagerClass

*klass){

GObjectClass *object_class = (GObjectClass*) klass;

g_assert (G_DIGICAM_IS_MANAGER_CLASS (klass));

parent_class = g_type_class_peek_parent (klass);

g_type_class_add_private (klass, sizeof (GDigicamManagerPrivate));

/* Override virtual functions */ object_class->finalize = _g_digicam_manager_finalize;

/** * GDigicamManager::focus-done:

* @manager: the gdigicam manager

Juan A. Suárez Romerojasuarez@igalia.com

Writing multimedia applications with Grilo

Opening

Sources

Sources

Grilo

● Framework focused on making discovery and browsing easy for application developers● A single, high-level API for all the sources

● Plugins● Provides access to multimedia content● Extendable

Grilo

SOURCESOURCESOURCE

SOURCESOURCEMEDIASOURCESOURCE

METADATAKEYS

crea

tes

contains

provides

YoutubeJamendoFlickrIMDB...

AudioVideoImage...

TitleArtistAlbum...

Totem

Totem

Requirements

● Define what we need● Type of content

– Any kind?– Only video? Music?

● Metadata keys– URL– Title– Thumbnail– ... 55 metadata keys

Content to show

● Ignore any source that does not provide Videos● In “browse” view, ignore any source that does

not support browsing● In “search” view, ignore any source that does

not support searching

Information to show

- Title- Author- Duration- Thumbnail- URL

- Title- Author- Duration- Thumbnail- URL

Browse Search

Invoke Grilo

- Title- Author- Duration- Thumbnail- URL

- Title- Author- Duration- Thumbnail- URL

Browse Search

Problems

● Two problems to solve● Source not handling some keys● Too much expensive to retrieve some keys

Totem

● Flags to control content retrieval● Normal: provides the known requested content

– GRL_RESOLVE_NORMAL● Fast only: provides the known requested content

that does not penalize the operation in terms of performance– GRL_RESOLVE_FAST_ONLY

● Full: provides the known requested content using all the available sources– GRL_RESOLVE_FULL

Reduce the problems

● Request content in chunks● Request fast only in first iteration● While current chunk is visible

● Ask for each visible media element the discarded keys (using full flag)

● URL key case: slow key and not shown in the UI● Request it when user wants to play

GNOME Music

GNOME MusicCover Art

GNOME Music

● Music defines its own structure

● Grilo's one is different● Does not have concept of “Artist” or “Album”

● They are “boxes”

● Needs to sort the results

GNOME Music

Approaches

● Request content from Tracker directly● Create Grilo Media elements to add missing information

(Cover Art)

● Instruct Grilo's Tracker plugin how to construct the medias

● Use query() function● Very specific to the plugin● In case of Tracker plugin, use SPARQL to make the query

– First column is the media to build– Use alias to map each SPARQL column to specific metadata keys

Closing

Other use-cases

● Application to upload audio/video content to web services● store() function

● Mediaplayer with auto-resume● “playback-interrupted-time” key● store_metadata() function

– Metadata Store source handles it

Show me a code

Resources

● Wiki● http://live.gnome.org/Grilo

● Source code● git://git.gnome.org/grilo● git://git.gnome.org/grilo-plugins

● IRC● #grilo at irc.gnome.org

● Mailing list● http://mail.gnome.org/mailman/listinfo/grilo-list

Recommended