diff options
author | Juan A. Suarez Romero <jasuarez@igalia.com> | 2011-05-03 16:19:09 +0000 |
---|---|---|
committer | Juan A. Suarez Romero <jasuarez@igalia.com> | 2012-07-13 07:35:01 +0000 |
commit | ae22e96590eed29b2a8d1c4b4bfce6fb11a1d822 (patch) | |
tree | 947c5dd93652e8050d59fe56199f78d563176733 /examples | |
parent | 1a354a48c655e23477e9949b7ea3a21c20d9c672 (diff) | |
download | grilo-ae22e96590eed29b2a8d1c4b4bfce6fb11a1d822.tar.gz |
core: Redesign source/plugin hierarchy
Previously, hierarchy was:
+----------------+
| GrlMediaPlugin |
+-------.--------+
/_\
|
+-------------------+
| GrlMetadataSource |
+---------.---------+
/_\
|
+----------------+
| GrlMediaSource |
+----------------+
With the redesign, we have the new hierarchy:
+-----------+ +-----------+
| GrlPlugin |<>-----*| GrlSource |
+-----------+ +-----.-----+
/_\
|
+------------+----------+
| |
+-------------------+ +----------------+
| GrlMetadataSource | | GrlMediaSource |
+-------------------+ +----------------+
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/browsing.c | 11 | ||||
-rw-r--r-- | examples/configuring-plugins.c | 4 | ||||
-rw-r--r-- | examples/efficient-metadata-resolution.c | 12 | ||||
-rw-r--r-- | examples/loading-plugins.c | 8 | ||||
-rw-r--r-- | examples/multivalues.c | 11 | ||||
-rw-r--r-- | examples/searching.c | 11 |
6 files changed, 26 insertions, 31 deletions
diff --git a/examples/browsing.c b/examples/browsing.c index 674ccb4..d9459da 100644 --- a/examples/browsing.c +++ b/examples/browsing.c @@ -62,26 +62,25 @@ browse_cb (GrlMediaSource *source, } static void -source_added_cb (GrlPluginRegistry *registry, gpointer user_data) +source_added_cb (GrlPluginRegistry *registry, GrlSource *source, gpointer user_data) { static gboolean first = TRUE; - GrlMetadataSource *source = GRL_METADATA_SOURCE (user_data); GList * keys = grl_metadata_key_list_new (GRL_METADATA_KEY_TITLE, GRL_METADATA_KEY_DURATION, GRL_METADATA_KEY_URL, GRL_METADATA_KEY_CHILDCOUNT, NULL); g_debug ("Detected new source available: '%s'", - grl_metadata_source_get_name (source)); + grl_source_get_name (source)); /* We will just issue a browse operation on the first browseble source we find */ if (first && - grl_metadata_source_supported_operations (source) & GRL_OP_BROWSE) { + grl_source_supported_operations (source) & GRL_OP_BROWSE) { GrlOperationOptions *options; GrlCaps *caps; first = FALSE; - g_debug ("Browsing source: %s", grl_metadata_source_get_name (source)); + g_debug ("Browsing source: %s", grl_source_get_name (source)); /* Here is how you can browse a source, you have to provide: 1) The source you want to browse contents from. 2) The container object you want to browse (NULL for the root container) @@ -92,7 +91,7 @@ source_added_cb (GrlPluginRegistry *registry, gpointer user_data) It returns an operation identifier that you can use to match results with the corresponding request (we ignore it here) */ - caps = grl_metadata_source_get_caps (source, GRL_OP_BROWSE); + caps = grl_source_get_caps (source, GRL_OP_BROWSE); options = grl_operation_options_new (caps); grl_operation_options_set_count (options, 5); grl_operation_options_set_flags (options, GRL_RESOLVE_IDLE_RELAY); diff --git a/examples/configuring-plugins.c b/examples/configuring-plugins.c index 6e75427..fd93444 100644 --- a/examples/configuring-plugins.c +++ b/examples/configuring-plugins.c @@ -10,11 +10,11 @@ GRL_LOG_DOMAIN_STATIC(example_log_domain); static void -source_added_cb (GrlPluginRegistry *registry, gpointer user_data) +source_added_cb (GrlPluginRegistry *registry, GrlSource *source, gpointer user_data) { /* If the Youtube plugin is installed, you should see it here now! */ g_debug ("Detected new source available: '%s'", - grl_metadata_source_get_name (GRL_METADATA_SOURCE (user_data))); + grl_source_get_name (source)); } static void diff --git a/examples/efficient-metadata-resolution.c b/examples/efficient-metadata-resolution.c index c407fcf..79a6b06 100644 --- a/examples/efficient-metadata-resolution.c +++ b/examples/efficient-metadata-resolution.c @@ -59,8 +59,7 @@ search_cb (GrlMediaSource *source, GrlCaps *caps; GList *keys = grl_metadata_key_list_new (GRL_METADATA_KEY_URL, NULL); - caps = grl_metadata_source_get_caps (GRL_METADATA_SOURCE (source), - GRL_OP_METADATA); + caps = grl_source_get_caps (GRL_SOURCE (source), GRL_OP_METADATA); options = grl_operation_options_new (caps); grl_operation_options_set_flags (options, GRL_RESOLVE_IDLE_RELAY); grl_media_source_metadata (source, @@ -76,10 +75,9 @@ search_cb (GrlMediaSource *source, } static void -source_added_cb (GrlPluginRegistry *registry, gpointer user_data) +source_added_cb (GrlPluginRegistry *registry, GrlSource *source, gpointer user_data) { - GrlMetadataSource *source = GRL_METADATA_SOURCE (user_data); - const gchar *source_id = grl_metadata_source_get_id (source); + const gchar *source_id = grl_source_get_id (source); GrlCaps *caps; GrlOperationOptions *options; @@ -92,10 +90,10 @@ source_added_cb (GrlPluginRegistry *registry, gpointer user_data) NULL); /* The source must be searchable */ - if (!(grl_metadata_source_supported_operations (source) & GRL_OP_SEARCH)) + if (!(grl_source_supported_operations (source) & GRL_OP_SEARCH)) g_error ("Source %s is not searchable!", source_id); - caps = grl_metadata_source_get_caps (source, GRL_OP_SEARCH); + caps = grl_source_get_caps (source, GRL_OP_SEARCH); options = grl_operation_options_new (caps); grl_operation_options_set_count (options, 5); grl_operation_options_set_flags (options, diff --git a/examples/loading-plugins.c b/examples/loading-plugins.c index b23e04d..9169ee4 100644 --- a/examples/loading-plugins.c +++ b/examples/loading-plugins.c @@ -10,20 +10,20 @@ GRL_LOG_DOMAIN_STATIC(example_log_domain); static void -source_added_cb (GrlPluginRegistry *registry, gpointer user_data) +source_added_cb (GrlPluginRegistry *registry, GrlSource *source, gpointer user_data) { g_debug ("Detected new source available: '%s'", - grl_metadata_source_get_name (GRL_METADATA_SOURCE (user_data))); + grl_source_get_name (source)); /* Usually you may add the new service to the user interface so the user can interact with it (browse, search, etc) */ } static void -source_removed_cb (GrlPluginRegistry *registry, gpointer user_data) +source_removed_cb (GrlPluginRegistry *registry, GrlSource *source, gpointer user_data) { g_debug ("Source '%s' is gone", - grl_metadata_source_get_name (GRL_METADATA_SOURCE (user_data))); + grl_source_get_name (source)); /* Usually you would inform the user that this service is no longer available (for example a UPnP server was shutdown) and remove it diff --git a/examples/multivalues.c b/examples/multivalues.c index e179097..0043afb 100644 --- a/examples/multivalues.c +++ b/examples/multivalues.c @@ -48,10 +48,9 @@ search_cb (GrlMediaSource *source, } static void -source_added_cb (GrlPluginRegistry *registry, gpointer user_data) +source_added_cb (GrlPluginRegistry *registry, GrlSource *source, gpointer user_data) { const gchar *id; - GrlMetadataSource *source = GRL_METADATA_SOURCE (user_data); GrlCaps *caps; GrlOperationOptions *options; GList * keys = grl_metadata_key_list_new (GRL_METADATA_KEY_TITLE, @@ -60,18 +59,18 @@ source_added_cb (GrlPluginRegistry *registry, gpointer user_data) NULL); /* Not interested if not searchable */ - if (!(grl_metadata_source_supported_operations (source) & GRL_OP_SEARCH)) + if (!(grl_source_supported_operations (source) & GRL_OP_SEARCH)) return; g_debug ("Detected new searchable source available: '%s'", - grl_metadata_source_get_name (source)); + grl_source_get_name (source)); /* Only interested in Youtube */ - id = grl_metadata_source_get_id (source); + id = grl_source_get_id (source); if (strcmp (id, "grl-youtube")) return; - caps = grl_metadata_source_get_caps (source, GRL_OP_SEARCH); + caps = grl_source_get_caps (source, GRL_OP_SEARCH); options = grl_operation_options_new (caps); grl_operation_options_set_skip (options, 0); grl_operation_options_set_count (options, 5); diff --git a/examples/searching.c b/examples/searching.c index 3c56e00..45b4ce7 100644 --- a/examples/searching.c +++ b/examples/searching.c @@ -45,10 +45,9 @@ search_cb (GrlMediaSource *source, } static void -source_added_cb (GrlPluginRegistry *registry, gpointer user_data) +source_added_cb (GrlPluginRegistry *registry, GrlSource *source, gpointer user_data) { const gchar *id; - GrlMetadataSource *source = GRL_METADATA_SOURCE (user_data); GrlCaps *caps; GrlOperationOptions *options; GList * keys = grl_metadata_key_list_new (GRL_METADATA_KEY_TITLE, @@ -57,18 +56,18 @@ source_added_cb (GrlPluginRegistry *registry, gpointer user_data) NULL); /* Not interested if not searchable */ - if (!(grl_metadata_source_supported_operations (source) & GRL_OP_SEARCH)) + if (!(grl_source_supported_operations (source) & GRL_OP_SEARCH)) return; g_debug ("Detected new searchable source available: '%s'", - grl_metadata_source_get_name (source)); + grl_source_get_name (source)); /* Only interested in Jamendo */ - id = grl_metadata_source_get_id (source); + id = grl_source_get_id (source); if (strcmp (id, "grl-jamendo")) return; - caps = grl_metadata_source_get_caps (source, GRL_OP_SEARCH); + caps = grl_source_get_caps (source, GRL_OP_SEARCH); options = grl_operation_options_new (caps); grl_operation_options_set_count (options, 5); grl_operation_options_set_flags (options, GRL_RESOLVE_IDLE_RELAY); |