[PATCH 0/1] Rework of metadata key system



Hi all!

I've been working on revamping the current metadata key system we had in Grilo.

One of the features we thought at the very beginning was that developers should
be able to add new keys to system. Thus if a plugin is able to handle a new
kind of key, it should be able to add it to system.

This feature was not very good achieved, as it required to change the core
itself.

With this proposed rework, users can add their own keys. Two important issues
were keeping in mind:

- Developers can add their own keys.
- Comparing keys must be done quickly.

Later issue is the reason why GrlKeyID were numbers and not strings: because
comparing strings is rather slow.

Roughly speaking, the new proposed system replaces numbers by pointers to
GParamSpec: thus, comparing keys can be done quickly still.

One of the improvements about using GParamSpec is that there is no need for
GrlMetadataKey, as all information is contained in GrlKeyID. Also, and a very
important issue, now metadata keys have the expected type. For instance,
GRL_METADATA_KEY_TITLE expects a G_TYPE_STRING, while
GRL_METADATA_KEY_CHILDCOUNT expects a G_TYPE_INT.

I have had to make all changes in a single patch, else it would break system.
More information is in the commit message.

Later I would send the changes in plugins required to work with this new
system.

Also, these are the minimum changes required to the new system, but if finally
they land at master, more improvements can be done in the system. As examples,
improving serialization()/unserialization() functions, and improvements on
GrlMedia management.


      J.A.


Juan A. Suarez Romero (1):
  [core] Rework metadata key system

 src/Makefile.am                                    |    9 +-
 src/data/grl-data.c                                |   15 +-
 src/data/grl-media.c                               |   37 ++--
 ...{grl-metadata-key.c => grl-metadata-key-priv.h} |   25 +--
 src/grl-metadata-key.c                             |  214 +++++++++++++++++++-
 src/grl-metadata-key.h                             |  142 +++----------
 src/grl-metadata-source.c                          |   33 ++--
 src/grl-plugin-registry.c                          |  111 +++++-----
 src/grl-plugin-registry.h                          |    7 +-
 tools/grilo-test-ui/main.c                         |    8 +-
 10 files changed, 354 insertions(+), 247 deletions(-)
 copy src/{grl-metadata-key.c => grl-metadata-key-priv.h} (69%)



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