-Seungkeun Lee <sngn.lee@samsung.com>
-Kangho Hur <kanho.hur@samsung.com>
Seungbae Shin <seungbae.shin at samsung dot com>
+Doohwan Kim <dh8210.kim at samsung dot com>
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
IF("${ARCH}" MATCHES "^arm.*")
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_MEDIA_WAV_PLAYER_DOC_H__
+#define __TIZEN_MEDIA_WAV_PLAYER_DOC_H__
+
+
+/**
+ * @file wave_player_doc.h
+ * @brief This file contains high level documentation for the WAV Player API.
+ *
+ */
+
+/**
+ * @ingroup CAPI_MEDIA_FRAMEWORK
+ * @defgroup CAPI_MEDIA_WAV_PLAYER_MODULE WAV Player
+ */
+
+/**
+ * @ingroup CAPI_MEDIA_FRAMEWORK
+ * @addtogroup CAPI_MEDIA_WAV_PLAYER_MODULE
+ * @brief The @ref CAPI_MEDIA_WAV_PLAYER_MODULE API provides functions for playing the waveform audio file format(*.wav).
+ * @section CAPI_MEDIA_WAV_PLAYER_MODULE_HEADER Required Header
+ * \#include <wav_player.h>
+ *
+ * @section CAPI_MEDIA_WAV_PLAYER_OVERVIEW Overview
+ * The @ref CAPI_MEDIA_WAV_PLAYER_MODULE API allows you to simply play and stop a wav file. To play a certain wav file, call wave_player_start() with a path to the .wav file.
+ * When playing a wav file is finished, wav_player_playback_completed_cb() will be invoked.
+ */
+
+#endif /* __TIZEN_MEDIA_WAV_PLAYER_DOC_H__ */
+
+
--- /dev/null
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* 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 __TIZEN_MEDIA_WAV_PLAYER_PRIVATE_H__
+#define __TIZEN_MEDIA_WAV_PLAYER_PRIVATE_H__
+
+#include <tizen.h>
+#include <sound_manager.h>
+#include <sound_manager_internal.h>
+#include <wav_player.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#define WAV_PLAYER_ERROR_CLASS TIZEN_ERROR_MULTIMEDIA_CLASS | 0x50
+
+/**
+ * @file wav_player_private.h
+ * @brief This file contains the WAV player API
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_WAV_PLAYER_MODULE
+ * @{
+ */
+
+
+typedef struct _cb_data_{
+ wav_player_playback_completed_cb cb;
+ void * user_data;
+} _cb_data;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+int __convert_wav_player_error_code(const char *func, int code);
+void __internal_complete_cb(void *user_data, int id);
+
+#endif /* __TIZEN_MEDIA_WAV_PLAYER_PRIVATE_H__ */
Name: capi-media-wav-player
Summary: A wav player library in Tizen C API
-Version: 0.1.0
+Version: 0.1.1
Release: 0
Group: Multimedia/API
License: Apache-2.0
#include <string.h>
#include <unistd.h>
#include <dlog.h>
-#include <wav_player.h>
+#include "wav_player.h"
+#include "wav_player_private.h"
#include <stdlib.h>
-typedef struct _cb_data_{
- wav_player_playback_completed_cb cb;
- void * uesr_data;
- int id;
-} _cb_data;
-
-
-
-static int __convert_wav_player_error_code(const char *func, int code){
- int ret = WAV_PLAYER_ERROR_INVALID_OPERATION;
- char *errorstr = NULL;
- switch(code)
- {
- case MM_ERROR_NONE:
- ret = WAV_PLAYER_ERROR_NONE;
- errorstr = "ERROR_NONE";
- break;
- case MM_ERROR_INVALID_ARGUMENT:
- case MM_ERROR_SOUND_INVALID_POINTER:
- case WAV_PLAYER_ERROR_INVALID_PARAMETER:
- ret = WAV_PLAYER_ERROR_INVALID_PARAMETER;
- errorstr = "INVALID_PARAMETER";
- break;
- case MM_ERROR_SOUND_INTERNAL:
- ret = WAV_PLAYER_ERROR_INVALID_OPERATION;
- errorstr = "INVALID_OPERATION";
- break;
- case MM_ERROR_SOUND_UNSUPPORTED_MEDIA_TYPE:
- ret = WAV_PLAYER_ERROR_FORMAT_NOT_SUPPORTED;
- errorstr = "FORMAT_NOT_SUPPORTED";
- break;
- default:
- ret = WAV_PLAYER_ERROR_INVALID_OPERATION;
- errorstr = "INVALID_OPERATION";
-
- }
- LOGE( "[%s] %s(0x%08x)",func, errorstr, ret);
- return ret;
-}
-
-
-static void __internal_complete_cb(void *user_data){
- _cb_data * cb_data = (_cb_data*)user_data;
- if(!cb_data)
- return;
-
- if( cb_data->cb )
- cb_data->cb(cb_data->id, cb_data->uesr_data);
- free(cb_data);
-}
-
-
-int wav_player_start(const char *path, sound_type_e type , wav_player_playback_completed_cb cb, void *user_data, int * id){
- int ret ;
- int player;
+int wav_player_start(const char *path, sound_type_e type, wav_player_playback_completed_cb cb, void *user_data, int * id)
+{
+ int ret = MM_ERROR_NONE;
+ int player = -1;
char m_path[PATH_MAX];
- void (*_completed_cb)(void *);
+ void (*_completed_cb)(void *, int);
_completed_cb = NULL;
_cb_data *cb_data = NULL;
-
-
+
+
if( path == NULL)
return __convert_wav_player_error_code(__func__, WAV_PLAYER_ERROR_INVALID_PARAMETER);
- if( type < SOUND_TYPE_SYSTEM || type > SOUND_TYPE_CALL )
+ if( type < SOUND_TYPE_SYSTEM || type >= SOUND_TYPE_NUM )
return __convert_wav_player_error_code(__func__, WAV_PLAYER_ERROR_INVALID_PARAMETER);
m_path[0] = '\0';
if(cb_data == NULL )
return __convert_wav_player_error_code(__func__, WAV_PLAYER_ERROR_INVALID_OPERATION);
cb_data->cb = cb;
- cb_data->uesr_data = user_data;
+ cb_data->user_data = user_data;
}
-
+
+
ret = mm_sound_play_sound(m_path, type, _completed_cb , cb_data, &player);
- if( ret == 0 && id != NULL)
- *id = player;
- if( ret == 0 && cb_data )
- cb_data->id = player;
-
+
+ if( ret == 0 && id != NULL){
+ *id = player;
+ }
+
if( ret != 0 && cb_data != NULL)
free(cb_data);
-
return __convert_wav_player_error_code(__func__, ret);
}
-int wav_player_stop(int id){
+int wav_player_stop(int id)
+{
return __convert_wav_player_error_code(__func__, mm_sound_stop_sound(id));
}
--- /dev/null
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* 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.
+*/
+
+
+#define LOG_TAG "CAPI_MEDIA_WAV_PLAYER"
+
+#include <mm_sound.h>
+#include <mm_sound_private.h>
+#include <stdio.h>
+#include <limits.h>
+#include <string.h>
+#include <unistd.h>
+#include <dlog.h>
+#include <stdlib.h>
+#include "wav_player_private.h"
+
+int __convert_wav_player_error_code(const char *func, int code)
+{
+ int ret = WAV_PLAYER_ERROR_INVALID_OPERATION;
+ char *errorstr = NULL;
+ switch(code)
+ {
+ case MM_ERROR_NONE:
+ ret = WAV_PLAYER_ERROR_NONE;
+ errorstr = "ERROR_NONE";
+ break;
+ case MM_ERROR_INVALID_ARGUMENT:
+ case MM_ERROR_SOUND_INVALID_POINTER:
+ case WAV_PLAYER_ERROR_INVALID_PARAMETER:
+ ret = WAV_PLAYER_ERROR_INVALID_PARAMETER;
+ errorstr = "INVALID_PARAMETER";
+ break;
+ case MM_ERROR_SOUND_INTERNAL:
+ ret = WAV_PLAYER_ERROR_INVALID_OPERATION;
+ errorstr = "INVALID_OPERATION";
+ break;
+ case MM_ERROR_SOUND_UNSUPPORTED_MEDIA_TYPE:
+ ret = WAV_PLAYER_ERROR_FORMAT_NOT_SUPPORTED;
+ errorstr = "FORMAT_NOT_SUPPORTED";
+ break;
+ default:
+ ret = WAV_PLAYER_ERROR_INVALID_OPERATION;
+ errorstr = "INVALID_OPERATION";
+ break;
+ }
+ LOGE( "[%s] %s(0x%08x)",func, errorstr, ret);
+ return ret;
+}
+
+
+void __internal_complete_cb(void *user_data, int id)
+{
+ _cb_data * cb_data = (_cb_data*)user_data;
+ if(!cb_data)
+ return;
+
+ if( cb_data->cb ){
+ LOGD( "user callback for handle %d call", id);
+ cb_data->cb(id, cb_data->user_data);
+ }
+ free(cb_data);
+}
+