[grilo] core: renamed media_from_site API to media_from_uri.
- From: Iago Toral Quiroga <itoral src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo] core: renamed media_from_site API to media_from_uri.
- Date: Mon, 13 Dec 2010 11:47:33 +0000 (UTC)
commit 3962e466cab4bbd9f137e043e2d52cf2e2f0ecd0
Author: Iago Toral Quiroga <itoral igalia com>
Date: Mon Dec 13 12:23:49 2010 +0100
core: renamed media_from_site API to media_from_uri.
https://bugzilla.gnome.org/show_bug.cgi?id=635394
src/grl-error.h | 2 +-
src/grl-media-source.c | 108 ++++++++++++++++++++++----------------------
src/grl-media-source.h | 42 +++++++++---------
src/grl-metadata-source.h | 5 +-
src/grl-multiple.c | 90 +++++++++++++++++++-------------------
src/grl-multiple.h | 10 ++--
6 files changed, 129 insertions(+), 128 deletions(-)
---
diff --git a/src/grl-error.h b/src/grl-error.h
index c6e42d0..1f677c6 100644
--- a/src/grl-error.h
+++ b/src/grl-error.h
@@ -61,7 +61,7 @@ typedef enum {
GRL_CORE_ERROR_STORE_FAILED,
GRL_CORE_ERROR_REMOVE_FAILED,
GRL_CORE_ERROR_SET_METADATA_FAILED,
- GRL_CORE_ERROR_MEDIA_FROM_SITE_FAILED,
+ GRL_CORE_ERROR_MEDIA_FROM_URI_FAILED,
} GrlCoreError;
#endif /* _GRL_ERROR_H_ */
diff --git a/src/grl-media-source.c b/src/grl-media-source.c
index 973b4f3..48fbf6c 100644
--- a/src/grl-media-source.c
+++ b/src/grl-media-source.c
@@ -141,10 +141,10 @@ struct MetadataRelayCb {
GrlMediaSourceMetadataSpec *spec;
};
-struct MediaFromSiteRelayCb {
+struct MediaFromUriRelayCb {
GrlMediaSourceMetadataCb user_callback;
gpointer user_data;
- GrlMediaSourceMediaFromSiteSpec *spec;
+ GrlMediaSourceMediaFromUriSpec *spec;
};
struct OperationState {
@@ -548,16 +548,16 @@ remove_idle (gpointer user_data)
}
static void
-media_from_site_relay_cb (GrlMediaSource *source,
- GrlMedia *media,
- gpointer user_data,
- const GError *error)
+media_from_uri_relay_cb (GrlMediaSource *source,
+ GrlMedia *media,
+ gpointer user_data,
+ const GError *error)
{
- GRL_DEBUG ("media_from_site_relay_cb");
+ GRL_DEBUG ("media_from_uri_relay_cb");
- struct MediaFromSiteRelayCb *mfsrc;
+ struct MediaFromUriRelayCb *mfsrc;
- mfsrc = (struct MediaFromSiteRelayCb *) user_data;
+ mfsrc = (struct MediaFromUriRelayCb *) user_data;
if (media) {
grl_media_set_source (media,
grl_metadata_source_get_id (GRL_METADATA_SOURCE (source)));
@@ -566,20 +566,20 @@ media_from_site_relay_cb (GrlMediaSource *source,
mfsrc->user_callback (source, media, mfsrc->user_data, error);
g_object_unref (mfsrc->spec->source);
- g_free (mfsrc->spec->site_uri);
+ g_free (mfsrc->spec->uri);
g_list_free (mfsrc->spec->keys);
g_free (mfsrc->spec);
g_free (mfsrc);
}
static gboolean
-media_from_site_idle (gpointer user_data)
+media_from_uri_idle (gpointer user_data)
{
- GRL_DEBUG ("media_from_site_idle");
- GrlMediaSourceMediaFromSiteSpec *mfss =
- (GrlMediaSourceMediaFromSiteSpec *) user_data;
- GRL_MEDIA_SOURCE_GET_CLASS (mfss->source)->media_from_site (mfss->source,
- mfss);
+ GRL_DEBUG ("media_from_uri_idle");
+ GrlMediaSourceMediaFromUriSpec *mfus =
+ (GrlMediaSourceMediaFromUriSpec *) user_data;
+ GRL_MEDIA_SOURCE_GET_CLASS (mfus->source)->media_from_uri (mfus->source,
+ mfus);
return FALSE;
}
@@ -1984,9 +1984,9 @@ grl_media_source_supported_operations (GrlMetadataSource *metadata_source)
caps |= GRL_OP_STORE;
if (media_source_class->remove)
caps |= GRL_OP_REMOVE;
- if (media_source_class->test_media_from_site &&
- media_source_class->media_from_site)
- caps |= GRL_OP_MEDIA_FROM_SITE;
+ if (media_source_class->test_media_from_uri &&
+ media_source_class->media_from_uri)
+ caps |= GRL_OP_MEDIA_FROM_URI;
return caps;
}
@@ -2300,71 +2300,71 @@ grl_media_source_remove_sync (GrlMediaSource *source,
}
/**
- * grl_media_source_test_media_from_site:
+ * grl_media_source_test_media_from_uri:
* @source: a media source
- * @site_uri: The media site URI
+ * @uri: A URI that can be used to identify a media resource
*
* Tests whether @source can instantiate a #GrlMedia object representing
- * the media resource exposed at @site_uri.
+ * the media resource exposed at @uri.
*
* Returns: %TRUE if it can, %FALSE otherwise.
*
* This method is synchronous.
*/
gboolean
-grl_media_source_test_media_from_site (GrlMediaSource *source,
- const gchar *site_uri)
+grl_media_source_test_media_from_uri (GrlMediaSource *source,
+ const gchar *uri)
{
- GRL_DEBUG ("grl_media_source_test_media_from_site");
+ GRL_DEBUG ("grl_media_source_test_media_from_uri");
g_return_val_if_fail (GRL_IS_MEDIA_SOURCE (source), FALSE);
- g_return_val_if_fail (site_uri != NULL, FALSE);
+ g_return_val_if_fail (uri != NULL, FALSE);
- if (GRL_MEDIA_SOURCE_GET_CLASS (source)->test_media_from_site) {
- return GRL_MEDIA_SOURCE_GET_CLASS (source)->test_media_from_site (source,
- site_uri);
+ if (GRL_MEDIA_SOURCE_GET_CLASS (source)->test_media_from_uri) {
+ return GRL_MEDIA_SOURCE_GET_CLASS (source)->test_media_from_uri (source,
+ uri);
} else {
return FALSE;
}
}
/**
- * grl_media_source_get_media_from_site:
+ * grl_media_source_get_media_from_uri:
* @source: a media source
- * @site_uri: The media site URI
+ * @uri: A URI that can be used to identify a media resource
* @keys: A list of keys to resolve
* @callback: (scope notified): the user defined callback
* @user_data: the user data to pass in the callback
*
* Creates an instance of #GrlMedia representing the media resource
- * exposed at @site_uri.
+ * exposed at @uri.
*
- * It is recommended to call grl_media_source_test_media_from_site() before
+ * It is recommended to call grl_media_source_test_media_from_uri() before
* invoking this to check whether the target source can theoretically do the
* resolution.
*
* This method is asynchronous.
*/
void
-grl_media_source_get_media_from_site (GrlMediaSource *source,
- const gchar *site_uri,
- const GList *keys,
- GrlMetadataResolutionFlags flags,
- GrlMediaSourceMetadataCb callback,
- gpointer user_data)
+grl_media_source_get_media_from_uri (GrlMediaSource *source,
+ const gchar *uri,
+ const GList *keys,
+ GrlMetadataResolutionFlags flags,
+ GrlMediaSourceMetadataCb callback,
+ gpointer user_data)
{
- GRL_DEBUG ("grl_media_source_get_media_from_site");
+ GRL_DEBUG ("grl_media_source_get_media_from_uri");
GList *_keys;
- GrlMediaSourceMediaFromSiteSpec *mfss;
- struct MediaFromSiteRelayCb *mfsrc;
+ GrlMediaSourceMediaFromUriSpec *mfus;
+ struct MediaFromUriRelayCb *mfsrc;
g_return_if_fail (GRL_IS_MEDIA_SOURCE (source));
- g_return_if_fail (site_uri != NULL);
+ g_return_if_fail (uri != NULL);
g_return_if_fail (keys != NULL);
g_return_if_fail (callback != NULL);
g_return_if_fail (grl_metadata_source_supported_operations (GRL_METADATA_SOURCE (source)) &
- GRL_OP_MEDIA_FROM_SITE);
+ GRL_OP_MEDIA_FROM_URI);
_keys = g_list_copy ((GList *) keys);
if (flags & GRL_RESOLVE_FAST_ONLY) {
@@ -2381,21 +2381,21 @@ grl_media_source_get_media_from_site (GrlMediaSource *source,
post-processing before handing out the results
to the user */
- mfsrc = g_new0 (struct MediaFromSiteRelayCb, 1);
+ mfsrc = g_new0 (struct MediaFromUriRelayCb, 1);
mfsrc->user_callback = callback;
mfsrc->user_data = user_data;
- mfss = g_new0 (GrlMediaSourceMediaFromSiteSpec, 1);
- mfss->source = g_object_ref (source);
- mfss->site_uri = g_strdup (site_uri);
- mfss->keys = _keys;
- mfss->flags = flags;
- mfss->callback = media_from_site_relay_cb;
- mfss->user_data = mfsrc;
+ mfus = g_new0 (GrlMediaSourceMediaFromUriSpec, 1);
+ mfus->source = g_object_ref (source);
+ mfus->uri = g_strdup (uri);
+ mfus->keys = _keys;
+ mfus->flags = flags;
+ mfus->callback = media_from_uri_relay_cb;
+ mfus->user_data = mfsrc;
/* Save a reference to the operaton spec in the relay-cb's
user_data so that we can free the spec there */
- mfsrc->spec = mfss;
+ mfsrc->spec = mfus;
- g_idle_add (media_from_site_idle, mfss);
+ g_idle_add (media_from_uri_idle, mfus);
}
diff --git a/src/grl-media-source.h b/src/grl-media-source.h
index c383e3f..b3cf386 100644
--- a/src/grl-media-source.h
+++ b/src/grl-media-source.h
@@ -285,25 +285,25 @@ typedef struct {
} GrlMediaSourceRemoveSpec;
/**
- * GrlMediaSourceMediaFromSiteSpec:
+ * GrlMediaSourceMediaFromUriSpec:
* @source: a media source
- * @site_uri: The site media URI
+ * @uri: A URI that can be used to identify a media resource
* @keys: Metadata keys to resolve
* @flags: Operation flags
* @callback: the user defined callback
* @user_data: the user data to pass in the callback
*
* Data transport structure used internally by the plugins which support
- * media_from_site vmethod.
+ * media_from_uri vmethod.
*/
typedef struct {
GrlMediaSource *source;
- gchar *site_uri;
+ gchar *uri;
GList *keys;
GrlMetadataResolutionFlags flags;
GrlMediaSourceMetadataCb callback;
gpointer user_data;
-} GrlMediaSourceMediaFromSiteSpec;
+} GrlMediaSourceMediaFromUriSpec;
/* GrlMediaSource class */
@@ -321,10 +321,10 @@ typedef struct _GrlMediaSourceClass GrlMediaSourceClass;
* @metadata: request for specific metadata
* @store: store a media in a container
* @remove: remove a media from a container
- * @test_media_from_site: tests if this source can create #GrlMedia
- * instances from a given site URI.
- * @media_from_site: Creates a #GrlMedia instance representing the media
- * exposed by a certain site URI.
+ * @test_media_from_uri: tests if this source can create #GrlMedia
+ * instances from a given URI.
+ * @media_from_uri: Creates a #GrlMedia instance representing the media
+ * exposed by a certain URI.
*
* Grilo MediaSource class. Override the vmethods to implement the
* source functionality.
@@ -349,11 +349,11 @@ struct _GrlMediaSourceClass {
void (*remove) (GrlMediaSource *source, GrlMediaSourceRemoveSpec *ss);
- gboolean (*test_media_from_site) (GrlMediaSource *source,
- const gchar *site_uri);
+ gboolean (*test_media_from_uri) (GrlMediaSource *source,
+ const gchar *uri);
- void (*media_from_site) (GrlMediaSource *source,
- GrlMediaSourceMediaFromSiteSpec *mfss);
+ void (*media_from_uri) (GrlMediaSource *source,
+ GrlMediaSourceMediaFromUriSpec *mfss);
};
G_BEGIN_DECLS
@@ -459,15 +459,15 @@ void grl_media_source_set_auto_split_threshold (GrlMediaSource *source,
guint grl_media_source_get_auto_split_threshold (GrlMediaSource *source);
-gboolean grl_media_source_test_media_from_site (GrlMediaSource *source,
- const gchar *site_uri);
+gboolean grl_media_source_test_media_from_uri (GrlMediaSource *source,
+ const gchar *uri);
-void grl_media_source_get_media_from_site (GrlMediaSource *source,
- const gchar *site_uri,
- const GList *keys,
- GrlMetadataResolutionFlags flags,
- GrlMediaSourceMetadataCb callback,
- gpointer user_data);
+void grl_media_source_get_media_from_uri (GrlMediaSource *source,
+ const gchar *uri,
+ const GList *keys,
+ GrlMetadataResolutionFlags flags,
+ GrlMediaSourceMetadataCb callback,
+ gpointer user_data);
G_END_DECLS
diff --git a/src/grl-metadata-source.h b/src/grl-metadata-source.h
index 6f9faf2..b4c51af 100644
--- a/src/grl-metadata-source.h
+++ b/src/grl-metadata-source.h
@@ -194,7 +194,8 @@ typedef struct {
* @GRL_OP_STORE_PARENT: Store content as child of a certian parent category.
* @GRL_OP_REMOVE: Remove content from a service.
* @GRL_OP_SET_METADATA: Update metadata of a #GrlMedia in a service.
- * @GRL_OP_MEDIA_FROM_SITE: Create a #GrlMedia instance from a site URL.
+ * @GRL_OP_MEDIA_FROM_URI: Create a #GrlMedia instance from an URI
+ * representing a media resource.
*
* Bitwise flags which reflect the kind of operations that a
* #GrlMediaPlugin supports.
@@ -210,7 +211,7 @@ typedef enum {
GRL_OP_STORE_PARENT = 1 << 6,
GRL_OP_REMOVE = 1 << 7,
GRL_OP_SET_METADATA = 1 << 8,
- GRL_OP_MEDIA_FROM_SITE = 1 << 9,
+ GRL_OP_MEDIA_FROM_URI = 1 << 9,
} GrlSupportedOps;
/* GrlMetadataSource class */
diff --git a/src/grl-multiple.c b/src/grl-multiple.c
index 97008ce..fcd7a2c 100644
--- a/src/grl-multiple.c
+++ b/src/grl-multiple.c
@@ -72,8 +72,8 @@ struct CallbackData {
gpointer user_data;
};
-struct MediaFromSiteCallbackData {
- gchar *site_uri;
+struct MediaFromUriCallbackData {
+ gchar *uri;
GrlMediaSourceMetadataCb user_callback;
gpointer user_data;
};
@@ -436,37 +436,37 @@ multiple_search_cb (GrlMediaSource *source,
}
static void
-free_media_from_site_data (struct MediaFromSiteCallbackData *mfscd)
+free_media_from_uri_data (struct MediaFromUriCallbackData *mfucd)
{
- GRL_DEBUG ("free_media_from_site_data");
- g_free (mfscd->site_uri);
- g_free (mfscd);
+ GRL_DEBUG ("free_media_from_uri_data");
+ g_free (mfucd->uri);
+ g_free (mfucd);
}
static void
-media_from_site_cb (GrlMediaSource *source,
- GrlMedia *media,
- gpointer user_data,
- const GError *error)
+media_from_uri_cb (GrlMediaSource *source,
+ GrlMedia *media,
+ gpointer user_data,
+ const GError *error)
{
- struct MediaFromSiteCallbackData *mfscd =
- (struct MediaFromSiteCallbackData *) user_data;
+ struct MediaFromUriCallbackData *mfucd =
+ (struct MediaFromUriCallbackData *) user_data;
if (error) {
- mfscd->user_callback (NULL, NULL, mfscd->user_data, error);
+ mfucd->user_callback (NULL, NULL, mfucd->user_data, error);
} else if (media) {
- mfscd->user_callback (source, media, mfscd->user_data, NULL);
+ mfucd->user_callback (source, media, mfucd->user_data, NULL);
} else {
GError *_error = g_error_new (GRL_CORE_ERROR,
- GRL_CORE_ERROR_MEDIA_FROM_SITE_FAILED,
- "Could not resolve media for site URI '%s'",
- mfscd->site_uri);
+ GRL_CORE_ERROR_MEDIA_FROM_URI_FAILED,
+ "Could not resolve media for URI '%s'",
+ mfucd->uri);
- mfscd->user_callback (source, media, mfscd->user_data, _error);
+ mfucd->user_callback (source, media, mfucd->user_data, _error);
g_error_free (_error);
}
- free_media_from_site_data (mfscd);
+ free_media_from_uri_data (mfucd);
}
/* ================ API ================ */
@@ -661,8 +661,8 @@ grl_multiple_search_sync (const GList *sources,
}
/**
- * grl_multiple_get_media_from_site:
- * @site_uri: Site URI where the media is exposed.
+ * grl_multiple_get_media_from_uri:
+ * @uri: A URI that can be used to identify a media resource
* @keys: List of metadata keys we want to obtain.
* @flags: the operation flags
* @callback: (scope notified): the user defined callback
@@ -670,49 +670,49 @@ grl_multiple_search_sync (const GList *sources,
*
* Goes though all available media sources until it finds one capable of
* constructing a GrlMedia object representing the media resource exposed
- * by @site_url.
+ * by @uri.
*
* This method is asynchronous.
*/
void
-grl_multiple_get_media_from_site (const gchar *site_uri,
- const GList *keys,
- GrlMetadataResolutionFlags flags,
- GrlMediaSourceMetadataCb callback,
- gpointer user_data)
+grl_multiple_get_media_from_uri (const gchar *uri,
+ const GList *keys,
+ GrlMetadataResolutionFlags flags,
+ GrlMediaSourceMetadataCb callback,
+ gpointer user_data)
{
GrlPluginRegistry *registry;
GList *sources, *iter;
gboolean found = FALSE;
- g_return_if_fail (site_uri != NULL);
+ g_return_if_fail (uri != NULL);
g_return_if_fail (keys != NULL);
g_return_if_fail (callback != NULL);
registry = grl_plugin_registry_get_default ();
sources =
grl_plugin_registry_get_sources_by_operations (registry,
- GRL_OP_MEDIA_FROM_SITE,
+ GRL_OP_MEDIA_FROM_URI,
TRUE);
- /* Look for the first source that knows how to deal with 'site_uri' */
+ /* Look for the first source that knows how to deal with 'uri' */
iter = sources;
while (iter && !found) {
GrlMediaSource *source = GRL_MEDIA_SOURCE (iter->data);
- if (grl_media_source_test_media_from_site (source, site_uri)) {
- struct MediaFromSiteCallbackData *mfscd =
- g_new0 (struct MediaFromSiteCallbackData, 1);
-
- mfscd->user_callback = callback;
- mfscd->user_data = user_data;
- mfscd->site_uri = g_strdup (site_uri);
-
- grl_media_source_get_media_from_site (source,
- site_uri,
- keys,
- flags,
- media_from_site_cb,
- mfscd);
+ if (grl_media_source_test_media_from_uri (source, uri)) {
+ struct MediaFromUriCallbackData *mfucd =
+ g_new0 (struct MediaFromUriCallbackData, 1);
+
+ mfucd->user_callback = callback;
+ mfucd->user_data = user_data;
+ mfucd->uri = g_strdup (uri);
+
+ grl_media_source_get_media_from_uri (source,
+ uri,
+ keys,
+ flags,
+ media_from_uri_cb,
+ mfucd);
found = TRUE;
}
iter = g_list_next (iter);
@@ -720,7 +720,7 @@ grl_multiple_get_media_from_site (const gchar *site_uri,
g_list_free (sources);
- /* No source knows how to deal with 'site_uri', invoke user callback
+ /* No source knows how to deal with 'uri', invoke user callback
with NULL GrlMedia */
if (!found) {
callback (NULL, NULL, user_data, NULL);
diff --git a/src/grl-multiple.h b/src/grl-multiple.h
index 780f09f..035c120 100644
--- a/src/grl-multiple.h
+++ b/src/grl-multiple.h
@@ -48,10 +48,10 @@ GList *grl_multiple_search_sync (const GList *sources,
void grl_multiple_cancel (guint search_id);
-void grl_multiple_get_media_from_site (const gchar *site_uri,
- const GList *keys,
- GrlMetadataResolutionFlags flags,
- GrlMediaSourceMetadataCb callback,
- gpointer user_data);
+void grl_multiple_get_media_from_uri (const gchar *uri,
+ const GList *keys,
+ GrlMetadataResolutionFlags flags,
+ GrlMediaSourceMetadataCb callback,
+ gpointer user_data);
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]