debug_msg("found a node : request_focus_type(%d), stream_type(%s)/additional info(%s) of acquired focus\n", focus_type, node->stream_type, node->option);
*stream_type = node->stream_type;
if (additional_info)
- *additional_info = node->option;
+ *additional_info = node->option[focus_type-1];
ret = MM_ERROR_NONE;
break;
}
#define MASTER_VOLUME_MAX 100
#define MASTER_VOLUME_MIN 0
-static pthread_mutex_t g_volume_mutex = PTHREAD_MUTEX_INITIALIZER;
-
#include <gio/gio.h>
static GList *g_subscribe_cb_list = NULL;
*
*/
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <poll.h>
void _system_signal_handler(int signo)
{
int ret = MM_ERROR_NONE;
- int index = 0;
sigset_t old_mask, all_mask;
debug_error("Got signal : signo(%d)", signo);
#ifdef USE_FOCUS
- int index = 0;
-
if (g_focus_thread) {
g_main_loop_quit(g_focus_loop);
g_thread_join(g_focus_thread);
#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);
/* Defensive code - wait until callback timeout although callback is removed */
int buf = MM_ERROR_NONE; //no need to specify cb result to server, just notice if the client got the callback properly or not
int tmpfd = -1;
+ char str_error[256];
tmpfd = open(filename2, O_WRONLY | O_NONBLOCK);
if (tmpfd < 0) {
- char str_error[256];
strerror_r(errno, str_error, sizeof(str_error));
debug_warning("could not open file(%s) (may server close it first), tid(%d) fd(%d) %s errno=%d(%s)",
filename2, g_focus_sound_handle[index].focus_tid, tmpfd, filename2, errno, str_error);
} else {
+ ssize_t written;
debug_msg("write MM_ERROR_NONE(tid:%d) for waiting server", g_focus_sound_handle[index].focus_tid);
written = write(tmpfd, &buf, sizeof(buf));
+ if (written == -1) {
+ strerror_r(errno, str_error, sizeof(str_error));
+ debug_warning("write failed, %s", str_error);
+ }
close(tmpfd);
}
pa_channel_map maps;
pa_buffer_attr attr;
- int vol_conf_type;
- int prop_vol_type, prop_gain_type;
+ int prop_vol_type, prop_gain_type = VOLUME_GAIN_DEFAULT;
int err = MM_ERROR_SOUND_INTERNAL;
int period_time = PA_SIMPLE_PERIOD_TIME_FOR_MID_LATENCY_MSEC;
err = MM_ERROR_SOUND_INTERNAL;
goto fail;
}
- g_list_append(mm_sound_handle_mgr.handles, handle);
+ mm_sound_handle_mgr.handles = g_list_append(mm_sound_handle_mgr.handles, handle);
if(handle->handle == 0) {
debug_msg("out of range. handle(%d)\n", handle->handle);
debug_msg("leave: handle[%d] stream_index[%d]\n", handle, phandle->stream_idx);
- g_list_remove(mm_sound_handle_mgr.handles, phandle);
+ mm_sound_handle_mgr.handles = g_list_remove(mm_sound_handle_mgr.handles, phandle);
if(phandle != NULL) {
free(phandle);
phandle = NULL;
int value;
} get_volume_max_userdata_t;
-static void __mm_sound_pa_get_cb(pa_context *c, uint32_t value, void *userdata)
-{
- get_volume_max_userdata_t* u = (get_volume_max_userdata_t*)userdata;
-
- assert(c);
- assert(u);
-
- u->value = value;
-
- pa_threaded_mainloop_signal(u->mainloop, 0);
-}
-
EXPORT_API
int mm_sound_pa_corkall(int cork)
{
Name: libmm-sound
Summary: MMSound Package contains client lib and sound_server binary
-Version: 0.10.13
+Version: 0.10.14
Release: 0
Group: System/Libraries
License: Apache-2.0
unsigned int subs_id = 0;
- err = mm_sound_add_device_connected_callback(MM_SOUND_DEVICE_STATE_ACTIVATED_FLAG, (mm_sound_device_connected_cb)sound_codec_device_connected_callback, *slotid, &subs_id);
+ err = mm_sound_add_device_connected_callback(MM_SOUND_DEVICE_STATE_ACTIVATED_FLAG, (mm_sound_device_connected_cb)sound_codec_device_connected_callback, (void*) *slotid, &subs_id);
if (err) {
debug_error("mm_sound_add_device_connected_callback failed [0x%x]", err);
pthread_mutex_unlock(&g_slot_mutex);
unsigned int subs_id = 0;
- err = mm_sound_add_device_connected_callback(MM_SOUND_DEVICE_STATE_ACTIVATED_FLAG, (mm_sound_device_connected_cb)sound_codec_device_connected_callback, *slotid, &subs_id);
+ err = mm_sound_add_device_connected_callback(MM_SOUND_DEVICE_STATE_ACTIVATED_FLAG, (mm_sound_device_connected_cb)sound_codec_device_connected_callback, (void*) *slotid, &subs_id);
if (err) {
debug_error("mm_sound_add_device_connected_callback failed [0x%x]", err);
pthread_mutex_unlock(&g_slot_mutex);
static int (*g_thread_pool_func)(void*, void (*)(void*)) = NULL;
-static int _MMSoundKeytoneInit(void);
-static int _MMSoundKeytoneFini(void);
static int stop_flag = 0;
#ifdef SUPPORT_DBUS_KEYTONE
static int MMSoundPlugRunKeytoneControlRun(void)
{
- int ret = MM_ERROR_NONE;
-
debug_enter("\n");
/* While loop is always on */
stop_flag = MMSOUND_TRUE;
gboolean timeout_quit_program(void *data);
gboolean input (GIOChannel *channel);
-static char* __get_playback_device_str (mm_sound_device_out out);
-static char* __get_capture_device_str (mm_sound_device_in in);
-static char* __get_route_str (mm_sound_route route);
-
void mycallback(void *data, int id)
{
char *str = (char*)data;
g_print("\nThe input directory is '%s' \n\n",g_dir_name);
}
-static char* __get_playback_device_str (mm_sound_device_out out)
-{
- switch (out) {
- case MM_SOUND_DEVICE_OUT_SPEAKER: return "SPEAKER";
- case MM_SOUND_DEVICE_OUT_RECEIVER: return "RECEIVER";
- case MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY: return "HEADSET";
- case MM_SOUND_DEVICE_OUT_BT_SCO: return "BTSCO";
- case MM_SOUND_DEVICE_OUT_BT_A2DP: return "BTA2DP";
- case MM_SOUND_DEVICE_OUT_DOCK: return "DOCK";
- case MM_SOUND_DEVICE_OUT_HDMI: return "HDMI";
- case MM_SOUND_DEVICE_OUT_MIRRORING: return "MIRRORING";
- case MM_SOUND_DEVICE_OUT_USB_AUDIO: return "USB";
- case MM_SOUND_DEVICE_OUT_MULTIMEDIA_DOCK: return "MULTIMEDIA_DOCK";
- default: return NULL;
- }
-}
-
-static char* __get_capture_device_str (mm_sound_device_in in)
-{
- switch (in) {
- case MM_SOUND_DEVICE_IN_MIC: return "MAINMIC";
- case MM_SOUND_DEVICE_IN_WIRED_ACCESSORY: return "HEADSET";
- case MM_SOUND_DEVICE_IN_BT_SCO: return "BTMIC";
- default: return NULL;
- }
-}
-
-static char* __get_route_str (mm_sound_route route)
-{
- switch (route) {
- case MM_SOUND_ROUTE_OUT_SPEAKER: return "OUT_SPEAKER";
- case MM_SOUND_ROUTE_OUT_RECEIVER: return "OUT_RECEIVER";
- case MM_SOUND_ROUTE_OUT_WIRED_ACCESSORY: return "OUT_WIRED_ACCESSORY";
- case MM_SOUND_ROUTE_OUT_BLUETOOTH_A2DP: return "OUT_BLUETOOTH_A2DP";
- case MM_SOUND_ROUTE_OUT_DOCK: return "OUT_DOCK";
- case MM_SOUND_ROUTE_OUT_HDMI: return "OUT_HDMI";
- case MM_SOUND_ROUTE_OUT_MIRRORING: return "OUT_MIRRORING";
- case MM_SOUND_ROUTE_OUT_USB_AUDIO: return "OUT_USB";
- case MM_SOUND_ROUTE_OUT_MULTIMEDIA_DOCK: return "OUT_MULTIMEDIA_DOCK";
- case MM_SOUND_ROUTE_IN_MIC: return "IN_MIC";
- case MM_SOUND_ROUTE_IN_WIRED_ACCESSORY: return "IN_WIRED_ACCESSORY";
- case MM_SOUND_ROUTE_IN_MIC_OUT_RECEIVER: return "IN_MIC_OUT_RECEIVER";
- case MM_SOUND_ROUTE_IN_MIC_OUT_SPEAKER: return "IN_MIC_OUT_SPEAKER";
- case MM_SOUND_ROUTE_IN_MIC_OUT_HEADPHONE: return "IN_MIC_OUT_HEADPHONE";
- case MM_SOUND_ROUTE_INOUT_HEADSET: return "INOUT_HEADSET";
- case MM_SOUND_ROUTE_INOUT_BLUETOOTH: return "INOUT_BLUETOOTH";
- default: return NULL;
- }
-}
-
static void __mm_sound_signal_cb1 (mm_sound_signal_name_t signal, int value, void *user_data)
{
int _value = 0;
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], subs_id[%u]\n", device_flag_1|device_flag_2|device_flag_3, device_connected_cb, g_subs_id_device_conn);
+ g_print("device_flags[0x%x], callback fun[%p], subs_id[%u]\n", device_flag_1|device_flag_2|device_flag_3, device_connected_cb, g_subs_id_device_conn);
}
}
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], subs_id[%u]\n", device_flag_1|device_flag_2|device_flag_3, device_info_changed_cb, g_subs_id_device_info);
+ g_print("device_flags[0x%x], callback fun[%p], subs_id[%u]\n", device_flag_1|device_flag_2|device_flag_3, device_info_changed_cb, g_subs_id_device_info);
}
}