Linux bluetooth development
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 1/3] audio/media: Add support for tracking Seeked signal
Date: Fri, 11 Oct 2013 14:53:22 +0300	[thread overview]
Message-ID: <1381492404-25765-1-git-send-email-luiz.dentz@gmail.com> (raw)

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

This tracks Seeked signal and update the position in case it happens.
---
 profiles/audio/media.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index 9c72b8d..646c76a 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -96,6 +96,7 @@ struct media_player {
 	guint			watch;
 	guint			properties_watch;
 	guint			track_watch;
+	guint			seek_watch;
 	char			*status;
 	uint32_t		position;
 	uint32_t		duration;
@@ -949,6 +950,7 @@ static void media_player_free(gpointer data)
 	g_dbus_remove_watch(conn, mp->watch);
 	g_dbus_remove_watch(conn, mp->properties_watch);
 	g_dbus_remove_watch(conn, mp->track_watch);
+	g_dbus_remove_watch(conn, mp->seek_watch);
 
 	if (mp->track)
 		g_hash_table_unref(mp->track);
@@ -1681,6 +1683,21 @@ static gboolean properties_changed(DBusConnection *connection, DBusMessage *msg,
 	return TRUE;
 }
 
+static gboolean position_changed(DBusConnection *connection, DBusMessage *msg,
+							void *user_data)
+{
+	struct media_player *mp = user_data;
+	DBusMessageIter iter;
+
+	DBG("sender=%s path=%s", mp->sender, mp->path);
+
+	dbus_message_iter_init(msg, &iter);
+
+	set_position(mp, &iter);
+
+	return TRUE;
+}
+
 static struct media_player *media_player_create(struct media_adapter *adapter,
 						const char *sender,
 						const char *path,
@@ -1702,6 +1719,10 @@ static struct media_player *media_player_create(struct media_adapter *adapter,
 						path, MEDIA_PLAYER_INTERFACE,
 						properties_changed,
 						mp, NULL);
+	mp->seek_watch = g_dbus_add_signal_watch(conn, sender,
+						path, MEDIA_PLAYER_INTERFACE,
+						"Seeked", position_changed,
+						mp, NULL);
 	mp->player = avrcp_register_player(adapter->btd_adapter, &player_cb,
 							mp, media_player_free);
 	if (!mp->player) {
-- 
1.8.3.1


             reply	other threads:[~2013-10-11 11:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-11 11:53 Luiz Augusto von Dentz [this message]
2013-10-11 11:53 ` [PATCH BlueZ 2/3] audio/media: Send status changed if position changes Luiz Augusto von Dentz
2013-10-11 11:53 ` [PATCH BlueZ 3/3] tools/mpris-player: Forward player signals Luiz Augusto von Dentz
2013-10-15 10:11 ` [PATCH BlueZ 1/3] audio/media: Add support for tracking Seeked signal 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=1381492404-25765-1-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