summaryrefslogtreecommitdiffstats
path: root/binding/afm-mediaplayer-binding.c
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2017-10-16 20:43:05 -0700
committerMatt Ranostay <matt.ranostay@konsulko.com>2017-10-16 20:43:20 -0700
commita6d08a5739649adabc574b016ef7cf192b997fa2 (patch)
treed26b38dd514493cb4c66996c4afb3c00ce487a28 /binding/afm-mediaplayer-binding.c
parentf5dc724681b735f6645f58fc66d365ef4e9db4d2 (diff)
binding: mediaplayer: add playing status report
Report playing status back in the response of the control verb. Bug-AGL: SPEC-931 Change-Id: Iabaa162b01e1c29c1eb8b973b1a005ef433c2c92 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'binding/afm-mediaplayer-binding.c')
-rw-r--r--binding/afm-mediaplayer-binding.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/binding/afm-mediaplayer-binding.c b/binding/afm-mediaplayer-binding.c
index cac0f23..56213cb 100644
--- a/binding/afm-mediaplayer-binding.c
+++ b/binding/afm-mediaplayer-binding.c
@@ -290,6 +290,7 @@ static void controls(struct afb_req request)
const char *value = afb_req_value(request, "value");
const char *position = afb_req_value(request, "position");
int cmd = get_command_index(value);
+ json_object *jresp = NULL;
if (!value) {
afb_req_fail(request, "failed", "no value was passed");
@@ -301,12 +302,16 @@ static void controls(struct afb_req request)
switch (cmd) {
case PLAY_CMD:
+ jresp = json_object_new_object();
gst_element_set_state(data.playbin, GST_STATE_PLAYING);
data.playing = TRUE;
+ json_object_object_add(jresp, "playing", json_object_new_boolean(TRUE));
break;
case PAUSE_CMD:
+ jresp = json_object_new_object();
gst_element_set_state(data.playbin, GST_STATE_PAUSED);
data.playing = FALSE;
+ json_object_object_add(jresp, "playing", json_object_new_boolean(FALSE));
break;
case PREVIOUS_CMD:
case NEXT_CMD:
@@ -368,7 +373,7 @@ static void controls(struct afb_req request)
return;
}
- afb_req_success(request, NULL, NULL);
+ afb_req_success(request, jresp, NULL);
pthread_mutex_unlock(&mutex);
}