summaryrefslogtreecommitdiff
path: root/tools/bluetooth-player.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2013-05-30 22:51:57 +0300
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2013-06-10 11:06:45 +0300
commitccc7d6726fd92f6d69508ca04db9472ee0163c86 (patch)
tree926281c1873f84b8cca51291b82c4270f67ebca7 /tools/bluetooth-player.c
parentffba5601a886a03fc96a4e861b745c144bebfa6b (diff)
downloadbluez-ccc7d6726fd92f6d69508ca04db9472ee0163c86.tar.gz
tools/bluetooth-player: Add rewind command
Add support for rewind command which can be used to rewind the playback
Diffstat (limited to 'tools/bluetooth-player.c')
-rw-r--r--tools/bluetooth-player.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/bluetooth-player.c b/tools/bluetooth-player.c
index dab0e6e25..b94c54ea7 100644
--- a/tools/bluetooth-player.c
+++ b/tools/bluetooth-player.c
@@ -260,6 +260,35 @@ static void cmd_fast_forward(int argc, char *argv[])
rl_printf("Fast forward playback\n");
}
+static void rewind_reply(DBusMessage *message, void *user_data)
+{
+ DBusError error;
+
+ dbus_error_init(&error);
+
+ if (dbus_set_error_from_message(&error, message) == TRUE) {
+ rl_printf("Failed to rewind: %s\n", error.name);
+ dbus_error_free(&error);
+ return;
+ }
+
+ rl_printf("Rewind successful\n");
+}
+
+static void cmd_rewind(int argc, char *argv[])
+{
+ if (!check_default_player())
+ return;
+
+ if (g_dbus_proxy_method_call(default_player, "Rewind", NULL,
+ rewind_reply, NULL, NULL) == FALSE) {
+ rl_printf("Failed to rewind\n");
+ return;
+ }
+
+ rl_printf("Rewind playback\n");
+}
+
static const struct {
const char *cmd;
const char *arg;
@@ -273,6 +302,7 @@ static const struct {
{ "previous", NULL, cmd_previous, "Jump to previous item" },
{ "fast-forward", NULL, cmd_fast_forward,
"Fast forward playback" },
+ { "rewind", NULL, cmd_rewind, "Rewind playback" },
{ "quit", NULL, cmd_quit, "Quit program" },
{ "exit", NULL, cmd_quit },
{ "help" },