--- /dev/null
+Jeongmo Yang <jm80.yang at samsung dot com>
+Hyuntae Kim <ht1211.kim at samsung dot com>
+Sejong Park <sejong123.park at samsung dot com>
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+SET(Services
+ "application"
+ "base"
+ "content"
+ "location"
+ "media"
+ "messaging"
+ "network"
+ "social"
+ "telephony"
+ "system"
+ )
+
+# project
+SET(prefix "/usr")
+SET(version "0.0.1")
+SET(maintainer "Jeongmo Yang<jm80.yang>, Hyuntae Kim<ht1211.kim@samsung.com>, Sejong Park<sejong123.park@samsung.com>")
+SET(description "A Camera library in Tizen Native API")
+SET(service "mmsvc")
+SET(submodule "recorder")
+
+# for package file
+SET(dependents "dlog mm-camcorder mmsvc-camera capi-media-audio-io audio-session-mgr")
+SET(pc_dependents "capi-base-common mmsvc-camera capi-media-audio-io")
+
+SET(fw_name "${service}-${submodule}")
+
+PROJECT(${fw_name})
+
+SET(CMAKE_INSTALL_PREFIX ${prefix})
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(VERSION ${version})
+
+SET(INC_DIR include)
+INCLUDE_DIRECTORIES(${INC_DIR})
+
+SET(MUSED_INC_DIR muse/include)
+INCLUDE_DIRECTORIES(${MUSED_INC_DIR})
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_name} REQUIRED ${dependents})
+FOREACH(flag ${${fw_name}_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Wextra -Wno-array-bounds -Wno-empty-body -Wno-ignored-qualifiers -Wno-unused-parameter -Wshadow -Wwrite-strings -Wswitch-default -Wno-unused-but-set-parameter -Wno-unused-but-set-variable")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+
+IF("${ARCH}" STREQUAL "arm")
+ ADD_DEFINITIONS("-DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DTIZEN_DEBUG")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
+
+aux_source_directory(src SOURCES)
+ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
+
+TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
+
+SET_TARGET_PROPERTIES(${fw_name}
+ PROPERTIES
+ VERSION ${FULLVER}
+ SOVERSION ${MAJORVER}
+ CLEAN_DIRECT_OUTPUT 1
+)
+
+INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(
+ DIRECTORY ${INC_DIR}/ DESTINATION include/media
+ FILES_MATCHING
+ PATTERN "*_private.h" EXCLUDE
+ PATTERN "${INC_DIR}/*.h"
+ )
+
+SET(PC_NAME ${fw_name})
+SET(PC_REQUIRED ${pc_dependents})
+SET(PC_LDFLAGS -l${fw_name})
+
+CONFIGURE_FILE(
+ ${fw_name}.pc.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
+ @ONLY
+)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
+#ADD_SUBDIRECTORY(test)
+ADD_SUBDIRECTORY(muse)
+
+IF(UNIX)
+
+ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution)
+ADD_CUSTOM_COMMAND(
+ DEPENDS clean
+ COMMENT "distribution clean"
+ COMMAND find
+ ARGS .
+ -not -name config.cmake -and \(
+ -name tester.c -or
+ -name Testing -or
+ -name CMakeFiles -or
+ -name cmake.depends -or
+ -name cmake.check_depends -or
+ -name CMakeCache.txt -or
+ -name cmake.check_cache -or
+ -name *.cmake -or
+ -name Makefile -or
+ -name core -or
+ -name core.* -or
+ -name gmon.out -or
+ -name install_manifest.txt -or
+ -name *.pc -or
+ -name *~ \)
+ | grep -v TC | xargs rm -rf
+ TARGET distclean
+ VERBATIM
+)
+
+ENDIF(UNIX)
--- /dev/null
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+\r
+ Apache License\r
+ Version 2.0, January 2004\r
+ http://www.apache.org/licenses/\r
+\r
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r
+\r
+ 1. Definitions.\r
+\r
+ "License" shall mean the terms and conditions for use, reproduction,\r
+ and distribution as defined by Sections 1 through 9 of this document.\r
+\r
+ "Licensor" shall mean the copyright owner or entity authorized by\r
+ the copyright owner that is granting the License.\r
+\r
+ "Legal Entity" shall mean the union of the acting entity and all\r
+ other entities that control, are controlled by, or are under common\r
+ control with that entity. For the purposes of this definition,\r
+ "control" means (i) the power, direct or indirect, to cause the\r
+ direction or management of such entity, whether by contract or\r
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the\r
+ outstanding shares, or (iii) beneficial ownership of such entity.\r
+\r
+ "You" (or "Your") shall mean an individual or Legal Entity\r
+ exercising permissions granted by this License.\r
+\r
+ "Source" form shall mean the preferred form for making modifications,\r
+ including but not limited to software source code, documentation\r
+ source, and configuration files.\r
+\r
+ "Object" form shall mean any form resulting from mechanical\r
+ transformation or translation of a Source form, including but\r
+ not limited to compiled object code, generated documentation,\r
+ and conversions to other media types.\r
+\r
+ "Work" shall mean the work of authorship, whether in Source or\r
+ Object form, made available under the License, as indicated by a\r
+ copyright notice that is included in or attached to the work\r
+ (an example is provided in the Appendix below).\r
+\r
+ "Derivative Works" shall mean any work, whether in Source or Object\r
+ form, that is based on (or derived from) the Work and for which the\r
+ editorial revisions, annotations, elaborations, or other modifications\r
+ represent, as a whole, an original work of authorship. For the purposes\r
+ of this License, Derivative Works shall not include works that remain\r
+ separable from, or merely link (or bind by name) to the interfaces of,\r
+ the Work and Derivative Works thereof.\r
+\r
+ "Contribution" shall mean any work of authorship, including\r
+ the original version of the Work and any modifications or additions\r
+ to that Work or Derivative Works thereof, that is intentionally\r
+ submitted to Licensor for inclusion in the Work by the copyright owner\r
+ or by an individual or Legal Entity authorized to submit on behalf of\r
+ the copyright owner. For the purposes of this definition, "submitted"\r
+ means any form of electronic, verbal, or written communication sent\r
+ to the Licensor or its representatives, including but not limited to\r
+ communication on electronic mailing lists, source code control systems,\r
+ and issue tracking systems that are managed by, or on behalf of, the\r
+ Licensor for the purpose of discussing and improving the Work, but\r
+ excluding communication that is conspicuously marked or otherwise\r
+ designated in writing by the copyright owner as "Not a Contribution."\r
+\r
+ "Contributor" shall mean Licensor and any individual or Legal Entity\r
+ on behalf of whom a Contribution has been received by Licensor and\r
+ subsequently incorporated within the Work.\r
+\r
+ 2. Grant of Copyright License. Subject to the terms and conditions of\r
+ this License, each Contributor hereby grants to You a perpetual,\r
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+ copyright license to reproduce, prepare Derivative Works of,\r
+ publicly display, publicly perform, sublicense, and distribute the\r
+ Work and such Derivative Works in Source or Object form.\r
+\r
+ 3. Grant of Patent License. Subject to the terms and conditions of\r
+ this License, each Contributor hereby grants to You a perpetual,\r
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+ (except as stated in this section) patent license to make, have made,\r
+ use, offer to sell, sell, import, and otherwise transfer the Work,\r
+ where such license applies only to those patent claims licensable\r
+ by such Contributor that are necessarily infringed by their\r
+ Contribution(s) alone or by combination of their Contribution(s)\r
+ with the Work to which such Contribution(s) was submitted. If You\r
+ institute patent litigation against any entity (including a\r
+ cross-claim or counterclaim in a lawsuit) alleging that the Work\r
+ or a Contribution incorporated within the Work constitutes direct\r
+ or contributory patent infringement, then any patent licenses\r
+ granted to You under this License for that Work shall terminate\r
+ as of the date such litigation is filed.\r
+\r
+ 4. Redistribution. You may reproduce and distribute copies of the\r
+ Work or Derivative Works thereof in any medium, with or without\r
+ modifications, and in Source or Object form, provided that You\r
+ meet the following conditions:\r
+\r
+ (a) You must give any other recipients of the Work or\r
+ Derivative Works a copy of this License; and\r
+\r
+ (b) You must cause any modified files to carry prominent notices\r
+ stating that You changed the files; and\r
+\r
+ (c) You must retain, in the Source form of any Derivative Works\r
+ that You distribute, all copyright, patent, trademark, and\r
+ attribution notices from the Source form of the Work,\r
+ excluding those notices that do not pertain to any part of\r
+ the Derivative Works; and\r
+\r
+ (d) If the Work includes a "NOTICE" text file as part of its\r
+ distribution, then any Derivative Works that You distribute must\r
+ include a readable copy of the attribution notices contained\r
+ within such NOTICE file, excluding those notices that do not\r
+ pertain to any part of the Derivative Works, in at least one\r
+ of the following places: within a NOTICE text file distributed\r
+ as part of the Derivative Works; within the Source form or\r
+ documentation, if provided along with the Derivative Works; or,\r
+ within a display generated by the Derivative Works, if and\r
+ wherever such third-party notices normally appear. The contents\r
+ of the NOTICE file are for informational purposes only and\r
+ do not modify the License. You may add Your own attribution\r
+ notices within Derivative Works that You distribute, alongside\r
+ or as an addendum to the NOTICE text from the Work, provided\r
+ that such additional attribution notices cannot be construed\r
+ as modifying the License.\r
+\r
+ You may add Your own copyright statement to Your modifications and\r
+ may provide additional or different license terms and conditions\r
+ for use, reproduction, or distribution of Your modifications, or\r
+ for any such Derivative Works as a whole, provided Your use,\r
+ reproduction, and distribution of the Work otherwise complies with\r
+ the conditions stated in this License.\r
+\r
+ 5. Submission of Contributions. Unless You explicitly state otherwise,\r
+ any Contribution intentionally submitted for inclusion in the Work\r
+ by You to the Licensor shall be under the terms and conditions of\r
+ this License, without any additional terms or conditions.\r
+ Notwithstanding the above, nothing herein shall supersede or modify\r
+ the terms of any separate license agreement you may have executed\r
+ with Licensor regarding such Contributions.\r
+\r
+ 6. Trademarks. This License does not grant permission to use the trade\r
+ names, trademarks, service marks, or product names of the Licensor,\r
+ except as required for reasonable and customary use in describing the\r
+ origin of the Work and reproducing the content of the NOTICE file.\r
+\r
+ 7. Disclaimer of Warranty. Unless required by applicable law or\r
+ agreed to in writing, Licensor provides the Work (and each\r
+ Contributor provides its Contributions) on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r
+ implied, including, without limitation, any warranties or conditions\r
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r
+ PARTICULAR PURPOSE. You are solely responsible for determining the\r
+ appropriateness of using or redistributing the Work and assume any\r
+ risks associated with Your exercise of permissions under this License.\r
+\r
+ 8. Limitation of Liability. In no event and under no legal theory,\r
+ whether in tort (including negligence), contract, or otherwise,\r
+ unless required by applicable law (such as deliberate and grossly\r
+ negligent acts) or agreed to in writing, shall any Contributor be\r
+ liable to You for damages, including any direct, indirect, special,\r
+ incidental, or consequential damages of any character arising as a\r
+ result of this License or out of the use or inability to use the\r
+ Work (including but not limited to damages for loss of goodwill,\r
+ work stoppage, computer failure or malfunction, or any and all\r
+ other commercial damages or losses), even if such Contributor\r
+ has been advised of the possibility of such damages.\r
+\r
+ 9. Accepting Warranty or Additional Liability. While redistributing\r
+ the Work or Derivative Works thereof, You may choose to offer,\r
+ and charge a fee for, acceptance of support, warranty, indemnity,\r
+ or other liability obligations and/or rights consistent with this\r
+ License. However, in accepting such obligations, You may act only\r
+ on Your own behalf and on Your sole responsibility, not on behalf\r
+ of any other Contributor, and only if You agree to indemnify,\r
+ defend, and hold each Contributor harmless for any liability\r
+ incurred by, or claims asserted against, such Contributor by reason\r
+ of your accepting any such warranty or additional liability.\r
+\r
+ END OF TERMS AND CONDITIONS\r
+\r
+ APPENDIX: How to apply the Apache License to your work.\r
+\r
+ To apply the Apache License to your work, attach the following\r
+ boilerplate notice, with the fields enclosed by brackets "[]"\r
+ replaced with your own identifying information. (Don't include\r
+ the brackets!) The text should be enclosed in the appropriate\r
+ comment syntax for the file format. We also recommend that a\r
+ file or class name and description of purpose be included on the\r
+ same "printed page" as the copyright notice for easier\r
+ identification within third-party archives.\r
+\r
+ Copyright [yyyy] [name of copyright owner]\r
+\r
+ Licensed under the Apache License, Version 2.0 (the "License");\r
+ you may not use this file except in compliance with the License.\r
+ You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
+\r
+\r
--- /dev/null
+Copyright (c) Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE.APLv2 file for Apache License terms and conditions.
--- /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_MULTIMEDIA_RECORDER_H__
+#define __TIZEN_MULTIMEDIA_RECORDER_H__
+#include <tizen.h>
+#include <mmsvc_camera.h>
+#include <audio_io.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define RECORDER_ERROR_CLASS TIZEN_ERROR_RECORDER | 0x10
+
+/**
+ * @file recorder.h
+ * @brief This file contains the Recorder API.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_RECORDER_MODULE
+ * @{
+ */
+
+/**
+ * @brief The Media recorder handle.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef struct recorder_s *recorder_h;
+
+/**
+ * @brief Enumeration for error code of the media recorder.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef enum
+{
+ RECORDER_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ RECORDER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+ RECORDER_ERROR_INVALID_STATE = RECORDER_ERROR_CLASS | 0x02, /**< Invalid state */
+ RECORDER_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY , /**< Out of memory */
+ RECORDER_ERROR_DEVICE = RECORDER_ERROR_CLASS | 0x04, /**< Device error */
+ RECORDER_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Internal error */
+ RECORDER_ERROR_SOUND_POLICY = RECORDER_ERROR_CLASS | 0x06, /**< Blocked by Audio Session Manager */
+ RECORDER_ERROR_SECURITY_RESTRICTED = RECORDER_ERROR_CLASS | 0x07, /**< Restricted by security system policy */
+ RECORDER_ERROR_SOUND_POLICY_BY_CALL = RECORDER_ERROR_CLASS | 0x08, /**< Blocked by Audio Session Manager - CALL */
+ RECORDER_ERROR_SOUND_POLICY_BY_ALARM = RECORDER_ERROR_CLASS | 0x09, /**< Blocked by Audio Session Manager - ALARM */
+ RECORDER_ERROR_ESD = RECORDER_ERROR_CLASS | 0x0a, /**< ESD situation */
+ RECORDER_ERROR_OUT_OF_STORAGE = RECORDER_ERROR_CLASS | 0x0b, /**< Out of storage */
+ RECORDER_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< The access to the resources can not be granted */
+ RECORDER_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< The feature is not supported */
+} recorder_error_e;
+
+/**
+ * @brief Enumeration for recorder states.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef enum
+{
+ RECORDER_STATE_NONE, /**< Recorder is not created */
+ RECORDER_STATE_CREATED, /**< Recorder is created, but not prepared */
+ RECORDER_STATE_READY, /**< Recorder is ready to record \n In case of video recorder, preview display will be shown */
+ RECORDER_STATE_RECORDING, /**< Recorder is recording media */
+ RECORDER_STATE_PAUSED, /**< Recorder is paused while recording media */
+} recorder_state_e;
+
+/**
+ * @brief Enumeration for the recording limit.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef enum
+{
+ RECORDER_RECORDING_LIMIT_TIME, /**< Time limit (second) of recording file */
+ RECORDER_RECORDING_LIMIT_SIZE, /**< Size limit (kilo bytes [KB]) of recording file */
+ RECORDER_RECORDING_LIMIT_FREE_SPACE, /**< No free space in storage */
+} recorder_recording_limit_type_e;
+
+/**
+ * @brief Enumeration for the file container format.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef enum
+{
+ RECORDER_FILE_FORMAT_3GP, /**< 3GP file format */
+ RECORDER_FILE_FORMAT_MP4, /**< MP4 file format */
+ RECORDER_FILE_FORMAT_AMR, /**< AMR file format */
+ RECORDER_FILE_FORMAT_ADTS, /**< ADTS file format */
+ RECORDER_FILE_FORMAT_WAV, /**< WAV file format */
+ RECORDER_FILE_FORMAT_OGG, /**< OGG file format */
+} recorder_file_format_e;
+
+/**
+ * @brief Enumeration for the audio codec.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef enum
+{
+ RECORDER_AUDIO_CODEC_DISABLE = -1, /**< Disable audio track */
+ RECORDER_AUDIO_CODEC_AMR = 0, /**< AMR codec */
+ RECORDER_AUDIO_CODEC_AAC, /**< AAC codec */
+ RECORDER_AUDIO_CODEC_VORBIS, /**< Vorbis codec */
+ RECORDER_AUDIO_CODEC_PCM /**< PCM codec */
+} recorder_audio_codec_e;
+
+/**
+ * @brief Enumeration for the video codec.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef enum
+{
+ RECORDER_VIDEO_CODEC_H263, /**< H263 codec */
+ RECORDER_VIDEO_CODEC_H264, /**< H264 codec */
+ RECORDER_VIDEO_CODEC_MPEG4, /**< MPEG4 codec */
+ RECORDER_VIDEO_CODEC_THEORA /**< Theora codec */
+} recorder_video_codec_e;
+
+/**
+ * @brief Enumeration for audio capture devices.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef enum
+{
+ RECORDER_AUDIO_DEVICE_MIC, /**< Mic device */
+ RECORDER_AUDIO_DEVICE_MODEM, /**< Modem */
+} recorder_audio_device_e;
+
+/**
+ * @brief Enumeration for the recorder rotation type.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef enum
+{
+ RECORDER_ROTATION_NONE, /**< No rotation */
+ RECORDER_ROTATION_90, /**< 90 degree rotation */
+ RECORDER_ROTATION_180, /**< 180 degree rotation */
+ RECORDER_ROTATION_270, /**< 270 degree rotation */
+} recorder_rotation_e;
+
+/**
+ * @brief Enumeration for the recorder policy.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef enum
+{
+ RECORDER_POLICY_NONE = 0, /**< None */
+ RECORDER_POLICY_SOUND, /**< Sound policy */
+ RECORDER_POLICY_SOUND_BY_CALL, /**< Sound policy by CALL */
+ RECORDER_POLICY_SOUND_BY_ALARM, /**< Sound policy by ALARM */
+ RECORDER_POLICY_SECURITY /**< Security policy */
+} recorder_policy_e;
+
+/**
+ * @}
+*/
+
+/**
+ * @addtogroup CAPI_MEDIA_RECORDER_MODULE
+ * @{
+ */
+
+/**
+ * @brief Called when limitation error occurs while recording.
+ * @details The callback function is possible to receive three types of limits: time, size and no-space.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks After being called, recording data is discarded and not written in the recording file. Also the state of recorder is not changed.
+ * @param[in] type The imitation type
+ * @param[in] user_data The user data passed from the callback registration function
+ * @pre You have to register a callback using recorder_set_recording_limit_reached_cb().
+ * @see recorder_set_recording_status_cb()
+ * @see recorder_set_recording_limit_reached_cb()
+ * @see recorder_unset_recording_limit_reached_cb()
+ */
+typedef void (*recorder_recording_limit_reached_cb)(recorder_recording_limit_type_e type, void *user_data);
+
+/**
+ * @brief Called to indicate the recording status.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks This callback function is repeatedly invoked during the #RECORDER_STATE_RECORDING state.
+ * @param[in] elapsed_time The time of the recording (milliseconds)
+ * @param[in] file_size The size of the recording file (KB)
+ * @param[in] user_data The user data passed from the callback registration function
+ * @pre recorder_start() will invoke this callback if you register it using recorder_set_recording_status_cb().
+ * @see recorder_set_recording_status_cb()
+ * @see recorder_unset_recording_status_cb()
+ * @see recorder_start()
+ */
+typedef void (*recorder_recording_status_cb)(unsigned long long elapsed_time, unsigned long long file_size, void *user_data);
+
+/**
+ * @brief Called when the record state is changed.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] previous The previous state of the recorder
+ * @param[in] current The current state of the recorder
+ * @param[in] by_policy @c true if the state is changed by policy, otherwise @c false if the state is not changed
+ * @param[in] user_data The user data passed from the callback registration function
+ * @pre This function is required to register a callback using recorder_set_state_changed_cb().
+ * @see recorder_set_state_changed_cb()
+ * @see recorder_prepare()
+ * @see recorder_unprepare()
+ * @see recorder_start()
+ * @see recorder_pause()
+ * @see recorder_commit()
+ * @see recorder_cancel()
+ */
+typedef void (*recorder_state_changed_cb)(recorder_state_e previous , recorder_state_e current , bool by_policy, void *user_data);
+
+/**
+ * @brief Called when the recorder is interrupted by a policy.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] policy The policy that is interrupting the recorder
+ * @param[in] previous The previous state of the recorder
+ * @param[in] current The current state of the recorder
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see recorder_set_interrupted_cb()
+ */
+typedef void (*recorder_interrupted_cb)(recorder_policy_e policy, recorder_state_e previous, recorder_state_e current, void *user_data);
+
+/**
+ * @brief Called when audio stream data was being delivered just before storing in the recorded file.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks The callback function holds the same buffer that will be recorded. \n
+ * So if the user changes the buffer, the result file will contain the buffer.
+ * @remarks The callback is called via internal thread of Frameworks, therefore do not invoke UI API, recorder_unprepare(), recorder_commit() and recorder_cancel() in callback.
+ * @param[in] stream The audio stream data
+ * @param[in] size The size of the stream data
+ * @param[in] format The audio format
+ * @param[in] channel The number of the channel
+ * @param[in] timestamp The timestamp of the stream buffer (in msec)
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see recorder_set_audio_stream_cb()
+ */
+typedef void (*recorder_audio_stream_cb)(void* stream, int size, audio_sample_type_e format, int channel, unsigned int timestamp, void *user_data);
+
+/**
+ * @brief Called once for each supported video resolution.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] width The video image width
+ * @param[in] height The video image height
+ * @param[in] user_data The user data passed from the foreach function
+ * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
+ * @pre recorder_foreach_supported_video_resolution() will invoke this callback.
+ * @see recorder_foreach_supported_video_resolution()
+ */
+typedef bool (*recorder_supported_video_resolution_cb)(int width, int height, void *user_data);
+
+/**
+ * @brief Called when the error occurred.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks This callback informs about the critical error situation. \n
+ * When being invoked, user should release the resource and terminate the application. \n
+ * This error code will be reported.
+ * #RECORDER_ERROR_DEVICE \n
+ * #RECORDER_ERROR_INVALID_OPERATION \n
+ * #RECORDER_ERROR_OUT_OF_MEMORY.
+ * @param[in] error The error code
+ * @param[in] current_state The current state of the recorder
+ * @param[in] user_data The user data passed from the callback registration function
+ * @pre This callback function is invoked if you register this callback using recorder_set_error_cb().
+ * @see recorder_set_error_cb()
+ * @see recorder_unset_error_cb()
+ */
+typedef void (*recorder_error_cb)(recorder_error_e error, recorder_state_e current_state, void *user_data);
+
+ /**
+ * @}
+*/
+
+/**
+ * @addtogroup CAPI_MEDIA_RECORDER_CAPABILITY_MODULE
+ * @{
+ */
+
+/**
+ * @brief Called iteratively to notify about the supported file formats.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] format The format of recording files
+ * @param[in] user_data The user data passed from the foreach function
+ * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
+ * @pre recorder_foreach_supported_file_format() will invoke this callback.
+ * @see recorder_foreach_supported_file_format()
+ */
+typedef bool (*recorder_supported_file_format_cb)(recorder_file_format_e format, void *user_data);
+
+/**
+ * @brief Called iteratively to notify about the supported audio encoders.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] codec The codec of audio encoder
+ * @param[in] user_data The user data passed from the foreach function
+ * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
+ * @pre recorder_foreach_supported_audio_encoder() will invoke this callback.
+ * @see recorder_foreach_supported_audio_encoder()
+ */
+typedef bool (*recorder_supported_audio_encoder_cb)(recorder_audio_codec_e codec, void *user_data);
+
+/**
+ * @brief Called iteratively to notify about the supported video encoders.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] codec The codec of video encoder
+ * @param[in] user_data The user data passed from the foreach function
+ * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
+ * @pre recorder_foreach_supported_video_encoder() will invoke this callback.
+ * @see recorder_foreach_supported_video_encoder()
+ */
+typedef bool (*recorder_supported_video_encoder_cb)(recorder_video_codec_e codec, void *user_data);
+
+/**
+ * @}
+*/
+
+/**
+ * @addtogroup CAPI_MEDIA_RECORDER_MODULE
+ * @{
+ */
+
+/**
+ * @brief Creates a recorder handle to record a video.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/recorder
+ * @remarks You must release @a recorder using recorder_destroy(). \n
+ * The @a camera handle also could be used for capturing images. \n
+ * If the camera state was #CAMERA_STATE_CREATED, the preview format will be changed to the recommended preview format for recording.
+ * @remarks The created recorder state will be different according to camera state : \n
+ * #CAMERA_STATE_CREATED -> #RECORDER_STATE_CREATED\n
+ * #CAMERA_STATE_PREVIEW -> #RECORDER_STATE_READY\n
+ * #CAMERA_STATE_CAPTURED -> #RECORDER_STATE_READY
+ * @param[in] camera The handle to the camera
+ * @param[out] recorder A handle to the recorder
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #RECORDER_ERROR_SOUND_POLICY Sound policy error
+ * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see camera_create()
+ * @see camera_stop_preview()
+ * @see recorder_destroy()
+ */
+int mmsvc_recorder_create_videorecorder(camera_h camera, recorder_h *recorder);
+
+/**
+ * @brief Creates a recorder handle to record an audio.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/recorder
+ * @remarks You must release @a recorder using recorder_destroy().
+ * @param[out] recorder A handle to the recorder
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #RECORDER_ERROR_SOUND_POLICY Sound policy error
+ * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @post The recorder state will be #RECORDER_STATE_CREATED.
+ * @see recorder_destroy()
+ */
+int mmsvc_recorder_create_audiorecorder(recorder_h *recorder);
+
+
+/**
+ * @brief Destroys the recorder handle.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/recorder
+ * @remarks The video recorder's camera handle is not released by this function.
+ * @param[in] recorder The handle to the media recorder
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @pre The recorder state should be #RECORDER_STATE_CREATED.
+ * @post The recorder state will be #RECORDER_STATE_NONE.
+ * @see camera_destroy()
+ * @see recorder_create_videorecorder()
+ * @see recorder_create_audiorecorder()
+ */
+int mmsvc_recorder_destroy(recorder_h recorder);
+
+/**
+ * @brief Prepares the media recorder for recording.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/recorder
+ * @remarks Before calling the function, it is required to properly set audio encoder (recorder_set_audio_encoder()),
+ * video encoder(recorder_set_video_encoder()) and file format (recorder_set_file_format()).
+ * @param[in] recorder The handle to the media recorder
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_SOUND_POLICY Sound policy error
+ * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @pre The recorder state should be #RECORDER_STATE_CREATED by mmsvc_recorder_create_videorecorder(), mmsvc_recorder_create_audiorecorder() or mmsvc_recorder_unprepare().
+ * @post The recorder state will be #RECORDER_STATE_READY.
+ * @post If recorder handle is created by mmsvc_recorder_create_videorecorder(), the camera state will be changed to #CAMERA_STATE_PREVIEW.
+ * @see recorder_create_videorecorder()
+ * @see recorder_create_audiorecorder()
+ * @see recorder_unprepare()
+ * @see recorder_set_audio_encoder()
+ * @see recorder_set_video_encoder()
+ * @see recorder_set_file_format()
+ */
+int mmsvc_recorder_prepare(recorder_h recorder);
+
+/**
+ * @brief Resets the media recorder.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/recorder
+ * @param[in] recorder The handle to the media recorder
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @pre The recorder state should be #RECORDER_STATE_READY set by mmsvc_recorder_prepare(), mmsvc_recorder_cancel() or mmsvc_recorder_commit().
+ * @post The recorder state will be #RECORDER_STATE_CREATED.
+ * @post If the recorder handle is created by mmsvc_recorder_create_videorecorder(), camera state will be changed to #CAMERA_STATE_CREATED.
+ * @see recorder_prepare()
+ * @see recorder_cancel()
+ * @see recorder_commit()
+ */
+int mmsvc_recorder_unprepare(recorder_h recorder);
+
+/**
+ * @brief Starts the recording.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/recorder
+ * @remarks If file path has been set to an existing file, this file is removed automatically and updated by new one. \n
+ * In the video recorder, some preview format does not support record mode. It will return #RECORDER_ERROR_INVALID_OPERATION error. \n
+ * You should use default preview format or #CAMERA_PIXEL_FORMAT_NV12 in the record mode. \n
+ * When you want to record audio or video file, you need to add privilege according to rules below additionally. \n
+ * If you want to save contents to internal storage, you should add mediastorage privilege. \n
+ * If you want to save contents to external storage, you should add externalstorage privilege. \n
+ * The filename should be set before this function is invoked.
+ * @param[in] recorder The handle to the media recorder
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @pre The recorder state must be #RECORDER_STATE_READY by mmsvc_recorder_prepare() or #RECORDER_STATE_PAUSED by mmsvc_recorder_pause(). \n
+ * The filename should be set by mmsvc_recorder_set_filename().
+ * @post The recorder state will be #RECORDER_STATE_RECORDING.
+ * @see recorder_pause()
+ * @see recorder_commit()
+ * @see recorder_cancel()
+ * @see recorder_set_audio_encoder()
+ * @see recorder_set_filename()
+ * @see recorder_set_file_format()
+ * @see recorder_recording_status_cb()
+ * @see recorder_set_filename()
+ */
+int mmsvc_recorder_start(recorder_h recorder);
+
+/**
+ * @brief Pauses the recording.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/recorder
+ * @remarks Recording can be resumed with mmsvc_recorder_start().
+ * @param[in] recorder The handle to the media recorder
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @pre The recorder state must be #RECORDER_STATE_RECORDING.
+ * @post The recorder state will be #RECORDER_STATE_PAUSED.
+ * @see mmsvc_recorder_pause()
+ * @see mmsvc_recorder_commit()
+ * @see mmsvc_recorder_cancel()
+ */
+int mmsvc_recorder_pause(recorder_h recorder);
+
+/**
+ * @brief Stops recording and saves the result.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/recorder
+ * @remarks When you want to record audio or video file, you need to add privilege according to rules below additionally. \n
+ * If you want to save contents to internal storage, you should add mediastorage privilege. \n
+ * If you want to save contents to external storage, you should add externalstorage privilege.
+ * @param[in] recorder The handle to the media recorder
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @pre The recorder state must be #RECORDER_STATE_RECORDING set by mmsvc_recorder_start() or #RECORDER_STATE_PAUSED by mmsvc_recorder_pause().
+ * @post The recorder state will be #RECORDER_STATE_READY.
+ * @see mmsvc_recorder_pause()
+ * @see mmsvc_recorder_cancel()
+ * @see mmsvc_recorder_set_filename()
+ * @see recorder_start()
+ */
+int mmsvc_recorder_commit(recorder_h recorder);
+
+/**
+ * @brief Cancels the recording.
+ * @details The recording data is discarded and not written in the recording file.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/recorder
+ * @remarks When you want to record audio or video file, you need to add privilege according to rules below additionally. \n
+ * If you want to save contents to internal storage, you should add mediastorage privilege. \n
+ * If you want to save contents to external storage, you should add externalstorage privilege.
+ * @param[in] recorder The handle to the media recorder
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @pre The recorder state must be #RECORDER_STATE_RECORDING set by mmsvc_recorder_start() or #RECORDER_STATE_PAUSED by mmsvc_recorder_pause().
+ * @post The recorder state will be #RECORDER_STATE_READY.
+ * @see mmsvc_recorder_pause()
+ * @see mmsvc_recorder_commit()
+ * @see mmsvc_recorder_cancel()
+ * @see mmsvc_recorder_start()
+ */
+int mmsvc_recorder_cancel(recorder_h recorder);
+
+/**
+ * @brief Gets the recorder's current state.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @param[out] state The current state of the recorder
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ */
+int mmsvc_recorder_get_state(recorder_h recorder, recorder_state_e *state);
+
+/**
+ * @brief Gets the peak audio input level that was sampled since the last call to this function.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks @c 0 dB indicates maximum input level, @c -300 dB indicates minimum input level.
+ * @param[in] recorder The handle to the media recorder
+ * @param[out] dB The audio input level in dB
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @pre The recorder state must be #RECORDER_STATE_RECORDING or #RECORDER_STATE_PAUSED.
+ */
+int mmsvc_recorder_get_audio_level(recorder_h recorder, double *dB);
+
+/**
+ * @brief Sets the file path to record.
+ * @details This function sets file path which defines where newly recorded data should be stored.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks If the same file already exists in the file system, then old file will be overwritten.
+ * @param[in] recorder The handle to the media recorder
+ * @param[in] path The recording file path
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
+ * @see recorder_get_filename()
+ */
+int mmsvc_recorder_set_filename(recorder_h recorder, const char *path);
+
+/**
+ * @brief Gets the file path to record.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks You must release @a path using free().
+ * @param[in] recorder The handle to the media recorder
+ * @param[out] path The recording file path
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see recorder_set_filename()
+ */
+int mmsvc_recorder_get_filename(recorder_h recorder, char **path);
+
+/**
+ * @brief Sets the file format for recording media stream.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks Since 2.3.1, it could be returned #RECORDER_ERROR_INVALID_OPERATION \n
+ * when it's audio recorder and its state is #RECORDER_STATE_READY \n
+ * because of checking codec compatibility with current encoder.
+ * @param[in] recorder The handle to the media recorder
+ * @param[in] format The media file format
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation (Since 2.3.1)
+ * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY (for video recorder only).\n
+ * Since 2.3.1, this API also works for audio recorder when its state is #RECORDER_STATE_READY.
+ * @see mmsvc_recorder_get_file_format()
+ * @see mmsvc_recorder_foreach_supported_file_format()
+ */
+int mmsvc_recorder_set_file_format(recorder_h recorder, recorder_file_format_e format);
+
+
+/**
+ * @brief Gets the file format for recording media stream.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @param[out] format The media file format
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see mmsvc_recorder_set_file_format()
+ * @see mmsvc_recorder_foreach_supported_file_format()
+ */
+int mmsvc_recorder_get_file_format(recorder_h recorder, recorder_file_format_e *format);
+
+
+ /**
+ * @}
+*/
+
+/**
+ * @addtogroup CAPI_MEDIA_RECORDER_CAPABILITY_MODULE
+ * @{
+ */
+
+/**
+ * @brief Retrieves all supported file formats by invoking a specific callback for each supported file format.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @param[in] callback The iteration callback
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @post mmsvc_recorder_supported_file_format_cb() will be invoked.
+ * @see mmsvc_recorder_get_file_format()
+ * @see mmsvc_recorder_set_file_format()
+ * @see mmsvc_recorder_supported_file_format_cb()
+ */
+int mmsvc_recorder_foreach_supported_file_format(recorder_h recorder, recorder_supported_file_format_cb callback, void *user_data);
+
+/**
+ * @}
+*/
+
+/**
+ * @addtogroup CAPI_MEDIA_RECORDER_MODULE
+ * @{
+ */
+
+/**
+ * @brief Sets the audio codec for encoding an audio stream.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks You can get available audio encoders by using recorder_foreach_supported_audio_encoder(). \n
+ * If set to #RECORDER_AUDIO_CODEC_DISABLE, the audio track is not created in recording files.\n
+ * Since 2.3.1, it could be returned #RECORDER_ERROR_INVALID_OPERATION \n
+ * when it's audio recorder and its state is #RECORDER_STATE_READY \n
+ * because of checking codec compatibility with current file format.
+ * @param[in] recorder The handle to the media recorder
+ * @param[in] codec The audio codec
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation (Since 2.3.1)
+ * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
+ * @see recorder_get_audio_encoder()
+ * @see mmsvc_recorder_foreach_supported_audio_encoder()
+ */
+int mmsvc_recorder_set_audio_encoder(recorder_h recorder, recorder_audio_codec_e codec);
+
+/**
+ * @brief Gets the audio codec for encoding an audio stream.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @param[out] codec The audio codec
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see recorder_set_audio_encoder()
+ * @see mmsvc_recorder_foreach_supported_audio_encoder()
+ */
+int mmsvc_recorder_get_audio_encoder(recorder_h recorder, recorder_audio_codec_e *codec);
+
+ /**
+ * @}
+*/
+
+/**
+ * @addtogroup CAPI_MEDIA_RECORDER_CAPABILITY_MODULE
+ * @{
+ */
+
+/**
+ * @brief Retrieves all supported audio encoders by invoking a specific callback for each supported audio encoder.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @param[in] callback The iteration callback
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @post mmsvc_recorder_supported_audio_encoder_cb() will be invoked.
+ * @see recorder_set_audio_encoder()
+ * @see recorder_get_audio_encoder()
+ * @see recorder_supported_audio_encoder_cb()
+ */
+int mmsvc_recorder_foreach_supported_audio_encoder(recorder_h recorder, recorder_supported_audio_encoder_cb callback, void *user_data);
+
+/**
+ * @}
+*/
+
+/**
+ * @addtogroup CAPI_MEDIA_RECORDER_MODULE
+ * @{
+ */
+
+/**
+ * @brief Sets the resolution of the video recording.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks This function should be called before recording (recorder_start()).
+ * @param[in] recorder The handle to the media recorder
+ * @param[in] width The preview width
+ * @param[in] height The preview height
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
+ * @see recorder_start()
+ * @see recorder_get_video_resolution()
+ * @see recorder_foreach_supported_video_resolution()
+ */
+int mmsvc_recorder_set_video_resolution(recorder_h recorder, int width, int height);
+
+/**
+ * @brief Gets the resolution of the video recording.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @param[out] width The video width
+ * @param[out] height The video height
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see recorder_set_video_resolution()
+ * @see recorder_foreach_supported_video_resolution()
+ */
+int mmsvc_recorder_get_video_resolution(recorder_h recorder, int *width, int *height);
+
+/**
+ * @}
+*/
+
+/**
+ * @addtogroup CAPI_MEDIA_RECORDER_CAPABILITY_MODULE
+ * @{
+ */
+
+/**
+ * @brief Retrieves all supported video resolutions by invoking callback function once for each supported video resolution.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @param[in] foreach_cb The callback function to be invoked
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @post This function invokes mmsvc_recorder_supported_video_resolution_cb() repeatedly to retrieve each supported video resolution.
+ * @see recorder_set_video_resolution()
+ * @see recorder_get_video_resolution()
+ * @see recorder_supported_video_resolution_cb()
+ */
+int mmsvc_recorder_foreach_supported_video_resolution(recorder_h recorder,
+ recorder_supported_video_resolution_cb foreach_cb, void *user_data);
+
+/**
+ * @}
+*/
+
+/**
+ * @addtogroup CAPI_MEDIA_RECORDER_MODULE
+ * @{
+ */
+
+/**
+ * @brief Sets the video codec for encoding video stream.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks You can get available video encoders by using recorder_foreach_supported_video_encoder().
+ * @param[in] recorder The handle to the media recorder
+ * @param[in] codec The video codec
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
+ * @see recorder_get_video_encoder()
+ * @see mmsvc_recorder_foreach_supported_video_encoder()
+ */
+int mmsvc_recorder_set_video_encoder(recorder_h recorder, recorder_video_codec_e codec);
+
+/**
+ * @brief Gets the video codec for encoding video stream.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @param[out] codec The video codec
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see mmsvc_recorder_set_video_encoder()
+ * @see mmsvc_recorder_foreach_supported_video_encoder()
+ */
+int mmsvc_recorder_get_video_encoder(recorder_h recorder, recorder_video_codec_e *codec);
+
+/**
+ * @}
+*/
+
+/**
+ * @addtogroup CAPI_MEDIA_RECORDER_CAPABILITY_MODULE
+ * @{
+ */
+
+/**
+ * @brief Retrieves all supported video encoders by invoking a specific callback for each supported video encoder.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @param[in] callback The iteration callback
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @post mmsvc_recorder_supported_video_encoder_cb() will be invoked.
+ * @see mmsvc_recorder_set_video_encoder()
+ * @see mmsvc_recorder_get_video_encoder()
+ * @see recorder_supported_video_encoder_cb()
+ */
+int mmsvc_recorder_foreach_supported_video_encoder(recorder_h recorder, recorder_supported_video_encoder_cb callback, void *user_data);
+
+ /**
+ * @}
+*/
+
+/**
+ * @addtogroup CAPI_MEDIA_RECORDER_MODULE
+ * @{
+ */
+
+/**
+ * @brief Registers the callback function that will be invoked when the recorder state changes.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @param[in] callback The function pointer of user callback
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @post mmsvc_recorder_state_changed_cb() will be invoked.
+ * @see mmsvc_recorder_unset_state_changed_cb()
+ * @see mmsvc_recorder_state_changed_cb()
+ */
+int mmsvc_recorder_set_state_changed_cb(recorder_h recorder, recorder_state_changed_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see mmsvc_recorder_set_state_changed_cb()
+ */
+int mmsvc_recorder_unset_state_changed_cb(recorder_h recorder);
+
+/**
+ * @brief Registers a callback function to be called when the media recorder is interrupted according to a policy.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see recorder_unset_interrupted_cb()
+ * @see recorder_interrupted_cb()
+ */
+int mmsvc_recorder_set_interrupted_cb(recorder_h recorder, recorder_interrupted_cb callback,
+ void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see recorder_set_interrupted_cb()
+ */
+int mmsvc_recorder_unset_interrupted_cb(recorder_h recorder);
+
+/**
+ * @brief Registers a callback function to be called when audio stream data is being delivered.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks This callback function holds the same buffer that will be recorded. \n
+ * Therefore if an user changes the buffer, the result file will have the buffer. \n
+ * @remarks The callback is called via internal thread of Frameworks. Therefore do not invoke UI API, mmsvc_recorder_unprepare(), mmsvc_recorder_commit() and mmsvc_recorder_cancel() in callback.\n
+ * This callback function to be called in #RECORDER_STATE_RECORDING and #RECORDER_STATE_PAUSED state.
+ *
+ * @param[in] recorder The handle to the recorder
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @pre The recorder state should be #RECORDER_STATE_READY or #RECORDER_STATE_CREATED.
+ * @see recorder_unset_audio_stream_cb()
+ * @see recorder_audio_stream_cb()
+ */
+int mmsvc_recorder_set_audio_stream_cb(recorder_h recorder, recorder_audio_stream_cb callback, void* user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see mmsvc_recorder_set_audio_stream_cb()
+ */
+int mmsvc_recorder_unset_audio_stream_cb(recorder_h recorder);
+
+/**
+ * @brief Registers a callback function to be invoked when the recording information changes.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @param[in] callback The function pointer of user callback
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @post mmsvc_recorder_recording_status_cb() will be invoked.
+ * @see recorder_unset_recording_status_cb()
+ * @see recorder_recording_status_cb()
+ */
+int mmsvc_recorder_set_recording_status_cb(recorder_h recorder, recorder_recording_status_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see recorder_set_recording_status_cb()
+ */
+int mmsvc_recorder_unset_recording_status_cb(recorder_h recorder);
+
+/**
+ * @brief Registers the callback function to be run when reached the recording limit.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to media recorder
+ * @param[in] callback The function pointer of user callback
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @post mmsvc_recorder_recording_limit_reached_cb() will be invoked.
+ * @see recorder_unset_recording_limit_reached_cb()
+ * @see recorder_attr_set_size_limit()
+ * @see recorder_attr_set_time_limit()
+ * @see recorder_recording_limit_reached_cb()
+ */
+int mmsvc_recorder_set_recording_limit_reached_cb(recorder_h recorder, recorder_recording_limit_reached_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see recorder_set_recording_limit_reached_cb()
+ */
+int mmsvc_recorder_unset_recording_limit_reached_cb(recorder_h recorder);
+
+/**
+ * @brief Registers a callback function to be called when an asynchronous operation error occurred.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks This callback informs critical error situation.\n
+ * When this callback is invoked, user should release the resource and terminate the application. \n
+ * These error codes will occur. \n
+ * #RECORDER_ERROR_DEVICE \n
+ * #RECORDER_ERROR_INVALID_OPERATION \n
+ * #RECORDER_ERROR_OUT_OF_MEMORY
+ * @param[in] recorder The handle to the recorder
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @post This function will invoke mmsvc_recorder_error_cb() when an asynchronous operation error occur.
+ * @see recorder_unset_error_cb()
+ * @see recorder_error_cb()
+ */
+int mmsvc_recorder_set_error_cb(recorder_h recorder, recorder_error_cb callback, void *user_data);
+
+
+/**
+ * @brief Unregisters the callback function.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the recorder
+ * @return @c on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see recorder_set_error_cb()
+ */
+int mmsvc_recorder_unset_error_cb(recorder_h recorder);
+
+
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_RECORDER_ATTRIBUTES_MODULE
+ * @{
+ */
+
+
+/**
+ * @brief Sets the maximum size of a recording file.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks After reaching the limitation, the recording data is discarded and not written in the recording file.
+ * @param[in] recorder The handle to the media recorder
+ * @param[in] kbyte The maximum size of the recording file(KB) \n
+ * @c 0 means unlimited recording size.
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
+ * @see recorder_attr_get_size_limit()
+ * @see recorder_attr_set_time_limit()
+ */
+int mmsvc_recorder_attr_set_size_limit(recorder_h recorder, int kbyte);
+
+/**
+ * @brief Gets the maximum size of a recording file.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @param[out] kbyte The maximum size of recording file (KB) \n
+ * @c 0 means unlimited recording size.
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see recorder_attr_set_size_limit()
+ * @see recorder_attr_get_time_limit()
+ */
+int mmsvc_recorder_attr_get_size_limit(recorder_h recorder, int *kbyte);
+
+/**
+ * @brief Sets the time limit of a recording file.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks After reaching the limitation, the recording data is discarded and not written in the recording file.
+ * @param[in] recorder The handle to the media recorder
+ * @param[in] second The time limit of the recording file (in seconds) \n
+ * @c 0 means unlimited recording size.
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
+ * @see recorder_attr_get_time_limit()
+ * @see recorder_attr_set_size_limit()
+ */
+int mmsvc_recorder_attr_set_time_limit(recorder_h recorder, int second);
+
+
+/**
+ * @brief Gets the time limit of a recording file.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @param[out] second The time limit of the recording file (in seconds) \n
+ * @c 0 means unlimited recording time.
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see recorder_attr_set_time_limit()
+ * @see recorder_attr_get_size_limit()
+ */
+int mmsvc_recorder_attr_get_time_limit(recorder_h recorder, int *second);
+
+/**
+ * @brief Sets the audio device for recording.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @param[in] device The type of an audio device
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY (for video recorder only).\n
+ * Since 2.3.1, this API also works for audio recorder when its state is #RECORDER_STATE_READY.
+ * @see recorder_attr_get_audio_device()
+ */
+int mmsvc_recorder_attr_set_audio_device(recorder_h recorder, recorder_audio_device_e device);
+
+/**
+ * @brief Gets the audio device for recording.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @param[out] device The type of an audio device
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see recorder_attr_set_audio_device()
+ */
+int mmsvc_recorder_attr_get_audio_device(recorder_h recorder, recorder_audio_device_e *device);
+
+/**
+ * @brief Sets the sampling rate of an audio stream.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @param[in] samplerate The sample rate in Hertz
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY (for video recorder only).\n
+ * Since 2.3.1, this API also works for audio recorder when its state is #RECORDER_STATE_READY.
+ * @see recorder_attr_get_audio_samplerate()
+ */
+int mmsvc_recorder_attr_set_audio_samplerate(recorder_h recorder, int samplerate);
+
+/**
+ * @brief Gets the sampling rate of an audio stream.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @param[out] samplerate The sample rate in Hertz
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see recorder_attr_set_audio_samplerate()
+ */
+int mmsvc_recorder_attr_get_audio_samplerate(recorder_h recorder, int *samplerate);
+
+/**
+ * @brief Sets the bitrate of an audio encoder.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @param[in] bitrate The bitrate (for mms : 12200[bps], normal : 288000[bps])
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
+ * @see recorder_attr_get_audio_encoder_bitrate()
+ */
+int mmsvc_recorder_attr_set_audio_encoder_bitrate(recorder_h recorder, int bitrate);
+
+/**
+ * @brief Sets the bitrate of a video encoder.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @param[in] bitrate The bitrate in bits per second
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
+ * @see recorder_attr_get_video_encoder_bitrate()
+ */
+int mmsvc_recorder_attr_set_video_encoder_bitrate(recorder_h recorder, int bitrate);
+
+/**
+ * @brief Gets the bitrate of an audio encoder.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @param[out] bitrate The bitrate in bits per second
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see recorder_attr_set_audio_encoder_bitrate()
+ */
+int mmsvc_recorder_attr_get_audio_encoder_bitrate(recorder_h recorder, int *bitrate);
+
+/**
+ * @brief Gets the bitrate of a video encoder.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @param[out] bitrate The bitrate in bits per second
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see recorder_attr_set_audio_encoder_bitrate()
+ */
+int mmsvc_recorder_attr_get_video_encoder_bitrate(recorder_h recorder, int *bitrate);
+
+/**
+ * @brief Sets the mute state of a recorder.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @param[in] enable The mute state
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see recorder_attr_is_muted()
+ */
+int mmsvc_recorder_attr_set_mute(recorder_h recorder, bool enable);
+
+/**
+ * @brief Gets the mute state of a recorder.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ * @return @c true if the recorder is not recording any sound,
+ * otherwise @c false if the recorder is recording
+ * @exception #RECORDER_ERROR_NONE Successful
+ * @exception #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @exception #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see recorder_attr_set_mute()
+ */
+bool mmsvc_recorder_attr_is_muted(recorder_h recorder);
+
+/**
+ * @brief Sets the recording motion rate.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks This attribute is valid only in a video recorder. \n
+ * If the rate bigger than @c 0 and smaller than @c 1, video is recorded in a slow motion mode. \n
+ * If the rate bigger than @c 1, video is recorded in a fast motion mode (time lapse recording).
+ * @remarks Audio data is not recorded. \n
+ * To reset slow motion recording, set the rate to @c 1.
+ * @param[in] recorder The handle to the media recorder
+ * @param[in] rate The recording motion rate \n
+ * It is computed with fps. (@c 0<rate<@c 1 for slow motion, @c 1<rate for fast motion(time lapse recording), @c 1 to reset).
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
+ * @see recorder_attr_get_recording_motion_rate()
+ */
+int mmsvc_recorder_attr_set_recording_motion_rate(recorder_h recorder , double rate);
+
+/**
+ * @brief Gets the recording motion rate.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks This attribute is valid only in a video recorder. \n
+ * If the rate bigger than @c 0 and smaller than @c 1, video is recorded in a slow motion mode. \n
+ * If the rate bigger than @c 1, video is recorded in a fast motion mode (time lapse recording).
+ * @remarks Audio data is not recorded. \n
+ * To reset slow motion recording, set the rate to @c 1.
+ * @param[in] recorder The handle to the media recorder
+ * @param[out] rate The recording motion rate \n
+ * It is computed with fps.
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see recorder_attr_set_recording_motion_rate()
+ */
+int mmsvc_recorder_attr_get_recording_motion_rate(recorder_h recorder , double *rate);
+
+/**
+ * @brief Sets the number of the audio channel.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks This attribute is applied only in RECORDER_STATE_CREATED state. \n
+ * For mono recording, setting channel to @c 1. \n
+ * For stereo recording, setting channel to @c 2.
+ * @param[in] recorder The handle to the media recorder
+ * @param[in] channel_count The number of the audio channel
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY (for video recorder only).\n
+ * Since 2.3.1, this API also works for audio recorder when its state is #RECORDER_STATE_READY.
+ * @see recorder_attr_get_audio_channel()
+ */
+int mmsvc_recorder_attr_set_audio_channel(recorder_h recorder, int channel_count);
+
+/**
+ * @brief Gets the number of the audio channel.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to the media recorder
+ * @param[out] channel_count The number of the audio channel
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see recorder_attr_set_audio_channel()
+ */
+int mmsvc_recorder_attr_get_audio_channel(recorder_h recorder, int *channel_count);
+
+
+/**
+ * @brief Sets the video orientation in a video metadata tag.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to a media recorder
+ * @param[in] orientation The information of the video orientation
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see recorder_attr_get_orientation_tag()
+ */
+int mmsvc_recorder_attr_set_orientation_tag(recorder_h recorder, recorder_rotation_e orientation);
+
+/**
+ * @brief Gets the video orientation in a video metadata tag.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] recorder The handle to a media recorder
+ * @param[out] orientation The information of the video orientation
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
+ * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see recorder_attr_set_orientation_tag()
+ */
+int mmsvc_recorder_attr_get_orientation_tag(recorder_h recorder, recorder_rotation_e *orientation);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_MULTIMEDIA_RECORDER_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_MULTIMEDIA_RECORDER_PRIVATE_H__
+#define __TIZEN_MULTIMEDIA_RECORDER_PRIVATE_H__
+#include <mmsvc_camera.h>
+#include <mm_camcorder.h>
+#include <mmsvc_recorder.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef union _mediaSource{
+ camera_h camera;
+}mediasource;
+
+
+typedef enum {
+ _RECORDER_EVENT_TYPE_STATE_CHANGE,
+ _RECORDER_EVENT_TYPE_RECORDING_LIMITED,
+ _RECORDER_EVENT_TYPE_RECORDING_STATUS,
+ _RECORDER_EVENT_TYPE_INTERRUPTED,
+ _RECORDER_EVENT_TYPE_AUDIO_STREAM,
+ _RECORDER_EVENT_TYPE_ERROR,
+ _RECORDER_EVENT_TYPE_NUM
+}_recorder_event_e;
+
+typedef enum {
+ _RECORDER_TYPE_AUDIO = 0,
+ _RECORDER_TYPE_VIDEO
+}_recorder_type_e;
+
+typedef enum {
+ _RECORDER_SOURCE_TYPE_UNKNOWN,
+ _RECORDER_SOURCE_TYPE_CAMERA,
+}_recorder_source_type_e;
+
+typedef struct _recorder_s{
+ MMHandleType mm_handle;
+ mediasource mm_source;
+ void* user_cb[_RECORDER_EVENT_TYPE_NUM];
+ void* user_data[_RECORDER_EVENT_TYPE_NUM];
+ unsigned int state;
+ int camera_device_count;
+ _recorder_type_e type;
+ _recorder_source_type_e src_type;
+ int origin_preview_format;
+ int changed_preview_format;
+ double last_max_input_level;
+} recorder_s;
+
+int __convert_recorder_error_code(const char *func, int code);
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__TIZEN_MULTIMEDIA_RECORDER_PRIVATE_H__
+
+
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_" />
+ </request>
+</manifest>
--- /dev/null
+
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=/usr
+libdir=@LIB_INSTALL_DIR@
+includedir=/usr/include/media
+
+Name: @PC_NAME@
+Description: @PACKAGE_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRED@
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir}
+
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(service "muse")
+SET(submodule "recorder")
+
+SET(dependents "dlog mused mm-common glib-2.0 mmsvc-camera capi-media-audio-io audio-session-mgr")
+SET(pc_dependents "dlog capi-media-audio-io")
+SET(fw_name "${service}-${submodule}")
+PROJECT(${fw_name})
+
+SET(CMAKE_INSTALL_PREFIX /usr)
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+SET(INC_DIR include)
+INCLUDE_DIRECTORIES(${INC_DIR})
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_name} REQUIRED ${dependents})
+FOREACH(flag ${${fw_name}_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "-I./include ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Wextra -Wno-array-bounds -Wno-empty-body -Wno-ignored-qualifiers -Wno-unused-parameter -Wshadow -Wwrite-strings -Wswitch-default -Wno-unused-but-set-parameter -Wno-unused-but-set-variable")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+
+IF("${ARCH}" STREQUAL "arm")
+ ADD_DEFINITIONS("-DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DTIZEN_DEBUG")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
+
+aux_source_directory(src MUSED_SOURCES)
+ADD_LIBRARY(${fw_name} SHARED ${MUSED_SOURCES})
+
+
+TARGET_LINK_LIBRARIES(${fw_name} mmsvc-recorder ${${fw_name}_LDFLAGS})
+
+SET_TARGET_PROPERTIES(${fw_name}
+ PROPERTIES
+ VERSION ${FULLVER}
+ SOVERSION ${MAJORVER}
+ CLEAN_DIRECT_OUTPUT 1
+)
+
+INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(
+ DIRECTORY ${INC_DIR}/ DESTINATION include/media
+ FILES_MATCHING
+ PATTERN "*_private.h" EXCLUDE
+ PATTERN "${INC_DIR}/*.h"
+ )
+
+SET(PC_NAME ${fw_name})
+SET(PC_REQUIRED ${pc_dependents})
+SET(PC_LDFLAGS -l${fw_name})
+SET(PC_CFLAGS -I\${includedir}/media)
+
+CONFIGURE_FILE(
+ ${fw_name}.pc.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
+ @ONLY
+)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
--- /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 __MUSE_RECORDER_H__
+#define __MUSE_RECORDER_H__
+
+#ifdef _cplusplus
+extern "C" {
+#endif
+
+#include "tbm_bufmgr.h"
+#include <stdbool.h>
+#include <stdio.h>
+
+typedef enum {
+ MUSE_RECORDER_API_CREATE, //0
+ MUSE_RECORDER_API_DESTROY,
+ MUSE_RECORDER_API_GET_STATE,
+ MUSE_RECORDER_API_PREPARE,
+ MUSE_RECORDER_API_UNPREPARE,
+ MUSE_RECORDER_API_START, //5
+ MUSE_RECORDER_API_PAUSE,
+ MUSE_RECORDER_API_COMMIT,
+ MUSE_RECORDER_API_CANCEL,
+ MUSE_RECORDER_API_SET_VIDEO_RESOLUTION,
+ MUSE_RECORDER_API_GET_VIDEO_RESOLUTION, //10
+ MUSE_RECORDER_API_FOREACH_SUPPORTED_VIDEO_RESOLUTION,
+ MUSE_RECORDER_API_GET_AUDIO_LEVEL,
+ MUSE_RECORDER_API_SET_FILENAME,
+ MUSE_RECORDER_API_GET_FILENAME,
+ MUSE_RECORDER_API_SET_FILE_FORMAT, //15
+ MUSE_RECORDER_API_GET_FILE_FORMAT,
+ MUSE_RECORDER_API_SET_STATE_CHANGED_CB,
+ MUSE_RECORDER_API_UNSET_STATE_CHANGED_CB,
+ MUSE_RECORDER_API_SET_INTERRUPTED_CB,
+ MUSE_RECORDER_API_UNSET_INTERRUPTED_CB, //20
+ MUSE_RECORDER_API_SET_AUDIO_STREAM_CB,
+ MUSE_RECORDER_API_UNSET_AUDIO_STREAM_CB,
+ MUSE_RECORDER_API_SET_ERROR_CB,
+ MUSE_RECORDER_API_UNSET_ERROR_CB,
+ MUSE_RECORDER_API_SET_RECORDING_STATUS_CB, //25
+ MUSE_RECORDER_API_UNSET_RECORDING_STATUS_CB,
+ MUSE_RECORDER_API_SET_RECORDING_LIMIT_REACHED_CB,
+ MUSE_RECORDER_API_UNSET_RECORDING_LIMIT_REACHED_CB,
+ MUSE_RECORDER_API_FOREACH_SUPPORTED_FILE_FORMAT,
+ MUSE_RECORDER_API_ATTR_SET_SIZE_LIMIT, //30
+ MUSE_RECORDER_API_ATTR_SET_TIME_LIMIT,
+ MUSE_RECORDER_API_ATTR_SET_AUDIO_DEVICE,
+ MUSE_RECORDER_API_SET_AUDIO_ENCODER,
+ MUSE_RECORDER_API_GET_AUDIO_ENCODER,
+ MUSE_RECORDER_API_SET_VIDEO_ENCODER, //35
+ MUSE_RECORDER_API_GET_VIDEO_ENCODER,
+ MUSE_RECORDER_API_ATTR_SET_AUDIO_SAMPLERATE,
+ MUSE_RECORDER_API_ATTR_SET_AUDIO_ENCODER_BITRATE,
+ MUSE_RECORDER_API_ATTR_SET_VIDEO_ENCODER_BITRATE,
+ MUSE_RECORDER_API_ATTR_GET_SIZE_LIMIT, //40
+ MUSE_RECORDER_API_ATTR_GET_TIME_LIMIT,
+ MUSE_RECORDER_API_ATTR_GET_AUDIO_DEVICE,
+ MUSE_RECORDER_API_ATTR_GET_AUDIO_SAMPLERATE,
+ MUSE_RECORDER_API_ATTR_GET_AUDIO_ENCODER_BITRATE,
+ MUSE_RECORDER_API_ATTR_GET_VIDEO_ENCODER_BITRATE, //45
+ MUSE_RECORDER_API_FOREACH_SUPPORTED_AUDIO_ENCODER,
+ MUSE_RECORDER_API_FOREACH_SUPPORTED_VIDEO_ENCODER,
+ MUSE_RECORDER_API_ATTR_SET_MUTE,
+ MUSE_RECORDER_API_ATTR_IS_MUTED,
+ MUSE_RECORDER_API_ATTR_SET_RECORDING_MOTION_RATE, //50
+ MUSE_RECORDER_API_ATTR_GET_RECORDING_MOTION_RATE,
+ MUSE_RECORDER_API_ATTR_SET_AUDIO_CHANNEL,
+ MUSE_RECORDER_API_ATTR_GET_AUDIO_CHANNEL,
+ MUSE_RECORDER_API_ATTR_SET_ORIENTATION_TAG,
+ MUSE_RECORDER_API_ATTR_GET_ORIENTATION_TAG, //55
+ MUSE_RECORDER_API_MAX //56
+} muse_recorder_api_e;
+
+typedef enum {
+ MUSE_RECORDER_EVENT_TYPE_STATE_CHANGE,
+ MUSE_RECORDER_EVENT_TYPE_RECORDING_LIMITED,
+ MUSE_RECORDER_EVENT_TYPE_RECORDING_STATUS,
+ MUSE_RECORDER_EVENT_TYPE_INTERRUPTED,
+ MUSE_RECORDER_EVENT_TYPE_AUDIO_STREAM,
+ MUSE_RECORDER_EVENT_TYPE_ERROR,
+ MUSE_RECORDER_EVENT_TYPE_FOREACH_SUPPORTED_AUDIO_ENCODER,
+ MUSE_RECORDER_EVENT_TYPE_FOREACH_SUPPORTED_FILE_FORMAT,
+ MUSE_RECORDER_EVENT_TYPE_FOREACH_SUPPORTED_VIDEO_ENCODER,
+ MUSE_RECORDER_EVENT_TYPE_FOREACH_SUPPORTED_VIDEO_RESOLUTION,
+ MUSE_RECORDER_EVENT_TYPE_NUM
+}muse_recorder_event_e;
+
+typedef enum {
+ MUSE_RECORDER_ERROR_INVALID = -1,
+ MUSE_RECORDER_ERROR_NONE = 1,
+} muse_recorder_error_e;
+
+typedef enum {
+ MUSE_RECORDER_TYPE_AUDIO = 0,
+ MUSE_RECORDER_TYPE_VIDEO
+}muse_recorder_type_e;
+
+typedef enum {
+ MUSE_RECORDER_SOURCE_TYPE_UNKNOWN,
+ MUSE_RECORDER_SOURCE_TYPE_CAMERA,
+}muse_recorder_source_type_e;
+
+/**
+ * @brief The structure type for data transport
+ */
+typedef struct {
+ int data_size;
+ int tbm_key;
+ tbm_bo bo;
+ tbm_bo_handle bo_handle;
+ tbm_bufmgr bufmgr;
+} muse_recorder_transport_info_s;
+
+typedef struct {
+ tbm_bufmgr bufmgr;
+} muse_recorder_info_s;
+
+#define MUSE_RECORDER_CB_EVENT MUSE_RECORDER_API_MAX + 1
+#define MUSE_RECORDER_MSG_MAX_LENGTH 256
+#define MUSE_RECORDER_PARSE_STRING_SIZE 200
+
+bool muse_recorder_ipc_make_tbm(muse_recorder_transport_info_s *transport_info);
+int muse_recorder_ipc_export_tbm(muse_recorder_transport_info_s transport_info);
+bool muse_recorder_ipc_init_tbm(muse_recorder_transport_info_s *transport_info);
+int muse_recorder_ipc_import_tbm(muse_recorder_transport_info_s *transport_info);
+void muse_recorder_ipc_unref_tbm(muse_recorder_transport_info_s *transport_info);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __MM_MEDIA_PLAYER2_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 __RECORDER_MSG_PRIVATE_H__
+#define __RECORDER_MSG_PRIVATE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "muse_core_msg_json.h"
+
+#define PARAM_HANDLE "handle"
+#define PARAM_RET "ret"
+#define PARAM_EVENT "event"
+#define PARAM_ERROR "error"
+#define PARAM_TBM_KEY "t_key"
+#define PARAM_DISPLAY_MODE "display_mode"
+#define PARAM_DEVICE_TYPE "device_type"
+#define PARAM_RECORDER_TYPE "recorder_type"
+#define PARAM_CAMERA_HANDLE "camera_handle"
+
+#define CALLBACK_TIME_OUT 3
+
+typedef int32_t INT;
+typedef int64_t INT64;
+typedef intptr_t POINTER;
+typedef double DOUBLE;
+typedef const char* STRING;
+
+#define muse_recorder_msg_get(param, buf) \
+ muse_core_msg_json_deserialize(#param, buf, NULL, ¶m, NULL, MUSE_TYPE_ANY)
+
+#define muse_recorder_msg_get_string(param, buf) \
+ muse_core_msg_json_deserialize(#param, buf, NULL, param, NULL, MUSE_TYPE_STRING)
+
+#define muse_recorder_msg_get_array(param, buf) \
+ muse_core_msg_json_deserialize(#param, buf, NULL, param, NULL, MUSE_TYPE_ARRAY)
+
+#define muse_recorder_msg_get_pointer(param, buf) \
+ muse_core_msg_json_deserialize(#param, buf, NULL, ¶m, NULL, MUSE_TYPE_POINTER)
+
+#define muse_recorder_msg_get_error_e(param, buf, e) \
+ muse_core_msg_json_deserialize(#param, buf, NULL, ¶m, &e, MUSE_TYPE_ANY)
+
+#define muse_recorder_msg_send(api, fd, cb_info, ret) \
+ do{ \
+ char *__sndMsg__; \
+ callback_cb_info_s *cb_info_s; \
+ int __len__; \
+ cb_info_s = (callback_cb_info_s *)cb_info; \
+ cb_info_s->activating[api] = 0; \
+ __sndMsg__ = muse_core_msg_json_factory_new(api, 0); \
+ __len__ = muse_core_ipc_send_msg(fd, __sndMsg__); \
+ if (__len__ <= 0) { \
+ LOGE("sending message failed"); \
+ ret = RECORDER_ERROR_INVALID_OPERATION; \
+ } else \
+ ret = client_wait_for_cb_return(api, cb_info, CALLBACK_TIME_OUT); \
+ muse_core_msg_json_factory_free(__sndMsg__); \
+ }while(0)
+
+#define muse_recorder_msg_send1(api, fd, cb_info, ret, type, param) \
+ do{ \
+ char *__sndMsg__; \
+ int __len__; \
+ type __value__ = (type)param; \
+ __sndMsg__ = muse_core_msg_json_factory_new(api, \
+ MUSE_TYPE_##type, #param, __value__, \
+ 0); \
+ __len__ = muse_core_ipc_send_msg(fd, __sndMsg__); \
+ if (__len__ <= 0) { \
+ LOGE("sending message failed"); \
+ ret = RECORDER_ERROR_INVALID_OPERATION; \
+ } else \
+ ret = client_wait_for_cb_return(api, cb_info, CALLBACK_TIME_OUT); \
+ muse_core_msg_json_factory_free(__sndMsg__); \
+ }while(0)
+
+#define muse_recorder_msg_send2(api, fd, cb_info, ret, type1, param1, type2, param2) \
+ do{ \
+ char *__sndMsg__; \
+ int __len__; \
+ type1 __value1__ = (type1)param1; \
+ type2 __value2__ = (type2)param2; \
+ __sndMsg__ = muse_core_msg_json_factory_new(api, \
+ MUSE_TYPE_##type1, #param1, __value1__, \
+ MUSE_TYPE_##type2, #param2, __value2__, \
+ 0); \
+ __len__ = muse_core_ipc_send_msg(fd, __sndMsg__); \
+ if (__len__ <= 0) { \
+ LOGE("sending message failed"); \
+ ret = RECORDER_ERROR_INVALID_OPERATION; \
+ } else \
+ ret = client_wait_for_cb_return(api, cb_info, CALLBACK_TIME_OUT); \
+ muse_core_msg_json_factory_free(__sndMsg__); \
+ }while(0)
+
+#define muse_recorder_msg_send_array(api, fd, cb_info, ret, param, length, datum_size) \
+ do{ \
+ char *__sndMsg__; \
+ int __len__; \
+ int *__value__ = (int *)param; \
+ __sndMsg__ = muse_core_msg_json_factory_new(api, \
+ MUSE_TYPE_INT, #length, length, \
+ MUSE_TYPE_ARRAY, #param, \
+ datum_size == sizeof(int)? length : \
+ length / sizeof(int) + (length % sizeof(int)?1:0), \
+ __value__, \
+ 0); \
+ __len__ = muse_core_ipc_send_msg(fd, __sndMsg__); \
+ if (__len__ <= 0) { \
+ LOGE("sending message failed"); \
+ ret = RECORDER_ERROR_INVALID_OPERATION; \
+ } else \
+ ret = client_wait_for_cb_return(api, cb_info, CALLBACK_TIME_OUT); \
+ muse_core_msg_json_factory_free(__sndMsg__); \
+ }while(0)
+
+#define muse_recorder_msg_send1_async(api, fd, type, param) \
+ do{ \
+ char *__sndMsg__; \
+ int __len__; \
+ type __value__ = (type)param; \
+ __sndMsg__ = muse_core_msg_json_factory_new(api, \
+ MUSE_TYPE_##type, #param, __value__, \
+ 0); \
+ __len__ = muse_core_ipc_send_msg(fd, __sndMsg__); \
+ muse_core_msg_json_factory_free(__sndMsg__); \
+ if (__len__ <= 0) { \
+ LOGE("sending message failed"); \
+ return RECORDER_ERROR_INVALID_OPERATION; \
+ } \
+ }while(0)
+
+#define muse_recorder_msg_send2_async(api, fd, type1, param1, type2, param2) \
+ do{ \
+ char *__sndMsg__; \
+ int __len__; \
+ type1 __value1__ = (type1)param1; \
+ type2 __value2__ = (type2)param2; \
+ __sndMsg__ = muse_core_msg_json_factory_new(api, \
+ MUSE_TYPE_##type1, #param1, __value1__, \
+ MUSE_TYPE_##type2, #param2, __value2__, \
+ 0); \
+ __len__ = muse_core_ipc_send_msg(fd, __sndMsg__); \
+ muse_core_msg_json_factory_free(__sndMsg__); \
+ if (__len__ <= 0) { \
+ LOGE("sending message failed"); \
+ return RECORDER_ERROR_INVALID_OPERATION; \
+ } \
+ }while(0)
+
+#define muse_recorder_msg_return(api, ret, module) \
+ do{ \
+ char *__sndMsg__; \
+ int __len__; \
+ __sndMsg__ = muse_core_msg_json_factory_new(api, \
+ MUSE_TYPE_INT, PARAM_RET, ret, \
+ 0); \
+ __len__ = muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \
+ if (__len__ <= 0) { \
+ LOGE("sending message failed"); \
+ ret = RECORDER_ERROR_INVALID_OPERATION; \
+ } \
+ muse_core_msg_json_factory_free(__sndMsg__); \
+ }while(0)
+
+#define muse_recorder_msg_return1(api, ret, module, type, param) \
+ do{ \
+ char *__sndMsg__; \
+ int __len__; \
+ type __value__ = (type)param; \
+ __sndMsg__ = muse_core_msg_json_factory_new(api, \
+ MUSE_TYPE_INT, PARAM_RET, ret, \
+ MUSE_TYPE_##type, #param, __value__, \
+ 0); \
+ __len__ = muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \
+ if (__len__ <= 0) { \
+ LOGE("sending message failed"); \
+ ret = RECORDER_ERROR_INVALID_OPERATION; \
+ } \
+ muse_core_msg_json_factory_free(__sndMsg__); \
+ }while(0)
+
+#define muse_recorder_msg_return2(api, ret, module, type1, param1, type2, param2) \
+ do{ \
+ char *__sndMsg__; \
+ int __len__; \
+ type1 __value1__ = (type1)param1; \
+ type2 __value2__ = (type2)param2; \
+ __sndMsg__ = muse_core_msg_json_factory_new(api, \
+ MUSE_TYPE_INT, PARAM_RET, ret, \
+ MUSE_TYPE_##type1, #param1, __value1__, \
+ MUSE_TYPE_##type2, #param2, __value2__, \
+ 0); \
+ __len__ = muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \
+ if (__len__ <= 0) { \
+ LOGE("sending message failed"); \
+ ret = RECORDER_ERROR_INVALID_OPERATION; \
+ } \
+ muse_core_msg_json_factory_free(__sndMsg__); \
+ }while(0)
+
+#define muse_recorder_msg_return3(api, ret, module, type1, param1, type2, param2, type3, param3) \
+ do{ \
+ char *__sndMsg__; \
+ int __len__; \
+ type1 __value1__ = (type1)param1; \
+ type2 __value2__ = (type2)param2; \
+ type3 __value3__ = (type3)param3; \
+ __sndMsg__ = muse_core_msg_json_factory_new(api, \
+ MUSE_TYPE_INT, PARAM_RET, ret, \
+ MUSE_TYPE_##type1, #param1, __value1__, \
+ MUSE_TYPE_##type2, #param2, __value2__, \
+ MUSE_TYPE_##type3, #param3, __value3__, \
+ 0); \
+ __len__ = muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \
+ if (__len__ <= 0) { \
+ LOGE("sending message failed"); \
+ ret = RECORDER_ERROR_INVALID_OPERATION; \
+ } \
+ muse_core_msg_json_factory_free(__sndMsg__); \
+ }while(0)
+
+#define muse_recorder_msg_return_array(api, ret, module, param, length, datum_size) \
+ do{ \
+ char *__sndMsg__; \
+ int __len__; \
+ int *__value__ = (int *)param; \
+ __sndMsg__ = muse_core_msg_json_factory_new(api, \
+ MUSE_TYPE_INT, PARAM_RET, ret, \
+ MUSE_TYPE_INT, #length, length, \
+ MUSE_TYPE_ARRAY, #param, \
+ datum_size == sizeof(int)? length : \
+ length / sizeof(int) + (length % sizeof(int)?1:0), \
+ __value__, \
+ 0); \
+ __len__ = muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \
+ if (__len__ <= 0) { \
+ LOGE("sending message failed"); \
+ ret = RECORDER_ERROR_INVALID_OPERATION; \
+ } \
+ muse_core_msg_json_factory_free(__sndMsg__); \
+ }while(0)
+
+#define muse_recorder_msg_event(api, event, fd) \
+ do{ \
+ char *__sndMsg__; \
+ __sndMsg__ = muse_core_msg_json_factory_new(api, \
+ MUSE_TYPE_INT, PARAM_EVENT, event, \
+ 0); \
+ muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \
+ muse_core_msg_json_factory_free(__sndMsg__); \
+ }while(0)
+
+#define muse_recorder_msg_event1(api, event, module, type, param) \
+ do{ \
+ char *__sndMsg__; \
+ type __value__ = (type)param; \
+ __sndMsg__ = muse_core_msg_json_factory_new(api, \
+ MUSE_TYPE_INT, PARAM_EVENT, event, \
+ MUSE_TYPE_##type, #param, __value__, \
+ 0); \
+ muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \
+ muse_core_msg_json_factory_free(__sndMsg__); \
+ }while(0)
+
+#define muse_recorder_msg_event2(api, event, module, type1, param1, type2, param2) \
+ do{ \
+ char *__sndMsg__; \
+ type1 __value1__ = (type1)param1; \
+ type2 __value2__ = (type2)param2; \
+ __sndMsg__ = muse_core_msg_json_factory_new(api, \
+ MUSE_TYPE_INT, PARAM_EVENT, event, \
+ MUSE_TYPE_##type1, #param1, __value1__, \
+ MUSE_TYPE_##type2, #param2, __value2__, \
+ 0); \
+ muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \
+ muse_core_msg_json_factory_free(__sndMsg__); \
+ }while(0)
+
+#define muse_recorder_msg_event3(api, event, module, type1, param1, type2, param2, type3, param3) \
+ do{ \
+ char *__sndMsg__; \
+ type1 __value1__ = (type1)param1; \
+ type2 __value2__ = (type2)param2; \
+ type3 __value3__ = (type3)param3; \
+ __sndMsg__ = muse_core_msg_json_factory_new(api, \
+ MUSE_TYPE_INT, PARAM_EVENT, event, \
+ MUSE_TYPE_##type1, #param1, __value1__, \
+ MUSE_TYPE_##type2, #param2, __value2__, \
+ MUSE_TYPE_##type3, #param3, __value3__, \
+ 0); \
+ muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \
+ muse_core_msg_json_factory_free(__sndMsg__); \
+ }while(0)
+
+#define muse_recorder_msg_event4(api, event, module, type1, param1, type2, param2, type3, param3, type4, param4) \
+ do{ \
+ char *__sndMsg__; \
+ type1 __value1__ = (type1)param1; \
+ type2 __value2__ = (type2)param2; \
+ type3 __value3__ = (type3)param3; \
+ type4 __value4__ = (type4)param4; \
+ __sndMsg__ = muse_core_msg_json_factory_new(api, \
+ MUSE_TYPE_INT, PARAM_EVENT, event, \
+ MUSE_TYPE_##type1, #param1, __value1__, \
+ MUSE_TYPE_##type2, #param2, __value2__, \
+ MUSE_TYPE_##type3, #param3, __value3__, \
+ MUSE_TYPE_##type4, #param4, __value4__, \
+ 0); \
+ muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \
+ muse_core_msg_json_factory_free(__sndMsg__); \
+ }while(0)
+
+#define muse_recorder_msg_event5(api, event, module, type1, param1, type2, param2, type3, param3, type4, param4, type5, param5) \
+ do{ \
+ char *__sndMsg__; \
+ type1 __value1__ = (type1)param1; \
+ type2 __value2__ = (type2)param2; \
+ type3 __value3__ = (type3)param3; \
+ type4 __value4__ = (type4)param4; \
+ type5 __value5__ = (type5)param5; \
+ __sndMsg__ = muse_core_msg_json_factory_new(api, \
+ MUSE_TYPE_INT, PARAM_EVENT, event, \
+ MUSE_TYPE_##type1, #param1, __value1__, \
+ MUSE_TYPE_##type2, #param2, __value2__, \
+ MUSE_TYPE_##type3, #param3, __value3__, \
+ MUSE_TYPE_##type4, #param4, __value4__, \
+ MUSE_TYPE_##type5, #param5, __value5__, \
+ 0); \
+ muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \
+ muse_core_msg_json_factory_free(__sndMsg__); \
+ }while(0)
+
+#define muse_recorder_msg_event2_array(api, event, module, type1, param1, type2, param2, arr_param, length, datum_size) \
+ do{ \
+ char *__sndMsg__; \
+ type1 __value1__ = (type1)param1; \
+ type2 __value2__ = (type2)param2; \
+ int *__arr_value__ = (int *)arr_param; \
+ __sndMsg__ = muse_core_msg_json_factory_new(api, \
+ MUSE_TYPE_INT, PARAM_EVENT, event, \
+ MUSE_TYPE_##type1, #param1, __value1__, \
+ MUSE_TYPE_##type2, #param2, __value2__, \
+ MUSE_TYPE_INT, #length, length, \
+ MUSE_TYPE_ARRAY, #arr_param, \
+ datum_size == sizeof(int)? length : \
+ length / sizeof(int) + (length % sizeof(int)?1:0), \
+ __arr_value__, \
+ 0); \
+ muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \
+ muse_core_msg_json_factory_free(__sndMsg__); \
+ }while(0)
+
+#define muse_recorder_msg_event6_array(api, event, client, type1, param1, type2, param2, type3, param3, type4, param4, type5, param5, type6, param6, arr_param, length, datum_size) \
+ do{ \
+ char *__sndMsg__; \
+ type1 __value1__ = (type1)param1; \
+ type2 __value2__ = (type2)param2; \
+ type3 __value3__ = (type3)param3; \
+ type4 __value4__ = (type4)param4; \
+ type5 __value5__ = (type5)param5; \
+ type6 __value6__ = (type6)param6; \
+ int *__arr_value__ = (int *)arr_param; \
+ __sndMsg__ = muse_core_msg_json_factory_new(api, \
+ MUSE_TYPE_INT, PARAM_EVENT, event, \
+ MUSE_TYPE_##type1, #param1, __value1__, \
+ MUSE_TYPE_##type2, #param2, __value2__, \
+ MUSE_TYPE_##type3, #param3, __value3__, \
+ MUSE_TYPE_##type4, #param4, __value4__, \
+ MUSE_TYPE_##type5, #param5, __value5__, \
+ MUSE_TYPE_##type6, #param6, __value6__, \
+ MUSE_TYPE_INT, #length, length, \
+ MUSE_TYPE_ARRAY, #arr_param, \
+ datum_size == sizeof(int)? length : \
+ length / sizeof(int) + (length % sizeof(int)?1:0), \
+ __arr_value__, \
+ 0); \
+ muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \
+ muse_core_msg_json_factory_free(__sndMsg__); \
+ }while(0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__RECORDER_MSG_PRIVATE_H__*/
--- /dev/null
+
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=/usr
+libdir=@LIB_INSTALL_DIR@
+includedir=/usr/include/media
+
+Name: @PC_NAME@
+Description: @PACKAGE_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRED@
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir}
+
--- /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.
+*/
+
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <stdio.h>
+#include "muse_recorder.h"
+#include "muse_recorder_msg.h"
+#include "muse_core.h"
+#include "muse_core_ipc.h"
+#include "mm_types.h"
+#include "mmsvc_recorder.h"
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "MMSVC_RECORDER"
+
+void _mmsvc_recorder_disp_recording_limit_reached_cb(recorder_recording_limit_type_e type, void *user_data)
+{
+ muse_module_h module = (muse_module_h)user_data;
+
+ LOGD("Enter");
+ int cb_type = (int)type;
+ muse_recorder_msg_event1(MUSE_RECORDER_CB_EVENT,
+ MUSE_RECORDER_EVENT_TYPE_RECORDING_LIMITED,
+ module,
+ INT, cb_type);
+ return;
+}
+
+void _mmsvc_recorder_disp_recording_status_cb(unsigned long long elapsed_time, unsigned long long file_size, void *user_data)
+{
+ muse_module_h module = (muse_module_h)user_data;
+
+ LOGD("Enter");
+ double cb_elapsed_time = elapsed_time;
+ double cb_file_size = file_size;
+ muse_recorder_msg_event2(MUSE_RECORDER_CB_EVENT,
+ MUSE_RECORDER_EVENT_TYPE_RECORDING_STATUS,
+ module,
+ DOUBLE, cb_elapsed_time,
+ DOUBLE, cb_file_size);
+ return;
+}
+
+void _mmsvc_recorder_disp_state_changed_cb(recorder_state_e previous , recorder_state_e current , bool by_policy, void *user_data)
+{
+ muse_module_h module = (muse_module_h)user_data;
+
+ LOGD("Enter");
+ int cb_previous = (int)previous;
+ int cb_current = (int)current;
+ int cb_by_policy = (int)by_policy;
+ muse_recorder_msg_event3(MUSE_RECORDER_CB_EVENT,
+ MUSE_RECORDER_EVENT_TYPE_STATE_CHANGE,
+ module,
+ INT, cb_previous,
+ INT, cb_current,
+ INT, cb_by_policy);
+ return;
+}
+
+void _mmsvc_recorder_disp_interrupted_cb(recorder_policy_e policy, recorder_state_e previous, recorder_state_e current, void *user_data)
+{
+ muse_module_h module = (muse_module_h)user_data;
+
+ LOGD("Enter");
+ int cb_policy = (int)policy;
+ int cb_previous = (int)previous;
+ int cb_current = (int)current;
+ muse_recorder_msg_event3(MUSE_RECORDER_CB_EVENT,
+ MUSE_RECORDER_EVENT_TYPE_INTERRUPTED,
+ module,
+ INT, cb_policy,
+ INT, cb_previous,
+ INT, cb_current);
+ return;
+}
+
+void _mmsvc_recorder_disp_error_cb(recorder_error_e error, recorder_state_e current_state, void *user_data)
+{
+ muse_module_h module = (muse_module_h)user_data;
+ int cb_error = (int)error;
+ int cb_current_state = (int)current_state;
+ LOGD("Enter");
+
+ muse_recorder_msg_event2(MUSE_RECORDER_CB_EVENT,
+ MUSE_RECORDER_EVENT_TYPE_INTERRUPTED,
+ module,
+ INT, cb_error,
+ INT, cb_current_state);
+ return;
+}
+
+void _mmsvc_recorder_disp_audio_stream_cb(void* stream, int size, audio_sample_type_e format, int channel, unsigned int timestamp, void *user_data)
+{
+ muse_module_h module = (muse_module_h)user_data;
+ int cb_size = size;
+ int cb_format = (int)format;
+ int cb_channel = channel;
+ int cb_timestamp = timestamp;
+ muse_recorder_transport_info_s transport_info;
+ muse_recorder_info_s *recorder_data;
+ int tKey = 0;
+ LOGD("Enter");
+
+ /* Initial TBM setting */
+ transport_info.data_size = size;
+ recorder_data = (muse_recorder_info_s *)muse_core_client_get_cust_data(module);
+ transport_info.bufmgr = recorder_data->bufmgr;
+
+ if (muse_recorder_ipc_make_tbm(&transport_info) == FALSE) {
+ LOGE("TBM Init failed");
+ return;
+ }
+ LOGD("bohandle_ptr : 0x%x, export_bo : %d, tSize : %d", transport_info.bo_handle.ptr, transport_info.bo, transport_info.data_size);
+
+ memcpy(transport_info.bo_handle.ptr, stream, size);
+ tKey = muse_recorder_ipc_export_tbm(transport_info);
+
+ if(tKey == 0) {
+ LOGE("Create key_info ERROR!!");
+ muse_recorder_ipc_unref_tbm(&transport_info);
+ return;
+ }
+
+ muse_recorder_msg_event5(MUSE_RECORDER_CB_EVENT,
+ MUSE_RECORDER_EVENT_TYPE_AUDIO_STREAM,
+ module,
+ INT, cb_size,
+ INT, cb_format,
+ INT, cb_channel,
+ INT, cb_timestamp,
+ INT, tKey);
+
+ muse_recorder_ipc_unref_tbm(&transport_info);
+ return;
+}
+
+void _mmsvc_recorder_disp_foreach_supported_video_resolution_cb(int width, int height, void *user_data)
+{
+ muse_module_h module = (muse_module_h)user_data;
+ LOGD("Enter");
+
+ muse_recorder_msg_event2(MUSE_RECORDER_CB_EVENT,
+ MUSE_RECORDER_EVENT_TYPE_FOREACH_SUPPORTED_VIDEO_RESOLUTION,
+ module,
+ INT, width,
+ INT, height);
+ return;
+}
+
+void _mmsvc_recorder_disp_foreach_supported_file_format_cb(recorder_file_format_e format, void *user_data)
+{
+ muse_module_h module = (muse_module_h)user_data;
+ int cb_format = (int)format;
+ LOGD("Enter");
+
+ muse_recorder_msg_event1(MUSE_RECORDER_CB_EVENT,
+ MUSE_RECORDER_EVENT_TYPE_FOREACH_SUPPORTED_FILE_FORMAT,
+ module,
+ INT, cb_format);
+ return;
+}
+
+void _mmsvc_recorder_disp_foreach_supported_audio_encoder_cb(recorder_audio_codec_e codec, void *user_data)
+{
+ muse_module_h module = (muse_module_h)user_data;
+ int cb_codec = (int)codec;
+ LOGD("Enter");
+
+ muse_recorder_msg_event1(MUSE_RECORDER_CB_EVENT,
+ MUSE_RECORDER_EVENT_TYPE_FOREACH_SUPPORTED_AUDIO_ENCODER,
+ module,
+ INT, cb_codec);
+ return;
+}
+
+void _mmsvc_recorder_disp_foreach_supported_video_encoder_cb(recorder_video_codec_e codec, void *user_data)
+{
+ muse_module_h module = (muse_module_h)user_data;
+ int cb_codec = (int)codec;
+ LOGD("Enter");
+
+ muse_recorder_msg_event1(MUSE_RECORDER_CB_EVENT,
+ MUSE_RECORDER_EVENT_TYPE_FOREACH_SUPPORTED_VIDEO_ENCODER,
+ module,
+ INT, cb_codec);
+ return;
+}
+
+int recorder_dispatcher_create(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ muse_recorder_api_e api = MUSE_RECORDER_API_CREATE;
+ recorder_h recorder;
+ intptr_t camera_handle;
+ muse_recorder_info_s *recorder_data;
+ tbm_bufmgr bufmgr;
+ int recorder_type;
+ intptr_t handle;
+ LOGD("Enter");
+ muse_recorder_msg_get(recorder_type, muse_core_client_get_msg(module));
+ if (recorder_type == MUSE_RECORDER_TYPE_VIDEO) {
+ muse_recorder_msg_get_pointer(camera_handle, muse_core_client_get_msg(module));
+ LOGD("video type, camera handle : 0x%x", camera_handle);
+ ret = mmsvc_recorder_create_videorecorder((camera_h)camera_handle, &recorder);
+ } else if (recorder_type == MUSE_RECORDER_TYPE_AUDIO) {
+ LOGD("audio type");
+ ret = mmsvc_recorder_create_audiorecorder(&recorder);
+ }
+
+ if (ret == RECORDER_ERROR_NONE) {
+ handle = (intptr_t)recorder;
+ LOGD("recorder handle : 0x%x, api : %d, module", handle, api, module);
+ muse_core_ipc_set_handle(module, handle);
+
+ recorder_data = (muse_recorder_info_s *)g_new(muse_recorder_info_s, sizeof(muse_recorder_info_s));
+ muse_core_ipc_get_bufmgr(&bufmgr);
+ LOGD("bufmgr: 0x%x", bufmgr);
+ if (bufmgr != NULL) {
+ recorder_data->bufmgr = bufmgr;
+ muse_core_client_set_cust_data(module, (void *)recorder_data);
+ } else {
+ LOGE("TBM bufmgr is NULL => check the mmsvc_core.");
+ }
+ muse_recorder_msg_return1(api, ret, module, POINTER, handle);
+ } else {
+ muse_recorder_msg_return(api, ret, module);
+ }
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_destroy(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ muse_recorder_api_e api = MUSE_RECORDER_API_DESTROY;
+ muse_recorder_info_s *recorder_data;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_destroy((recorder_h)handle);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ recorder_data = (muse_recorder_info_s *)muse_core_client_get_cust_data(module);
+ if (recorder_data != NULL) {
+ g_free(recorder_data);
+ recorder_data = NULL;
+ }
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_get_state(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ muse_recorder_api_e api = MUSE_RECORDER_API_GET_STATE;
+ intptr_t handle;
+ recorder_state_e state;
+ int get_state;
+
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_get_state((recorder_h)handle, &state);
+ get_state = (int)state;
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return1(api, ret, module, INT, get_state);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_prepare(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ muse_recorder_api_e api = MUSE_RECORDER_API_PREPARE;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_prepare((recorder_h)handle);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_unprepare(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ muse_recorder_api_e api = MUSE_RECORDER_API_UNPREPARE;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_unprepare((recorder_h)handle);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_start(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ muse_recorder_api_e api = MUSE_RECORDER_API_START;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_start((recorder_h)handle);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_pause(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ muse_recorder_api_e api = MUSE_RECORDER_API_PAUSE;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_pause((recorder_h)handle);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_commit(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ muse_recorder_api_e api = MUSE_RECORDER_API_COMMIT;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_commit((recorder_h)handle);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_cancel(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ muse_recorder_api_e api = MUSE_RECORDER_API_CANCEL;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_cancel((recorder_h)handle);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_set_video_resolution(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ int width;
+ int height;
+ muse_recorder_api_e api = MUSE_RECORDER_API_SET_VIDEO_RESOLUTION;
+ handle = muse_core_ipc_get_handle(module);
+ muse_recorder_msg_get(width, muse_core_client_get_msg(module));
+ muse_recorder_msg_get(height, muse_core_client_get_msg(module));
+ ret = mmsvc_recorder_set_video_resolution((recorder_h)handle, width, height);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_get_video_resolution(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ int get_width;
+ int get_height;
+ muse_recorder_api_e api = MUSE_RECORDER_API_GET_VIDEO_RESOLUTION;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_get_video_resolution((recorder_h)handle, &get_width, &get_height);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return2(api,
+ ret,
+ module,
+ INT, get_width,
+ INT, get_height);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_foreach_supported_video_resolution(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ muse_recorder_api_e api = MUSE_RECORDER_API_FOREACH_SUPPORTED_VIDEO_RESOLUTION;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_foreach_supported_video_resolution((recorder_h)handle,
+ (recorder_supported_video_resolution_cb)_mmsvc_recorder_disp_foreach_supported_video_resolution_cb,
+ (void *)module);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_get_audio_level(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ double get_level;
+ muse_recorder_api_e api = MUSE_RECORDER_API_GET_AUDIO_LEVEL;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_get_audio_level((recorder_h)handle, &get_level);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return1(api,
+ ret,
+ module,
+ DOUBLE, get_level);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_set_filename(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ char filename[MUSE_RECORDER_MSG_MAX_LENGTH] = {0,};
+ muse_recorder_api_e api = MUSE_RECORDER_API_SET_FILENAME;
+ handle = muse_core_ipc_get_handle(module);
+ muse_recorder_msg_get_string(filename, muse_core_client_get_msg(module));
+ ret = mmsvc_recorder_set_filename((recorder_h)handle, filename);
+ LOGD("handle : 0x%x, filename : %s", handle, filename);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_get_filename(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ char *get_filename;
+ muse_recorder_api_e api = MUSE_RECORDER_API_GET_FILENAME;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_get_filename((recorder_h)handle, &get_filename);
+ LOGD("handle : 0x%x, filename : %s", handle, get_filename);
+ muse_recorder_msg_return1(api, ret, module, STRING, get_filename);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_set_file_format(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ int set_format;
+ muse_recorder_api_e api = MUSE_RECORDER_API_SET_FILE_FORMAT;
+ handle = muse_core_ipc_get_handle(module);
+ muse_recorder_msg_get(set_format, muse_core_client_get_msg(module));
+ ret = mmsvc_recorder_set_file_format((recorder_h)handle, (recorder_file_format_e)set_format);
+ LOGD("handle : 0x%x, set_format : %d", handle, set_format);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_get_file_format(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ recorder_file_format_e format;
+ int get_format;
+ muse_recorder_api_e api = MUSE_RECORDER_API_GET_FILE_FORMAT;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_get_file_format((recorder_h)handle, &format);
+ get_format = (int)format;
+ LOGD("handle : 0x%x, get_format : %d", handle, get_format);
+ muse_recorder_msg_return1(api, ret, module, INT, get_format);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_set_state_changed_cb(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ muse_recorder_api_e api = MUSE_RECORDER_API_SET_STATE_CHANGED_CB;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_set_state_changed_cb((recorder_h)handle,
+ (recorder_state_changed_cb)_mmsvc_recorder_disp_state_changed_cb,
+ (void *)module);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_unset_state_changed_cb(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ muse_recorder_api_e api = MUSE_RECORDER_API_UNSET_STATE_CHANGED_CB;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_unset_state_changed_cb((recorder_h)handle);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_set_interrupted_cb(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ muse_recorder_api_e api = MUSE_RECORDER_API_SET_INTERRUPTED_CB;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_set_interrupted_cb((recorder_h)handle,
+ (recorder_interrupted_cb)_mmsvc_recorder_disp_interrupted_cb,
+ (void *)module);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_unset_interrupted_cb(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ muse_recorder_api_e api = MUSE_RECORDER_API_UNSET_INTERRUPTED_CB;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_unset_interrupted_cb((recorder_h)handle);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_set_audio_stream_cb(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ muse_recorder_api_e api = MUSE_RECORDER_API_SET_AUDIO_STREAM_CB;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_set_audio_stream_cb((recorder_h)handle,
+ (recorder_audio_stream_cb)_mmsvc_recorder_disp_audio_stream_cb,
+ (void *)module);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_unset_audio_stream_cb(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ muse_recorder_api_e api = MUSE_RECORDER_API_UNSET_AUDIO_STREAM_CB;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_unset_audio_stream_cb((recorder_h)handle);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_set_error_cb(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ muse_recorder_api_e api = MUSE_RECORDER_API_SET_ERROR_CB;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_set_error_cb((recorder_h)handle,
+ (recorder_error_cb)_mmsvc_recorder_disp_error_cb,
+ (void *)module);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_unset_error_cb(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ muse_recorder_api_e api = MUSE_RECORDER_API_UNSET_ERROR_CB;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_unset_error_cb((recorder_h)handle);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_set_recording_status_cb(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ muse_recorder_api_e api = MUSE_RECORDER_API_SET_RECORDING_STATUS_CB;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_set_recording_status_cb((recorder_h)handle,
+ (recorder_recording_status_cb)_mmsvc_recorder_disp_recording_status_cb,
+ (void *)module);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_unset_recording_status_cb(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ muse_recorder_api_e api = MUSE_RECORDER_API_UNSET_RECORDING_STATUS_CB;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_unset_recording_status_cb((recorder_h)handle);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_set_recording_limit_reached_cb(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ muse_recorder_api_e api = MUSE_RECORDER_API_SET_RECORDING_LIMIT_REACHED_CB;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_set_recording_limit_reached_cb((recorder_h)handle,
+ (recorder_recording_limit_reached_cb)_mmsvc_recorder_disp_recording_limit_reached_cb,
+ (void *)module);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_unset_recording_limit_reached_cb(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ muse_recorder_api_e api = MUSE_RECORDER_API_UNSET_RECORDING_LIMIT_REACHED_CB;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_unset_recording_limit_reached_cb((recorder_h)handle);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_foreach_supported_file_format(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ muse_recorder_api_e api = MUSE_RECORDER_API_FOREACH_SUPPORTED_FILE_FORMAT;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_foreach_supported_file_format((recorder_h)handle,
+ (recorder_supported_file_format_cb)_mmsvc_recorder_disp_foreach_supported_file_format_cb,
+ (void *)module);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_attr_set_size_limit(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ int kbyte;
+ muse_recorder_api_e api = MUSE_RECORDER_API_ATTR_SET_SIZE_LIMIT;
+ handle = muse_core_ipc_get_handle(module);
+ muse_recorder_msg_get(kbyte, muse_core_client_get_msg(module));
+ ret = mmsvc_recorder_attr_set_size_limit((recorder_h)handle, kbyte);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_attr_set_time_limit(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ int second;
+ muse_recorder_api_e api = MUSE_RECORDER_API_ATTR_SET_TIME_LIMIT;
+ handle = muse_core_ipc_get_handle(module);
+ muse_recorder_msg_get(second, muse_core_client_get_msg(module));
+ ret = mmsvc_recorder_attr_set_time_limit((recorder_h)handle, second);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_attr_set_audio_device(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ int set_device;
+ muse_recorder_api_e api = MUSE_RECORDER_API_ATTR_SET_AUDIO_DEVICE;
+ handle = muse_core_ipc_get_handle(module);
+ muse_recorder_msg_get(set_device, muse_core_client_get_msg(module));
+ ret = mmsvc_recorder_attr_set_audio_device((recorder_h)handle, (recorder_audio_device_e)set_device);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_set_audio_encoder(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ int set_codec;
+ muse_recorder_api_e api = MUSE_RECORDER_API_SET_AUDIO_ENCODER;
+ handle = muse_core_ipc_get_handle(module);
+ muse_recorder_msg_get(set_codec, muse_core_client_get_msg(module));
+ ret = mmsvc_recorder_set_audio_encoder((recorder_h)handle, (recorder_audio_codec_e)set_codec);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_get_audio_encoder(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ recorder_audio_codec_e codec;
+ int get_codec;
+ muse_recorder_api_e api = MUSE_RECORDER_API_GET_AUDIO_ENCODER;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_get_audio_encoder((recorder_h)handle, &codec);
+ get_codec = (int)codec;
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return1(api, ret, module, INT, get_codec);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_set_video_encoder(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ int set_codec;
+ muse_recorder_api_e api = MUSE_RECORDER_API_SET_VIDEO_ENCODER;
+ handle = muse_core_ipc_get_handle(module);
+ muse_recorder_msg_get(set_codec, muse_core_client_get_msg(module));
+ ret = mmsvc_recorder_set_video_encoder((recorder_h)handle, (recorder_video_codec_e)set_codec);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_get_video_encoder(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ recorder_video_codec_e codec;
+ int get_codec;
+ muse_recorder_api_e api = MUSE_RECORDER_API_GET_VIDEO_ENCODER;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_get_video_encoder((recorder_h)handle, &codec);
+ get_codec = (int)codec;
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return1(api, ret, module, INT, get_codec);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_attr_set_audio_samplerate(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ int samplerate;
+ muse_recorder_api_e api = MUSE_RECORDER_API_ATTR_SET_AUDIO_SAMPLERATE;
+ handle = muse_core_ipc_get_handle(module);
+ muse_recorder_msg_get(samplerate, muse_core_client_get_msg(module));
+ ret = mmsvc_recorder_attr_set_audio_samplerate((recorder_h)handle, samplerate);
+ LOGD("handle : 0x%x samplerate : %d", handle, samplerate);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_attr_set_audio_encoder_bitrate(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ int bitrate;
+ muse_recorder_api_e api = MUSE_RECORDER_API_ATTR_SET_AUDIO_ENCODER_BITRATE;
+ handle = muse_core_ipc_get_handle(module);
+ muse_recorder_msg_get(bitrate, muse_core_client_get_msg(module));
+ ret = mmsvc_recorder_attr_set_audio_encoder_bitrate((recorder_h)handle, bitrate);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_attr_set_video_encoder_bitrate(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ int bitrate;
+ muse_recorder_api_e api = MUSE_RECORDER_API_ATTR_SET_VIDEO_ENCODER_BITRATE;
+ handle = muse_core_ipc_get_handle(module);
+ muse_recorder_msg_get(bitrate, muse_core_client_get_msg(module));
+ ret = mmsvc_recorder_attr_set_video_encoder_bitrate((recorder_h)handle, bitrate);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_attr_get_size_limit(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ int get_kbyte;
+ muse_recorder_api_e api = MUSE_RECORDER_API_ATTR_GET_SIZE_LIMIT;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_attr_get_size_limit((recorder_h)handle, &get_kbyte);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return1(api, ret, module, INT, get_kbyte);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_attr_get_time_limit(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ int get_second;
+ muse_recorder_api_e api = MUSE_RECORDER_API_ATTR_GET_TIME_LIMIT;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_attr_get_time_limit((recorder_h)handle, &get_second);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return1(api, ret, module, INT, get_second);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_attr_get_audio_device(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ recorder_audio_device_e device;
+ int get_device;
+ muse_recorder_api_e api = MUSE_RECORDER_API_ATTR_GET_AUDIO_DEVICE;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_attr_get_audio_device((recorder_h)handle, &device);
+ get_device = (int)device;
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return1(api, ret, module, INT, get_device);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_attr_get_audio_samplerate(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ int get_samplerate;
+ muse_recorder_api_e api = MUSE_RECORDER_API_ATTR_GET_AUDIO_SAMPLERATE;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_attr_get_audio_samplerate((recorder_h)handle, &get_samplerate);
+ LOGD("handle : 0x%x, get_samplerate : %d", handle, get_samplerate);
+ muse_recorder_msg_return1(api, ret, module, INT, get_samplerate);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_attr_get_audio_encoder_bitrate(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ int get_bitrate;
+ muse_recorder_api_e api = MUSE_RECORDER_API_ATTR_GET_AUDIO_ENCODER_BITRATE;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_attr_get_audio_encoder_bitrate((recorder_h)handle, &get_bitrate);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return1(api, ret, module, INT, get_bitrate);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_attr_get_video_encoder_bitrate(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ int get_bitrate;
+ muse_recorder_api_e api = MUSE_RECORDER_API_ATTR_GET_VIDEO_ENCODER_BITRATE;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_attr_get_video_encoder_bitrate((recorder_h)handle, &get_bitrate);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return1(api, ret, module, INT, get_bitrate);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_foreach_supported_audio_encoder(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ muse_recorder_api_e api = MUSE_RECORDER_API_FOREACH_SUPPORTED_AUDIO_ENCODER;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_foreach_supported_audio_encoder((recorder_h)handle,
+ (recorder_supported_audio_encoder_cb)_mmsvc_recorder_disp_foreach_supported_audio_encoder_cb,
+ (void *)module);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_foreach_supported_video_encoder(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ muse_recorder_api_e api = MUSE_RECORDER_API_FOREACH_SUPPORTED_VIDEO_ENCODER;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_foreach_supported_video_encoder((recorder_h)handle,
+ (recorder_supported_video_encoder_cb)_mmsvc_recorder_disp_foreach_supported_video_encoder_cb,
+ (void *)module);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_attr_set_mute(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ int set_enable;
+ muse_recorder_api_e api = MUSE_RECORDER_API_ATTR_SET_MUTE;
+ handle = muse_core_ipc_get_handle(module);
+ muse_recorder_msg_get(set_enable, muse_core_client_get_msg(module));
+ ret = mmsvc_recorder_attr_set_mute((recorder_h)handle, (bool)set_enable);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_attr_is_muted(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ muse_recorder_api_e api = MUSE_RECORDER_API_ATTR_IS_MUTED;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_attr_is_muted((recorder_h)handle);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_attr_set_recording_motion_rate(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ double rate;
+ muse_recorder_api_e api = MUSE_RECORDER_API_ATTR_SET_RECORDING_MOTION_RATE;
+ handle = muse_core_ipc_get_handle(module);
+ muse_recorder_msg_get(rate, muse_core_client_get_msg(module));
+ ret = mmsvc_recorder_attr_set_recording_motion_rate((recorder_h)handle, rate);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_attr_get_recording_motion_rate(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ double get_rate;
+ muse_recorder_api_e api = MUSE_RECORDER_API_ATTR_GET_RECORDING_MOTION_RATE;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_attr_get_recording_motion_rate((recorder_h)handle, &get_rate);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return1(api, ret, module, DOUBLE, get_rate);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_attr_set_audio_channel(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ int channel_count;
+ muse_recorder_api_e api = MUSE_RECORDER_API_ATTR_SET_AUDIO_CHANNEL;
+ handle = muse_core_ipc_get_handle(module);
+ muse_recorder_msg_get(channel_count, muse_core_client_get_msg(module));
+ LOGD("channel_count : %d", channel_count);
+ ret = mmsvc_recorder_attr_set_audio_channel((recorder_h)handle, channel_count);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_attr_get_audio_channel(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ int get_channel_count;
+ muse_recorder_api_e api = MUSE_RECORDER_API_ATTR_GET_AUDIO_CHANNEL;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_attr_get_audio_channel((recorder_h)handle, &get_channel_count);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return1(api, ret, module, INT, get_channel_count);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_attr_set_orientation_tag(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ int set_orientation;
+ muse_recorder_api_e api = MUSE_RECORDER_API_ATTR_SET_ORIENTATION_TAG;
+ handle = muse_core_ipc_get_handle(module);
+ muse_recorder_msg_get(set_orientation, muse_core_client_get_msg(module));
+ ret = mmsvc_recorder_attr_set_orientation_tag((recorder_h)handle, (recorder_rotation_e)set_orientation);
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return(api, ret, module);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int recorder_dispatcher_attr_get_orientation_tag(muse_module_h module)
+{
+ int ret = RECORDER_ERROR_NONE;
+ intptr_t handle;
+ recorder_rotation_e orientation;
+ int get_orientation;
+ muse_recorder_api_e api = MUSE_RECORDER_API_ATTR_GET_ORIENTATION_TAG;
+ handle = muse_core_ipc_get_handle(module);
+ ret = mmsvc_recorder_attr_get_orientation_tag((recorder_h)handle, &orientation);
+ get_orientation = (int)orientation;
+ LOGD("handle : 0x%x", handle);
+ muse_recorder_msg_return1(api, ret, module, INT, get_orientation);
+
+ return MUSE_RECORDER_ERROR_NONE;
+}
+
+int (*dispatcher[MUSE_RECORDER_API_MAX]) (muse_module_h module) = {
+ recorder_dispatcher_create, /* MUSE_RECORDER_API_CREATE, */
+ recorder_dispatcher_destroy, /* MUSE_RECORDER_API_DESTROY, */
+ recorder_dispatcher_get_state, /* MUSE_RECORDER_API_GET_STATE, */
+ recorder_dispatcher_prepare, /* MUSE_RECORDER_API_PREPARE, */
+ recorder_dispatcher_unprepare, /* MUSE_RECORDER_API_UNPREPARE, */
+ recorder_dispatcher_start, /* MUSE_RECORDER_API_START, */
+ recorder_dispatcher_pause, /* MUSE_RECORDER_API_PAUSE, */
+ recorder_dispatcher_commit, /* MUSE_RECORDER_API_COMMIT, */
+ recorder_dispatcher_cancel, /* MUSE_RECORDER_API_CANCEL, */
+ recorder_dispatcher_set_video_resolution, /* MUSE_RECORDER_API_SET_VIDEO_RESOLUTION, */
+ recorder_dispatcher_get_video_resolution, /* MUSE_RECORDER_API_GET_VIDEO_RESOLUTION, */
+ recorder_dispatcher_foreach_supported_video_resolution, /* MUSE_RECORDER_API_FOREACH_SUPPORTED_VIDEO_RESOLUTION, */
+ recorder_dispatcher_get_audio_level, /* MUSE_RECORDER_API_GET_AUDIO_LEVEL, */
+ recorder_dispatcher_set_filename, /* MUSE_RECORDER_API_SET_FILENAME, */
+ recorder_dispatcher_get_filename, /* MUSE_RECORDER_API_GET_FILENAME, */
+ recorder_dispatcher_set_file_format, /* MUSE_RECORDER_API_SET_FILE_FORMAT, */
+ recorder_dispatcher_get_file_format, /* MUSE_RECORDER_API_GET_FILE_FORMAT, */
+ recorder_dispatcher_set_state_changed_cb, /* MUSE_RECORDER_API_SET_STATE_CHANGED_CB, */
+ recorder_dispatcher_unset_state_changed_cb, /* MUSE_RECORDER_API_UNSET_STATE_CHANGED_CB, */
+ recorder_dispatcher_set_interrupted_cb, /* MUSE_RECORDER_API_SET_INTERRUPTED_CB, */
+ recorder_dispatcher_unset_interrupted_cb, /* MUSE_RECORDER_API_UNSET_INTERRUPTED_CB, */
+ recorder_dispatcher_set_audio_stream_cb, /* MUSE_RECORDER_API_SET_AUDIO_STREAM_CB, */
+ recorder_dispatcher_unset_audio_stream_cb, /* MUSE_RECORDER_API_UNSET_AUDIO_STREAM_CB, */
+ recorder_dispatcher_set_error_cb, /* MUSE_RECORDER_API_SET_ERROR_CB, */
+ recorder_dispatcher_unset_error_cb, /* MUSE_RECORDER_API_UNSET_ERROR_CB, */
+ recorder_dispatcher_set_recording_status_cb, /* MUSE_RECORDER_API_SET_RECORDING_STATUS_CB, */
+ recorder_dispatcher_unset_recording_status_cb, /* MUSE_RECORDER_API_UNSET_RECORDING_STATUS_CB, */
+ recorder_dispatcher_set_recording_limit_reached_cb, /* MUSE_RECORDER_API_SET_RECORDING_LIMIT_RECHEAD_CB, */
+ recorder_dispatcher_unset_recording_limit_reached_cb, /* MUSE_RECORDER_API_UNSET_RECORDING_LIMIT_RECHEAD_CB, */
+ recorder_dispatcher_foreach_supported_file_format, /* MUSE_RECORDER_API_FOREACH_SUPPORTED_FILE_FORMAT, */
+ recorder_dispatcher_attr_set_size_limit, /* MUSE_RECORDER_API_ATTR_SET_SIZE_LIMIT, */
+ recorder_dispatcher_attr_set_time_limit, /* MUSE_RECORDER_API_ATTR_SET_TIME_LIMIT, */
+ recorder_dispatcher_attr_set_audio_device, /* MUSE_RECORDER_API_ATTR_SET_AUDIO_DEVICE, */
+ recorder_dispatcher_set_audio_encoder, /* MUSE_RECORDER_API_SET_AUDIO_ENCODER, */
+ recorder_dispatcher_get_audio_encoder, /* MUSE_RECORDER_API_GET_AUDIO_ENCODER, */
+ recorder_dispatcher_set_video_encoder, /* MUSE_RECORDER_API_SET_VIDEO_ENCODER, */
+ recorder_dispatcher_get_video_encoder, /* MUSE_RECORDER_API_GET_VIDEO_ENCODER, */
+ recorder_dispatcher_attr_set_audio_samplerate, /* MUSE_RECORDER_API_ATTR_SET_AUDIO_SAMPLERATE, */
+ recorder_dispatcher_attr_set_audio_encoder_bitrate, /* MUSE_RECORDER_API_ATTR_SET_AUDIO_ENCODER_BITRATE, */
+ recorder_dispatcher_attr_set_video_encoder_bitrate, /* MUSE_RECORDER_API_ATTR_SET_VIDEO_ENCODER_BITRATE, */
+ recorder_dispatcher_attr_get_size_limit, /* MUSE_RECORDER_API_ATTR_GET_SIZE_LIMIT, */
+ recorder_dispatcher_attr_get_time_limit, /* MUSE_RECORDER_API_ATTR_GET_TIME_LIMIT, */
+ recorder_dispatcher_attr_get_audio_device, /* MUSE_RECORDER_API_ATTR_GET_AUDIO_DEVICE, */
+ recorder_dispatcher_attr_get_audio_samplerate, /* MUSE_RECORDER_API_ATTR_GET_AUDIO_SAMPLERATE, */
+ recorder_dispatcher_attr_get_audio_encoder_bitrate, /* MUSE_RECORDER_API_ATTR_GET_AUDIO_ENCODER_BITRATE, */
+ recorder_dispatcher_attr_get_video_encoder_bitrate, /* MUSE_RECORDER_API_ATTR_GET_VIDEO_ENCODER_BITRATE, */
+ recorder_dispatcher_foreach_supported_audio_encoder, /* MUSE_RECORDER_API_FOREACH_SUPPORTED_AUDIO_ENCODER, */
+ recorder_dispatcher_foreach_supported_video_encoder, /* MUSE_RECORDER_API_FOREACH_SUPPORTED_VIDEO_ENCODER, */
+ recorder_dispatcher_attr_set_mute, /* MUSE_RECORDER_API_ATTR_SET_MUTE, */
+ recorder_dispatcher_attr_is_muted, /* MUSE_RECORDER_API_ATTR_IS_MUTED, */
+ recorder_dispatcher_attr_set_recording_motion_rate, /* MUSE_RECORDER_API_ATTR_SET_RECORDING_MOTION_RATE, */
+ recorder_dispatcher_attr_get_recording_motion_rate, /* MUSE_RECORDER_API_ATTR_GET_RECORDING_MOTION_RATE, */
+ recorder_dispatcher_attr_set_audio_channel, /* MUSE_RECORDER_API_ATTR_SET_AUDIO_CHANNEL, */
+ recorder_dispatcher_attr_get_audio_channel, /* MUSE_RECORDER_API_ATTR_GET_AUDIO_CHANNEL, */
+ recorder_dispatcher_attr_set_orientation_tag, /* MUSE_RECORDER_API_ATTR_SET_ORIENTATION_TAG, */
+ recorder_dispatcher_attr_get_orientation_tag, /* MUSE_RECORDER_API_ATTR_GET_ORIENTATION_TAG, */
+};
--- /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.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+#include <errno.h>
+#include <err.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <glib.h>
+#include "muse_core.h"
+#include "muse_core_workqueue.h"
+#include "muse_recorder.h"
+#include "mm_types.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "MUSE_RECORDER_IPC"
+
+bool muse_recorder_ipc_make_tbm(muse_recorder_transport_info_s *transport_info)
+{
+ if(transport_info == NULL) {
+ LOGE("transport_info is NULL!");
+ return FALSE;
+ }
+
+ tbm_bufmgr bufmgr = transport_info->bufmgr;
+
+ bufmgr = transport_info->bufmgr;
+ LOGD("Enter!bufmgr : 0x%x", bufmgr);
+
+ if(bufmgr == NULL) {
+ LOGE("tbm_bufmgr is NULL!");
+ return FALSE;
+ }
+
+ transport_info->bo = tbm_bo_alloc(bufmgr, transport_info->data_size, TBM_BO_DEFAULT);
+
+ if(transport_info->bo == NULL) {
+ LOGE("tbm_bo_alloc Error!");
+ tbm_bufmgr_deinit(bufmgr);
+ return FALSE;
+ }
+
+ transport_info->bo_handle = tbm_bo_map(transport_info->bo, TBM_DEVICE_CPU, TBM_OPTION_WRITE);
+
+ if(transport_info->bo_handle.ptr == NULL) {
+ if (transport_info->bo != NULL) {
+ tbm_bo_unref(transport_info->bo);
+ }
+ LOGE("tbm_bo_map Error!");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+int muse_recorder_ipc_export_tbm(muse_recorder_transport_info_s transport_info)
+{
+ LOGD("muse_recorder_ipc_export_tbm_bo!");
+ return tbm_bo_export(transport_info.bo);
+}
+
+
+bool muse_recorder_ipc_init_tbm(muse_recorder_transport_info_s *transport_info)
+{
+ int drm_fd = -1;
+
+ LOGE("muse_recorder_ipc_import_tbm enter!!");
+
+ transport_info->bufmgr = tbm_bufmgr_init(drm_fd);
+ if (transport_info->bufmgr == NULL) {
+ LOGE("tbm_bufmgr_init error!!");
+ return FALSE;
+ }
+ return TRUE;
+}
+
+int muse_recorder_ipc_import_tbm(muse_recorder_transport_info_s *transport_info)
+{
+ LOGD("muse_recorder_ipc_import_tbm enter!!");
+
+ transport_info->bo = tbm_bo_import(transport_info->bufmgr, transport_info->tbm_key);
+ if (transport_info->bo == NULL) {
+ goto IMPORT_FAIL;
+ }
+
+ transport_info->bo_handle = tbm_bo_map(transport_info->bo, TBM_DEVICE_CPU, TBM_OPTION_READ);
+
+ LOGE("tbm_bo_map passed!!!!!!!bo_handle.ptr : 0x%x", transport_info->bo_handle.ptr);
+
+ return TRUE;
+
+IMPORT_FAIL:
+ return FALSE;
+}
+
+void muse_recorder_ipc_unref_tbm(muse_recorder_transport_info_s *transport_info)
+{
+ LOGD("Enter");
+ if (transport_info->bo) {
+ LOGD("Unref bo");
+ tbm_bo_unmap(transport_info->bo);
+ tbm_bo_unref(transport_info->bo);
+ }
+ return;
+}
--- /dev/null
+Name: mmsvc-recorder
+Summary: A Recorder library in Tizen Native API
+Version: 0.2.2
+Release: 0
+Group: Multimedia/API
+License: Apache-2.0
+Source0: %{service}-%{name}-%{version}.tar.gz
+BuildRequires: cmake
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(mm-camcorder)
+BuildRequires: pkgconfig(audio-session-mgr)
+BuildRequires: pkgconfig(capi-base-common)
+BuildRequires: pkgconfig(mmsvc-camera)
+BuildRequires: pkgconfig(mm-common)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(mused)
+BuildRequires: pkgconfig(capi-media-tool)
+BuildRequires: pkgconfig(json)
+BuildRequires: pkgconfig(capi-media-audio-io)
+
+
+%description
+A Recorder library in Tizen Native API
+
+
+%package devel
+Summary: A Recorder library in Tizen C API (Development)
+Requires: %{name} = %{version}-%{release}
+
+
+%description devel
+A Recorder library in Tizen Native API Development Package.
+
+
+%prep
+%setup -q
+
+
+%build
+MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+%cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
+make %{?jobs:-j%jobs}
+
+
+%install
+rm -rf %{buildroot}
+mkdir -p %{buildroot}/usr/share/license
+cp LICENSE.APLv2 %{buildroot}/usr/share/license/%{name}
+
+
+%make_install
+
+
+%post -p /sbin/ldconfig
+
+
+%postun -p /sbin/ldconfig
+
+
+%files
+%manifest mmsvc-recorder.manifest
+%{_libdir}/libmmsvc-recorder.so.*
+%{_libdir}/libmuse-recorder.so*
+%{_datadir}/license/%{name}
+%{_includedir}/media/mmsvc_recorder.h
+
+%files devel
+%{_includedir}/media/muse_recorder.h
+%{_includedir}/media/muse_recorder_msg.h
+%{_libdir}/pkgconfig/*.pc
+%{_libdir}/libmmsvc-recorder.so
+%{_libdir}/libmuse-recorder.so
--- /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.
+*/
+
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <mm.h>
+#include <audio-session-manager-types.h>
+#include <mm_camcorder.h>
+#include <mm_types.h>
+#include <math.h>
+#include <mmsvc_camera.h>
+#include <mmsvc_recorder_private.h>
+#include <dlog.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TIZEN_N_RECORDER"
+
+#define LOWSET_DECIBEL -300.0
+#define RECORDER_PATH_RECORDER_RESOURCE "/usr/share/sounds/mm-camcorder/recorder_resource"
+
+
+/*
+ * camera_private function
+*/
+int _camera_get_mm_handle(camera_h camera , MMHandleType *handle);
+int _camera_set_relay_mm_message_callback(camera_h camera, MMMessageCallback callback, void *user_data);
+int _camera_set_use(camera_h camera, bool used);
+bool _camera_is_used(camera_h camera);
+/*
+ * end of camera_private function
+ */
+
+static int __mm_audio_stream_cb(MMCamcorderAudioStreamDataType *stream, void *user_param);
+static int __mm_recorder_msg_cb(int message, void *param, void *user_data);
+
+
+static int __convert_error_code_camera_to_recorder(int code)
+{
+ int new_code = code;
+
+ switch (code) {
+ case CAMERA_ERROR_INVALID_STATE :
+ new_code = RECORDER_ERROR_INVALID_STATE;
+ break;
+ case CAMERA_ERROR_DEVICE:
+ new_code = RECORDER_ERROR_DEVICE;
+ break;
+ case CAMERA_ERROR_SOUND_POLICY:
+ new_code = RECORDER_ERROR_SOUND_POLICY;
+ break;
+ case CAMERA_ERROR_SECURITY_RESTRICTED:
+ new_code = RECORDER_ERROR_SECURITY_RESTRICTED;
+ break;
+ default:
+ break;
+ }
+
+ return new_code;
+}
+
+
+int __convert_recorder_error_code(const char *func, int code)
+{
+ int ret = RECORDER_ERROR_INVALID_OPERATION;
+ const char *errorstr = NULL;
+
+ switch (code) {
+ case RECORDER_ERROR_INVALID_PARAMETER:
+ ret = RECORDER_ERROR_INVALID_PARAMETER;
+ errorstr = "INVALID_PARAMETER";
+ break;
+ case MM_ERROR_NONE:
+ ret = RECORDER_ERROR_NONE;
+ errorstr = "ERROR_NONE";
+ break;
+ case MM_ERROR_CAMCORDER_INVALID_ARGUMENT :
+ case MM_ERROR_COMMON_INVALID_ATTRTYPE :
+ ret = RECORDER_ERROR_INVALID_PARAMETER;
+ errorstr = "INVALID_PARAMETER";
+ break;
+ case MM_ERROR_COMMON_INVALID_PERMISSION :
+ ret = RECORDER_ERROR_PERMISSION_DENIED;
+ errorstr = "ERROR_PERMISSION_DENIED";
+ break;
+ case MM_ERROR_CAMCORDER_NOT_INITIALIZED :
+ case MM_ERROR_CAMCORDER_INVALID_STATE :
+ ret = RECORDER_ERROR_INVALID_STATE;
+ errorstr = "INVALID_STATE";
+ break;
+ case MM_ERROR_CAMCORDER_DEVICE :
+ case MM_ERROR_CAMCORDER_DEVICE_NOT_FOUND :
+ case MM_ERROR_CAMCORDER_DEVICE_BUSY :
+ case MM_ERROR_CAMCORDER_DEVICE_OPEN :
+ case MM_ERROR_CAMCORDER_DEVICE_IO :
+ case MM_ERROR_CAMCORDER_DEVICE_TIMEOUT :
+ case MM_ERROR_CAMCORDER_DEVICE_WRONG_JPEG :
+ case MM_ERROR_CAMCORDER_DEVICE_LACK_BUFFER :
+ ret = RECORDER_ERROR_DEVICE;
+ errorstr = "ERROR_DEVICE";
+ break;
+ case MM_ERROR_CAMCORDER_GST_CORE :
+ case MM_ERROR_CAMCORDER_GST_LIBRARY :
+ case MM_ERROR_CAMCORDER_GST_RESOURCE :
+ case MM_ERROR_CAMCORDER_GST_STREAM :
+ case MM_ERROR_CAMCORDER_GST_STATECHANGE :
+ case MM_ERROR_CAMCORDER_GST_NEGOTIATION :
+ case MM_ERROR_CAMCORDER_GST_LINK :
+ case MM_ERROR_CAMCORDER_GST_FLOW_ERROR :
+ case MM_ERROR_CAMCORDER_ENCODER :
+ case MM_ERROR_CAMCORDER_ENCODER_BUFFER :
+ case MM_ERROR_CAMCORDER_ENCODER_WRONG_TYPE :
+ case MM_ERROR_CAMCORDER_ENCODER_WORKING :
+ case MM_ERROR_CAMCORDER_INTERNAL :
+ case MM_ERROR_CAMCORDER_RESPONSE_TIMEOUT :
+ case MM_ERROR_CAMCORDER_CMD_IS_RUNNING :
+ case MM_ERROR_CAMCORDER_DSP_FAIL :
+ case MM_ERROR_CAMCORDER_AUDIO_EMPTY :
+ case MM_ERROR_CAMCORDER_CREATE_CONFIGURE :
+ case MM_ERROR_CAMCORDER_FILE_SIZE_OVER :
+ case MM_ERROR_CAMCORDER_DISPLAY_DEVICE_OFF :
+ case MM_ERROR_CAMCORDER_INVALID_CONDITION :
+ ret = RECORDER_ERROR_INVALID_OPERATION;
+ errorstr = "INVALID_OPERATION";
+ break;
+ case MM_ERROR_CAMCORDER_RESOURCE_CREATION :
+ case MM_ERROR_COMMON_OUT_OF_MEMORY:
+ ret = RECORDER_ERROR_OUT_OF_MEMORY;
+ errorstr = "OUT_OF_MEMORY";
+ break;
+ case MM_ERROR_POLICY_BLOCKED:
+ ret = RECORDER_ERROR_SOUND_POLICY;
+ errorstr = "ERROR_SOUND_POLICY";
+ break;
+ case MM_ERROR_POLICY_BLOCKED_BY_CALL:
+ ret = RECORDER_ERROR_SOUND_POLICY_BY_CALL;
+ errorstr = "ERROR_SOUND_POLICY_BY_CALL";
+ break;
+ case MM_ERROR_POLICY_BLOCKED_BY_ALARM:
+ ret = RECORDER_ERROR_SOUND_POLICY_BY_ALARM;
+ errorstr = "ERROR_SOUND_POLICY_BY_ALARM";
+ break;
+ case MM_ERROR_POLICY_RESTRICTED:
+ ret = RECORDER_ERROR_SECURITY_RESTRICTED;
+ errorstr = "ERROR_RESTRICTED";
+ break;
+ case MM_ERROR_CAMCORDER_DEVICE_REG_TROUBLE:
+ ret = RECORDER_ERROR_ESD;
+ errorstr = "ERROR_ESD";
+ break;
+ case MM_ERROR_OUT_OF_STORAGE:
+ ret = RECORDER_ERROR_OUT_OF_STORAGE;
+ errorstr = "OUT_OF_STORAGE";
+ break;
+ case MM_ERROR_COMMON_OUT_OF_ARRAY:
+ case MM_ERROR_COMMON_OUT_OF_RANGE:
+ case MM_ERROR_COMMON_ATTR_NOT_EXIST:
+ case MM_ERROR_CAMCORDER_NOT_SUPPORTED:
+ ret = RECORDER_ERROR_NOT_SUPPORTED;
+ errorstr = "NOT_SUPPORTED";
+ break;
+ default:
+ ret = RECORDER_ERROR_INVALID_OPERATION;
+ errorstr = "INVALID_OPERATION";
+ break;
+ }
+
+ LOGE("[%s] %s(0x%08x) : core frameworks error code(0x%08x)", func, errorstr, ret, code);
+
+ return ret;
+}
+
+
+static recorder_state_e __recorder_state_convert(MMCamcorderStateType mm_state)
+{
+ recorder_state_e state = RECORDER_STATE_NONE;
+ switch (mm_state) {
+ case MM_CAMCORDER_STATE_NONE:
+ state = RECORDER_STATE_NONE;
+ break;
+ case MM_CAMCORDER_STATE_NULL:
+ state = RECORDER_STATE_CREATED;
+ break;
+ case MM_CAMCORDER_STATE_READY:
+ state = RECORDER_STATE_CREATED;
+ break;
+ case MM_CAMCORDER_STATE_PREPARE:
+ state = RECORDER_STATE_READY;
+ break;
+ case MM_CAMCORDER_STATE_CAPTURING:
+ state = RECORDER_STATE_READY;
+ break;
+ case MM_CAMCORDER_STATE_RECORDING:
+ state = RECORDER_STATE_RECORDING;
+ break;
+ case MM_CAMCORDER_STATE_PAUSED:
+ state = RECORDER_STATE_PAUSED;
+ break;
+ default:
+ state = RECORDER_STATE_NONE;
+ break;
+ }
+
+ return state;
+}
+
+
+static int __mm_recorder_msg_cb(int message, void *param, void *user_data)
+{
+ recorder_s * handle = (recorder_s *)user_data;
+ MMMessageParamType *m = (MMMessageParamType *)param;
+ recorder_state_e previous_state;
+ recorder_recording_limit_type_e type;
+ int recorder_error = 0;
+
+ switch (message) {
+ case MM_MESSAGE_READY_TO_RESUME:
+ LOGW("not supported message");
+ break;
+ case MM_MESSAGE_CAMCORDER_STATE_CHANGED:
+ case MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_ASM:
+ case MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_SECURITY:
+ previous_state = handle->state;
+ handle->state = __recorder_state_convert(m->state.current);
+ recorder_policy_e policy = RECORDER_POLICY_NONE;
+ if (message == MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_ASM) {
+ switch (m->state.code) {
+ case ASM_EVENT_SOURCE_CALL_START:
+ case ASM_EVENT_SOURCE_CALL_END:
+ policy = RECORDER_POLICY_SOUND_BY_CALL;
+ LOGE("RECORDER_POLICY_SOUND_BY_CALL");
+ break;
+ case ASM_EVENT_SOURCE_ALARM_START:
+ case ASM_EVENT_SOURCE_ALARM_END:
+ policy = RECORDER_POLICY_SOUND_BY_ALARM;
+ LOGE("RECORDER_POLICY_SOUND_BY_ALARM");
+ break;
+ default:
+ policy = RECORDER_POLICY_SOUND;
+ LOGE("RECORDER_POLICY_SOUND");
+ break;
+ }
+ } else if (message == MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_SECURITY) {
+ policy = RECORDER_POLICY_SECURITY;
+ LOGE("RECORDER_POLICY_SECURITY");
+ }
+
+ if (previous_state != handle->state && handle->user_cb[_RECORDER_EVENT_TYPE_STATE_CHANGE]) {
+ ((recorder_state_changed_cb)handle->user_cb[_RECORDER_EVENT_TYPE_STATE_CHANGE])(previous_state, handle->state, policy, handle->user_data[_RECORDER_EVENT_TYPE_STATE_CHANGE]);
+ }
+
+ /* should change intermediate state MM_CAMCORDER_STATE_READY is not valid in capi , change to NULL state */
+ if (policy != RECORDER_POLICY_NONE &&
+ (m->state.current == MM_CAMCORDER_STATE_PAUSED || m->state.current == MM_CAMCORDER_STATE_NULL)) {
+ if (handle->user_cb[_RECORDER_EVENT_TYPE_INTERRUPTED]) {
+ ((recorder_interrupted_cb)handle->user_cb[_RECORDER_EVENT_TYPE_INTERRUPTED])(policy, previous_state, handle->state, handle->user_data[_RECORDER_EVENT_TYPE_INTERRUPTED]);
+ } else {
+ LOGW("_RECORDER_EVENT_TYPE_INTERRUPTED cb is NULL");
+ }
+ }
+ break;
+ case MM_MESSAGE_CAMCORDER_MAX_SIZE:
+ case MM_MESSAGE_CAMCORDER_NO_FREE_SPACE:
+ case MM_MESSAGE_CAMCORDER_TIME_LIMIT:
+ if (MM_MESSAGE_CAMCORDER_MAX_SIZE == message) {
+ type = RECORDER_RECORDING_LIMIT_SIZE;
+ } else if (MM_MESSAGE_CAMCORDER_NO_FREE_SPACE == message) {
+ type = RECORDER_RECORDING_LIMIT_FREE_SPACE;
+ } else {
+ type = RECORDER_RECORDING_LIMIT_TIME;
+ }
+ if (handle->user_cb[_RECORDER_EVENT_TYPE_RECORDING_LIMITED]) {
+ ((recorder_recording_limit_reached_cb)handle->user_cb[_RECORDER_EVENT_TYPE_RECORDING_LIMITED])(type, handle->user_data[_RECORDER_EVENT_TYPE_RECORDING_LIMITED]);
+ }
+ break;
+ case MM_MESSAGE_CAMCORDER_RECORDING_STATUS:
+ if (handle->user_cb[_RECORDER_EVENT_TYPE_RECORDING_STATUS]) {
+ ((recorder_recording_status_cb)handle->user_cb[_RECORDER_EVENT_TYPE_RECORDING_STATUS])(m->recording_status.elapsed, m->recording_status.filesize, handle->user_data[_RECORDER_EVENT_TYPE_RECORDING_STATUS]);
+ }
+ break;
+ case MM_MESSAGE_CAMCORDER_ERROR:
+ switch (m->code) {
+ case MM_ERROR_CAMCORDER_DEVICE:
+ case MM_ERROR_CAMCORDER_DEVICE_TIMEOUT:
+ case MM_ERROR_CAMCORDER_DEVICE_WRONG_JPEG:
+ recorder_error = RECORDER_ERROR_DEVICE;
+ break;
+ case MM_ERROR_CAMCORDER_GST_CORE:
+ case MM_ERROR_CAMCORDER_GST_LIBRARY:
+ case MM_ERROR_CAMCORDER_GST_RESOURCE:
+ case MM_ERROR_CAMCORDER_GST_STREAM:
+ case MM_ERROR_CAMCORDER_GST_NEGOTIATION:
+ case MM_ERROR_CAMCORDER_GST_FLOW_ERROR:
+ case MM_ERROR_CAMCORDER_ENCODER:
+ case MM_ERROR_CAMCORDER_ENCODER_BUFFER:
+ case MM_ERROR_CAMCORDER_ENCODER_WORKING:
+ case MM_ERROR_CAMCORDER_MNOTE_CREATION:
+ case MM_ERROR_CAMCORDER_MNOTE_ADD_ENTRY:
+ case MM_ERROR_CAMCORDER_INTERNAL:
+ case MM_ERROR_FILE_NOT_FOUND:
+ case MM_ERROR_FILE_READ:
+ recorder_error = RECORDER_ERROR_INVALID_OPERATION;
+ break;
+ case MM_ERROR_CAMCORDER_LOW_MEMORY:
+ case MM_ERROR_CAMCORDER_MNOTE_MALLOC:
+ recorder_error = RECORDER_ERROR_OUT_OF_MEMORY;
+ break;
+ case MM_ERROR_CAMCORDER_DEVICE_REG_TROUBLE:
+ recorder_error = RECORDER_ERROR_ESD;
+ break;
+ case MM_ERROR_OUT_OF_STORAGE:
+ recorder_error = RECORDER_ERROR_OUT_OF_STORAGE;
+ break;
+ default:
+ recorder_error = RECORDER_ERROR_INVALID_OPERATION;
+ break;
+ }
+
+ if (recorder_error != 0 && handle->user_cb[_RECORDER_EVENT_TYPE_ERROR]) {
+ ((recorder_error_cb)handle->user_cb[_RECORDER_EVENT_TYPE_ERROR])(recorder_error, handle->state, handle->user_data[_RECORDER_EVENT_TYPE_ERROR]);
+ }
+ break;
+ case MM_MESSAGE_CAMCORDER_CURRENT_VOLUME:
+ if (handle->last_max_input_level < m->rec_volume_dB) {
+ handle->last_max_input_level = m->rec_volume_dB;
+ }
+ break;
+ default:
+ break;
+ }
+
+ return 1;
+}
+
+
+static int __mm_audio_stream_cb(MMCamcorderAudioStreamDataType *stream, void *user_param)
+{
+ if (user_param == NULL || stream == NULL) {
+ return 0;
+ }
+
+ recorder_s *handle = (recorder_s *)user_param;
+ audio_sample_type_e format = AUDIO_SAMPLE_TYPE_U8;
+
+ if (stream->format == MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE) {
+ format = AUDIO_SAMPLE_TYPE_S16_LE;
+ }
+
+ if( handle->user_cb[_RECORDER_EVENT_TYPE_AUDIO_STREAM] ){
+ ((recorder_audio_stream_cb)(handle->user_cb[_RECORDER_EVENT_TYPE_AUDIO_STREAM]))(stream->data, stream->length, format,
+ stream->channel, stream->timestamp,
+ handle->user_data[_RECORDER_EVENT_TYPE_AUDIO_STREAM]);
+ }
+
+ return 1;
+}
+
+
+static int _recorder_check_and_set_attribute(recorder_h recorder, const char *attribute_name, int set_value)
+{
+ bool reset_pipeline = false;
+ bool restore_set = false;
+ int ret = MM_ERROR_NONE;
+ int ret2 = MM_ERROR_NONE;
+ int current_value = -1;
+ int current_audio_disable = 0;
+
+ recorder_s *handle = (recorder_s *)recorder;
+ MMCamcorderStateType mmstate = MM_CAMCORDER_STATE_NONE;
+
+ if (recorder == NULL) {
+ LOGE("handle is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ mm_camcorder_get_state(handle->mm_handle, &mmstate);
+ if (mmstate >= MM_CAMCORDER_STATE_RECORDING) {
+ LOGE("invalid state %d", mmstate);
+ return RECORDER_ERROR_INVALID_STATE;
+ }
+
+ if (handle->type == _RECORDER_TYPE_AUDIO && mmstate == MM_CAMCORDER_STATE_PREPARE) {
+ mm_camcorder_get_attributes(handle->mm_handle, NULL,
+ MMCAM_AUDIO_DISABLE, ¤t_audio_disable,
+ attribute_name, ¤t_value,
+ NULL);
+
+ if (current_value != set_value) {
+ LOGD("try to reset pipeline");
+
+ ret = mm_camcorder_stop(handle->mm_handle);
+ if (ret != MM_ERROR_NONE) {
+ LOGE("mm_camcorder_stop failed 0x%x", ret);
+ return __convert_recorder_error_code(attribute_name, ret);
+ }
+
+ ret = mm_camcorder_unrealize(handle->mm_handle);
+ if (ret != MM_ERROR_NONE) {
+ LOGE("mm_camcorder_unrealize failed 0x%x", ret);
+ mm_camcorder_start(handle->mm_handle);
+ return __convert_recorder_error_code(attribute_name, ret);
+ }
+
+ reset_pipeline = true;
+ }
+ }
+
+ if (!strcmp(attribute_name, MMCAM_AUDIO_ENCODER)) {
+ if (set_value == RECORDER_AUDIO_CODEC_DISABLE) {
+ ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+ MMCAM_AUDIO_DISABLE, true,
+ NULL);
+ } else {
+ ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+ MMCAM_AUDIO_DISABLE, false,
+ MMCAM_AUDIO_ENCODER, set_value,
+ NULL);
+ }
+ } else {
+ ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+ attribute_name, set_value,
+ NULL);
+ }
+
+ if (ret != MM_ERROR_NONE) {
+ LOGE("set [%s] failed 0x%x", attribute_name, ret);
+ }
+
+ if (reset_pipeline) {
+ ret2 = mm_camcorder_realize(handle->mm_handle);
+ if (ret2 == MM_ERROR_NONE) {
+ ret2 = mm_camcorder_start(handle->mm_handle);
+ if (ret2 == MM_ERROR_NONE) {
+ LOGW("restart pipeline done.");
+ } else {
+ LOGE("mm_camcorder_start failed 0x%x", ret2);
+ mm_camcorder_unrealize(handle->mm_handle);
+ }
+ } else {
+ LOGE("mm_camcorder_realize failed 0x%x", ret2);
+ }
+
+ if (ret2 != MM_ERROR_NONE) {
+ restore_set = true;
+ /* determine return value */
+ if (ret == MM_ERROR_NONE) {
+ ret = ret2;
+ }
+ }
+ }
+
+ if (restore_set) {
+ ret2 = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+ MMCAM_AUDIO_DISABLE, current_audio_disable,
+ attribute_name, current_value,
+ NULL);
+ LOGW("restore attribute set : 0x%x", ret2);
+
+ ret2 = mm_camcorder_realize(handle->mm_handle);
+ LOGW("restore mm_camcorder_realize : 0x%x", ret2);
+
+ ret2 = mm_camcorder_start(handle->mm_handle);
+ LOGW("restore mm_camcorder_realize : 0x%x", ret2);
+ if (ret2 != MM_ERROR_NONE) {
+ ret2 = mm_camcorder_unrealize(handle->mm_handle);
+ LOGW("restore mm_camcorder_unrealize : 0x%x", ret2);
+ }
+ }
+
+ return __convert_recorder_error_code(attribute_name, ret);
+}
+
+
+int mmsvc_recorder_create_videorecorder(camera_h camera, recorder_h *recorder)
+{
+ int ret = MM_ERROR_NONE;
+ int resource_fd = -1;
+ recorder_s *handle = NULL;
+ int preview_format = MM_PIXEL_FORMAT_NV12;
+ int camera_device_count = 0;
+
+ if (camera == NULL) {
+ LOGE("NULL pointer camera handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+ if (recorder == NULL) {
+ LOGE("NULL pointer recorder handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Check already used in another recorder */
+ if (_camera_is_used(camera)) {
+ LOGE("[%s] camera is using in another recorder.", __func__);
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ resource_fd = open(RECORDER_PATH_RECORDER_RESOURCE, O_RDONLY);
+ if (resource_fd < 0) {
+ LOGE("failed to open recorder resource : errno [%d]", errno);
+ if (errno == EPERM || errno == EACCES) {
+ LOGE("permission denied");
+ return RECORDER_ERROR_PERMISSION_DENIED;
+ } else {
+ LOGE("invalid operation");
+ return RECORDER_ERROR_INVALID_OPERATION;
+ }
+ }
+
+ close(resource_fd);
+ resource_fd = -1;
+
+ LOGW("permission check done");
+
+ handle = (recorder_s*)malloc( sizeof(recorder_s) );
+ if(handle == NULL){
+ LOGE("[%s] malloc error", __func__);
+ return RECORDER_ERROR_OUT_OF_MEMORY;
+ }
+
+ memset(handle, 0 , sizeof(recorder_s));
+ handle->src_type = _RECORDER_SOURCE_TYPE_CAMERA;
+ handle->last_max_input_level = LOWSET_DECIBEL;
+ handle->changed_preview_format = -1;
+ handle->mm_source.camera = camera;
+
+ _camera_get_mm_handle(camera, &handle->mm_handle);
+ _camera_set_relay_mm_message_callback(camera, __mm_recorder_msg_cb , (void*)handle);
+ handle->type = _RECORDER_TYPE_VIDEO;
+ mmsvc_recorder_get_state((recorder_h)handle, (recorder_state_e*)&handle->state);
+
+ mm_camcorder_get_attributes(handle->mm_handle, NULL,
+ MMCAM_CAMERA_FORMAT, &preview_format,
+ NULL);
+ handle->origin_preview_format = preview_format;
+ mm_camcorder_get_attributes(handle->mm_handle, NULL,
+ MMCAM_RECOMMEND_PREVIEW_FORMAT_FOR_RECORDING, &preview_format,
+ NULL);
+ ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL,
+ MMCAM_CAMERA_DEVICE_COUNT, &camera_device_count,
+ NULL);
+ if (ret != MM_ERROR_NONE) {
+ free(handle);
+ handle = NULL;
+ LOGE("get device count error");
+ return __convert_recorder_error_code(__func__, ret);
+ }
+ if (camera_device_count == 0) {
+ free(handle);
+ handle = NULL;
+ LOGE("RECORDER_ERROR_NOT_SUPPORTED");
+ return RECORDER_ERROR_NOT_SUPPORTED;
+ } else {
+ handle->camera_device_count = camera_device_count;
+ }
+
+ _camera_set_use(camera, true);
+ if (handle->state == RECORDER_STATE_CREATED) {
+ ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+ MMCAM_CAMERA_FORMAT, preview_format,
+ NULL);
+ if (ret == MM_ERROR_NONE) {
+ handle->changed_preview_format = preview_format;
+ }
+ }
+ *recorder = (recorder_h)handle;
+
+ return RECORDER_ERROR_NONE;
+}
+
+
+int mmsvc_recorder_create_audiorecorder(recorder_h *recorder)
+{
+ int ret = MM_ERROR_NONE;
+ recorder_s *handle = NULL;
+ MMCamPreset info;
+ int camera_device_count = 0;
+
+ if (recorder == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ info.videodev_type = MM_VIDEO_DEVICE_NONE;
+
+ handle = (recorder_s *)malloc(sizeof(recorder_s));
+ if (handle == NULL) {
+ LOGE("OUT_OF_MEMORY(0x%08x)", RECORDER_ERROR_OUT_OF_MEMORY);
+ return RECORDER_ERROR_OUT_OF_MEMORY;
+ }
+
+ memset(handle, 0, sizeof(recorder_s));
+
+ handle->last_max_input_level = LOWSET_DECIBEL;
+
+ ret = mm_camcorder_create(&handle->mm_handle, &info);
+ if (ret != MM_ERROR_NONE) {
+ free(handle);
+ handle = NULL;
+ LOGE("mm_camcorder_create fail");
+ return __convert_recorder_error_code(__func__, ret);
+ }
+
+ ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+ MMCAM_MODE, MM_CAMCORDER_MODE_AUDIO,
+ NULL);
+
+ if (ret != MM_ERROR_NONE) {
+ mm_camcorder_destroy(handle->mm_handle);
+ free(handle);
+ handle = NULL;
+ LOGE("AUDIO mode setting fail");
+ return __convert_recorder_error_code(__func__, ret);
+ }
+ ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL,
+ MMCAM_CAMERA_DEVICE_COUNT, &camera_device_count, NULL);
+ if (ret != MM_ERROR_NONE) {
+ mm_camcorder_destroy(handle->mm_handle);
+ free(handle);
+ handle = NULL;
+ LOGE("get device count error");
+ return __convert_recorder_error_code(__func__, ret);
+ } else {
+ handle->camera_device_count = camera_device_count;
+ }
+ handle->state = RECORDER_STATE_CREATED;
+ handle->mm_source.camera = NULL;
+ handle->type = _RECORDER_TYPE_AUDIO;
+
+ mm_camcorder_set_message_callback(handle->mm_handle, __mm_recorder_msg_cb, (void*)handle);
+
+ *recorder = (recorder_h)handle;
+
+ return RECORDER_ERROR_NONE;
+}
+
+
+int mmsvc_recorder_get_state(recorder_h recorder, recorder_state_e *state)
+{
+ int ret = MM_ERROR_NONE;
+ MMCamcorderStateType mmstate;
+
+ if (recorder == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+ if (state == NULL) {
+ LOGE("NULL pointer state");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ recorder_s *handle = (recorder_s*)recorder;
+
+ ret = mm_camcorder_get_state(handle->mm_handle, &mmstate);
+ if (ret != MM_ERROR_NONE) {
+ return __convert_recorder_error_code(__func__, ret);
+ }
+
+ *state = __recorder_state_convert(mmstate);
+
+ return RECORDER_ERROR_NONE;
+}
+
+
+int mmsvc_recorder_destroy(recorder_h recorder)
+{
+ recorder_s *handle = NULL;
+ int ret = MM_ERROR_NONE;
+ int preview_format;
+
+ if (recorder == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ handle = (recorder_s *)recorder;
+
+ if (handle->type == _RECORDER_TYPE_VIDEO) {
+ /* set to unsed */
+ _camera_set_use(handle->mm_source.camera, false);
+ ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
+ MMCAM_CAMERA_FORMAT, &preview_format,
+ NULL);
+
+ /* preview format was changed? */
+ if (ret == MM_ERROR_NONE && preview_format == handle->changed_preview_format) {
+ ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+ MMCAM_CAMERA_FORMAT, handle->origin_preview_format,
+ NULL);
+ }
+
+ if (ret == MM_ERROR_NONE) {
+ _camera_set_relay_mm_message_callback(handle->mm_source.camera, NULL, NULL);
+ }
+ } else {
+ ret = mm_camcorder_destroy(handle->mm_handle);
+ }
+
+ if (ret == MM_ERROR_NONE) {
+ free(handle);
+ }
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int mmsvc_recorder_prepare(recorder_h recorder)
+{
+ int ret = MM_ERROR_NONE;
+ recorder_s *handle = (recorder_s *)recorder;
+ MMCamcorderStateType mmstate;
+
+ if (recorder == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ if (handle->type == _RECORDER_TYPE_VIDEO) {
+ return __convert_error_code_camera_to_recorder(mmsvc_camera_start_preview(handle->mm_source.camera));
+ }
+
+ ret = mm_camcorder_get_state(handle->mm_handle, &mmstate);
+
+ if (ret == MM_ERROR_NONE && mmstate < MM_CAMCORDER_STATE_READY) {
+ ret = mm_camcorder_realize(handle->mm_handle);
+ if (ret != MM_ERROR_NONE) {
+ LOGE("mm_camcorder_realize fail");
+ return __convert_recorder_error_code(__func__, ret);
+ }
+ }
+
+ ret = mm_camcorder_start(handle->mm_handle);
+ if (ret != MM_ERROR_NONE) {
+ LOGE("mm_camcorder_start fail");
+ mm_camcorder_unrealize(handle->mm_handle);
+ return __convert_recorder_error_code(__func__, ret);
+ }
+
+ return RECORDER_ERROR_NONE;
+}
+
+
+int mmsvc_recorder_unprepare(recorder_h recorder)
+{
+ int ret = MM_ERROR_NONE;
+ recorder_s *handle = (recorder_s *)recorder;
+ MMCamcorderStateType mmstate;
+
+ if (recorder == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_camcorder_get_state(handle->mm_handle, &mmstate);
+ if (ret == MM_ERROR_NONE && mmstate == MM_CAMCORDER_STATE_PREPARE) {
+ ret = mm_camcorder_stop(handle->mm_handle);
+ if( ret != MM_ERROR_NONE){
+ LOGE("mm_camcorder_stop fail");
+ }
+ }
+
+ if (ret == MM_ERROR_NONE) {
+ ret = mm_camcorder_unrealize(handle->mm_handle);
+ if (ret != MM_ERROR_NONE) {
+ LOGE("mm_camcorder_unrealize fail");
+ mm_camcorder_start(handle->mm_handle);
+ }
+ }
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int mmsvc_recorder_start(recorder_h recorder)
+{
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ return __convert_recorder_error_code(__func__, mm_camcorder_record(handle->mm_handle));
+}
+
+
+int mmsvc_recorder_pause(recorder_h recorder)
+{
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ return __convert_recorder_error_code(__func__, mm_camcorder_pause(handle->mm_handle));
+}
+
+
+int mmsvc_recorder_commit(recorder_h recorder)
+{
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ return __convert_recorder_error_code(__func__, mm_camcorder_commit(handle->mm_handle));
+}
+
+
+int mmsvc_recorder_cancel(recorder_h recorder)
+{
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ return __convert_recorder_error_code(__func__, mm_camcorder_cancel(handle->mm_handle));
+}
+
+
+int mmsvc_recorder_set_video_resolution(recorder_h recorder, int width, int height)
+{
+ int ret = MM_ERROR_NONE;
+ recorder_s *handle = (recorder_s*)recorder;
+ recorder_state_e state;
+
+ if (handle == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+ if (handle->camera_device_count == 0) {
+ LOGE("RECORDER_ERROR_NOT_SUPPORTED");
+ return RECORDER_ERROR_NOT_SUPPORTED;
+ }
+ mmsvc_recorder_get_state(recorder, &state);
+ if (state > RECORDER_STATE_READY) {
+ LOGE("RECORDER_ERROR_INVALID_STATE (state:%d)", state);
+ return RECORDER_ERROR_INVALID_STATE;
+ }
+
+ ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+ MMCAM_VIDEO_WIDTH, width,
+ MMCAM_VIDEO_HEIGHT, height,
+ NULL);
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int mmsvc_recorder_get_video_resolution(recorder_h recorder, int *width, int *height)
+{
+ int ret = MM_ERROR_NONE;
+ recorder_s *handle = (recorder_s*)recorder;
+
+ if (!handle) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ if (handle->camera_device_count == 0) {
+ LOGE("RECORDER_ERROR_NOT_SUPPORTED");
+ return RECORDER_ERROR_NOT_SUPPORTED;
+ }
+
+ if (!width || !height) {
+ LOGE("NULL pointer width = [%p], height = [%p]", width, height);
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
+ MMCAM_VIDEO_WIDTH, width,
+ MMCAM_VIDEO_HEIGHT, height,
+ NULL);
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int mmsvc_recorder_foreach_supported_video_resolution(recorder_h recorder,
+ recorder_supported_video_resolution_cb foreach_cb, void *user_data)
+{
+ int i = 0;
+ int ret = MM_ERROR_NONE;
+ recorder_s * handle = (recorder_s*)recorder;
+ MMCamAttrsInfo video_width;
+ MMCamAttrsInfo video_height;
+
+ if (!handle) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ if (handle->camera_device_count == 0) {
+ LOGE("RECORDER_ERROR_NOT_SUPPORTED");
+ return RECORDER_ERROR_NOT_SUPPORTED;
+ }
+
+ if (!foreach_cb) {
+ LOGE("NULL pointer callback");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_VIDEO_WIDTH, &video_width);
+ ret |= mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_VIDEO_HEIGHT, &video_height);
+
+ if (ret != MM_ERROR_NONE ) {
+ return __convert_recorder_error_code(__func__, ret);
+ }
+
+ for (i = 0 ; i < video_width.int_array.count ; i++) {
+ if (!foreach_cb(video_width.int_array.array[i], video_height.int_array.array[i], user_data)) {
+ break;
+ }
+ }
+
+ return RECORDER_ERROR_NONE;
+}
+
+
+int mmsvc_recorder_get_audio_level(recorder_h recorder, double *level)
+{
+ recorder_s *handle = (recorder_s *)recorder;
+ recorder_state_e state;
+
+ if (recorder == NULL || level == NULL) {
+ LOGE("NULL pointer %p %p", recorder, level);
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ mmsvc_recorder_get_state(recorder, &state);
+ if (state < RECORDER_STATE_RECORDING) {
+ LOGE("RECORDER_ERROR_INVALID_STATE(0x%08x)", RECORDER_ERROR_INVALID_STATE);
+ return RECORDER_ERROR_INVALID_STATE;
+ }
+
+ *level = handle->last_max_input_level;
+ handle->last_max_input_level = LOWSET_DECIBEL;
+
+ return RECORDER_ERROR_NONE;
+}
+
+
+int mmsvc_recorder_set_filename(recorder_h recorder, const char *filename)
+{
+ int ret = MM_ERROR_NONE;
+ recorder_s *handle = (recorder_s *)recorder;
+ MMCamcorderStateType mmstate = MM_CAMCORDER_STATE_NONE;
+
+ if (recorder == NULL) {
+ LOGE("handle is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ if (filename == NULL) {
+ LOGE("filename is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ mm_camcorder_get_state(handle->mm_handle, &mmstate);
+ if (mmstate >= MM_CAMCORDER_STATE_RECORDING) {
+ LOGE("invalid state %d", mmstate);
+ return RECORDER_ERROR_INVALID_STATE;
+ }
+
+ ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+ MMCAM_TARGET_FILENAME, filename, strlen(filename),
+ NULL);
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int mmsvc_recorder_get_filename(recorder_h recorder, char **filename)
+{
+ int ret = MM_ERROR_NONE;
+ char *record_filename = NULL;
+ int record_filename_size;
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("handle is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ if (filename == NULL) {
+ LOGE("filename is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
+ MMCAM_TARGET_FILENAME, &record_filename, &record_filename_size,
+ NULL);
+ if (ret == MM_ERROR_NONE && record_filename) {
+ *filename = strdup(record_filename);
+ } else {
+ LOGE("internal return (0x%08x), get filename p:%p", ret, record_filename);
+ *filename = NULL;
+ }
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int mmsvc_recorder_set_file_format(recorder_h recorder, recorder_file_format_e format)
+{
+ int format_table[6] = { MM_FILE_FORMAT_3GP, /* RECORDER_FILE_FORMAT_3GP */
+ MM_FILE_FORMAT_MP4, /* RECORDER_FILE_FORMAT_MP4 */
+ MM_FILE_FORMAT_AMR, /* RECORDER_FILE_FORMAT_AMR */
+ MM_FILE_FORMAT_AAC, /* RECORDER_FILE_FORMAT_ADTS */
+ MM_FILE_FORMAT_WAV, /* RECORDER_FILE_FORMAT_WAV */
+ MM_FILE_FORMAT_OGG /* RECORDER_FILE_FORMAT_OGG */
+ };
+
+ if (format < RECORDER_FILE_FORMAT_3GP || format > RECORDER_FILE_FORMAT_OGG) {
+ LOGE("invalid format %d", format);
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ return _recorder_check_and_set_attribute(recorder, MMCAM_FILE_FORMAT, format_table[format]);
+}
+
+
+int mmsvc_recorder_get_file_format(recorder_h recorder, recorder_file_format_e *format)
+{
+ int ret = MM_ERROR_NONE;
+ recorder_s *handle = (recorder_s *)recorder;
+ int mm_format;
+
+ if (recorder == NULL) {
+ LOGE("handle is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ if (format == NULL) {
+ LOGE("format is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
+ MMCAM_FILE_FORMAT, &mm_format,
+ NULL);
+ if (ret == MM_ERROR_NONE) {
+ switch (mm_format) {
+ case MM_FILE_FORMAT_3GP:
+ *format = RECORDER_FILE_FORMAT_3GP;
+ break;
+ case MM_FILE_FORMAT_MP4 :
+ *format = RECORDER_FILE_FORMAT_MP4;
+ break;
+ case MM_FILE_FORMAT_AMR :
+ *format = RECORDER_FILE_FORMAT_AMR;
+ break;
+ case MM_FILE_FORMAT_AAC :
+ *format = RECORDER_FILE_FORMAT_ADTS;
+ break;
+ case MM_FILE_FORMAT_WAV:
+ *format = RECORDER_FILE_FORMAT_WAV;
+ break;
+ case MM_FILE_FORMAT_OGG:
+ *format = RECORDER_FILE_FORMAT_OGG;
+ break;
+ default :
+ ret = MM_ERROR_CAMCORDER_INTERNAL;
+ break;
+ }
+ }
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int mmsvc_recorder_set_state_changed_cb(recorder_h recorder, recorder_state_changed_cb callback, void* user_data)
+{
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ if (callback == NULL) {
+ LOGE("NULL pointer callback");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ handle->user_cb[_RECORDER_EVENT_TYPE_STATE_CHANGE] = callback;
+ handle->user_data[_RECORDER_EVENT_TYPE_STATE_CHANGE] = user_data;
+
+ return RECORDER_ERROR_NONE;
+}
+
+
+int mmsvc_recorder_unset_state_changed_cb(recorder_h recorder)
+{
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ handle->user_cb[_RECORDER_EVENT_TYPE_STATE_CHANGE] = NULL;
+ handle->user_data[_RECORDER_EVENT_TYPE_STATE_CHANGE] = NULL;
+
+ return RECORDER_ERROR_NONE;
+}
+
+
+int mmsvc_recorder_set_interrupted_cb(recorder_h recorder, recorder_interrupted_cb callback, void *user_data)
+{
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+ if (callback == NULL) {
+ LOGE("NULL pointer callback");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ handle->user_cb[_RECORDER_EVENT_TYPE_INTERRUPTED] = callback;
+ handle->user_data[_RECORDER_EVENT_TYPE_INTERRUPTED] = user_data;
+
+ return RECORDER_ERROR_NONE;
+}
+
+
+int mmsvc_recorder_unset_interrupted_cb(recorder_h recorder)
+{
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ handle->user_cb[_RECORDER_EVENT_TYPE_INTERRUPTED] = NULL;
+ handle->user_data[_RECORDER_EVENT_TYPE_INTERRUPTED] = NULL;
+
+ return RECORDER_ERROR_NONE;
+}
+
+
+int mmsvc_recorder_set_audio_stream_cb(recorder_h recorder, recorder_audio_stream_cb callback, void* user_data)
+{
+ int ret = MM_ERROR_NONE;
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+ if (callback == NULL) {
+ LOGE("NULL pointer callback");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_camcorder_set_audio_stream_callback(handle->mm_handle, __mm_audio_stream_cb, handle);
+ if (ret == MM_ERROR_NONE){
+ handle->user_cb[_RECORDER_EVENT_TYPE_AUDIO_STREAM] = callback;
+ handle->user_data[_RECORDER_EVENT_TYPE_AUDIO_STREAM] = user_data;
+ }
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int mmsvc_recorder_unset_audio_stream_cb(recorder_h recorder)
+{
+ int ret = MM_ERROR_NONE;
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ handle->user_cb[_RECORDER_EVENT_TYPE_AUDIO_STREAM] = NULL;
+ handle->user_data[_RECORDER_EVENT_TYPE_AUDIO_STREAM] = NULL;
+
+ ret = mm_camcorder_set_audio_stream_callback(handle->mm_handle, NULL, NULL);
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int mmsvc_recorder_set_error_cb(recorder_h recorder, recorder_error_cb callback, void *user_data)
+{
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+ if (callback == NULL) {
+ LOGE("NULL pointer callback");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ handle->user_cb[_RECORDER_EVENT_TYPE_ERROR] = callback;
+ handle->user_data[_RECORDER_EVENT_TYPE_ERROR] = user_data;
+
+ return RECORDER_ERROR_NONE;
+}
+
+
+int mmsvc_recorder_unset_error_cb(recorder_h recorder)
+{
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ handle->user_cb[_RECORDER_EVENT_TYPE_ERROR] = NULL;
+ handle->user_data[_RECORDER_EVENT_TYPE_ERROR] = NULL;
+
+ return RECORDER_ERROR_NONE;
+}
+
+
+int mmsvc_recorder_set_recording_status_cb(recorder_h recorder, recorder_recording_status_cb callback, void* user_data)
+{
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+ if (callback == NULL) {
+ LOGE("NULL pointer callback");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ handle->user_cb[_RECORDER_EVENT_TYPE_RECORDING_STATUS] = callback;
+ handle->user_data[_RECORDER_EVENT_TYPE_RECORDING_STATUS] = user_data;
+
+ return RECORDER_ERROR_NONE;
+}
+
+
+int mmsvc_recorder_unset_recording_status_cb(recorder_h recorder)
+{
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ handle->user_cb[_RECORDER_EVENT_TYPE_RECORDING_STATUS] = NULL;
+ handle->user_data[_RECORDER_EVENT_TYPE_RECORDING_STATUS] = NULL;
+
+ return RECORDER_ERROR_NONE;
+}
+
+
+int mmsvc_recorder_set_recording_limit_reached_cb(recorder_h recorder, recorder_recording_limit_reached_cb callback, void* user_data)
+{
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+ if (callback == NULL) {
+ LOGE("NULL pointer callback");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ handle->user_cb[_RECORDER_EVENT_TYPE_RECORDING_LIMITED] = callback;
+ handle->user_data[_RECORDER_EVENT_TYPE_RECORDING_LIMITED] = user_data;
+
+ return RECORDER_ERROR_NONE;
+}
+
+
+int mmsvc_recorder_unset_recording_limit_reached_cb(recorder_h recorder)
+{
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ handle->user_cb[_RECORDER_EVENT_TYPE_RECORDING_LIMITED] = NULL;
+ handle->user_data[_RECORDER_EVENT_TYPE_RECORDING_LIMITED] = NULL;
+
+ return RECORDER_ERROR_NONE;
+}
+
+
+int mmsvc_recorder_foreach_supported_file_format(recorder_h recorder, recorder_supported_file_format_cb foreach_cb, void *user_data)
+{
+ int i = 0;
+ int ret = MM_ERROR_NONE;
+ recorder_s *handle = (recorder_s *)recorder;
+ MMCamAttrsInfo info;
+ int format;
+
+ if (recorder == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+ if (foreach_cb == NULL) {
+ LOGE("NULL pointer foreach_cb");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_FILE_FORMAT, &info);
+ if (ret != MM_ERROR_NONE) {
+ LOGE("mm_camcorder_get_attribute_info failed 0x%x", ret);
+ return __convert_recorder_error_code(__func__, ret);;
+ }
+
+ for (i = 0 ; i < info.int_array.count ; i++) {
+ switch (info.int_array.array[i]) {
+ case MM_FILE_FORMAT_3GP:
+ format = RECORDER_FILE_FORMAT_3GP;
+ break;
+ case MM_FILE_FORMAT_MP4 :
+ format = RECORDER_FILE_FORMAT_MP4;
+ break;
+ case MM_FILE_FORMAT_AMR :
+ format = RECORDER_FILE_FORMAT_AMR;
+ break;
+ case MM_FILE_FORMAT_AAC:
+ format = RECORDER_FILE_FORMAT_ADTS;
+ break;
+ case MM_FILE_FORMAT_WAV:
+ format = RECORDER_FILE_FORMAT_WAV;
+ break;
+ default :
+ format = -1;
+ break;
+ }
+
+ if (format != -1 && !foreach_cb(format,user_data)) {
+ break;
+ }
+ }
+
+ return RECORDER_ERROR_NONE;
+}
+
+
+int mmsvc_recorder_attr_set_size_limit(recorder_h recorder, int kbyte)
+{
+ int ret = MM_ERROR_NONE;
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+ MMCAM_TARGET_MAX_SIZE, kbyte,
+ NULL);
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int mmsvc_recorder_attr_set_time_limit(recorder_h recorder, int second)
+{
+ int ret = MM_ERROR_NONE;
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+ MMCAM_TARGET_TIME_LIMIT, second,
+ NULL);
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int mmsvc_recorder_attr_set_audio_device(recorder_h recorder, recorder_audio_device_e device)
+{
+ if (device < RECORDER_AUDIO_DEVICE_MIC || device > RECORDER_AUDIO_DEVICE_MODEM) {
+ LOGE("invalid device %d", device);
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ return _recorder_check_and_set_attribute(recorder, MMCAM_AUDIO_DEVICE, device);
+}
+
+
+int mmsvc_recorder_set_audio_encoder(recorder_h recorder, recorder_audio_codec_e codec)
+{
+ recorder_s *handle = (recorder_s *)recorder;
+ int audio_table[4] = { MM_AUDIO_CODEC_AMR, /* RECORDER_AUDIO_CODEC_AMR */
+ MM_AUDIO_CODEC_AAC, /* RECORDER_AUDIO_CODEC_AAC */
+ MM_AUDIO_CODEC_VORBIS, /* RECORDER_AUDIO_CODEC_VORBIS */
+ MM_AUDIO_CODEC_WAVE /* RECORDER_AUDIO_CODEC_PCM */
+ };
+
+ if (recorder == NULL) {
+ LOGE("handle is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ if (codec != RECORDER_AUDIO_CODEC_DISABLE &&
+ (codec < RECORDER_AUDIO_CODEC_AMR || codec > RECORDER_AUDIO_CODEC_PCM)) {
+ LOGE("invalid parameter : codec %d", codec);
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ if (handle->type == _RECORDER_TYPE_AUDIO && codec == RECORDER_AUDIO_CODEC_DISABLE) {
+ LOGE("AUDIO_CODEC_DISABLE is not supported in audio mode");
+ return RECORDER_ERROR_NOT_SUPPORTED;
+ }
+
+ return _recorder_check_and_set_attribute(recorder, MMCAM_AUDIO_ENCODER, codec == RECORDER_AUDIO_CODEC_DISABLE ? RECORDER_AUDIO_CODEC_DISABLE : audio_table[codec]);
+}
+
+
+int mmsvc_recorder_get_audio_encoder(recorder_h recorder, recorder_audio_codec_e *codec)
+{
+ int ret = MM_ERROR_NONE;
+ int mm_codec = 0;
+ int audio_disable = 0;
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("handle is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ if (codec == NULL) {
+ LOGE("codec is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
+ MMCAM_AUDIO_ENCODER, &mm_codec,
+ MMCAM_AUDIO_DISABLE, &audio_disable,
+ NULL);
+
+ if (ret == MM_ERROR_NONE && audio_disable == 0) {
+ switch (mm_codec) {
+ case MM_AUDIO_CODEC_AMR :
+ *codec = RECORDER_AUDIO_CODEC_AMR;
+ break;
+ case MM_AUDIO_CODEC_AAC :
+ *codec = RECORDER_AUDIO_CODEC_AAC;
+ break;
+ case MM_AUDIO_CODEC_VORBIS:
+ *codec = RECORDER_AUDIO_CODEC_VORBIS;
+ break;
+ case MM_AUDIO_CODEC_WAVE:
+ *codec = RECORDER_AUDIO_CODEC_PCM;
+ break;
+ default :
+ ret = MM_ERROR_CAMCORDER_INTERNAL;
+ break;
+ }
+ } else if (ret == MM_ERROR_NONE && audio_disable) {
+ *codec = RECORDER_AUDIO_CODEC_DISABLE;
+ }
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int mmsvc_recorder_set_video_encoder(recorder_h recorder, recorder_video_codec_e codec)
+{
+ int ret = MM_ERROR_NONE;
+ int video_table[4] = { MM_VIDEO_CODEC_H263, /* RECORDER_VIDEO_CODEC_H263 */
+ MM_VIDEO_CODEC_H264, /* RECORDER_VIDEO_CODEC_H264 */
+ MM_VIDEO_CODEC_MPEG4, /* RECORDER_VIDEO_CODEC_MPEG4 */
+ MM_VIDEO_CODEC_THEORA /* RECORDER_VIDEO_CODEC_THEORA */
+ };
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (handle == NULL) {
+ LOGE("handle is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ if (handle->camera_device_count == 0) {
+ LOGE("RECORDER_ERROR_NOT_SUPPORTED");
+ return RECORDER_ERROR_NOT_SUPPORTED;
+ }
+
+ if (codec < RECORDER_VIDEO_CODEC_H263 || codec > RECORDER_VIDEO_CODEC_THEORA) {
+ LOGE("invalid codec %d", codec);
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+ MMCAM_VIDEO_ENCODER, video_table[codec],
+ NULL);
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int mmsvc_recorder_get_video_encoder(recorder_h recorder, recorder_video_codec_e *codec)
+{
+ int ret = MM_ERROR_NONE;
+ int mm_codec = 0;
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (handle == NULL) {
+ LOGE("handle is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+ if (handle->camera_device_count == 0) {
+ LOGE("RECORDER_ERROR_NOT_SUPPORTED");
+ return RECORDER_ERROR_NOT_SUPPORTED;
+ }
+ if (codec == NULL) {
+ LOGE("codec is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
+ MMCAM_VIDEO_ENCODER, &mm_codec,
+ NULL);
+ if (ret == MM_ERROR_NONE) {
+ switch(mm_codec) {
+ case MM_VIDEO_CODEC_H263 :
+ *codec = RECORDER_VIDEO_CODEC_H263;
+ break;
+ case MM_VIDEO_CODEC_H264 :
+ *codec = RECORDER_VIDEO_CODEC_H264;
+ break;
+ case MM_VIDEO_CODEC_MPEG4 :
+ *codec = RECORDER_VIDEO_CODEC_MPEG4;
+ break;
+ case MM_VIDEO_CODEC_THEORA:
+ *codec = RECORDER_VIDEO_CODEC_THEORA;
+ break;
+ default :
+ ret = MM_ERROR_CAMCORDER_INTERNAL;
+ break;
+ }
+ }
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int mmsvc_recorder_attr_set_audio_samplerate(recorder_h recorder, int samplerate)
+{
+ if (samplerate < 1) {
+ LOGE("invalid samplerate %d", samplerate);
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ return _recorder_check_and_set_attribute(recorder, MMCAM_AUDIO_SAMPLERATE, samplerate);
+}
+
+
+int mmsvc_recorder_attr_set_audio_encoder_bitrate(recorder_h recorder, int bitrate)
+{
+ if (bitrate < 1) {
+ LOGE("invalid bitrate %d", bitrate);
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ return _recorder_check_and_set_attribute(recorder, MMCAM_AUDIO_ENCODER_BITRATE, bitrate);
+}
+
+
+int mmsvc_recorder_attr_set_video_encoder_bitrate(recorder_h recorder, int bitrate)
+{
+ int ret = MM_ERROR_NONE;
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (handle == NULL) {
+ LOGE("handle is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+ if (handle->camera_device_count == 0) {
+ LOGE("RECORDER_ERROR_NOT_SUPPORTED");
+ return RECORDER_ERROR_NOT_SUPPORTED;
+ }
+
+ ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+ MMCAM_VIDEO_ENCODER_BITRATE, bitrate,
+ NULL);
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int mmsvc_recorder_attr_get_size_limit(recorder_h recorder, int *kbyte)
+{
+ int ret = MM_ERROR_NONE;
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("handle is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
+ MMCAM_TARGET_MAX_SIZE, kbyte,
+ NULL);
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int mmsvc_recorder_attr_get_time_limit(recorder_h recorder, int *second)
+{
+ int ret = MM_ERROR_NONE;
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("handle is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
+ MMCAM_TARGET_TIME_LIMIT, second,
+ NULL);
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int mmsvc_recorder_attr_get_audio_device(recorder_h recorder, recorder_audio_device_e *device)
+{
+ int ret = MM_ERROR_NONE;
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("handle is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
+ MMCAM_AUDIO_DEVICE, device,
+ NULL);
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int mmsvc_recorder_attr_get_audio_samplerate(recorder_h recorder, int *samplerate)
+{
+ int ret = MM_ERROR_NONE;
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("handle is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
+ MMCAM_AUDIO_SAMPLERATE, samplerate,
+ NULL);
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int mmsvc_recorder_attr_get_audio_encoder_bitrate(recorder_h recorder, int *bitrate)
+{
+ int ret = MM_ERROR_NONE;
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("handle is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
+ MMCAM_AUDIO_ENCODER_BITRATE, bitrate,
+ NULL);
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int mmsvc_recorder_attr_get_video_encoder_bitrate(recorder_h recorder, int *bitrate)
+{
+ int ret = MM_ERROR_NONE;
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (handle == NULL) {
+ LOGE("handle is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+ if (handle->camera_device_count == 0) {
+ LOGE("RECORDER_ERROR_NOT_SUPPORTED");
+ return RECORDER_ERROR_NOT_SUPPORTED;
+ }
+ ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
+ MMCAM_VIDEO_ENCODER_BITRATE, bitrate,
+ NULL);
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int mmsvc_recorder_foreach_supported_audio_encoder(recorder_h recorder, recorder_supported_audio_encoder_cb foreach_cb, void *user_data)
+{
+ int i = 0;
+ int ret = MM_ERROR_NONE;
+ int codec;
+ recorder_s *handle = (recorder_s *)recorder;
+ MMCamAttrsInfo info;
+
+ if (recorder == NULL) {
+ LOGE("handle is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+ if (foreach_cb == NULL) {
+ LOGE("foreach_cb is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_AUDIO_ENCODER, &info);
+ if (ret != MM_ERROR_NONE) {
+ return __convert_recorder_error_code(__func__, ret);
+ }
+
+ for (i = 0 ; i < info.int_array.count ; i++) {
+ switch (info.int_array.array[i]) {
+ case MM_AUDIO_CODEC_AMR:
+ codec = RECORDER_AUDIO_CODEC_AMR;
+ break;
+ case MM_AUDIO_CODEC_AAC :
+ codec = RECORDER_AUDIO_CODEC_AAC;
+ break;
+ case MM_AUDIO_CODEC_VORBIS:
+ codec = RECORDER_AUDIO_CODEC_VORBIS;
+ break;
+ case MM_AUDIO_CODEC_WAVE:
+ codec = RECORDER_AUDIO_CODEC_PCM;
+ break;
+ default :
+ codec = -1;
+ break;
+ }
+ if (codec != -1 && !foreach_cb(codec,user_data)) {
+ break;
+ }
+ }
+
+ return RECORDER_ERROR_NONE;
+}
+
+
+int mmsvc_recorder_foreach_supported_video_encoder(recorder_h recorder, recorder_supported_video_encoder_cb foreach_cb, void *user_data)
+{
+ int i = 0;
+ int ret = MM_ERROR_NONE;
+ int codec;
+ recorder_s *handle = (recorder_s *)recorder;
+ MMCamAttrsInfo info;
+
+ if (handle == NULL) {
+ LOGE("handle is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+ if (handle->camera_device_count == 0) {
+ LOGE("RECORDER_ERROR_NOT_SUPPORTED");
+ return RECORDER_ERROR_NOT_SUPPORTED;
+ }
+ if (foreach_cb == NULL) {
+ LOGE("foreach_cb is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_VIDEO_ENCODER, &info);
+ if (ret != MM_ERROR_NONE) {
+ return __convert_recorder_error_code(__func__, ret);
+ }
+
+ for (i = 0 ; i < info.int_array.count ; i++) {
+ switch (info.int_array.array[i]){
+ case MM_VIDEO_CODEC_H263 :
+ codec = RECORDER_VIDEO_CODEC_H263;
+ break;
+ case MM_VIDEO_CODEC_H264 :
+ codec = RECORDER_VIDEO_CODEC_H264;
+ break;
+ case MM_VIDEO_CODEC_MPEG4 :
+ codec = RECORDER_VIDEO_CODEC_MPEG4;
+ break;
+ case MM_VIDEO_CODEC_THEORA :
+ codec = RECORDER_VIDEO_CODEC_THEORA;
+ break;
+ default :
+ codec = -1;
+ break;
+ }
+
+ if (codec != -1 && !foreach_cb(codec,user_data)) {
+ break;
+ }
+ }
+
+ return RECORDER_ERROR_NONE;
+}
+
+
+int mmsvc_recorder_attr_set_mute(recorder_h recorder, bool enable)
+{
+ int ret = MM_ERROR_NONE;
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("handle is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+ MMCAM_AUDIO_VOLUME, enable ? 0.0 : 1.0,
+ NULL);
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+bool mmsvc_recorder_attr_is_muted(recorder_h recorder)
+{
+ int ret = MM_ERROR_NONE;
+ double volume = 1.0;
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("handle is NULL");
+ return false;
+ }
+
+ ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
+ MMCAM_AUDIO_VOLUME, &volume,
+ NULL);
+
+ set_last_result(__convert_recorder_error_code(__func__, ret));
+
+ if (volume == 0.0) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+
+int mmsvc_recorder_attr_set_recording_motion_rate(recorder_h recorder, double rate)
+{
+ int ret = MM_ERROR_NONE;
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (handle == NULL) {
+ LOGE("handle is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+ if (handle->camera_device_count == 0) {
+ LOGE("RECORDER_ERROR_NOT_SUPPORTED");
+ return RECORDER_ERROR_NOT_SUPPORTED;
+ }
+ ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+ MMCAM_CAMERA_RECORDING_MOTION_RATE, rate,
+ NULL);
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int mmsvc_recorder_attr_get_recording_motion_rate(recorder_h recorder, double *rate)
+{
+ int ret = MM_ERROR_NONE;
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (handle == NULL) {
+ LOGE("handle is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+ if (handle->camera_device_count == 0) {
+ LOGE("RECORDER_ERROR_NOT_SUPPORTED");
+ return RECORDER_ERROR_NOT_SUPPORTED;
+ }
+ if (rate == NULL) {
+ LOGE("rate is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
+ MMCAM_CAMERA_RECORDING_MOTION_RATE, rate,
+ NULL);
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int mmsvc_recorder_attr_set_audio_channel(recorder_h recorder, int channel_count)
+{
+ if (channel_count < 1) {
+ LOGE("invalid channel %d", channel_count);
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ return _recorder_check_and_set_attribute(recorder, MMCAM_AUDIO_CHANNEL, channel_count);
+}
+
+
+int mmsvc_recorder_attr_get_audio_channel(recorder_h recorder, int *channel_count)
+{
+ int ret = MM_ERROR_NONE;
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (recorder == NULL) {
+ LOGE("handle is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+ if (channel_count == NULL) {
+ LOGE("channel_count is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
+ MMCAM_AUDIO_CHANNEL, channel_count,
+ NULL);
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int mmsvc_recorder_attr_set_orientation_tag(recorder_h recorder, recorder_rotation_e orientation)
+{
+ int ret = MM_ERROR_NONE;
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (handle == NULL) {
+ LOGE("handle is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+ if (handle->camera_device_count == 0) {
+ LOGE("RECORDER_ERROR_NOT_SUPPORTED");
+ return RECORDER_ERROR_NOT_SUPPORTED;
+ }
+ if (orientation > RECORDER_ROTATION_270) {
+ LOGE("invalid orientation %d", orientation);
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+ MMCAM_RECORDER_TAG_ENABLE, true,
+ MMCAM_TAG_VIDEO_ORIENTATION, orientation,
+ NULL);
+
+ return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int mmsvc_recorder_attr_get_orientation_tag(recorder_h recorder, recorder_rotation_e *orientation)
+{
+ int ret = MM_ERROR_NONE;
+ recorder_s *handle = (recorder_s *)recorder;
+
+ if (handle == NULL) {
+ LOGE("handle is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+ if (handle->camera_device_count == 0) {
+ LOGE("RECORDER_ERROR_NOT_SUPPORTED");
+ return RECORDER_ERROR_NOT_SUPPORTED;
+ }
+ if (orientation == NULL) {
+ LOGE("orientation is NULL");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
+ MMCAM_TAG_VIDEO_ORIENTATION, orientation,
+ NULL);
+
+ return __convert_recorder_error_code(__func__, ret);
+}
--- /dev/null
+SET(fw_test "${fw_name}-test")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_test} REQUIRED mm-camcorder elementary evas capi-media-camera)
+FOREACH(flag ${${fw_test}_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ MESSAGE(${flag})
+ENDFOREACH()
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall")
+
+#ADD_EXECUTABLE("system-sensor" system-sensor.c)
+#TARGET_LINK_LIBRARIES("system-sensor" ${fw_name} ${${fw_test}_LDFLAGS})
+
+aux_source_directory(. sources)
+FOREACH(src ${sources})
+ GET_FILENAME_COMPONENT(src_name ${src} NAME_WE)
+ MESSAGE("${src_name}")
+ ADD_EXECUTABLE(${src_name} ${src})
+ TARGET_LINK_LIBRARIES(${src_name} ${fw_name} ${${fw_test}_LDFLAGS})
+ENDFOREACH()
--- /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.
+*/
+
+
+
+
+#include <stdio.h>
+#include <Elementary.h>
+#include <glib.h>
+#include <Ecore.h>
+#include <Ecore_X.h>
+#include <Elementary.h>
+#include <pthread.h>
+#include <recorder.h>
+#include <camera.h>
+#include <mm.h>
+#include <mm_camcorder.h>
+#include <mm_types.h>
+
+Evas_Object* mEvasWindow;
+Ecore_X_Window mXwindow;
+Ecore_X_Window preview_win;
+
+bool record_state_cb(recorder_state_e previous , recorder_state_e current , int by_asm, void *user_data){
+ char * state_table[] = {
+ "MEDIARECORDER_STATE_NONE", /**< recorder is not created yet */
+ "MEDIARECORDER_STATE_CREATED", /**< recorder is created, but not initialized yet */
+ "MEDIARECORDER_STATE_READY", /**< prepare to record if video recorder is playing preview */
+ "MEDIARECORDER_STATE_RECORDING", /**< While recording */
+ "MEDIARECORDER_STATE_PAUSED", /**< Pause recording */
+ "MEDIARECORDER_STATE_NUM" /**< Number of recorder states */
+ };
+ printf("%s\n", state_table[current]);
+ return 0;
+}
+
+int recording_size_limit_test(recorder_h recorder){
+ int ret;
+ int fail=0;
+ int int_value;
+ // negative test
+ printf("-------------limit size test----------------------\n");
+ printf("-negative test\n");
+ ret = recorder_attr_set_size_limit(recorder, -1);
+ if( ret == 0 ){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ printf("-0 test\n");
+ ret = recorder_attr_set_size_limit(recorder, 0);
+ if( ret != 0 ){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ ret = recorder_attr_get_size_limit(recorder,&int_value);
+ if( int_value != 0){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+
+ printf("-1212 set test\n");
+ ret = recorder_attr_set_size_limit(recorder, 1212);
+ if( ret != 0 ){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ ret = recorder_attr_get_size_limit(recorder,&int_value);
+ if( int_value != 1212){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ return -fail;
+}
+
+int recording_time_limit_test(recorder_h recorder){
+ int ret;
+ int fail=0;
+ int int_value;
+ // negative test
+ printf("-------------limit time test----------------------\n");
+
+ ret = recorder_attr_set_time_limit(recorder, -1);
+ if( ret == 0 ){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ printf("-0 test\n");
+ ret = recorder_attr_set_time_limit(recorder, 0);
+ if( ret != 0 ){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ ret = recorder_attr_get_time_limit(recorder,&int_value);
+ if( int_value != 0){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+
+ printf("-1212 set test\n");
+ ret = recorder_attr_set_time_limit(recorder, 1212);
+ if( ret != 0 ){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ ret = recorder_attr_get_time_limit(recorder,&int_value);
+ if( int_value != 1212){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+
+ return -fail;
+}
+
+int fileformat_test_fail = 0;
+bool _file_format_test_cb(recorder_file_format_e format, void *user_data){
+ int ret;
+ recorder_h recorder = (recorder_h)user_data;
+ recorder_file_format_e get_format;
+ ret = recorder_set_file_format(recorder, format);
+ recorder_get_file_format(recorder, &get_format);
+
+ if( get_format != format){
+ printf("FAIL\n");
+ fileformat_test_fail++;
+ }else
+ printf("PASS\n");
+ return true;
+}
+
+
+int fileformat_test(recorder_h recorder){
+ fileformat_test_fail = 0;
+ printf("----------------file format test ------------------\n");
+ recorder_foreach_supported_file_format(recorder, _file_format_test_cb, recorder);
+ return -fileformat_test_fail;
+}
+
+int videoencoder_test_fail = 0;
+bool _video_encoder_test_cb(recorder_video_codec_e codec, void *user_data){
+ int ret;
+ recorder_h recorder = (recorder_h)user_data;
+ recorder_video_codec_e get_codec;
+ ret = recorder_set_video_encoder(recorder, codec);
+ recorder_get_video_encoder(recorder, &get_codec);
+
+
+ if( get_codec != codec){
+ printf("FAIL\n");
+ videoencoder_test_fail++;
+ }else
+ printf("PASS\n");
+ return true;
+}
+
+
+int video_encoder_test(recorder_h recorder){
+ videoencoder_test_fail = 0;
+ printf("----------------video encoder test ------------------\n");
+ recorder_foreach_supported_video_encoder(recorder, _video_encoder_test_cb, recorder);
+ return -videoencoder_test_fail;
+}
+
+int audioencoder_test_fail = 0;
+bool _audio_encoder_test_cb(recorder_audio_codec_e codec, void *user_data){
+ int ret;
+ recorder_h recorder = (recorder_h)user_data;
+ recorder_audio_codec_e get_codec;
+ ret = recorder_set_audio_encoder(recorder, codec);
+ recorder_get_audio_encoder(recorder, &get_codec);
+
+
+ if( get_codec != codec){
+ printf("FAIL\n");
+ audioencoder_test_fail++;
+ }else
+ printf("PASS\n");
+ return true;
+}
+
+
+int audio_encoder_test(recorder_h recorder){
+ audioencoder_test_fail = 0;
+ printf("----------------audio encoder test ------------------\n");
+ recorder_foreach_supported_audio_encoder(recorder, _audio_encoder_test_cb, recorder);
+ return -audioencoder_test_fail;
+}
+
+int recording_audio_device_test(recorder_h recorder)
+{
+ int ret;
+ int fail=0;
+ recorder_audio_device_e int_value;
+ // negative test
+ printf("-------------audio device test----------------------\n");
+ printf("-negative test\n");
+ ret = recorder_attr_set_audio_device (recorder, -1);
+ if( ret == 0 ){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ printf("-RECORDER_AUDIO_DEVICE_MIC test\n");
+ ret = recorder_attr_set_audio_device(recorder, RECORDER_AUDIO_DEVICE_MIC);
+ if( ret != 0 ){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ ret = recorder_attr_get_audio_device(recorder,&int_value);
+ if( int_value != RECORDER_AUDIO_DEVICE_MIC){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+
+ printf("-RECORDER_AUDIO_DEVICE_MODEM set test\n");
+ ret = recorder_attr_set_audio_device(recorder, RECORDER_AUDIO_DEVICE_MODEM );
+ if( ret != 0 ){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ ret = recorder_attr_get_audio_device(recorder,&int_value);
+ if( int_value != RECORDER_AUDIO_DEVICE_MODEM){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ return -fail;
+}
+
+int recording_samplerate_test(recorder_h recorder){
+ int ret;
+ int fail=0;
+ int int_value;
+ // negative test
+ printf("-------------samplerate test----------------------\n");
+
+ ret = recorder_attr_set_audio_samplerate(recorder, -1);
+ if( ret == 0 ){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ printf("-44100 test\n");
+ ret = recorder_attr_set_audio_samplerate(recorder, 44100);
+ if( ret != 0 ){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ ret = recorder_attr_get_audio_samplerate(recorder,&int_value);
+ if( int_value != 44100){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+
+ printf("-1212 set test\n");
+ ret = recorder_attr_set_audio_samplerate(recorder, 1212);
+ if( ret != 0 ){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ ret = recorder_attr_get_audio_samplerate(recorder,&int_value);
+ if( int_value != 1212){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+
+ return -fail;
+}
+
+
+int recording_audio_encoder_bitrate_test(recorder_h recorder){
+ int ret;
+ int fail=0;
+ int int_value;
+ // negative test
+ printf("-------------audio encoder bitrate test----------------------\n");
+ printf("-negative test\n");
+ ret = recorder_attr_set_audio_encoder_bitrate (recorder, -2);
+ if( ret == 0 ){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ printf("-12200 test\n");
+ ret = recorder_attr_set_audio_encoder_bitrate (recorder, 12200);
+ if( ret != 0 ){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ ret = recorder_attr_get_audio_encoder_bitrate (recorder,&int_value);
+ if( int_value != 12200){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+
+ printf("-288000 set test\n");
+ ret = recorder_attr_set_audio_encoder_bitrate (recorder, 288000 );
+ if( ret != 0 ){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ ret = recorder_attr_get_audio_encoder_bitrate (recorder,&int_value);
+ if( int_value != 288000 ){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ printf("-1212 set test\n");
+ ret = recorder_attr_set_audio_encoder_bitrate (recorder, 1212 );
+ if( ret != 0 ){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ ret = recorder_attr_get_audio_encoder_bitrate (recorder,&int_value);
+ if( int_value != 1212 ){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ return -fail;
+}
+
+int recording_video_encoder_bitrate_test(recorder_h recorder){
+ int ret;
+ int fail=0;
+ int int_value;
+ // negative test
+ printf("-------------video encoder bitrate test----------------------\n");
+ printf("-negative test\n");
+ ret = recorder_attr_set_video_encoder_bitrate (recorder, -2);
+ if( ret == 0 ){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ printf("-12200 test\n");
+ ret = recorder_attr_set_video_encoder_bitrate (recorder, 12200);
+ if( ret != 0 ){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ ret = recorder_attr_get_video_encoder_bitrate (recorder,&int_value);
+ if( int_value != 12200){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+
+ printf("-288000 set test\n");
+ ret = recorder_attr_set_video_encoder_bitrate (recorder, 288000 );
+ if( ret != 0 ){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ ret = recorder_attr_get_video_encoder_bitrate (recorder,&int_value);
+ if( int_value != 288000 ){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ printf("-1212 set test\n");
+ ret = recorder_attr_set_video_encoder_bitrate (recorder, 1212 );
+ if( ret != 0 ){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ ret = recorder_attr_get_video_encoder_bitrate (recorder,&int_value);
+ if( int_value != 1212 ){
+ printf("FAIL\n");
+ fail++;
+ }else
+ printf("PASS\n");
+
+ return -fail;
+}
+
+
+typedef struct{
+ bool iscalled;
+ bool isprepare;
+ bool isrecording;
+ bool ispaused;
+ recorder_state_e state;
+} state_change_data;
+
+void _state_change_test_cb(recorder_state_e previous, recorder_state_e current, bool by_asm, void *user_data){
+ printf(" state change %d => %d\n", previous , current);
+ state_change_data * data = (state_change_data*)user_data;
+ if( current == RECORDER_STATE_READY )
+ data->isprepare = true;
+ if( current == RECORDER_STATE_RECORDING )
+ data->isrecording = true;
+ if( current == RECORDER_STATE_PAUSED )
+ data->ispaused = true;
+
+ data->state = current;
+
+ //printf("state %d\n",current);
+}
+
+int recorder_state_change_test(){
+ char *state_str[] = { "RECORDER_STATE_NONE", /**< recorder is not created yet */
+ "RECORDER_STATE_CREATED", /**< recorder is created, but not initialized yet */
+ "RECORDER_STATE_READY", /**< prepare to record if video recorder is playing preview */
+ "RECORDER_STATE_RECORDING", /**< While recording */
+ "RECORDER_STATE_PAUSED", /**< Pause recording */
+ };
+ recorder_h recorder;
+ state_change_data data;
+ int ret;
+ recorder_state_e state;
+ recorder_create_audiorecorder(&recorder);
+ data.iscalled = false;
+ data.isprepare = false;
+ data.isrecording = false;
+ data.ispaused = false;
+ data.state = 0;
+ printf("-------------------------recorder state change test -------------------\n");
+ recorder_get_state(recorder, &state);
+ printf("state = %s\n", state_str[state]);
+ recorder_set_state_changed_cb(recorder, _state_change_test_cb, &data);
+ recorder_set_file_format(recorder, RECORDER_FILE_FORMAT_AMR);
+ ret = recorder_prepare(recorder);
+ printf("recorder_prepare ret = %x\n", ret);
+ recorder_get_state(recorder, &state);
+ printf("state = %s\n", state_str[state]);
+ ret = recorder_start(recorder);
+ printf("recorder_start ret = %x\n", ret);
+ recorder_get_state(recorder, &state);
+ printf("state = %s\n", state_str[state]);
+ sleep(1);
+ ret = recorder_pause(recorder);
+ printf("recorder_pause ret = %x\n", ret);
+ recorder_get_state(recorder, &state);
+ printf("state = %s\n", state_str[state]);
+
+ ret =recorder_commit(recorder);
+ sleep(2);
+
+ if( data.isprepare && data.isrecording && data.ispaused && data.state == RECORDER_STATE_READY ){
+ printf("PASS\n");
+ ret = 0;
+ }else{
+ printf("FAIL data.isprepare %d, data.isrecording %d, data.ispaused %d, data.state %d \n", data.isprepare , data.isrecording , data.ispaused , data.state );
+ ret = -1;
+ }
+
+ ret = recorder_unprepare(recorder);
+ printf("recorder_unprepare ret = %x\n", ret);
+ recorder_get_state(recorder, &state);
+ printf("state = %s\n", state_str[state]);
+
+ ret = recorder_destroy(recorder);
+ printf("recorder_destroy ret = %x\n", ret);
+
+ return ret;
+
+}
+
+
+typedef struct {
+ int elapsed_time;
+ int file_size;
+} recording_result;
+void _recording_status_test_cb(unsigned long long elapsed_time, unsigned long long file_size, void *user_data){
+ recording_result *result = (recording_result*)user_data;
+ result->elapsed_time = elapsed_time;
+ result->file_size = file_size;
+
+}
+
+int recorder_recoding_status_cb_test(){
+ recorder_h recorder;
+ recording_result result;
+ int ret;
+
+ printf("--------------recording status cb test-------------------\n");
+ recorder_create_audiorecorder(&recorder);
+ recorder_set_recording_status_cb(recorder,_recording_status_test_cb, &result);
+ recorder_set_file_format(recorder, RECORDER_FILE_FORMAT_AMR);
+ ret = recorder_prepare(recorder);
+ printf("prepare %d\n", ret);
+ ret = recorder_start(recorder);
+ printf("start %d\n", ret);
+ result.elapsed_time = 0;
+ result.file_size = 0;
+ sleep(3);
+ ret = recorder_cancel(recorder);
+ printf("cancel %d\n", ret);
+ ret =recorder_unprepare(recorder);
+ printf("unprepare %d\n", ret);
+ ret =recorder_destroy(recorder);
+ printf("destroy %d\n", ret);
+ if( result.elapsed_time > 0 && result.file_size > 0){
+ printf("PASS\n");
+ return 0;
+ }else{
+ printf("FAIL\n");
+ return -1;
+ }
+}
+
+
+int recorder_attribute_test(){
+ int fail =0;
+ int ret;
+ recorder_h recorder;
+ ret = recorder_create_audiorecorder(&recorder);
+ fail = recording_size_limit_test(recorder);
+ fail +=recording_time_limit_test(recorder);
+ fail +=fileformat_test(recorder);
+ fail +=video_encoder_test(recorder);
+ fail +=audio_encoder_test(recorder);
+ fail +=recording_audio_device_test(recorder);
+ fail +=recording_samplerate_test(recorder);
+ fail +=recording_audio_encoder_bitrate_test(recorder);
+ fail +=recording_video_encoder_bitrate_test(recorder);
+ return fail;
+}
+
+
+
+void _recording_status_cb2(unsigned long long elapsed_time, unsigned long long file_size, void *user_data){
+ //printf("elapsed time :%d , file_size :%d\n", elapsed_time , file_size);
+}
+
+void _recording_limit_reached_cb(recorder_recording_limit_type_e type, void *user_data){
+ printf("limited!! %d\n", type);
+ int *ischeck = (int*)user_data;
+ *ischeck = 1;
+}
+
+
+int recorder_limit_cb_test(){
+ recorder_h recorder;
+ int ischeck = 0;
+ int ret =0;
+ recorder_create_audiorecorder(&recorder);
+ printf("------------------------limit cb test -------------------------\n");
+ //recorder_set_state_changed_cb(recorder, record_state_cb, NULL);
+ recorder_set_recording_status_cb(recorder, _recording_status_cb2, NULL);
+ recorder_set_recording_limit_reached_cb(recorder, _recording_limit_reached_cb, &ischeck);
+ recorder_set_file_format(recorder, RECORDER_FILE_FORMAT_AMR);
+ recorder_prepare(recorder);
+
+
+ printf("-time limit test\n");
+ recorder_attr_set_time_limit(recorder, 2);
+ recorder_start(recorder);
+ sleep(5);
+ recorder_cancel(recorder);
+ if( ischeck ){
+ printf("PASS\n");
+ }else{
+ printf("FAIL\n");
+ ret--;
+ }
+
+
+ printf("-time unlimit test\n");
+ //recorder_unprepare(recorder);
+ recorder_attr_set_time_limit(recorder, 0);
+ //recorder_prepare(recorder);
+ ischeck = 0;
+ recorder_set_recording_limit_reached_cb(recorder, _recording_limit_reached_cb, &ischeck);
+ recorder_start(recorder);
+ sleep(5);
+ recorder_cancel(recorder);
+ if( ischeck ){
+ printf("FAIL\n");
+ ret--;
+ }else{
+ printf("PASS\n");
+ }
+
+
+ printf("-size limit test\n");
+ ischeck = 0;
+ recorder_attr_set_size_limit(recorder, 2);
+ recorder_start(recorder);
+ sleep(5);
+ recorder_cancel(recorder);
+
+ if( ischeck ){
+ printf("PASS\n");
+ }else{
+ printf("FAIL\n");
+ ret--;
+ }
+
+ printf("-size unlimit test\n");
+ ischeck = 0;
+ recorder_attr_set_size_limit(recorder, 0);
+ recorder_start(recorder);
+ sleep(5);
+ recorder_cancel(recorder);
+
+ if( ischeck ){
+ printf("FAIL\n");
+ ret--;
+ }else{
+ printf("PASS\n");
+ }
+
+
+ recorder_unprepare(recorder);
+ recorder_destroy(recorder);
+
+ return ret;
+
+}
+
+int video_recorder_test(){
+ camera_h camera ;
+ recorder_h recorder;
+ int ret;
+
+ printf("-----------------video recorder test--------------------\n");
+ camera_create(CAMERA_DEVICE_CAMERA0 , &camera);
+ recorder_create_videorecorder(camera, &recorder);
+ camera_set_display(camera,CAMERA_DISPLAY_TYPE_X11,GET_DISPLAY(preview_win));
+ camera_set_x11_display_rotation(camera, CAMERA_ROTATION_270);
+ //camera_set_preview_resolution(camera, 320, 240);
+ camera_attr_set_preview_fps(camera, CAMERA_ATTR_FPS_AUTO);
+ ret = recorder_set_file_format(recorder,RECORDER_FILE_FORMAT_MP4);
+ printf("ret = %x\n", ret);
+ ret = recorder_set_video_encoder(recorder, RECORDER_VIDEO_CODEC_H263);
+ printf("ret = %x\n", ret);
+ ret = recorder_set_audio_encoder(recorder, RECORDER_AUDIO_CODEC_AAC);
+ printf("ret = %x\n", ret);
+ ret = recorder_set_filename(recorder, "/mnt/nfs/video_recorder_test.mp4");
+ printf("ret = %x\n", ret);
+
+
+ ret= recorder_prepare(recorder);
+ printf("ret = %x\n", ret);
+ ret = recorder_start(recorder);
+ printf("ret = %x\n", ret);
+ sleep(10);
+ ret = recorder_pause(recorder);
+ printf("ret = %x\n", ret);
+ ret = recorder_commit(recorder);
+ printf("ret = %x\n", ret);
+ ret =recorder_unprepare(recorder);
+ printf("ret = %x\n", ret);
+ ret= recorder_destroy(recorder);
+ printf("ret = %x\n", ret);
+ return 0;
+}
+
+int mm_test(){
+ MMCamPreset info;
+ info.videodev_type= MM_VIDEO_DEVICE_NONE;
+ MMHandleType camcorder;
+ int ret;
+ ret = mm_camcorder_create(&camcorder, &info);
+ printf("mm_camcorder_create %x\n", ret);
+ ret = mm_camcorder_set_attributes(camcorder, NULL,
+ MMCAM_MODE , MM_CAMCORDER_MODE_AUDIO,
+ (void*)NULL);
+ printf("mm_camcorder_set_attributes %x\n", ret);
+
+ ret = mm_camcorder_set_attributes(camcorder ,NULL, MMCAM_AUDIO_ENCODER ,MM_AUDIO_CODEC_AAC , NULL);
+ printf("mm_camcorder_set_attributes %x\n", ret);
+
+ ret = mm_camcorder_set_attributes(camcorder ,NULL, MMCAM_FILE_FORMAT ,MM_FILE_FORMAT_MP4 , NULL);
+ printf("mm_camcorder_set_attributes %x\n", ret);
+
+ ret = mm_camcorder_realize(camcorder);
+ printf("mm_camcorder_realize %x\n", ret);
+
+ ret = mm_camcorder_start(camcorder);
+ printf("mm_camcorder_start %x\n", ret);
+
+ ret = mm_camcorder_record(camcorder);
+ printf("mm_camcorder_record %x\n", ret);
+
+
+
+ ret = mm_camcorder_pause(camcorder);
+ printf("mm_camcorder_pause %x\n", ret);
+
+ ret = mm_camcorder_cancel(camcorder);
+ printf("mm_camcorder_cancel %x\n", ret);
+
+ ret = mm_camcorder_stop(camcorder);
+ printf("mm_camcorder_stop %x\n", ret);
+
+ ret = mm_camcorder_unrealize(camcorder);
+ printf("mm_camcorder_unrealize %x\n", ret);
+
+ ret = mm_camcorder_destroy(camcorder);
+ printf("mm_camcorder_destroy %x\n", ret);
+
+
+
+ return 0;
+
+}
+
+
+
+int recorder_encoder_test(){
+ recorder_h recorder;
+ camera_h camera;
+ int ret;
+
+ printf("3GP - AMR\n");
+ ret=recorder_create_audiorecorder(&recorder);
+ ret+=recorder_set_file_format(recorder, RECORDER_FILE_FORMAT_3GP);
+ ret+=recorder_set_audio_encoder(recorder, RECORDER_AUDIO_CODEC_AMR);
+ ret+=recorder_set_filename(recorder , "/mnt/nfs/audiotest_amr.3gp");
+ ret+=recorder_prepare(recorder);
+ ret+=recorder_start(recorder);
+ sleep(4);
+ ret+=recorder_commit(recorder);
+ ret += recorder_unprepare(recorder);
+ ret+=recorder_destroy(recorder);
+
+ printf("3GP - AAC\n");
+ ret=recorder_create_audiorecorder(&recorder);
+ ret+=recorder_set_file_format(recorder, RECORDER_FILE_FORMAT_3GP);
+ ret+=recorder_set_audio_encoder(recorder, RECORDER_AUDIO_CODEC_AAC);
+ ret+=recorder_set_filename(recorder , "/mnt/nfs/audiotest_aac.3gp");
+ ret+=recorder_prepare(recorder);
+ ret+=recorder_start(recorder);
+ sleep(4);
+ ret+=recorder_commit(recorder);
+ ret += recorder_unprepare(recorder);
+ ret+=recorder_destroy(recorder);
+
+ printf("AMR - AMR\n");
+ ret=recorder_create_audiorecorder(&recorder);
+ ret+=recorder_set_file_format(recorder, RECORDER_FILE_FORMAT_AMR);
+ ret+=recorder_set_audio_encoder(recorder, RECORDER_AUDIO_CODEC_AMR);
+ ret+=recorder_set_filename(recorder , "/mnt/nfs/audiotest.amr");
+ ret+=recorder_prepare(recorder);
+ ret+=recorder_start(recorder);
+ sleep(4);
+ ret+=recorder_commit(recorder);
+ ret += recorder_unprepare(recorder);
+ ret+=recorder_destroy(recorder);
+
+ printf("MP4 - AAC\n");
+ ret=recorder_create_audiorecorder(&recorder);
+ ret+=recorder_set_file_format(recorder, RECORDER_FILE_FORMAT_MP4);
+ ret+=recorder_set_audio_encoder(recorder, RECORDER_AUDIO_CODEC_AAC);
+ ret+=recorder_set_filename(recorder , "/mnt/nfs/audiotest_aac.mp4");
+ ret+=recorder_prepare(recorder);
+ ret+=recorder_start(recorder);
+ sleep(4);
+ ret+=recorder_commit(recorder);
+ ret += recorder_unprepare(recorder);
+ ret+=recorder_destroy(recorder);
+
+
+ ret+=camera_create(CAMERA_DEVICE_CAMERA0,&camera);
+ ret+=camera_set_x11_display_rotation(camera, CAMERA_ROTATION_270);
+ ret+=camera_set_display(camera, CAMERA_DISPLAY_TYPE_X11, GET_DISPLAY(preview_win));
+
+
+ printf("3GP - AMR- H263\n");
+ ret+=recorder_create_videorecorder(camera, &recorder);
+ ret+=recorder_set_file_format(recorder, RECORDER_FILE_FORMAT_3GP);
+ ret+=recorder_set_audio_encoder(recorder, RECORDER_AUDIO_CODEC_AMR);
+ ret+=recorder_set_video_encoder(recorder, RECORDER_VIDEO_CODEC_H263);
+ ret+=recorder_set_filename(recorder , "/mnt/nfs/videotest_amr_h263.3gp");
+ ret+=recorder_prepare(recorder);
+ ret+=recorder_start(recorder);
+ sleep(10);
+ ret+=recorder_commit(recorder);
+ ret += recorder_unprepare(recorder);
+ ret+=recorder_destroy(recorder);
+
+
+ printf("3GP - AMR- H264\n");
+ ret+=recorder_create_videorecorder(camera, &recorder);
+ ret+=recorder_set_file_format(recorder, RECORDER_FILE_FORMAT_3GP);
+ ret+=recorder_set_audio_encoder(recorder, RECORDER_AUDIO_CODEC_AMR);
+ ret+=recorder_set_video_encoder(recorder, RECORDER_VIDEO_CODEC_H264);
+ ret+=recorder_set_filename(recorder , "/mnt/nfs/videotest_amr_h264.3gp");
+ ret+=recorder_prepare(recorder);
+ ret+=recorder_start(recorder);
+ sleep(10);
+ ret+=recorder_commit(recorder);
+ ret += recorder_unprepare(recorder);
+ ret+=recorder_destroy(recorder);
+
+ printf("3GP - AMR- MPEG4\n");
+ ret+=recorder_create_videorecorder(camera, &recorder);
+ ret+=recorder_set_file_format(recorder, RECORDER_FILE_FORMAT_3GP);
+ ret+=recorder_set_audio_encoder(recorder, RECORDER_AUDIO_CODEC_AMR);
+ ret+=recorder_set_video_encoder(recorder, RECORDER_VIDEO_CODEC_MPEG4);
+ ret+=recorder_set_filename(recorder , "/mnt/nfs/videotest_amr_mpeg4.3gp");
+ ret+=recorder_prepare(recorder);
+ ret+=recorder_start(recorder);
+ sleep(10);
+ ret+=recorder_commit(recorder);
+ ret += recorder_unprepare(recorder);
+ ret+=recorder_destroy(recorder);
+
+
+ printf("3GP - AAC- H263\n");
+ ret+=recorder_create_videorecorder(camera, &recorder);
+ ret+=recorder_set_file_format(recorder, RECORDER_FILE_FORMAT_3GP);
+ ret+=recorder_set_audio_encoder(recorder, RECORDER_AUDIO_CODEC_AAC);
+ ret+=recorder_set_video_encoder(recorder, RECORDER_VIDEO_CODEC_H263);
+ ret+=recorder_set_filename(recorder , "/mnt/nfs/videotest_AAC_h263.3gp");
+ ret+=recorder_prepare(recorder);
+ ret+=recorder_start(recorder);
+ sleep(10);
+ ret+=recorder_commit(recorder);
+ ret += recorder_unprepare(recorder);
+ ret+=recorder_destroy(recorder);
+
+
+ printf("3GP - AAC- H264\n");
+ ret+=recorder_create_videorecorder(camera, &recorder);
+ ret+=recorder_set_file_format(recorder, RECORDER_FILE_FORMAT_3GP);
+ ret+=recorder_set_audio_encoder(recorder, RECORDER_AUDIO_CODEC_AAC);
+ ret+=recorder_set_video_encoder(recorder, RECORDER_VIDEO_CODEC_H264);
+ ret+=recorder_set_filename(recorder , "/mnt/nfs/videotest_AAC_h264.3gp");
+ ret+=recorder_prepare(recorder);
+ ret+=recorder_start(recorder);
+ sleep(10);
+ ret+=recorder_commit(recorder);
+ ret += recorder_unprepare(recorder);
+ ret+=recorder_destroy(recorder);
+
+ printf("3GP - AAC- MPEG4\n");
+ ret+=recorder_create_videorecorder(camera, &recorder);
+ ret+=recorder_set_file_format(recorder, RECORDER_FILE_FORMAT_3GP);
+ ret+=recorder_set_audio_encoder(recorder, RECORDER_AUDIO_CODEC_AAC);
+ ret+=recorder_set_video_encoder(recorder, RECORDER_VIDEO_CODEC_MPEG4);
+ ret+=recorder_set_filename(recorder , "/mnt/nfs/videotest_AAC_MPEG4.3gp");
+ ret+=recorder_prepare(recorder);
+ ret+=recorder_start(recorder);
+ sleep(10);
+ ret+=recorder_commit(recorder);
+ ret += recorder_unprepare(recorder);
+ ret+=recorder_destroy(recorder);
+
+ printf("MP4 - AAC- H264\n");
+ ret+=recorder_create_videorecorder(camera, &recorder);
+ ret+=recorder_set_file_format(recorder, RECORDER_FILE_FORMAT_MP4);
+ ret+=recorder_set_audio_encoder(recorder, RECORDER_AUDIO_CODEC_AAC);
+ ret+=recorder_set_video_encoder(recorder, RECORDER_VIDEO_CODEC_H264);
+ ret+=recorder_set_filename(recorder , "/mnt/nfs/videotest_AAC_h264.mp4");
+ ret+=recorder_prepare(recorder);
+ ret+=recorder_start(recorder);
+ sleep(10);
+ ret+=recorder_commit(recorder);
+ ret += recorder_unprepare(recorder);
+ ret+=recorder_destroy(recorder);
+
+ printf("MP4 - AAC- MPEG4\n");
+ ret+=recorder_create_videorecorder(camera, &recorder);
+ ret+=recorder_set_file_format(recorder, RECORDER_FILE_FORMAT_MP4);
+ ret+=recorder_set_audio_encoder(recorder, RECORDER_AUDIO_CODEC_AAC);
+ ret+=recorder_set_video_encoder(recorder, RECORDER_VIDEO_CODEC_MPEG4);
+ ret+=recorder_set_filename(recorder , "/mnt/nfs/videotest_AAC_MPEG4.mp4");
+ ret+=recorder_prepare(recorder);
+ ret+=recorder_start(recorder);
+ sleep(10);
+ ret+=recorder_commit(recorder);
+ ret += recorder_unprepare(recorder);
+ ret+=recorder_destroy(recorder);
+
+
+ camera_destroy(camera);
+
+
+ return ret;
+}
+
+ Eina_Bool print_audio_level(void *data){
+ recorder_h recorder = (recorder_h)data;
+ if( recorder ){
+ double level;
+ recorder_get_audio_level(recorder,&level);
+ printf("%g\n", level);
+ }
+ return 1;
+}
+
+int audio_level_test(){
+ recorder_h recorder;
+ recorder_create_audiorecorder(&recorder);
+ recorder_set_audio_encoder(recorder, RECORDER_AUDIO_CODEC_AMR);
+ recorder_set_file_format(recorder, RECORDER_FILE_FORMAT_AMR);
+ recorder_set_filename(recorder, "/mnt/nfs/test.amr");
+
+ recorder_prepare(recorder);
+ recorder_start(recorder);
+ ecore_timer_add(0.1, print_audio_level, recorder);
+ sleep(2);
+ return 0;
+}
+
+void _camera_state_changed_cb(camera_state_e previous, camera_state_e current,bool by_policy, void *user_data){
+ printf("camera state changed %d -> %d\n", previous , current);
+}
+
+void _recorder_state_changed_cb(recorder_state_e previous , recorder_state_e current , bool by_policy, void *user_data){
+ printf("recorder state changed %d -> %d\n", previous , current);
+}
+
+int slow_motion_test(){
+ camera_h camera;
+ recorder_h recorder;
+ int ret;
+ ret = camera_create(CAMERA_DEVICE_CAMERA0, &camera);
+ printf("camera_create ret = %x\n", ret);
+ camera_set_state_changed_cb(camera, _camera_state_changed_cb, NULL);
+ ret = recorder_create_videorecorder(camera, &recorder);
+ printf("recorder_create_videorecorder ret = %x\n", ret);
+ ret = recorder_set_state_changed_cb(recorder, _recorder_state_changed_cb , NULL);
+ ret = recorder_set_filename(recorder, "/mnt/nfs/test.3gp");
+ printf("recorder_set_filename ret = %x\n", ret);
+ ret = recorder_set_audio_encoder(recorder, RECORDER_AUDIO_CODEC_AAC);
+ printf("recorder_set_audio_encoder ret = %x\n", ret);
+ ret = recorder_set_video_encoder(recorder, RECORDER_VIDEO_CODEC_MPEG4);
+ printf("recorder_set_video_encoder ret = %x\n", ret);
+ ret = recorder_set_file_format(recorder, RECORDER_FILE_FORMAT_3GP);
+ printf("recorder_set_file_format ret = %x\n", ret);
+ ret = recorder_attr_set_recording_motion_rate(recorder, 0.5);
+ printf("recorder_attr_set_slow_motion_rate ret = %x\n", ret);
+ ret = recorder_prepare(recorder);
+ printf("recorder_prepare ret = %x\n", ret);
+ ret = recorder_start(recorder);
+ printf("recorder_start ret = %x\n", ret);
+ sleep(10);
+ ret = recorder_commit(recorder);
+ printf("recorder_commit ret = %x\n", ret);
+ ret = recorder_unprepare(recorder);
+ printf("recorder_unprepare ret = %x\n", ret);
+ ret = recorder_destroy(recorder);
+ printf("recorder_destroy ret = %x\n", ret);
+ return 0;
+}
+
+void _capturing_cb(camera_image_data_s* image, camera_image_data_s* postview, camera_image_data_s* thumbnail, void *user_data){
+ printf("capturing callback!\n");
+}
+
+void _capture_completed_cb(void *user_data){
+ printf("capture completed callback\n");
+}
+
+
+int recording_capture_test(){
+ camera_h camera;
+ recorder_h recorder;
+ int ret;
+ ret = camera_create(CAMERA_DEVICE_CAMERA0, &camera);
+ printf("camera_create ret = %x\n", ret);
+ camera_set_state_changed_cb(camera, _camera_state_changed_cb, NULL);
+ ret = recorder_create_videorecorder(camera, &recorder);
+ printf("recorder_create_videorecorder ret = %x\n", ret);
+ ret = recorder_set_state_changed_cb(recorder, _recorder_state_changed_cb , NULL);
+ ret = recorder_set_filename(recorder, "/mnt/nfs/test.3gp");
+ printf("recorder_set_filename ret = %x\n", ret);
+ ret = recorder_set_audio_encoder(recorder, RECORDER_AUDIO_CODEC_AAC);
+ printf("recorder_set_audio_encoder ret = %x\n", ret);
+ ret = recorder_set_video_encoder(recorder, RECORDER_VIDEO_CODEC_MPEG4);
+ printf("recorder_set_video_encoder ret = %x\n", ret);
+ ret = recorder_set_file_format(recorder, RECORDER_FILE_FORMAT_3GP);
+ printf("recorder_set_file_format ret = %x\n", ret);
+
+ camera_set_display(camera, CAMERA_DISPLAY_TYPE_X11, GET_DISPLAY(preview_win));
+ //camera_set_preview_resolution(camera, 640, 480);
+ //camera_set_capture_resolution(camera, 640, 480);
+
+ ret = recorder_prepare(recorder);
+ printf("recorder_prepare ret = %x\n", ret);
+ ret = recorder_start(recorder);
+ printf("recorder_start ret = %x\n", ret);
+ sleep(10);
+ ret = camera_start_capture(camera, _capturing_cb , _capture_completed_cb, NULL);
+ printf("camera_start_capture ret =%x\n", ret);
+ sleep(10);
+
+ ret = recorder_commit(recorder);
+ printf("recorder_commit ret = %x\n", ret);
+ ret = recorder_unprepare(recorder);
+ printf("recorder_unprepare ret = %x\n", ret);
+ ret = recorder_destroy(recorder);
+ printf("recorder_destroy ret = %x\n", ret);
+ return 0;
+}
+
+
+void _audio_stream_cb(void* stream, int size, audio_sample_type_e format, int channel, unsigned int timestamp, void *user_data){
+ printf("size = %d[%d]( %d )\n", size, format, timestamp);
+}
+
+int audio_stream_cb_test(){
+ recorder_h recorder;
+ int ret = 0;
+ ret = recorder_create_audiorecorder(&recorder);
+ printf(" create ret =%d\n", ret);
+ ret = recorder_set_audio_encoder(recorder, RECORDER_AUDIO_CODEC_AMR);
+ printf(" create2 ret =%d\n", ret);
+ ret = recorder_set_file_format(recorder, RECORDER_FILE_FORMAT_AMR);
+ printf(" create3 ret =%d\n", ret);
+ ret = recorder_set_filename(recorder, "/mnt/nfs/test.amr");
+ printf(" create4 ret =%d\n", ret);
+ ret = recorder_set_audio_stream_cb(recorder, _audio_stream_cb, NULL);
+ printf(" recorder_set_audio_stream_cb ret =%d\n", ret);
+ ret = recorder_prepare(recorder);
+ printf(" recorder_prepare ret =%d\n", ret);
+ ret = recorder_set_audio_stream_cb(recorder, _audio_stream_cb, NULL);
+ printf(" recorder_set_audio_stream_cb ret =%d\n", ret);
+ ret = recorder_start(recorder);
+ printf(" recorder_start ret =%d\n", ret);
+ sleep(10);
+ ret = recorder_commit(recorder);
+ printf(" recorder_commit ret =%d\n", ret);
+ return 0;
+}
+
+
+void _camera_capturing_cb_modechange(camera_image_data_s* image, camera_image_data_s* postview, camera_image_data_s* thumbnail, void *user_data){
+ printf("capturing callback\n");
+}
+void _camera_capture_completed_cb_modechange(void *user_data){
+ printf("capture complete\n");
+}
+
+void _camera_capturing_cb_modechange2(camera_image_data_s* image, camera_image_data_s* postview, camera_image_data_s* thumbnail, void *user_data){
+ printf("in recording capture callback\n");
+}
+void _camera_capture_completed_cb_modechange2(void *user_data){
+ printf("in recording capture complete\n");
+}
+
+
+int modechange_test(){
+ camera_h camera;
+ recorder_h recorder;
+ int ret;
+ ret = camera_create(CAMERA_DEVICE_CAMERA0, &camera);
+ printf("camera_create %d\n", ret);
+ ret = recorder_create_videorecorder(camera, &recorder);
+ printf("recorder_create_videorecorder %d\n", ret);
+ camera_set_display(camera, CAMERA_DISPLAY_TYPE_X11 , GET_DISPLAY(preview_win));
+
+ ret =recorder_set_file_format(recorder, RECORDER_FILE_FORMAT_3GP);
+ printf("recorder_set_file_format %d\n", ret);
+ ret =recorder_set_audio_encoder(recorder, RECORDER_AUDIO_CODEC_AAC);
+ printf("recorder_set_audio_encoder %d\n", ret);
+ ret =recorder_set_video_encoder(recorder, RECORDER_VIDEO_CODEC_MPEG4);
+ printf("recorder_set_video_encoder %d\n", ret);
+ ret =recorder_set_filename(recorder , "/mnt/nfs/videotest_AAC_MPEG4.3gp");
+ printf("recorder_set_filename %d\n", ret);
+
+ ret = camera_start_preview(camera);
+ printf("camera_start_preview %d\n", ret);
+ ret = camera_start_capture(camera, _camera_capturing_cb_modechange, _camera_capture_completed_cb_modechange, NULL);
+ printf("camera_start_capture %d\n", ret);
+ camera_state_e state;
+ camera_get_state(camera, &state);
+ while( state == CAMERA_STATE_CAPTURING ){
+ sleep(1);
+ camera_get_state(camera, &state);
+ printf("camera state = %d\n", state);
+ }
+
+ ret =recorder_set_audio_encoder(recorder, RECORDER_AUDIO_CODEC_AAC);
+ printf("recorder_set_audio_encoder %d\n", ret);
+ ret =recorder_set_video_encoder(recorder, RECORDER_VIDEO_CODEC_MPEG4);
+ printf("recorder_set_video_encoder %d\n", ret);
+
+ ret = camera_start_preview(camera);
+ printf("camera_start_preview %d\n", ret);
+
+ ret = recorder_start(recorder);
+ printf("recorder_start %d\n", ret);
+ sleep(5);
+ ret = camera_start_capture(camera, _camera_capturing_cb_modechange2, _camera_capture_completed_cb_modechange2, NULL);
+ sleep(5);
+
+ ret = recorder_commit(recorder);
+ printf("recorder_commit %d\n", ret);
+ return 0;
+}
+
+
+void* test_main(void *arg){
+ int ret = 0;
+ //ret = recorder_encoder_test();
+ /*
+ ret = recorder_attribute_test();
+ ret += recorder_state_change_test();
+ ret += recorder_recoding_status_cb_test();
+ ret += recorder_limit_cb_test();
+ ret += video_recorder_test();
+ ret = mm_test();
+ */
+
+ //audio_level_test();
+ //slow_motion_test();
+ //recording_capture_test();
+ //audio_stream_cb_test();
+ //modechange_test();
+ recorder_recoding_status_cb_test();
+
+ if( ret == 0 )
+ printf("--------------RECORDER TEST ALL PASS--------------------------\n");
+ else
+ printf("--------------RECORDER TEST FAIL %d--------------------------\n", -ret);
+
+
+ return 0;
+}
+
+int main(int argc, char ** argv)
+{
+
+ elm_init(argc, argv);
+
+
+
+ mEvasWindow = elm_win_add(NULL, "VIDEO OVERLAY", ELM_WIN_BASIC);
+ elm_win_title_set(mEvasWindow, "video overlay window");
+ elm_win_borderless_set(mEvasWindow, 0);
+ evas_object_resize(mEvasWindow, 800, 480);
+ evas_object_move(mEvasWindow, 0, 0);
+ evas_object_show(mEvasWindow);
+
+ //To support full-screen
+ elm_win_rotation_set(mEvasWindow, 270);
+ //elm_win_fullscreen_set(mEvasWindow, 1);
+
+ evas_object_color_set(mEvasWindow, 0,0,0,0);
+ preview_win = elm_win_xwindow_get(mEvasWindow);
+
+ fprintf(stderr, "end of elm\n");
+
+ pthread_t gloop_thread;
+
+ pthread_create(&gloop_thread, NULL, test_main, NULL);
+
+
+
+ elm_run();
+ elm_shutdown();
+
+
+ return 0;
+}