[PATCH 0/6] Serialize and unserialize Medias to strings



This set of patches adds a new feature to GrlMedia:

  * grl_media_serialize()
  * grl_media_unserialize()

As it can be notice, serialize() returns a string that represents a Media, and
unserialize() rebuilds the Media from the string.

The scheme adopted in the serialization is using an URI. An example of a
serialized element would be:

    grlaudio://grl-jamendo/3

In protocol it is encoded the type of media (box, audio, video, etc.).

Next parameter (the "host") is the source.

And finally, we have the "id" of element.

All those elements are escaped.

This is the "basic" serialization. But when serializing there's an option to
specify a "full" serialization. In this case, all parameters in media are
taking in account when building the serial. An example would be:

     grlaudio://grl-jamendo/3?title=mytitle&artist=madonna

unserialize() will handle both kind of serializations.

How useful are these functions: well, it depends on your needs. But some use
cases would be:

- Send the media through dbus to a non-grilo compliant application (rygel-grilo
  case)
- Create a list of medias in disk, which could be consumed later by other
  application
- A non-grilo application could be create this kind of uris so they can be
  consumed by a grilo-compliant application

Finally, it is worth to note that both implementations could seem a bit
"hackish". Well, maybe is true, because I didn't add some other functions to
Grilo API which would make easy the implementation of these two functions.
Reason is that I plan to review more carefully some needs in Grilo, so when
they are implemented, I'll change this couple of functions.

Attached are the patches to add these functions. Feel free to send me your
reviews. If everybody agree, I'll merge them in trunk after this review period.


	J.A.


Juan A. Suarez Romero (6):
  Add a serializing function for medias
  Add unserialize() function
  Do not use whitespaces in key names
  Serialize all properties
  Unserialize all properties
  Document serialize() / unserialize() functions

 src/data/grl-media.c   |  274 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/data/grl-media.h   |    6 +-
 src/grl-metadata-key.h |    6 +-
 3 files changed, 282 insertions(+), 4 deletions(-)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]