Git init
authorKibum Kim <kb0929.kim@samsung.com>
Fri, 6 Jan 2012 15:42:54 +0000 (00:42 +0900)
committerKibum Kim <kb0929.kim@samsung.com>
Fri, 6 Jan 2012 15:42:54 +0000 (00:42 +0900)
20 files changed:
.gitignore [new file with mode: 0755]
AUTHORS [new file with mode: 0755]
CMakeLists.txt [new file with mode: 0755]
LICENSE [new file with mode: 0755]
capi-media-recorder.pc.in [new file with mode: 0755]
debian/README [new file with mode: 0755]
debian/capi-media-recorder-dev.install [new file with mode: 0755]
debian/capi-media-recorder-dev.postinst [new file with mode: 0755]
debian/capi-media-recorder.install [new file with mode: 0755]
debian/capi-media-recorder.postinst [new file with mode: 0755]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0755]
debian/control [new file with mode: 0755]
debian/rules [new file with mode: 0755]
include/recorder.h [new file with mode: 0755]
include/recorder_private.h [new file with mode: 0755]
packaging/capi-media-recorder.spec [new file with mode: 0755]
src/recorder.c [new file with mode: 0755]
test/CMakeLists.txt [new file with mode: 0755]
test/multimedia_recorder_test.c [new file with mode: 0755]

