diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2013-10-09 17:04:31 +0300 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2013-10-15 13:00:00 +0300 |
commit | bfc19ea0731dd47f9aa40cb3d501ce6f73f305e9 (patch) | |
tree | 86f201d6abf464e38826d78606eb11d69514eec0 | |
parent | b8a882a488d8369c0fd3d558e7b9e256ead64efb (diff) | |
download | bluez-bfc19ea0731dd47f9aa40cb3d501ce6f73f305e9.tar.gz |
audio/media: Add support for tracking Seeked signal
This tracks Seeked signal and update the position in case it happens.
-rw-r--r-- | profiles/audio/media.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/profiles/audio/media.c b/profiles/audio/media.c index 9c72b8dc4..646c76acc 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) { |