--- /dev/null
+CMakeCache.txt
+*/CMakeFiles/*
+*.cmake
+CMakeFiles*
+*.a
+*.so
+Testing
+cmake.depends
+cmake.check_depends
+cmake.check_cache
+core
+core.*
+gmon.out
+install_manifest.txt
+*~
+.kdev_include_paths
+src.kdev4
+.cproject
+.project
+tet_captured
+tet_lock
+*.pc
+*-test
+*-test_*
+*tester.c
+.gitattributes
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_" />
+ </request>
+</manifest>
--- /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__ */
+
+
* limitations under the License.
*/
-
-
-
#ifndef __TIZEN_MEDIA_WAV_PLAYER_H__
#define __TIZEN_MEDIA_WAV_PLAYER_H__
{
#endif
-#define WAV_PLAYER_ERROR_CLASS TIZEN_ERROR_MULTIMEDIA_CLASS | 0x50
-
/**
* @file wav_player.h
- * @brief This file contains the WAV player API
+ * @brief This file contains the WAV player API.
*/
/**
*/
/**
- * @brief Enumerations of error code for WAV player.
+ * @brief Enumeration of error codes for WAV player.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
WAV_PLAYER_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
WAV_PLAYER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
WAV_PLAYER_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */
- WAV_PLAYER_ERROR_FORMAT_NOT_SUPPORTED = WAV_PLAYER_ERROR_CLASS | 0x01 /**< Not supported format */
+ WAV_PLAYER_ERROR_FORMAT_NOT_SUPPORTED = TIZEN_ERROR_WAV_PLAYER | 0x01 /**< Format not supported */
} wav_player_error_e;
/**
- * @}
- */
-
-
-/**
- * @addtogroup CAPI_MEDIA_WAV_PLAYER_MODULE
- * @{
- */
-
-/**
- * @brief Called when a WAV file has finished playing.
+ * @brief Called when a WAV file is no longer being played.
* @details This callback is not invoked by calling wav_player_stop().
- *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] id The completed wav player ID
* @param[in] user_data The user data passed from the callback registration function
* @see wav_player_start()
*/
typedef void (*wav_player_playback_completed_cb)(int id, void *user_data);
-
/**
* @brief Plays a WAV file.
- * @param[in] path The WAV file path to play
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] path The WAV file path to the file to be played
* @param[in] type The sound type
- * @param[in] callback The callback function to invoke when a WAV file is finished playing
+ * @param[in] callback The callback function to be invoked when a WAV file is no longer being played
* @param[in] user_data The user data to be passed to the callback function
- * @param[out] id The WAV player ID ( can be set to NULL )
+ * @param[out] id The WAV player ID (can be set to @c NULL)
*
- * @return 0 on success, otherwise a negative error value.
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #WAV_PLAYER_ERROR_NONE Successful
- * @retval #WAV_PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WAV_PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WAV_PLAYER_ERROR_INVALID_OPERATION Invalid operation
*
- * @post It invokes wav_player_playback_completed_cb() when a WAV file has finished playing.
+ * @post It invokes wav_player_playback_completed_cb() when a WAV file is no longer being played.
* @see wav_player_stop()
* @see wav_player_playback_completed_cb()
*/
/**
* @brief Stops playing the WAV file.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] id The WAV player ID to stop
*
- * @param[in] id The WAV player ID to stop
- *
- * @return 0 on success, otherwise a negative error value.
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #WAV_PLAYER_ERROR_NONE Successful
* @retval #WAV_PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WAV_PLAYER_ERROR_INVALID_OPERATION Invalid operation
--- /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__ */
#sbs-git:slp/api/wav-player capi-media-wav-player 0.1.0 8d904bb3bd0ca7fa01ebd8f4185e4b993d94c08d
Name: capi-media-wav-player
-Summary: A wav player library in Tizen C API
-Version: 0.1.0
-Release: 10
+Summary: A wav player library in SLP C API
+Version: 0.1.12
+Release: 0
Group: TO_BE/FILLED_IN
-License: TO BE FILLED IN
+License: Apache License, Version 2.0
Source0: %{name}-%{version}.tar.gz
BuildRequires: cmake
BuildRequires: pkgconfig(mm-sound)
BuildRequires: pkgconfig(capi-media-sound-manager)
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
+Requires(post): libprivilege-control
%description
%package devel
-Summary: A wav player library in Tizen C API (Development)
+Summary: A wav player library in SLP C API (Development)
Group: TO_BE/FILLED_IN
Requires: %{name} = %{version}-%{release}
%description devel
-
%prep
%setup -q
%install
rm -rf %{buildroot}
+mkdir -p %{buildroot}/usr/share/license
+cp LICENSE %{buildroot}/usr/share/license/%{name}
+mkdir -p %{buildroot}/usr/share/privilege-control
+
%make_install
-%post -p /sbin/ldconfig
+%post
+/sbin/ldconfig
+/usr/bin/api_feature_loader --verbose --dir=/usr/share/privilege-control
%postun -p /sbin/ldconfig
%files
%{_libdir}/libcapi-media-wav-player.so.*
+%{_datadir}/license/%{name}
+%manifest capi-media-wav-player.manifest
%files devel
%{_includedir}/media/*.h
*/
-#define LOG_TAG "TIZEN_N_WAV_PLAYER"
+#define LOG_TAG "CAPI_MEDIA_WAV_PLAYER"
#include <mm_sound.h>
#include <mm_sound_private.h>
#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);
+}
+
MESSAGE(${flag})
ENDFOREACH()
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -pie")
#ADD_EXECUTABLE("system-sensor" system-sensor.c)
#TARGET_LINK_LIBRARIES("system-sensor" ${fw_name} ${${fw_test}_LDFLAGS})