diff --git a/.gitignore b/.gitignore
new file mode 100755 (executable)
index 0000000..f884ceb
--- /dev/null
@@ -0,0 +1,26 @@
+CMakeCache.txt
+*/CMakeFiles/*
+*.cmake
+CMakeFiles*
+*.a
+*.so
+Testing
+cmake.depends
+cmake.check_depends
+cmake.check_cache
+core
+core.*
+gmon.out
+install_manifest.txt
+*~
+.kdev_include_paths
+src.kdev4
+.cproject
+.project
+tet_captured
+tet_lock
+*.pc
+*-test
+*-test_*
+*tester.c
+TC/config
diff --git a/AUTHORS b/AUTHORS
new file mode 100755 (executable)
index 0000000..a724834
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,2 @@
+Seungkeun Lee <sngn.lee@samsung.com>
+Kangho Hur <kanho.hur@samsung.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..14a0478
--- /dev/null
@@ -0,0 +1,116 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+SET(Services 
+        "application"
+        "base"
+        "content"
+        "location"
+        "media"
+        "messaging"
+        "network"
+        "social"
+        "telephony"
+        "system"
+   )
+
+# project
+SET(project_prefix "capi")
+SET(prefix "/usr")
+SET(version "0.0.1")
+SET(maintainer "Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>")
+SET(description "A Camera library in Tizen Native API")
+SET(service "media")
+SET(submodule "recorder")
+
+# for package file
+SET(dependents "dlog mm-camcorder capi-media-camera")
+
+# for deb
+SET(deb_dependents "libdlog-0 libmm-camcorder capi-media-camera")
+
+SET(fw_name "${project_prefix}-${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})
+
+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 -Werror")
+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=/usr/lib")
+
+aux_source_directory(src SOURCES)
+ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
+
+TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
+
+INSTALL(TARGETS ${fw_name} DESTINATION lib)
+INSTALL(
+        DIRECTORY ${INC_DIR}/ DESTINATION include/${service}
+        FILES_MATCHING
+        PATTERN "*_private.h" EXCLUDE
+        PATTERN "${INC_DIR}/*.h"
+        )
+
+SET(PC_NAME ${fw_name})
+SET(PC_REQUIRED ${dependents})
+SET(PC_LDFLAGS -l${fw_name})
+SET(PC_CFLAGS -I\${includedir}/${service})
+
+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/pkgconfig)
+
+#ADD_SUBDIRECTORY(test)
+
+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)
diff --git a/LICENSE b/LICENSE
new file mode 100755 (executable)
index 0000000..bbe9d02
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,206 @@
+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
diff --git a/capi-media-recorder.pc.in b/capi-media-recorder.pc.in
new file mode 100755 (executable)
index 0000000..773d667
--- /dev/null
@@ -0,0 +1,15 @@
+
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=/usr
+libdir=/usr/lib
+includedir=/usr/include/media
+
+Name: @PC_NAME@
+Description: @PACKAGE_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRED@ 
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir} @PC_CFLAGS@
+
diff --git a/debian/README b/debian/README
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/debian/capi-media-recorder-dev.install b/debian/capi-media-recorder-dev.install
new file mode 100755 (executable)
index 0000000..761a28b
--- /dev/null
@@ -0,0 +1,4 @@
+/usr/include/*
+/usr/include/*/*
+/usr/lib/pkgconfig/*.pc
+
diff --git a/debian/capi-media-recorder-dev.postinst b/debian/capi-media-recorder-dev.postinst
new file mode 100755 (executable)
index 0000000..1a24852
--- /dev/null
@@ -0,0 +1 @@
+#!/bin/sh
diff --git a/debian/capi-media-recorder.install b/debian/capi-media-recorder.install
new file mode 100755 (executable)
index 0000000..4a755a4
--- /dev/null
@@ -0,0 +1 @@
+/usr/lib/lib*.so*
diff --git a/debian/capi-media-recorder.postinst b/debian/capi-media-recorder.postinst
new file mode 100755 (executable)
index 0000000..1a24852
--- /dev/null
@@ -0,0 +1 @@
+#!/bin/sh
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..26fd843
--- /dev/null
@@ -0,0 +1,11 @@
+capi-media-recorder (0.1.0-4) unstable; urgency=low
+
+  * Update version
+
+ -- Seungkeun Lee <sngn.lee@samsung.com>  Thu, 15 Dec 2011 12:54:39 +0900
+
+capi-media-recorder (0.0.1-1) unstable; urgency=low
+
+  * Initial release.
+
+ -- Seungkeun Lee <sngn.lee@samsung.com>  Thu, 08 Dec 2011 08:57:45 +0900
diff --git a/debian/compat b/debian/compat
new file mode 100755 (executable)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100755 (executable)
index 0000000..2cb8739
--- /dev/null
@@ -0,0 +1,22 @@
+
+Source: capi-media-recorder
+Section: libs
+Priority: extra
+Maintainer: Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>
+Build-Depends: debhelper (>= 5), libmm-camcorder-dev, libmm-common-dev, capi-media-camera-dev
+
+Package: capi-media-recorder
+Architecture: any
+Depends: ${shilbs:Depends}, ${misc:Depends}
+Description: A Camera library in Tizen Native API
+
+Package: capi-media-recorder-dev
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, capi-media-recorder (= ${Source-Version}), dlog-dev, capi-base-common-dev, capi-media-camera-dev, libmm-camcorder-dev
+Description: A Camera library in Tizen Native API (DEV)
+
+Package: capi-media-recorder-dbg
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, capi-media-recorder (= ${Source-Version})
+Description: A Camera library in Tizen Native API (DBG)
+
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..dba96d0
--- /dev/null
@@ -0,0 +1,65 @@
+#!/usr/bin/make -f
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0
+else
+       CFLAGS += -O2
+endif
+CMAKE_ROOT_DIR ?= $(CURDIR)
+CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp
+
+configure: configure-stamp
+configure-stamp:
+       dh_testdir
+       mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && cmake ..
+       touch configure-stamp
+
+
+build: build-stamp
+build-stamp: configure-stamp 
+       dh_testdir
+       cd $(CMAKE_BUILD_DIR) && $(MAKE)
+       touch $@
+
+clean:
+       cd $(CMAKE_ROOT_DIR)
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp configure-stamp
+       rm -f 
+       rm -rf $(CMAKE_BUILD_DIR)
+       dh_clean
+       
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k 
+       dh_installdirs
+
+       cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+binary-indep: build install
+
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+       dh_installchangelogs 
+       dh_installdocs
+       dh_installexamples
+       dh_install --sourcedir=debian/tmp
+       dh_installman
+       dh_link
+       dh_strip --dbg-package=capi-media-recorder-dbg
+       dh_fixperms
+       dh_makeshlibs
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
+
diff --git a/include/recorder.h b/include/recorder.h
new file mode 100755 (executable)
index 0000000..fbb02dc
--- /dev/null
@@ -0,0 +1,881 @@
+/*
+* 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 <camera.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define RECORDER_ERROR_CLASS        TIZEN_ERROR_MULTIMEDIA_CLASS | 0x10
+
+
+/**
+ * @file recorder.h
+ * @brief This file contains the Recorder API.
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_RECORDER_MODULE
+ * @{
+ */
+
+/**
+ * @brief The handle to media recorder
+ */
+typedef struct recorder_s *recorder_h;
+
+/**
+ * @brief  Enumerations of error code for the media recorder.
+ */
+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_e;
+
+/**
+ * @brief Enumerations for camera states.
+ */
+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 Enumerations of recording limitation.
+ */
+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 Enumerations of file container format.
+ */
+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_e;
+
+
+/**
+ * @brief Enumerations of audio codec.
+ */
+typedef enum
+{
+       RECORDER_AUDIO_CODEC_AMR,                       /**< AMR codec */
+       RECORDER_AUDIO_CODEC_AAC,                       /**< AAC codec */
+} recorder_audio_codec_e;
+
+/**
+ * @brief Enumerations of video codec.
+ */
+typedef enum
+{
+       RECORDER_VIDEO_CODEC_H263,                      /**< H263 codec */
+       RECORDER_VIDEO_CODEC_H264,                      /**< H264 codec */
+       RECORDER_VIDEO_CODEC_MPEG4,             /**< MPEG4 codec */
+} recorder_video_codec_e;
+
+/**
+ * @brief Enumerations of audio capture devices.
+ */
+typedef enum
+{
+       RECORDER_AUDIO_DEVICE_MIC,      /**< Mic device */
+       RECORDER_AUDIO_DEVICE_MODEM,    /**< Modem */
+} recorder_audio_device_e;
+
+
+/**
+ * @}
+*/
+
+/**
+ * @addtogroup CAPI_MEDIA_RECORDER_MODULE
+ * @{
+ */
+
+/**
+ * @brief  The callback function called when limitation error occurs while recording.
+ * @details The callback function is possible to receive three types of limits: time, size and no-space.
+ * @remarks After called it, recording data is discarded and not written in recording file. Also the state of recorder is not changed.
+ * @param[in] type             The limitation type
+ * @param[in] user_data The user data passed from the callback registration function
+ * @pre It is required 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  Callback function to indicate recording status
+ * @remarks This callback function is repeatedly invoked during #RECORDER_STATE_RECORDING state
+ * @param[in] elapsed_time     The time of recording (milliseconds)
+ * @param[in] file_size        The size of recording file (KB)
+ * @param[in] user_data The user data passed from the callback registration function
+ * @pre recorder_start() will cause this callback if you register this callback 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)(int elapsed_time, int file_size, void *user_data);
+
+
+/**
+ * @brief  Called when the record state has changed.
+ * @param[in] previous The previous state of recorder
+ * @param[in] current  The current state of recorder
+ * @param[in] by_policy        @c true if the recorder state is changed by sound policy, otherwise @c false
+ * @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);
+
+ /**
+ * @}
+*/
+
+/**
+ * @addtogroup CAPI_MEDIA_RECORDER_CAPABILITY_MODULE
+ * @{
+ */
+
+/**
+ * @brief Gets called iteratively to notify you of supported file formats. 
+ * @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 @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  Gets called iteratively to notify you of supported audio encoders.
+ * @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 @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  Gets called iteratively to notify you of supported video encoders.
+ * @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 @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.
+ * @param[in]   camera The handle to camera
+ * @param[out]  recorder       A handle to recorder
+ * @remarks @a recorder must be released with recorder_destroy() by you.\n
+ * The @a camera handle can not be used for capturing images until @record is deleted by recorder_destroy().  
+ * @return     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
+ * @pre Camera handle's state must be #CAMERA_STATE_CREATED by camera_create() or camera_stop_preview().
+ * @post The recorder state will be #RECORDER_STATE_CREATED.
+ * @see camera_create()
+ * @see camera_stop_preview()
+ * @see recorder_destroy()
+ */
+int recorder_create_videorecorder(camera_h camera, recorder_h *recorder);
+
+
+/**
+ * @brief  Creates a recorder handle to record an audio.
+ * @remarks @a recorder must be released with recorder_destroy() by you 
+ * @param[out] recorder        A handle to  recorder
+ * @return     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
+ * @post The recorder state will be #RECORDER_STATE_CREATED.
+ * @see recorder_destroy()
+ */
+int recorder_create_audiorecorder(recorder_h *recorder);
+
+
+/**
+ * @brief  Destroys the recorder handle
+ * @remarks    Video recorder's camera handle is not release by this function.
+ * @param[in]  recorder    The handle to media recorder
+ * @return     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
+ * @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 recorder_destroy(recorder_h recorder);
+
+
+/**
+ * @brief  Prepares the media recorder for recording
+ * @remarks    Before calling the function, it is required to set audio encoder (recorder_set_audio_encoder()),
+ * video encoder(recorder_set_video_encoder()), file format (recorder_set_file_format()) with proper value.
+ * @param[in]  recorder        The handle to media recorder
+ * @return     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
+ * @pre  The recorder state should be #RECORDER_STATE_CREATED by recorder_create_videorecorder(), recorder_create_audiorecorder() or recorder_unprepare().
+ * @post The recorder state will be #RECORDER_STATE_READY.
+ * @post       If recorder handle is created by recorder_create_videorecorder(), it's 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 recorder_prepare(recorder_h recorder);
+
+
+/**
+ * @brief  Reset the media recorder.
+ * @param[in]  recorder    The handle to media recorder
+ * @return     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
+ * @pre  The recorder state should be #RECORDER_STATE_READY by recorder_prepare(), recorder_cancel(),or recorder_commit().
+ * @post The recorder state will be #RECORDER_STATE_CREATED.
+ * @post       If recorder handle is created by recorder_create_videorecorder(), it's camera state will be changed to #CAMERA_STATE_CREATED.
+ * @see        recorder_prepare()
+ * @see        recorder_cancel()
+ * @see        recorder_commit()
+ */
+int recorder_unprepare(recorder_h recorder);
+
+
+/**
+ * @brief  Starts recording
+ * @remarks If file path has been set to existing file, this file is removed automatically and updated by new one.
+ * @param[in]  recorder        The handle to media recorder
+ * @return     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
+ * @pre The recorder state must be #RECORDER_STATE_READY by recorder_prepare() or #RECORDER_STATE_PAUSED by recorder_pause()
+ * @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()
+ */
+int recorder_start(recorder_h recorder);
+
+
+/**
+ * @brief  Pauses recording
+ * @remarks    Recording can be resumed with recorder_start().
+ * @param[in]  recorder        The handle to media recorder
+ * @return     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
+ * @pre The recorder state must be #RECORDER_STATE_RECORDING
+ * @post The recorder state will be #RECORDER_STATE_PAUSED.
+ * @see recorder_pause()
+ * @see recorder_commit()
+ * @see recorder_cancel()
+ */
+int recorder_pause(recorder_h recorder);
+
+
+/**
+ * @brief  Stops recording and saving the result
+ * @param   [in]       recorder        The handle to media recorder
+ * @return     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
+ * @pre The recorder state must be #RECORDER_STATE_RECORDING by recorder_start() or #RECORDER_STATE_PAUSED by recorder_pause()
+ * @post The recorder state will be #RECORDER_STATE_READY.
+ * @see recorder_pause()
+ * @see recorder_cancel()
+ * @see recorder_set_filename()
+ * @see        recorder_start()
+ */
+int recorder_commit(recorder_h recorder);
+
+
+/**
+ * @brief  Cancels recording.
+ * @detail The recording data is discarded and not written in recording file.
+ * @param[in]  recorder    The handle to media recorder
+ * @return     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
+ * @pre The recorder state must be #RECORDER_STATE_RECORDING by recorder_start() or #RECORDER_STATE_PAUSED by recorder_pause()
+ * @post The recorder state will be #RECORDER_STATE_READY.
+ * @see recorder_pause()
+ * @see recorder_commit()
+ * @see recorder_cancel()
+ * @see recorder_start()
+ */
+int recorder_cancel(recorder_h recorder);
+
+
+/**
+ * @brief Gets the recorder's current state.
+ * @param[in]  recorder The handle to the recorder.
+ * @param[out] state  The current state of the recorder
+ * @return  0 on success, otherwise a negative error value.
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int recorder_get_state(recorder_h recorder, recorder_state_e *state);
+
+
+/**
+ * @brief  Sets the file path to record
+ * @details This function sets file path which defines where newly recorder data should be stored. 
+ * @remarks    If there is already exists same file in file system, then old file will be overwritten.
+ * @param[in]  recorder        The handle to media recorder
+ * @param[in]  path The recording file path
+ * @return     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
+ * @pre The recorder state must be #RECORDER_STATE_CREATED by recorder_create() or recorder_unprepare()
+ * @see        recorder_get_filename()
+ */
+int recorder_set_filename(recorder_h recorder, const char *path);
+
+
+/**
+ * @brief  Gets the file path to record
+ * @remarks  @a path must be released with @c free() by you.
+ * @param[in]  recorder    The handle to media recorder
+ * @param[out] path    The recording file path
+ * @return     0 on success, otherwise a negative error value.
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see        recorder_set_filename()
+ */
+int recorder_get_filename(recorder_h recorder, char **path);
+
+
+/**
+ * @brief  Sets the file format for recording media stream
+ * @param[in] recorder The handle to media recorder
+ * @param[in] format   The media file format
+ * @return     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
+ * @pre The recorder state must be #RECORDER_STATE_CREATED
+ * @see recorder_get_file_format()
+ * @see recorder_foreach_supported_file_format()
+ */
+int recorder_set_file_format(recorder_h recorder, recorder_file_format_e format);
+
+
+/**
+ * @brief  Gets the file format for recording media stream
+ * @param [in] recorder The handle to media recorder
+ * @param [in] format   The media file format
+ * @return     0 on success, otherwise a negative error value.
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see recorder_set_file_format()
+ * @see recorder_foreach_supported_file_format()
+ */
+int 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
+ * @param[in] recorder  The handle to media recorder
+ * @param[in] callback The iteration callback
+ * @param[in] user_data        The user data to be passed to the callback function
+ * @return     0 on success, otherwise a negative error value.
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @post  recorder_supported_file_format_cb() will be invoked
+ * @see recorder_get_file_format()
+ * @see recorder_set_file_format()
+ * @see recorder_supported_file_format_cb()
+ */
+int 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 audio stream
+ * @remarks You can get available audio encoders by using recorder_foreach_supported_audio_encoder().
+ * @param[in] recorder The handle to media recorder
+ * @param[in] codec    The audio codec
+ * @return     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
+ * @pre The recorder state must be #RECORDER_STATE_CREATED
+ * @see        recorder_get_audio_encoder()
+ * @see recorder_foreach_supported_audio_encoder()
+ */
+int recorder_set_audio_encoder(recorder_h recorder, recorder_audio_codec_e codec);
+
+
+/**
+ * @brief  Gets the audio codec for encoding audio stream
+ * @param [in] recorder The handle to media recorder
+ * @param [out] codec   The audio codec
+ * @return     0 on success, otherwise a negative error value.
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see        recorder_set_audio_encoder()
+ * @see recorder_foreach_supported_audio_encoder()
+ */
+int 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.
+ * @param[in] recorder  The handle to media recorder
+ * @param[in] callback The iteration callback
+ * @param[in] user_data        The user data to be passed to the callback function
+ * @return     0 on success, otherwise a negative error value.
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @post  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 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 video codec for encoding video stream.
+ * @remarks You can get available video encoders by using recorder_foreach_supported_video_encoder().
+ * @param[in] recorder The handle to media recorder
+ * @param[in] codec    The video codec
+ * @return     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
+ * @pre The recorder state must be #RECORDER_STATE_CREATED
+ * @see recorder_get_video_encoder()
+ * @see recorder_foreach_supported_video_encoder()
+ */
+int recorder_set_video_encoder(recorder_h recorder, recorder_video_codec_e codec);
+
+
+/**
+ * @brief  Gets the video codec for encoding video stream.
+ * @param[in] recorder The handle to media recorder
+ * @param[out] codec   The video codec
+ * @return     0 on success, otherwise a negative error value.
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see recorder_set_video_encoder()
+ * @see recorder_foreach_supported_video_encoder()
+ */
+int 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.
+ * @param[in] recorder The handle to media recorder
+ * @param[in] callback The iteration callback
+ * @param[in] user_data        The user data to be passed to the callback function
+ * @return     0 on success, otherwise a negative error value.
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @post  recorder_supported_video_encoder_cb() will be invoked
+ * @see recorder_set_video_encoder()
+ * @see recorder_get_video_encoder()
+ * @see        recorder_supported_video_encoder_cb()
+ */
+int 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.
+ * @param[in] recorder The handle to the 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     0 on success, otherwise a negative error value.
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @post  recorder_state_changed_cb() will be invoked
+ * @see recorder_unset_state_changed_cb()
+ * @see recorder_state_changed_cb()
+ */
+int recorder_set_state_changed_cb(recorder_h recorder, recorder_state_changed_cb callback, void *user_data);
+
+
+/**
+ * @brief  Unregisters the callback function.
+ * @param[in]  recorder The handle to the recorder.
+ * @return     0 on success, otherwise a negative error value.
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see recorder_set_state_changed_cb()
+ */
+int recorder_unset_state_changed_cb(recorder_h recorder);
+
+
+/**
+ * @brief  Registers a callback function to be invoked when the recording information changes.
+ * @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     0 on success, otherwise a negative error value.
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @post  recorder_recording_status_cb() will be invoked
+ * @see recorder_unset_recording_status_cb()
+ * @see        recorder_recording_status_cb()
+ */
+int recorder_set_recording_status_cb(recorder_h recorder, recorder_recording_status_cb callback, void *user_data);
+
+
+/**
+ * @brief Unregisters the callback function.
+ * @param[in]  recorder    The handle to media recorder
+ * @return     0 on success, otherwise a negative error value.
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see recorder_set_recording_status_cb()
+ */
+int recorder_unset_recording_status_cb(recorder_h recorder);
+
+
+/**
+ * @brief  Registers the callback function to run when reached recording limit.
+ * @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     0 on success, otherwise a negative error value.
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @post  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 recorder_set_recording_limit_reached_cb(recorder_h recorder, recorder_recording_limit_reached_cb callback, void *user_data);
+
+
+/**
+ * @brief  Unregisters the callback function.
+ * @param[in]  recorder        The handle to media recorder
+ * @return     0 on success, otherwise a negative error value.
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see        recorder_set_recording_limit_reached_cb()
+ */
+int recorder_unset_recording_limit_reached_cb(recorder_h recorder);
+
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_RECORDER_ATTRIBUTES_MODULE
+ * @{
+ */
+
+
+/**
+ * @brief  Sets maximum size of recording file.
+ * @remarks    After reached limitation, recording data is discarded and not written in recording file.
+ * @param[in] recorder The handle to media recorder
+ * @param[in] kbyte The maximum size of recording file(KB)\n @c 0 means unlimited recording size.
+ * @return     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
+ * @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 recorder_attr_set_size_limit(recorder_h recorder, int kbyte);
+
+
+/**
+ * @brief  Gets the maximum size of recording file.
+ * @param[in] recorder The handle to media recorder
+ * @param[out] kbyte   The maximum size of recording file (KB)\n @c 0 means unlimited recording size
+ * @return     0 on success, otherwise a negative error value.
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see recorder_attr_set_size_limit()
+ * @see recorder_attr_get_time_limit()
+ */
+int recorder_attr_get_size_limit(recorder_h recorder, int *kbyte);
+
+
+/**
+ * @brief  Sets time limit of recording file.
+ * @remarks    After reached limitation, recording data is discarded and not written in recording file.
+ * @param[in] recorder The handle to media recorder
+ * @param[in] second   The time limit of recording file (in seconds) \n @c 0 means unlimited recording size
+ * @return     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
+ * @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 recorder_attr_set_time_limit(recorder_h recorder, int second);
+
+
+/**
+ * @brief  Gets the time limit of recording file
+ * @param[in] recorder  The handle to media recorder
+ * @param[out] second   The time limit of recording file (in seconds)\n  @c 0 means unlimited recording time.
+ * @return     0 on success, otherwise a negative error value.
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see        recorder_attr_set_time_limit()
+ * @see        recorder_attr_get_size_limit()
+ */
+int recorder_attr_get_time_limit(recorder_h recorder, int *second);
+
+
+/**
+ * @brief  Sets audio device for recording.
+ * @param[in] recorder The handle to media recorder
+ * @param[in] device   The type of audio device
+ * @return     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
+ * @pre The recorder state must be #RECORDER_STATE_CREATED
+ * @see        recorder_attr_get_audio_device()
+ */
+int recorder_attr_set_audio_device(recorder_h recorder, recorder_audio_device_e device);
+
+
+/**
+ * @brief Gets the audio device for recording.
+ * @param[in] recorder  The handle to media recorder
+ * @param[out] device The type of audio device
+ * @return     0 on success, otherwise a negative error value.
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see        recorder_attr_set_audio_device()
+ */
+int recorder_attr_get_audio_device(recorder_h recorder, recorder_audio_device_e *device);
+
+
+/**
+ * @brief  Sets sampling rate of audio stream.
+ * @param[in] recorder  The handle to media recorder
+ * @param[in] samplerate The sample rate in Hertz
+ * @return     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
+ * @pre The recorder state must be #RECORDER_STATE_CREATED
+ * @see        recorder_attr_get_audio_samplerate()
+ */
+int recorder_attr_set_audio_samplerate(recorder_h recorder, int samplerate);
+
+
+/**
+ * @brief  Gets the sampling rate of audio stream.
+ * @param[in] recorder The handle to media recorder
+ * @param[out] samplerate  The sample rate in Hertz
+ * @return     0 on success, otherwise a negative error value.
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see        recorder_attr_set_audio_samplerate()
+ */
+int recorder_attr_get_audio_samplerate(recorder_h recorder, int *samplerate);
+
+
+/**
+ * @brief  Sets the bitrate of audio encoder.
+ * @param[in] recorder  The handle to media recorder
+ * @param[in] bitrate   The bitrate (for mms : 12200[bps], normal : 288000[bps])
+ * @return     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
+ * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY
+ * @see        recorder_attr_get_audio_encoder_bitrate()
+ */
+int recorder_attr_set_audio_encoder_bitrate(recorder_h recorder, int bitrate);
+
+
+/**
+ * @brief  Sets bitrate of video encoder.
+ * @param[in] recorder  The handle to media recorder
+ * @param[in] bitrate   The bitrate in bits per second
+ * @return     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
+ * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY
+ * @see        recorder_attr_get_video_encoder_bitrate()
+ */
+int recorder_attr_set_video_encoder_bitrate(recorder_h recorder, int bitrate);
+
+
+/**
+ * @brief  Gets the bitrate of audio encoder.
+ * @param[in] recorder  The handle to media recorder
+ * @param[out] bitrate  The bitrate in bits per second
+ * @return     0 on success, otherwise a negative error value.
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see        recorder_attr_set_audio_encoder_bitrate()
+ */
+int recorder_attr_get_audio_encoder_bitrate(recorder_h recorder, int *bitrate);
+
+
+/**
+ * @brief  Gets the bitrate of video encoder.
+ * @param[in] recorder The handle to media recorder
+ * @param[out] bitrate The bitrate in bits per second
+ * @return     0 on success, otherwise a negative error value.
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see        recorder_attr_set_audio_encoder_bitrate()
+ */
+int recorder_attr_get_video_encoder_bitrate(recorder_h recorder, int *bitrate);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_MULTIMEDIA_RECORDER_H__ */
+
diff --git a/include/recorder_private.h b/include/recorder_private.h
new file mode 100755 (executable)
index 0000000..8479796
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+* 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 <camera.h>
+#include <mm_camcorder.h>
+#include <recorder.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+       _RECORDER_EVENT_TYPE_STATE_CHANGE,
+       _RECORDER_EVENT_TYPE_RECORDING_LIMITED, 
+       _RECORDER_EVENT_TYPE_RECORDING_STATUS,
+       _RECORDER_EVENT_TYPE_NUM
+}_recorder_event_e;
+
+typedef enum {
+       _RECORDER_TYPE_AUDIO= 0,
+       _RECORDER_TYPE_VIDEO
+}_recorder_type_e;
+
+typedef struct _recorder_s{
+       MMHandleType mm_handle;
+       camera_h camera;
+       void* user_cb[_RECORDER_EVENT_TYPE_NUM];
+       void* user_data[_RECORDER_EVENT_TYPE_NUM];
+       int state;
+       _recorder_type_e  type;
+       int origin_preview_format;
+
+} recorder_s;
+
+int mm_recorder_msg_cb(int message, void *param, void *user_data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__TIZEN_MULTIMEDIA_RECORDER_PRIVATE_H__
+
+
diff --git a/packaging/capi-media-recorder.spec b/packaging/capi-media-recorder.spec
new file mode 100755 (executable)
index 0000000..44dffdd
--- /dev/null
@@ -0,0 +1,51 @@
+Name:       capi-media-recorder
+Summary:    A Camera library in Tizen Native API
+Version:    0.0.1
+Release:    1
+Group:      TO_BE/FILLED_IN
+License:    TO BE FILLED IN
+Source0:    %{name}-%{version}.tar.gz
+BuildRequires:  cmake
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(mm-camcorder)
+BuildRequires:  pkgconfig(capi-base-common)
+BuildRequires:  pkgconfig(capi-media-camera)
+Requires(post): /sbin/ldconfig  
+Requires(postun): /sbin/ldconfig
+
+%description
+
+%package devel
+Summary:  A Camera library in Tizen Native API (Development)
+Group:    TO_BE/FILLED_IN
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+
+%prep
+%setup -q
+
+
+%build
+cmake . -DCMAKE_INSTALL_PREFIX=/usr
+
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+
+%files
+%{_libdir}/libcapi-media-recorder.so
+
+%files devel
+%{_includedir}/media/recorder.h
+%{_libdir}/pkgconfig/*.pc
+
+
diff --git a/src/recorder.c b/src/recorder.c
new file mode 100755 (executable)
index 0000000..16fac98
--- /dev/null
@@ -0,0 +1,964 @@
+/*
+* 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 <mm_camcorder.h>
+#include <mm_types.h>
+#include <math.h>
+#include <camera.h>
+#include <recorder.h>
+#include <recorder_private.h>
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TIZEN_N_RECORDER"
+
+/*
+ *     camera_private
+ * It should be sync with camera_private.h
+*/
+int mm_message_callback(int message, void *param, void *user_data);
+
+typedef enum {
+       _CAMERA_EVENT_TYPE_STATE_CHANGE,
+       _CAMERA_EVENT_TYPE_FOCUS_CHANGE,        
+       _CAMERA_EVENT_TYPE_CAPTURE_COMPLETE,
+       _CAMERA_EVENT_TYPE_PREVIEW,
+       _CAMERA_EVENT_TYPE_CAPTURE,     
+       _CAMERA_EVENT_TYPE_ERROR,               
+       _CAMERA_EVENT_TYPE_NUM
+}_camera_event_e;
+
+typedef struct _camera_s{
+       MMHandleType mm_handle;
+       
+       void* user_cb[_CAMERA_EVENT_TYPE_NUM];
+       void* user_data[_CAMERA_EVENT_TYPE_NUM];
+       unsigned long display_handle;
+       int state;
+       
+} camera_s;
+/*
+ * end of camera_private
+ */
+
+
+int _convert_recorder_error_code(const char *func, int code){
+       int ret = RECORDER_ERROR_INVALID_OPERATION;
+       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 :
+               case MM_ERROR_COMMON_INVALID_PERMISSION :
+               case MM_ERROR_COMMON_OUT_OF_ARRAY :
+               case MM_ERROR_COMMON_OUT_OF_RANGE :
+               case MM_ERROR_COMMON_ATTR_NOT_EXIST :
+                       ret = RECORDER_ERROR_INVALID_PARAMETER;
+                       errorstr = "INVALID_PARAMETER";                 
+                       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_REG_TROUBLE :
+               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_NOT_SUPPORTED :
+               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;
+
+               default:
+                       ret = RECORDER_ERROR_INVALID_OPERATION;
+                       errorstr = "INVALID_OPERATION";
+               
+       }
+
+       LOGE( "[%s] %s(0x%08x) : core frameworks error code(0x%08x)",func, errorstr, ret, code);
+       
+
+       return ret;
+}
+
+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_RECORDING:
+                       state = RECORDER_STATE_RECORDING;
+                       break;
+               case MM_CAMCORDER_STATE_PAUSED:
+                       state = RECORDER_STATE_PAUSED;
+                       break;
+               default:
+                       state = RECORDER_STATE_NONE;
+                       break;
+       }
+
+       return state;
+}
+
+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; 
+
+       switch(message){
+               case MM_MESSAGE_CAMCORDER_STATE_CHANGED:
+               case MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_ASM:
+                               previous_state = handle->state;
+                               handle->state = _recorder_state_convert(m->state.current);
+                               
+                               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, message == MM_MESSAGE_CAMCORDER_STATE_CHANGED ? 0 : 1 , 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( message == MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_ASM ){
+                                       if( m->state.previous == MM_CAMCORDER_STATE_PREPARE && m->state.current == MM_CAMCORDER_STATE_PREPARE ){
+                                               mm_camcorder_unrealize(handle->mm_handle);
+                                       }
+                               }
+                               
+                               break;
+               case MM_MESSAGE_CAMCORDER_MAX_SIZE:
+               case MM_MESSAGE_CAMCORDER_NO_FREE_SPACE:                        
+               case MM_MESSAGE_CAMCORDER_TIME_LIMIT:
+                       {
+                               recorder_recording_limit_type_e type ;
+                               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_CAPTURED :
+               {
+                       MMCamRecordingReport *report = (MMCamRecordingReport *)m ->data;
+                       int mode;
+                       mm_camcorder_get_attributes(handle->mm_handle ,NULL,MMCAM_MODE, &mode, NULL);
+
+                       if( mode != MM_CAMCORDER_MODE_IMAGE){
+                               if( report && report->recording_filename ){
+                                       free(report->recording_filename );
+                                       report->recording_filename = NULL;
+                               }
+                               if( report ){
+                                       free(report);
+                                       report = NULL;
+                               }
+                       }
+                       break;
+               }
+
+
+                       
+       }
+
+       return 1;
+}
+
+int recorder_create_videorecorder( camera_h camera, recorder_h* recorder){
+       
+       if( camera == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);  
+
+       int ret;
+       recorder_s * handle;
+       camera_state_e camera_state;    
+       int preview_format;     
+
+       camera_get_state(camera, &camera_state);
+       if( camera_state != CAMERA_STATE_CREATED){
+               LOGE("[%s] camera state(%d) is not CAMERA_STATE_CREATED ", __func__, camera_state);
+               return RECORDER_ERROR_INVALID_PARAMETER;
+       }
+       
+       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->mm_handle = ((camera_s*)camera)->mm_handle;
+       handle->camera = camera;
+       handle->state = RECORDER_STATE_CREATED;
+
+       mm_camcorder_set_message_callback(handle->mm_handle, mm_recorder_msg_cb, (void*)handle);
+
+       //((camera_s*)camera)->relay_callback = mm_recorder_msg_cb;
+       //((camera_s*)camera)->relay_user_data = handle;
+       handle->type = _RECORDER_TYPE_VIDEO;
+       *recorder = (recorder_h)handle;
+
+       preview_format = MM_PIXEL_FORMAT_YUYV;
+       ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_FORMAT, &preview_format, NULL);
+       handle->origin_preview_format = preview_format;
+       preview_format = MM_PIXEL_FORMAT_NV12;  
+       ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_RECOMMEND_PREVIEW_FORMAT_FOR_RECORDING, &preview_format, NULL);
+       
+       ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, 
+                                                                                                                               MMCAM_MODE , MM_CAMCORDER_MODE_VIDEO, 
+                                                                                                                               MMCAM_CAMERA_FORMAT, preview_format,
+                                                                                                                               (void*)NULL);
+       return _convert_recorder_error_code(__func__, ret);
+       
+}
+
+int recorder_create_audiorecorder( recorder_h* recorder){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);  
+       
+       int ret;
+       recorder_s * handle;
+       MMCamPreset info;
+       info.videodev_type= MM_VIDEO_DEVICE_NONE;
+       
+       handle = (recorder_s*)malloc( sizeof(recorder_s) );
+       if(handle==NULL){
+               LOGE( "[%s] OUT_OF_MEMORY(0x%08x)", __func__, RECORDER_ERROR_OUT_OF_MEMORY);
+               return RECORDER_ERROR_OUT_OF_MEMORY;
+       }
+       
+       memset(handle, 0 , sizeof(recorder_s));
+       
+       ret = mm_camcorder_create(&handle->mm_handle, &info);
+       if( ret != MM_ERROR_NONE){
+               free(handle);
+               LOGE("[%s] mm_camcorder_create fail", __func__);
+               return _convert_recorder_error_code(__func__, ret);
+       }
+       ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, 
+                                                                                                                               MMCAM_MODE , MM_CAMCORDER_MODE_AUDIO, 
+                                                                                                                               (void*)NULL);
+
+       if( ret != MM_ERROR_NONE){
+               mm_camcorder_destroy(handle->mm_handle);
+               free(handle);
+               LOGE("[%s] AUDIO mode setting fail", __func__);
+               return _convert_recorder_error_code(__func__, ret);
+       }
+
+
+       handle->state = RECORDER_STATE_CREATED;
+       mm_camcorder_set_message_callback(handle->mm_handle, mm_recorder_msg_cb, (void*)handle);
+       handle->camera = NULL;
+       handle->type = _RECORDER_TYPE_AUDIO;
+
+       *recorder = (recorder_h)handle;
+
+       return RECORDER_ERROR_NONE;
+
+}
+
+
+int recorder_get_state(recorder_h recorder, recorder_state_e * state){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);  
+       if( state == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);     
+
+       recorder_s *handle = (recorder_s*)recorder;
+
+       MMCamcorderStateType mmstate ;
+       recorder_state_e capi_state;
+       mm_camcorder_get_state(handle->mm_handle, &mmstate);    
+       capi_state = _recorder_state_convert(mmstate);
+
+       *state = capi_state;
+       return CAMERA_ERROR_NONE;
+       
+}
+
+int recorder_destroy( recorder_h recorder){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);  
+       recorder_s * handle;
+       int ret;
+
+       handle = (recorder_s *) recorder;
+       if( handle->type == _RECORDER_TYPE_VIDEO ){
+               //camera object mode change
+               ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, 
+                                                                                                                               MMCAM_MODE , MM_CAMCORDER_MODE_IMAGE, 
+                                                                                                                               MMCAM_CAMERA_FORMAT,  handle->origin_preview_format,
+                                                                                                                               MMCAM_IMAGE_ENCODER , MM_IMAGE_CODEC_JPEG, 
+                                                                                                                               MMCAM_CAPTURE_FORMAT, MM_PIXEL_FORMAT_ENCODED,
+                                                                                                                               MMCAM_CAPTURE_COUNT, 1, 
+                                                                                                                               (void*)NULL);
+               
+               mm_camcorder_set_message_callback(handle->mm_handle, mm_message_callback, (void*)handle->camera);
+       }else{
+               ret = mm_camcorder_destroy(handle->mm_handle);
+       }
+
+       if(ret == MM_ERROR_NONE)
+               free(handle);
+
+       return _convert_recorder_error_code(__func__, ret);
+
+}
+
+int recorder_prepare( recorder_h recorder){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       int ret = 0;
+       recorder_s *handle = (recorder_s*)recorder;
+
+       MMCamcorderStateType mmstate ;
+       mm_camcorder_get_state(handle->mm_handle, &mmstate);    
+
+       if( mmstate !=  MM_CAMCORDER_STATE_READY){
+               
+               ret = mm_camcorder_realize(handle->mm_handle);  
+               if( ret != MM_ERROR_NONE){
+                       LOGE("[%s] mm_camcorder_realize fail", __func__);
+                       return _convert_recorder_error_code(__func__, ret);
+               }
+               
+       }
+       
+       ret = mm_camcorder_start(handle->mm_handle);
+       
+       if( ret != MM_ERROR_NONE){
+               LOGE("[%s] mm_camcorder_start fail", __func__); 
+               mm_camcorder_unrealize(handle->mm_handle);
+               return _convert_recorder_error_code(__func__, ret);
+       }       
+
+       return RECORDER_ERROR_NONE;
+}
+
+int recorder_unprepare( recorder_h recorder){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);  
+       int ret = 0;
+       recorder_s *handle = (recorder_s*)recorder;
+
+       MMCamcorderStateType mmstate ;
+       mm_camcorder_get_state(handle->mm_handle, &mmstate);    
+       
+       if( mmstate ==  MM_CAMCORDER_STATE_PREPARE){
+               ret = mm_camcorder_stop(handle->mm_handle);     
+               if( ret != MM_ERROR_NONE){
+                       LOGE("[%s] mm_camcorder_stop fail", __func__);  
+                       return _convert_recorder_error_code(__func__, ret);
+               }
+       }
+       ret = mm_camcorder_unrealize(handle->mm_handle);
+       return _convert_recorder_error_code(__func__, ret);
+}
+
+int recorder_start( recorder_h recorder){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       int ret;
+       recorder_s *handle = (recorder_s*)recorder;
+       ret = mm_camcorder_record(handle->mm_handle);
+       return _convert_recorder_error_code(__func__, ret);
+}
+
+int recorder_pause( recorder_h recorder){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       int ret;
+       recorder_s *handle = (recorder_s*)recorder;
+       ret = mm_camcorder_pause(handle->mm_handle);
+
+       return _convert_recorder_error_code(__func__, ret);
+}
+
+int recorder_commit( recorder_h recorder){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       int ret;
+       recorder_s *handle = (recorder_s*)recorder;
+       ret = mm_camcorder_commit(handle->mm_handle);
+       return _convert_recorder_error_code(__func__, ret);     
+}
+
+int recorder_cancel( recorder_h recorder){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       int ret;
+       recorder_s *handle = (recorder_s*)recorder;
+       ret = mm_camcorder_cancel(handle->mm_handle);
+       return _convert_recorder_error_code(__func__, ret);     
+}
+
+int recorder_set_filename(recorder_h recorder,  const char *filename){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       g_return_val_if_fail(filename != NULL, RECORDER_ERROR_INVALID_PARAMETER);                       
+       int ret;
+       recorder_s * handle = (recorder_s*)recorder;
+       ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL,  MMCAM_TARGET_FILENAME  , filename , strlen(filename), NULL);
+       return _convert_recorder_error_code(__func__, ret);
+
+}
+
+int recorder_get_filename(recorder_h recorder,  char **filename){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       g_return_val_if_fail(filename != NULL, RECORDER_ERROR_INVALID_PARAMETER);                       
+       int ret;
+       recorder_s * handle = (recorder_s*)recorder;
+
+       char *record_filename;
+       int record_filename_size;
+       ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_TARGET_FILENAME , &record_filename, &record_filename_size, NULL);
+       if( ret == CAMERA_ERROR_NONE ){
+               *filename = strdup(record_filename);
+       }
+
+       return _convert_recorder_error_code(__func__, ret);
+       
+}
+
+
+int recorder_set_file_format(recorder_h recorder, recorder_file_format_e format){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       int ret;
+       int format_table[3] = { MM_FILE_FORMAT_3GP ,  // RECORDER_FILE_FORMAT_3GP,
+                                                                                         MM_FILE_FORMAT_MP4 , //RECORDER_FILE_FORMAT_MP4,
+                                                                                         MM_FILE_FORMAT_AMR //RECORDER_FILE_FORMAT_AMR,
+                                                                                       };
+       
+       if( format < RECORDER_FILE_FORMAT_3GP || format > RECORDER_FILE_FORMAT_AMR )
+               return RECORDER_ERROR_INVALID_PARAMETER;
+       
+       recorder_s * handle = (recorder_s*)recorder;
+       ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_FILE_FORMAT  , format_table[format], NULL);
+       return _convert_recorder_error_code(__func__, ret);
+}
+
+int recorder_get_file_format(recorder_h recorder, recorder_file_format_e *format){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       g_return_val_if_fail(format != NULL, RECORDER_ERROR_INVALID_PARAMETER);         
+       
+       int ret;
+       recorder_s * handle = (recorder_s*)recorder;
+       int mm_format;
+       ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_FILE_FORMAT  , &mm_format, NULL);
+
+       if( ret == 0 ){
+               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;                          
+                       default :
+                               ret = MM_ERROR_CAMCORDER_INTERNAL;
+                               break;
+               }
+       }       
+       return _convert_recorder_error_code(__func__, ret);
+}
+
+
+
+int recorder_set_state_changed_cb(recorder_h recorder, recorder_state_changed_cb callback, void* user_data){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);  
+       recorder_s *handle = (recorder_s*)recorder;
+       if( callback == NULL )
+               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 recorder_unset_state_changed_cb(recorder_h recorder){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       recorder_s *handle = (recorder_s*)recorder;
+
+       handle->user_cb[_RECORDER_EVENT_TYPE_STATE_CHANGE] = NULL;
+       handle->user_data[_RECORDER_EVENT_TYPE_STATE_CHANGE] = NULL;
+
+       return RECORDER_ERROR_NONE;     
+}
+
+int recorder_set_recording_status_cb(recorder_h recorder, recorder_recording_status_cb callback, void* user_data){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       recorder_s *handle = (recorder_s*)recorder;
+       if( callback == NULL )
+               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 recorder_unset_recording_status_cb(recorder_h recorder){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       recorder_s *handle = (recorder_s*)recorder;     
+       handle->user_cb[_RECORDER_EVENT_TYPE_RECORDING_STATUS] = NULL;
+       handle->user_data[_RECORDER_EVENT_TYPE_RECORDING_STATUS] = NULL;
+       
+       return RECORDER_ERROR_NONE;
+       
+}
+
+int recorder_set_recording_limit_reached_cb(recorder_h recorder, recorder_recording_limit_reached_cb callback, void* user_data){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       recorder_s *handle = (recorder_s*)recorder;
+       if( callback == NULL )
+               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 recorder_unset_recording_limit_reached_cb(recorder_h recorder){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       recorder_s *handle = (recorder_s*)recorder;
+       handle->user_cb[_RECORDER_EVENT_TYPE_RECORDING_LIMITED] = NULL;
+       handle->user_data[_RECORDER_EVENT_TYPE_RECORDING_LIMITED] = NULL;
+
+       return RECORDER_ERROR_NONE;     
+}
+
+int recorder_foreach_supported_file_format(recorder_h recorder, recorder_supported_file_format_cb foreach_cb , void *user_data){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       if( foreach_cb == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);                        
+       int ret;
+       recorder_s * handle = (recorder_s*)recorder;
+       MMCamAttrsInfo info;
+       ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_FILE_FORMAT , &info);
+       if( ret != RECORDER_ERROR_NONE )
+               return ret;
+       
+       int i;
+       for( i=0 ; i < info.int_array.count ; i++)
+       {
+
+               int format;
+               
+               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;                          
+                       default :
+                               format = -1;
+               }       
+       
+               if ( format != -1 && !foreach_cb(format,user_data) )
+                       break;
+       }
+       return RECORDER_ERROR_NONE;
+       
+}
+
+
+
+int recorder_attr_set_size_limit(recorder_h recorder,  int kbyte){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       int ret;
+       recorder_s * handle = (recorder_s*)recorder;
+       ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_TARGET_MAX_SIZE  , kbyte, NULL);
+       return _convert_recorder_error_code(__func__, ret);
+       
+}
+
+int recorder_attr_set_time_limit(recorder_h recorder,  int second){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       int ret;
+       recorder_s * handle = (recorder_s*)recorder;
+       ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_TARGET_TIME_LIMIT , second, NULL);
+       return _convert_recorder_error_code(__func__, ret);     
+}
+
+int recorder_attr_set_audio_device(recorder_h recorder , recorder_audio_device_e device){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       int ret;
+       recorder_s * handle = (recorder_s*)recorder;
+       ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_AUDIO_DEVICE , device, NULL);
+       return _convert_recorder_error_code(__func__, ret);     
+}
+
+int recorder_set_audio_encoder(recorder_h recorder, recorder_audio_codec_e  codec){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+
+       if( codec < RECORDER_AUDIO_CODEC_AMR || codec > RECORDER_AUDIO_CODEC_AAC)
+               return RECORDER_ERROR_INVALID_PARAMETER;
+               
+
+       int audio_table[2] = { MM_AUDIO_CODEC_AMR , //RECORDER_AUDIO_CODEC_AMR
+                                                                                       MM_AUDIO_CODEC_AAC  //RECORDER_AUDIO_CODEC_AAC
+                                                                               };
+
+       
+       int ret;
+       recorder_s * handle = (recorder_s*)recorder;
+       if( handle->state != RECORDER_STATE_CREATED )
+               return RECORDER_ERROR_INVALID_STATE;
+       
+       ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_AUDIO_ENCODER , audio_table[codec], NULL);
+
+       return _convert_recorder_error_code(__func__, ret);
+       
+}
+
+int recorder_get_audio_encoder(recorder_h recorder, recorder_audio_codec_e *codec){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       g_return_val_if_fail(codec != NULL, RECORDER_ERROR_INVALID_PARAMETER);          
+       int ret;
+       int mm_codec = 0;
+       
+       recorder_s * handle = (recorder_s*)recorder;
+       ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_AUDIO_ENCODER , &mm_codec , NULL);
+       if( ret == 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;
+                       default :
+                               ret = MM_ERROR_CAMCORDER_INTERNAL;
+                               break;
+               }
+       }
+               
+       return _convert_recorder_error_code(__func__, ret);     
+}
+
+int recorder_set_video_encoder(recorder_h recorder, recorder_video_codec_e  codec){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       int ret;
+
+       int video_table[3] = { MM_VIDEO_CODEC_H263,             //RECORDER_VIDEO_CODEC_H263,                    /**< H263 codec         */
+                                                                                       MM_VIDEO_CODEC_H264,    //RECORDER_VIDEO_CODEC_H264,                    /**< H264 codec         */
+                                                                                       MM_VIDEO_CODEC_MPEG4    //RECORDER_VIDEO_CODEC_MPEG4,                   /**< MPEG4 codec        */
+                                                                               };
+       if( codec < RECORDER_VIDEO_CODEC_H263 || codec > RECORDER_VIDEO_CODEC_MPEG4 )
+               return RECORDER_ERROR_INVALID_PARAMETER;
+       
+       recorder_s * handle = (recorder_s*)recorder;
+       if( handle->state != RECORDER_STATE_CREATED )
+               return RECORDER_ERROR_INVALID_STATE;
+
+       ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_VIDEO_ENCODER   , video_table[codec], NULL);
+       return _convert_recorder_error_code(__func__, ret);
+}
+
+
+
+int recorder_get_video_encoder(recorder_h recorder, recorder_video_codec_e *codec){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);  
+       if( codec == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);     
+
+       int ret;
+       int mm_codec = 0;
+
+       recorder_s * handle = (recorder_s*)recorder;
+       ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_VIDEO_ENCODER , &mm_codec, NULL);
+       if( ret == 0 ){
+               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;                          
+                       default :
+                               ret = MM_ERROR_CAMCORDER_INTERNAL;
+                               break;
+               }
+       }
+       
+       return _convert_recorder_error_code(__func__, ret);
+       
+}
+
+int recorder_attr_set_audio_samplerate(recorder_h recorder, int samplerate){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       int ret;
+       recorder_s * handle = (recorder_s*)recorder;
+       ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_AUDIO_SAMPLERATE  , samplerate, NULL);
+       return _convert_recorder_error_code(__func__, ret);
+       
+}
+
+int recorder_attr_set_audio_encoder_bitrate(recorder_h recorder,  int bitrate){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       int ret;
+       recorder_s * handle = (recorder_s*)recorder;
+       ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_AUDIO_ENCODER_BITRATE  , bitrate, NULL);
+       return _convert_recorder_error_code(__func__, ret);
+       
+}
+
+int recorder_attr_set_video_encoder_bitrate(recorder_h recorder,  int bitrate){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       int ret;
+       recorder_s * handle = (recorder_s*)recorder;
+       ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_VIDEO_ENCODER_BITRATE  , bitrate, NULL);
+       return _convert_recorder_error_code(__func__, ret);
+       
+}
+
+int recorder_attr_get_size_limit(recorder_h recorder,  int *kbyte){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       int ret;
+       recorder_s * handle = (recorder_s*)recorder;
+       ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_TARGET_MAX_SIZE  , kbyte, NULL);
+       return _convert_recorder_error_code(__func__, ret);     
+}
+
+int recorder_attr_get_time_limit(recorder_h recorder,  int *second){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       int ret;
+       recorder_s * handle = (recorder_s*)recorder;
+       ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_TARGET_TIME_LIMIT , second, NULL);
+       return _convert_recorder_error_code(__func__, ret);
+       
+}
+
+int recorder_attr_get_audio_device(recorder_h recorder , recorder_audio_device_e *device){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       int ret;
+       recorder_s * handle = (recorder_s*)recorder;
+       ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_AUDIO_DEVICE , device, NULL);
+       return _convert_recorder_error_code(__func__, ret);     
+}
+
+
+
+int recorder_attr_get_audio_samplerate(recorder_h recorder, int *samplerate){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       int ret;
+       recorder_s * handle = (recorder_s*)recorder;
+       ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_AUDIO_SAMPLERATE , samplerate, NULL);
+       return _convert_recorder_error_code(__func__, ret);
+       
+}
+
+int recorder_attr_get_audio_encoder_bitrate(recorder_h recorder,  int *bitrate){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       int ret;
+       recorder_s * handle = (recorder_s*)recorder;
+       ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_AUDIO_ENCODER_BITRATE , bitrate, NULL);
+       return _convert_recorder_error_code(__func__, ret);
+}
+
+int recorder_attr_get_video_encoder_bitrate(recorder_h recorder,  int *bitrate){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       int ret;
+       recorder_s * handle = (recorder_s*)recorder;
+       ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_VIDEO_ENCODER_BITRATE , bitrate, NULL);
+       return _convert_recorder_error_code(__func__, ret);
+       
+}
+
+int recorder_foreach_supported_audio_encoder(recorder_h recorder, recorder_supported_audio_encoder_cb foreach_cb , void *user_data){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);          
+       if( foreach_cb == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);                
+       int ret;
+       recorder_s * handle = (recorder_s*)recorder;
+       MMCamAttrsInfo info;
+       ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_AUDIO_ENCODER , &info);
+       if( ret != RECORDER_ERROR_NONE )
+               return _convert_recorder_error_code(__func__, ret);
+       
+       int i;
+       for( i=0 ; i < info.int_array.count ; i++)
+       {
+               int codec;
+               
+               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;
+                       default :
+                               codec = -1;
+               }       
+               if( codec != -1 && !foreach_cb(codec,user_data) )
+                       break;
+       }
+       return RECORDER_ERROR_NONE;     
+}
+int recorder_foreach_supported_video_encoder(recorder_h recorder, recorder_supported_video_encoder_cb foreach_cb , void *user_data){
+       
+       if( recorder == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);
+       if( foreach_cb == NULL) return _convert_recorder_error_code(__func__, RECORDER_ERROR_INVALID_PARAMETER);
+       int ret;
+       recorder_s * handle = (recorder_s*)recorder;
+       MMCamAttrsInfo info;
+       ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_VIDEO_ENCODER , &info);
+       if( ret != RECORDER_ERROR_NONE )
+               return _convert_recorder_error_code(__func__, ret);
+       
+       int i;
+       for( i=0 ; i < info.int_array.count ; i++)
+       {
+               int codec;
+               
+               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;          
+                       default :
+                               codec = -1;
+               }       
+       
+               if ( codec != -1 &&  !foreach_cb(codec,user_data) )
+                       break;
+       }
+       return RECORDER_ERROR_NONE;
+       
+}
+
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..81ff17f
--- /dev/null
@@ -0,0 +1,21 @@
+SET(fw_test "${fw_name}-test")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_test} REQUIRED mm-camcorder appcore-efl 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()
diff --git a/test/multimedia_recorder_test.c b/test/multimedia_recorder_test.c
new file mode 100755 (executable)
index 0000000..9b96e2b
--- /dev/null
@@ -0,0 +1,997 @@
+/*
+* 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(int elapsed_time, int 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);
+       recorder_prepare(recorder);
+       ret = recorder_start(recorder);
+       result.elapsed_time = 0;
+       result.file_size = 0;
+       sleep(3);
+       ret = recorder_cancel(recorder);
+       ret =recorder_unprepare(recorder);
+       ret =recorder_destroy(recorder);        
+       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(int elapsed_time, int 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_DISPLAY_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_DISPLAY_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;
+}
+
+
+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();
+       */
+
+       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);
+       elm_win_transparent_set(mEvasWindow, 1);
+       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;
+}