linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 06/14] tools: Add support for MPRIS TrackList.TrackMetadataChanged signal to mpris-player
Date: Wed, 15 May 2013 18:31:38 +0300	[thread overview]
Message-ID: <1368631906-15951-6-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1368631906-15951-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

---
 tools/mpris-player.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/tools/mpris-player.c b/tools/mpris-player.c
index 79d815b..681bb09 100644
--- a/tools/mpris-player.c
+++ b/tools/mpris-player.c
@@ -1694,6 +1694,8 @@ static const GDBusSignalTable tracklist_signals[] = {
 	{ GDBUS_SIGNAL("TrackAdded", GDBUS_ARGS({"metadata", "a{sv}"},
 						{"after", "o"})) },
 	{ GDBUS_SIGNAL("TrackRemoved", GDBUS_ARGS({"track", "o"})) },
+	{ GDBUS_SIGNAL("TrackMetadataChanged", GDBUS_ARGS({"track", "o"},
+						{"metadata", "a{sv}"})) },
 	{ }
 };
 
@@ -2281,6 +2283,41 @@ static void transport_property_changed(GDBusProxy *proxy, const char *name,
 						name);
 }
 
+static void item_property_changed(GDBusProxy *proxy, const char *name,
+					DBusMessageIter *iter, void *user_data)
+{
+	struct player *player;
+	DBusMessage *signal;
+	DBusMessageIter args;
+	const char *path;
+
+	path = g_dbus_proxy_get_path(proxy);
+
+	player = find_player_by_item(path);
+	if (player == NULL)
+		return;
+
+	if (strcasecmp(name, "Metadata") != 0)
+		return;
+
+	signal = dbus_message_new_signal(MPRIS_PLAYER_PATH,
+					MPRIS_TRACKLIST_INTERFACE,
+					"TrackMetadataChanged");
+	if (!signal) {
+		fprintf(stderr, "Unable to allocate new %s.TrackAdded signal",
+						MPRIS_TRACKLIST_INTERFACE);
+		return;
+	}
+
+	dbus_message_iter_init_append(signal, &args);
+
+	dbus_message_iter_append_basic(&args, DBUS_TYPE_OBJECT_PATH, &path);
+
+	append_iter(&args, iter);
+
+	g_dbus_send_message(player->conn, signal);
+}
+
 static void property_changed(GDBusProxy *proxy, const char *name,
 					DBusMessageIter *iter, void *user_data)
 {
@@ -2294,6 +2331,9 @@ static void property_changed(GDBusProxy *proxy, const char *name,
 	if (strcmp(interface, BLUEZ_MEDIA_TRANSPORT_INTERFACE) == 0)
 		return transport_property_changed(proxy, name, iter,
 								user_data);
+
+	if (strcmp(interface, BLUEZ_MEDIA_ITEM_INTERFACE) == 0)
+		return item_property_changed(proxy, name, iter, user_data);
 }
 
 int main(int argc, char *argv[])
-- 
1.8.1.4


  parent reply	other threads:[~2013-05-15 15:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-15 15:31 [PATCH BlueZ 01/14] tools: Add support for MPRIS TrackList interface to mpris-player Luiz Augusto von Dentz
2013-05-15 15:31 ` [PATCH BlueZ 02/14] tools: Add implementation of TrackList.GetTracksMetadata " Luiz Augusto von Dentz
2013-05-15 15:31 ` [PATCH BlueZ 03/14] tools: Add implementation of TrackList.GoTo " Luiz Augusto von Dentz
2013-05-15 15:31 ` [PATCH BlueZ 04/14] tools: Add support for MPRIS TrackList.TrackAdded signal " Luiz Augusto von Dentz
2013-05-15 15:31 ` [PATCH BlueZ 05/14] tools: Add support for MPRIS TrackList.TrackRemoved " Luiz Augusto von Dentz
2013-05-15 15:31 ` Luiz Augusto von Dentz [this message]
2013-05-15 15:31 ` [PATCH BlueZ 07/14] tools: Add support for MPRIS Playlists interface " Luiz Augusto von Dentz
2013-05-15 15:31 ` [PATCH BlueZ 08/14] tools: Add implementation of Playlists.ActivatePlaylist " Luiz Augusto von Dentz
2013-05-15 15:31 ` [PATCH BlueZ 09/14] tools: Add implementation of Playlists.GetPlaylists " Luiz Augusto von Dentz
2013-05-15 15:31 ` [PATCH BlueZ 10/14] tools: Map mpris:trackid to Item in mpris-player Luiz Augusto von Dentz
2013-05-15 15:31 ` [PATCH BlueZ 11/14] tools: Always register Playlists and TrackList " Luiz Augusto von Dentz
2013-05-15 15:31 ` [PATCH BlueZ 12/14] tools: Wait MediaFolder interface appear to enable " Luiz Augusto von Dentz
2013-05-15 15:31 ` [PATCH BlueZ 13/14] tools: Use playlist proxy instead of object path " Luiz Augusto von Dentz
2013-05-15 15:31 ` [PATCH BlueZ 14/14] tools: Emit changes to HasTrackList " Luiz Augusto von Dentz
2013-05-17  6:46 ` [PATCH BlueZ 01/14] tools: Add support for MPRIS TrackList interface to mpris-player Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1368631906-15951-6-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).