From a6d08a5739649adabc574b016ef7cf192b997fa2 Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Mon, 16 Oct 2017 20:43:05 -0700 Subject: 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 --- binding/afm-mediaplayer-binding.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'binding') 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); } -- cgit 1.2.3-korg