stream-manager: Notify ducking activation to HAL 41/211041/2 accepted/tizen/unified/20190807.111819 submit/tizen/20190807.024035
authorJeongmo Yang <jm80.yang@samsung.com>
Mon, 29 Jul 2019 08:32:36 +0000 (17:32 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Tue, 30 Jul 2019 00:18:15 +0000 (09:18 +0900)
[Version] 11.1.67
[Issue Type] Update

Change-Id: I1b94cc0c3b8f6f0936ff64347eff4e55631487f1
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
packaging/pulseaudio-modules-tizen.spec
src/hal-interface.c
src/hal-interface.h
src/stream-manager-dbus.c

index 14512a4..fbfdda3 100644 (file)
@@ -1,6 +1,6 @@
 Name:             pulseaudio-modules-tizen
 Summary:          Pulseaudio modules for Tizen
-Version:          11.1.66
+Version:          11.1.67
 Release:          0
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
index bbd2d33..26ee345 100644 (file)
@@ -65,6 +65,7 @@ pa_hal_interface* pa_hal_interface_get(pa_core *core) {
         h->intf.get_volume_mute = dlsym(h->dl_handle, "audio_get_volume_mute");
         h->intf.set_volume_mute = dlsym(h->dl_handle, "audio_set_volume_mute");
         h->intf.set_volume_ratio = dlsym(h->dl_handle, "audio_set_volume_ratio");
+        h->intf.notify_ducking_activation_changed = dlsym(h->dl_handle, "audio_notify_ducking_activation_changed");
         h->intf.update_route = dlsym(h->dl_handle, "audio_update_route");
         h->intf.update_route_option = dlsym(h->dl_handle, "audio_update_route_option");
         h->intf.notify_stream_connection_changed = dlsym(h->dl_handle, "audio_notify_stream_connection_changed");
@@ -271,6 +272,30 @@ int32_t pa_hal_interface_set_volume_ratio(pa_hal_interface *h, const char *strea
     return ret;
 }
 
+int32_t pa_hal_interface_notify_ducking_activation_changed(pa_hal_interface *h, hal_ducking_activation_info *info) {
+    audio_return_t hal_ret = AUDIO_RET_OK;
+    audio_ducking_info_t hal_info;
+
+    pa_assert(h);
+    pa_assert(info);
+
+    if (!h->intf.notify_ducking_activation_changed) {
+        pa_log_warn("not implemented");
+        return -2;
+    }
+
+    hal_info.target_role = info->target_role;
+    hal_info.duration = info->duration;
+    hal_info.ratio = info->ratio;
+
+    if (AUDIO_RET_OK != (hal_ret = h->intf.notify_ducking_activation_changed(h->ah_handle, &hal_info, (uint32_t)info->is_activated))) {
+        pa_log_error("notify_ducking_activation_changed returns error:0x%x", hal_ret);
+        return -1;
+    }
+
+    return 0;
+}
+
 int32_t pa_hal_interface_update_route(pa_hal_interface *h, hal_route_info *info) {
     int32_t ret = 0;
     audio_return_t hal_ret = AUDIO_RET_OK;
index b654845..2351701 100644 (file)
@@ -64,6 +64,13 @@ typedef struct _hal_stream_info {
     pa_sample_spec *sample_spec;
 } hal_stream_info;
 
+typedef struct _hal_ducking_activation_info {
+       const char *target_role;
+       uint32_t duration;
+       double ratio;
+       bool is_activated;
+} hal_ducking_activation_info;
+
 typedef void* pcm_handle;
 
 #define UPDATE_HAL_ROUTE_OPTION(x_hal_intf, x_role, x_name, x_value) \
@@ -91,6 +98,7 @@ int32_t pa_hal_interface_get_volume_value(pa_hal_interface *h, const char *volum
 int32_t pa_hal_interface_get_volume_mute(pa_hal_interface *h, const char *volume_type, io_direction_t direction, uint32_t *mute);
 int32_t pa_hal_interface_set_volume_mute(pa_hal_interface *h, const char *volume_type, io_direction_t direction, uint32_t mute);
 int32_t pa_hal_interface_set_volume_ratio(pa_hal_interface *h, const char *stream_role, io_direction_t direction, uint32_t idx, double ratio);
+int32_t pa_hal_interface_notify_ducking_activation_changed(pa_hal_interface *h, hal_ducking_activation_info *info);
 int32_t pa_hal_interface_update_route(pa_hal_interface *h, hal_route_info *info);
 int32_t pa_hal_interface_update_route_option(pa_hal_interface *h, hal_route_option *option);
 int32_t pa_hal_interface_notify_stream_connection_changed(pa_hal_interface *h, hal_stream_connection_info *info);
index 1a7155c..83c3f8e 100644 (file)
@@ -1789,6 +1789,7 @@ static void handle_activate_ducking(DBusConnection *conn, DBusMessage *msg, void
     pa_stream_manager *m = (pa_stream_manager*)userdata;
     stream_ducking *sd = NULL;
     bool target_matched = false;
+    hal_ducking_activation_info ducking_activation_info;
 
     pa_assert(conn);
     pa_assert(msg);
@@ -1860,6 +1861,14 @@ static void handle_activate_ducking(DBusConnection *conn, DBusMessage *msg, void
     pa_assert_se(dbus_connection_send(conn, reply, NULL));
     dbus_message_unref(reply);
 
+    /* notify ducking activation */
+    ducking_activation_info.target_role = target_stream;
+    ducking_activation_info.duration = duration;
+    ducking_activation_info.ratio = ratio;
+    ducking_activation_info.is_activated = enable;
+
+    pa_hal_interface_notify_ducking_activation_changed(m->hal, &ducking_activation_info);
+
     if (target_matched == false) {
         /* change ducking state and send signal here,
            because ramp_finish_cb could not be called in this case */