[grilo] core: Added flags input parameter to media_from_site() APIs.
- From: Iago Toral Quiroga <itoral src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo] core: Added flags input parameter to media_from_site() APIs.
- Date: Mon, 13 Dec 2010 11:47:28 +0000 (UTC)
commit 2c47a7cc3ae7c3058b80673609419fafe0de91e4
Author: Iago Toral Quiroga <itoral igalia com>
Date: Fri Dec 3 09:55:41 2010 +0100
core: Added flags input parameter to media_from_site() APIs.
https://bugzilla.gnome.org/show_bug.cgi?id=635394
src/grl-media-source.c | 18 +++++++++++++++++-
src/grl-media-source.h | 3 +++
src/grl-multiple.c | 3 +++
src/grl-multiple.h | 1 +
4 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/src/grl-media-source.c b/src/grl-media-source.c
index cbc74d5..973b4f3 100644
--- a/src/grl-media-source.c
+++ b/src/grl-media-source.c
@@ -2349,11 +2349,13 @@ 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_DEBUG ("grl_media_source_get_media_from_site");
+ GList *_keys;
GrlMediaSourceMediaFromSiteSpec *mfss;
struct MediaFromSiteRelayCb *mfsrc;
@@ -2364,6 +2366,17 @@ grl_media_source_get_media_from_site (GrlMediaSource *source,
g_return_if_fail (grl_metadata_source_supported_operations (GRL_METADATA_SOURCE (source)) &
GRL_OP_MEDIA_FROM_SITE);
+ _keys = g_list_copy ((GList *) keys);
+ if (flags & GRL_RESOLVE_FAST_ONLY) {
+ grl_metadata_source_filter_slow (GRL_METADATA_SOURCE (source),
+ &_keys, FALSE);
+ }
+
+ /* We cannot prepare for full resolution yet because we don't
+ have a GrlMedia t operate with.
+ TODO: full resolution could be added in the relay calback
+ when we get the GrlMedia object */
+
/* Always hook an own relay callback so we can do some
post-processing before handing out the results
to the user */
@@ -2375,10 +2388,13 @@ grl_media_source_get_media_from_site (GrlMediaSource *source,
mfss = g_new0 (GrlMediaSourceMediaFromSiteSpec, 1);
mfss->source = g_object_ref (source);
mfss->site_uri = g_strdup (site_uri);
- mfss->keys = (GList *) g_list_copy (keys);
+ mfss->keys = _keys;
+ mfss->flags = flags;
mfss->callback = media_from_site_relay_cb;
mfss->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;
g_idle_add (media_from_site_idle, mfss);
diff --git a/src/grl-media-source.h b/src/grl-media-source.h
index 764257e..c383e3f 100644
--- a/src/grl-media-source.h
+++ b/src/grl-media-source.h
@@ -289,6 +289,7 @@ typedef struct {
* @source: a media source
* @site_uri: The site media URI
* @keys: Metadata keys to resolve
+ * @flags: Operation flags
* @callback: the user defined callback
* @user_data: the user data to pass in the callback
*
@@ -299,6 +300,7 @@ typedef struct {
GrlMediaSource *source;
gchar *site_uri;
GList *keys;
+ GrlMetadataResolutionFlags flags;
GrlMediaSourceMetadataCb callback;
gpointer user_data;
} GrlMediaSourceMediaFromSiteSpec;
@@ -463,6 +465,7 @@ gboolean grl_media_source_test_media_from_site (GrlMediaSource *source,
void grl_media_source_get_media_from_site (GrlMediaSource *source,
const gchar *site_uri,
const GList *keys,
+ GrlMetadataResolutionFlags flags,
GrlMediaSourceMetadataCb callback,
gpointer user_data);
diff --git a/src/grl-multiple.c b/src/grl-multiple.c
index 651ed0e..97008ce 100644
--- a/src/grl-multiple.c
+++ b/src/grl-multiple.c
@@ -664,6 +664,7 @@ grl_multiple_search_sync (const GList *sources,
* grl_multiple_get_media_from_site:
* @site_uri: Site URI where the media is exposed.
* @keys: List of metadata keys we want to obtain.
+ * @flags: the operation flags
* @callback: (scope notified): the user defined callback
* @user_data: the user data to pass to the user callback
*
@@ -676,6 +677,7 @@ grl_multiple_search_sync (const GList *sources,
void
grl_multiple_get_media_from_site (const gchar *site_uri,
const GList *keys,
+ GrlMetadataResolutionFlags flags,
GrlMediaSourceMetadataCb callback,
gpointer user_data)
{
@@ -708,6 +710,7 @@ grl_multiple_get_media_from_site (const gchar *site_uri,
grl_media_source_get_media_from_site (source,
site_uri,
keys,
+ flags,
media_from_site_cb,
mfscd);
found = TRUE;
diff --git a/src/grl-multiple.h b/src/grl-multiple.h
index 8cc69c8..780f09f 100644
--- a/src/grl-multiple.h
+++ b/src/grl-multiple.h
@@ -50,6 +50,7 @@ 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]