4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Seungbae Shin <seungbae.shin@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
32 #include <mm_session_private.h>
34 #include "include/mm_sound_private.h"
35 #include "include/mm_sound_utils.h"
36 #include "include/mm_sound_client.h"
37 #include "include/mm_sound_pa_client.h"
38 #include "include/mm_sound_common.h"
41 #define VOLUME_MAX_MULTIMEDIA 16
42 #define VOLUME_MAX_BASIC 8
43 #define VOLUME_MAX_SINGLE 1
46 #define MASTER_VOLUME_MAX 100
47 #define MASTER_VOLUME_MIN 0
51 static pthread_mutex_t g_subscribe_cb_list_mutex = PTHREAD_MUTEX_INITIALIZER;
53 #define MM_SOUND_DBUS_BUS_NAME_PREPIX "org.tizen.MMSound"
54 #define MM_SOUND_DBUS_OBJECT_PATH "/org/tizen/MMSound"
55 #define MM_SOUND_DBUS_INTERFACE "org.tizen.mmsound"
57 static GDBusConnection *g_dbus_conn_mmsound;
58 static int g_dbus_signal_values[MM_SOUND_SIGNAL_MAX] = {0,};
59 static const char* dbus_signal_name_str[] = {
60 "ReleaseInternalFocus",
63 typedef struct _subscribe_cb {
64 mm_sound_signal_name_t signal_type;
65 mm_sound_signal_callback callback;
71 static const char* _get_volume_str (volume_type_t type)
73 static const char *volume_type_str[VOLUME_TYPE_MAX] =
74 { "SYSTEM", "NOTIFICATION", "ALARM", "RINGTONE", "MEDIA", "CALL", "VOIP", "VOICE", "FIXED"};
76 return (type >= VOLUME_TYPE_SYSTEM && type < VOLUME_TYPE_MAX)? volume_type_str[type] : "Unknown";
79 static int _validate_volume(volume_type_t type, int value)
86 case VOLUME_TYPE_CALL:
87 case VOLUME_TYPE_VOIP:
88 if (value >= VOLUME_MAX_BASIC) {
92 case VOLUME_TYPE_SYSTEM:
93 case VOLUME_TYPE_MEDIA:
94 case VOLUME_TYPE_ALARM:
95 case VOLUME_TYPE_NOTIFICATION:
96 case VOLUME_TYPE_RINGTONE:
97 case VOLUME_TYPE_VOICE:
98 if (value >= VOLUME_MAX_MULTIMEDIA) {
110 int mm_sound_volume_remove_callback(volume_type_t type)
112 /* FIXME : Will be removed */
113 return MM_ERROR_NOT_SUPPORT_API;
117 int mm_sound_add_volume_changed_callback(mm_sound_volume_changed_cb func, void* user_data, unsigned int *subs_id)
119 int ret = MM_ERROR_NONE;
121 if (func == NULL || subs_id == NULL) {
122 debug_error("argument is not valid\n");
123 return MM_ERROR_INVALID_ARGUMENT;
126 ret = mm_sound_client_add_volume_changed_callback(func, user_data, subs_id);
128 debug_error("Can not add volume changed callback, ret = %x\n", ret);
135 int mm_sound_remove_volume_changed_callback(unsigned int subs_id)
137 int ret = MM_ERROR_NONE;
139 ret = mm_sound_client_remove_volume_changed_callback(subs_id);
141 debug_error("Can not remove volume changed callback, ret = %x\n", ret);
148 int mm_sound_volume_set_value(volume_type_t volume_type, const unsigned int volume_level)
150 int ret = MM_ERROR_NONE;
152 debug_msg("type = (%d)%s, value = %d", volume_type, _get_volume_str(volume_type), volume_level);
154 /* Check input param */
155 if (0 > _validate_volume(volume_type, (int)volume_level)) {
156 debug_error("invalid volume type %d, value %u\n", volume_type, volume_level);
157 return MM_ERROR_INVALID_ARGUMENT;
160 /* request daemon to set volume */
161 ret = mm_sound_client_set_volume_by_type(volume_type, volume_level);
162 if (MM_ERROR_NONE != ret)
163 debug_error("Can not set volume, ret=0x%x", ret);
169 int mm_sound_volume_get_value(volume_type_t type, unsigned int *value)
171 int ret = MM_ERROR_NONE;
173 /* Check input param */
175 debug_error("invalid argument\n");
176 return MM_ERROR_INVALID_ARGUMENT;
178 if (type < 0 || type >= VOLUME_TYPE_MAX) {
179 debug_error("invalid volume type value %d\n", type);
180 return MM_ERROR_INVALID_ARGUMENT;
183 ret = mm_sound_util_volume_get_value_by_type(type, value);
185 debug_msg("returned %s = %d", _get_volume_str(type), *value);
190 int mm_sound_volume_primary_type_set(volume_type_t type)
192 int ret = MM_ERROR_NONE;
194 /* Check input param */
195 if(type < VOLUME_TYPE_UNKNOWN || type >= VOLUME_TYPE_MAX) {
196 debug_error("invalid argument\n");
197 return MM_ERROR_INVALID_ARGUMENT;
200 if (vconf_set_int(VCONFKEY_SOUND_PRIMARY_VOLUME_TYPE, type)) {
201 debug_error("could not set vconf for RIMARY_VOLUME_TYPE\n");
202 ret = MM_ERROR_SOUND_INTERNAL;
204 debug_msg("set primary volume type forcibly %d(%s)", type, _get_volume_str(type));
211 int mm_sound_volume_primary_type_get(volume_type_t *type)
213 int ret = MM_ERROR_NONE;
214 int voltype = VOLUME_TYPE_RINGTONE;
216 /* Check input param */
218 debug_error("invalid argument\n");
219 return MM_ERROR_INVALID_ARGUMENT;
222 /* check force set */
223 if (vconf_get_int(VCONFKEY_SOUND_PRIMARY_VOLUME_TYPE, &voltype)) {
224 debug_error("could not get vconf for PRIMARY_VOLUME_TYPE\n");
225 ret = MM_ERROR_SOUND_INTERNAL;
227 debug_msg("get primary volume type %d(%s)", voltype, _get_volume_str(voltype));
235 int mm_sound_set_filter(const char *stream_type, const char *filter_name, const char *filter_parameters, const char *filter_group)
237 /* Check input param */
238 if (!stream_type || !filter_name) {
239 debug_error("invalid argument");
240 return MM_ERROR_INVALID_ARGUMENT;
242 if (!filter_parameters)
243 filter_parameters = "";
245 filter_group = "default";
247 debug_msg("stream_type(%s), filter_name(%s), filter_parameters(%s), filter_group(%s)", stream_type, filter_name, filter_parameters, filter_group);
249 return mm_sound_client_set_filter_by_type(stream_type, filter_name, filter_parameters, filter_group);
253 int mm_sound_unset_filter(const char *stream_type)
255 /* Check input param */
257 debug_error("invalid argument");
258 return MM_ERROR_INVALID_ARGUMENT;
261 debug_msg("stream_type(%s)", stream_type);
263 return mm_sound_client_unset_filter_by_type(stream_type);
267 int mm_sound_control_filter(const char *stream_type, const char *filter_name, const char *filter_controls)
269 /* Check input param */
270 if (!stream_type || !filter_name || !filter_controls) {
271 debug_error("invalid argument");
272 return MM_ERROR_INVALID_ARGUMENT;
275 debug_msg("stream_type(%s), filter_name(%s), filter_controls(%s)", stream_type, filter_name, filter_controls);
277 return mm_sound_client_control_filter_by_type(stream_type, filter_name, filter_controls);
280 ///////////////////////////////////
281 //// MMSOUND PLAY APIs
282 ///////////////////////////////////
283 static inline void _mm_sound_fill_play_param(MMSoundPlayParam *param, const char *filename, int volume_config, mm_sound_stop_callback_func callback, void *data)
285 param->filename = filename;
286 param->volume = 0; //volume value dose not effect anymore
287 param->callback = callback;
290 param->volume_config = volume_config;
294 int mm_sound_play_loud_solo_sound(const char *filename, int volume_config, mm_sound_stop_callback_func callback, void *data, int *handle)
296 MMSoundPlayParam param = { 0, };
298 /* FIXME : this function will be deleted */
299 _mm_sound_fill_play_param(¶m, filename, volume_config, callback, data);
300 return mm_sound_play_sound_ex(¶m, handle);
304 int mm_sound_play_sound(const char *filename, int volume_config, mm_sound_stop_callback_func callback, void *data, int *handle)
306 MMSoundPlayParam param = { 0, };
308 _mm_sound_fill_play_param(¶m, filename, volume_config, callback, data);
309 return mm_sound_play_sound_ex(¶m, handle);
313 int mm_sound_play_sound_ex(MMSoundPlayParam *param, int *handle)
318 /* Check input param */
320 debug_error("param is null\n");
321 return MM_ERROR_INVALID_ARGUMENT;
324 volume_type = MM_SOUND_VOLUME_CONFIG_TYPE(param->volume_config);
326 if (param->filename == NULL) {
327 debug_error("filename is NULL\n");
328 return MM_ERROR_SOUND_FILE_NOT_FOUND;
330 if (volume_type < 0 || volume_type >= VOLUME_TYPE_MAX) {
331 debug_error("Volume type is invalid %d\n", volume_type);
332 return MM_ERROR_INVALID_ARGUMENT;
336 err = mm_sound_client_play_sound(param, 0, &lhandle);
338 debug_error("Failed to play sound\n");
342 /* Set handle to return */
346 debug_critical("The sound hadle cannot be get [%d]\n", lhandle);
349 debug_warning ("success : handle=[%p]\n", handle);
351 return MM_ERROR_NONE;
355 int mm_sound_play_sound_with_stream_info(const char *filename, char *stream_type, int stream_id, unsigned int loop, mm_sound_stop_callback_func callback, void *data, int *handle)
357 MMSoundPlayParam param = { 0, };
360 param.filename = filename;
361 param.volume = 0; //volume value dose not effect anymore
362 param.callback = callback;
370 err = mm_sound_client_play_sound_with_stream_info(¶m, handle, stream_type, stream_id);
372 debug_error("Failed to play sound\n");
376 debug_warning ("success : handle=[%p]\n", handle);
378 return MM_ERROR_NONE;
384 int mm_sound_stop_sound(int handle)
388 debug_warning ("enter : handle=[%d]\n", handle);
390 err = mm_sound_client_stop_sound(handle);
392 debug_error("Fail to stop sound\n");
395 debug_warning ("success : handle=[%d]\n", handle);
397 return MM_ERROR_NONE;
400 ///////////////////////////////////
401 //// MMSOUND TONE APIs
402 ///////////////////////////////////
404 int mm_sound_play_tone_ex (MMSoundTone_t num, int volume_config, const double volume, const int duration, int *handle, bool enable_session)
407 int err = MM_ERROR_NONE;
408 int volume_type = MM_SOUND_VOLUME_CONFIG_TYPE(volume_config);
412 /* Check input param */
414 debug_error("number is invalid %d\n", duration);
415 return MM_ERROR_INVALID_ARGUMENT;
417 if (num < MM_SOUND_TONE_DTMF_0 || num >= MM_SOUND_TONE_NUM) {
418 debug_error("TONE Value is invalid %d\n", num);
419 return MM_ERROR_INVALID_ARGUMENT;
421 if (volume_type < 0 || volume_type >= VOLUME_TYPE_MAX) {
422 debug_error("Volume type is invalid %d\n", volume_type);
423 return MM_ERROR_INVALID_ARGUMENT;
425 if (volume < 0.0 || volume > 1.0) {
426 debug_error("Volume Value is invalid %d\n", volume);
427 return MM_ERROR_INVALID_ARGUMENT;
431 debug_msg("Call MMSoundClientPlayTone\n");
432 err = mm_sound_client_play_tone(num, volume_config, volume, duration, &lhandle, enable_session);
434 debug_error("Failed to play sound\n");
438 /* Set handle to return */
442 debug_critical("The sound handle cannot be get [%d]\n", lhandle);
445 return MM_ERROR_NONE;
449 int mm_sound_play_tone_with_stream_info(MMSoundTone_t tone, char *stream_type, int stream_id, const double volume, const int duration, int *handle)
452 int err = MM_ERROR_NONE;
454 err = mm_sound_client_play_tone_with_stream_info(tone, stream_type, stream_id, volume, duration, handle);
456 debug_error("Failed to play sound\n");
466 int mm_sound_play_tone (MMSoundTone_t num, int volume_config, const double volume, const int duration, int *handle)
468 return mm_sound_play_tone_ex (num, volume_config, volume, duration, handle, true);
471 ///////////////////////////////////
472 //// MMSOUND ROUTING APIs
473 ///////////////////////////////////
476 int mm_sound_test(int a, int b, int* getv)
478 int ret = MM_ERROR_NONE;
480 debug_log("mm_sound_test enter");
482 debug_error("argu null");
483 return MM_ERROR_INVALID_ARGUMENT;
485 ret = mm_sound_client_test(a, b, getv);
487 debug_error("Can not mm sound test, ret = %x\n", ret);
489 debug_log("mm_sound_test leave");
495 int mm_sound_add_test_callback(mm_sound_test_cb func, void *user_data, unsigned int *subs_id)
497 int ret = MM_ERROR_NONE;
499 debug_log("mm_sound_add_test_callback enter");
500 if (!func || !subs_id) {
501 debug_error("argument is not valid\n");
502 return MM_ERROR_INVALID_ARGUMENT;
505 ret = mm_sound_client_add_test_callback(func, user_data, subs_id);
507 debug_error("Can not add test callback, ret = %x\n", ret);
509 debug_log("mm_sound_add_test_callback leave");
515 int mm_sound_remove_test_callback(unsigned int subs_id)
517 int ret = MM_ERROR_NONE;
519 debug_log("mm_sound_remove_test_callback enter");
520 ret = mm_sound_client_remove_test_callback(subs_id);
522 debug_error("Can not remove test callback, ret = %x\n", ret);
524 debug_log("mm_sound_remove_test_callback leave");
529 static int _convert_signal_name_str_to_enum (const char *name_str, mm_sound_signal_name_t *name_enum) {
530 int ret = MM_ERROR_NONE;
532 if (!name_str || !name_enum)
533 return MM_ERROR_INVALID_ARGUMENT;
535 if (!strncmp(name_str, "ReleaseInternalFocus", strlen("ReleaseInternalFocus"))) {
536 *name_enum = MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS;
538 ret = MM_ERROR_INVALID_ARGUMENT;
539 LOGE("not supported signal name(%s), err(0x%08x)", name_str, ret);
544 static void _dbus_signal_callback (const char *signal_name, int value, void *user_data)
546 int ret = MM_ERROR_NONE;
547 mm_sound_signal_name_t signal;
548 subscribe_cb_t *subscribe_cb = (subscribe_cb_t*)user_data;
555 ret = _convert_signal_name_str_to_enum(signal_name, &signal);
559 debug_msg("signal: name[%s], value[%d], user_data[%p], type[%d]\n",
560 signal_name, value, user_data, subscribe_cb->signal_type);
562 if (subscribe_cb->signal_type == MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS) {
563 /* Trigger the signal callback when it comes from the same process.
564 * In this case, the second integer argument is consist of
565 * |<-- pid (16bits) -->|<-- value (16bits) -->|,
566 * FYI, #define PID_MAX_DEFAULT (CONFIG_BASE_SMALL ? 0x1000 : 0x8000).
567 * In case of daemon usage, it uses the client_pid of subscribe_cb. */
568 debug_msg ("client_pid[%d], getpid[%d], value>>16[%d], callback[%p]\n",
569 subscribe_cb->client_pid, getpid(), (value >> 16), subscribe_cb);
570 if ((subscribe_cb->client_pid ? subscribe_cb->client_pid : getpid()) == (value >> 16))
571 subscribe_cb->callback(signal, (value & 0x0000FFFF), subscribe_cb->user_data);
573 debug_warning("not supported type[%d]\n", subscribe_cb->signal_type);
581 static void signal_callback(GDBusConnection *conn,
582 const gchar *sender_name,
583 const gchar *object_path,
584 const gchar *interface_name,
585 const gchar *signal_name,
586 GVariant *parameters,
590 const GVariantType* value_type;
592 debug_msg ("sender : %s, object : %s, interface : %s, signal : %s",
593 sender_name, object_path, interface_name, signal_name);
594 if (g_variant_is_of_type(parameters, G_VARIANT_TYPE("(i)"))) {
595 g_variant_get(parameters, "(i)",&value);
596 debug_msg(" - value : %d\n", value);
597 _dbus_signal_callback(signal_name, value, user_data);
599 value_type = g_variant_get_type(parameters);
600 debug_warning("signal type is %s", value_type);
605 int mm_sound_subscribe_signal(mm_sound_signal_name_t signal_type, unsigned int *subscribe_id,
606 mm_sound_signal_callback callback, void *user_data)
608 int ret = MM_ERROR_NONE;
611 subscribe_cb_t *subscribe_cb = NULL;
615 MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(&g_subscribe_cb_list_mutex, MM_ERROR_SOUND_INTERNAL);
617 if (signal_type < 0 || signal_type >= MM_SOUND_SIGNAL_MAX || !subscribe_id) {
618 debug_error ("invalid argument, signal(%d), subscribe_id(%p)", signal_type, subscribe_id);
619 ret = MM_ERROR_INVALID_ARGUMENT;
623 subscribe_cb = malloc(sizeof(subscribe_cb_t));
625 ret = MM_ERROR_SOUND_INTERNAL;
628 memset(subscribe_cb, 0, sizeof(subscribe_cb_t));
629 subscribe_cb->signal_type = signal_type;
630 subscribe_cb->callback = callback;
631 subscribe_cb->user_data = user_data;
633 g_dbus_conn_mmsound = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
634 if (!g_dbus_conn_mmsound && err) {
635 debug_error ("g_bus_get_sync() error (%s) ", err->message);
637 ret = MM_ERROR_SOUND_INTERNAL;
640 subs_id = g_dbus_connection_signal_subscribe(g_dbus_conn_mmsound, NULL, MM_SOUND_DBUS_INTERFACE,
641 dbus_signal_name_str[signal_type], MM_SOUND_DBUS_OBJECT_PATH,
642 NULL, G_DBUS_SIGNAL_FLAGS_NONE, signal_callback,
645 debug_error ("g_dbus_connection_signal_subscribe() error (%d)", subs_id);
646 ret = MM_ERROR_SOUND_INTERNAL;
647 g_object_unref(g_dbus_conn_mmsound);
650 subscribe_cb->id = subs_id;
651 *subscribe_id = subs_id;
653 MMSOUND_LEAVE_CRITICAL_SECTION(&g_subscribe_cb_list_mutex);
663 MMSOUND_LEAVE_CRITICAL_SECTION(&g_subscribe_cb_list_mutex);
668 /* ToDo : Almost same as mm_sound_subscribe_signal, need to be merged */
670 int mm_sound_subscribe_signal_for_daemon(mm_sound_signal_name_t signal_type, int client_pid, unsigned int *subscribe_id,
671 mm_sound_signal_callback callback, void *user_data)
673 int ret = MM_ERROR_NONE;
676 subscribe_cb_t *subscribe_cb = NULL;
680 MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(&g_subscribe_cb_list_mutex, MM_ERROR_SOUND_INTERNAL);
682 if (signal_type < 0 || signal_type >= MM_SOUND_SIGNAL_MAX || !client_pid || !subscribe_id) {
683 debug_error ("invalid argument, signal(%d), client_pid(%d), subscribe_id(%p)", signal_type, client_pid, subscribe_id);
684 ret = MM_ERROR_INVALID_ARGUMENT;
688 subscribe_cb = malloc(sizeof(subscribe_cb_t));
690 ret = MM_ERROR_SOUND_INTERNAL;
693 memset(subscribe_cb, 0, sizeof(subscribe_cb_t));
694 subscribe_cb->signal_type = signal_type;
695 subscribe_cb->callback = callback;
696 subscribe_cb->user_data = user_data;
697 subscribe_cb->client_pid = client_pid;
699 g_dbus_conn_mmsound = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
700 if (!g_dbus_conn_mmsound && err) {
701 debug_error ("g_bus_get_sync() error (%s) ", err->message);
703 ret = MM_ERROR_SOUND_INTERNAL;
706 subs_id = g_dbus_connection_signal_subscribe(g_dbus_conn_mmsound, NULL, MM_SOUND_DBUS_INTERFACE,
707 dbus_signal_name_str[signal_type], MM_SOUND_DBUS_OBJECT_PATH,
708 NULL, G_DBUS_SIGNAL_FLAGS_NONE, signal_callback,
711 debug_error ("g_dbus_connection_signal_subscribe() error (%d)", subs_id);
712 ret = MM_ERROR_SOUND_INTERNAL;
713 g_object_unref(g_dbus_conn_mmsound);
716 subscribe_cb->id = subs_id;
717 *subscribe_id = subs_id;
719 MMSOUND_LEAVE_CRITICAL_SECTION(&g_subscribe_cb_list_mutex);
729 MMSOUND_LEAVE_CRITICAL_SECTION(&g_subscribe_cb_list_mutex);
735 void mm_sound_unsubscribe_signal(unsigned int subscribe_id)
739 MMSOUND_ENTER_CRITICAL_SECTION(&g_subscribe_cb_list_mutex);
741 if (g_dbus_conn_mmsound && subscribe_id) {
742 g_dbus_connection_signal_unsubscribe(g_dbus_conn_mmsound, subscribe_id);
743 g_object_unref(g_dbus_conn_mmsound);
746 MMSOUND_LEAVE_CRITICAL_SECTION(&g_subscribe_cb_list_mutex);
752 int mm_sound_send_signal(mm_sound_signal_name_t signal_type, int value)
754 int ret = MM_ERROR_NONE;
756 GDBusConnection *conn = NULL;
757 gboolean dbus_ret = TRUE;
761 MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(&g_subscribe_cb_list_mutex, MM_ERROR_SOUND_INTERNAL);
763 if (signal_type < 0 || signal_type >= MM_SOUND_SIGNAL_MAX) {
764 debug_error ("invalid argument, signal(%d)", signal_type);
765 ret = MM_ERROR_INVALID_ARGUMENT;
769 conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
771 debug_error ("g_bus_get_sync() error (%s)", err->message);
772 ret = MM_ERROR_SOUND_INTERNAL;
776 g_dbus_signal_values[signal_type] = value;
777 if (signal_type == MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS) {
778 /* Trigger the signal callback when it comes from the same process.
779 * |<-- pid (16bits) -->|<-- value (16bits) -->|,
780 * FYI, #define PID_MAX_DEFAULT (CONFIG_BASE_SMALL ? 0x1000 : 0x8000). */
781 value |= ((int)getpid() << 16);
782 if ((_mm_session_util_write_information((int)getpid(), MM_SESSION_TYPE_REPLACED_BY_STREAM, 0)))
783 debug_error ("failed to _mm_session_util_write_information for MM_SESSION_TYPE_REPLACED_BY_STREAM");
785 dbus_ret = g_dbus_connection_emit_signal (conn,
786 NULL, MM_SOUND_DBUS_OBJECT_PATH, MM_SOUND_DBUS_INTERFACE, dbus_signal_name_str[signal_type],
787 g_variant_new ("(i)", value),
789 if (!dbus_ret && err) {
790 debug_error ("g_dbus_connection_emit_signal() error (%s)", err->message);
791 ret = MM_ERROR_SOUND_INTERNAL;
795 dbus_ret = g_dbus_connection_flush_sync(conn, NULL, &err);
796 if (!dbus_ret && err) {
797 debug_error ("g_dbus_connection_flush_sync() error (%s)", err->message);
798 ret = MM_ERROR_SOUND_INTERNAL;
802 g_object_unref(conn);
803 debug_msg ("sending signal[%s], value[%d] success", dbus_signal_name_str[signal_type], value);
805 MMSOUND_LEAVE_CRITICAL_SECTION(&g_subscribe_cb_list_mutex);
815 g_object_unref(conn);
817 MMSOUND_LEAVE_CRITICAL_SECTION(&g_subscribe_cb_list_mutex);
823 int mm_sound_get_signal_value(mm_sound_signal_name_t signal_type, int *value)
825 int ret = MM_ERROR_NONE;
829 MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(&g_subscribe_cb_list_mutex, MM_ERROR_SOUND_INTERNAL);
831 *value = g_dbus_signal_values[signal_type];
833 MMSOUND_LEAVE_CRITICAL_SECTION(&g_subscribe_cb_list_mutex);
840 __attribute__ ((constructor))
841 static void _mm_sound_initialize(void)
843 mm_sound_client_initialize();
847 __attribute__ ((destructor))
848 static void _mm_sound_finalize(void)
850 mm_sound_client_finalize();