[PATCH 09/15] shoutcast: updated for the new caps and options APIs



From: Guillaume Emont <guijemont igalia com>

---
 src/media/shoutcast/grl-shoutcast.c |   29 +++++++++++++++++++++++------
 1 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/src/media/shoutcast/grl-shoutcast.c b/src/media/shoutcast/grl-shoutcast.c
index 57b2240..34cdced 100644
--- a/src/media/shoutcast/grl-shoutcast.c
+++ b/src/media/shoutcast/grl-shoutcast.c
@@ -89,6 +89,9 @@ gboolean grl_shoutcast_plugin_init (GrlPluginRegistry *registry,
 
 static const GList *grl_shoutcast_source_supported_keys (GrlMetadataSource *source);
 
+static GrlCaps * grl_shoutcast_source_get_caps (GrlMetadataSource *source,
+                                                GrlSupportedOps operation);
+
 static void grl_shoutcast_source_metadata (GrlMediaSource *source,
                                            GrlMediaSourceMetadataSpec *ms);
 
@@ -152,6 +155,7 @@ grl_shoutcast_source_class_init (GrlShoutcastSourceClass * klass)
   source_class->search = grl_shoutcast_source_search;
   metadata_class->cancel = grl_shoutcast_source_cancel;
   metadata_class->supported_keys = grl_shoutcast_source_supported_keys;
+  metadata_class->get_caps = grl_shoutcast_source_get_caps;
   gobject_class->finalize = grl_shoutcast_source_finalize;
 }
 
@@ -636,8 +640,8 @@ grl_shoutcast_source_browse (GrlMediaSource *source,
   data->source = source;
   data->operation_id = bs->browse_id;
   data->result_cb = bs->callback;
-  data->skip = bs->skip;
-  data->count = bs->count;
+  data->skip = grl_operation_options_get_skip (bs->options);
+  data->count = grl_operation_options_get_count (bs->options);
   data->user_data = bs->user_data;
   data->error_code = GRL_CORE_ERROR_BROWSE_FAILED;
 
@@ -650,7 +654,7 @@ grl_shoutcast_source_browse (GrlMediaSource *source,
   } else {
     url = g_strdup_printf (SHOUTCAST_GET_RADIOS,
                            container_id,
-                           bs->skip + bs->count);
+                           data->skip + data->count);
     data->genre = g_strdup (container_id);
   }
 
@@ -689,8 +693,8 @@ grl_shoutcast_source_search (GrlMediaSource *source,
   data->source = source;
   data->operation_id = ss->search_id;
   data->result_cb = ss->callback;
-  data->skip = ss->skip;
-  data->count = ss->count;
+  data->skip = grl_operation_options_get_skip (ss->options);
+  data->count = grl_operation_options_get_count (ss->options);
   data->user_data = ss->user_data;
   data->error_code = GRL_CORE_ERROR_SEARCH_FAILED;
 
@@ -698,7 +702,7 @@ grl_shoutcast_source_search (GrlMediaSource *source,
 
   url = g_strdup_printf (SHOUTCAST_SEARCH_RADIOS,
                          ss->text,
-                         ss->skip + ss->count);
+                         data->skip + data->count);
 
   read_url_async (url, data);
 
@@ -722,3 +726,16 @@ grl_shoutcast_source_cancel (GrlMetadataSource *source, guint operation_id)
     op_data->cancelled = TRUE;
   }
 }
+
+static GrlCaps *
+grl_shoutcast_source_get_caps (GrlMetadataSource *source,
+                               GrlSupportedOps operation)
+{
+  static GrlCaps *caps = NULL;
+
+  if (caps == NULL) {
+    caps = grl_caps_new ();
+  }
+
+  return caps;
+}
-- 
1.7.5.4



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