summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonan Le Martret <ronan.lemartret@iot.bzh>2017-12-05 11:06:07 +0100
committerRonan Le Martret <ronan.lemartret@iot.bzh>2017-12-06 09:16:57 +0100
commitf836a438078bba3bc27ca81339a6a22a395ffdac (patch)
tree61127874ddc2c39f71f7b3d4439f338810d621b4
parent381b4ed77c3b11efa5e7619253133146a44df911 (diff)
Test 4A inside service mediaplayerdummy
Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh>
-rw-r--r--binding/afm-mediaplayer-binding.c27
-rw-r--r--conf.d/wgt/config.xml.in2
2 files changed, 29 insertions, 0 deletions
diff --git a/binding/afm-mediaplayer-binding.c b/binding/afm-mediaplayer-binding.c
index 2e3bef2..5fd5dbe 100644
--- a/binding/afm-mediaplayer-binding.c
+++ b/binding/afm-mediaplayer-binding.c
@@ -660,6 +660,33 @@ static void *gstreamer_loop_thread(void *ptr)
data.fake_sink = gst_element_factory_make("fakesink", NULL);
data.alsa_sink = gst_element_factory_make("alsasink", NULL);
+ 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);
+
+ if (!ret) {
+ json_object *valJson = NULL;
+ json_object *val = NULL;
+ gboolean ret;
+ ret = json_object_object_get_ex(response, "response", &valJson);
+ if (ret) {
+ ret = json_object_object_get_ex(valJson, "device_uri", &val);
+ if (ret) {
+ char* jres_pcm = json_object_get_string(val);
+ gchar ** res_pcm= g_strsplit (jres_pcm,":",-1);
+ if (res_pcm) {
+ g_object_set(data.alsa_sink, "device", res_pcm[1], NULL);
+ g_free(res_pcm);
+ }
+ }
+ ret = json_object_object_get_ex(valJson, "stream_id", &val);
+ if (ret) {
+ int stream_id = json_object_get_int(val);
+ }
+ }
+ }
+
g_object_set(data.playbin, "audio-sink", data.fake_sink, NULL);
gst_element_set_state(data.playbin, GST_STATE_PAUSED);
diff --git a/conf.d/wgt/config.xml.in b/conf.d/wgt/config.xml.in
index 00711b6..a6ab311 100644
--- a/conf.d/wgt/config.xml.in
+++ b/conf.d/wgt/config.xml.in
@@ -10,6 +10,7 @@
<feature name="urn:AGL:widget:required-permission">
<param name="urn:AGL:permission::public:hidden" value="required" />
<param name="urn:AGL:permission::public:no-htdocs" value="required" />
+ <param name="urn:AGL:permission:audio:public:audiostream" value="required" />
</feature>
<feature name="urn:AGL:widget:provided-api">
@@ -18,6 +19,7 @@
<feature name="urn:AGL:widget:required-api">
<param name="mediascanner" value="ws" />
+ <param name="ahl-4a" value="ws" />
<param name="@WIDGET_ENTRY_POINT@" value="local" />
</feature>
</widget>