debug_log("Dbus subscirbe signal with Obj'%s' Intf'%s' sig'%s'", object_name, intf_name, signal_name);
- subs_id = g_dbus_connection_signal_subscribe(conn, NULL, intf_name, signal_name, object_name, \
- NULL , G_DBUS_SIGNAL_FLAGS_NONE , signal_cb, userdata, NULL );
+ subs_id = g_dbus_connection_signal_subscribe(conn, NULL, intf_name, signal_name, object_name,
+ NULL, G_DBUS_SIGNAL_FLAGS_NONE , signal_cb, userdata, freefunc);
if (!subs_id) {
debug_error ("g_dbus_connection_signal_subscribe() failed ");
#if !defined(USE_SYSTEM_SERVER_PROCESS_MONITORING)
int pid;
#endif
-#ifdef TIZEN_TV
- int fd_ss_ready = -1;
-#endif
+ int fd_fs_ready = -1;
if (_get_option(argc, argv, &serveropt))
return 1;
}
}
-#ifdef TIZEN_TV
/* FIXME : This code is moved from sound_server temporally for TV migration
As other modules which has dependancy on this file is cleared,
this code will be removed */
} else {
debug_warning("SOUND_SERVER_READY(%s) event was created", SOUND_SERVER_READY);
}
-#else
- if ((fd_ss_ready = creat(SOUND_SERVER_READY, 0644)) != -1) {
- debug_warning("SOUND_SERVER_READY(%s) file was created", SOUND_SERVER_READY);
- close(fd_ss_ready);
+#endif
+ if ((fd_fs_ready = creat(FOCUS_SERVER_READY, 0644)) != -1) {
+ debug_warning("FOCUS_SERVER_READY(%s) file was created", FOCUS_SERVER_READY);
+ close(fd_fs_ready);
} else {
- debug_error("cannot create SOUND_SERVER_READY(/tmp/.sound_server_ready)");
+ debug_error("cannot create FOCUS_SERVER_READY(%s), errno(%d)", FOCUS_SERVER_READY, errno);
}
-#endif
-#endif
_mainloop_run();
}
*
**************************************/
RELEASE:
- if (filename) {
- g_free (filename);
- filename = NULL;
- }
- if (filename2) {
- g_free (filename2);
- filename2 = NULL;
- }
+ g_free(filename);
+ filename = NULL;
+
+ g_free(filename2);
+ filename2 = NULL;
+
if (fd_FOCUS != -1) {
close(fd_FOCUS);
fd_FOCUS = -1;
_mm_sound_mgr_focus_do_watch_callback((focus_type_e)assaulter_param->request_type, command, victim_node, assaulter_param);
RELEASE:
- if (filename) {
- g_free (filename);
- filename = NULL;
- }
- if (filename2) {
- g_free (filename2);
- filename2 = NULL;
- }
+ g_free(filename);
+ filename = NULL;
+
+ g_free(filename2);
+ filename2 = NULL;
+
if (fd_FOCUS != -1) {
close(fd_FOCUS);
fd_FOCUS = -1;
#endif
#define PA_READY "/tmp/.pa_ready"
-
+#ifdef USE_LWIPC
#define SOUND_SERVER_READY "/tmp/.sound_server_ready"
+#endif
+#define FOCUS_SERVER_READY "/tmp/.focus_server_ready"
#define MMSOUND_ENTER_CRITICAL_SECTION(x_mutex) \
switch ( pthread_mutex_lock( x_mutex ) ) \
struct callback_data *cb_data = (struct callback_data*) data;
if (cb_data) {
- if (cb_data->extra_data)
- g_free(cb_data->extra_data);
+ g_free(cb_data->extra_data);
g_free(cb_data);
}
}
debug_fenter();
+ if (index < 0 || index >= FOCUS_HANDLE_MAX) {
+ debug_error("Invalid focus handle index [%d]", index);
+ return;
+ }
+
if (is_for_watching) {
filename = g_strdup_printf("/tmp/FOCUS.%d.%d.wch", g_focus_sound_handle[index].focus_tid, g_focus_sound_handle[index].handle);
} else {
debug_fenter();
+ if (index < 0 || index >= FOCUS_HANDLE_MAX) {
+ debug_error("Invalid focus handle index [%d]", index);
+ return;
+ }
+
if (g_focus_sound_handle[index].focus_fd < 0) {
debug_error("Close fail : index(%d)", index);
} else {
return true;
ERROR:
- if (g_src_funcs)
- g_free(g_src_funcs);
- if (g_poll_fd)
- g_free(g_poll_fd);
+ g_free(g_src_funcs);
+ g_free(g_poll_fd);
if (g_src)
g_source_unref(g_src);
return false;
}
-static bool _focus_remove_sound_callback(int index, gushort events)
+static bool _focus_remove_sound_callback(int index)
{
bool ret = true;
+ focus_sound_info_t *h = NULL;
debug_fenter();
- g_mutex_clear(&g_focus_sound_handle[index].focus_lock);
+ if (index < 0 || index >= FOCUS_HANDLE_MAX) {
+ debug_error("Invalid focus handle index [%d]", index);
+ return false;
+ }
- 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..");
+ h = &g_focus_sound_handle[index];
+
+ if (h->focus_src && h->g_poll_fd) {
+ debug_log("g_source_remove_poll : fd(%d), event(0x%x)",
+ h->g_poll_fd->fd, h->g_poll_fd->events);
+ g_source_remove_poll(h->focus_src, h->g_poll_fd);
+ } else {
+ debug_error("[%d] focus_src[%p], g_poll_fd[%p]",
+ index, h->focus_src, h->g_poll_fd);
ret = false;
- goto RELEASE;
}
- g_poll_fd->fd = g_focus_sound_handle[index].focus_fd;
- g_poll_fd->events = events;
- if (!g_focus_sound_handle[index].focus_src) {
- debug_error("g_focus_sound_handle[%d].focus_src is null..", index);
- ret = false;
- goto RELEASE;
+ if (h->focus_src) {
+ g_source_destroy(h->focus_src);
+ g_source_unref(h->focus_src);
+ h->focus_src = NULL;
}
- g_source_remove_poll(g_focus_sound_handle[index].focus_src, g_poll_fd);
- debug_log("g_source_remove_poll : fd(%d), event(%x)", g_poll_fd->fd, g_poll_fd->events);
-RELEASE:
- if (g_focus_sound_handle[index].focus_src)
- g_source_destroy(g_focus_sound_handle[index].focus_src);
+ debug_log("g_free : g_src_funcs(%p), g_poll_fd(%p)",
+ h->g_src_funcs, h->g_poll_fd);
- debug_log("g_free : g_src_funcs(%x), g_poll_fd(%x)", g_src_funcs, g_poll_fd);
- if (g_src_funcs) {
- g_free(g_src_funcs);
- g_src_funcs = NULL;
- }
- if (g_poll_fd) {
- g_free(g_poll_fd);
- g_poll_fd = NULL;
- }
+ g_free(h->g_src_funcs);
+ h->g_src_funcs = NULL;
+
+ g_free(h->g_poll_fd);
+ h->g_poll_fd = NULL;
- g_focus_sound_handle[index].g_src_funcs = NULL;
- g_focus_sound_handle[index].g_poll_fd = NULL;
- g_focus_sound_handle[index].focus_src = NULL;
- g_focus_sound_handle[index].focus_callback = NULL;
- g_focus_sound_handle[index].watch_callback = NULL;
+ h->focus_callback = NULL;
+ h->watch_callback = NULL;
+
+ g_mutex_clear(&h->focus_lock);
debug_fleave();
+
return ret;
}
static void _focus_add_callback(int index, bool is_for_watching)
{
debug_fenter();
+
+ if (index < 0 || index >= FOCUS_HANDLE_MAX) {
+ debug_error("Invalid focus handle index [%d]", index);
+ return;
+ }
+
if (!is_for_watching) {
- if (!_focus_add_sound_callback(index, g_focus_sound_handle[index].focus_fd, (gushort)POLLIN | POLLPRI, _focus_callback_handler)) {
- debug_error("failed to _focus_add_sound_callback()");
- //return false;
- }
+ if (!_focus_add_sound_callback(index, g_focus_sound_handle[index].focus_fd,
+ (gushort)POLLIN | POLLPRI, _focus_callback_handler))
+ debug_error("failed to _focus_add_sound_callback(%p)", _focus_callback_handler);
} else { // need to check if it's necessary
- if (!_focus_add_sound_callback(index, g_focus_sound_handle[index].focus_fd, (gushort)POLLIN | POLLPRI, _focus_watch_callback_handler)) {
- debug_error("failed to _focus_add_sound_callback()");
- //return false;
- }
+ if (!_focus_add_sound_callback(index, g_focus_sound_handle[index].focus_fd,
+ (gushort)POLLIN | POLLPRI, _focus_watch_callback_handler))
+ debug_error("failed to _focus_add_sound_callback(%p)", _focus_watch_callback_handler);
}
debug_fleave();
}
static void _focus_remove_callback(int index)
{
debug_fenter();
- if (!_focus_remove_sound_callback(index, (gushort)POLLIN | POLLPRI)) {
+ if (!_focus_remove_sound_callback(index))
debug_error("failed to __focus_remove_sound_callback()");
- //return false;
- }
debug_fleave();
}
handle->handle, handle->mode, handle->policy, handle->volume_type, handle->gain_type,
handle->rate, handle->channels, ss->format, handle->stream_idx, handle->s, handle->source_type, handle_inout);
+ if (proplist)
+ pa_proplist_free(proplist);
+
return handle->handle;
fail:
Name: libmm-sound
Summary: MMSound Package contains client lib and sound_server binary
-Version: 0.10.84
+Version: 0.10.87
Release: 0
Group: System/Libraries
License: Apache-2.0
#define _ENABLE_KEYTONE /* Temporal test code */
-/* #define FOCUS_INTEGRATION */
+#define FOCUS_INTEGRATION
typedef struct {
int (*callback)(int, void *, void *, int); /* msg_type(pid) client callback & client data info */
}
/*The count num means codec type WAV, MP3 */
- debug_msg("DTMF[%d] Repeat[%d] Volume[%f] plugin_codec[%d]\n", param->tone, param->repeat_count, param->volume, count);
+ debug_msg("DTMF[%d] Repeat[%d] Volume[%f] plugin_codec[%d], session(type[%d],option[%d])\n",
+ param->tone, param->repeat_count, param->volume, count, param->session_type, param->session_options);
if (g_plugins[count].GetSupportTypes == NULL) { /* Codec not found */
debug_error("unsupported file type %d\n", count);
param.volume_config = volume_config;
param.priority = priority;
param.session_type = session_type;
+ param.session_options = session_options;
param.param = (void*)client_pid;
param.source = source;
param.handle_route = handle_route;
static void handle_method_play_file_start(GDBusMethodInvocation* invocation)
{
gchar* filename = NULL;
- char *stream_type = NULL;
+ gchar *stream_type = NULL;
gint32 ret = MM_ERROR_NONE, slotid = 0;
gint32 tone = 0, repeat = 0, volume = 0, vol_config = 0, priority = 0;
gint32 session_type = 0, session_option = 0, pid = 0, handle_route =0, stream_index = 0;
ret = _MMSoundMgrIpcPlayFile(filename, tone, repeat, volume, vol_config, priority,
session_type, session_option, _get_sender_pid(invocation), handle_route, enable_session, &slotid, stream_type, stream_index);
+
send_reply:
if (ret == MM_ERROR_NONE) {
_method_call_return_value(invocation, g_variant_new("(i)", slotid));
_method_call_return_error(invocation, ret);
}
+ g_free(filename);
+ g_free(stream_type);
+
debug_fleave();
}
static void handle_method_play_file_start_with_stream_info(GDBusMethodInvocation* invocation)
{
gchar* filename = NULL;
- char *stream_type = NULL;
+ gchar *stream_type = NULL;
gint32 ret = MM_ERROR_NONE, slotid = 0;
gint32 repeat = 0, volume = 0, priority = 0, pid = 0, handle_route =0, stream_index = 0;
GVariant *params = NULL;
_method_call_return_error(invocation, ret);
}
+ g_free(filename);
+ g_free(stream_type);
+
debug_fleave();
}
{
int ret = MM_ERROR_NONE, slotid = 0;
int tone = 0, repeat = 0, volume = 0, vol_config = 0, session_type = 0, session_option = 0, pid = 0, stream_index = 0;
- char* stream_type = NULL;
+ gchar* stream_type = NULL;
gboolean enable_session = 0;
GVariant *params = NULL;
_method_call_return_error(invocation, ret);
}
+ g_free(stream_type);
debug_fleave();
}