Adapt codes for PulseAudio 13.0 88/222888/3 submit/tizen/20200211.115824
authorSangchul Lee <sc11.lee@samsung.com>
Tue, 21 Jan 2020 07:03:42 +0000 (16:03 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Wed, 5 Feb 2020 06:54:01 +0000 (15:54 +0900)
[Version] 13.0.1
[Issue Type] Update

Change-Id: I6524931df89b70d573b209eb6a4479cd6b7adafc
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
Makefile.am
packaging/pulseaudio-modules-tizen.spec
src/acm.c
src/device-manager.c
src/module-tizenaudio-policy.c
src/module-tizenaudio-sink.c
src/module-tizenaudio-source.c
src/stream-manager-filter.c
src/stream-manager.c
src/tizen-device.c

index 424938d..cef1ea0 100644 (file)
@@ -17,7 +17,7 @@
 
 ACLOCAL_AMFLAGS = -I m4
 
-pulsemodlibexecdir= $(libdir)/pulse-11.1/modules
+pulsemodlibexecdir= $(libdir)/pulse-13.0/modules
 pulselibexecdir=$(libexecdir)/pulse
 
 AM_CFLAGS = \
index eae842b..274ce85 100644 (file)
@@ -1,6 +1,6 @@
 Name:             pulseaudio-modules-tizen
 Summary:          Pulseaudio modules for Tizen
-Version:          11.1.97
+Version:          13.0.1
 Release:          0
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
@@ -68,17 +68,17 @@ install -m 0644 %SOURCE1 %{buildroot}%{_tmpfilesdir}/pulseaudio.conf
 %manifest %{name}.manifest
 %defattr(-,root,root,-)
 %license LICENSE.LGPL-2.1+
-%{_libdir}/pulse-11.1/modules/module-hw-keysound.so
-%{_libdir}/pulse-11.1/modules/module-poweroff.so
-%{_libdir}/pulse-11.1/modules/module-sound-player.so
-%{_libdir}/pulse-11.1/modules/module-tizenaudio-policy.so
-%{_libdir}/pulse-11.1/modules/module-tizenaudio-sink.so
-%{_libdir}/pulse-11.1/modules/module-tizenaudio-source.so
-%{_libdir}/pulse-11.1/modules/libhal-interface.so
-%{_libdir}/pulse-11.1/modules/libcommunicator.so
+%{_libdir}/pulse-13.0/modules/module-hw-keysound.so
+%{_libdir}/pulse-13.0/modules/module-poweroff.so
+%{_libdir}/pulse-13.0/modules/module-sound-player.so
+%{_libdir}/pulse-13.0/modules/module-tizenaudio-policy.so
+%{_libdir}/pulse-13.0/modules/module-tizenaudio-sink.so
+%{_libdir}/pulse-13.0/modules/module-tizenaudio-source.so
+%{_libdir}/pulse-13.0/modules/libhal-interface.so
+%{_libdir}/pulse-13.0/modules/libcommunicator.so
 %{_tmpfilesdir}/pulseaudio.conf
 %if "%{tizen_profile_name}" == "tv"
-%{_libdir}/pulse-11.1/modules/module-vconf.so
+%{_libdir}/pulse-13.0/modules/module-vconf.so
 %{_libexecdir}/pulse/vconf-helper
 %endif
 %{_libdir}/ladspa/*.so
@@ -87,5 +87,5 @@ install -m 0644 %SOURCE1 %{buildroot}%{_tmpfilesdir}/pulseaudio.conf
 %manifest %{name}.manifest
 %defattr(-,root,root,-)
 %license LICENSE.LGPL-2.1+
-%{_libdir}/pulse-11.1/modules/module-acm-sink.so
+%{_libdir}/pulse-13.0/modules/module-acm-sink.so
 
index 6494e4f..a0d07a7 100644 (file)
--- a/src/acm.c
+++ b/src/acm.c
@@ -184,7 +184,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
         case PA_SINK_MESSAGE_SET_STATE: {
             pa_sink_state_t new_state = PA_PTR_TO_UINT(data);
 
-            if (pa_sink_get_state(u->sink) == PA_SINK_SUSPENDED || pa_sink_get_state(u->sink) == PA_SINK_INIT) {
+            if (u->sink->state == PA_SINK_SUSPENDED || u->sink->state == PA_SINK_INIT) {
                 if (new_state == PA_SINK_RUNNING || new_state == PA_SINK_IDLE)
                     u->timestamp = pa_rtclock_now();
             }
@@ -194,7 +194,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
             else
                 dump_close(u);
 #endif
-            if (pa_sink_get_state(u->sink) == PA_SINK_RUNNING) {
+            if (u->sink->state == PA_SINK_RUNNING) {
                 if (new_state != PA_SINK_RUNNING)
                     ipc_request_drain(u);
             }
index 22d9845..6276308 100644 (file)
@@ -1681,19 +1681,17 @@ static pa_hook_result_t sink_source_state_changed_hook_cb(pa_core *c, pa_object
 
     if (pa_sink_isinstance(pdevice)) {
         pa_sink *s = PA_SINK(pdevice);
-        pa_sink_state_t state = pa_sink_get_state(s);
-        pa_log_debug("=========== Sink(%p,%s) state has been changed to [%d](0:RUNNING, 1:IDLE, 2:SUSPEND) ==========", s, s->name, state);
+        pa_log_debug("=========== Sink(%p,%s) state has been changed to [%d](0:RUNNING, 1:IDLE, 2:SUSPEND) ==========", s, s->name, s->state);
         if (!s->use_internal_codec && !pa_safe_streq(s->name, SINK_NAME_NULL))
             if ((device = pa_device_manager_get_device_with_sink(s)))
-                pa_tz_device_set_running_and_notify(device, (state == PA_SINK_RUNNING));
+                pa_tz_device_set_running_and_notify(device, (s->state == PA_SINK_RUNNING));
 
     } else if (pa_source_isinstance(pdevice)) {
         pa_source *s = PA_SOURCE(pdevice);
-        pa_source_state_t state = pa_source_get_state(s);
-        pa_log_debug("=========== Source(%p,%s) state has been changed to [%d](0:RUNNING, 1:IDLE, 2:SUSPEND) ==========", s, s->name, state);
+        pa_log_debug("=========== Source(%p,%s) state has been changed to [%d](0:RUNNING, 1:IDLE, 2:SUSPEND) ==========", s, s->name, s->state);
         if (!s->use_internal_codec && !pa_safe_streq(s->name, SOURCE_NAME_NULL))
             if ((device = pa_device_manager_get_device_with_source(s)))
-                pa_tz_device_set_running_and_notify(device, (state == PA_SOURCE_RUNNING));
+                pa_tz_device_set_running_and_notify(device, (s->state == PA_SOURCE_RUNNING));
     }
     pa_log_debug("========= sink_source_state_changed_hook_cb END =====");
 
@@ -1737,7 +1735,7 @@ static void* load_module(pa_core *c, bool is_sink, const char *device_string, co
     }
     pa_log_info("argument : %s", full_params);
 
-    if (!(module = pa_module_load(c, module_name, full_params))) {
+    if (pa_module_load(&module, c, module_name, full_params)) {
         pa_log_error("Load module with name '%s' argument '%s' failed", module_name, full_params);
         return NULL;
     }
index 877116a..8b3b613 100644 (file)
@@ -480,9 +480,10 @@ static void update_loopback_module(struct userdata *u, bool load) {
         if (u->module_loopback)
             pa_module_unload(u->module_loopback, true);
 
-        u->module_loopback = pa_module_load(u->core, MODULE_LOOPBACK, args);
-
-        pa_log_info("  -- load module-loopback with (%s)", args);
+        if (pa_module_load(&u->module_loopback, u->core, MODULE_LOOPBACK, args))
+            pa_log_error("failed to load module-loopback with (%s)", args);
+        else
+            pa_log_info("  -- load module-loopback with (%s)", args);
         pa_xfree(args);
 
     } else if (!load) {
@@ -895,7 +896,8 @@ static void select_device_by_manual_external_routing(struct userdata *u, pa_stre
                             char *args = pa_sprintf_malloc("sink_name=%s slaves=\"%s,%s\"",
                                                             SINK_NAME_COMBINED_EX, combine_sink_arg1->name, combine_sink_arg2->name);
                             pa_log_info("  -- combined sink is not prepared, now load module[%s]", args);
-                            u->module_combine_sink_for_ex = pa_module_load(u->core, MODULE_COMBINE_SINK, args);
+                            if (pa_module_load(&u->module_combine_sink_for_ex, u->core, MODULE_COMBINE_SINK, args))
+                                pa_log_error("failed to load module-combine-sink with args(%s)", args);
                             pa_xfree(args);
                         }
                         sink = (pa_sink*)pa_namereg_get(u->core, SINK_NAME_COMBINED_EX, PA_NAMEREG_SINK);
@@ -1234,7 +1236,8 @@ static pa_hook_result_t update_combine_sink_and_bt_sco(struct userdata *u, pa_st
                     char *args = pa_sprintf_malloc("sink_name=%s slaves=\"%s,%s\"",
                                                 SINK_NAME_COMBINED, (*combine_sink_arg1)->name, (*combine_sink_arg2)->name);
                     pa_log_info("[ROUTE][AUTO_ALL] combined sink is not prepared, now load module[%s]", args);
-                    u->module_combine_sink = pa_module_load(u->core, MODULE_COMBINE_SINK, args);
+                    if (pa_module_load(&u->module_combine_sink, u->core, MODULE_COMBINE_SINK, args))
+                        pa_log_error("failed to load module-combine-sink with args(%s)", args);
                     pa_xfree(args);
                 }
                 if ((sink = (pa_sink*)pa_namereg_get(u->core, SINK_NAME_COMBINED, PA_NAMEREG_SINK))) {
@@ -1826,10 +1829,12 @@ int pa__init(pa_module *m)
 
     /* load null sink/source */
     args = pa_sprintf_malloc("sink_name=%s", SINK_NAME_NULL);
-    u->module_null_sink = pa_module_load(u->core, MODULE_NULL_SINK, args);
+    if (pa_module_load(&u->module_null_sink, u->core, MODULE_NULL_SINK, args))
+        pa_log_error("failed to load module-null-sink");
     pa_xfree(args);
     args = pa_sprintf_malloc("source_name=%s", SOURCE_NAME_NULL);
-    u->module_null_source = pa_module_load(u->core, MODULE_NULL_SOURCE, args);
+    if (pa_module_load(&u->module_null_source, u->core, MODULE_NULL_SOURCE, args))
+        pa_log_error("failed to load module-null-source");
     pa_xfree(args);
 
     __load_dump_config(u);
index 7fe87db..7d75d5a 100644 (file)
@@ -31,6 +31,7 @@
 #include <pulse/rtclock.h>
 #include <pulse/timeval.h>
 #include <pulse/xmalloc.h>
+#include <pulse/util.h>
 
 #include <pulsecore/i18n.h>
 #include <pulsecore/macro.h>
@@ -390,7 +391,7 @@ static void thread_func(void *userdata) {
     pa_log_debug("Thread starting up");
 
     if (u->core->realtime_scheduling)
-        pa_make_realtime(u->core->realtime_priority);
+        pa_thread_make_realtime(u->core->realtime_priority);
 
     pa_thread_mq_install(&u->thread_mq);
 
index 613025a..098e1f9 100644 (file)
@@ -31,6 +31,7 @@
 #include <pulse/rtclock.h>
 #include <pulse/timeval.h>
 #include <pulse/xmalloc.h>
+#include <pulse/util.h>
 
 #include <pulsecore/i18n.h>
 #include <pulsecore/macro.h>
@@ -335,7 +336,7 @@ static void thread_func(void *userdata) {
     pa_log_debug("Thread starting up");
 
     if (u->core->realtime_scheduling)
-        pa_make_realtime(u->core->realtime_priority);
+        pa_thread_make_realtime(u->core->realtime_priority);
 
     pa_thread_mq_install(&u->thread_mq);
 
index a0d0842..c954151 100644 (file)
@@ -517,8 +517,10 @@ void init_filters(pa_stream_manager *m) {
     }
     if (!module) {
         char *args = pa_sprintf_malloc("autoclean_interval=%d", 0);
-        pa_module_load(m->core, MODULE_FILTER_APPLY, args);
-        pa_log("module-filter-apply loaded");
+        if (pa_module_load(&module, m->core, MODULE_FILTER_APPLY, args))
+            pa_log_error("failed to load module-filter-apply with args(%s)", args);
+        else
+            pa_log("module-filter-apply loaded");
         pa_xfree(args);
     }
 }
index 69b981e..0debcf1 100644 (file)
@@ -2514,19 +2514,15 @@ static pa_hook_result_t sink_input_unlink_cb(pa_core *core, pa_sink_input *i, pa
 }
 
 static pa_hook_result_t sink_input_state_changed_cb(pa_core *core, pa_sink_input *i, pa_stream_manager *m) {
-    pa_sink_input_state_t state;
-
     pa_assert(i);
     pa_assert(m);
 
-    state = pa_sink_input_get_state(i);
-    pa_log_debug("sink-input(%p, index:%u), state(%d)", i, i->index, state);
+    pa_log_debug("sink-input(%p, index:%u), state(%d)", i, i->index, i->state);
 
-    switch (state) {
+    switch (i->state) {
     case PA_SINK_INPUT_CORKED:
         process_stream(m, i, STREAM_SINK_INPUT, PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_ENDED, false);
         break;
-    case PA_SINK_INPUT_DRAINED:
     case PA_SINK_INPUT_RUNNING:
         process_stream(m, i, STREAM_SINK_INPUT, PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_STARTED, false);
         break;
@@ -2670,15 +2666,12 @@ static pa_hook_result_t source_output_unlink_cb(pa_core *core, pa_source_output
 }
 
 static pa_hook_result_t source_output_state_changed_cb(pa_core *core, pa_source_output *o, pa_stream_manager *m) {
-    pa_source_output_state_t state;
-
     pa_assert(o);
     pa_assert(m);
 
-    state = pa_source_output_get_state(o);
-    pa_log_debug("source-output(%p, index:%u), state(%d)", o, o->index, state);
+    pa_log_debug("source-output(%p, index:%u), state(%d)", o, o->index, o->state);
 
-    switch (state) {
+    switch (o->state) {
     case PA_SOURCE_OUTPUT_CORKED:
         process_stream(m, o, STREAM_SOURCE_OUTPUT, PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_ENDED, false);
         break;
index 3203d61..4f90d45 100644 (file)
@@ -782,12 +782,12 @@ bool pa_tz_device_is_all_suspended(pa_tz_device *device) {
     void *state;
 
     PA_HASHMAP_FOREACH(sink, device->playback_devices, state) {
-        if (pa_sink_get_state(sink) != PA_SINK_SUSPENDED)
+        if (sink->state != PA_SINK_SUSPENDED)
             return false;
     }
 
     PA_HASHMAP_FOREACH(source, device->capture_devices, state) {
-        if (pa_source_get_state(source) != PA_SOURCE_SUSPENDED)
+        if (source->state != PA_SOURCE_SUSPENDED)
             return false;
     }