lib_LTLIBRARIES = libmmfsoundcommon.la
-libmmfsoundcommon_la_SOURCES = mm_ipc.c \
- mm_sound_utils.c \
+libmmfsoundcommon_la_SOURCES = mm_sound_utils.c \
mm_sound_dbus.c
#libmmfsoundcommon_la_DEPENDENCIES = $(libdir)/libmmfcommon.la
+++ /dev/null
-/*
- * libmm-sound
- *
- * 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 <string.h>
-#include <errno.h>
-
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <semaphore.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include <aio.h>
-
-#include <mm_ipc.h>
-#include <mm_error.h>
-#include <mm_debug.h>
-
-#define FIX_PROCESS 1
-
-#include <assert.h>
-#include <sys/ipc.h>
-#include <sys/msg.h>
-
-#include <vconf.h>
-
-#define AUDIO_ROUTE_POLICY_LOCK "audio_route_policy_lock"
-#define LOCK_TIMEOUT_SEC 6
-
-EXPORT_API
-int __mm_sound_lock()
-{
- sem_t *sem = NULL;
- int ret;
- int err = MM_ERROR_NONE;
- struct timespec wait_time;
-
- sem = sem_open(AUDIO_ROUTE_POLICY_LOCK, O_CREAT, 0666, 1);
- if (sem == SEM_FAILED)
- {
- char str_error[256];
- strerror_r(errno, str_error, sizeof(str_error));
- debug_error("Semaphore open Fail! (name:%s, %s)\n", AUDIO_ROUTE_POLICY_LOCK, str_error);
- return MM_ERROR_SOUND_INTERNAL;
- }
-retry_lock:
- wait_time.tv_sec = (long int)(time(NULL)) + LOCK_TIMEOUT_SEC;
- wait_time.tv_nsec = 0;
- ret = sem_timedwait(sem, &wait_time);
- if(ret == -1)
- {
- switch(errno)
- {
- case EINTR:
- debug_error("Lock RETRY LOCK\n");
- goto retry_lock;
- break;
- case EINVAL:
- debug_error("Invalid semaphore\n");
- err = MM_ERROR_SOUND_INTERNAL;
- break;
- case EAGAIN:
- debug_error("EAGAIN\n");
- err = MM_ERROR_SOUND_INTERNAL;
- break;
- case ETIMEDOUT:
- debug_error("sem_wait leached %d seconds timeout.\n", LOCK_TIMEOUT_SEC);
- {
- //Recovery of sem_wait lock....in abnormal condition
- int sem_value = -1;
- if(0 == sem_getvalue(sem, &sem_value))
- {
- debug_error("%s sem value is %d\n",AUDIO_ROUTE_POLICY_LOCK, sem_value);
- if(sem_value == 0)
- {
- ret = sem_post(sem);
- if(ret == -1)
- {
- debug_error("sem_post error %s : %d\n", AUDIO_ROUTE_POLICY_LOCK, sem_value);
- }
- else
- {
- debug_error("lock recovery success...try lock again\n");
- goto retry_lock;
- }
- }
- else
- {
- debug_error("sem value is not 0. but failed sem_timedwait so retry.. : %s\n",AUDIO_ROUTE_POLICY_LOCK);
- usleep(5);
- goto retry_lock;
- }
- }
- else
- {
- debug_error("sem_getvalue failed : %s\n",AUDIO_ROUTE_POLICY_LOCK);
- }
- }
- err = MM_ERROR_SOUND_INTERNAL;
- break;
- }
- }
- sem_close(sem);
- return err;
-}
-
-EXPORT_API
-int __mm_sound_unlock()
-{
- sem_t *sem = NULL;
- int ret;
- int err = MM_ERROR_NONE;
-
- sem = sem_open(AUDIO_ROUTE_POLICY_LOCK, O_CREAT, 0666, 1);
- if (sem == SEM_FAILED)
- {
- debug_error("Semaphore open Fail! (name:%s, errno %d)\n", AUDIO_ROUTE_POLICY_LOCK, errno);
- return MM_ERROR_SOUND_INTERNAL;
- }
-
- ret = sem_post(sem);
- if (ret == -1)
- {
- debug_error("UNLOCK FAIL\n");
- err = MM_ERROR_SOUND_INTERNAL;
- }
-
- sem_close(sem);
- return err;
-}
-
*/
#include <sys/types.h>
-#include <sys/stat.h>
#include <fcntl.h>
-#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <glib.h>
#include <vconf.h>
-#include <vconf-keys.h>
#include <mm_types.h>
#include <mm_error.h>
#include <mm_debug.h>
#include "../include/mm_sound_private.h"
-#include "../include/mm_sound.h"
-#include "../include/mm_sound_common.h"
#include "../include/mm_sound_utils.h"
-#define MM_SOUND_DEFAULT_VOLUME_SYSTEM 9
-#define MM_SOUND_DEFAULT_VOLUME_NOTIFICATION 11
-#define MM_SOUND_DEFAULT_VOLUME_ALARAM 7
-#define MM_SOUND_DEFAULT_VOLUME_RINGTONE 11
-#define MM_SOUND_DEFAULT_VOLUME_MEDIA 7
-#define MM_SOUND_DEFAULT_VOLUME_CALL 4
-#define MM_SOUND_DEFAULT_VOLUME_VOIP 4
-#define MM_SOUND_DEFAULT_VOLUME_VOICE 7
-#define MM_SOUND_DEFAULT_VOLUME_ANDROID 0
+#define VCONF_KEY_VOLUME_PREFIX "file/private/sound/volume"
+#define VCONF_KEY_VOLUME_TYPE_SYSTEM VCONF_KEY_VOLUME_PREFIX"/system"
+#define VCONF_KEY_VOLUME_TYPE_NOTIFICATION VCONF_KEY_VOLUME_PREFIX"/notification"
+#define VCONF_KEY_VOLUME_TYPE_ALARM VCONF_KEY_VOLUME_PREFIX"/alarm"
+#define VCONF_KEY_VOLUME_TYPE_RINGTONE VCONF_KEY_VOLUME_PREFIX"/ringtone"
+#define VCONF_KEY_VOLUME_TYPE_MEDIA VCONF_KEY_VOLUME_PREFIX"/media"
+#define VCONF_KEY_VOLUME_TYPE_CALL VCONF_KEY_VOLUME_PREFIX"/call"
+#define VCONF_KEY_VOLUME_TYPE_VOIP VCONF_KEY_VOLUME_PREFIX"/voip"
+#define VCONF_KEY_VOLUME_TYPE_VOICE VCONF_KEY_VOLUME_PREFIX"/voice"
+#define VCONF_KEY_VOLUME_TYPE_ANDROID VCONF_KEY_VOLUME_PREFIX"/fixed"
static char *g_volume_vconf[VOLUME_TYPE_MAX] = {
VCONF_KEY_VOLUME_TYPE_SYSTEM, /* VOLUME_TYPE_SYSTEM */
}
EXPORT_API
-bool mm_sound_util_is_recording (void)
-{
- /* FIXME : is this function needs anymore ??? */
- return false;
-}
-
-EXPORT_API
bool mm_sound_util_is_process_alive(pid_t pid)
{
gchar *tmp = NULL;
#include "../include/mm_sound.h"
#include "../include/mm_sound_focus.h"
#include "../include/mm_sound_stream.h"
-#include "../include/mm_ipc.h"
#include "mm_sound_mgr_focus_ipc.h"
typedef enum
#include <lwipc.h>
#endif
-#include <signal.h>
-
#include "../include/mm_sound_common.h"
#include "include/mm_sound_mgr_focus.h"
#include "include/mm_sound_mgr_focus_dbus.h"
ret = __mm_sound_mgr_focus_dbus_get_stream_list(&g_stream_list);
if (ret)
- debug_error("failed to __mm_sound_mgr_ipc_dbus_get_stream_list()\n");
+ debug_error("failed to __mm_sound_mgr_focus_dbus_get_stream_list()\n");
debug_fleave();
return ret;
+++ /dev/null
-/*
- * libmm-sound
- *
- * 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.
- *
- */
-
-#ifndef __MM_SOUND_IPC_H__
-#define __MM_SOUND_IPC_H__
-
-#include <stdio.h>
-#include <unistd.h>
-
-#include "mm_sound.h"
-#include "mm_sound_device.h"
-#ifdef USE_FOCUS
-#include "mm_sound_stream.h"
-#endif
-
-
-#define FILE_PATH 512
-
-typedef enum {
- MM_IPC_SUCCESS,
- MM_IPC_WARNING,
- MM_IPC_ERROR,
- MM_IPC_PROCESS,
-} mm_ipc_async_state;
-
-typedef struct
-{
- /* Recieve data */
- int msgid;
- int msgtype;
- int code;
-
- /* Send data */
- int keytone;
- int repeat;
- int tone;
- double volume;
- int memptr;
- int memsize;
- int sharedkey;
- char filename[FILE_PATH];
-
- /* Device */
- mm_sound_device_t device_handle;
- int total_device_num;
- int device_flags;
- bool is_connected;
- int changed_device_info_type;
-
- int device_in;
- int device_out;
- int is_available;
- int route_list[MM_SOUND_ROUTE_NUM];
-
-#ifdef USE_FOCUS
- /* Focus */
- int handle_id;
- int focus_type;
- int changed_state;
- char stream_type[MAX_STREAM_TYPE_LEN];
-#endif
- /* Volume */
- int type;
- int val;
-
- /* Common data */
- int handle;
- void *callback;
- void *cbdata;
- int samplerate;
- int channels;
- int volume_config;
- int session_type;
- int session_options;
-
- bool enable_session;
- bool need_broadcast;
-
- char name[MM_SOUND_NAME_NUM];
-} mmsound_ipc_t;
-
-typedef struct
-{
- long msg_type;
- mmsound_ipc_t sound_msg;
- bool wait_for_reply;
-} mm_ipc_msg_t;
-
-typedef void (*mm_ipc_callback_t)(int code, int size);
-
-int MMSoundGetTime(char *position);
-int MMIpcCreate(const int key);
-int MMIpcDestroy(const int key);
-int MMIpcSendMsg(const int key, mm_ipc_msg_t *msg);
-int MMIpcRecvMsg(const int key, mm_ipc_msg_t *msg);
-
-int MMIpcSendMsgAsync(const char *ipcname, mm_ipc_msg_t *msg, mm_ipc_callback_t callback);
-int MMIpcRecvMsgAsync(const char *ipcname, mm_ipc_msg_t **msg, mm_ipc_callback_t callback);
-int MMIpcRecvData(const char *ipcname, void *data, int *size);
-int MMIpcSendDataAsync(const char *ipcname, void *data, int size, mm_ipc_callback_t callback);
-int __mm_sound_lock(void);
-int __mm_sound_unlock(void);
-
-#endif /* __MM_SOUND_IPC_H__ */
-
</table></div>
*/
-#define MM_SOUND_STREAM_TYPE_LEN 64
/*
* MMSound Volume APIs
#include <errno.h>
-///////////////////////////////////
-//// MMSOUND VOLUME APIs
-///////////////////////////////////
-#define VCONF_KEY_VOLUME_PREFIX "file/private/sound/volume"
-#define VCONF_KEY_VOLUME_TYPE_SYSTEM VCONF_KEY_VOLUME_PREFIX"/system"
-#define VCONF_KEY_VOLUME_TYPE_NOTIFICATION VCONF_KEY_VOLUME_PREFIX"/notification"
-#define VCONF_KEY_VOLUME_TYPE_ALARM VCONF_KEY_VOLUME_PREFIX"/alarm"
-#define VCONF_KEY_VOLUME_TYPE_RINGTONE VCONF_KEY_VOLUME_PREFIX"/ringtone"
-#define VCONF_KEY_VOLUME_TYPE_MEDIA VCONF_KEY_VOLUME_PREFIX"/media"
-#define VCONF_KEY_VOLUME_TYPE_CALL VCONF_KEY_VOLUME_PREFIX"/call"
-#define VCONF_KEY_VOLUME_TYPE_VOIP VCONF_KEY_VOLUME_PREFIX"/voip"
-#define VCONF_KEY_VOLUME_TYPE_VOICE VCONF_KEY_VOLUME_PREFIX"/voice"
-#define VCONF_KEY_VOLUME_TYPE_ANDROID VCONF_KEY_VOLUME_PREFIX"/fixed"
-
-#ifndef _TIZEN_PUBLIC_
-#define VCONF_KEY_VR_LEFTHAND_ENABLED VCONFKEY_SETAPPL_PERFERED_ARM_LEFT_BOOL
-#endif
-
#define PA_READY "/tmp/.pa_ready"
#define SOUND_SERVER_READY "/tmp/.sound_server_ready"
#define FOCUS_SERVER_READY "/tmp/.focus_server_ready"
}MMSoundHandleMode;
int mm_sound_pa_open(MMSoundHandleMode mode, int volume_config, pa_sample_spec* ss, pa_channel_map* channel_map, int* size, char *stream_type, int stream_index);
-int mm_sound_pa_read(const int handle, void* buf, const int size);
int mm_sound_pa_write(const int handle, void* buf, const int size);
int mm_sound_pa_close(const int handle);
int mm_sound_pa_drain(const int handle);
-int mm_sound_pa_flush(const int handle);
#endif
*/
#define MM_SOUND_VOLUME_CONFIG_TYPE(vol) (vol & 0x00FF)
-#define MM_SOUND_VOLUME_CONFIG_GAIN(vol) (vol & 0xFF00)
typedef struct {
const char *filename; /**< filename to play */
#ifndef __MM_SOUND_UTILS_H__
#define __MM_SOUND_UTILS_H__
-#include <mm_types.h>
-#include <mm_error.h>
-#include <unistd.h>
-
-#include "../include/mm_sound.h"
-
#ifdef __cplusplus
extern "C" {
#endif
int mm_sound_util_volume_get_value_by_type(volume_type_t type, unsigned int *value);
int mm_sound_util_volume_set_value_by_type(volume_type_t type, unsigned int value);
-bool mm_sound_util_is_recording (void);
bool mm_sound_util_is_process_alive(pid_t pid);
#ifdef __cplusplus
{
switch (volume_type) {
case VOLUME_TYPE_SYSTEM:
- MMSOUND_STRNCPY(stream_type, "system", MM_SOUND_STREAM_TYPE_LEN);
+ MMSOUND_STRNCPY(stream_type, "system", MAX_STREAM_TYPE_LEN);
break;
case VOLUME_TYPE_NOTIFICATION:
- MMSOUND_STRNCPY(stream_type, "notification", MM_SOUND_STREAM_TYPE_LEN);
+ MMSOUND_STRNCPY(stream_type, "notification", MAX_STREAM_TYPE_LEN);
break;
case VOLUME_TYPE_ALARM:
- MMSOUND_STRNCPY(stream_type, "alarm", MM_SOUND_STREAM_TYPE_LEN);
+ MMSOUND_STRNCPY(stream_type, "alarm", MAX_STREAM_TYPE_LEN);
break;
case VOLUME_TYPE_RINGTONE:
- MMSOUND_STRNCPY(stream_type, "ringtone-voip", MM_SOUND_STREAM_TYPE_LEN);
+ MMSOUND_STRNCPY(stream_type, "ringtone-voip", MAX_STREAM_TYPE_LEN);
break;
case VOLUME_TYPE_MEDIA:
- MMSOUND_STRNCPY(stream_type, "media", MM_SOUND_STREAM_TYPE_LEN);
+ MMSOUND_STRNCPY(stream_type, "media", MAX_STREAM_TYPE_LEN);
break;
case VOLUME_TYPE_CALL:
- MMSOUND_STRNCPY(stream_type, "call-voice", MM_SOUND_STREAM_TYPE_LEN);
+ MMSOUND_STRNCPY(stream_type, "call-voice", MAX_STREAM_TYPE_LEN);
break;
case VOLUME_TYPE_VOIP:
- MMSOUND_STRNCPY(stream_type, "voip", MM_SOUND_STREAM_TYPE_LEN);
+ MMSOUND_STRNCPY(stream_type, "voip", MAX_STREAM_TYPE_LEN);
break;
case VOLUME_TYPE_VOICE:
- MMSOUND_STRNCPY(stream_type, "voice-information", MM_SOUND_STREAM_TYPE_LEN);
+ MMSOUND_STRNCPY(stream_type, "voice-information", MAX_STREAM_TYPE_LEN);
break;
default:
- MMSOUND_STRNCPY(stream_type, "media", MM_SOUND_STREAM_TYPE_LEN);
+ MMSOUND_STRNCPY(stream_type, "media", MAX_STREAM_TYPE_LEN);
break;
}
int ret = MM_ERROR_NONE;
// int instance = -1; /* instance is unique to communicate with server : client message queue filter type */
int volume_type = MM_SOUND_VOLUME_CONFIG_TYPE(volume_config);
- char stream_type[MM_SOUND_STREAM_TYPE_LEN] = {0, };
+ char stream_type[MAX_STREAM_TYPE_LEN] = {0, };
debug_fenter();
int is_focus_registered = 0;
// int instance = -1; /* instance is unique to communicate with server : client message queue filter type */
int volume_type = MM_SOUND_VOLUME_CONFIG_TYPE(param->volume_config);
- char stream_type[MM_SOUND_STREAM_TYPE_LEN] = {0, };
+ char stream_type[MAX_STREAM_TYPE_LEN] = {0, };
struct callback_data *cb_data = NULL;
play_sound_end_callback_data_t *end_cb_data;
int source_type;
} mm_sound_handle_t;
-#define MM_SOUND_HANDLE_MAX 32
static struct {
uint32_t handle_count; /* use amotic operations */
GList* handles;
} \
} while(0);
-#define CHECK_VOLUME_TYPE_RANGE(x) \
- do { \
- if(x < VOLUME_TYPE_SYSTEM || x >= VOLUME_TYPE_MAX) { \
- debug_msg("invalid volume type(%d)", x); \
- return MM_ERROR_INVALID_ARGUMENT; \
- } \
- } while(0);
-
#define ATOMIC_INC(l, x) \
do { \
pthread_mutex_lock(l); \
} while(0);
-// should be call after pa_ext function.
-#define WAIT_PULSEAUDIO_OPERATION(x, y) \
- do { \
- while (pa_operation_get_state(y) == PA_OPERATION_RUNNING) { \
- debug_msg("waiting.................."); \
- pa_threaded_mainloop_wait(x.mainloop); \
- debug_msg("waiting DONE"); \
- } \
- } while(0);
-
-#define PA_SIMPLE_FADE_INTERVAL_USEC 20000
-
#define PA_SIMPLE_SAMPLES_PER_PERIOD_DEFAULT 1536 /* frames */
#define PA_SIMPLE_PERIODS_PER_BUFFER_FASTMODE 4
#define PA_SIMPLE_PERIODS_PER_BUFFER_DEFAULT 6
#define PA_SIMPLE_PERIOD_TIME_FOR_LOW_LATENCY_MSEC 25
#define PA_SIMPLE_PERIOD_TIME_FOR_MID_LATENCY_MSEC 50
#define PA_SIMPLE_PERIOD_TIME_FOR_HIGH_LATENCY_MSEC 75
-#define PA_SIMPLE_PERIOD_TIME_FOR_VERY_HIGH_LATENCY_MSEC 150
#define PA_SIMPLE_PERIOD_TIME_FOR_VOIP_LATENCY_MSEC 20
-#define IS_INPUT_HANDLE(x) \
- if( x == HANDLE_MODE_INPUT || x == HANDLE_MODE_INPUT_HIGH_LATENCY || \
- x == HANDLE_MODE_INPUT_LOW_LATENCY || x == HANDLE_MODE_INPUT_AP_CALL )
-
__attribute__ ((constructor)) void __mm_sound_pa_init(void)
{
memset(&mm_sound_handle_mgr, 0, sizeof(mm_sound_handle_mgr));
}
EXPORT_API
-int mm_sound_pa_read(const int handle, void* buf, const int size)
-{
- mm_sound_handle_t* phandle = NULL;
- int err = MM_ERROR_NONE;
-
-#ifdef __STREAM_DEBUG__
- debug_msg("handle(%d), buf(%p), size(%d)", handle, buf, size);
-#endif
- if (buf == NULL)
- return MM_ERROR_INVALID_ARGUMENT;
-
- if (size < 0)
- return MM_ERROR_INVALID_ARGUMENT;
- else if (size == 0)
- return size;
-
- CHECK_HANDLE_RANGE(handle);
- GET_HANDLE_DATA(phandle, mm_sound_handle_mgr.handles, &handle, __mm_sound_handle_comparefunc);
- if(phandle == NULL) {
- debug_msg("phandle is null");
- return MM_ERROR_SOUND_INTERNAL;
- }
-
- if (0 > pa_simple_read(phandle->s, buf, size, &err)) {
- debug_error("pa_simple_read() failed with %s", pa_strerror(err));
- return MM_ERROR_SOUND_INTERNAL;
- }
-
- return size;
-}
-
-EXPORT_API
int mm_sound_pa_write(const int handle, void* buf, const int size)
{
mm_sound_handle_t* phandle = NULL;
return err;
}
-EXPORT_API
-int mm_sound_pa_flush(const int handle)
-{
- mm_sound_handle_t* phandle = NULL;
- int err = MM_ERROR_NONE;
-
- CHECK_HANDLE_RANGE(handle);
- GET_HANDLE_DATA(phandle, mm_sound_handle_mgr.handles, &handle, __mm_sound_handle_comparefunc);
- if(phandle == NULL)
- return MM_ERROR_SOUND_INTERNAL;
-
- if (0 > pa_simple_flush(phandle->s, &err)) {
- debug_error("pa_simple_flush() failed with %s\n", pa_strerror(err));
- err = MM_ERROR_SOUND_INTERNAL;
- }
-
- return err;
-}
-
-typedef struct _get_volume_max_userdata_t
-{
- pa_threaded_mainloop* mainloop;
- int value;
-} get_volume_max_userdata_t;
Name: libmm-sound
Summary: MMSound Package contains client lib and sound_server binary
-Version: 0.10.107
+Version: 0.10.108
Release: 0
Group: System/Libraries
License: Apache-2.0
sound_server_SOURCES = mm_sound_mgr_codec.c \
mm_sound_mgr_ipc.c \
mm_sound_mgr_ipc_dbus.c \
- mm_sound_mgr_run.c \
mm_sound_plugin.c \
mm_sound_server.c \
mm_sound_thread_pool.c
#include <stdbool.h>
#include <mm_sound_stream.h>
-#include "../../include/mm_sound.h"
typedef struct {
int tone;
int channels;
int volume_config;
bool enable_session;
- char stream_type[MM_SOUND_STREAM_TYPE_LEN];
+ char stream_type[MAX_STREAM_TYPE_LEN];
int stream_index;
} mmsound_mgr_codec_param_t;
-enum
-{
- MM_SOUND_CODEC_OP_KEYTONE = 0,
- MM_SOUND_CODEC_OP_SOUND,
-};
-
int MMSoundMgrCodecInit(const char *targetdir, GSourceFunc _shutdown_cb);
int MMSoundMgrCodecFini(void);
int MMSoundMgrCodecPlayWithStreamInfo(int *slotid, const mmsound_mgr_codec_param_t *param);
int MMSoundMgrCodecStop(const int slotid);
int MMSoundMgrCodecClearFocus(int pid);
-int MMSoundMgrCodecCreate(int *slotid, const mmsound_mgr_codec_param_t *param);
-int MMSoundMgrCodecPlayWave(int slotid, const mmsound_mgr_codec_param_t *param);
int MMSoundMgrCodecPlayDtmf(int *slotid, const mmsound_mgr_codec_param_t *param);
int MMSoundMgrCodecPlayDtmfWithStreamInfo(int *slotid, const mmsound_mgr_codec_param_t *param);
-int MMSoundMgrCodecDestroy(const int slotid);
#endif /* __MM_SOUND_MGR_CODEC_H__ */
+++ /dev/null
-/*
- * libmm-sound
- *
- * 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.
- *
- */
-
-
-#ifndef __MM_SOUND_MGR_COMMON_H__
-#define __MM_SOUND_MGR_COMMON_H__
-
-#define MANAGER_HANDLE_MAX 256 //30
-
-#include <mm_session.h>
-#include <mm_session_private.h>
-
-#endif /* __MM_SOUND_MGR_COMMON_H__ */
-
#define __MM_SOUND_MGR_IPC_H__
#include <glib.h>
-#include <stdbool.h>
-#include "../../include/mm_sound_device.h"
-#include "../../include/mm_sound.h"
-
-int MMSoundMgrIpcInit(void);
-int MMSoundMgrIpcFini(void);
/* Msg processing */
int _MMSoundMgrIpcPlayFile(char* filename, int tone, int repeat, int volume, int volume_config, int session_type,
gboolean enable_session, int *codechandle, char *stream_type, int stream_index);
int _MMSoundMgrIpcPlayDTMFWithStreamInfo(int tone, int repeat, int volume, int client_pid, int *codechandle, char *stream_type, int stream_index);
-int __mm_sound_mgr_ipc_get_current_connected_device_list(int device_flags, mm_sound_device_t **device_list, int *total_num);
-
int __mm_sound_mgr_ipc_notify_play_file_end (int handle);
-int __mm_sound_mgr_ipc_notify_device_connected (mm_sound_device_t *device, gboolean is_connected);
-int __mm_sound_mgr_ipc_notify_device_info_changed (mm_sound_device_t *device, int changed_device_info_type);
-int __mm_sound_mgr_ipc_notify_volume_changed(unsigned int vol_type, unsigned int value);
-int __mm_sound_mgr_ipc_notify_active_device_changed(int device_in, int device_out);
-int __mm_sound_mgr_ipc_notify_available_device_changed(int device_in, int device_out, int available);
#endif /* __MM_SOUND_MGR_H__ */
#define __MM_SOUND_MGR_IPC_DBUS_H__
#include <gio/gio.h>
-#include "../include/mm_sound_device.h"
-#include "../include/mm_sound_stream.h"
-
-
-int mm_sound_mgr_ipc_dbus_send_signal_freeze (char* command, int pid);
int __mm_sound_mgr_ipc_dbus_notify_play_file_end(int handle);
-int __mm_sound_mgr_ipc_dbus_notify_device_connected (mm_sound_device_t *device, gboolean is_connected);
-int __mm_sound_mgr_ipc_dbus_notify_device_info_changed (mm_sound_device_t *device, int changed_device_info_type);
-int __mm_sound_mgr_ipc_dbus_notify_volume_changed(unsigned int vol_type, unsigned int value);
-int __mm_sound_mgr_ipc_dbus_notify_active_device_changed(int device_in, int device_out);
-int __mm_sound_mgr_ipc_dbus_notify_available_device_changed(int device_in, int device_out, int available);
-int __mm_sound_mgr_ipc_dbus_get_stream_list(stream_list_t* stream_list);
int MMSoundMgrDbusInit(void);
void MMSoundMgrDbusFini(void);
+++ /dev/null
-/*
- * libmm-sound
- *
- * 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.
- *
- */
-
-#ifndef __MM_SOUND_MGR_RUN_H__
-#define __MM_SOUND_MGR_RUN_H__
-
-int MMSoundMgrRunInit(const char *targetdir);
-int MMSoundMgrRunFini(void);
-int MMSoundMgrRunRunAll(void);
-int MMSoundMgrRunStopAll(void);
-
-#endif /* __MM_SOUND_MGR_RUN_H__ */
void *module;
} MMSoundPluginType;
-#define MMSOUND_TRUE 1
-#define MMSOUND_FALSE 0
-
/* Plugin Interface */
int MMSoundGetPluginType(void);
/* Utility Interfaces */
-char* MMSoundPluginGetTypeName(int type);
int MMSoundPluginScan(const char *plugindir, const int type, MMSoundPluginType **pluginlist);
int MMSoundPluginRelease(MMSoundPluginType *pluginlist);
#include "mm_sound_plugin.h"
#include <mm_types.h>
-#define MM_SOUND_STREAM_TYPE_LEN 64
+#define MAX_STREAM_TYPE_LEN 64
#define MM_SOUND_MAX_FILENAME 256
enum MMSoundSupportedCodec {
int volume_config;
int keytone;
char *pfilename;
- char stream_type[MM_SOUND_STREAM_TYPE_LEN];
+ char stream_type[MAX_STREAM_TYPE_LEN];
int stream_index;
pthread_mutex_t *codec_wave_mutex;
} mmsound_codec_param_t;
+++ /dev/null
-/*
- * libmm-sound
- *
- * 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.
- *
- */
-
-#ifndef __MM_SOUND_PLUGIN_RUN_H__
-#define __MM_SOUND_PLUGIN_RUN_H__
-
-#include "mm_sound_plugin.h"
-#include <mm_types.h>
-
-enum {
- MM_SOUND_PLUG_RUN_OP_RUN,
- MM_SOUND_PLUG_RUN_OP_STOP,
- MM_SOUND_PLUG_RUN_OP_LAST
-};
-
-/* Plugin Interface */
-typedef struct {
- int (*run)(void);
- int (*stop)(void);
- int (*SetThreadPool) (int (*)(void*, void (*)(void*)));
-} mmsound_run_interface_t;
-
-int MMSoundRunRun(void);
-int MMSoundRunStop(void);
-
-/* Utility Functions */
-#define RUN_GET_INTERFACE_FUNC_NAME "MMSoundPlugRunGetInterface"
-#define MMSoundPlugRunCastGetInterface(func) ((int (*)(mmsound_run_interface_t*))(func))
-int MMSoundPlugRunGetInterface(mmsound_run_interface_t *intf);
-
-#endif /* __MM_SOUND_PLUGIN_RUN_H__ */
-
#include <stdio.h>
#include <string.h>
#include <pthread.h>
-#include <unistd.h>
-#include <errno.h>
#include <mm_error.h>
#include <mm_types.h>
#include <mm_debug.h>
-#include <mm_ipc.h>
#include <mm_session.h>
#include <glib.h>
-#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_common.h"
#include "../include/mm_sound_focus.h"
+#include "../include/mm_sound.h"
#define SHUTDOWN_TIMEOUT_SEC 10
#define STATUS_IDLE 0
#define STATUS_SOUND 3
#define SOUND_SLOT_START 0
#define FOCUS_INTEGRATION
+#define MANAGER_HANDLE_MAX 256
typedef struct {
int (*callback)(int, void *, void *, int); /* msg_type(pid) client callback & client data info */
codec_param.param = *slotid;
codec_param.pid = (int)param->param;
codec_param.stream_index = param->stream_index;
- MMSOUND_STRNCPY(codec_param.stream_type, param->stream_type, MM_SOUND_STREAM_TYPE_LEN);
+ MMSOUND_STRNCPY(codec_param.stream_type, param->stream_type, MAX_STREAM_TYPE_LEN);
SLOT_LOCK();
#ifdef FOCUS_INTEGRATION
codec_param.param = *slotid;
codec_param.pid = (int)param->param;
codec_param.stream_index = param->stream_index;
- MMSOUND_STRNCPY(codec_param.stream_type, param->stream_type, MM_SOUND_STREAM_TYPE_LEN);
+ MMSOUND_STRNCPY(codec_param.stream_type, param->stream_type, MAX_STREAM_TYPE_LEN);
SLOT_LOCK();
/* Codec id WAV or MP3 */
codec_param.param = *slotid;
codec_param.pid = (int)param->param;
codec_param.stream_index = param->stream_index;
- MMSOUND_STRNCPY(codec_param.stream_type, param->stream_type, MM_SOUND_STREAM_TYPE_LEN);
+ MMSOUND_STRNCPY(codec_param.stream_type, param->stream_type, MAX_STREAM_TYPE_LEN);
SLOT_LOCK();
#ifdef FOCUS_INTEGRATION
codec_param.pid = (int)param->param;
codec_param.volume_config = -1; //setting volume config to -1 since using stream info instead of volume type
codec_param.stream_index = param->stream_index;
- MMSOUND_STRNCPY(codec_param.stream_type, param->stream_type, MM_SOUND_STREAM_TYPE_LEN);
+ MMSOUND_STRNCPY(codec_param.stream_type, param->stream_type, MAX_STREAM_TYPE_LEN);
SLOT_LOCK();
g_slots[*slotid].pluginid = plugin_id;
*
*/
-#include <stdlib.h>
-#include <string.h>
-
-#include <pthread.h>
-#include <sys/shm.h>
-#include <sys/msg.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include <errno.h>
-#include "include/mm_sound_mgr_common.h"
#include "include/mm_sound_mgr_ipc.h"
#include "include/mm_sound_mgr_ipc_dbus.h"
#include "../include/mm_sound_common.h"
#include "include/mm_sound_mgr_codec.h"
#include <mm_debug.h>
-
-#define SHM_OPEN
+#include <mm_error.h>
/******************************************************************************************
Functions For handling request from client
param.pfilename = filename;
param.enable_session = enable_session;
param.stream_index = stream_index;
- MMSOUND_STRNCPY(param.stream_type, stream_type, MM_SOUND_STREAM_TYPE_LEN);
-
-/*
- debug_msg("File[%s] DTMF[%d] Loop[%d] Volume[%f] VolCfg[0x%x] callback[%p] param[%d] src_type[%d] src_ptr[%p] keytone[%d] enable_session[%d]",
- filename,
- param.tone, param.repeat_count, param.volume, param.volume_config, param.callback,
- (int)param.param, param.source->type, param.source->ptr, param.keytone, param.enable_session);
- */
+ MMSOUND_STRNCPY(param.stream_type, stream_type, MAX_STREAM_TYPE_LEN);
ret = MMSoundMgrCodecPlay(codechandle, ¶m);
if (ret != MM_ERROR_NONE) {
param.param = (void*)client_pid;
param.pfilename = filename;
param.stream_index = stream_index;
- MMSOUND_STRNCPY(param.stream_type, stream_type, MM_SOUND_STREAM_TYPE_LEN);
+ MMSOUND_STRNCPY(param.stream_type, stream_type, MAX_STREAM_TYPE_LEN);
ret = MMSoundMgrCodecPlayWithStreamInfo(codechandle, ¶m);
if (ret != MM_ERROR_NONE) {
param.session_options = session_options;
param.enable_session = enable_session;
param.stream_index = stream_index;
- MMSOUND_STRNCPY(param.stream_type, stream_type, MM_SOUND_STREAM_TYPE_LEN);
+ MMSOUND_STRNCPY(param.stream_type, stream_type, MAX_STREAM_TYPE_LEN);
debug_msg("DTMF %d\n", param.tone);
debug_msg("Loop %d\n", param.repeat_count);
param.volume = volume;
param.param = (void*)client_pid;
param.stream_index = stream_index;
- MMSOUND_STRNCPY(param.stream_type, stream_type, MM_SOUND_STREAM_TYPE_LEN);
+ MMSOUND_STRNCPY(param.stream_type, stream_type, MAX_STREAM_TYPE_LEN);
debug_msg("DTMF %d\n", param.tone);
debug_msg("Loop %d\n", param.repeat_count);
return ret;
}
-int __mm_sound_mgr_ipc_get_current_connected_device_list(int device_flags, mm_sound_device_t **device_list, int *total_num)
-{
- int ret = MM_ERROR_NONE;
-
-// ret = _mm_sound_mgr_device_get_current_connected_dev_list(device_flags, device_list, total_num);
-
- return ret;
-}
-
/******************************************************************************************
Functions For Server-Side to notify Clients
******************************************************************************************/
-int __mm_sound_mgr_ipc_notify_play_file_end (int handle)
-{
- return __mm_sound_mgr_ipc_dbus_notify_play_file_end(handle);
-}
-
-int __mm_sound_mgr_ipc_notify_device_connected (mm_sound_device_t *device, gboolean is_connected)
-{
- return __mm_sound_mgr_ipc_dbus_notify_device_connected(device, is_connected);
-}
-
-int __mm_sound_mgr_ipc_notify_device_info_changed (mm_sound_device_t *device, int changed_device_info_type)
-{
- return __mm_sound_mgr_ipc_dbus_notify_device_info_changed(device, changed_device_info_type);
+int __mm_sound_mgr_ipc_notify_play_file_end (int handle) {
+ return __mm_sound_mgr_ipc_dbus_notify_play_file_end(handle);
}
-int __mm_sound_mgr_ipc_notify_volume_changed(unsigned int vol_type, unsigned int value)
-{
- return __mm_sound_mgr_ipc_dbus_notify_volume_changed(vol_type, value);
-}
-
-int __mm_sound_mgr_ipc_notify_active_device_changed(int device_in, int device_out)
-{
- /* Not Implemented */
- return __mm_sound_mgr_ipc_dbus_notify_active_device_changed(device_in, device_out);
-}
-
-int __mm_sound_mgr_ipc_notify_available_device_changed(int device_in, int device_out, int available)
-{
- /* Not Implemented */
- return __mm_sound_mgr_ipc_dbus_notify_available_device_changed(device_in, device_out, available);
-}
-
-int MMSoundMgrIpcInit(void)
-{
- return MM_ERROR_NONE;
-}
-
-int MMSoundMgrIpcFini(void)
-{
- return MM_ERROR_NONE;
-}
static void handle_method_clear_focus(GDBusMethodInvocation* invocation);
#endif
static void handle_method_test(GDBusMethodInvocation* invocation);
-static void handle_method_get_connected_device_list(GDBusMethodInvocation* invocation);
/* Currently , Just using method's name and handler */
/* TODO : generate introspection xml automatically, with these value include argument and reply */
},
.handler = handle_method_play_dtmf_with_stream_info
},
- [AUDIO_METHOD_GET_CONNECTED_DEVICE_LIST] = {
- .info = {
- .name = "GetConnectedDeviceList",
- },
- .handler = handle_method_get_connected_device_list
- },
};
static GDBusNodeInfo *introspection_data = NULL;
}
#endif
-static void handle_method_get_connected_device_list(GDBusMethodInvocation* invocation)
-{
- int ret = MM_ERROR_NONE;
- GVariant *params = NULL;
- GVariantBuilder reply_builder;
- int mask_flags = 0;
- int devices_num = 0, device_idx = 0;
- mm_sound_device_t *device_list = NULL, *device_entry = NULL;
-
- if (!(params = g_dbus_method_invocation_get_parameters(invocation))) {
- debug_error("Parameter for Method is NULL");
- ret = MM_ERROR_SOUND_INTERNAL;
- goto send_reply;
- }
-
- g_variant_get(params, "(i)", &mask_flags);
- debug_log("Get device list with device_flag %X", mask_flags);
- if ((ret = __mm_sound_mgr_ipc_get_current_connected_device_list(mask_flags, &device_list, &devices_num))==MM_ERROR_NONE) {
- g_variant_builder_init(&reply_builder, G_VARIANT_TYPE("(a(iiiis))"));
- g_variant_builder_open(&reply_builder, G_VARIANT_TYPE("a(iiiis)"));
- for (device_idx = 0; device_idx < devices_num; device_idx++) {
- device_entry = &device_list[device_idx];
-// debug_log("device(%d): id(%d), type(%d), io(%d), state(%d), name(%s) ", device_idx, device_entry->id, device_entry->type, device_entry->io_direction, device_entry->state, device_entry->name);
- g_variant_builder_add(&reply_builder, "(iiiis)", device_entry->id, device_entry->type, device_entry->io_direction, device_entry->state, device_entry->name);
- }
- g_variant_builder_close(&reply_builder);
- }
-
-send_reply:
- if (ret == MM_ERROR_NONE) {
- _method_call_return_value(invocation, g_variant_builder_end(&reply_builder));
- debug_log("Reply Sent");
- } else {
- _method_call_return_error(invocation, ret);
- }
-}
-
static void handle_method_call(GDBusConnection *connection,
const gchar *sender,
const gchar *object_path,
}
}
-int __mm_sound_mgr_ipc_dbus_notify_device_connected(mm_sound_device_t *device, gboolean is_connected)
-{
- int ret = MM_ERROR_NONE;
- GVariantBuilder builder;
- GVariant* param = NULL;
-
- debug_log("Send device connected signal");
-
- g_variant_builder_init(&builder, G_VARIANT_TYPE("((iiiis)b)"));
- g_variant_builder_open(&builder, G_VARIANT_TYPE_TUPLE);
- g_variant_builder_add(&builder, "(iiiis)", device->id, device->type, device->io_direction, device->state, device->name);
- g_variant_builder_close(&builder);
- g_variant_builder_add(&builder, "b", is_connected);
- param = g_variant_builder_end(&builder);
- if (param) {
- if ((ret = mm_sound_mgr_ipc_dbus_send_signal(AUDIO_EVENT_DEVICE_CONNECTED, param))!= MM_ERROR_NONE) {
- debug_error("Send device connected signal failed");
- }
- } else {
- debug_error("Build variant for dbus param failed");
- }
-
- return ret;
-}
-
-int __mm_sound_mgr_ipc_dbus_notify_device_info_changed(mm_sound_device_t *device, int changed_device_info_type)
-{
- int ret = MM_ERROR_NONE;
- GVariantBuilder builder;
- GVariant* param = NULL;
-
- debug_log("Send device info changed signal");
-
- g_variant_builder_init(&builder, G_VARIANT_TYPE("((iiiis)i)"));
- g_variant_builder_open(&builder, G_VARIANT_TYPE_TUPLE);
- g_variant_builder_add(&builder, "(iiiis)", device->id, device->type, device->io_direction, device->state, device->name);
- g_variant_builder_close(&builder);
- g_variant_builder_add(&builder, "i", changed_device_info_type);
- param = g_variant_builder_end(&builder);
- if (param) {
- if ((ret = mm_sound_mgr_ipc_dbus_send_signal(AUDIO_EVENT_DEVICE_INFO_CHANGED, param)) != MM_ERROR_NONE) {
- debug_error("Send device info changed signal failed");
- }
- } else {
- debug_error("Build variant for dbus param failed");
- }
-
- return ret;
-}
-
-int __mm_sound_mgr_ipc_dbus_notify_volume_changed(unsigned int vol_type, unsigned int value)
-{
- int ret = MM_ERROR_NONE;
- GVariant* param = NULL;
-
- debug_log("Send Signal volume changed signal");
-
- param = g_variant_new("(uu)", vol_type, value);
- if (param) {
- if ((ret = mm_sound_mgr_ipc_dbus_send_signal(AUDIO_EVENT_VOLUME_CHANGED, param)) != MM_ERROR_NONE) {
- debug_error("Send device connected signal failed");
- }
- } else {
- debug_error("Build variant for dbus param failed");
- }
-
- return ret;
-}
-
int __mm_sound_mgr_ipc_dbus_notify_play_file_end(int handle)
{
int ret = MM_ERROR_NONE;
return ret;
}
-int __mm_sound_mgr_ipc_dbus_notify_active_device_changed(int device_in, int device_out)
-{
- return MM_ERROR_SOUND_INTERNAL;
-}
-
-int __mm_sound_mgr_ipc_dbus_notify_available_device_changed(int device_in, int device_out, int available)
-{
- return MM_ERROR_SOUND_INTERNAL;
-}
-
-#define PA_BUS_NAME "org.pulseaudio.Server"
-#define PA_STREAM_MANAGER_OBJECT_PATH "/org/pulseaudio/StreamManager"
-#define PA_STREAM_MANAGER_INTERFACE "org.pulseaudio.StreamManager"
-#define PA_STREAM_MANAGER_METHOD_NAME_GET_STREAM_LIST "GetStreamList"
-int __mm_sound_mgr_ipc_dbus_get_stream_list(stream_list_t* stream_list)
-{
- int ret = MM_ERROR_NONE;
- GVariant *result = NULL;
- GVariant *child = NULL;
- GDBusConnection *conn = NULL;
- GError *err = NULL;
- int i = 0;
-
- conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
- if (!conn && err) {
- LOGE("g_bus_get_sync() error (%s)", err->message);
- g_error_free(err);
- ret = MM_ERROR_SOUND_INTERNAL;
- return ret;
- }
- result = g_dbus_connection_call_sync(conn,
- PA_BUS_NAME,
- PA_STREAM_MANAGER_OBJECT_PATH,
- PA_STREAM_MANAGER_INTERFACE,
- PA_STREAM_MANAGER_METHOD_NAME_GET_STREAM_LIST,
- NULL,
- G_VARIANT_TYPE("(vv)"),
- G_DBUS_CALL_FLAGS_NONE,
- 2000,
- NULL,
- &err);
- if (!result && err) {
- debug_error("g_dbus_connection_call_sync() error (%s)", err->message);
- ret = MM_ERROR_SOUND_INTERNAL;
- } else {
- GVariantIter iter;
- GVariant *item = NULL;
- child = g_variant_get_child_value(result, 0);
- item = g_variant_get_variant(child);
- gchar *name;
- i = 0;
- g_variant_iter_init(&iter, item);
- while ((i < AVAIL_STREAMS_MAX) && g_variant_iter_loop(&iter, "&s", &name)) {
- debug_log("name : %s", name);
- stream_list->stream_types[i++] = strdup(name);
- }
- g_variant_unref(item);
- g_variant_unref(child);
-
- child = g_variant_get_child_value(result, 1);
- item = g_variant_get_variant(child);
- gint32 priority;
- i = 0;
- g_variant_iter_init(&iter, item);
- while ((i < AVAIL_STREAMS_MAX) && g_variant_iter_loop(&iter, "i", &priority)) {
- debug_log("priority : %d", priority);
- stream_list->priorities[i++] = priority;
- }
- g_variant_unref(item);
- g_variant_unref(child);
-
- g_variant_unref(result);
- }
- g_object_unref(conn);
-
- return ret;
-}
-
int MMSoundMgrDbusInit(void)
{
debug_enter();
+++ /dev/null
-/*
- * libmm-sound
- *
- * 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 "include/mm_sound_plugin_run.h"
-#include "include/mm_sound_mgr_run.h"
-#include "include/mm_sound_thread_pool.h"
-
-#include <mm_error.h>
-#include <mm_debug.h>
-
-static void _MMsoundMgrRunRunInternal(void *param);
-
-static MMSoundPluginType *g_run_plugins = NULL;
-
-int MMSoundMgrRunInit(const char *targetdir)
-{
- debug_fenter();
-
- if (g_run_plugins) {
- debug_error("Please Check Init twice\n");
- return MM_ERROR_SOUND_INTERNAL;
- }
- MMSoundPluginScan(targetdir, MM_SOUND_PLUGIN_TYPE_RUN, &g_run_plugins);
-
- debug_fleave();
- return MM_ERROR_NONE;
-}
-
-int MMSoundMgrRunFini(void)
-{
- debug_fenter();
-
- MMSoundPluginRelease(g_run_plugins);
- g_run_plugins = NULL;
-
- debug_fleave();
- return MM_ERROR_NONE;
-}
-
-int MMSoundMgrRunRunAll(void)
-{
- int loop = 0;
-
- debug_fenter();
-
- while (g_run_plugins[loop].type != MM_SOUND_PLUGIN_TYPE_NONE) {
- MMSoundThreadPoolRun((void*)loop, _MMsoundMgrRunRunInternal);
- loop++;
- }
-
- debug_fleave();
- return MM_ERROR_NONE;
-}
-
-int MMSoundMgrRunStopAll(void)
-{
- mmsound_run_interface_t intface;
- void *func = NULL;
- int loop = 0;
-
- debug_fenter();
-
- while (g_run_plugins && g_run_plugins[loop].type != MM_SOUND_PLUGIN_TYPE_NONE) {
- debug_msg("loop : %d\n", loop);
- MMSoundPluginGetSymbol(&g_run_plugins[loop], RUN_GET_INTERFACE_FUNC_NAME, &func);
- MMSoundPlugRunCastGetInterface(func)(&intface);
- intface.stop();
- loop++;
- }
-
- debug_fleave();
- return MM_ERROR_NONE;
-}
-
-static void _MMsoundMgrRunRunInternal(void *param)
-{
- int err = MM_ERROR_NONE;
- mmsound_run_interface_t intface;
- void* func = NULL;
-
- debug_enter("plugin number %d\n", (int)param);
-
- err = MMSoundPluginGetSymbol(&g_run_plugins[(int)param], RUN_GET_INTERFACE_FUNC_NAME, &func);
- if (err != MM_ERROR_NONE) {
- debug_error("Get Symbol RUN_GET_INTERFACE_FUNC_NAME is fail : %x\n", err);
- }
- err = MMSoundPlugRunCastGetInterface(func)(&intface);
- if (err != MM_ERROR_NONE) {
- debug_error("Get interface fail : %x\n", err);
- /* If error occur, clean interface */
- //memset(&g_run_plugins[(int)param], 0, sizeof(mmsound_run_interface_t));
- }
- if(intface.SetThreadPool)
- intface.SetThreadPool(MMSoundThreadPoolRun);
- intface.run();
- debug_msg("Trace\n");
- debug_msg("Trace\n");
-
- debug_fleave();
-}
-
static int _MMSoundPluginGetList(const char *plugdir ,char ***list);
static int _MMSoundPluginDestroyList(char **list);
-char* MMSoundPluginGetTypeName(int type)
-{
- static char *typename[] = {
- "ERROR",
- "SOUND",
- "RUN",
- };
-
- if (type < MM_SOUND_PLUGIN_TYPE_LAST && type > -1)
- return typename[type];
- else
- return "Unknown"; /* error condition */
-}
-
int MMSoundPluginScan(const char *plugindir, const int type, MMSoundPluginType **pluginlist)
{
char **list = NULL;
#include "../include/mm_sound_common.h"
#include "include/mm_sound_thread_pool.h"
-#include "include/mm_sound_mgr_run.h"
#include "include/mm_sound_mgr_codec.h"
#include "include/mm_sound_mgr_ipc_dbus.h"
{
int ret = MM_ERROR_NONE;
- ret = MMSoundMgrRunStopAll();
- if (ret != MM_ERROR_NONE) {
- debug_error("Fail to stop run-plugin\n");
- } else {
- debug_log("All run-type plugin stopped\n");
- }
-
switch(sig) {
case SIGINT:
sigaction(SIGINT, &sigint_action, NULL);
if (serveropt.startserver || serveropt.printlist) {
MMSoundMgrDbusInit();
MMSoundThreadPoolInit();
- MMSoundMgrRunInit(serveropt.plugdir);
MMSoundMgrCodecInit(serveropt.plugdir, _shutdown_cb);
}
debug_warning("sound_server [%d] initialization complete...now, start running!!\n", getpid());
if (serveropt.startserver) {
- /* Start Run types */
- MMSoundMgrRunRunAll();
-
/* Start MainLoop */
_mainloop_run();
}
debug_warning("sound_server [%d] terminating \n", getpid());
if (serveropt.startserver || serveropt.printlist) {
- MMSoundMgrRunStopAll();
MMSoundMgrCodecFini();
- MMSoundMgrRunFini();
MMSoundThreadPoolFini();
MMSoundMgrDbusFini();
}
int (*stop_cb)(int);
char filename[MM_SOUND_MAX_FILENAME];
int cb_param;
- char stream_type[MM_SOUND_STREAM_TYPE_LEN];
+ char stream_type[MAX_STREAM_TYPE_LEN];
int stream_index;
pa_threaded_mainloop *m;
p->cb_param = param->param;
MMSOUND_STRNCPY(p->filename, param->pfilename, MM_SOUND_MAX_FILENAME);
p->stream_index = param->stream_index;
- MMSOUND_STRNCPY(p->stream_type, param->stream_type, MM_SOUND_STREAM_TYPE_LEN);
+ MMSOUND_STRNCPY(p->stream_type, param->stream_type, MAX_STREAM_TYPE_LEN);
ret = _sound_prepare(p);
if (ret < 0) {