} mm_sound_signal_name_t;
typedef void (* mm_sound_signal_callback) (mm_sound_signal_name_t signal, int value, void *user_data);
-int mm_sound_subscribe_signal(mm_sound_signal_name_t signal, unsigned int *subscribe_id, mm_sound_signal_callback callback, void *user_data);
+int mm_sound_subscribe_signal(mm_sound_signal_name_t signal, unsigned int* subscribe_id, mm_sound_signal_callback callback, void *user_data);
void mm_sound_unsubscribe_signal(unsigned int subscribe_id);
int mm_sound_send_signal(mm_sound_signal_name_t signal, int value);
int mm_sound_get_signal_value(mm_sound_signal_name_t signal, int *value);
#endif
int mm_sound_client_dbus_play_tone(int tone, int repeat, int volume, int volume_config,
- int session_type, int session_options, int client_pid,
- bool enable_session, int *codechandle, char *stream_type, int stream_index);
+ int session_type, int session_options, int client_pid,
+ bool enable_session, int *codechandle, char *stream_type, int stream_index);
int mm_sound_client_dbus_play_tone_with_stream_info(int client_pid, int tone, char *stream_type, int stream_id, int volume, int repeat, int *codechandle);
-int mm_sound_client_dbus_play_sound(char* filename, int tone, int repeat, int volume, int volume_config,
- int priority, int session_type, int session_options, int client_pid, int handle_route,
- bool enable_session, int *codechandle, char *stream_type, int stream_index);
+int mm_sound_client_dbus_play_sound(const char* filename, int tone, int repeat, int volume, int volume_config,
+ int priority, int session_type, int session_options, int client_pid, int handle_route,
+ bool enable_session, int *codechandle, char *stream_type, int stream_index);
+int mm_sound_client_dbus_play_sound_with_stream_info(const char* filename, int repeat, int volume,
+ int priority, int client_pid, int handle_route, int *codechandle, char *stream_type, int stream_index);
int mm_sound_client_dbus_stop_sound(int handle);
int mm_sound_client_dbus_clear_focus(int pid); // Not original focus feature, only for cleaning up tone/wav player internal focus usage.
int mm_sound_client_dbus_is_route_available(mm_sound_route route, bool *is_available);
#ifdef __cplusplus
extern "C" {
-#endif
+#endif
#define MAX_DEVICE_NAME_NUM 256
#define MAX_DEVICE_TYPE_STR_LEN 30
typedef struct {
unsigned int id;
} subscribe_cb_t;
-static char* _get_volume_str (volume_type_t type)
+static const char* _get_volume_str (volume_type_t type)
{
static const char *volume_type_str[VOLUME_TYPE_MAX] =
{ "SYSTEM", "NOTIFICATION", "ALARM", "RINGTONE", "MEDIA", "CALL", "VOIP", "VOICE", "FIXED"};
EXPORT_API
int mm_sound_volume_primary_type_set(volume_type_t type)
{
- pid_t mypid;
int ret = MM_ERROR_NONE;
/* Check input param */
EXPORT_API
int mm_sound_volume_primary_type_clear(void)
{
- pid_t mypid;
int ret = MM_ERROR_NONE;
if (vconf_set_int(VCONFKEY_SOUND_PRIMARY_VOLUME_TYPE, -1)) {
return ret;
}
-static void signal_callback(GDBusConnection *conn,
- const gchar *sender_name,
- const gchar *object_path,
- const gchar *interface_name,
- const gchar *signal_name,
- GVariant *parameters,
- gpointer user_data)
-{
- int value=0;
- const GVariantType* value_type;
-
- debug_msg ("sender : %s, object : %s, interface : %s, signal : %s",
- sender_name, object_path, interface_name, signal_name);
- if(g_variant_is_of_type(parameters, G_VARIANT_TYPE("(i)"))) {
- g_variant_get(parameters, "(i)",&value);
- debug_msg(" - value : %d\n", value);
- _dbus_signal_callback (signal_name, value, user_data);
- } else {
- value_type = g_variant_get_type(parameters);
- debug_warning("signal type is %s", value_type);
- }
-}
-
-int _convert_signal_name_str_to_enum (const char *name_str, mm_sound_signal_name_t *name_enum) {
+static int _convert_signal_name_str_to_enum (const char *name_str, mm_sound_signal_name_t *name_enum) {
int ret = MM_ERROR_NONE;
if (!name_str || !name_enum)
return ret;
}
-void _dbus_signal_callback (const char *signal_name, int value, void *user_data)
+static void _dbus_signal_callback (const char *signal_name, int value, void *user_data)
{
int ret = MM_ERROR_NONE;
mm_sound_signal_name_t signal;
return;
}
+static void signal_callback(GDBusConnection *conn,
+ const gchar *sender_name,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *signal_name,
+ GVariant *parameters,
+ gpointer user_data)
+{
+ int value=0;
+ const GVariantType* value_type;
+
+ debug_msg ("sender : %s, object : %s, interface : %s, signal : %s",
+ sender_name, object_path, interface_name, signal_name);
+ if (g_variant_is_of_type(parameters, G_VARIANT_TYPE("(i)"))) {
+ g_variant_get(parameters, "(i)",&value);
+ debug_msg(" - value : %d\n", value);
+ _dbus_signal_callback(signal_name, value, user_data);
+ } else {
+ value_type = g_variant_get_type(parameters);
+ debug_warning("signal type is %s", value_type);
+ }
+}
+
EXPORT_API
int mm_sound_subscribe_signal(mm_sound_signal_name_t signal, unsigned int *subscribe_id, mm_sound_signal_callback callback, void *user_data)
{
debug_fenter();
- MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(&g_subscribe_cb_list_mutex, MM_ERROR_SOUND_INTERNAL);
+ MMSOUND_ENTER_CRITICAL_SECTION(&g_subscribe_cb_list_mutex);
if (g_dbus_conn_mmsound && subscribe_id) {
g_dbus_connection_signal_unsubscribe(g_dbus_conn_mmsound, subscribe_id);
static pthread_mutex_t g_device_list_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t g_id_mutex = PTHREAD_MUTEX_INITIALIZER;
-int g_focus_signal_handle = 0;
+guint g_focus_signal_handle = 0;
int mm_sound_client_initialize(void)
{
debug_fenter();
- mm_sound_client_dbus_finalize();
+ ret = mm_sound_client_dbus_finalize();
debug_fleave();
- return MM_ERROR_NONE;
+ return ret;
}
int mm_sound_client_is_route_available(mm_sound_route route, bool *is_available)
goto failed;
}
if (param->callback) {
- ret = mm_sound_client_dbus_add_play_sound_end_callback(param->callback, param->data, *handle);
+ ret = mm_sound_client_dbus_add_play_sound_end_callback(*handle, param->callback, param->data);
if (ret != MM_ERROR_NONE) {
debug_error("Add callback for play sound(%d) Failed", *handle);
}
return ret;
}
- if((ret = mm_sound_client_dbus_get_current_connected_device_list(device_flags, &g_device_list_t))!=MM_ERROR_NONE){
+ if ((ret = mm_sound_client_dbus_get_current_connected_device_list(device_flags, &g_device_list_t.list)) != MM_ERROR_NONE) {
debug_error("[Client] failed to get current connected device list with dbus, ret[0x%x]", ret);
goto failed;
}
******************************************************************************************/
-static int _parse_error_msg(const char *full_err_msg, char **err_name, char **err_msg)
+static int _parse_error_msg(char *full_err_msg, char **err_name, char **err_msg)
{
char *save_p, *domain, *_err_name, *_err_msg;
return ret;
}
-int __convert_volume_type_to_int(char *volume_type_str, unsigned int *volume_type)
+static int __convert_volume_type_to_int(char *volume_type_str, volume_type_t *volume_type)
{
int ret = MM_ERROR_NONE;
GVariant *params,
gpointer user_data)
{
- struct user_callback* user_cb = NULL;
- GVariantIter *iter = NULL;
-
- user_cb = (struct user_callback*) user_data;
+ struct user_callback* user_cb = (struct user_callback*) user_data;
if (!user_cb || !user_cb->cb) {
debug_error("User callback data Null");
{
GDBusConnection *conn = NULL;
guint subs_id = 0;
- int instance = 0;
struct user_callback *user_cb = NULL;
if (!cb) {
{
GDBusConnection *conn = NULL;
guint subs_id = 0;
- int instance = 0;
struct user_callback *user_cb = NULL;
const char *object, *interface;
return MM_ERROR_INVALID_ARGUMENT;
}
- if ((conn = _dbus_get_connection(G_BUS_TYPE_SYSTEM))) {
- _dbus_unsubscribe_signal(conn, g_dbus_subs_ids[signaltype]);
- } else {
+ if (!(conn = _dbus_get_connection(G_BUS_TYPE_SYSTEM))) {
debug_error("Get Dbus Connection Error");
return MM_ERROR_SOUND_INTERNAL;
}
+
+ _dbus_unsubscribe_signal(conn, g_dbus_subs_ids[signaltype]);
+
+ return MM_ERROR_NONE;
}
static int _pulseaudio_dbus_set_property(pulseaudio_property_t property, GVariant* args, GVariant **result)
GVariant *params;
GVariantIter iter;
mm_sound_device_t* device_item;
- GList* g_device_list = NULL;
const gchar *device_name_tmp = NULL, *device_type_tmp = NULL;
debug_fenter();
debug_fenter();
- if (ret = __convert_volume_type_to_str(volume_type, &type_str) != MM_ERROR_NONE) {
+ if ((ret = __convert_volume_type_to_str(volume_type, &type_str)) != MM_ERROR_NONE) {
debug_error("volume type convert failed");
return ret;
}
}
-int mm_sound_client_dbus_play_sound(char* filename, int tone, int repeat, int volume, int volume_config,
+int mm_sound_client_dbus_play_sound(const char* filename, int tone, int repeat, int volume, int volume_config,
int priority, int session_type, int session_options, int client_pid, int handle_route,
bool enable_session, int *codechandle, char *stream_type, int stream_index)
{
return ret;
}
-int mm_sound_client_dbus_play_sound_with_stream_info(char* filename, int repeat, int volume,
- int priority, int client_pid, int handle_route, int *codechandle, char *stream_type, int stream_index)
+int mm_sound_client_dbus_play_sound_with_stream_info(const char* filename, int repeat, int volume,
+ int priority, int client_pid, int handle_route, int *codechandle, char *stream_type, int stream_index)
{
int ret = MM_ERROR_NONE;
int handle = 0;
debug_fenter();
params = g_variant_new("(siiiiisi)", filename, repeat, volume,
- priority, client_pid, handle_route, stream_type, stream_index);
+ priority, client_pid, handle_route, stream_type, stream_index);
if (params) {
if ((ret = _dbus_method_call_to(DBUS_TO_SOUND_SERVER, METHOD_CALL_PLAY_FILE_START_WITH_STREAM_INFO, params, &result)) != MM_ERROR_NONE) {
debug_error("dbus play file failed");
return -1;
}
-static bool _focus_callback_handler(gpointer d)
+static gboolean _focus_callback_handler(gpointer d)
{
GPollFD *data = (GPollFD*)d;
int count;
#ifdef CONFIG_ENABLE_RETCB
char *filename2;
+ int written;
if (is_for_watching) {
filename2 = g_strdup_printf("/tmp/FOCUS.%d.wchr", g_focus_sound_handle[index].focus_tid);
filename2, g_focus_sound_handle[index].focus_tid, tmpfd, filename2, errno, str_error);
} else {
debug_msg("write MM_ERROR_NONE(tid:%d) for waiting server", g_focus_sound_handle[index].focus_tid);
- write(tmpfd, &buf, sizeof(buf));
+ written = write(tmpfd, &buf, sizeof(buf));
close(tmpfd);
}
static bool _focus_remove_sound_callback(int index, gushort events)
{
bool ret = true;
- gboolean gret = TRUE;
debug_fenter();
g_focus_sound_handle[index].focus_lock = NULL;
}
- GSourceFunc *g_src_funcs = g_focus_sound_handle[index].g_src_funcs;
+ GSourceFuncs *g_src_funcs = g_focus_sound_handle[index].g_src_funcs;
GPollFD *g_poll_fd = g_focus_sound_handle[index].g_poll_fd; /* store file descriptor */
if (!g_poll_fd) {
debug_error("g_poll_fd is null..");
#include "include/mm_sound.h"
#include "include/mm_sound_device.h"
+#include "include/mm_sound_client.h"
#define VOLUME_TYPE_LEN 64
{
int ret = MM_ERROR_NONE;
mm_sound_device_list_t *device_list_t = NULL;
- mm_sound_device_t *device_h = NULL;
GList *node = NULL;
if (!device_list || !device) {
return MM_ERROR_INVALID_ARGUMENT;
{
int ret = MM_ERROR_NONE;
mm_sound_device_list_t *device_list_t = NULL;
- mm_sound_device_t *device_h = NULL;
GList *node = NULL;
if (!device_list || !device) {
return MM_ERROR_INVALID_ARGUMENT;
int fd = -1;
int size = 0;
ipc_t data = {{0,},{0,},{0,}};
- int capture_status = 0;
- char *role = NULL;
+ const char *role = NULL;
const char *vol_gain_type = NULL;
if (!filename)
#include <sys/msg.h>
#include <assert.h>
#include <errno.h>
+#include <stdio.h>
#include <mm_error.h>
#include <mm_debug.h>
int period; /* open api retrun value.*/
- int stream_idx;
+ unsigned int stream_idx;
int source_type;
} mm_sound_handle_t;
pa_channel_map maps;
pa_buffer_attr attr;
- int vol_conf_type, vol_conf_gain;
+ int vol_conf_type;
int prop_vol_type, prop_gain_type;
int err = MM_ERROR_SOUND_INTERNAL;
int samples_per_period = PA_SIMPLE_SAMPLES_PER_PERIOD_DEFAULT;
int periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_DEFAULT;
- const char *prop_policy = NULL;
-
unsigned long latency = 0;
int handle_mode = mode;
int handle_inout = HANDLE_DIRECTION_NONE;
pa_threaded_mainloop_unlock(mm_sound_handle_mgr.mainloop);
+ return MM_ERROR_NONE;
}
EXPORT_API
pa_operation_unref(o);
pa_threaded_mainloop_unlock(mm_sound_handle_mgr.mainloop);
+
+ return MM_ERROR_NONE;
}
EXPORT_API
pa_operation_unref(o);
pa_threaded_mainloop_unlock(mm_sound_handle_mgr.mainloop);
+
+ return MM_ERROR_NONE;
}
EXPORT_API
pa_threaded_mainloop_unlock(mm_sound_handle_mgr.mainloop);
+ return MM_ERROR_NONE;
}
EXPORT_API
int mm_sound_pcm_get_latency(MMSoundPcmHandle_t handle, int *latency)
{
mm_sound_pcm_t *pcmHandle = (mm_sound_pcm_t*)handle;
- int result = MM_ERROR_NONE;
int mlatency = 0;
/* Check input param */
if (latency == NULL)
return MM_ERROR_INVALID_ARGUMENT;
- if(MM_ERROR_NONE != mm_sound_pa_get_latency(pcmHandle->handle, &mlatency)) {
+ if (MM_ERROR_NONE != mm_sound_pa_get_latency(pcmHandle->handle, &mlatency)) {
debug_error("Get Latency Error");
+ /* FIXME : is this correct return value? */
return MM_ERROR_SOUND_DEVICE_NOT_OPENED;
}
int ret = 0;
static int written_byte = 0;
mm_sound_pcm_async_t *pcmHandle = (mm_sound_pcm_async_t*)handle;
- int vr_state = 0;
/* Check input param */
if(pcmHandle == NULL) {
}
temp_list = temp_list->next;
}
+
+ return NULL;
}
#endif /* SUPPORT_CONTAINER */
#ifdef SUPPORT_CONTAINER
container_info_t* container_info = __get_container_info(instance_id);
+ if (container_info == NULL) {
+ debug_error("error getting container info!!!");
+ return NULL;
+ }
if (instance_id == container_info->pid) {
debug_error ("This might be in the HOST(%s)[%d], let's form normal path",
case ASM_CASE_1PAUSE_2PLAY:
{
int ret = MM_ERROR_NONE;
- mm_sound_device_out device_out_wired_accessory = MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY;
- mm_sound_device_in device_in = MM_SOUND_DEVICE_IN_NONE;
bool available = false;
if (incoming_playing_event == ASM_EVENT_NOTIFY && (mm_sound_util_is_recording() || mm_sound_util_is_mute_policy()) ) {
{
int ret = MM_ERROR_NONE;
mm_sound_device_out device_out = MM_SOUND_DEVICE_OUT_NONE;
- mm_sound_device_in device_in = MM_SOUND_DEVICE_IN_NONE;
if (__is_media_session(current_playing_event) && __is_media_session(incoming_playing_event)) {
if ((!(g_handle_info[current_playing_handle].option_flags & ASM_SESSION_OPTION_UNINTERRUPTIBLE)) &&
int ret = MM_ERROR_NONE;
session_t cur_session;
+ /* FIXME */
// MMSoundMgrSessionGetSession(&cur_session);
debug_warning (" cur_session[%d] (0:MEDIA 1:VC 2:VT 3:VOIP 4:FM 5:NOTI 6:ALARM 7:EMER 8:VR)\n",cur_session);
if (is_for_recovery) {
#include "include/mm_sound_mgr_common.h"
#include "include/mm_sound_mgr_codec.h"
+#include "include/mm_sound_mgr_ipc.h"
#include "include/mm_sound_plugin_codec.h"
#include "include/mm_sound_thread_pool.h"
#include "include/mm_sound_pa_client.h"
static pthread_mutex_t g_slot_mutex;
static pthread_mutex_t codec_wave_mutex;
static int _MMSoundMgrCodecStopCallback(int param);
-static int _MMSoundMgrCodecFindKeytoneSlot(int *slotid);
static int _MMSoundMgrCodecGetEmptySlot(int *slotid);
-static int _MMSoundMgrCodecFindLocaleSlot(int *slotid);
static int _MMSoundMgrCodecRegisterInterface(MMSoundPluginType *plugin);
#define STATUS_IDLE 0
mmsound_codec_info_t info;
mmsound_codec_param_t codec_param;
int err = MM_ERROR_NONE;
- int errorcode = 0;
int need_focus_unregister = 0;
#ifdef DEBUG_DETAIL
mmsound_codec_info_t info;
mmsound_codec_param_t codec_param;
int err = MM_ERROR_NONE;
- int errorcode = 0;
#ifdef DEBUG_DETAIL
debug_enter("\n");
mmsound_codec_info_t info;
mmsound_codec_param_t codec_param;
int err = MM_ERROR_NONE;
- int errorcode = 0;
int need_focus_unregister = 0;
#ifdef DEBUG_DETAIL
return err;
}
-MMSoundMgrCodecPlayDtmfWithStreamInfo(int *slotid, const mmsound_mgr_codec_param_t *param)
+int MMSoundMgrCodecPlayDtmfWithStreamInfo(int *slotid, const mmsound_mgr_codec_param_t *param)
{
int count = 0;
int *codec_type;
mmsound_codec_info_t info;
mmsound_codec_param_t codec_param;
int err = MM_ERROR_NONE;
- int errorcode = 0;
#ifdef DEBUG_DETAIL
debug_enter("\n");
}
if(mm_sound_unregister_focus(g_slots[slotid].focus_handle) || err) {
debug_error("Focus clean up failed [0x%x]", err);
- pthread_mutex_unlock(&g_slot_mutex);
- return MM_ERROR_POLICY_INTERNAL;
+ err = MM_ERROR_POLICY_INTERNAL;
+ goto cleanup;
}
} else if (~(g_slots[slotid].session_options & MM_SESSION_OPTION_PAUSE_OTHERS)) {
err = mm_sound_unset_focus_watch_callback(g_slots[slotid].focus_wcb_id);
if (err) {
debug_error("mm_sound_unset_focus_watch_callback failed [0x%x]", err);
- pthread_mutex_unlock(&g_slot_mutex);
- return MM_ERROR_POLICY_INTERNAL;
+ err = MM_ERROR_POLICY_INTERNAL;
+ goto cleanup;
}
}
}
/*
* Unregister FOCUS here
*/
-
- int errorcode = 0;
debug_msg("[CODEC MGR] enable_session %d ",g_slots[param].enable_session);
if (g_slots[param].focus_handle || g_slots[param].focus_wcb_id) {
param.volume_config = volume_config;
param.priority = priority;
mm_session_type = session_type;
- param.param = client_pid;
+ param.param = (void*)client_pid;
param.source = source;
param.handle_route = handle_route;
param.enable_session = enable_session;
return MM_ERROR_NONE;
}
-_MMSoundMgrIpcPlayFileWithStreamInfo(char* filename, int repeat, int volume,
+int _MMSoundMgrIpcPlayFileWithStreamInfo(char* filename, int repeat, int volume,
int priority, int client_pid, int handle_route, int *codechandle, char *stream_type, int stream_index)
{
mmsound_mgr_codec_param_t param = {0,};
param.repeat_count = repeat;
param.volume = volume;
param.priority = priority;
- param.param = client_pid;
+ param.param = (void*)client_pid;
param.source = source;
param.handle_route = handle_route;
param.stream_index = stream_index;
param.volume = volume;
param.volume_config = volume_config;
param.priority = 0;
- param.param = client_pid;
+ param.param = (void*)client_pid;
param.session_options = session_options;
param.enable_session = enable_session;
param.stream_index = stream_index;
param.repeat_count = repeat;
param.volume = volume;
param.priority = 0;
- param.param = client_pid;
+ param.param = (void*)client_pid;
param.stream_index = stream_index;
strncpy(param.stream_type, stream_type, MM_SOUND_STREAM_TYPE_LEN);
int __mm_sound_mgr_ipc_set_sound_path_for_active_device(mm_sound_device_in _device_in, mm_sound_device_out _device_out)
{
int ret = MM_ERROR_NONE;
+#if 0 /* FIXME */
mm_sound_device_in device_in = MM_SOUND_DEVICE_IN_NONE;
mm_sound_device_out device_out = MM_SOUND_DEVICE_OUT_NONE;
device_in = _device_in;
device_out = _device_out;
-// ret = _mm_sound_mgr_device_set_sound_path_for_active_device(device_out, device_in);
+ ret = _mm_sound_mgr_device_set_sound_path_for_active_device(device_out, device_in);
+#endif
return ret;
}
debug_fenter();
+ /* FIXME */
// ret = MMSoundMgrPulseHandleIsBtA2DPOnReq(&is_bt_on, &bt_name);
send_reply:
static void handle_method_get_audio_path(GDBusMethodInvocation* invocation)
{
int ret = MM_ERROR_NONE;
- int device_in = 0, device_out = 0;
+ mm_sound_device_in device_in = 0;
+ mm_sound_device_out device_out = 0;
debug_fenter();
ret = __mm_sound_mgr_ipc_get_audio_path(&device_in, &device_out);
+ /* FIXME */
send_reply:
if (ret == MM_ERROR_NONE) {
_method_call_return_value(invocation, g_variant_new("(ii)", device_in, device_out));
static void handle_method_get_connected_device_list(GDBusMethodInvocation* invocation)
{
int ret = MM_ERROR_NONE;
- GVariant *params = NULL, *reply_v = NULL;
+ GVariant *params = NULL;
GVariantBuilder reply_builder;
int mask_flags = 0;
int devices_num = 0, device_idx = 0;
static void handle_method_asm_register_sound(GDBusMethodInvocation* invocation)
{
int ret = MM_ERROR_NONE;
- int pid = 0, handle = 0, sound_event = 0, request_id = 0, sound_state = 0, resource = 0;
+ int handle = 0, sound_event = 0, request_id = 0, sound_state = 0, resource = 0;
int pid_r = 0, alloc_handle_r = 0, cmd_handle_r = 0, request_id_r = 0, sound_command_r = 0, sound_state_r = 0;
GVariant *params = NULL;
#ifdef SUPPORT_CONTAINER
#ifdef USE_SECURITY
GVariant* cookie_data;
#endif /* USE_SECURITY */
+#else
+ int pid = 0;
#endif /* SUPPORT_CONTAINER */
debug_fenter();
static void handle_method_asm_register_watcher(GDBusMethodInvocation* invocation)
{
int ret = MM_ERROR_NONE;
- int pid = 0, handle = 0, sound_event = 0, request_id = 0, sound_state = 0, resource = 0;
+ int handle = 0, sound_event = 0, request_id = 0, sound_state = 0, resource = 0;
int pid_r = 0, alloc_handle_r = 0, cmd_handle_r = 0, request_id_r = 0, sound_command_r = 0, sound_state_r = 0;
GVariant *params = NULL;
#ifdef SUPPORT_CONTAINER
#ifdef USE_SECURITY
GVariant* cookie_data;
#endif /* USE_SECURITY */
+#else
+ int pid = 0;
#endif /* SUPPORT_CONTAINER */
debug_fenter();
{
int ret = MM_ERROR_NONE;
int pid = 0, handle = 0, sound_event = 0, request_id = 0, sound_state = 0, resource = 0;
- int pid_r = 0, alloc_handle_r = 0, cmd_handle_r = 0, request_id_r = 0, sound_command_r = 0, sound_state_r = 0;
+ int pid_r = 0, alloc_handle_r = 0, cmd_handle_r = 0, request_id_r = 0, sound_state_r = 0;
GVariant *params = NULL;
debug_fenter();
{
int ret = MM_ERROR_NONE;
int pid = 0, handle = 0, sound_event = 0, request_id = 0, sound_state = 0, resource = 0;
- int pid_r = 0, alloc_handle_r = 0, cmd_handle_r = 0, request_id_r = 0, sound_command_r = 0, sound_state_r = 0;
+ int pid_r = 0, alloc_handle_r = 0, cmd_handle_r = 0, request_id_r = 0, sound_state_r = 0;
GVariant *params = NULL;
debug_fenter();
int fd = -1;
ipc_t data = {{0,},{0,},{0,}};
int ret = MM_ERROR_NONE;
- char *role = NULL;
- char *vol_gain_type = NULL;
+ const char *role = NULL;
+ const char *vol_gain_type = NULL;
debug_msg("filepath=[%s], volume_config=[0x%x]\n", filename, volume_config);
int fd = -1;
ipc_type data;
int size = 0;
- mmsound_codec_info_t info = {0,};
- MMSourceType source = {0,};
-
- buf_param_t buf_param = {NULL, NULL};
debug_enter("\n");
}
/* While loop is always on */
stop_flag = MMSOUND_TRUE;
- source.ptr = NULL;
debug_msg("Start IPC with pipe\n");
size = sizeof(ipc_type);
unsigned char* ogg_buf;
unsigned int ogg_remain;
int err;
- mm_sound_device_in device_in_after = MM_SOUND_DEVICE_IN_NONE;
- mm_sound_device_out device_out_after = MM_SOUND_DEVICE_OUT_NONE;
debug_enter("\n");
static void _running_tone(void *param)
{
- int result = MM_ERROR_NONE;
char *ptoneBuf = NULL;
char filename[100];
char *org_cur = NULL;
int org_size = 0;
char *dummy = NULL;
- int ret;
- unsigned int volume_value = 0;
int size;
pa_sample_spec ss;
- mm_sound_handle_route_info route_info;
+ mm_sound_handle_route_info route_info;
mm_sound_device_in device_in_before = MM_SOUND_DEVICE_IN_NONE;
- mm_sound_device_in device_in_after = MM_SOUND_DEVICE_IN_NONE;
mm_sound_device_out device_out_before = MM_SOUND_DEVICE_OUT_NONE;
- mm_sound_device_out device_out_after = MM_SOUND_DEVICE_OUT_NONE;
if (p == NULL) {
debug_error("[CODEC WAV] param is null\n");
void mm_sound_test_cb1(int a, void *user_data)
{
debug_log("dbus test user callback called: param(%d), userdata(%d)\n", a, (int)user_data);
- g_print("my callback pid : %u tid : %u\n", getpid(), pthread_self());
+ g_print("my callback pid : %u tid : %ld\n", getpid(), pthread_self());
}
void device_connected_cb (MMSoundDevice_t device_h, bool is_connected, void *user_data)
{
int ret = 0;
- int device_type = 0;
- int io_direction = 0;
- int state = 0;
+ mm_sound_device_type_e device_type = 0;
+ mm_sound_device_io_direction_e io_direction = 0;
+ mm_sound_device_state_e state = 0;
int id = 0;
char *name = NULL;
- debug_log("*** device_connected_cb is called, device_h[0x%x], is_connected[%d], user_date[0x%x]\n", device_h, is_connected, user_data);
+ debug_log("*** device_connected_cb is called, device_h[%p], is_connected[%d], user_date[%p]\n", device_h, is_connected, user_data);
ret = mm_sound_get_device_type(device_h, &device_type);
if (ret) {
debug_error("failed to mm_sound_get_device_type()\n");
void device_info_changed_cb (MMSoundDevice_t device_h, int changed_info_type, void *user_data)
{
int ret = 0;
- int device_type = 0;
- int io_direction = 0;
- int state = 0;
+ mm_sound_device_type_e device_type = 0;
+ mm_sound_device_io_direction_e io_direction = 0;
+ mm_sound_device_state_e state = 0;
int id = 0;
char *name = NULL;
- debug_log("*** device_info_changed_cb is called, device_h[0x%x], changed_info_type[%d], user_date[0x%x]\n", device_h, changed_info_type, user_data);
+ debug_log("*** device_info_changed_cb is called, device_h[%p], changed_info_type[%d], user_date[%p]\n", device_h, changed_info_type, user_data);
ret = mm_sound_get_device_type(device_h, &device_type);
if (ret) {
debug_error("failed to mm_sound_get_device_type()\n");
else
_state = "ACQUIRED";
debug_log("*** focus_cb0 is called, index[%d], focus_type[%d], state[%s], reason_for_change[%s], additional_info[%s], user_data[%s]\n",
- index, type, _state, reason_for_change, additional_info, user_data);
+ index, type, _state, reason_for_change, additional_info, (char*)user_data);
}
void focus_cb1 (int index, mm_sound_focus_type_e type, mm_sound_focus_state_e state, const char *reason_for_change, const char *additional_info, void *user_data)
{
else
_state = "ACQUIRED";
debug_log("*** focus_cb1 is called, index[%d], focus_type[%d], state[%s], reason_for_change[%s], additional_info[%s], user_data[%s]\n",
- index, type, _state, reason_for_change, additional_info, user_data);
+ index, type, _state, reason_for_change, additional_info, (char*)user_data);
}
void focus_watch_cb (int index, mm_sound_focus_type_e type, mm_sound_focus_state_e state, const char *reason_for_change, const char *additional_info, void *user_data)
{
else
_state = "ACQUIRED";
debug_log("*** focus_watch_cb is called, index[%d], focus_type[%d], state[%s], reason_for_change[%s], additional_info[%s], user_data[%s]\n",
- index, type, _state, reason_for_change, additional_info, user_data);
+ index, type, _state, reason_for_change, additional_info, (char*)user_data);
}
#endif
void quit_program()
gboolean input (GIOChannel *channel)
{
- char buf[MAX_STRING_LEN + 3];
- gsize read;
-
- g_io_channel_read(channel, buf, MAX_STRING_LEN, &read);
- buf[read] = '\0';
- g_strstrip(buf);
- interpret (buf);
- return TRUE;
+ GError *err = NULL;
+ gsize read;
+ char buf[MAX_STRING_LEN + 3];
+
+ g_io_channel_read_chars(channel, buf, MAX_STRING_LEN, &read, &err);
+ buf[read] = '\0';
+ g_strstrip(buf);
+
+ interpret (buf);
+
+ return TRUE;
}
static void __mm_sound_signal_cb1 (mm_sound_signal_name_t signal, int value, void *user_data)
{
int _value = 0;
- g_print ("[%s] signal[%d], value[%d], user_data[0x%x]]\n", __func__, signal, value, user_data);
+ g_print ("[%s] signal[%d], value[%d], user_data[%p]]\n", __func__, signal, value, user_data);
mm_sound_get_signal_value (signal, &_value);
g_print (" -- get value : %d\n", _value);
}
static void __mm_sound_signal_cb2 (mm_sound_signal_name_t signal, int value, void *user_data)
{
int _value = 0;
- g_print ("[%s] signal[%d], value[%d], user_data[0x%x]]\n", __func__, signal, value, user_data);
+ g_print ("[%s] signal[%d], value[%d], user_data[%p]]\n", __func__, signal, value, user_data);
mm_sound_get_signal_value (signal, &_value);
g_print (" -- get value : %d\n", _value);
}
if(ret < 0)
debug_log("mm_sound_subscribe_signal() failed with 0x%x\n", ret);
else
- debug_log("id: %u, callback:0x%x\n", g_subscribe_id1, __mm_sound_signal_cb1);
+ debug_log("id: %u, callback:%p\n", g_subscribe_id1, __mm_sound_signal_cb1);
ret = mm_sound_subscribe_signal(MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS, &g_subscribe_id2, __mm_sound_signal_cb2, NULL);
if(ret < 0)
debug_log("mm_sound_subscribe_signal() failed with 0x%x\n", ret);
else
- debug_log("id: %u, callback:0x%x\n", g_subscribe_id2, __mm_sound_signal_cb2);
+ debug_log("id: %u, callback:%p\n", g_subscribe_id2, __mm_sound_signal_cb2);
}
else if(strncmp(cmd, "DU", 2) ==0) {
if(ret < 0)
debug_log("mm_sound_send_signal() failed with 0x%x\n", ret);
else
- debug_log("mm_sound_send_signal for signal[%s], value[%d] is success\n", MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS, 1);
+ debug_log("mm_sound_send_signal for signal[%d], value[%d] is success\n", MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS, 1);
mm_sound_get_signal_value (MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS, &value);
g_print (" -- get value of RELEASE_INTERNAL_FOCUS : %d\n", value);
ret = mm_sound_send_signal(MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS, 0);
if(ret < 0)
debug_log("mm_sound_send_signal() failed with 0x%x\n", ret);
else
- debug_log("mm_sound_send_signal for signal[%s], value[%d] is success\n", MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS, 0);
+ debug_log("mm_sound_send_signal for signal[%d], value[%d] is success\n", MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS, 0);
mm_sound_get_signal_value (MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS, &value);
g_print (" -- get value of RELEASE_INTERNAL_FOCUS : %d\n", value);
}
else if(flag_2 == '0') { stream_type = "voice_recognition"; }
else { stream_type = "media"; }
- ret = mm_sound_register_focus(id, stream_type, (id == 0)? focus_cb0 : focus_cb1, user_data);
+ ret = mm_sound_register_focus(id, stream_type, (id == 0)? focus_cb0 : focus_cb1, (void*)user_data);
if (ret) {
g_print("failed to mm_sound_register_focus(), ret[0x%x]\n", ret);
} else {
- g_print("id[%d], stream_type[%s], callback fun[0x%x]\n", id, stream_type, (id == 0)? focus_cb0 : focus_cb1);
+ g_print("id[%d], stream_type[%s], callback fun[%p]\n", id, stream_type, (id == 0)? focus_cb0 : focus_cb1);
}
}
char input_string[128];
char flag_1;
int type = 0;
- char *stream_type = NULL;
const char *user_data = "this is user data for watch";
fflush(stdin);
else if(flag_1 == '2') { type = 2; }
else if(flag_1 == '3') { type = 3; }
else { type = 1; }
- ret = mm_sound_set_focus_watch_callback(type, focus_watch_cb, user_data, &g_focus_watch_index);
+ ret = mm_sound_set_focus_watch_callback(type, focus_watch_cb, (void*)user_data, &g_focus_watch_index);
if (ret) {
g_print("failed to mm_sound_set_focus_watch_callback(), ret[0x%x]\n", ret);
} else {
- g_print("index[%d], type[%d], callback fun[0x%x]\n", g_focus_watch_index, type, focus_watch_cb);
+ g_print("index[%d], type[%d], callback fun[%p]\n", g_focus_watch_index, type, focus_watch_cb);
}
}
int ret = 0;
int user_data = 3;
g_print("dbus method test add callback\n");
- g_print("my testsuite pid : %u tid : %u\n", getpid(), pthread_self());
+ g_print("my testsuite pid : %u tid : %ld\n", getpid(), pthread_self());
ret = mm_sound_add_test_callback(mm_sound_test_cb1, (void *)user_data);
if (ret) {
g_print("failed to mm_sound_add_test_callback(), ret[0x%x]\n", ret);
}
else if (strncmp(cmd, "gap", 3) == 0) {
int ret = 0;
- int device_in=0, device_out=0;
+ mm_sound_device_in device_in = 0;
+ mm_sound_device_out device_out = 0;
ret = mm_sound_get_audio_path(&device_in, &device_out);
if (ret == MM_ERROR_NONE) {
g_print ("### mm_sound_get_audio_path() Success (%X,%X)\n\n", device_in, device_out);
int ret = 0;
mm_sound_device_flags_e flags = MM_SOUND_DEVICE_ALL_FLAG;
MMSoundDeviceList_t device_list;
- int device_type = 0;
- int io_direction = 0;
- int state = 0;
+ mm_sound_device_type_e device_type = 0;
+ mm_sound_device_io_direction_e io_direction = 0;
+ mm_sound_device_state_e state = 0;
int id = 0;
char *name = NULL;
MMSoundDevice_t device_h = NULL;
if (ret) {
g_print("failed to mm_sound_get_current_device_list(), ret[0x%x]\n", ret);
} else {
- g_print("device_list[0x%x], device_h[0x%x]\n", device_list, device_h);
+ g_print("device_list[%p], device_h[%p]\n", device_list, device_h);
do {
dret = mm_sound_get_next_device (device_list, &device_h);
if (dret) {
if (ret) {
g_print("failed to mm_sound_add_device_connected_callback(), ret[0x%x]\n", ret);
} else {
- g_print("device_flags[0x%x], callback fun[0x%x]\n", device_flag_1|device_flag_2|device_flag_3, device_connected_cb);
+ g_print("device_flags[0x%x], callback fun[%p]\n", device_flag_1|device_flag_2|device_flag_3, device_connected_cb);
}
}
if (ret) {
g_print("failed to mm_sound_add_device_information_changed_callback(), ret[0x%x]\n", ret);
} else {
- g_print("device_flags[0x%x], callback fun[0x%x]\n", device_flag_1|device_flag_2|device_flag_3, device_info_changed_cb);
+ g_print("device_flags[0x%x], callback fun[%p]\n", device_flag_1|device_flag_2|device_flag_3, device_info_changed_cb);
}
}