From a04e0913014e319f7c60e8708824ebe240047882 Mon Sep 17 00:00:00 2001 From: Loïc Collignon Date: Fri, 23 Nov 2018 16:40:05 +0100 Subject: Fix an issue in 4a support due to change in APIv3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In APIv3 there is a change in the response json from a call to an API. This prevent multimedia to get the right device to play audio on. Bug: SPEC-1974 Change-Id: Iea60421e229a3f24633065b9b81ab4b5c574fcc4 Signed-off-by: Loïc Collignon (cherry picked from commit abb035ab5b74757cd7577f493bc30e7aac0f5227) --- binding/afm-mediaplayer-binding.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/binding/afm-mediaplayer-binding.c b/binding/afm-mediaplayer-binding.c index 8a60541..049fb2d 100644 --- a/binding/afm-mediaplayer-binding.c +++ b/binding/afm-mediaplayer-binding.c @@ -820,23 +820,18 @@ static void gstreamer_init(afb_api_t api) ret = afb_api_call_sync(api, "ahl-4a", "multimedia", jsonData, &response, NULL, NULL); if (!ret) { - json_object *valJson = NULL; json_object *val = NULL; gboolean ret; - ret = json_object_object_get_ex(response, "response", &valJson); + ret = json_object_object_get_ex(response, "device_uri", &val); if (ret) { - ret = json_object_object_get_ex(valJson, "device_uri", &val); - if (ret) { - char* jres_pcm = json_object_get_string(val); - g_object_set(data.alsa_sink, "device", jres_pcm, NULL); - AFB_DEBUG("GSTREAMER alsa_sink.device = \"%s\"", jres_pcm); - } - ret = json_object_object_get_ex(valJson, "stream_id", &val); - if (ret) { - int stream_id = json_object_get_int(val); - } + char* jres_pcm = json_object_get_string(val); + g_object_set(data.alsa_sink, "device", jres_pcm, NULL); + AFB_DEBUG("GSTREAMER alsa_sink.device = \"%s\"", jres_pcm); } } + else { + AFB_ERROR("GSTREAMER Failed to call ahl-4a/multimedia!"); + } #endif g_object_set(data.playbin, "audio-sink", data.fake_sink, NULL); -- cgit 1.2.3-korg