[grilo-plugins] all: Send operation id in metadata()/media_from_uri()'s callbacks
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] all: Send operation id in metadata()/media_from_uri()'s callbacks
- Date: Wed, 13 Apr 2011 10:20:14 +0000 (UTC)
commit 5fd7ee0e290e6e3df87e950aeec062faabd99d8a
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date: Tue Apr 5 17:41:57 2011 +0000
all: Send operation id in metadata()/media_from_uri()'s callbacks
These callbacks requires now to send the operation id.
Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>
src/media/bookmarks/grl-bookmarks.c | 10 +++++-----
src/media/filesystem/grl-filesystem.c | 10 +++++-----
src/media/flickr/grl-flickr.c | 4 ++--
src/media/jamendo/grl-jamendo.c | 5 +++--
src/media/podcasts/grl-podcasts.c | 14 +++++++-------
src/media/tracker/grl-tracker-media-api.c | 6 +++---
src/media/upnp/grl-upnp.c | 10 +++++-----
src/media/vimeo/grl-vimeo.c | 4 ++--
src/media/youtube/grl-youtube.c | 14 +++++++-------
test/main.c | 3 ++-
10 files changed, 41 insertions(+), 39 deletions(-)
---
diff --git a/src/media/bookmarks/grl-bookmarks.c b/src/media/bookmarks/grl-bookmarks.c
index e01bd98..ced21e8 100644
--- a/src/media/bookmarks/grl-bookmarks.c
+++ b/src/media/bookmarks/grl-bookmarks.c
@@ -390,7 +390,7 @@ bookmark_metadata (GrlMediaSourceMetadataSpec *ms)
if (!id) {
/* Root category: special case */
grl_media_set_title (ms->media, GRL_ROOT_TITLE);
- ms->callback (ms->source, ms->media, ms->user_data, NULL);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, NULL);
return;
}
@@ -404,7 +404,7 @@ bookmark_metadata (GrlMediaSourceMetadataSpec *ms)
error = g_error_new (GRL_CORE_ERROR,
GRL_CORE_ERROR_METADATA_FAILED,
"Failed to get bookmark metadata");
- ms->callback (ms->source, ms->media, ms->user_data, error);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, error);
g_error_free (error);
return;
}
@@ -413,13 +413,13 @@ bookmark_metadata (GrlMediaSourceMetadataSpec *ms)
if (r == SQLITE_ROW) {
build_media_from_stmt (ms->media, sql_stmt);
- ms->callback (ms->source, ms->media, ms->user_data, NULL);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, NULL);
} else {
GRL_WARNING ("Failed to get bookmark: %s", sqlite3_errmsg (db));
error = g_error_new (GRL_CORE_ERROR,
GRL_CORE_ERROR_METADATA_FAILED,
"Failed to get bookmark metadata");
- ms->callback (ms->source, ms->media, ms->user_data, error);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, error);
g_error_free (error);
}
@@ -840,7 +840,7 @@ grl_bookmarks_source_metadata (GrlMediaSource *source,
error = g_error_new (GRL_CORE_ERROR,
GRL_CORE_ERROR_METADATA_FAILED,
"No database connection");
- ms->callback (ms->source, ms->media, ms->user_data, error);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, error);
g_error_free (error);
}
diff --git a/src/media/filesystem/grl-filesystem.c b/src/media/filesystem/grl-filesystem.c
index 5a45392..423099f 100644
--- a/src/media/filesystem/grl-filesystem.c
+++ b/src/media/filesystem/grl-filesystem.c
@@ -1196,13 +1196,13 @@ grl_filesystem_source_metadata (GrlMediaSource *source,
create_content (ms->media, path,
ms->flags & GRL_RESOLVE_FAST_ONLY,
!id);
- ms->callback (ms->source, ms->media, ms->user_data, NULL);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, NULL);
} else {
GError *error = g_error_new (GRL_CORE_ERROR,
GRL_CORE_ERROR_METADATA_FAILED,
"File '%s' does not exist",
path);
- ms->callback (ms->source, ms->media, ms->user_data, error);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, error);
g_error_free (error);
}
}
@@ -1252,7 +1252,7 @@ static void grl_filesystem_get_media_from_uri (GrlMediaSource *source,
error = g_error_new (GRL_CORE_ERROR,
GRL_CORE_ERROR_MEDIA_FROM_URI_FAILED,
"Cannot create media from '%s'", mfus->uri);
- mfus->callback (source, NULL, mfus->user_data, error);
+ mfus->callback (source, mfus->media_from_uri_id, NULL, mfus->user_data, error);
g_clear_error (&error);
return;
}
@@ -1265,7 +1265,7 @@ static void grl_filesystem_get_media_from_uri (GrlMediaSource *source,
"Cannot create media from '%s', error message: %s",
mfus->uri, error->message);
g_clear_error (&error);
- mfus->callback (source, NULL, mfus->user_data, new_error);
+ mfus->callback (source, mfus->media_from_uri_id, NULL, mfus->user_data, new_error);
g_clear_error (&new_error);
goto beach;
}
@@ -1274,7 +1274,7 @@ static void grl_filesystem_get_media_from_uri (GrlMediaSource *source,
/* Note: we assume create_content() never returns NULL, which seems to be true */
media = create_content (NULL, path, mfus->flags & GRL_RESOLVE_FAST_ONLY,
FALSE);
- mfus->callback (source, media, mfus->user_data, NULL);
+ mfus->callback (source, mfus->media_from_uri_id, media, mfus->user_data, NULL);
beach:
g_free (path);
diff --git a/src/media/flickr/grl-flickr.c b/src/media/flickr/grl-flickr.c
index 9f03028..e1ceed3 100644
--- a/src/media/flickr/grl-flickr.c
+++ b/src/media/flickr/grl-flickr.c
@@ -377,7 +377,7 @@ getInfo_cb (GFlickr *f, GHashTable *photo, gpointer user_data)
update_media (ms->media, photo);
}
- ms->callback (ms->source, ms->media, ms->user_data, NULL);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, NULL);
}
static void
@@ -699,7 +699,7 @@ grl_flickr_source_metadata (GrlMediaSource *source,
const gchar *id;
if (!ms->media || (id = grl_media_get_id (ms->media)) == NULL) {
- ms->callback (ms->source, ms->media, ms->user_data, NULL);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, NULL);
return;
}
diff --git a/src/media/jamendo/grl-jamendo.c b/src/media/jamendo/grl-jamendo.c
index e7a0011..b8426c2 100644
--- a/src/media/jamendo/grl-jamendo.c
+++ b/src/media/jamendo/grl-jamendo.c
@@ -722,6 +722,7 @@ read_done_cb (GObject *source_object,
switch (xpe->type) {
case METADATA:
xpe->spec.ms->callback (xpe->spec.ms->source,
+ xpe->spec.ms->metadata_id,
xpe->spec.ms->media,
xpe->spec.ms->user_data,
error);
@@ -1065,14 +1066,14 @@ grl_jamendo_source_metadata (GrlMediaSource *source,
g_free (url);
} else {
if (ms->media) {
- ms->callback (ms->source, ms->media, ms->user_data, NULL);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, NULL);
}
}
return;
send_error:
- ms->callback (ms->source, NULL, ms->user_data, error);
+ ms->callback (ms->source, ms->metadata_id, NULL, ms->user_data, error);
g_error_free (error);
}
diff --git a/src/media/podcasts/grl-podcasts.c b/src/media/podcasts/grl-podcasts.c
index ef412ea..791764b 100644
--- a/src/media/podcasts/grl-podcasts.c
+++ b/src/media/podcasts/grl-podcasts.c
@@ -1347,7 +1347,7 @@ stream_metadata (GrlMediaSourceMetadataSpec *ms)
error = g_error_new (GRL_CORE_ERROR,
GRL_CORE_ERROR_METADATA_FAILED,
"Failed to get podcast stream metadata");
- ms->callback (ms->source, ms->media, ms->user_data, error);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, error);
g_error_free (error);
return;
}
@@ -1356,13 +1356,13 @@ stream_metadata (GrlMediaSourceMetadataSpec *ms)
if (r == SQLITE_ROW) {
build_media_from_stmt (ms->media, sql_stmt, FALSE);
- ms->callback (ms->source, ms->media, ms->user_data, NULL);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, NULL);
} else {
GRL_WARNING ("Failed to get podcast stream: %s", sqlite3_errmsg (db));
error = g_error_new (GRL_CORE_ERROR,
GRL_CORE_ERROR_METADATA_FAILED,
"Failed to get podcast stream metadata");
- ms->callback (ms->source, ms->media, ms->user_data, error);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, error);
g_error_free (error);
}
@@ -1385,7 +1385,7 @@ podcast_metadata (GrlMediaSourceMetadataSpec *ms)
if (!id) {
/* Root category: special case */
grl_media_set_title (ms->media, GRL_ROOT_TITLE);
- ms->callback (ms->source, ms->media, ms->user_data, NULL);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, NULL);
return;
}
@@ -1393,14 +1393,14 @@ podcast_metadata (GrlMediaSourceMetadataSpec *ms)
if (sql_stmt) {
build_media_from_stmt (ms->media, sql_stmt, TRUE);
- ms->callback (ms->source, ms->media, ms->user_data, NULL);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, NULL);
sqlite3_finalize (sql_stmt);
} else {
GRL_WARNING ("Failed to get podcast: %s", sqlite3_errmsg (db));
error = g_error_new (GRL_CORE_ERROR,
GRL_CORE_ERROR_METADATA_FAILED,
"Failed to get podcast metadata");
- ms->callback (ms->source, ms->media, ms->user_data, error);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, error);
g_error_free (error);
}
}
@@ -1557,7 +1557,7 @@ grl_podcasts_source_metadata (GrlMediaSource *source,
error = g_error_new (GRL_CORE_ERROR,
GRL_CORE_ERROR_METADATA_FAILED,
"No database connection");
- ms->callback (ms->source, ms->media, ms->user_data, error);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, error);
g_error_free (error);
return;
}
diff --git a/src/media/tracker/grl-tracker-media-api.c b/src/media/tracker/grl-tracker-media-api.c
index e1db276..3aeba2f 100644
--- a/src/media/tracker/grl-tracker-media-api.c
+++ b/src/media/tracker/grl-tracker-media-api.c
@@ -394,7 +394,7 @@ tracker_metadata_cb (GObject *source_object,
"Failed to start metadata action : %s",
tracker_error->message);
- ms->callback (ms->source, ms->media, ms->user_data, error);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, error);
g_error_free (tracker_error);
g_error_free (error);
@@ -410,7 +410,7 @@ tracker_metadata_cb (GObject *source_object,
ms->media, cursor, col);
}
- ms->callback (ms->source, ms->media, ms->user_data, NULL);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, NULL);
}
end_operation:
@@ -619,7 +619,7 @@ grl_tracker_media_metadata (GrlMediaSource *source,
sparql_final = g_strdup_printf (TRACKER_BROWSE_FILESYSTEM_ROOT_REQUEST,
sparql_select, constraint, 0, 1);
} else {
- ms->callback (ms->source, ms->media, ms->user_data, NULL);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, NULL);
return;
}
} else {
diff --git a/src/media/upnp/grl-upnp.c b/src/media/upnp/grl-upnp.c
index 26da2de..db13e74 100644
--- a/src/media/upnp/grl-upnp.c
+++ b/src/media/upnp/grl-upnp.c
@@ -989,7 +989,7 @@ gupnp_metadata_result_cb (GUPnPDIDLLiteParser *parser,
GrlMediaSourceMetadataSpec *ms = (GrlMediaSourceMetadataSpec *) user_data;
if (gupnp_didl_lite_object_get_id (didl)) {
build_media_from_didl (ms->media, didl, ms->keys);
- ms->callback (ms->source, ms->media, ms->user_data, NULL);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, NULL);
}
}
@@ -1016,7 +1016,7 @@ gupnp_metadata_cb (GUPnPServiceProxy *service,
if (!result) {
GRL_WARNING ("Metadata operation failed");
- ms->callback (ms->source, ms->media, ms->user_data, error);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, error);
if (error) {
GRL_WARNING (" Reason: %s", error->message);
g_error_free (error);
@@ -1027,7 +1027,7 @@ gupnp_metadata_cb (GUPnPServiceProxy *service,
if (!didl) {
GRL_DEBUG ("Got no metadata");
- ms->callback (ms->source, ms->media, ms->user_data, NULL);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, NULL);
goto free_resources;
}
@@ -1041,7 +1041,7 @@ gupnp_metadata_cb (GUPnPServiceProxy *service,
&error);
if (error) {
GRL_WARNING ("Failed to parse DIDL result: %s", error->message);
- ms->callback (ms->source, ms->media, ms->user_data, error);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, error);
g_error_free (error);
goto free_resources;
}
@@ -1291,7 +1291,7 @@ grl_upnp_source_metadata (GrlMediaSource *source,
error = g_error_new (GRL_CORE_ERROR,
GRL_CORE_ERROR_METADATA_FAILED,
"Failed to start metadata action");
- ms->callback (ms->source, ms->media, ms->user_data, error);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, error);
g_error_free (error);
}
diff --git a/src/media/vimeo/grl-vimeo.c b/src/media/vimeo/grl-vimeo.c
index 8e9223e..b4901b2 100644
--- a/src/media/vimeo/grl-vimeo.c
+++ b/src/media/vimeo/grl-vimeo.c
@@ -341,7 +341,7 @@ video_get_play_url_cb (gchar *url, gpointer user_data)
grl_media_set_url (ms->media, url);
}
- ms->callback (ms->source, ms->media, ms->user_data, NULL);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, NULL);
}
/* ================== API Implementation ================ */
@@ -375,7 +375,7 @@ grl_vimeo_source_metadata (GrlMediaSource *source,
if (!ms->media || (id_str = grl_media_get_id (ms->media)) == NULL)
{
- ms->callback (ms->source, ms->media, ms->user_data, NULL);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, NULL);
return;
}
diff --git a/src/media/youtube/grl-youtube.c b/src/media/youtube/grl-youtube.c
index 208bafc..3e8fca3 100644
--- a/src/media/youtube/grl-youtube.c
+++ b/src/media/youtube/grl-youtube.c
@@ -894,7 +894,7 @@ static void
build_media_from_entry_metadata_cb (GrlMedia *media, gpointer user_data)
{
GrlMediaSourceMetadataSpec *ms = (GrlMediaSourceMetadataSpec *) user_data;
- ms->callback (ms->source, media, ms->user_data, NULL);
+ ms->callback (ms->source, ms->metadata_id, media, ms->user_data, NULL);
}
static void
@@ -966,7 +966,7 @@ metadata_cb (GObject *object,
#endif
if (error) {
error->code = GRL_CORE_ERROR_METADATA_FAILED;
- ms->callback (ms->source, ms->media, ms->user_data, error);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, error);
g_error_free (error);
} else {
build_media_from_entry (ms->media, video, ms->keys,
@@ -1330,7 +1330,7 @@ build_media_from_entry_media_from_uri_cb (GrlMedia *media, gpointer user_data)
{
GrlMediaSourceMediaFromUriSpec *mfus =
(GrlMediaSourceMediaFromUriSpec *) user_data;
- mfus->callback (mfus->source, media, mfus->user_data, NULL);
+ mfus->callback (mfus->source, mfus->media_from_uri_id, media, mfus->user_data, NULL);
}
static void
@@ -1356,7 +1356,7 @@ media_from_uri_cb (GObject *object, GAsyncResult *result, gpointer user_data)
if (error) {
error->code = GRL_CORE_ERROR_MEDIA_FROM_URI_FAILED;
- mfus->callback (mfus->source, NULL, mfus->user_data, error);
+ mfus->callback (mfus->source, mfus->media_from_uri_id, NULL, mfus->user_data, error);
g_error_free (error);
} else {
build_media_from_entry (NULL, video, mfus->keys,
@@ -1564,10 +1564,10 @@ grl_youtube_source_metadata (GrlMediaSource *source,
}
if (error) {
- ms->callback (ms->source, ms->media, ms->user_data, error);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, error);
g_error_free (error);
} else if (media) {
- ms->callback (ms->source, ms->media, ms->user_data, NULL);
+ ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, NULL);
}
}
@@ -1600,7 +1600,7 @@ grl_youtube_get_media_from_uri (GrlMediaSource *source,
error = g_error_new (GRL_CORE_ERROR,
GRL_CORE_ERROR_MEDIA_FROM_URI_FAILED,
"Cannot create media from '%s'", mfus->uri);
- mfus->callback (source, NULL, mfus->user_data, error);
+ mfus->callback (source, mfus->media_from_uri_id, NULL, mfus->user_data, error);
g_error_free (error);
return;
}
diff --git a/test/main.c b/test/main.c
index a2e4943..7a75d7c 100644
--- a/test/main.c
+++ b/test/main.c
@@ -137,6 +137,7 @@ browse_cb (GrlMediaSource *source,
static void
metadata_cb (GrlMediaSource *source,
+ guint operation_id,
GrlMedia *media,
gpointer user_data,
const GError *error)
@@ -169,7 +170,7 @@ resolve_cb (GrlMetadataSource *source,
gpointer user_data,
const GError *error)
{
- metadata_cb (NULL, media, user_data, error);
+ metadata_cb (NULL, 0, media, user_data, error);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]