diff options
author | Seungbae Shin <seungbae.shin@samsung.com> | 2012-08-21 18:18:38 +0900 |
---|---|---|
committer | Seungbae Shin <seungbae.shin@samsung.com> | 2012-08-21 18:18:38 +0900 |
commit | 039035002f8487e801afcc10ee3b006025a177dd (patch) | |
tree | 55585bcef3a5afe510cedf54c3d371cbbcd1c795 | |
parent | f6f49e0c547e1dee5e5bf145d325b31f5ca9967e (diff) | |
download | audio-session-manager-039035002f8487e801afcc10ee3b006025a177dd.tar.gz audio-session-manager-039035002f8487e801afcc10ee3b006025a177dd.tar.bz2 audio-session-manager-039035002f8487e801afcc10ee3b006025a177dd.zip |
2.0 init
-rw-r--r-- | Makefile.am | 18 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | debian/changelog | 676 | ||||
-rw-r--r-- | debian/control | 2 | ||||
-rw-r--r-- | debian/libaudiosessionmgr-0.install.in | 2 | ||||
-rw-r--r-- | debian/libaudiosessionmgr-0.postinst | 6 | ||||
-rwxr-xr-x | debian/rules | 5 | ||||
-rw-r--r--[-rwxr-xr-x] | include/asm-error.h | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | include/asm-log.h | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | include/audio-session-manager-types.h | 18 | ||||
-rw-r--r--[-rwxr-xr-x] | include/audio-session-manager.h | 6 | ||||
-rw-r--r-- | init/Makefile.am | 2 | ||||
-rw-r--r-- | init/Makefile.in | 359 | ||||
-rw-r--r-- | init/audiosessionmanager | 13 | ||||
-rw-r--r-- | packaging/audio-session-manager.spec | 23 | ||||
-rw-r--r-- | src/audio-session-mgr-server.c | 1582 | ||||
-rw-r--r-- | src/audio-session-mgr.c | 360 |
17 files changed, 982 insertions, 2091 deletions
diff --git a/Makefile.am b/Makefile.am index a2ea79e..555c0fe 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,21 +1,3 @@ -SUBDIRS = init - -bin_PROGRAMS = audio-session-mgr-server - -audio_session_mgr_server_SOURCES = \ - $(srcdir)/src/audio-session-mgr-server.c - -#audio_session_mgr_server_LDADD = libaudio-session-mgr.la - -audio_session_mgr_server_CPPFLAGS = -I$(srcdir)/include/ -D__DEBUG_MODE__ -DUSE_VCONF $(MMLOG_CFLAGS) -D__USE_LOGMANAGER__ $(SYSMAN_CFLAGS) $(AVSYSAUDIO_CFLAGS) -#audio_session_mgr_server_LDFLAGS += $(AUDIOSESSIONMGR_LIBS) $(MMLOG_LIBS) $(SYSMAN_LIBS) -audio_session_mgr_server_LDADD = $(AUDIOSESSIONMGR_LIBS) $(MMLOG_LIBS) $(SYSMAN_LIBS) $(AVSYSAUDIO_LIBS) - -if USE_SECURITY -audio_session_mgr_server_CPPFLAGS += $(SECURITY_CFLAGS) -DUSE_SECURITY -audio_session_mgr_server_LDADD += $(SECURITY_LIBS) -endif - AM_CFLAGS = $(AUDIOSESSIONMGR_CFLAGS) lib_LTLIBRARIES = libaudio-session-mgr.la diff --git a/configure.ac b/configure.ac index 4d5ae2f..e057713 100644 --- a/configure.ac +++ b/configure.ac @@ -65,6 +65,5 @@ AC_CHECK_FUNCS([memset]) AC_CONFIG_FILES([Makefile audio-session-mgr.pc - init/Makefile ]) AC_OUTPUT diff --git a/debian/changelog b/debian/changelog index 5fbf057..edd508c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,679 @@ +audio-session-manager (0.2.1-0) unstable; urgency=low + + * [BOT-2372] fix memory leak, free GPollFD/GSourceFuncs when calling __ASM_remove_sound_callback() + * Git: slp/pkgs/a/audio-session-manager + * Tag: audio-session-manager_0.2.1-0 + + -- Sangchul Lee <sc11.lee@samsung.com> Mon, 21 May 2012 12:05:53 +0900 + +audio-session-manager (0.2.0-0) unstable; urgency=low + + * [AudioRoute] remove asm daemon, add richcall + * Git: slp/pkgs/a/audio-session-manager + * Tag: audio-session-manager_0.2.0-0 + + -- Seungbae Shin <seungbae.shin@samsung.com> Mon, 23 Apr 2012 17:27:57 +0900 + +audio-session-manager (0.1.20-0) unstable; urgency=low + + * change booting priority script (S30->S15) + * Git: slp/pkgs/a/audio-session-manager + * Tag: audio-session-manager_0.1.20-0 + + -- Seungbae Shin <seungbae.shin@samsung.com> Mon, 16 Apr 2012 12:07:44 +0900 + audio-session-manager (0.1.19-0) unstable; urgency=low - * Initial release - * Git: pkgs/a/audio-session-manager + * support handling EINTR + * remove deadcode + * Replace boilerplate - APACHE v2.0 + * Check gcf vconf only once when daemon starts + * Git: slp/pkgs/a/audio-session-manager * Tag: audio-session-manager_0.1.19-0 -- Seungbae Shin <seungbae.shin@samsung.com> Tue, 03 Jan 2012 19:14:10 +0900 + +audio-session-manager (0.1.18-0) unstable; urgency=low + + * Fix asm table for shared fm-radio + * Git: 165.213.180.234:slp/pkgs/a/audio-session-manager + * Tag: audio-session-manager_0.1.18-0 + + -- Seungbae Shin <seungbae.shin@samsung.com> Wed, 16 Nov 2011 17:35:21 +0900 + +audio-session-manager (0.1.17-0) unstable; urgency=low + + * fix prevent for run #91 + * Git: 165.213.180.234:slp/pkgs/a/audio-session-manager + * Tag: audio-session-manager_0.1.17-0 + + -- Seungbae Shin <seungbae.shin@samsung.com> Fri, 21 Oct 2011 10:37:21 +0900 + +audio-session-manager (0.1.16-0) unstable; urgency=low + + * 1. Fix for prevent run #90 (leak, strerror, gid, etc.) + * 2. Refine code + * Git: 165.213.180.234:slp/pkgs/a/audio-session-manager + * Tag: audio-session-manager_0.1.16-0 + + -- Seungbae Shin <seungbae.shin@samsung.com> Mon, 10 Oct 2011 13:55:08 +0900 + +audio-session-manager (0.1.15-0) unstable; urgency=low + + * 1. Force mixing in same pid 2. Support dump feature + * Git: 165.213.180.234:slp/pkgs/a/audio-session-manager + * Tag: audio-session-manager_0.1.15-0 + + -- Seungbae Shin <seungbae.shin@samsung.com> Thu, 22 Sep 2011 16:13:16 +0900 + +audio-session-manager (0.1.14-3) unstable; urgency=low + + * Fix for prevent + * Git: 165.213.180.234:slp/pkgs/a/audio-session-manager + * Tag: audio-session-manager_0.1.14-3 + + -- Seungbae Shin <seungbae.shin@samsung.com> Mon, 22 Aug 2011 15:01:04 +0900 + +audio-session-manager (0.1.14-2) unstable; urgency=low + + * Code cleanup & remove REPLACE + * Git: 165.213.180.234:slp/pkgs/a/audio-session-manager + * Tag: audio-session-manager_0.1.14-2 + + -- Seungbae Shin <seungbae.shin@samsung.com> Wed, 13 Jul 2011 19:44:54 +0900 + +audio-session-manager (0.1.14-1) unstable; urgency=low + + * Remove PLATFORM_INIT macro in configure.ac + * Git: 165.213.180.234:slp/pkgs/a/audio-session-manager + * Tag: audio-session-manager_0.1.14-1 + + -- Seungbae Shin <seungbae.shin@samsung.com> Thu, 19 May 2011 15:45:30 +0900 + +audio-session-manager (0.1.14-0) unstable; urgency=low + + * Add defensive code - wait until timeout although callback is removed + * Git: 165.213.180.234:slp/pkgs/a/audio-session-manager + * Tag: audio-session-manager_0.1.14-0 + + -- Jeongmo Yang <jm80.yang@samsung.com> Wed, 18 May 2011 15:34:01 +0900 + +audio-session-manager (0.1.13-1) unstable; urgency=low + + * update FM radio exlcusive policy table + * Git: 165.213.180.234:slp/pkgs/a/audio-session-manager + * Tag: audio-session-manager_0.1.13-1 + + -- KwangHui Cho <kwanghui.cho@samsung.com> Fri, 13 May 2011 07:09:09 +0900 + +audio-session-manager (0.1.13-0) unstable; urgency=low + + * Modify ASM_sound_case table + * Git: 165.213.180.234:slp/pkgs/a/audio-session-manager + * Tag: audio-session-manager_0.1.13-0 + + -- Seungbae Shin <seungbae.shin@samsung.com> Wed, 20 Apr 2011 16:35:19 +0900 + +audio-session-manager (0.1.12-9) unstable; urgency=low + + * for preGCF + * Git: 165.213.180.234:slp/pkgs/a/audio-session-manager + * Tag: audio-session-manager_0.1.12-9 + + -- Younghwan Ahn <younghwan_.an@samsung.com> Tue, 05 Apr 2011 13:19:29 +0900 + +audio-session-manager (0.1.12-8) unstable; urgency=low + + * remove self process monitoring + * Git: 165.213.180.234:slp/pkgs/a/audio-session-manager + * Tag: audio-session-manager_0.1.12-8 + + -- KwangHui Cho <kwanghui.cho@samsung.com> Thu, 17 Feb 2011 16:46:12 +0900 + +audio-session-manager (0.1.12-7) unstable; urgency=low + + * fix prevent + * Git: 165.213.180.234:slp/pkgs/a/audio-session-manager + * Tag: audio-session-manager_0.1.12-7 + + -- Jisung Ahn <jcastle.ahn@samsung.com> Mon, 14 Feb 2011 19:16:54 +0900 + +audio-session-manager (0.1.12-6) unstable; urgency=low + + * check sound path before resume callback + * Git: 165.213.180.234:slp/pkgs/a/audio-session-manager + * Tag: audio-session-manager_0.1.12-6 + + -- KwangHui Cho <kwanghui.cho@samsung.com> Mon, 07 Feb 2011 19:48:01 +0900 + +audio-session-manager (0.1.12-5) unstable; urgency=low + + * add unmerged source + * Git: 165.213.180.234:slp/pkgs/a/audio-session-manager + * Tag: audio-session-manager_0.1.12-5 + + -- Jisung Ahn <jcastle.ahn@samsung.com> Mon, 31 Jan 2011 14:19:29 +0900 + +audio-session-manager (0.1.12-4) unstable; urgency=low + + * seperate call & videocall + * Git: 165.213.180.234:slp/pkgs/a/audio-session-manager + * Tag: audio-session-manager_0.1.12-4 + + -- Jisung Ahn <jcastle.ahn@samsung.com> Thu, 27 Jan 2011 17:01:59 +0900 + +audio-session-manager (0.1.12-3) unstable; urgency=low + + * restore signal handler at destructor + * Git: 165.213.180.234:slp/pkgs/a/audio-session-manager + * Tag: audio-session-manager_0.1.12-3 + + -- KwangHui Cho <kwanghui.cho@samsung.com> Wed, 26 Jan 2011 10:46:49 +0900 + +audio-session-manager (0.1.12-2) unstable; urgency=low + + * Check security privilege + * Git: 165.213.180.234:slp/pkgs/a/audio-session-manager + * Tag: audio-session-manager_0.1.12-2 + + -- Seungbae Shin <seungbae.shin@samsung.com> Tue, 25 Jan 2011 17:10:15 +0900 + +audio-session-manager (0.1.12-1) unstable; urgency=low + + * set vconf group + * Git: 165.213.180.234:slp/pkgs/a/audio-session-manager + * Tag: audio-session-manager_0.1.12-1 + + -- Jisung Ahn <jcastle.ahn@samsung.com> Thu, 13 Jan 2011 19:50:29 +0900 + +audio-session-manager (0.1.12-0) unstable; urgency=low + + * Allow alarm on call + * use -i option on vconftool set value + * Git: 165.213.180.234:slp/pkgs/a/audio-session-manager + * Tag: audio-session-manager_0.1.12-0 + + -- KwangHui Cho <kwanghui.cho@samsung.com> Mon, 27 Dec 2010 15:39:52 +0900 + +audio-session-manager (0.1.11-5) unstable; urgency=low + + * Fix for as-needed + * Git: 165.213.180.234:/git/slp/pkgs/audio-session-manager + * Tag: audio-session-manager_0.1.11-5 + + -- Seungbae Shin <seungbae.shin@samsung.com> Wed, 24 Nov 2010 20:52:12 +0900 + +audio-session-manager (0.1.11-4) unstable; urgency=low + + * change vconf key of hibernation ready + * Git: 165.213.180.234:/git/slp/pkgs/audio-session-manager + * Tag: audio-session-manager_0.1.11-4 + + -- Kwanghui Cho <kwanghui.cho@samsung.com> Tue, 23 Nov 2010 17:04:08 +0900 + +audio-session-manager (0.1.11-3) unstable; urgency=low + + * do not send resume callback to previously paused or stopped instance + * Git: 165.213.180.234:/git/slp/pkgs/audio-session-manager + * Tag: audio-session-manager_0.1.11-3 + + -- Kwanghui Cho <kwanghui.cho@samsung.com> Tue, 23 Nov 2010 15:25:25 +0900 + +audio-session-manager (0.1.11-2) unstable; urgency=low + + * update log + * check dead process before getmystatus + * Git: 165.213.180.234:/git/slp/pkgs/audio-session-manager + * Tag: audio-session-manager_0.1.11-2 + + -- Kwanghui Cho <kwanghui.cho@samsung.com> Sat, 20 Nov 2010 08:12:46 +0900 + +audio-session-manager (0.1.11-1) unstable; urgency=low + + * update debian/rules + * Git: 165.213.180.234:/git/slp/pkgs/audio-session-manager + * Tag: audio-session-manager_0.1.11-1 + + -- Kwanghui Cho <kwanghui.cho@samsung.com> Thu, 18 Nov 2010 16:02:38 +0900 + +audio-session-manager (0.1.11-0) unstable; urgency=low + + * add ASM_get_process_session_state() function + * update __asm_find_list() function in audio-session-mgr-server.c + * Git: 165.213.180.234:/git/slp/pkgs/audio-session-manager + * Tag: audio-session-manager_0.1.11-0 + + -- Kwanghui Cho <kwanghui.cho@samsung.com> Tue, 16 Nov 2010 11:58:10 +0900 + +audio-session-manager (0.1.10-1) unstable; urgency=low + + * Use hibernation check vconf + * Git: 165.213.180.234:/git/slp/pkgs/audio-session-manager + * Tag: audio-session-manager_0.1.10-1 + + -- Kwanghui Cho <kwanghui.cho@samsung.com> Fri, 12 Nov 2010 10:12:08 +0900 + +audio-session-manager (0.1.10-0) unstable; urgency=low + + * Add ASM_EVENT_SOURCE_OTHER_PLAYER_APP + * Git: 165.213.180.234:/git/slp/pkgs/audio-session-manager + * Tag: audio-session-manager_0.1.10-0 + + -- Kwanghui Cho <kwanghui.cho@samsung.com> Tue, 02 Nov 2010 15:49:03 +0900 + +audio-session-manager (0.1.9-1) unstable; urgency=low + + * Add ASM_EVENT_SOURCE_OTHER_CAPTURE_APP for libmm-player + * Git: 165.213.180.234:/git/slp/pkgs/audio-session-manager + * Tag: audio-session-manager_0.1.9-1 + + -- Kwanghui Cho <kwanghui.cho@samsung.com> Fri, 29 Oct 2010 17:17:44 +0900 + +audio-session-manager (0.1.9-0) unstable; urgency=low + + * Add monitor type + * Git: 165.213.180.234:/git/slp/pkgs/audio-session-manager + * Tag: audio-session-manager_0.1.9-0 + + -- Kwanghui Cho <kwanghui.cho@samsung.com> Sat, 23 Oct 2010 11:30:32 +0900 + +audio-session-manager (0.1.8-2) unstable; urgency=low + + * Add rc4 script + * Git: 165.213.180.234:/git/slp/pkgs/audio-session-manager + * Tag: audio-session-manager_0.1.8-2 + + -- Kwanghui Cho <kwanghui.cho@samsung.com> Mon, 18 Oct 2010 13:37:06 +0900 + +audio-session-manager (0.1.8-1) unstable; urgency=low + + * Add exception handling when server handle is full + * Git: 165.213.180.234:/git/slp/pkgs/audio-session-manager + * Tag: audio-session-manager_0.1.8-1 + + -- Kwanghui Cho <kwanghui.cho@samsung.com> Wed, 13 Oct 2010 12:26:40 +0900 + +audio-session-manager (0.1.8-0) unstable; urgency=low + + * Change handle creation method (0~255) + * Git: 165.213.180.234:/git/slp/pkgs/audio-session-manager + * Tag: audio-session-manager_0.1.8-0 + + -- Kwanghui Cho <kwanghui.cho@samsung.com> Wed, 13 Oct 2010 10:36:32 +0900 + +audio-session-manager (0.1.7-3) unstable; urgency=low + + * Ignore OOM setting error + * Git: 165.213.180.234:/git/slp/pkgs/audio-session-manager + * Tag: audio-session-manager_0.1.7-3 + + -- Seungbae Shin <seungbae.shin@samsung.com> Thu, 07 Oct 2010 21:09:37 +0900 + +audio-session-manager (0.1.7-2) unstable; urgency=low + + * Skip check conflict on own handle + * Git: 165.213.180.234:/git/slp/pkgs/audio-session-manager + * Tag: audio-session-manager_0.1.7-2 + + -- Kwanghui Cho <kwanghui.cho@samsung.com> Tue, 05 Oct 2010 15:05:00 +0900 + +audio-session-manager (0.1.7-1) unstable; urgency=low + + * Update asm callback function proto type + * Git: 165.213.180.234:/git/slp/pkgs/audio-session-manager + * Tag: audio-session-manager_0.1.7-1 + + -- Kwanghui Cho <kwanghui.cho@samsung.com> Mon, 04 Oct 2010 10:55:04 +0900 + +audio-session-manager (0.1.7-0) unstable; urgency=low + + * Add replace, alarm session type + * Git: 165.213.180.234:/git/slp/pkgs/audio-session-manager + * Tag: audio-session-manager_0.1.7-0 + + -- Kwanghui Cho <kwanghui.cho@samsung.com> Mon, 04 Oct 2010 09:40:47 +0900 + +audio-session-manager (0.1.6-1) unstable; urgency=low + + * Handle be given each process(Max 128 processes) + * Git: 165.213.180.234:/git/slp/pkgs/audio-session-manager + * Tag: audio-session-manager_0.1.6-1 + + -- JiSung Ahn <jcastle.ahn@samsung.com> Thu, 16 Sep 2010 11:00:26 +0900 + +audio-session-manager (0.1.6-0) unstable; urgency=low + + * Add resource conflict managing feature + * Git: 165.213.180.234:/git/slp/pkgs/audio-session-manager + * Tag: audio-session-manager_0.1.6-0 + + -- KwangHui Cho <kwanghui.cho@samsung.com> Tue, 07 Sep 2010 13:19:19 +0900 + +audio-session-manager (0.1.5-1) unstable; urgency=low + + * update uploader in debian/control file + * Git: 165.213.180.234:/git/slp/pkgs/audio-session-manager + * Tag: audio-session-manager_0.1.5-1 + + -- KwangHui Cho <kwanghui.cho@samsung.com> Mon, 06 Sep 2010 08:26:57 +0900 + +audio-session-manager (0.1.5-0) unstable; urgency=low + + * fix emergency exit + * Git: 165.213.180.234:/git/slp/pkgs/audio-session-manager + * Tag: audio-session-manager_0.1.5-0 + + -- KwangHui Cho <kwanghui.cho@samsung.com> Mon, 06 Sep 2010 08:09:25 +0900 + +audio-session-manager (0.1.4-11) unstable; urgency=low + + * Fix (share+exclusive) concurrent play issue + * Git: 165.213.180.234:/git/slp/pkgs/audio-session-manager + * Tag: audio-session-manager_0.1.4-11 + + -- Seungbae Shin <seungbae.shin@samsung.com> Thu, 15 Jul 2010 15:19:52 +0900 + +audio-session-manager (0.1.4-10) unstable; urgency=low + + * fix exclusive player policy table + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/audio-session-manager-0.1 + * Tag: audio-session-manager_0.1.4-10 + + -- Seungbae Shin <seungbae.shin@samsung.com> Thu, 08 Jul 2010 08:58:47 +0900 + +audio-session-manager (0.1.4-9) unstable; urgency=low + + * Change maintainer + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/audio-session-manager-0.1 + * Tag: audio-session-manager_0.1.4-9 + + -- JongHyuk Choi <jhchoi.choi@samsung.com> Wed, 07 Jul 2010 14:06:24 +0900 + +audio-session-manager (0.1.4-8) unstable; urgency=low + + * Reupload for mm-log update + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/audio-session-manager-0.1 + * Tag: audio-session-manager_0.1.4-8 + + -- KwangHui Cho <kwanghui.cho@samsung.com> Thu, 17 Jun 2010 13:46:46 +0900 + +audio-session-manager (0.1.4-7) unstable; urgency=low + + * Reupload + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/audio-session-manager-0.1 + * Tag: audio-session-manager_0.1.4-7 + + -- KwangHui Cho <kwanghui.cho@samsung.com> Wed, 16 Jun 2010 10:47:01 +0900 + +audio-session-manager (0.1.4-6) unstable; urgency=low + + * Reupload + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/audio-session-manager-0.1 + * Tag: audio-session-manager_0.1.4-6 + + -- KwangHui Cho <kwanghui.cho@samsung.com> Wed, 16 Jun 2010 08:32:13 +0900 + +audio-session-manager (0.1.4-5) unstable; urgency=low + + * Reupload for mm-log update + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/audio-session-manager-0.1 + * Tag: audio-session-manager_0.1.4-5 + + -- Seungbae Shin <seungbae.shin@samsung.com> Tue, 15 Jun 2010 18:48:12 +0900 + +audio-session-manager (0.1.4-4) unstable; urgency=low + + * reupload + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/audio-session-manager-0.1 + * Tag: audio-session-manager_0.1.4-4 + + -- KwangHui Cho <kwanghui.cho@samsung.com> Fri, 04 Jun 2010 10:17:00 +0900 + +audio-session-manager (0.1.4-3) unstable; urgency=low + + * reupload because change of vconf + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/audio-session-manager-0.1 + * Tag: audio-session-manager_0.1.4-3 + + -- KwangHui Cho <kwanghui.cho@samsung.com> Sat, 29 May 2010 12:08:33 +0900 + +audio-session-manager (0.1.4-2) unstable; urgency=low + * Fix bug - client lib does not send return callback for resume command + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/audio-session-manager-0.1 + * Tag: audio-session-manager_0.1.4-2 + + -- KwangHui Cho <kwanghui.cho@samsung.com> Fri, 14 May 2010 12:56:11 +0900 + +audio-session-manager (0.1.4-1) unstable; urgency=low + * Repackage for libslp-setting update + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/audio-session-manager-0.1 + * Tag: audio-session-manager_0.1.4-1 + + -- Seungbae Shin <seungbae.shin@samsung.com> Wed, 12 May 2010 14:32:08 +0900 + +audio-session-manager (0.1.4-0) unstable; urgency=low + + * Add earjack eject event type & change callback parameter for event source type + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/audio-session-manager-0.1 + * Tag: audio-session-manager_0.1.4-0 + + -- KwangHui Cho <kwanghui.cho@samsung.com> Fri, 07 May 2010 11:10:09 +0900 + +audio-session-manager (0.1.3-5) unstable; urgency=low + + * Fix mistypo in debian/control + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/audio-session-manager-0.1 + * Tag: audio-session-manager_0.1.3-5 + + -- Seungbae Shin <seungbae.shin@samsung.com> Mon, 03 May 2010 22:32:45 +0900 + +audio-session-manager (0.1.3-4) unstable; urgency=low + + * Make new sdk-dev package + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/audio-session-manager-0.1 + * Tag: audio-session-manager_0.1.3-4 + + -- KwangHui Cho <kwanghui.cho@samsung.com> Mon, 03 May 2010 17:57:36 +0900 + +audio-session-manager (0.1.3-3) unstable; urgency=low + + * update log string + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/audio-session-manager-0.1 + * Tag: audio-session-manager_0.1.3-3 + + -- KwangHui Cho <kwanghui.cho@samsung.com> Fri, 30 Apr 2010 11:01:47 +0900 + +audio-session-manager (0.1.3-2) unstable; urgency=low + + * add libslp-setting-dev dependency on libaudiosessionmgr-dev + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/audio-session-manager-0.1 + * Tag: audio-session-manager_0.1.3-2 + + -- KwangHui Cho <kwanghui.cho@samsung.com> Sat, 24 Apr 2010 14:34:04 +0900 + +audio-session-manager (0.1.3-1) unstable; urgency=low + + * fix libaudiosessinmgr-dev dependency + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/audio-session-manager-0.1 + * Tag: audio-session-manager_0.1.3-1 + + -- KwangHui Cho <kwanghui.cho@samsung.com> Fri, 23 Apr 2010 17:55:51 +0900 + +audio-session-manager (0.1.3-0) unstable; urgency=low + + * Apply Resume callback when end of call interrupt + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/audio-session-manager-0.1 + * Tag: audio-session-manager_0.1.3-0 + + -- KwangHui Cho <kwanghui.cho@samsung.com> Tue, 20 Apr 2010 17:43:39 +0900 + +audio-session-manager (0.1.2-8) unstable; urgency=low + + * Apply chown/chmod in postinst script + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/audio-session-manager-0.1 + * Tag: audio-session-manager_0.1.2-8 + + -- KwangHui Cho <kwanghui.cho@samsung.com> Tue, 20 Apr 2010 09:50:11 +0900 + +audio-session-manager (0.1.2-7) unstable; urgency=low + + * update log message + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/audio-session-manager-0.1 + * Tag: audio-session-manager_0.1.2-7 + + -- KwangHui Cho <kwanghui.cho@samsung.com> Thu, 15 Apr 2010 18:12:59 +0900 + +audio-session-manager (0.1.2-6) unstable; urgency=low + + * Repackage for mm-log update + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/audio-session-manager-0.1 + * Tag: audio-session-manager_0.1.2-6 + + -- Seungbae Shin <seungbae.shin@samsung.com> Wed, 14 Apr 2010 23:02:53 +0900 + +audio-session-manager (0.1.2-5) unstable; urgency=low + + * add init script + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/audio-session-manager-0.1 + * Tag: audio-session-manager_0.1.2-5 + + -- KwangHui Cho <kwanghui.cho@samsung.com> Thu, 08 Apr 2010 19:41:00 +0900 + +audio-session-manager (0.1.2-4) unstable; urgency=low + + * dos2unix + + -- Seungbae Shin <seungbae.shin@samsung.com> Mon, 05 Apr 2010 13:54:41 +0900 + +audio-session-manager (0.1.2-3) unstable; urgency=low + + * Update policy : allow notify during call. + + -- KwangHui Cho <kwanghui.cho@samsung.com> Fri, 26 Mar 2010 15:08:08 +0900 + +audio-session-manager (0.1.2-2) unstable; urgency=low + + * Toolchain Upgrade + + -- Wonhyung Cho <wh01.cho@samsung.com> Thu, 25 Mar 2010 13:48:20 +0900 + +audio-session-manager (0.1.2-1) unstable; urgency=low + + * Add vconf_set_int at start of daemon + + -- KwangHui Cho <kwanghui.cho@samsung.com> Mon, 22 Mar 2010 15:10:56 +0900 + +audio-session-manager (0.1.2-0) unstable; urgency=low + + * get unique handle from server + + -- KwangHui Cho <kwanghui.cho@samsung.com> Tue, 16 Mar 2010 11:14:11 +0900 + +audio-session-manager (0.1.1-13) unstable; urgency=low + + * change return of callback function (void -> result) + + -- KwangHui Cho <kwanghui.cho@samsung.com> Tue, 09 Mar 2010 11:05:46 +0900 + +audio-session-manager (0.1.1-12) unstable; urgency=low + + * Add radio type. & bug fix for set status + + -- KwangHui Cho <kwanghui.cho@samsung.com> Sat, 06 Mar 2010 10:15:05 +0900 + +audio-session-manager (0.1.1-11) unstable; urgency=low + + * Change log level + + -- KwangHui Cho <kwanghui.cho@samsung.com> Sat, 06 Mar 2010 07:41:55 +0900 + +audio-session-manager (0.1.1-10) unstable; urgency=low + + * rework "remove duplicated register" + + -- KwangHui Cho <kwanghui.cho@samsung.com> Fri, 05 Mar 2010 19:49:44 +0900 + +audio-session-manager (0.1.1-9) unstable; urgency=low + + * change section + + -- KwangHui Cho <kwanghui.cho@samsung.com> Fri, 05 Mar 2010 18:18:43 +0900 + +audio-session-manager (0.1.1-8) unstable; urgency=low + + * remove duplicated register + + -- KwangHui Cho <kwanghui.cho@samsung.com> Fri, 05 Mar 2010 10:54:53 +0900 + +audio-session-manager (0.1.1-7) unstable; urgency=low + + * Add __check_daed_process() to ASM_REQUEST_SETSTATE + + -- KwangHui Cho <kwanghui.cho@samsung.com> Thu, 04 Mar 2010 14:24:25 +0900 + +audio-session-manager (0.1.1-6) unstable; urgency=low + + * Check dead process when every asm register + * change instance id from tid to pid + + -- KwangHui Cho <kwanghui.cho@samsung.com> Wed, 03 Mar 2010 09:21:42 +0900 + +audio-session-manager (0.1.1-5) unstable; urgency=low + + * skip callback to same pid when 1stop 2play & 1pause 2play + + -- KwangHui Cho <kwanghui.cho@samsung.com> Sat, 27 Feb 2010 07:26:31 +0900 + +audio-session-manager (0.1.1-4) unstable; urgency=low + + * Support mixing scenario + + -- KwangHui Cho <kwanghui.cho@samsung.com> Thu, 25 Feb 2010 10:54:03 +0900 + +audio-session-manager (0.1.1-3) unstable; urgency=low + + * Use possible_pause event when player is kicked out + + -- KwangHui Cho <kwanghui.cho@samsung.com> Wed, 24 Feb 2010 19:09:28 +0900 + +audio-session-manager (0.1.1-2) unstable; urgency=low + + * Expend event type + + -- KwangHui Cho <kwanghui.cho@samsung.com> Tue, 23 Feb 2010 12:20:35 +0900 + +audio-session-manager (0.1.1-1) unstable; urgency=low + + * Change SoundStatus vconf backend from db to memory + + -- KwangHui Cho <kwanghui.cho@samsung.com> Mon, 22 Feb 2010 15:43:59 +0900 + +audio-session-manager (0.1.1-0) unstable; urgency=low + + * change client api to handle based function + + -- KwangHui Cho <kwanghui.cho@samsung.com> Mon, 22 Feb 2010 10:23:43 +0900 + +audio-session-manager (0.1.0-3) unstable; urgency=low + + * update postinst script + + -- KwangHui Cho <kwanghui.cho@samsung.com> Fri, 19 Feb 2010 16:14:01 +0900 + +audio-session-manager (0.1.0-2) unstable; urgency=low + + * Update log + + -- KwangHui Cho <kwanghui.cho@samsung.com> Fri, 19 Feb 2010 13:29:09 +0900 + +audio-session-manager (0.1.0-1) unstable; urgency=low + + * Fix wrong policy about call interrupt + + -- KwangHui Cho <kwanghui.cho@samsung.com> Fri, 19 Feb 2010 11:00:50 +0900 + +audio-session-manager (0.1.0-0) unstable; urgency=low + + * Initial Release. + + -- KwangHui Cho <kwanghui.cho@samsung.com> Tue, 09 Feb 2010 17:29:12 +0900 diff --git a/debian/control b/debian/control index d436c1e..04f5779 100644 --- a/debian/control +++ b/debian/control @@ -1,7 +1,7 @@ Source: audio-session-manager Section: libs Priority: optional -Maintainer: Seungbae Shin <seungbae.shin@samsung.com>, JongHyuk Choi <jhchoi.choi@samsung.com> +Maintainer: Seungbae Shin <seungbae.shin@samsung.com>, JongHyuk Choi <jhchoi.choi@samsung.com>, Sangchul Lee <sc11.lee@samsung.com> Uploaders: Younghwan Ahn <younghwan_.an@samsung.com>, Jeongmo Yang <jm80.yang@samsung.com> Build-Depends: debhelper (>= 5), autotools-dev, libslp-setting-dev, libmm-log-dev, libslp-sysman-dev, libsecurity-server-client-dev, libavsystem-dev Standards-Version: 3.7.2 diff --git a/debian/libaudiosessionmgr-0.install.in b/debian/libaudiosessionmgr-0.install.in index aea1750..0dd5fa0 100644 --- a/debian/libaudiosessionmgr-0.install.in +++ b/debian/libaudiosessionmgr-0.install.in @@ -1,4 +1,2 @@ # if your module, creates shared libraries @PREFIX@/lib/*.so* -@PREFIX@/bin/* -/etc/rc.d/* diff --git a/debian/libaudiosessionmgr-0.postinst b/debian/libaudiosessionmgr-0.postinst index 991f2da..b572cd9 100644 --- a/debian/libaudiosessionmgr-0.postinst +++ b/debian/libaudiosessionmgr-0.postinst @@ -1,9 +1,3 @@ #!/bin/sh vconftool set -t int memory/Sound/SoundStatus "0" -i -if [ -n "`env|grep SBOX`" ]; then - echo "postinst: sbox installation skip lauching daemon" -else - echo "postinst: run audio-session-mgr-server again" - /usr/bin/audio-session-mgr-server& -fi diff --git a/debian/rules b/debian/rules index b5db4cd..34fda48 100755 --- a/debian/rules +++ b/debian/rules @@ -94,11 +94,6 @@ install: build # Add here commands to install the package into debian/ncurses. $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install - mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/ - ln -s ../init.d/audiosessionmanager $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/S30audiosessionmanager - mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc4.d/ - ln -s ../init.d/audiosessionmanager $(CURDIR)/debian/tmp/etc/rc.d/rc4.d/S30audiosessionmanager - # Build architecture-independent files here. binary-indep: build install diff --git a/include/asm-error.h b/include/asm-error.h index 9084444..9084444 100755..100644 --- a/include/asm-error.h +++ b/include/asm-error.h diff --git a/include/asm-log.h b/include/asm-log.h index e945238..e945238 100755..100644 --- a/include/asm-log.h +++ b/include/asm-log.h diff --git a/include/audio-session-manager-types.h b/include/audio-session-manager-types.h index f2ab404..1c4a17a 100755..100644 --- a/include/audio-session-manager-types.h +++ b/include/audio-session-manager-types.h @@ -62,15 +62,16 @@ typedef enum { ASM_REQUEST_REGISTER = 0, - ASM_REQUEST_UNREGISTER = 1, - ASM_REQUEST_GETSTATE = 2, - ASM_REQUEST_GETMYSTATE = 3, - ASM_REQUEST_SETSTATE = 4, - ASM_REQUEST_EMERGENT_EXIT = 5, - ASM_REQUEST_DUMP = 6, + ASM_REQUEST_UNREGISTER, + ASM_REQUEST_GETSTATE, + ASM_REQUEST_GETMYSTATE, + ASM_REQUEST_SETSTATE, + ASM_REQUEST_EMERGENT_EXIT, + ASM_REQUEST_DUMP, + ASM_REQUEST_SET_SUBSESSION, + ASM_REQUEST_GET_SUBSESSION, } ASM_requests_t; - /** * This enumeration defines sound event for Sound Scenario in Multimedia Resources Conflict Manager. */ @@ -96,6 +97,7 @@ typedef enum ASM_EVENT_ALARM, ASM_EVENT_VIDEOCALL, ASM_EVENT_MONITOR, + ASM_EVENT_RICH_CALL, ASM_EVENT_MAX } ASM_sound_events_t; @@ -154,6 +156,7 @@ typedef enum ASM_STATUS_ALARM = 0x00100000, ASM_STATUS_VIDEOCALL = 0x20000000, //Watch out ASM_STATUS_MONITOR = 0x80000000, //watch out + ASM_STATUS_RICH_CALL = 0x40000000, //Watch out } ASM_sound_status_t; @@ -314,6 +317,7 @@ static const ASM_sound_event_type_t ASM_sound_type[] = { { ASM_EVENT_ALARM, ASM_STATUS_ALARM }, { ASM_EVENT_VIDEOCALL, ASM_STATUS_VIDEOCALL }, { ASM_EVENT_MONITOR, ASM_STATUS_MONITOR }, + { ASM_EVENT_RICH_CALL, ASM_STATUS_RICH_CALL }, }; diff --git a/include/audio-session-manager.h b/include/audio-session-manager.h index 9a74181..b7434b2 100755..100644 --- a/include/audio-session-manager.h +++ b/include/audio-session-manager.h @@ -53,6 +53,9 @@ bool ASM_register_sound(const int application_pid, int *asm_handle, ASM_sound_events_t sound_event, ASM_sound_states_t sound_state, ASM_sound_cb_t callback, void* cb_data, ASM_resource_t mm_resource, int *error_code); +bool +ASM_register_sound_ex (const int application_pid, int *asm_handle, ASM_sound_events_t sound_event, + ASM_sound_states_t sound_state, ASM_sound_cb_t callback, void* cb_data, ASM_resource_t mm_resource, int *error_code, int (*func)(void*,void*)); /** * This function unregister sound event to ASM server. If unregistered, sound event is not playing. @@ -65,6 +68,7 @@ ASM_register_sound(const int application_pid, int *asm_handle, ASM_sound_events_ bool ASM_unregister_sound(const int asm_handle, ASM_sound_events_t sound_event, int *error_code); +bool ASM_unregister_sound_ex(const int asm_handle, ASM_sound_events_t sound_event, int *error_code, int (*func)(void*,void*)); /** @@ -118,7 +122,7 @@ ASM_get_process_session_state(const int asm_handle, ASM_sound_states_t *sound_st bool ASM_set_sound_state(const int asm_handle, ASM_sound_events_t sound_event, ASM_sound_states_t sound_state, ASM_resource_t mm_resource, int *error_code); - +bool ASM_set_sound_state_ex (const int asm_handle, ASM_sound_events_t sound_event, ASM_sound_states_t sound_state, ASM_resource_t mm_resource, int *error_code, int (*func)(void*,void*)); /** * This function ask sound policy to ASM server. diff --git a/init/Makefile.am b/init/Makefile.am deleted file mode 100644 index 9344687..0000000 --- a/init/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -installinitscriptdir = /etc/rc.d/init.d -installinitscript_SCRIPTS = $(srcdir)/audiosessionmanager diff --git a/init/Makefile.in b/init/Makefile.in deleted file mode 100644 index 1f05e4a..0000000 --- a/init/Makefile.in +++ /dev/null @@ -1,359 +0,0 @@ -# Makefile.in generated by automake 1.10.2 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = init -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__installdirs = "$(DESTDIR)$(installinitscriptdir)" -installinitscriptSCRIPT_INSTALL = $(INSTALL_SCRIPT) -SCRIPTS = $(installinitscript_SCRIPTS) -SOURCES = -DIST_SOURCES = -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUDIOSESSIONMGR_CFLAGS = @AUDIOSESSIONMGR_CFLAGS@ -AUDIOSESSIONMGR_LIBS = @AUDIOSESSIONMGR_LIBS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -MMLOG_CFLAGS = @MMLOG_CFLAGS@ -MMLOG_LIBS = @MMLOG_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -SYSMAN_CFLAGS = @SYSMAN_CFLAGS@ -SYSMAN_LIBS = @SYSMAN_LIBS@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -installinitscriptdir = /etc/rc.d/init.d -installinitscript_SCRIPTS = $(srcdir)/audiosessionmanager -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign init/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign init/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-installinitscriptSCRIPTS: $(installinitscript_SCRIPTS) - @$(NORMAL_INSTALL) - test -z "$(installinitscriptdir)" || $(MKDIR_P) "$(DESTDIR)$(installinitscriptdir)" - @list='$(installinitscript_SCRIPTS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - if test -f $$d$$p; then \ - f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ - echo " $(installinitscriptSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(installinitscriptdir)/$$f'"; \ - $(installinitscriptSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(installinitscriptdir)/$$f"; \ - else :; fi; \ - done - -uninstall-installinitscriptSCRIPTS: - @$(NORMAL_UNINSTALL) - @list='$(installinitscript_SCRIPTS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ - echo " rm -f '$(DESTDIR)$(installinitscriptdir)/$$f'"; \ - rm -f "$(DESTDIR)$(installinitscriptdir)/$$f"; \ - done - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(SCRIPTS) -installdirs: - for dir in "$(DESTDIR)$(installinitscriptdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-installinitscriptSCRIPTS - -install-dvi: install-dvi-am - -install-exec-am: - -install-html: install-html-am - -install-info: install-info-am - -install-man: - -install-pdf: install-pdf-am - -install-ps: install-ps-am - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-installinitscriptSCRIPTS - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - distclean distclean-generic distclean-libtool distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-installinitscriptSCRIPTS \ - install-man install-pdf install-pdf-am install-ps \ - install-ps-am install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ - ps ps-am uninstall uninstall-am \ - uninstall-installinitscriptSCRIPTS - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/init/audiosessionmanager b/init/audiosessionmanager deleted file mode 100644 index 8d63382..0000000 --- a/init/audiosessionmanager +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# -### BEGIN INIT INFO -# Provides: audiosessionmanager -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: start audio-session-manager daemon -### END INIT INFO - - -if [ -x /usr/bin/audio-session-mgr-server ]; then - /usr/bin/audio-session-mgr-server & -fi diff --git a/packaging/audio-session-manager.spec b/packaging/audio-session-manager.spec index d2fbbc5..2699613 100644 --- a/packaging/audio-session-manager.spec +++ b/packaging/audio-session-manager.spec @@ -1,9 +1,9 @@ Name: audio-session-manager -Summary: Audioxi Session Manager -Version: 0.1.19 +Summary: Audio Session Manager +Version: 0.2.0 Release: 1 Group: TO_BE/FILLED_IN -License: Apache-2.0 +License: TO BE FILLED IN Source0: %{name}-%{version}.tar.gz Requires(post): /sbin/ldconfig Requires(post): /usr/bin/vconftool @@ -47,7 +47,7 @@ auido-session-manager development package for sdk release for audio-session %autogen --disable-static --noconfigure LDFLAGS="$LDFLAGS -Wl,--rpath=%{prefix}/lib -Wl,--hash-style=both -Wl,--as-needed "; export LDFLAGS -CFLAGS="%{optflags} -fvisibility=hidden -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\"" ; export CFLAGS +CFLAGS="%{optflags} -fvisibility=hidden -DMM_DEBUG_FLAG -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\"" ; export CFLAGS %configure --disable-static --enable-security make %{?jobs:-j%jobs} @@ -62,28 +62,21 @@ rm -rf %{buildroot} vconftool set -t int memory/Sound/SoundStatus "0" -i -mkdir -p /etc/rc.d/rc3.d -mkdir -p /etc/rc.d/rc4.d -ln -s /etc/rc.d/init.d/audiosessionmanager /etc/rc.d/rc3.d/S30audiosessionmanager -ln -s /etc/rc.d/init.d/audiosessionmanager /etc/rc.d/rc4.d/S30audiosessionmanager - %postun /sbin/ldconfig -rm -f /etc/rc.d/rc3.d/S30audiosessionmanager -rm -f /etc/rc.d/rc4.d/S30audiosessionmanager - - %files -%{_sysconfdir}/rc.d/init.d/audiosessionmanager -%{_bindir}/audio-session-mgr-server +%defattr(-,root,root,-) %{_libdir}/libaudio-session-mgr.so.* %files devel +%defattr(-,root,root,-) %{_includedir}/mmf/audio-session-manager-types.h %{_includedir}/mmf/audio-session-manager.h + %files sdk-devel +%defattr(-,root,root,-) %{_includedir}/mmf/audio-session-manager-types.h %{_includedir}/mmf/audio-session-manager.h %{_libdir}/libaudio-session-mgr.so diff --git a/src/audio-session-mgr-server.c b/src/audio-session-mgr-server.c deleted file mode 100644 index f7bbd1b..0000000 --- a/src/audio-session-mgr-server.c +++ /dev/null @@ -1,1582 +0,0 @@ -/* - * audio-session-manager - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Seungbae Shin <seungbae.shin@samsung.com> - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <errno.h> -#include <fcntl.h> -#include <unistd.h> - -#include <sys/types.h> -#include <sys/wait.h> -#include <sys/ipc.h> -#include <sys/select.h> -#include <sys/time.h> -#include <sys/msg.h> -#include <glib.h> -#include <glib/gprintf.h> -#include <poll.h> - -#include <vconf.h> -#include <audio-session-manager.h> -#include <asm-log.h> -#include <string.h> -#include <errno.h> - -#include <sysman.h> - -#ifdef USE_SECURITY -#include <security-server.h> -#endif - -#include <avsys-audio.h> - -#define HIBERNATION_CHECK_KEY "memory/hibernation/audio_ready" -#define HIBERNATION_READY 1 -#define USE_SYSTEM_SERVER_PROCESS_MONITORING - -#define SUPPORT_GCF /* currently in use */ - -static const ASM_sound_cases_t ASM_sound_case[ASM_PRIORITY_MATRIX_MIN+1][ASM_PRIORITY_MATRIX_MIN+1] = -{ - /* SP SC SS SO SA, EP EC ES EO EA, N C SF EF EU, A VC M */ - { 8, 8, 8, 8, 8, 6, 6, 6, 6, 6, 8, 8, 8, 6, 6, 6, 6, 8 }, /* 00 Shared MMPlayer */ - { 8, 8, 8, 8, 8, 5, 5, 5, 5, 5, 8, 5, 8, 5, 8, 5, 5, 8 }, /* 01 Shared MMCamcorder */ - { 8, 8, 8, 8, 8, 5, 5, 5, 5, 5, 8, 5, 8, 5, 6, 5, 5, 8 }, /* 02 Shared MMSound */ - { 8, 8, 8, 8, 8, 5, 5, 5, 5, 5, 8, 5, 8, 5, 6, 5, 5, 8 }, /* 03 Shared OpenAL */ - { 8, 8, 8, 8, 8, 5, 5, 5, 5, 5, 8, 5, 8, 5, 8, 5, 5, 8 }, /* 04 Shared AVsystem */ - { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8, 6, 6, 6, 6, 6, 8 }, /* 05 Exclusive MMPlayer */ - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 5, 5, 5, 8, 5, 5 ,8 }, /* 06 Exclusive MMCamcorder */ - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 5, 5, 5, 6, 5, 5, 8 }, /* 07 Exclusive MMSound */ - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 5, 5, 5, 6, 5, 5, 8 }, /* 08 Exclusive OpenAL */ - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 5, 5, 5, 8, 5, 5, 8 }, /* 09 Exclusive AVsystem */ - { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 8, 8, 8, 5, 5, 8 }, /* 10 Notify */ - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 0, 1, 1, 8, 8, 1, 8 }, /* 11 Call */ - { 8, 8, 8, 8, 8, 5, 5, 5, 5, 5, 8, 5, 5, 5, 8, 5, 5, 8 }, /* 12 Shared FMradio */ - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 5, 5, 5, 8, 5, 5, 8 }, /* 13 Exclusive FMradio */ - { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 }, /* 14 Earjack Unplug */ - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 5, 1, 1, 8, 8, 5, 8 }, /* 15 Alarm */ - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 1, 1, 1, 8, 8, 0, 8 }, /* 16 Video Call */ - { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 }, /* 17 Monitor */ -}; - -typedef struct _list -{ - long int instance_id; - int sound_handle; - ASM_sound_events_t sound_event; - ASM_sound_states_t sound_state; - ASM_resume_states_t need_resume; - ASM_resource_t mm_resource; - avsys_audio_playing_devcie_t device_when_interrupted; - unsigned short monitor_active; - unsigned short monitor_dirty; - struct _list *next; -} asm_instance_list_t; - -asm_instance_list_t *head_list, *tail_list; - -int asm_snd_msgid; -int asm_rcv_msgid; -int asm_cb_msgid; -ASM_msg_lib_to_asm_t asm_rcv_msg; -ASM_msg_asm_to_lib_t asm_snd_msg; -ASM_msg_asm_to_cb_t asm_cb_msg; - -bool asm_is_send_msg_to_cb = false; - -#ifdef SUPPORT_GCF -#define GCF_DEFAULT 0 -int is_gcf = GCF_DEFAULT; -#endif - -unsigned int g_sound_status_pause = 0; -unsigned int g_sound_status_playing = 0; - -#define SERVER_HANDLE_MAX_COUNT 256 - -static const char* ASM_sound_events_str[] = -{ - "SHARE_MMPLAYER", - "SHARE_MMCAMCORDER", - "SHARE_MMSOUND", - "SHARE_OPENAL", - "SHARE_AVSYSTEM", - "EXCLUSIVE_MMPLAYER", - "EXCLUSIVE_MMCAMCORDER", - "EXCLUSIVE_MMSOUND", - "EXCLUSIVE_OPENAL", - "EXCLUSIVE_AVSYSTEM", - "NOTIFY", - "CALL", - "SHARE_FMRADIO", - "EXCLUSIVE_FMRADIO", - "EARJACK_UNPLUG", - "ALARM", - "VIDEOCALL", - "MONITOR" -}; - -static const char* ASM_sound_state_str[] = -{ - "STATE_NONE", - "STATE_PLAYING", - "STATE_WAITING", - "STATE_STOP", - "STATE_PAUSE", - "STATE_PAUSE_BY_APP", - "STATE_ALTER_PLAYING" -}; - - -static const char* ASM_sound_request_str[] = -{ - "REQUEST_REGISTER", - "REQUEST_UNREGISTER", - "REQUEST_GETSTATE", - "REQUEST_GETMYSTATE", - "REQUEST_SETSTATE", - "REQUEST_EMEGENT_EXIT", - "REQUEST_DUMP" -}; - - -static const char* ASM_sound_cases_str[] = -{ - "CASE_NONE", - "CASE_1PLAY_2STOP", - "CASE_1PLAY_2ALTER_PLAY", - "CASE_1PLAY_2WAIT", - "CASE_1ALTER_PLAY_2PLAY", - "CASE_1STOP_2PLAY", - "CASE_1PAUSE_2PLAY", - "CASE_1VIRTUAL_2PLAY", - "CASE_1PLAY_2PLAY_MIX" -}; - -static const char* ASM_sound_resume_str[] = -{ - "NO-RESUME", - "RESUME" -}; - - -static const char* ASM_sound_command_str[] = -{ - "CMD_NONE", - "CMD_WAIT", - "CMD_PLAY", - "CMD_STOP", - "CMD_PAUSE", - "CMD_RESUME", -}; - -#define ASM_SND_MSG_SET(asm_snd_msg, x_alloc_handle, x_cmd_handle, x_result_sound_command, x_result_sound_state) \ -do { \ - asm_snd_msg.data.alloc_handle = x_alloc_handle; \ - asm_snd_msg.data.cmd_handle = x_cmd_handle; \ - asm_snd_msg.data.result_sound_command = x_result_sound_command; \ - asm_snd_msg.data.result_sound_state = x_result_sound_state; \ -} while (0) - -void selectSleep(int secs) -{ - struct timeval timeout; - timeout.tv_sec = (secs < 1 || secs > 10) ? 3 : secs; - timeout.tv_usec = 0; - select(0, NULL, NULL, NULL, &timeout); - return; -} - - -gboolean __find_clean_monitor_handle(int instance_id, int *handle) -{ - asm_instance_list_t *temp_list = head_list; - int lhandle = -1; - - while (temp_list->next != tail_list) { - if (temp_list->instance_id == instance_id && temp_list->sound_event == ASM_EVENT_MONITOR) { - if (temp_list->monitor_dirty == 0) { - lhandle = temp_list->sound_handle; - } - break; - } - temp_list = temp_list->next; - } - if (lhandle == -1) { - return FALSE; - } else { - *handle = lhandle; - return TRUE; - } -} - -void __update_monitor_active(long int instance_id) -{ - asm_instance_list_t *temp_list = head_list; - asm_instance_list_t *monitor_list = NULL; - unsigned short active = 0; - asm_info("[ASM_Server] %s\n",__func__); - - while (temp_list->next != tail_list) { - if (temp_list->instance_id == instance_id && temp_list->sound_event == ASM_EVENT_MONITOR) { - /* backup monitor pointer */ - monitor_list = temp_list; - break; - } - temp_list = temp_list->next; - } - if (NULL == monitor_list) { - asm_warning("[ASM_Server] %s : No monitor instance for %d\n",__func__, instance_id); - return; - } - - temp_list = head_list; - while (temp_list->next != tail_list) { - if (temp_list->instance_id == instance_id && temp_list->sound_event != ASM_EVENT_MONITOR) { - if (ASM_STATE_PLAYING == temp_list->sound_state) { - active = 1; - break; - } - } - temp_list = temp_list->next; - } - - monitor_list->monitor_active = active; -} - -void __set_all_monitor_clean() -{ - asm_instance_list_t *temp_list = head_list; - - while (temp_list->next != tail_list) { - if (temp_list->sound_event == ASM_EVENT_MONITOR) { - temp_list->monitor_dirty = 0; - } - temp_list = temp_list->next; - } -} - -void __set_monitor_dirty(long int instance_id) -{ - asm_instance_list_t *temp_list = head_list; - - while (temp_list->next != tail_list) { - if (temp_list->instance_id == instance_id && temp_list->sound_event == ASM_EVENT_MONITOR) { - temp_list->monitor_dirty = 1; - break; - } - temp_list = temp_list->next; - } -} - -/* callback without retcb */ -void __do_callback_wo_retcb(int instance_id,int handle,int command) -{ - int fd_ASM = 0, cur_handle = 0; - char *filename = g_strdup_printf("/tmp/ASM.%d.%d", instance_id, handle); - - if ((fd_ASM = open(filename,O_WRONLY|O_NONBLOCK)) < 0) { - asm_info("[ASM_Server][CallCB] %s open error",filename); - g_free(filename); - return; - } - cur_handle = (unsigned int)(handle |(command << 4)); - if (write(fd_ASM, (void *)&cur_handle, sizeof(cur_handle)) < 0) { - asm_info("[ASM_Server][CallCB] %s write error",filename); - g_free(filename); - return; - } - close(fd_ASM); - g_free(filename); - selectSleep(2); /* if return immediately bad sound occur */ -} - - -int __do_callback(int instance_id,int handle,int command, ASM_event_sources_t event_src) -{ - char *filename = NULL; - char *filename2 = NULL; - struct timeval time; - int starttime = 0; - int endtime = 0; - int fd=0,nread = 0; - int fd_ASM = 0, cur_handle = 0; - int buf = 0; - struct pollfd pfd; - int pret = 0; - int pollingTimeout = 7000; - - asm_info("[ASM_Server] __do_callback for pid(%d) handle(%d)\n", instance_id, handle); - - /* Set start time */ - gettimeofday(&time, NULL); - starttime = time.tv_sec * 1000000 + time.tv_usec; - - /************************************** - * - * Open callback cmd pipe - * - **************************************/ - filename = g_strdup_printf("/tmp/ASM.%d.%d", instance_id, handle); - if ((fd_ASM = open(filename, O_WRONLY|O_NONBLOCK)) < 0) { - asm_error("[ASM_Server][CallCB] %s open error\n", filename); - goto fail; - } - - /****************************************** - * - * Open callback result pipe - * before writing callback cmd to pipe - * - ******************************************/ - filename2 = g_strdup_printf("/tmp/ASM.%d.%dr", instance_id, handle); - if ((fd=open(filename2,O_RDONLY|O_NONBLOCK))== -1) { - char str_error[256]; - strerror_r (errno, str_error, sizeof(str_error)); - asm_error("[ASM_Server][RETCB] Fail to open fifo (%s)\n", str_error); - goto fail; - } - asm_info("[ASM_Server] open return cb %s\n", filename2); - - - /******************************************* - * Write Callback msg - *******************************************/ - cur_handle = (unsigned int)((0x0000ffff & handle) |(command << 16) | (event_src << 24)); - if (write(fd_ASM, (void *)&cur_handle, sizeof(cur_handle)) < 0) { - asm_error("[ASM_Server][CallCB] %s write error\n", filename); - goto fail; - } - /************************************** - * - * Close callback cmd pipe - * - **************************************/ - close(fd_ASM); - fd_ASM = -1; - g_free(filename); - filename = NULL; - - pfd.fd = fd; - pfd.events = POLLIN; - - asm_instance_list_t *temp_list = head_list; - - - /********************************************* - * - * Wait callback result msg - * - ********************************************/ - asm_critical("[ASM_Server][RETCB]wait callback(tid=%d, handle=%d, cmd=%d, timeout=%d)\n", instance_id, handle, command, pollingTimeout); - pret = poll(&pfd, 1, pollingTimeout); //timeout 7sec - if (pret < 0) { - asm_error("[ASM_Server][RETCB]poll failed (%d)\n", pret); - goto fail; - } - if (pfd.revents & POLLIN) { - nread=read(fd, (void *)&buf, sizeof(buf)); - } - g_free(filename2); - filename2 = NULL; - - /* Calculate endtime and display*/ - gettimeofday(&time, NULL); - endtime = time.tv_sec * 1000000 + time.tv_usec; - asm_critical("[ASM_Server][RETCB] ASM_CB_END cbtimelab=%3.3f(second), timeout=%d(milli second) (reciever=%d)\n", ((endtime-starttime)/1000000.), pollingTimeout, instance_id); - - /************************************** - * - * Close callback result pipe - * - **************************************/ - close(fd); - fd = -1; - asm_info("[ASM_Server][RETCB] Return value 0x%x\n", buf); - return buf; - -fail: - if (filename) { - g_free (filename); - filename = NULL; - } - if (filename2) { - g_free (filename2); - filename2 = NULL; - } - if (fd_ASM != -1) { - close(fd_ASM); - fd_ASM = -1; - } - if (fd != -1) { - close (fd); - fd = -1; - } - - return -1; -} - -gboolean __isPlayingNow() -{ - asm_instance_list_t *temp_list = head_list; - while (temp_list->next != tail_list) { - if (temp_list->sound_state == ASM_STATE_PLAYING ) { - return TRUE; - } - - temp_list = temp_list->next; - } - return FALSE; -} - -gboolean __isItPlayingNow(int instance_id, int handle) -{ - asm_instance_list_t *temp_list = head_list; - while (temp_list->next != tail_list) { - if (temp_list->instance_id == instance_id && temp_list->sound_handle == handle) { - if (temp_list->sound_state == ASM_STATE_PLAYING) { - return TRUE; - } - } - - temp_list = temp_list->next; - } - return FALSE; -} - -void __temp_print_list(char * msg) -{ - asm_instance_list_t *temp_list = head_list; - int i = 0; - - if (NULL != msg) { - asm_warning("[ASM_Server] %s\n", msg); - } - while (temp_list->next != tail_list) { - asm_info("[ASM_Server] List[%02d] ( %5ld, %2d, %-20s, %-20s, %9s, 0x%04x)\n", i, temp_list->instance_id, temp_list->sound_handle, - ASM_sound_events_str[temp_list->sound_event], - ASM_sound_state_str[temp_list->sound_state], - ASM_sound_resume_str[temp_list->need_resume], - temp_list->mm_resource); - temp_list = temp_list->next; - i++; - } -} - -void updatePhoneStatus() -{ - asm_instance_list_t *temp_list = head_list; - int i = 0, error = 0; - - g_sound_status_pause = 0; - g_sound_status_playing = 0; - - while (temp_list->next != tail_list) { - if (temp_list->sound_state == ASM_STATE_PLAYING) { - if (temp_list->sound_event >= ASM_EVENT_SHARE_MMPLAYER && temp_list->sound_event < ASM_EVENT_MAX) { - g_sound_status_playing |= ASM_sound_type[(temp_list->sound_event) + 1].sound_status; - } - } else if (temp_list->sound_state == ASM_STATE_PAUSE ) { - if (temp_list->sound_event >= ASM_EVENT_SHARE_MMPLAYER && temp_list->sound_event < ASM_EVENT_MAX) { - g_sound_status_pause |= ASM_sound_type[(temp_list->sound_event) + 1].sound_status; - } - } - temp_list = temp_list->next; - } - - if (vconf_set_int(SOUND_STATUS_KEY, g_sound_status_playing)) { - asm_info("[ASM_Server[Error = %d][1st try] phonestatus_set \n", error); - if (vconf_set_int(SOUND_STATUS_KEY, g_sound_status_playing)) { - asm_critical("[ASM_Server][Error = %d][2nd try] phonestatus_set \n", error); - } - } - - asm_info("[ASM_Server] soundstatus set to (0x%08x)\n", g_sound_status_playing); -} - - -void __asm_register_list(long int instance_id, int handle, ASM_sound_events_t sound_event, ASM_sound_states_t sound_state, ASM_resource_t mm_resource) -{ - asm_instance_list_t *temp_list; - temp_list = (asm_instance_list_t *)malloc(sizeof(asm_instance_list_t)); - temp_list->instance_id = instance_id; - temp_list->sound_handle = handle; - temp_list->sound_event = sound_event; - temp_list->sound_state = sound_state; - temp_list->need_resume = 0; - temp_list->mm_resource = mm_resource; - temp_list->monitor_active = 0; - temp_list->monitor_dirty = 0; - temp_list->device_when_interrupted = AVSYS_AUDIO_ROUTE_DEVICE_UNKNOWN; - temp_list->next = head_list; - head_list = temp_list; - - __temp_print_list("Register List"); - updatePhoneStatus(); -} - -int __asm_unregister_list(int handle) -{ - asm_instance_list_t *temp_list = head_list; - asm_instance_list_t *temp_list2 = head_list; - int instance_id = -1; - - asm_info("[ASM_Server] __asm_unregister_list \n"); - - while (temp_list->next != tail_list) { - if (temp_list->sound_handle == handle) { - instance_id = temp_list->instance_id; - if (temp_list == head_list) - head_list = temp_list->next; - else - temp_list2->next = temp_list->next; - free(temp_list); - break; - } - temp_list2 = temp_list; - temp_list = temp_list->next; - } - - __temp_print_list("Unregister List for handle"); - updatePhoneStatus(); - return instance_id; -} - - -/* ------------------------- - * if PID exist return true, else return false - */ -gboolean isPIDExist(int pid) -{ - if (pid > 999999 || pid < 2) - return FALSE; - gchar *tmp = g_malloc0(25); - g_sprintf(tmp, "/proc/%d", pid); - if (access(tmp, R_OK)==0) { - g_free(tmp); - return TRUE; - } - g_free(tmp); - return FALSE; -} - - -/* ------------------------- - * - */ -void __check_dead_process() -{ - asm_instance_list_t *temp_list = head_list; - asm_instance_list_t *temp_list2 = head_list; - while (temp_list->next != tail_list) { - if (!isPIDExist(temp_list->instance_id)) { - asm_critical_r("[ASM_Server] PID(%ld) not exist! -> ASM_Server resource of pid(%ld) will be cleared \n", temp_list->instance_id, temp_list->instance_id); - - if (temp_list == head_list) { - head_list = temp_list->next; - } - temp_list2->next = temp_list->next; - free(temp_list); - } else { - temp_list2 = temp_list; - } - temp_list = temp_list2->next; - } - updatePhoneStatus(); -} - - - - -void emergent_exit(int exit_pid) -{ - asm_instance_list_t *temp_list = head_list; - int handle = -1; - int instance_id = -1; - - while (temp_list->next != tail_list) { - if (temp_list->instance_id == exit_pid) { - handle = temp_list->sound_handle; - - instance_id = __asm_unregister_list(handle); - - if (instance_id != -1) { - char str_error[256]; - char* filename = g_strdup_printf("/tmp/ASM.%d.%d", instance_id, handle); - char* filename2 = g_strdup_printf("/tmp/ASM.%d.%dr", instance_id, handle); - if (!remove(filename)) { - asm_info("[ASM_Server] remove %s success\n", filename); - } else { - strerror_r (errno, str_error, sizeof (str_error)); - asm_error("[ASM_Server] remove %s failed with %s\n", filename, str_error); - } - - if (!remove(filename2)) { - asm_info("[ASM_Server] remove %s success\n", filename2); - } else { - strerror_r (errno, str_error, sizeof (str_error)); - asm_error("[ASM_Server] remove %s failed with %s\n", filename2, str_error); - } - - g_free(filename); - g_free(filename2); - } - temp_list = head_list; - } else { - temp_list = temp_list->next; - } - } - - asm_info("[ASM_Server][EMERGENT_EXIT] complete\n"); - return; -} - - -int ___reorder_state(ASM_sound_states_t input) -{ - int res = 0; - - switch (input) { - case ASM_STATE_IGNORE: - case ASM_STATE_NONE: - res = 0; - break; - case ASM_STATE_WAITING: - case ASM_STATE_STOP: - res = 1; - break; - case ASM_STATE_PAUSE: - case ASM_STATE_PAUSE_BY_APP: - res = 2; - break; - case ASM_STATE_PLAYING: - res = 3; - break; - } - return res; -} - -ASM_sound_states_t __asm_find_process_status(int pid) -{ - asm_instance_list_t *temp_list = head_list; - ASM_sound_states_t result_state = ASM_STATE_NONE; - - asm_info("[ASM_Server] __asm_find_process_status for pid %d\n", pid); - - while (temp_list->next != tail_list) { - if (temp_list->instance_id == pid) { - if ( ___reorder_state(temp_list->sound_state) >= ___reorder_state(result_state)) { - result_state = temp_list->sound_state; - } - } - temp_list = temp_list->next; - } - - return result_state; -} - -ASM_sound_states_t __asm_find_list(ASM_requests_t request_id, int handle) -{ - asm_instance_list_t *temp_list = head_list; - - asm_info("[ASM_Server] __asm_find_list\n"); - - while (temp_list->next != tail_list) { - if ((request_id == ASM_REQUEST_GETSTATE && temp_list->sound_handle == handle)) { - return temp_list->sound_state; - } else { - temp_list = temp_list->next; - } - } - - return ASM_STATE_NONE; -} - -void __asm_change_state_list(long int instance_id, int handle, ASM_sound_states_t sound_state, ASM_resource_t mm_resource) -{ - asm_instance_list_t *temp_list = head_list; - int monitor_handle = -1; - asm_info("[ASM_Server] __asm_change_state_list\n"); - if (sound_state == ASM_STATE_IGNORE) { - asm_info("[ASM_Server] skip update state list %ld-%d\n", instance_id, handle); - return; - } - - while (temp_list->next != tail_list) { - if (temp_list->instance_id == instance_id && temp_list->sound_handle == handle) { - temp_list->sound_state = sound_state; - temp_list->mm_resource = mm_resource; - break; - } - temp_list = temp_list->next; - } - __update_monitor_active(instance_id); - updatePhoneStatus(); -} - -void __asm_change_need_resume_list(long int instance_id, int handle, ASM_resume_states_t need_resume) -{ - asm_instance_list_t *temp_list = head_list; - asm_info("[ASM_Server] __asm_change_need_resume_list\n"); - while (temp_list->next != tail_list) { - if (temp_list->instance_id == instance_id && temp_list->sound_handle == handle) { - temp_list->need_resume = need_resume; - - if (need_resume == ASM_NEED_RESUME) { - avsys_audio_playing_devcie_t dev = AVSYS_AUDIO_ROUTE_DEVICE_UNKNOWN; - if (AVSYS_SUCCESS(avsys_audio_get_playing_device_info(&dev))) { - temp_list->device_when_interrupted = dev; - } - } - break; - } - temp_list = temp_list->next; - } -} - - -void __asm_create_message_queue() -{ - asm_rcv_msgid = msgget((key_t)2014, 0666 | IPC_CREAT); - asm_snd_msgid = msgget((key_t)4102, 0666 | IPC_CREAT); - asm_cb_msgid = msgget((key_t)4103, 0666 | IPC_CREAT); - - if (asm_snd_msgid == -1 || asm_rcv_msgid == -1 || asm_cb_msgid == -1) { - asm_critical("[ASM_Server] msgget failed with error: \n"); - exit(EXIT_FAILURE); - } -} - -void __asm_snd_message() -{ - if (msgsnd(asm_snd_msgid, (void *)&asm_snd_msg, sizeof(asm_snd_msg.data), 0) == -1) { - asm_critical("[ASM_Server] msgsnd failed with error %d\n", errno); - exit(EXIT_FAILURE); - } -} - -void __asm_cb_message() -{ - if (msgsnd(asm_cb_msgid, (void *)&asm_cb_msg, sizeof(asm_cb_msg.data), 0) == -1) { - asm_critical_r("[ASM_Server] msgsnd(Callback msg) failed with error %d\n", errno); - exit(EXIT_FAILURE); - } -} - -void __asm_rcv_message() -{ - if (msgrcv(asm_rcv_msgid, (void *)&asm_rcv_msg, sizeof(asm_rcv_msg.data), 0, 0) == -1) { - asm_critical_r("[ASM_Server] msgrcv failed with error %d\n", errno); - exit(EXIT_FAILURE); - } -} - -void __asm_get_empty_handle(long int instance_id, int *handle) -{ - asm_instance_list_t *temp_list = head_list; - unsigned int i = 0, find_empty = 0, j = 0; - char handle_info[SERVER_HANDLE_MAX_COUNT]; - - asm_info("[ASM_Server] __asm_make_handle for %ld\n", instance_id); - __temp_print_list("current list before get new handle"); - - memset(handle_info, 0, sizeof(char) * SERVER_HANDLE_MAX_COUNT); - - while (temp_list->next != tail_list) { - handle_info[temp_list->sound_handle] = 1; - temp_list = temp_list->next; - } - - for (i = 0; i < ASM_SERVER_HANDLE_MAX; i++) { - if (handle_info[i] == 0) { - find_empty = 1; - break; - } - } - if (find_empty && (i != ASM_SERVER_HANDLE_MAX)) { - asm_error_r("[ASM_Server] New handle for %ld is %d\n", instance_id, i); - *handle = i; - } else { - asm_error_r("[ASM_Server] Handle is full for pid %ld\n", instance_id); - *handle = -1; - } - -} - -void __print_resource(unsigned short resource_status) -{ - if (resource_status == ASM_RESOURCE_NONE) - asm_info("[ASM_Server] resource NONE\n"); - if (resource_status | ASM_RESOURCE_CAMERA) - asm_info("[ASM_Server] resource CAMERA\n"); - if (resource_status | ASM_RESOURCE_VIDEO_OVERLAY) - asm_info("[ASM_Server] resource VIDEO OVERLAY\n"); - if (resource_status | ASM_RESOURCE_HW_ENCORDER) - asm_info("[ASM_Server] resource HW ENCORDER\n"); - if (resource_status | ASM_RESOURCE_HW_DECORDER) - asm_info("[ASM_Server] resource HW DECORDER\n"); - if (resource_status | ASM_RESOURCE_RADIO_TUNNER) - asm_info("[ASM_Server] resource RADIO TUNNER\n"); - if (resource_status | ASM_RESOURCE_TV_TUNNER) - asm_info("[ASM_Server] resource TV TUNNER\n"); -} - -void __asm_compare_priority_matrix(long int instance_id, int handle, ASM_requests_t request_id, - ASM_sound_events_t sound_event,ASM_sound_states_t sound_state, ASM_resource_t mm_resource) -{ - int no_conflict_flag = 0; - - /* If nobody is playing now, this means no conflict */ - if (ASM_STATUS_NONE == g_sound_status_playing) { - asm_info("[ASM_Server] __asm_compare_priority_matrix : No conflict ( No existing Sound )\n"); - - ASM_SND_MSG_SET(asm_snd_msg, handle, -1, ASM_COMMAND_NONE, sound_state); - - no_conflict_flag = 1; - } else { /* Somebody is playing */ - asm_instance_list_t *temp_list = head_list; - int updatedflag = 0; - int cb_res = 0; - int update_state = ASM_STATE_NONE; - - while (temp_list->next != tail_list) { - /* Find who's playing now */ - if (temp_list->sound_state == ASM_STATE_PLAYING) { - /* Found it */ - ASM_sound_states_t current_play_state = temp_list->sound_state; - ASM_sound_events_t current_play_sound_event = temp_list->sound_event; - long int current_play_instance_id = temp_list->instance_id; - int current_play_handle = temp_list->sound_handle; - ASM_resource_t current_using_resource = temp_list->mm_resource; - - if ((current_play_instance_id == instance_id) && (current_play_handle == handle)) { - asm_warning("[ASM_Server] This is my handle. skip %d %d\n", instance_id, handle); - temp_list = temp_list->next; - continue; - } - - /* Request is PLAYING */ - if (sound_state == ASM_STATE_PLAYING) { - /* Determine sound policy */ - ASM_sound_cases_t sound_case = ASM_sound_case[current_play_sound_event][sound_event]; - -#ifdef SUPPORT_GCF - /* GCF case is exception case */ - /* NOTE : GCF exception case only */ - if ((is_gcf) && (sound_case != ASM_CASE_1PLAY_2PLAY_MIX)) { - sound_case = ASM_CASE_1PLAY_2PLAY_MIX;; - } -#endif - - asm_critical("[ASM_Server] Conflict policy[%x][%x]: %s\n", current_play_sound_event,sound_event,ASM_sound_cases_str[sound_case]); - switch (sound_case) { - case ASM_CASE_1PLAY_2STOP: - { - if (current_play_instance_id == instance_id) { - /* PID is policy group.*/ - asm_info("[ASM_Server] Do not send Stop callback in same pid %ld\n", instance_id); - } else { - ASM_SND_MSG_SET(asm_snd_msg, handle, handle, ASM_COMMAND_STOP, sound_state); - temp_list = tail_list; /* skip all remain list */ - break; - } - - /* Prepare msg to send */ - ASM_SND_MSG_SET(asm_snd_msg, handle, handle, ASM_COMMAND_PLAY, sound_state); - - if (!updatedflag) { - if (request_id == ASM_REQUEST_REGISTER){ - __asm_register_list(instance_id, handle, sound_event, sound_state, mm_resource); - } else { - __asm_change_state_list(instance_id, handle, sound_state, mm_resource); - } - updatedflag = 1; - } - break; - } - - case ASM_CASE_1STOP_2PLAY: - { - if (current_play_instance_id == instance_id) { - /* PID is policy group. */ - asm_info("[ASM_Server] Do not send Stop callback in same pid %ld\n", instance_id); - } else { - ASM_event_sources_t event_src; - unsigned short resource_status = current_using_resource & mm_resource; - - /* Determine root cause of conflict */ - if (resource_status != ASM_RESOURCE_NONE) { - event_src = ASM_EVENT_SOURCE_RESOURCE_CONFLICT; - } else { - switch (sound_event) { - case ASM_EVENT_CALL: - case ASM_EVENT_VIDEOCALL: - event_src = ASM_EVENT_SOURCE_CALL_START; - break; - - case ASM_EVENT_EARJACK_UNPLUG: - event_src = ASM_EVENT_SOURCE_EARJACK_UNPLUG; - break; - - case ASM_EVENT_ALARM: - event_src = ASM_EVENT_SOURCE_ALARM_START; - break; - - default: - event_src = ASM_EVENT_SOURCE_OTHER_APP; - break; - } - } - - /* Execute callback function for monitor handle */ - int monitor_handle = -1; - if (__find_clean_monitor_handle(current_play_instance_id, &monitor_handle)) { - cb_res = __do_callback(current_play_instance_id, monitor_handle, ASM_COMMAND_STOP, event_src); - asm_warning("[ASM_Server] send stop callback for monitor handle of pid %d\n", current_play_instance_id); - if (cb_res != ASM_CB_RES_NONE && cb_res != ASM_CB_RES_STOP) { - asm_error_r("[ASM_Server] oops! not suspected callback result %d\n", cb_res); - } - __set_monitor_dirty(current_play_instance_id); - - /* If current is playing and input event is CALL/VIDEOCALL/ALARM, set to need resume */ - if ((sound_event == ASM_EVENT_CALL || sound_event == ASM_EVENT_VIDEOCALL || sound_event == ASM_EVENT_ALARM) - && (current_play_state == ASM_STATE_PLAYING)) { - __asm_change_need_resume_list(current_play_instance_id, monitor_handle, ASM_NEED_RESUME); - } - } - - /* Execute callback function for worker handle */ - cb_res = __do_callback(current_play_instance_id,current_play_handle,ASM_COMMAND_STOP, event_src); - if (cb_res != ASM_CB_RES_NONE && cb_res != ASM_CB_RES_STOP) - asm_error_r("[ASM_Server] oops! not suspected result %d\n", cb_res); - asm_warning("[ASM_Server] __asm_compare_priority_matrix(1STOP_2PLAY) : __do_callback Complete : TID=%ld, handle=%d", - current_play_instance_id,current_play_handle ); - - /* If current is playing and input event is CALL/VIDEOCALL/ALARM, set to need resume */ - if ((sound_event == ASM_EVENT_CALL || sound_event == ASM_EVENT_VIDEOCALL || sound_event == ASM_EVENT_ALARM) - && (current_play_state == ASM_STATE_PLAYING)) { - __asm_change_need_resume_list(current_play_instance_id, current_play_handle, ASM_NEED_RESUME); - } - - /* Set state to NONE */ - __asm_change_state_list(current_play_instance_id, current_play_handle, ASM_STATE_NONE, ASM_RESOURCE_NONE); - } - - /* Prepare msg to send */ - ASM_SND_MSG_SET(asm_snd_msg, handle, handle, ASM_COMMAND_PLAY, sound_state); - - if (!updatedflag) { - if (request_id == ASM_REQUEST_REGISTER) { - __asm_register_list(instance_id, handle, sound_event, sound_state, mm_resource); - } else { - __asm_change_state_list(instance_id, handle, sound_state, mm_resource); - } - updatedflag = 1; - } - break; - } - - case ASM_CASE_1PAUSE_2PLAY: - { - ASM_resource_t update_resource = current_using_resource; - if (current_play_instance_id == instance_id) { - asm_info("[ASM_Server] Do not send Pause callback in same pid %ld\n", instance_id); - } else { - ASM_event_sources_t event_src; - ASM_sound_commands_t command; - - unsigned short resource_status = current_using_resource & mm_resource; - if (resource_status != ASM_RESOURCE_NONE) { - asm_info("[ASM_Server] resource conflict found 0x%x\n", resource_status); - event_src = ASM_EVENT_SOURCE_RESOURCE_CONFLICT; - command = ASM_COMMAND_STOP; - } else { - switch (sound_event) { - case ASM_EVENT_CALL: - case ASM_EVENT_VIDEOCALL: - event_src = ASM_EVENT_SOURCE_CALL_START; - break; - - case ASM_EVENT_EARJACK_UNPLUG: - event_src = ASM_EVENT_SOURCE_EARJACK_UNPLUG; - break; - - case ASM_EVENT_ALARM: - event_src = ASM_EVENT_SOURCE_ALARM_START; - break; - - case ASM_EVENT_SHARE_MMPLAYER: - case ASM_EVENT_EXCLUSIVE_MMPLAYER: - if ( current_play_sound_event == ASM_EVENT_SHARE_MMPLAYER || - current_play_sound_event == ASM_EVENT_EXCLUSIVE_MMPLAYER ) { - event_src = ASM_EVENT_SOURCE_OTHER_PLAYER_APP; - break; - } - - default: - event_src = ASM_EVENT_SOURCE_OTHER_APP; - break; - } - command = ASM_COMMAND_PAUSE; - } - - /* Execute callback function for monitor handle */ - int monitor_handle = -1; - if (__find_clean_monitor_handle(current_play_instance_id, &monitor_handle)) { - cb_res = __do_callback(current_play_instance_id, monitor_handle, ASM_COMMAND_STOP, event_src); - asm_warning("[ASM_Server] send stop callback for monitor handle of pid %d\n", current_play_instance_id); - if (cb_res != ASM_CB_RES_NONE && cb_res != ASM_CB_RES_STOP) { - asm_error_r("[ASM_Server] oops! not suspected callback result %d\n", cb_res); - } - __set_monitor_dirty(current_play_instance_id); - - /* If current is playing and input event is CALL/VIDEOCALL/ALARM, set to need resume */ - if ((sound_event == ASM_EVENT_CALL || sound_event == ASM_EVENT_VIDEOCALL || sound_event == ASM_EVENT_ALARM) - && (current_play_state == ASM_STATE_PLAYING)) { - __asm_change_need_resume_list(current_play_instance_id, monitor_handle, ASM_NEED_RESUME); - } - } - - /* Execute callback function for worker handle */ - cb_res = __do_callback(current_play_instance_id,current_play_handle,command, event_src); - asm_warning("[ASM_Server] %s(1PAUSE_2PLAY) : Callback of %s: TID(%ld)\n", - __func__,ASM_sound_command_str[command], current_play_instance_id); - /*Change current sound' state when it is in 1Pause_2Play case */ - switch (cb_res) { - case ASM_CB_RES_PAUSE: - update_state = ASM_STATE_PAUSE; - break; - - case ASM_CB_RES_NONE: - case ASM_CB_RES_STOP: - update_state = ASM_STATE_NONE; - update_resource = ASM_RESOURCE_NONE; - break; - - case ASM_CB_RES_IGNORE: - update_state = ASM_STATE_IGNORE; - break; - - default: - asm_error_r("[ASM_Server] oops! not suspected result %d\n", cb_res); - update_state = ASM_STATE_NONE; - break; - } - - /* If current is playing and input event is CALL/VIDEOCALL/ALARM, set to need resume */ - if ((sound_event == ASM_EVENT_CALL || sound_event == ASM_EVENT_VIDEOCALL || sound_event == ASM_EVENT_ALARM) - &&(current_play_state == ASM_STATE_PLAYING)) { - __asm_change_need_resume_list(current_play_instance_id, current_play_handle, ASM_NEED_RESUME); - } - - __asm_change_state_list(current_play_instance_id, current_play_handle, update_state, update_resource); - } - - /* Prepare msg to send */ - ASM_SND_MSG_SET(asm_snd_msg, handle, handle, ASM_COMMAND_PLAY, sound_state); - - if (!updatedflag) { - if (request_id == ASM_REQUEST_REGISTER) { - __asm_register_list(instance_id, handle, sound_event, sound_state, mm_resource); - } else { - __asm_change_state_list(instance_id, handle, sound_state, mm_resource); - } - updatedflag = 1; - } - break; - } - - case ASM_CASE_1PLAY_2PLAY_MIX: - { - if (current_play_instance_id == instance_id) { - asm_info("[ASM_Server] Do not send check resource conflict in same pid %ld\n", instance_id); - } else { - /* MIX but need to check resource conflict */ - asm_warning("[ASM_Server] >>>> __asm_compare_priority_matrix(1PLAY_2PLAY_MIX) : !!!\n"); - ASM_resource_t update_resource = current_using_resource; - unsigned short resource_status = current_using_resource & mm_resource; - if (resource_status) { /* Resouce conflict */ - asm_warning("[ASM_Server] there is system resource conflict 0x%x\n", resource_status); - __print_resource(resource_status); - - /* Execute callback function for monitor handle */ - int monitor_handle = -1; - if (__find_clean_monitor_handle(current_play_instance_id, &monitor_handle)) { - cb_res = __do_callback(current_play_instance_id, monitor_handle, ASM_COMMAND_STOP, ASM_EVENT_SOURCE_RESOURCE_CONFLICT); - if (cb_res != ASM_CB_RES_NONE && cb_res != ASM_CB_RES_STOP) { - asm_error_r("[ASM_Server] oops! not suspected callback result %d\n", cb_res); - } - asm_warning("[ASM_Server] send stop callback for monitor handle of pid %d\n", current_play_instance_id); - __set_monitor_dirty(current_play_instance_id); - - /* If current is playing and input event is CALL/VIDEOCALL/ALARM, set to need resume */ - if ((sound_event == ASM_EVENT_CALL || sound_event == ASM_EVENT_VIDEOCALL || sound_event == ASM_EVENT_ALARM) - && (current_play_state == ASM_STATE_PLAYING) ) { - __asm_change_need_resume_list(current_play_instance_id, monitor_handle, ASM_NEED_RESUME); - } - } - - /* Execute callback function for worker handle */ - /* Stop current resource holding instance */ - cb_res = __do_callback(current_play_instance_id, current_play_handle, ASM_COMMAND_STOP, ASM_EVENT_SOURCE_RESOURCE_CONFLICT); - asm_warning("[ASM_Server] __asm_compare_priority_matrix(1PLAY_2PLAY_MIX) : Resource Conflict : TID(%ld)\n", - current_play_instance_id); - - /* Change current sound */ - switch (cb_res) { - case ASM_CB_RES_NONE: - case ASM_CB_RES_STOP: - update_state = ASM_STATE_NONE; - update_resource = ASM_RESOURCE_NONE; - break; - - case ASM_CB_RES_IGNORE: - update_state = ASM_STATE_IGNORE; - break; - - default: - asm_error_r("[ASM_Server] oops! not suspected result %d\n", cb_res); - update_state = ASM_STATE_NONE; - break; - } - - __asm_change_state_list(current_play_instance_id, current_play_handle, update_state, update_resource); - } - } - - /* Prepare msg to send */ - ASM_SND_MSG_SET(asm_snd_msg, handle, handle, ASM_COMMAND_PLAY, sound_state); - - if (!updatedflag) { - if (request_id == ASM_REQUEST_REGISTER) { - __asm_register_list(instance_id, handle, sound_event, sound_state, mm_resource); - } else { - __asm_change_state_list(instance_id, handle, sound_state, mm_resource); - } - updatedflag = 1; - } - break; - } - - default: - { - ASM_SND_MSG_SET(asm_snd_msg, handle, handle, ASM_COMMAND_NONE, sound_state); - asm_warning("[ASM_Server] >>>> __asm_compare_priority_matrix : ASM_CASE_NONE [It should not be seen] !!!\n"); - break; - } - } /* switch (sound_case) */ - } else { - /* Request was not PLAYING, this means no conflict, just do set */ - asm_info("[ASM_Server] __asm_compare_priority_matrix : No Conflict (Just Register or Set State) !!!\n"); - ASM_SND_MSG_SET(asm_snd_msg, handle, handle, ASM_COMMAND_NONE, sound_state); - - if (sound_state == ASM_STATE_NONE) { - asm_info("[ASM_Server] __asm_compare_priority_matrix(1PLAY_2NONE) : No Conflict !!!\n"); - } else if (sound_state == ASM_STATE_WAITING) { - asm_info("[ASM_Server] __asm_compare_priority_matrix(1PLAY_2WAIT) : No Conflict !!!\n"); - } - - if (!updatedflag) { - if (request_id == ASM_REQUEST_REGISTER) { - __asm_register_list(instance_id, handle, sound_event, sound_state, mm_resource); - } else { - __asm_change_state_list(instance_id, handle, sound_state, mm_resource); - } - updatedflag = 1; - } - } - } /* if (temp_list->sound_state == ASM_STATE_PLAYING) */ - - temp_list = temp_list->next; - - } /* while (temp_list->next != tail_list) */ - - /* Make all monitor handle dirty flag clean. */ - __set_all_monitor_clean(); - } - - /* Find if resource confilct exists in case of 1Pause 2Play or 1Stop 2Play */ - if (ASM_STATUS_NONE != g_sound_status_pause && mm_resource != ASM_RESOURCE_NONE && - (asm_snd_msg.data.result_sound_command == ASM_COMMAND_PLAY || no_conflict_flag)) { - asm_instance_list_t *temp_list = head_list; - int cb_res = 0; - - while (temp_list->next != tail_list) { - /* Who is in PAUSE state? */ - if (temp_list->sound_state == ASM_STATE_PAUSE) { - /* Found PAUSE state */ - asm_warning("[ASM_Server] Now list's state is pause. %d %d\n", instance_id, handle); - ASM_sound_states_t current_play_state = temp_list->sound_state; - ASM_sound_events_t current_play_sound_event = temp_list->sound_event; - long int current_play_instance_id = temp_list->instance_id; - int current_play_handle = temp_list->sound_handle; - ASM_resource_t current_using_resource = temp_list->mm_resource; - - if ((current_play_instance_id == instance_id) && (current_play_handle == handle)) { - if (request_id == ASM_REQUEST_SETSTATE) { - asm_warning("[ASM_Server] Own handle. Pause state change to play. %d %d\n", instance_id, handle); - __asm_change_state_list(instance_id, handle, sound_state, mm_resource); - } else { - asm_warning("[ASM_Server] This is my handle. skip %d %d\n", instance_id, handle); - } - temp_list = temp_list->next; - continue; - } - - if (sound_state == ASM_STATE_PLAYING) { - ASM_sound_cases_t sound_case = ASM_sound_case[current_play_sound_event][sound_event]; - - asm_critical("[ASM_Server] Conflict policy[%x][%x]: %s\n", current_play_sound_event, sound_event, ASM_sound_cases_str[sound_case]); - switch (sound_case) { - case ASM_CASE_1PAUSE_2PLAY: - case ASM_CASE_1STOP_2PLAY: - { - if (current_play_instance_id == instance_id) { - //PID is policy group. - asm_info("[ASM_Server] Do not send Stop callback in same pid %ld\n", instance_id); - } else { - unsigned short resource_status = current_using_resource & mm_resource; - - /* Check conflict with paused instance */ - if (resource_status != ASM_RESOURCE_NONE) { - asm_warning("[ASM_Server] there is system resource conflict with paused instance 0x%x\n",resource_status); - __print_resource(resource_status); - } else { - asm_info("[ASM_Server] no resource conflict with paused instance\n"); - break; - } - - /* Execute callback function for monitor handle */ - int monitor_handle = -1; - if (__find_clean_monitor_handle(current_play_instance_id, &monitor_handle)) { - cb_res = __do_callback(current_play_instance_id, monitor_handle, ASM_COMMAND_STOP, ASM_EVENT_SOURCE_RESOURCE_CONFLICT); - if (cb_res != ASM_CB_RES_NONE && cb_res != ASM_CB_RES_STOP) { - asm_error_r("[ASM_Server] oops! not suspected callback result %d\n", cb_res); - } - asm_warning("[ASM_Server] send stop callback for monitor handle of pid %d\n", current_play_instance_id); - - __set_monitor_dirty(current_play_instance_id); - } - - /* Execute callback function for worker handle */ - cb_res = __do_callback(current_play_instance_id,current_play_handle, ASM_COMMAND_STOP, ASM_EVENT_SOURCE_RESOURCE_CONFLICT); - if (cb_res != ASM_CB_RES_NONE && cb_res != ASM_CB_RES_STOP) { - asm_error_r("[ASM_Server] oops! not suspected result %d\n", cb_res); - } - asm_warning("[ASM_Server] __asm_compare_priority_matrix(1STOP_2PLAY) cause RESOURCE : __do_callback Complete : TID=%ld, handle=%d",current_play_instance_id,current_play_handle ); - - __asm_change_state_list(current_play_instance_id, current_play_handle, ASM_STATE_NONE, ASM_RESOURCE_NONE); - } - - asm_info("[ASM_Server] >>>> __asm_compare_priority_matrix(1STOP_2PLAY) cause RESOURCE : msg sent and then received msg !!!\n"); - break; - } - - default: - { - /* asm_warning("[ASM_Server] >>>> __asm_compare_priority_matrix : ASM_CASE_NONE [do not anything] !!!\n"); */ - break; - } - } /* switch (sound_case) */ - } else { - /* asm_warning("[ASM_Server] >>>> __asm_compare_priority_matrix : ASM_CASE_NONE [do not anything] !!!\n"); */ - } - } /* if (temp_list->sound_state == ASM_STATE_PAUSE) */ - - temp_list = temp_list->next; - } /* while (temp_list->next != tail_list) */ - } - - /* Finally, no conflict */ - if (no_conflict_flag) { - if (request_id == ASM_REQUEST_REGISTER) { - __asm_register_list(instance_id, handle, sound_event, sound_state, mm_resource); - } else { - __asm_change_state_list(instance_id, handle, sound_state, mm_resource); - } - } - - /* Send response to client */ - asm_snd_msg.instance_id = instance_id; - __asm_snd_message(); -} - -void __asm_do_all_resume_callback(ASM_event_sources_t eventsrc) -{ - asm_instance_list_t *temp_list = head_list; - int cb_res = 0; - int avsys_err = 0; - avsys_audio_playing_devcie_t dev = AVSYS_AUDIO_ROUTE_DEVICE_UNKNOWN; - - asm_info("[ASM_Server] __asm_do_all_resume_callback\n"); - - if (AVSYS_FAIL(avsys_err = avsys_audio_get_playing_device_info(&dev))) { - asm_error("[ASM_Server] Can not get playing device info\n"); - } - - while (temp_list->next != tail_list) { - if (temp_list->need_resume == ASM_NEED_RESUME) { - if ((avsys_err != AVSYS_STATE_SUCCESS) || - (dev == AVSYS_AUDIO_ROUTE_DEVICE_HANDSET && temp_list->device_when_interrupted != AVSYS_AUDIO_ROUTE_DEVICE_HANDSET)) { - asm_warning("[ASM_Server] Skip send resume callback. Because sound path has changed to loud during interruption.\n"); - } else { - cb_res = __do_callback(temp_list->instance_id, temp_list->sound_handle, ASM_COMMAND_RESUME, eventsrc); - switch (cb_res) { - case ASM_CB_RES_PLAYING: - temp_list->sound_state = ASM_STATE_PLAYING; - break; - case ASM_CB_RES_IGNORE: - case ASM_CB_RES_NONE: - case ASM_CB_RES_STOP: - case ASM_CB_RES_PAUSE: - default: - /* do nothing */ - break; - } - } - temp_list->need_resume = ASM_NEED_NOT_RESUME; - } - temp_list = temp_list->next; - } -} - -#ifdef USE_SECURITY -gboolean __asm_check_check_privilege (unsigned char* cookie) -{ - int asm_gid = -1; - int retval = 0; - - /* Get ASM server group id */ - asm_gid = security_server_get_gid("asm"); - asm_info ("[Security] asm server gid = [%d]\n", asm_gid); - if (asm_gid < 0) { - asm_error ("[Security] security_server_get_gid() failed. error=[%d]\n", asm_gid); - return false; - } - - /* Check privilege with valid group id */ - retval = security_server_check_privilege((char *)cookie, asm_gid); - if (retval == SECURITY_SERVER_API_SUCCESS) { - asm_info("[Security] security_server_check_privilege() returns [%d]\n", retval); - return true; - } else { - asm_error("[Security] security_server_check_privilege() returns [%d]\n", retval); - return false; - } -} -#endif /* USE_SECURITY */ - -int main() -{ - int pid = 0, ret = 0; - - if (sysconf_set_mempolicy(OOM_IGNORE)) { - fprintf(stderr, "set mem policy failed\n"); - } - signal(SIGPIPE, SIG_IGN); -#if !defined(USE_SYSTEM_SERVER_PROCESS_MONITORING) - while (1) { - if (( pid = fork()) < 0) { - asm_critical_r("[ASM_Server]Fork Failed!!!\n"); - return 0; - } else if (pid == 0) { - break; - } else if (pid > 0) { - wait(&ret); - asm_critical_r("[ASM_Server]worker(child) dead!!!, try to refork()"); - } - } -#endif - __asm_create_message_queue(); - - int temp_msgctl_id1 = msgctl(asm_snd_msgid, IPC_RMID, 0); - int temp_msgctl_id2 = msgctl(asm_rcv_msgid, IPC_RMID, 0); - int temp_msgctl_id3 = msgctl(asm_cb_msgid, IPC_RMID, 0); - - - if (temp_msgctl_id1 == -1 || temp_msgctl_id2 == -1 || temp_msgctl_id3 == -1) { - asm_info("[ASM_Server] msgctl failed with error: \n"); - exit(EXIT_FAILURE); - } - //------------------------------------------------------------------- - /* - This is unnessasry finaly, but nessasary during implement. - */ - - __asm_create_message_queue(); - - head_list = (asm_instance_list_t *)malloc(sizeof(asm_instance_list_t)); - tail_list = (asm_instance_list_t *)malloc(sizeof(asm_instance_list_t)); - head_list->next = tail_list; - tail_list->next = tail_list; - - - long int rcv_instance_id; - ASM_requests_t rcv_request_id; - ASM_sound_events_t rcv_sound_event; - ASM_sound_states_t rcv_sound_state; - ASM_resource_t rcv_resource; - int rcv_sound_handle; - - /* - * Init Vconf - */ - if (vconf_set_int(SOUND_STATUS_KEY, 0)) { - asm_critical("[ASM_Server] vconf_set_int fail\n"); - if (vconf_set_int(SOUND_STATUS_KEY, 0)) { - asm_critical_r("[ASM_Server] vconf_set_int fail\n"); - } - } - if (vconf_set_int(HIBERNATION_CHECK_KEY, HIBERNATION_READY)) { - asm_critical("[ASM_Server] Hibernation check vconf_set_int fail\n"); - } - -#ifdef SUPPORT_GCF - if (vconf_get_int(VCONFKEY_ADMIN_GCF_TEST, &is_gcf)) { - asm_warning_r("[ASM_Server] vconf_get_int for VCONFKEY_ADMIN_GCF_TEST failed, set as default\n"); - is_gcf = GCF_DEFAULT; - } -#endif - - while (true) { - asm_info("[ASM_Server] asm_Server is waiting message(%d)!!!\n", asm_is_send_msg_to_cb); - - if (!asm_is_send_msg_to_cb) { - __asm_rcv_message(); - - rcv_instance_id = asm_rcv_msg.instance_id; - rcv_sound_handle = asm_rcv_msg.data.handle; - rcv_request_id = asm_rcv_msg.data.request_id; - rcv_sound_event = asm_rcv_msg.data.sound_event; - rcv_sound_state = asm_rcv_msg.data.sound_state; - rcv_resource = asm_rcv_msg.data.system_resource; - - /*******************************************************************/ - asm_info("[ASM_Server] received msg (tid=%ld,handle=%d,req=%d,event=0x%x,state=0x%x,resource=0x%x)\n", - rcv_instance_id, rcv_sound_handle, rcv_request_id, rcv_sound_event, rcv_sound_state, rcv_resource); - if (rcv_request_id != ASM_REQUEST_EMERGENT_EXIT) { - asm_warning("[ASM_Server] request_id : %s\n", ASM_sound_request_str[rcv_request_id]); - asm_warning("[ASM_Server] sound_event : %s\n", ASM_sound_events_str[rcv_sound_event]); - asm_warning("[ASM_Server] sound_state : %s\n", ASM_sound_state_str[rcv_sound_state]); - asm_warning("[ASM_Server] resource : 0x%x\n", rcv_resource); - } - /*******************************************************************/ - - switch (rcv_request_id) { - case ASM_REQUEST_REGISTER: -#ifdef USE_SECURITY - /* do security check */ - if (__asm_check_check_privilege(asm_rcv_msg.data.cookie) == 0) { - asm_error ("[Security] __asm_check_check_privilege() failed....\n"); - asm_snd_msg.instance_id = rcv_instance_id; - asm_snd_msg.data.alloc_handle = -1; - asm_snd_msg.data.cmd_handle = -1; - asm_snd_msg.data.check_privilege = 0; - __asm_snd_message(); - break; - } - asm_info ("[Security] __asm_check_check_privilege() success\n"); - asm_snd_msg.data.check_privilege = 1; -#endif /* USE_SECURITY */ - __check_dead_process(); - - __asm_get_empty_handle(rcv_instance_id, &rcv_sound_handle); - if (rcv_sound_handle == -1) { - asm_snd_msg.instance_id = rcv_instance_id; - asm_snd_msg.data.alloc_handle = -1; - asm_snd_msg.data.cmd_handle = -1; - __asm_snd_message(); - } else { - __asm_compare_priority_matrix(rcv_instance_id, rcv_sound_handle, rcv_request_id, rcv_sound_event, rcv_sound_state, rcv_resource); - } - - break; - - case ASM_REQUEST_UNREGISTER: - __asm_unregister_list(rcv_sound_handle); - /* only support resuming at end of call & alarm interrupt */ - switch (rcv_sound_event) { - case ASM_EVENT_CALL: - case ASM_EVENT_VIDEOCALL: - __asm_do_all_resume_callback(ASM_EVENT_SOURCE_CALL_END); - break; - case ASM_EVENT_ALARM: - __asm_do_all_resume_callback(ASM_EVENT_SOURCE_ALARM_END); - break; - default: - break; - } - - break; - - case ASM_REQUEST_SETSTATE: - __check_dead_process(); - if ( rcv_sound_state == ASM_STATE_PLAYING ) { - if ( __isItPlayingNow(rcv_instance_id, rcv_sound_handle)) { - __asm_change_state_list(rcv_instance_id, rcv_sound_handle, rcv_sound_state, rcv_resource); - - asm_snd_msg.data.cmd_handle = rcv_sound_handle; - asm_snd_msg.data.result_sound_command = ASM_COMMAND_NONE; - asm_snd_msg.data.result_sound_state = rcv_sound_state; - asm_snd_msg.instance_id = rcv_instance_id; - - __asm_snd_message(); - } else { - __asm_compare_priority_matrix(rcv_instance_id, rcv_sound_handle, rcv_request_id, rcv_sound_event, rcv_sound_state, rcv_resource); - } - __temp_print_list("Set State (Play)"); - } else { - __asm_change_state_list(rcv_instance_id, rcv_sound_handle, rcv_sound_state, rcv_resource); - __temp_print_list("Set State (Not Play)"); - } - break; - - case ASM_REQUEST_GETSTATE: - asm_snd_msg.instance_id = rcv_instance_id; - asm_snd_msg.data.result_sound_state = __asm_find_list(rcv_request_id, rcv_sound_handle); - __asm_snd_message(); - break; - - case ASM_REQUEST_GETMYSTATE: - __check_dead_process(); - asm_snd_msg.instance_id = rcv_instance_id; - asm_snd_msg.data.result_sound_state = __asm_find_process_status(rcv_instance_id); - __asm_snd_message(); - break; - - case ASM_REQUEST_DUMP: - __temp_print_list("DUMP"); - break; - - case ASM_REQUEST_EMERGENT_EXIT: - emergent_exit(rcv_instance_id); - break; - - default: - break; - } - } - } - - return 0; -} - diff --git a/src/audio-session-mgr.c b/src/audio-session-mgr.c index 2178161..c4f4f12 100644 --- a/src/audio-session-mgr.c +++ b/src/audio-session-mgr.c @@ -82,14 +82,16 @@ typedef gboolean (*gLoopPollHandler_t)(gpointer d); typedef struct { ASM_sound_events_t sound_event; - int asm_fd; + GSourceFuncs* g_src_funcs; + GPollFD* g_poll_fd; + int asm_fd; ASM_sound_cb_t asm_callback; - void *cb_data; - int asm_tid; - int handle; - bool is_used; - GSource* asm_src; - guint ASM_g_id; + void *cb_data; + int asm_tid; + int handle; + bool is_used; + GSource* asm_src; + guint ASM_g_id; } ASM_sound_ino_t; ASM_sound_ino_t ASM_sound_handle[ASM_HANDLE_MAX]; @@ -113,7 +115,8 @@ static const char* ASM_sound_events_str[] = "EARJACK_UNPLUG", "ALARM", "VIDEOCALL", - "MONITOR" + "MONITOR", + "RICH_CALL" }; static const char* ASM_sound_cases_str[] = @@ -261,22 +264,28 @@ gboolean asm_callback_handler( gpointer d) break; } #ifdef CONFIG_ENABLE_RETCB - int rett = 0; - int buf = cb_res; - int tmpfd = -1; - char *filename2 = g_strdup_printf("/tmp/ASM.%d.%dr", ASM_sound_handle[asm_index].asm_tid, handle); - tmpfd = open(filename2, O_WRONLY | O_NONBLOCK); - if (tmpfd < 0) { - char str_error[256]; - strerror_r(errno, str_error, sizeof(str_error)); - asm_error("[ASM_CB][RETCB][Failed(May Server Close First)]tid(%d) fd(%d) %s errno=%d(%s)\n", tid, tmpfd, filename2, errno, str_error); + + /* If command is other than RESUME, send return */ + if (rcv_command != ASM_COMMAND_RESUME) { + int rett = 0; + int buf = cb_res; + int tmpfd = -1; + char *filename2 = g_strdup_printf("/tmp/ASM.%d.%dr", ASM_sound_handle[asm_index].asm_tid, handle); + tmpfd = open(filename2, O_WRONLY | O_NONBLOCK); + if (tmpfd < 0) { + char str_error[256]; + strerror_r(errno, str_error, sizeof(str_error)); + asm_error("[ASM_CB][RETCB][Failed(May Server Close First)]tid(%d) fd(%d) %s errno=%d(%s)\n", tid, tmpfd, filename2, errno, str_error); + g_free(filename2); + return FALSE; + } + rett = write(tmpfd, &buf, sizeof(buf)); + close(tmpfd); g_free(filename2); - return FALSE; + asm_info("[RETCB]tid(%d) finishing CB (write=%d)\n", tid, rett); + } else { + asm_info("[RETCB] No need to send return for RESUME command\n"); } - rett = write(tmpfd, &buf, sizeof(buf)); - close(tmpfd); - g_free(filename2); - asm_info("[RETCB]tid(%d) finishing CB (write=%d)\n", tid, rett); #endif } } @@ -285,36 +294,40 @@ gboolean asm_callback_handler( gpointer d) bool __ASM_add_sound_callback(int index, int fd, gushort events, gLoopPollHandler_t p_gloop_poll_handler ) { - GSource* cmd_fd_gsrc = NULL; - GSourceFuncs *src_funcs = NULL; /* handler function */ + GSource* g_src = NULL; + GSourceFuncs *g_src_funcs = NULL; /* handler function */ guint gsource_handle; - GPollFD *g_fd_cmd = NULL; /* file descriptor */ + GPollFD *g_poll_fd = NULL; /* file descriptor */ /* 1. make GSource Object */ - src_funcs = (GSourceFuncs *)g_malloc(sizeof(GSourceFuncs)); - if (!src_funcs) { + g_src_funcs = (GSourceFuncs *)g_malloc(sizeof(GSourceFuncs)); + if (!g_src_funcs) { asm_info(" __ASM_add_sound_callback : g_malloc failed on g_src_funcs"); return false; } - src_funcs->prepare = __asm_fd_prepare; - src_funcs->check = __asm_fd_check; - src_funcs->dispatch = __asm_fd_dispatch; - src_funcs->finalize = NULL; - cmd_fd_gsrc = g_source_new(src_funcs, sizeof(GSource)); - if (!cmd_fd_gsrc) { + g_src_funcs->prepare = __asm_fd_prepare; + g_src_funcs->check = __asm_fd_check; + g_src_funcs->dispatch = __asm_fd_dispatch; + g_src_funcs->finalize = NULL; + g_src = g_source_new(g_src_funcs, sizeof(GSource)); + if (!g_src) { asm_critical(" __ASM_add_sound_callback : g_malloc failed on m_readfd"); return false; } - ASM_sound_handle[index].asm_src = cmd_fd_gsrc; + ASM_sound_handle[index].asm_src = g_src; + ASM_sound_handle[index].g_src_funcs = g_src_funcs; + asm_info(" g_malloc : g_src_funcs(%#X)\n", g_src_funcs); /* 2. add file description which used in g_loop() */ - g_fd_cmd = (GPollFD *)g_malloc(sizeof(GPollFD)); - g_fd_cmd->fd = fd; - g_fd_cmd->events = events; + g_poll_fd = (GPollFD *)g_malloc(sizeof(GPollFD)); + g_poll_fd->fd = fd; + g_poll_fd->events = events; + ASM_sound_handle[index].g_poll_fd = g_poll_fd; + asm_info(" g_malloc : g_poll_fd(%#X)\n", g_poll_fd); /* 3. combine g_source object and file descriptor */ - g_source_add_poll(cmd_fd_gsrc, g_fd_cmd); - gsource_handle = g_source_attach(cmd_fd_gsrc, NULL); + g_source_add_poll(g_src, g_poll_fd); + gsource_handle = g_source_attach(g_src, NULL); if (!gsource_handle) { asm_critical(" __ASM_add_sound_callback : Error: Failed to attach the source to context"); return false; @@ -324,7 +337,7 @@ bool __ASM_add_sound_callback(int index, int fd, gushort events, gLoopPollHandle ASM_sound_handle[index].ASM_g_id = gsource_handle; /* 4. set callback */ - g_source_set_callback(cmd_fd_gsrc, p_gloop_poll_handler,(gpointer)g_fd_cmd, NULL); + g_source_set_callback(g_src, p_gloop_poll_handler,(gpointer)g_poll_fd, NULL); asm_info(" g_source_set_callback : %d\n", errno); return true; @@ -334,18 +347,30 @@ bool __ASM_add_sound_callback(int index, int fd, gushort events, gLoopPollHandle bool __ASM_remove_sound_callback(int index, gushort events) { bool ret; - GPollFD *g_fd_cmd = NULL; /* store file descriptor */ + GPollFD *g_poll_fd = NULL; /* store file descriptor */ + GSourceFunc *g_src_funcs = NULL; - g_fd_cmd = (GPollFD *)g_malloc(sizeof(GPollFD)); - g_fd_cmd->fd = ASM_sound_handle[index].asm_fd; - g_fd_cmd->events = events; + g_src_funcs = ASM_sound_handle[index].g_src_funcs; + g_poll_fd = ASM_sound_handle[index].g_poll_fd; + g_poll_fd->fd = ASM_sound_handle[index].asm_fd; + g_poll_fd->events = events; - asm_info(" g_source_remove_poll : fd(%d), event(%#x)\n", g_fd_cmd->fd, g_fd_cmd->events); - g_source_remove_poll(ASM_sound_handle[index].asm_src, g_fd_cmd); + asm_info(" g_source_remove_poll : fd(%d), event(%#x)\n", g_poll_fd->fd, g_poll_fd->events); + g_source_remove_poll(ASM_sound_handle[index].asm_src, g_poll_fd); asm_info(" g_source_remove_poll : %d\n", errno); ret = g_source_remove(ASM_sound_handle[index].ASM_g_id); asm_info(" g_source_remove : ret(%#X)\n", ret); + if (g_src_funcs) { + asm_info(" g_free : g_src_funcs(%#X)\n", g_src_funcs); + g_free(g_src_funcs); + ASM_sound_handle[index].g_src_funcs = NULL; + } + if (g_poll_fd) { + asm_info(" g_free : g_poll_fd(%#X)\n", g_poll_fd); + g_free(g_poll_fd); + ASM_sound_handle[index].g_poll_fd = NULL; + } ASM_sound_handle[index].ASM_g_id = 0; ASM_sound_handle[index].asm_src = NULL; ASM_sound_handle[index].asm_callback = NULL; @@ -519,7 +544,8 @@ bool __ASM_set_cookie (unsigned char* cookie) #endif EXPORT_API -bool ASM_register_sound(const int application_pid, int *asm_handle, ASM_sound_events_t sound_event, ASM_sound_states_t sound_state, ASM_sound_cb_t callback, void *cb_data, ASM_resource_t mm_resource, int *error_code) +bool ASM_register_sound_ex (const int application_pid, int *asm_handle, ASM_sound_events_t sound_event, ASM_sound_states_t sound_state, + ASM_sound_cb_t callback, void *cb_data, ASM_resource_t mm_resource, int *error_code, int (*func)(void*,void*)) { int error = 0; unsigned int sound_status_value; @@ -600,17 +626,22 @@ bool ASM_register_sound(const int application_pid, int *asm_handle, ASM_sound_ev asm_error_r("[Error] >>>> ASM_register_sound : Send msg construct failed.\n"); return false; } - NO_EINTR(ret = msgsnd(asm_snd_msgid, (void *)&asm_snd_msg, sizeof(asm_snd_msg.data), 0)); - if (ret == -1) { - *error_code = ERR_ASM_MSG_QUEUE_SND_ERROR; - asm_error_r("[Error] >>>> ASM_register_sound : Msgsnd failed (%d,%s) \n", errno, strerror(errno)); - return false; - } - NO_EINTR(ret = msgrcv(asm_rcv_msgid, (void *)&asm_rcv_msg, sizeof(asm_rcv_msg.data), asm_pid, 0)); - if (ret == -1) { - *error_code = ERR_ASM_MSG_QUEUE_RCV_ERROR; - asm_error_r("[Error] >>>> ASM_register_sound : Msgrcv failed (%d,%s) \n", errno, strerror(errno)); - return false; + + if (func) { + func ((void*)&asm_snd_msg, (void*)&asm_rcv_msg); + } else { + NO_EINTR(ret = msgsnd(asm_snd_msgid, (void *)&asm_snd_msg, sizeof(asm_snd_msg.data), 0)); + if (ret == -1) { + *error_code = ERR_ASM_MSG_QUEUE_SND_ERROR; + asm_error_r("[Error] >>>> ASM_register_sound : Msgsnd failed (%d,%s) \n", errno, strerror(errno)); + return false; + } + NO_EINTR(ret = msgrcv(asm_rcv_msgid, (void *)&asm_rcv_msg, sizeof(asm_rcv_msg.data), asm_pid, 0)); + if (ret == -1) { + *error_code = ERR_ASM_MSG_QUEUE_RCV_ERROR; + asm_error_r("[Error] >>>> ASM_register_sound : Msgrcv failed (%d,%s) \n", errno, strerror(errno)); + return false; + } } /* Construct msg to send -> send msg -> recv msg : end */ @@ -696,6 +727,14 @@ bool ASM_register_sound(const int application_pid, int *asm_handle, ASM_sound_ev } EXPORT_API +bool ASM_register_sound (const int application_pid, int *asm_handle, ASM_sound_events_t sound_event, ASM_sound_states_t sound_state, + ASM_sound_cb_t callback, void *cb_data, ASM_resource_t mm_resource, int *error_code) +{ + return ASM_register_sound_ex (application_pid, asm_handle, sound_event, sound_state, callback, cb_data, mm_resource, error_code, NULL); +} + + +EXPORT_API bool ASM_change_callback(const int asm_handle, ASM_sound_events_t sound_event, ASM_sound_cb_t callback, void *cb_data, int *error_code) { int handle=0; @@ -735,9 +774,8 @@ bool ASM_change_callback(const int asm_handle, ASM_sound_events_t sound_event, A return true; } - EXPORT_API -bool ASM_unregister_sound(const int asm_handle, ASM_sound_events_t sound_event, int *error_code) +bool ASM_unregister_sound_ex(const int asm_handle, ASM_sound_events_t sound_event, int *error_code, int (*func)(void*,void*)) { int handle=0; int asm_index = -1; @@ -775,11 +813,15 @@ bool ASM_unregister_sound(const int asm_handle, ASM_sound_events_t sound_event, return false; } - NO_EINTR(ret = msgsnd(asm_snd_msgid, (void *)&asm_snd_msg, sizeof(asm_snd_msg.data), 0)); - if (ret == -1) { - *error_code = ERR_ASM_MSG_QUEUE_SND_ERROR; - asm_error_r("[Error] >>>> ASM_unregister_sound : Msgsnd failed (%d,%s) \n", errno, strerror(errno)); - return false; + if (func) { + func(&asm_snd_msg, &asm_rcv_msg); + } else { + NO_EINTR(ret = msgsnd(asm_snd_msgid, (void *)&asm_snd_msg, sizeof(asm_snd_msg.data), 0)); + if (ret == -1) { + *error_code = ERR_ASM_MSG_QUEUE_SND_ERROR; + asm_error_r("[Error] >>>> ASM_unregister_sound : Msgsnd failed (%d,%s) \n", errno, strerror(errno)); + return false; + } } __ASM_destroy_callback(asm_index); @@ -795,6 +837,12 @@ bool ASM_unregister_sound(const int asm_handle, ASM_sound_events_t sound_event, } EXPORT_API +bool ASM_unregister_sound(const int asm_handle, ASM_sound_events_t sound_event, int *error_code) +{ + ASM_unregister_sound_ex (asm_handle, sound_event, error_code, NULL); +} + +EXPORT_API bool ASM_get_sound_status(unsigned int *all_sound_status, int *error_code) { if (all_sound_status == NULL || error_code == NULL) { @@ -925,9 +973,8 @@ bool ASM_get_sound_state(const int asm_handle, ASM_sound_events_t sound_event, A return true; } - EXPORT_API -bool ASM_set_sound_state(const int asm_handle, ASM_sound_events_t sound_event, ASM_sound_states_t sound_state, ASM_resource_t mm_resource, int *error_code) +bool ASM_set_sound_state_ex (const int asm_handle, ASM_sound_events_t sound_event, ASM_sound_states_t sound_state, ASM_resource_t mm_resource, int *error_code, int (*func)(void*,void*)) { int handle = 0; int asm_index = 0; @@ -969,20 +1016,27 @@ bool ASM_set_sound_state(const int asm_handle, ASM_sound_events_t sound_event, A return false; } - NO_EINTR(ret = msgsnd(asm_snd_msgid, (void *)&asm_snd_msg, sizeof(asm_snd_msg.data), 0)); - if (ret == -1) { - *error_code = ERR_ASM_MSG_QUEUE_SND_ERROR; - asm_error_r("[Error] >>>> ASM_set_sound_state : Msgsnd failed (%d,%s) \n", errno, strerror(errno)); - return false; - } - if (sound_state == ASM_STATE_PLAYING ) { - NO_EINTR(ret = msgrcv(asm_rcv_msgid, (void *)&asm_rcv_msg, sizeof(asm_rcv_msg.data), ASM_sound_handle[handle].asm_tid, 0)); + if (func) { + func (&asm_snd_msg, &asm_rcv_msg); + } else { + NO_EINTR(ret = msgsnd(asm_snd_msgid, (void *)&asm_snd_msg, sizeof(asm_snd_msg.data), 0)); if (ret == -1) { - *error_code = ERR_ASM_MSG_QUEUE_RCV_ERROR; - asm_error_r("[Error] >>>> ASM_set_sound_state : Msgrcv failed (%d,%s) \n", errno, strerror(errno)); + *error_code = ERR_ASM_MSG_QUEUE_SND_ERROR; + asm_error_r("[Error] >>>> ASM_set_sound_state : Msgsnd failed (%d,%s) \n", errno, strerror(errno)); return false; } + } + + if (sound_state == ASM_STATE_PLAYING ) { + if (func == NULL) { + NO_EINTR(ret = msgrcv(asm_rcv_msgid, (void *)&asm_rcv_msg, sizeof(asm_rcv_msg.data), ASM_sound_handle[handle].asm_tid, 0)); + if (ret == -1) { + *error_code = ERR_ASM_MSG_QUEUE_RCV_ERROR; + asm_error_r("[Error] >>>> ASM_set_sound_state : Msgrcv failed (%d,%s) \n", errno, strerror(errno)); + return false; + } + } asm_info( " <<<<<<<<<<<<<<<< [BEFORE] Callback : Main Context >>>>>>>>>>>>>>>>>>>> \n"); /********************************************************************************************************/ @@ -1042,6 +1096,158 @@ bool ASM_set_sound_state(const int asm_handle, ASM_sound_events_t sound_event, A } EXPORT_API +bool ASM_set_sound_state (const int asm_handle, ASM_sound_events_t sound_event, ASM_sound_states_t sound_state, ASM_resource_t mm_resource, int *error_code) +{ + return ASM_set_sound_state_ex (asm_handle, sound_event, sound_state, mm_resource, error_code, NULL); +} + +EXPORT_API +bool ASM_set_subsession (const int asm_handle, int subsession, int *error_code, int (*func)(void*,void*)) +{ + int handle = 0; + int asm_index = 0; + int ret = 0; + unsigned int rcv_sound_status_value; + + asm_info("<<<< ASM_set_subsession \n"); + if (error_code == NULL) { + asm_error_r("error_code is null \n"); + return false; + } + + if (asm_handle < 0 || asm_handle >= ASM_SERVER_HANDLE_MAX) { + *error_code = ERR_ASM_POLICY_INVALID_HANDLE; + asm_error_r("[Error] ASM_set_sound_state : Invalid handle %d \n", asm_handle); + return false; + } + + handle = asm_handle; + + asm_index = __ASM_find_index(handle); + if (asm_index == -1) { + asm_error_r("Can not find index of %d [%d]\n", handle, __LINE__); + return false; + } + + if (!__asm_construct_snd_msg(ASM_sound_handle[asm_index].asm_tid, ASM_sound_handle[asm_index].handle, subsession, ASM_REQUEST_SET_SUBSESSION, 0, 0, error_code)) { + asm_error_r("[Error] >>>> ASM_set_subsession : Send msg construct failed.\n"); + return false; + } + + + if (func) { + func (&asm_snd_msg, &asm_rcv_msg); + } else { + NO_EINTR(ret = msgsnd(asm_snd_msgid, (void *)&asm_snd_msg, sizeof(asm_snd_msg.data), 0)); + if (ret == -1) { + *error_code = ERR_ASM_MSG_QUEUE_SND_ERROR; + asm_error_r("[Error] >>>> ASM_set_subsession : Msgsnd failed (%d,%s) \n", errno, strerror(errno)); + return false; + } + + NO_EINTR(ret = msgrcv(asm_rcv_msgid, (void *)&asm_rcv_msg, sizeof(asm_rcv_msg.data), ASM_sound_handle[handle].asm_tid, 0)); + if (ret == -1) { + *error_code = ERR_ASM_MSG_QUEUE_RCV_ERROR; + asm_error_r("[Error] >>>> ASM_set_subsession : Msgrcv failed (%d,%s) \n", errno, strerror(errno)); + return false; + } + } + + /* TODO: Should check msg returned.....*/ +#if 0 + { + asm_info( " <<<<<<<<<<<<<<<< [BEFORE] Callback : Main Context >>>>>>>>>>>>>>>>>>>> \n"); + /********************************************************************************************************/ + switch (asm_rcv_msg.data.result_sound_command) { + case ASM_COMMAND_PAUSE: + case ASM_COMMAND_STOP: + case ASM_COMMAND_PLAY: + case ASM_COMMAND_NONE: + case ASM_COMMAND_RESUME: + default: + break; + } + /********************************************************************************************************/ + asm_info(" <<<<<<<<<<<<<<<< [AFTER] Callback : Main Context >>>>>>>>>>>>>>>>>>>> \n"); + + } +#endif + + + asm_info(">>>> ASM_set_subsession\n"); + + return true; +} + +EXPORT_API +bool ASM_get_subsession (const int asm_handle, int *subsession_value, int *error_code, int (*func)(void*,void*)) +{ + int handle = 0; + int asm_index = 0; + int ret = 0; + unsigned int rcv_sound_status_value; + + asm_info("<<<< ASM_get_subsession \n"); + if (error_code == NULL) { + asm_error_r("error_code is null \n"); + return false; + } + + /* TODO : Error Handling */ +#if 0 + if (sound_event < 0 || sound_event > ASM_PRIORITY_MATRIX_MIN) { + asm_error_r(" ASM_set_subsession(%x,%x) arg is out of bound!!\n", sound_event, sound_state); + *error_code = ERR_ASM_EVENT_IS_INVALID; + return false; + } +#endif + + if (asm_handle < 0 || asm_handle >= ASM_SERVER_HANDLE_MAX) { + *error_code = ERR_ASM_POLICY_INVALID_HANDLE; + asm_error_r("[Error] ASM_get_subsession : Invalid handle %d \n", asm_handle); + return false; + } + + handle = asm_handle; + + asm_index = __ASM_find_index(handle); + if (asm_index == -1) { + asm_error_r("Can not find index of %d [%d]\n", handle, __LINE__); + return false; + } + + if (!__asm_construct_snd_msg(ASM_sound_handle[asm_index].asm_tid, ASM_sound_handle[asm_index].handle, 0, ASM_REQUEST_GET_SUBSESSION, 0, 0, error_code)) { + asm_error_r("[Error] >>>> ASM_get_subsession : Send msg construct failed.\n"); + return false; + } + + + if (func) { + func (&asm_snd_msg, &asm_rcv_msg); + } else { + NO_EINTR(ret = msgsnd(asm_snd_msgid, (void *)&asm_snd_msg, sizeof(asm_snd_msg.data), 0)); + if (ret == -1) { + *error_code = ERR_ASM_MSG_QUEUE_SND_ERROR; + asm_error_r("[Error] >>>> ASM_get_subsession : Msgsnd failed (%d,%s) \n", errno, strerror(errno)); + return false; + } + + NO_EINTR(ret = msgrcv(asm_rcv_msgid, (void *)&asm_rcv_msg, sizeof(asm_rcv_msg.data), ASM_sound_handle[handle].asm_tid, 0)); + if (ret == -1) { + *error_code = ERR_ASM_MSG_QUEUE_RCV_ERROR; + asm_error_r("[Error] >>>> ASM_get_subsession : Msgrcv failed (%d,%s) \n", errno, strerror(errno)); + return false; + } + } + + *subsession_value = asm_rcv_msg.data.result_sound_command; + + asm_info(">>>> ASM_get_subsession with subsession value [%d]\n", *subsession_value); + + return true; +} + +EXPORT_API void ASM_dump_sound_state() { int error = 0; |