aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Collignon <loic.collignon@iot.bzh>2018-07-13 16:44:01 +0200
committerLoïc Collignon <loic.collignon@iot.bzh>2018-07-13 16:44:01 +0200
commit78390bc5571c59c6d66d05538102d2b48d3b384e (patch)
tree5db392a906f86fc284ec02987baf931db6795fca
parentae62677e2ba59b2714cf35fb5f29fa9cbfe7a4f4 (diff)
Fix 4a call to match last API version
API has changed since the last update. Make adjustments to call the right API. Change-Id: I1613cd3633f2b2b096a421cd228185d376ce0b8e Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
-rw-r--r--binding/CMakeLists.txt1
-rw-r--r--binding/afm-mediaplayer-binding.c13
2 files changed, 11 insertions, 3 deletions
diff --git a/binding/CMakeLists.txt b/binding/CMakeLists.txt
index 2df218b..3018731 100644
--- a/binding/CMakeLists.txt
+++ b/binding/CMakeLists.txt
@@ -40,5 +40,6 @@ PROJECT_TARGET_ADD(afm-mediaplayer-binding)
LIBRARY DESTINATION ${BINDINGS_INSTALL_DIR})
if(HAVE_4A_FRAMEWORK)
+ message(STATUS "4a framework support enabled!")
add_definitions(-DHAVE_4A_FRAMEWORK)
endif()
diff --git a/binding/afm-mediaplayer-binding.c b/binding/afm-mediaplayer-binding.c
index 2a0d60d..713df92 100644
--- a/binding/afm-mediaplayer-binding.c
+++ b/binding/afm-mediaplayer-binding.c
@@ -731,11 +731,13 @@ static void gstreamer_init()
#ifdef HAVE_4A_FRAMEWORK
json_object *jsonData = json_object_new_object();
- json_object_object_add(jsonData, "audio_role", json_object_new_string("Multimedia"));
- json_object_object_add(jsonData, "endpoint_type", json_object_new_string("sink"));
- ret = afb_service_call_sync("ahl-4a", "stream_open", jsonData, &response);
+ json_object_object_add(jsonData, "action", json_object_new_string("open"));
+
+ AFB_DEBUG("Call to 'ahl-4a/multimedia {'action': 'open' }");
+ ret = afb_service_call_sync("ahl-4a", "multimedia", jsonData, &response);
if (!ret) {
+ AFB_DEBUG("4a multimedia stream opened with success!");
json_object *valJson = NULL;
json_object *val = NULL;
gboolean ret;
@@ -744,6 +746,7 @@ static void gstreamer_init()
ret = json_object_object_get_ex(valJson, "device_uri", &val);
if (ret) {
char* jres_pcm = json_object_get_string(val);
+ AFB_DEBUG("PCM to open: %s", jres_pcm);
gchar ** res_pcm= g_strsplit (jres_pcm,":",-1);
if (res_pcm) {
g_object_set(data.alsa_sink, "device", res_pcm[1], NULL);
@@ -756,6 +759,10 @@ static void gstreamer_init()
}
}
}
+ else
+ {
+ AFB_ERROR("Failed to open the multimedia stream!");
+ }
#endif
g_object_set(data.playbin, "audio-sink", data.fake_sink, NULL);