tizen 2.3.1 release submit/tizen_2.3.1/20150915.075755 tizen_2.3.1_release
authorjk7744.park <jk7744.park@samsung.com>
Tue, 8 Sep 2015 13:09:45 +0000 (22:09 +0900)
committerjk7744.park <jk7744.park@samsung.com>
Tue, 8 Sep 2015 13:09:45 +0000 (22:09 +0900)
36 files changed:
AUTHORS
CMakeLists.txt
LICENSE.APLv2.0 [moved from LICENSE with 97% similarity]
NOTICE [new file with mode: 0644]
capi-content-media-content.manifest [new file with mode: 0644]
doc/media_content_doc.h [new file with mode: 0755]
include/media_audio.h
include/media_bookmark.h
include/media_content.h
include/media_content_type.h
include/media_filter.h
include/media_folder.h
include/media_group.h
include/media_image.h
include/media_info.h
include/media_info_private.h
include/media_playlist.h
include/media_tag.h
include/media_util_private.h
include/media_video.h
packaging/capi-content-media-content.spec
src/media_audio.c
src/media_bookmark.c
src/media_content.c
src/media_db.c
src/media_filter.c
src/media_folder.c
src/media_group.c
src/media_image.c
src/media_info.c
src/media_playlist.c
src/media_tag.c
src/media_util_private.c
src/media_video.c
test/CMakeLists.txt
test/media-content_test.c

diff --git a/AUTHORS b/AUTHORS
index 8e0eec9..677fb81 100755 (executable)
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,2 +1,2 @@
-Dongyoung Kim <dydot1.kim@samsung.com>
-Jongchul Park <jc0204.park@samsung.com>
+Haejeong Kim <backto.kim at samsung dot com>
+Hyunjun Ko <zzoon.ko at samsung dot com>
index 6632a6a..ae15081 100755 (executable)
@@ -9,7 +9,7 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 SET(INC_DIR include)
 INCLUDE_DIRECTORIES(${INC_DIR})
 
-SET(dependents "dlog libmedia-service media-thumbnail libmedia-utils capi-base-common")
+SET(dependents "dlog libmedia-service media-thumbnail libmedia-utils capi-base-common icu-i18n vconf")
 SET(pc_dependents "dlog capi-base-common")
 
 INCLUDE(FindPkgConfig)
@@ -27,6 +27,7 @@ ENDIF("${ARCH}" STREQUAL "arm")
 
 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
 ADD_DEFINITIONS("-DTIZEN_DEBUG")
+ADD_DEFINITIONS("-D_FILE_OFFSET_BITS=64")
 
 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
 
similarity index 97%
rename from LICENSE
rename to LICENSE.APLv2.0
index bbe9d02..261eeb9 100755 (executable)
--- a/LICENSE
-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
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..ffbca8e
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,4 @@
+Copyright (c) Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE file for Apache License terms and conditions.
+
diff --git a/capi-content-media-content.manifest b/capi-content-media-content.manifest
new file mode 100644 (file)
index 0000000..ca37499
--- /dev/null
@@ -0,0 +1,6 @@
+<manifest>
+       <request>
+               <domain name="_" />
+       </request>
+</manifest>
+
diff --git a/doc/media_content_doc.h b/doc/media_content_doc.h
new file mode 100755 (executable)
index 0000000..d62a266
--- /dev/null
@@ -0,0 +1,580 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+
+
+#ifndef __TIZEN_MEDIA_CONTENT_DOC_H__
+#define __TIZEN_MEDIA_CONTENT_DOC_H__
+
+/**
+ * @defgroup CAPI_MEDIA_CONTENT_MODULE Media Content
+ * @brief The Media Content API provides functions, enumerations used in the entire Content Service.
+ *
+ * @ingroup CAPI_CONTENT_FRAMEWORK
+ *
+ * @section CAPI_MEDIA_CONTENT_MODULE_HEADER Required Header
+ *   \#include <media_content.h>
+ *
+ * @section CAPI_MEDIA_CONTENT_MODULE_OVERVIEW Overview
+ * The Media Content API provides functions and enumerations used in the entire Content Service.\n
+ * The information about media items i.e. image, audio and video, are managed in the content database and
+ * operations that involve database requires an active connection with the media content service.\n
+ * The API provides functions for connecting (#media_content_connect()) and disconnecting (#media_content_disconnect()) from the media content service.
+ *
+ * The API consists of @ref CAPI_CONTENT_MEDIA_FOLDER_MODULE,@ref CAPI_CONTENT_MEDIA_TAG_MODULE,@ref CAPI_CONTENT_MEDIA_FILTER_MODULE, @ref CAPI_CONTENT_MEDIA_INFO_MODULE API and others.
+ * 
+ * <table>
+ * <tr>
+ *    <th>API</th>
+ *    <th>Description</th>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_CONTENT_MEDIA_FOLDER_MODULE </td>
+ *    <td> Provide information about folders (e.g. path, name, modification date) stored on the device.\n
+ * Provide information about the media items present in the folders.</td>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_CONTENT_MEDIA_TAG_MODULE </td>
+ *    <td> Provide information about media tags.\n
+ * Provide functions to insert or delete tag from database.\n
+ * Provide functions to add and remove media item from tags in the database. </td>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_CONTENT_MEDIA_FILTER_MODULE </td>
+ *    <td> Provide functions for creating and destroying media filters.\n
+ * Provide functions to get filter properties</td>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_CONTENT_MEDIA_INFO_MODULE </td>
+ *    <td> Provide generic information about media content items (i.e. image, audio, video and others).\n
+ *  Provide details about audio files (e.g. name, author, genre etc) present in the device.\n
+ *  Provide details about image files (e.g. width, height, orientation etc) present in the device.\n
+ *  Provide details about video files (e.g. width, height, duration etc) present in the device .</td>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_CONTENT_MEDIA_PLAYLIST_MODULE </td>
+ *    <td> Provide information about the media playlist. </td>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_CONTENT_MEDIA_ALBUM_MODULE </td>
+ *    <td> Provide information about the media album. </td>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_CONTENT_MEDIA_GROUP_MODULE </td>
+ *    <td> Provide information about the media group(e.g. media artist, composer, genre, year). </td>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_CONTENT_MEDIA_BOOKMARK_MODULE </td>
+ *    <td> Provide information about the media bookmark. </td>
+ * </tr> 
+ * 
+ * </table>
+ *
+ */
+
+/**
+ * @defgroup CAPI_CONTENT_MEDIA_FOLDER_MODULE Media Folder
+ * @brief The Media folder API provides functions to get information about folders.
+ *
+ * @ingroup CAPI_MEDIA_CONTENT_MODULE
+ *
+ * @section CAPI_CONTENT_MEDIA_FOLDER_MODULE_HEADER Required Header
+ *   \#include <media_content.h>
+ *
+ * @section CAPI_CONTENT_MEDIA_FOLDER_MODULE_OVERVIEW Overview
+ * A Folder is used to organize media content files i.e. image, audio, video files, in the physical storage of the device.  
+ * The Media Folder API provides functions to get basic information about existing folders e.g. folder name, path and storage type.
+ * It also provides functions to get information related to media items present in the folder.
+ *
+ * For getting information about folder call the respective get functions e.g. to get path and name of a given folder call #media_folder_get_path() and #media_folder_get_name() function respectively and so on.\n
+ * Similarly call media_folder_get_media_count_from_db() to get count of media items present in a given folder.
+ * @subsection CAPI_CONTENT_MEDIA_FOLDER_FOREACH_OPERATIONS Foreach Operations
+ * <div><table class="doxtable">
+ *     <tr>
+ *        <th><b>FOREACH</b></th>
+ *        <th><b>CALLBACK</b></th>
+ *        <th><b>DESCRIPTION</b></th>
+ *     </tr>
+ *     <tr>
+ *        <td>media_folder_foreach_folder_from_db()</td>
+ *        <td>media_folder_cb()</td>
+ *        <td>Iterates over a folder information list</td>
+ *     </tr>
+ *     <tr>
+ *        <td>media_folder_foreach_media_from_db()</td>
+ *        <td>media_info_cb()</td>
+ *        <td>Iterates media information trough the folder</td>
+ *     </tr>
+ * </table></div>
+ *
+ *
+ */
+
+
+/**
+ * @defgroup CAPI_CONTENT_MEDIA_TAG_MODULE Media Tag
+ * @brief  The Media Tag API provides functions to manage media content tags.
+ *
+ * @ingroup CAPI_MEDIA_CONTENT_MODULE
+ *
+ * @section CAPI_CONTENT_MEDIA_TAG_MODULE_HEADER Required Header
+ *   \#include <media_content.h>
+ *
+ * @section CAPI_CONTENT_MEDIA_TAG_MODULE_OVERVIEW Overview
+ * A Tag is a special piece of information that may be associated with media content items.
+ * Tagging allows a user to organize large number of items into logical groups providing a simplified 
+ * and faster way of accessing media content items.\n\n
+ * Media Tag API provides functions to get basic information about existing tags and manage tags 
+ * associated with Media Information (#media_info_h). 
+ * For inserting a new tag to the database call #media_tag_insert_to_db() function and for deleting existing tag from database
+ * call media_tag_delete_from_db() function.\n
+ * A Media item can be associated and dissociated from tags by calling #media_tag_add_media() and #media_tag_remove_media() function respectively.
+ * Finally, #media_tag_update_to_db function should be called so as to update the given item in the media database.
+ *
+ * @subsection CAPI_CONTENT_MEDIA_TAG_FOREACH_OPERATIONS Foreach Operations
+ * <div><table class="doxtable">
+ *     <tr>
+ *        <th><b>FOREACH</b></th>
+ *        <th><b>CALLBACK</b></th>
+ *        <th><b>DESCRIPTION</b></th>
+ *     </tr>
+ *     <tr>
+ *        <td>media_tag_foreach_tag_from_db()</td>
+ *        <td> media_tag_cb()</td>
+ *        <td>Iterates through tags</td>
+ *     </tr>
+ *     <tr>
+ *        <td>media_tag_foreach_media_from_db()</td>
+ *        <td>media_info_cb()</td>
+ *        <td> Iterates through the media items for a given tag
+ </td>
+ *     </tr>
+ * </table></div>
+ *
+ *
+ *
+ */
+
+
+/**
+ * @defgroup CAPI_CONTENT_MEDIA_FILTER_MODULE Media Filter
+ * @brief The Media Filter API provides functions to manage media filters.
+ *
+ * @ingroup CAPI_MEDIA_CONTENT_MODULE
+ *
+ * @section CAPI_CONTENT_MEDIA_FILTER_MODULE_HEADER Required Header
+ *   \#include <media_content.h>
+ *
+ * @section CAPI_CONTENT_MEDIA_FILTER_MODULE_OVERVIEW Overview
+ * A Media filter is required for filtering information associated with media Folder, Tag, Audio, Bookmark and Media Information on basis of details like offset, count, order and condition for searching.\n
+ * @ref CAPI_CONTENT_MEDIA_FILTER_MODULE API provides functions for creating and destroying media filters. \n
+ * It provide functions to set properties and also provide functions for getting filter properties associated with a given media filter.
+ *
+ *\n
+ * Setting media filter properties helps to limit the number of filtered items as following:
+ * - Offset - Used to set starting position of the filter's search
+ * - Count - Used to set number of items to be searched from offset
+ * - Condition - Used to set keyword which user want to search
+ * - Order - Used to set type of media to be ordered by the filter 
+ *
+ *\n
+ * The Media Filter API provides functions for creating and destroying media filters.\n
+ * It provide functions to set and get properties of the filter associated with a given media filter. \n
+ * For creating a media filter (@ref filter_h), call #media_filter_create() function and call #media_filter_destroy() function for destroying an existing filter. \n
+ * For setting filter properties call the respective set functions e.g. to set offset position, call #media_filter_set_offset() function and 
+ * call #media_filter_set_condition() function to set the condition like an sql "where" clause. \n
+ * Searchable expression can use one of the following forms:
+ *
+ *
+ * - column = value
+ * - column > value
+ * - column >= value
+ * - column < value
+ * - column <= value
+ * - value = column
+ * -  * - value > column
+ * - value >= column
+ * - value < column
+ * - value <= column
+ * - column IN (value)
+ * - column IN (value-list)
+ * - column NOT IN (value)
+ * - column NOT IN (value-list)
+ * - column LIKE value
+ * - expression1 AND expression2 OR expression3 
+ * 
+ *\n
+ * 
+ * Note that if you want to set qoutation(" ' " or " " ") as value of LIKE operator, you should use two times.(" '' " or " "" ") \n
+ * And the optional ESCAPE clause is supported. Both percent symbol("%") and underscore symbol("_") are used in the LIKE pattern.\n
+ * If these characters are used as value of LIKE operation, then the expression following the ESCAPE caluse of sqlite. \n
+ *
+ * For example, 
+ * - column LIKE ('#%') ESCAPE('#') - "#" is escape character, it will be ignored. 
+ *\n
+ *
+ *  
+ * Similarly, call respective get function to get filter properties e.g. call #media_filter_get_condition() function 
+ * to get condition of the media filter and call #media_filter_get_order() function to get order (#media_content_order_e) of the filtered items and so on.
+ *
+**/
+
+
+/**
+ * @defgroup CAPI_CONTENT_MEDIA_AUDIO_META_MODULE Audio Metadata
+ * @brief The Audio Metadata API provides functions to get information about audio items.
+ *
+ * @ingroup CAPI_CONTENT_MEDIA_INFO_MODULE
+ *
+ * @section CAPI_CONTENT_MEDIA_AUDIO_META_MODULE_HEADER Required Header
+ *   \#include <media_content.h>
+ *
+ * @section CAPI_CONTENT_MEDIA_AUDIO_META_MODULE_OVERVIEW Overview
+ * The Audio Metadata API provides functions to get information about stored audio files.
+ * Its purpose is threefold:
+ * - to provide information about audio content
+ * - to organize audio content logically (grouping)
+ *
+ * API provides functions that allow to check attributes of audio files. Following information about audio content is provided:
+ * - album
+ * - artist
+ * - genre
+ * - composer
+ * - year 
+ * - recorded_date
+ * - copyright
+ * - track number
+ * - sample rate
+ * - played count
+ * - played time
+ * - played position 
+ * - bitrate
+ *
+ * <p>
+ * For getting the audio handle (#audio_meta_h) from the media information (#media_info_h), call #media_info_get_audio() function.\n
+ * For getting the information related to audio files stored in the device, call the respective get functions e.g. to get the artist of a audio, call #audio_meta_get_artist() function and 
+ * to get bitrate of a audio, call #audio_meta_get_bit_rate() function and so on.\n
+ * When the audio handle is no longer needed, it should be destroyed by calling #audio_meta_destroy() function.\n 
+ *
+ *
+ *
+ */
+
+
+/**
+ * @defgroup CAPI_CONTENT_MEDIA_PLAYLIST_MODULE Media Playlist
+ * @brief The Media Playlist API provides functions to manage media playlists.
+ *
+ * @ingroup CAPI_MEDIA_CONTENT_MODULE
+ *
+ * @section CAPI_CONTENT_MEDIA_PLAYLIST_MODULE_HEADER Required Header
+ *   \#include <media_content.h>
+ *
+ * @section CAPI_CONTENT_MEDIA_PLAYLIST_MODULE_OVERVIEW Overview
+ * A Playlist is a list of songs which can be played in some sequence i.e. sequential or shuffled order.
+ * The Media Playlist API provides functions to insert, delete or updates a media playlist in the database.
+ * 
+ * For inserting new playlist (#media_playlist_h) in the database, call  #media_playlist_insert_to_db() function and call #media_playlist_delete_from_db() function
+ * to delete a playlist from the database.\n
+ * For adding a media item to the playlist, call #media_playlist_add_media() function, for removing a media item from the playlist, call 
+ * #media_playlist_remove_media() function.\n
+ * Finally, #media_playlist_update_to_db() function should be called so as to update the given item in the media database.
+ *
+ * @subsection CAPI_CONTENT_MEDIA_PLAYLIST_FOREACH_OPERATIONS Foreach Operations
+ * <div><table class="doxtable">
+ *     <tr>
+ *        <th><b>FOREACH</b></th>
+ *        <th><b>CALLBACK</b></th>
+ *        <th><b>DESCRIPTION</b></th>
+ *     </tr>
+ *     <tr>
+ *        <td>media_playlist_foreach_playlist_from_db()</td>
+ *        <td>media_playlist_cb()</td>
+ *        <td>Iterates through playlist</td>
+ *     </tr>
+ *     <tr>
+ *        <td>media_playlist_foreach_media_from_db()</td>
+ *        <td>media_info_cb()</td>
+ *        <td>Iterates through playlist's items</td>
+ *     </tr>
+ * </table></div>
+ *
+ *
+ */
+
+
+/**
+ * @defgroup CAPI_CONTENT_MEDIA_ALBUM_MODULE Media Album
+ * @brief The Media Album API provides information related to album of media items.
+ *
+ * @ingroup CAPI_MEDIA_CONTENT_MODULE
+ *
+ * @section CAPI_CONTENT_MEDIA_ALBUM_MODULE_HEADER Required Header
+ *   \#include <media_content.h>
+ *
+ * @section CAPI_CONTENT_MEDIA_ALBUM_MODULE_OVERVIEW Overview
+ * An album is a logical collection or grouping of related audio files. It is also used for filtering media items.\n
+ * The Media Album API allows to manage media albums which contains all video and audio items from
+ * the same album.
+ *
+ * The API provides functions to get and search media items in album group.
+ * For getting the count of media items associated with a given album, call #media_album_get_media_count_from_db() function.
+ *
+ * @subsection CAPI_CONTENT_MEDIA_ALBUM_FOREACH_OPERATIONS Foreach Operations
+ * <div><table class="doxtable">
+ *     <tr>
+ *        <th><b>FOREACH</b></th>
+ *        <th><b>CALLBACK</b></th>
+ *        <th><b>DESCRIPTION</b></th>
+ *     </tr>
+ *     <tr>
+ *        <td>media_album_foreach_album_from_db()</td>
+ *        <td>media_album_cb()</td>
+ *        <td>Iterates through albums</td>
+ *     </tr>
+ *     <tr>
+ *        <td>media_album_foreach_media_from_db()</td>
+ *        <td>media_info_cb()</td>
+ *        <td>Iterates through album's items</td>
+ *     </tr>
+ * </table></div>
+ *
+ *
+ */
+
+
+/**
+ * @defgroup CAPI_CONTENT_MEDIA_GROUP_MODULE Media Group
+ * @brief The Media Group API provides information related to artist of media group.
+ *
+ * @ingroup CAPI_MEDIA_CONTENT_MODULE
+ *
+ * @section CAPI_CONTENT_MEDIA_GROUP_MODULE_HEADER Required Header
+ *   \#include <media_content.h>
+ *
+ * @section CAPI_CONTENT_MEDIA_GROUP_MODULE_OVERVIEW Overview
+ * A Media Group represents logical grouping of media files with respect to their group name. It is also used for filtering media items.\n
+ *
+ * The API provides functions to get and search image, video and audio items in media group. 
+ * For getting the count of media items associated with a given group, call #media_group_get_media_count_from_db() function.
+ *
+ *
+ * @subsection CAPI_CONTENT_MEDIA_GROUP_FOREACH_OPERATIONS Foreach Operations
+ * <div><table class="doxtable">
+ *     <tr>
+ *        <th><b>FOREACH</b></th>
+ *        <th><b>CALLBACK</b></th>
+ *        <th><b>DESCRIPTION</b></th>
+ *     </tr>
+ *     <tr>
+ *        <td>media_group_foreach_group_from_db()</td>
+ *        <td> media_group_cb()</td>
+ *        <td>Iterates through group</td>
+ *     </tr>
+ *     <tr>
+ *        <td>media_group_foreach_media_from_db()</td>
+ *        <td>media_info_cb()</td>
+ *        <td>Iterates through group's items</td>
+ *     </tr>
+ * </table></div>
+ *
+ *
+ */
+
+
+/**
+ * @defgroup CAPI_CONTENT_MEDIA_IMAGE_MODULE Image Metadata
+ * @brief The Image Metadata API provides functions that allow to get information about
+ * stored image files.
+ *
+ * @ingroup CAPI_CONTENT_MEDIA_INFO_MODULE
+ *
+ * @section CAPI_CONTENT_MEDIA_IMAGE_MODULE_HEADER Required Header
+ *   \#include <media_content.h>
+ *
+ * @section CAPI_CONTENT_MEDIA_IMAGE_MODULE_OVERVIEW Overview
+ * The Image Metadata API provides functions to get basic information associated with image files:
+ * - width
+ * - height
+ * - date taken (when image was created)
+ * - image orientation\n
+ *
+ *<p>
+ * For getting the image handle (#image_meta_h) from the media information (#media_info_h), call #media_info_get_image() function.\n
+ * For getting the information related to image files stored in the device call the respective get functions e.g. to get the width of a image, call #image_meta_get_width() function and 
+ * to get orientation (#media_content_orientation_e) of a image, call #image_meta_get_orientation() function and so on.\n
+ * When the image handle is no longer needed, it should be destroyed by calling #image_meta_destroy() function.\n 
+ *
+ */
+
+
+
+
+/**
+ * @defgroup CAPI_CONTENT_MEDIA_VIDEO_META_MODULE Video Metadata
+ * @brief The Video Metadata API provides functions to get information about video files present in the device.
+ *
+ * @ingroup CAPI_CONTENT_MEDIA_INFO_MODULE
+ *
+ * @section CAPI_CONTENT_MEDIA_VIDEO_META_MODULE_HEADER Required Header
+ *   \#include <media_content.h>
+ *
+ * @section CAPI_CONTENT_MEDIA_VIDEO_META_MODULE_OVERVIEW Overview
+ * The Video Metadata API provides functions to get information about video files present in the device.
+ * Following information about video content (#video_meta_h )is provided:
+ * - artist
+ * - album
+ * - genre
+ * - composer
+ * - year
+ * - recorded date
+ * - copyright
+ * - track number
+ * - bit rate
+ * - width
+ * - height 
+ * - played count
+ * - played time
+ * - played position
+ * \n
+ * and others.\n
+ *<p>
+ * For getting the video handle (#video_meta_h) from the media information (#media_info_h), call the media_info_get_video() function.\n
+ * For getting the information related to video files stored in the device call the respective get functions e.g. to get duration of the video file
+ * call #video_meta_get_duration() function  and so on.\n
+ * When the video handle is no longer needed, it should be destroyed by calling #video_meta_destroy() function. 
+ *
+ *
+ *
+ */
+
+
+/**
+ * @defgroup CAPI_CONTENT_MEDIA_BOOKMARK_MODULE Media Bookmark
+ * @brief The Media Bookmark Information API provides functions to manage bookmark information on the media items.
+ *
+ * @ingroup CAPI_MEDIA_CONTENT_MODULE
+ *
+ * @section CAPI_CONTENT_MEDIA_BOOKMARKINFO_MODULE_HEADER Required Header
+ *   \#include <media_content.h>
+ *
+ * @section CAPI_CONTENT_MEDIA_BOOKMARKINFO_MODULE_OVERVIEW Overview
+ * A Bookmark allows you to mark interesting moment in a media(video and audio) to enable fast searching.
+ * The Bookmark Information API  provides functions to get information about bookmarks associated with video and audio items.
+ *
+ * API allows to:
+ * - get and filter existing bookmarks
+ * - insert new bookmarks
+ * - delete bookmarks
+ *
+ * For inserting a bookmark to media item, call media_bookmark_insert_to_db() function and for deleting already set bookmark from a media, call 
+ * #media_bookmark_delete_from_db() function.
+ * For retrieving time where the bookmark is placed on the media, call #media_bookmark_get_marked_time() function.
+ *
+ * @subsection CAPI_CONTENT_MEDIA_BOOKMARKINFO_FOREACH_OPERATIONS Foreach Operations
+ * <div><table class="doxtable" >
+ *     <tr>
+ *        <th><b>FOREACH</b></th>
+ *        <th><b>CALLBACK</b></th>
+ *        <th><b>DESCRIPTION</b></th>
+ *     </tr>
+ *     <tr>
+ *        <td>media_info_foreach_bookmark_from_db()</td>
+ *        <td>media_bookmark_cb()</td>
+ *        <td>Iterates through bookmarks</td>
+ *     </tr>
+ *</table></div>
+ *
+ *
+ */
+
+/**
+ * @defgroup CAPI_CONTENT_MEDIA_INFO_MODULE Media Information
+ * @brief The Media Information API provides functions to get information about media items
+ * stored on an internal and external storage.
+ *
+ * @ingroup CAPI_MEDIA_CONTENT_MODULE
+ *
+ * @section CAPI_CONTENT_MEDIA_INFO_MODULE_HEADER Required Header
+ *   \#include <media_content.h>
+ *
+ * @section CAPI_CONTENT_MEDIA_INFO_MODULE_OVERVIEW Overview
+ *
+ * The Media Information API provides functions to get basic information e.g. path, date, type etc about media items (#media_info_h) present in the device.
+ * Media Information (#media_info_h) is a generalization of media content of any type (audio, image, video and others).
+ *
+ * Received information about media items can be the processed using dedicated APIs:
+ * <table>
+ * <tr>
+ *    <th>API</th>
+ *    <th>Description</th>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_CONTENT_MEDIA_INFO_MODULE </td>
+ *    <td> Provides details about all items present in the device.\n
+ * Provide functions to get information (e.g. title, size, mime type etc) about the files.</td>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_CONTENT_MEDIA_AUDIO_META_MODULE </td>
+ *    <td> Provides details about audio items present in the device.\n
+ * Provide functions to get information (e.g. genre, album, year, bitrate etc) about the audio files.</td>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_CONTENT_MEDIA_IMAGE_MODULE </td>
+ *    <td> Provides details about image items present in the device.\n
+ * Provide functions to get information (e.g. longitude, description, date etc) about the image files.</td>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_CONTENT_MEDIA_VIDEO_META_MODULE </td>
+  *    <td> Provides details about video items present in the device.\n
+ * Provide functions to get information (e.g. title, duration, date etc) about the video files.</td>
+ * </tr>
+ * </table>
+ *
+ * Video and Audio information can be further processed with respect to its properties i.e. playlist, album, using their respective APIs.
+ * - @ref CAPI_CONTENT_MEDIA_PLAYLIST_MODULE 
+ * - @ref CAPI_CONTENT_MEDIA_ALBUM_MODULE 
+ * - @ref CAPI_CONTENT_MEDIA_BOOKMARK_MODULE  
+ *
+ *
+ * @subsection CAPI_CONTENT_MEDIA_INFO_FOREACH_OPERATIONS Foreach Operations
+ * <div><table class="doxtable">
+ *     <tr>
+ *        <th><b>FOREACH</b></th>
+ *        <th><b>CALLBACK</b></th>
+ *        <th><b>DESCRIPTION</b></th>
+ *     </tr>
+ *     <tr>
+ *        <td>media_info_foreach_media_from_db()</td>
+ *        <td>media_info_cb()</td>
+ *        <td>Iterates through items</td>
+ *     </tr>
+ *     <tr>
+ *        <td>media_info_foreach_tag_from_db()</td>
+ *        <td>media_tag_cb()</td>
+ *        <td>Iterate through tags</td>
+ *     </tr>
+ *     <tr>
+ *        <td>media_info_foreach_bookmark_from_db()</td>
+ *        <td>media_bookmark_cb()</td>
+ *        <td>Iterate through bookmark</td>
+ *     </tr> 
+ * </table></div>
+ *
+ *
+ *
+ */
+
+#endif /* __TIZEN_MEDIA_CONTENT_DOC_H__ */
index 183d1bd..7963084 100755 (executable)
@@ -26,318 +26,474 @@ extern "C" {
 #endif
 
 /**
+ * @file media_audio.h
+ * @brief This file contains the audio metadata API and related structure and enumeration. \n
+ *        Description of the audio content involves: album, artist, album_artist, author, genre and description tags. \n
+ *        Parameters of the recording are also supported such as format, bitrate, duration, size etc.
+ */
+
+/**
  * @addtogroup CAPI_CONTENT_MEDIA_AUDIO_META_MODULE
  * @{
- *
- * @file audio_meta.h
- * @brief This file contains the audio metadata API and related structure and enumeration. \n
- *        Description of the audio content involves: album, artist, author, genre and description tags. \n
- *        Parameters of the recording are also supported, as: format, bitrate, duration, size etc.
  */
 
 
 /**
- * @brief Destroys audio metadata.
+ * @brief Destroys the audio metadata.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] audio The handle to audio metadata.
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in] audio The audio metadata handle
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre Get copy of audio metadata handle handle by calling audio_meta_clone()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre Get a copy of audio metadata handle handle by calling audio_meta_clone().
+ *
  * @see audio_meta_clone()
- * @see media_info_get_audio_from_db()
  */
 int audio_meta_destroy(audio_meta_h audio);
 
 /**
- * @brief Clones audio metadata.
- * @details Function copies the audio metadata handle handle from source to destination.
+ * @brief Clones the audio metadata.
+ * @details This function copies the audio metadata handle from source to destination.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remark The destination handle must be released with audio_meta_destroy() by you.
+ * @remarks The destination handle must be released using audio_meta_destroy().
  *
- * @param [out] dst A destination handle to audio metadata
- * @param [in] src The source handle to audio metadata
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[out] dst  The destination handle to audio metadata
+ * @param[in]  src  The source handle to the audio metadata
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @see audio_meta_destroy()
  */
 int audio_meta_clone(audio_meta_h *dst, audio_meta_h src);
 
 /**
- * @brief Gets id of audio of given audio metadata.
+ * @brief Gets the audio ID of the given audio metadata.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a audio id must be released with free() by you.
+ * @remarks You must release @a media_id using free().
  *
- * @param [in] audio The handle to audio metadata
- * @param [out] media_id The id of the audio
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  audio    The audio metadata handle
+ * @param[out] media_id The ID of the audio
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int audio_meta_get_media_id(audio_meta_h audio, char **media_id);
 
 /**
- * @brief Gets title of audio of given audio metadata.
+ * @brief Gets the album name of the given audio metadata.
+ * @details If the value is an empty string, the method returns "Unknown".
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a audio title must be released with free() by you.
+ * @remarks You must release @a album_name using free().
  *
- * @param [in] audio The handle to audio metadata
- * @param [out] title The title of the audio
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  audio      The audio metadata handle
+ * @param[out] album_name The name of the album
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
-int audio_meta_get_title(audio_meta_h audio, char **title);
+int audio_meta_get_album(audio_meta_h audio, char **album_name);
 
 /**
- * @brief Gets name of album of given audio metadata.\n
- * If the value is an empty string, the method returns "Unknown".
+ * @brief Gets the artist name of the given audio metadata.
+ * @details If the value is an empty string, the method returns "Unknown".
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remarks You must release @a artist_name using free().
  *
- * @remarks @a album_name must be released with free() by you.
+ * @param[in]  audio       The audio metadata handle
+ * @param[out] artist_name The name of the artist
  *
- * @param [in] audio The handle to audio metadata
- * @param [out] album_name The name of the album
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
-int audio_meta_get_album(audio_meta_h audio, char **album_name);
+int audio_meta_get_artist(audio_meta_h audio, char **artist_name);
 
 /**
- * @brief Gets name of artist of given audio metadata.\n
- * If the value is an empty string, the method returns "Unknown".
+ * @brief Gets the album artist name of the given audio metadata.
+ * @details If the value is an empty string, the method returns "Unknown".
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remarks You must release @a album_artist_name using free().
+ *
+ * @param[in]  audio             The audio metadata handle
+ * @param[out] album_artist_name The name of the album artist
  *
- * @remarks @a artist_name must be released with free() by you.
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
- * @param [in] audio The handle to audio metadata
- * @param [out] artist_name The name of the artist
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
-int audio_meta_get_artist(audio_meta_h audio, char **artist_name);
+int audio_meta_get_album_artist(audio_meta_h audio, char **album_artist_name);
 
 /**
- * @brief Gets name of genre of given audio metadata.\n
- * If the value is an empty string, the method returns "Unknown".
+ * @brief Gets the genre name of the given audio metadata.
+ * @details If the value is an empty string, the method returns "Unknown".
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remarks You must release @a genre_name using free().
  *
- * @remarks @a genre_name must be released with free() by you.
+ * @param[in]  audio      The audio metadata handle
+ * @param[out] genre_name The name of the genre
  *
- * @param [in] audio The handle to audio metadata
- * @param [out] genre_name The name of the genre
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int audio_meta_get_genre(audio_meta_h audio, char **genre_name);
 
 /**
- * @brief Gets name of composer of given audio metadata.\n
- * If the value is an empty string, the method returns "Unknown".
+ * @brief Gets the composer name of the given audio metadata.
+ * @details If the value is an empty string, the method returns "Unknown".
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a author_name must be released with free() by you.
+ * @remarks You must release @a author_name using free().
  *
- * @param [in] audio The handle to audio metadata
- * @param [out] author_name The name of the author of audio
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  audio       The audio metadata handle
+ * @param[out] composer_name The name of the author of the audio
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int audio_meta_get_composer(audio_meta_h audio, char **composer_name);
 
 /**
- * @brief Gets year of given audio metadata.\n
- * If the value is an empty string, the method returns "Unknown".
+ * @brief Gets the year of the given audio metadata.
+ * @details If the value is an empty string, the method returns "Unknown".
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remarks You must release @a year using free().
+ *
+ * @param[in]  audio The audio metadata handle
+ * @param[out] year  The year of the audio file
  *
- * @remarks @a year must be released with free() by you.
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
- * @param [in] audio The handle to audio metadata
- * @param [out] year The year of the audio file
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int audio_meta_get_year(audio_meta_h audio, char **year);
 
 /**
- * @brief Gets recorded date of given audio metadata.
+ * @brief Gets the recorded date of the given audio metadata.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a recorded date must be released with free() by you.
+ * @remarks You must release @a recorded_date using free().
  *
- * @param [in] audio The handle to audio metadata
- * @param [out] recorded_date The recorded date of the audio file
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  audio         The audio metadata handle
+ * @param[out] recorded_date The recorded date of the audio file
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int audio_meta_get_recorded_date(audio_meta_h audio, char **recorded_date);
 
 /**
- * @brief Gets copyright notice of given audio metadata.
+ * @brief Gets the copyright notice of the given audio metadata.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remarks You must release @a copyright using free().
  *
- * @remarks @a copyright must be released with free() by you.
+ * @param[in]  audio     The audio metadata handle
+ * @param[out] copyright The audio copyright notice
  *
- * @param [in] audio The handle to audio metadata
- * @param [out] copyright The audio copyright notice
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int audio_meta_get_copyright(audio_meta_h audio, char **copyright);
 
 /**
- * @brief Gets track number of given audio metadata. \n
- * If the value is an empty string, the method returns "Unknown".
+ * @brief Gets the track number of the given audio metadata.
+ * @details If the value is an empty string, the method returns "Unknown".
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] audio The handle to audio metadata
- * @param [out] track_num The audio track number
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  audio     The audio metadata handle
+ * @param[out] track_num The audio track number
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int audio_meta_get_track_num(audio_meta_h audio, char **track_num);
 
 /**
- * @brief Gets bitrate of given audio metadata in bitrate per second.
+ * @brief Gets the bitrate of the given audio metadata in bitrate per second.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in]  audio    The audio metadata handle
+ * @param[out] bit_rate The audio bitrate in bit per second [bps]
  *
- * @param [in] audio The handle to audio metadata
- * @param [out] bit_rate The audio bitrate in bit per second [bps]
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int audio_meta_get_bit_rate(audio_meta_h audio, int *bit_rate);
 
 /**
- * @brief Gets sample rate of given audio metadata.
+ * @brief Gets bit per sample of the given audio metadata.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param [in]  audio        The handle to the audio metadata
+ * @param [out] bitpersample The audio bit per sample
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
- * @param [in] audio The handle to audio metadata
- * @param [out] sample_rate The audio sample rate[hz]
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ */
+
+int audio_meta_get_bitpersample(audio_meta_h audio, int *bitpersample);
+
+/**
+ * @brief Gets the sample rate of the given audio metadata.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in]  audio       The audio metadata handle
+ * @param[out] sample_rate The audio sample rate[hz]
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int audio_meta_get_sample_rate(audio_meta_h audio, int *sample_rate);
 
 /**
- * @brief Gets channel of given audio metadata.
+ * @brief Gets the channel of the given audio metadata.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in]  audio   The audio metadata handle
+ * @param[out] channel The channel of the audio
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
- * @param [in] audio The handle to audio metadata
- * @param [out] channel The channel of audio
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int audio_meta_get_channel(audio_meta_h audio, int *channel);
 
 /**
- * @brief Gets track duration of given audio metadata.
+ * @brief Gets the track duration of the given audio metadata.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] audio The handle to audio metadata
- * @param [out] duration The audio file duration
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  audio    The audio metadata handle
+ * @param[out] duration The audio file duration
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int audio_meta_get_duration(audio_meta_h audio, int *duration);
 
 /**
- * @brief Gets number which represents how many times given audio has been played.
+ * @brief Gets the number of times the given audio has been played.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in]  audio        The audio metadata handle
+ * @param[out] played_count The counter of the audio played
  *
- * @param [in] audio The handle to audio metadata
- * @param [out] count_played The counter of audio played
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int audio_meta_get_played_count(audio_meta_h audio, int *played_count);
 
 /**
- * @brief Gets the audio's played time parameter.
- * @details Function returns audio's elapsed playback time parameter as period
- * starting from the beginning of the track.
- *
- * @param [in] audio The handle to audio metadata
- * @param [out] played_time The elapsed time of the audio
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @brief Gets the played time parameter of an audio.
+ * @details This function returns audio's elapsed playback time parameter as a period
+ *          starting from the beginning of the track.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in]  audio       The audio metadata handle
+ * @param[out] played_time The elapsed time of the audio
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int audio_meta_get_played_time(audio_meta_h audio, time_t *played_time);
 
 /**
- * @brief Gets the audio's played position parameter.
- * @details Function returns audio's elapsed playback position parameter as period
- * starting from the beginning of the track.
- *
- * @param [in] audio The handle to audio metadata
- * @param [out] played_position The elapsed time of the audio
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @brief Gets the played position parameter of an audio.
+ * @details This function returns audio's elapsed playback position parameter as a period
+ *          starting from the beginning of the track.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in]  audio           The audio metadata handle
+ * @param[out] played_position The elapsed time of the audio
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int audio_meta_get_played_position(audio_meta_h audio, int *played_position);
 
 /**
- * @brief Sets the played count to audio meta handle.
+ * @brief Sets the played count to an audio meta handle.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] audio        The audio metadata handle
+ * @param[in] played_count The played count of the audio
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
- * @param [in] audio The handle to audio metadata
- * @param [in] played_count The played count of audio
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @post audio_meta_update_to_db()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @post audio_meta_update_to_db().
  */
 int audio_meta_set_played_count(audio_meta_h audio, int played_count);
 
 /**
- * @brief Sets the played time to audio meta handle.
+ * @brief Sets the played time to an audio meta handle.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] audio       The audio metadata handle
+ * @param[in] played_time The played time of the audio
  *
- * @param [in] audio The handle to audio metadata
- * @param [in] played_time The played time of audio
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @post audio_meta_update_to_db() 
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @post audio_meta_update_to_db().
  */
 int audio_meta_set_played_time(audio_meta_h audio, time_t played_time);
 
 /**
- * @brief Sets the played position to audio meta handle.
+ * @brief Sets the played position to an audio meta handle.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] audio           The audio metadata handle
+ * @param[in] played_position The played position of the audio
  *
- * @param [in] audio The handle to audio metadata
- * @param [in] played_position The played position of audio
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @post audio_meta_update_to_db()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @post audio_meta_update_to_db().
  */
 int audio_meta_set_played_position(audio_meta_h audio, int played_position);
 
 /**
- * @brief Updates audio metadata which is modified attributes to the media database.
+ * @brief Updates an audio metadata with modified attributes in the media database.
+ * @details The function updates the given audio meta in the media database.
  *
- * @details The function updates the given audio meta in the media database.\n
- * The function should be called after any change in the attributes, to be updated to the media database.\n
- * For example, after using audio_meta_set_played_count() for changing the count of the played,
- * audio_meta_update_to_db() function should be called so as to update the given the attibutes in the media database.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write
  *
- * @param [in] audio The handle to audio metadata
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @remarks The function should be called after any change in the attributes, to update the media database.
+ *          For example, after using audio_meta_set_played_count() for changing the count of the played, the
+ *          audio_meta_update_to_db() function should be called to update the given attributes in the media database. \n
+ *          Do not call this function in callback function of foreach function like media_info_foreach_media_from_db().
+ *
+ * @param[in] audio The audio metadata handle
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
+ *
  * @see media_content_connect()
  * @see audio_meta_set_played_count()
  * @see audio_meta_set_played_time()
index ce974c2..1851818 100755 (executable)
 extern "C" {
 #endif /* __cplusplus */
 
+/**
+ * @file media_bookmark.h
+ * @brief This file contains API on main functional operations with bookmarks that are related to media resources in the media database. \n
+ *        Operations include: inserting a new bookmark in media to the media database, removing bookmark from database, \n
+ *        getting number of bookmarks, cloning and destroying bookmark, getting bookmark`s ID, time marked parameter and thumbnail.
+ */
 
 /**
  * @addtogroup CAPI_CONTENT_MEDIA_BOOKMARK_MODULE
@@ -32,118 +38,175 @@ extern "C" {
  */
 
 /**
- * @brief Inserts a new bookmark in media on specified time offset to the media database.
+ * @brief Inserts a new bookmark in media on the specified time offset to the media database.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write
+ *
+ * @param[in] media_id       The media ID
+ * @param[in] time           The bookmark time offset (in seconds)
+ * @param[in] thumbnail_path The thumbnail path of video bookmark\ n
+ *                           If the media type is audio, then thumbnail is null.
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
- * @param [in] media_id The id of media
- * @param [in] time The bookmark time offset(in seconds)
- * @param [in] thumbnail_path The thumbnail path of video bookmark. If the media type is audio, then thumbnail is null.
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
+ *
  * @see media_content_connect()
  * @see media_bookmark_delete_from_db()
- *
  */
 int media_bookmark_insert_to_db(const char *media_id, time_t time, const char *thumbnail_path);
 
 /**
- * @brief Removes media bookmark from the media database.
+ * @brief Removes a media bookmark from the media database.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write
+ *
+ * @param[in] bookmark_id The ID of media bookmark
  *
- * @param [in] bookmark The handle to media bookmark
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
+ *
  * @see media_content_connect()
  * @see media_bookmark_insert_to_db()
- *
  */
 int media_bookmark_delete_from_db(int bookmark_id);
 
 /**
- * @brief Gets number of bookmark with optional filter from media database.
+ * @brief Gets the number of bookmarks with an optional filter from the media database.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in]  filter         The handle to the media filter
+ * @param[out] bookmark_count The count of the media bookmark
  *
- * @param [in] filter  The handle to media filter
- * @param [out] bookmark_count The count of media bookmark
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
+ *
  * @see media_content_connect()
  */
 int media_bookmark_get_bookmark_count_from_db(filter_h filter, int *bookmark_count);
 
 /**
- * @brief Clones media bookmark.
+ * @brief Clones media bookmark.
  * @details This function copies the media bookmark handle from a source to destination. There is no media_bookmark_create() function.
- * The media_bookmark_h is created internally and available through media bookmark foreach function such as media_info_foreach_bookmark_from_db().
- * To use this handle outside of these foreach functions, use this function.
+ *          The media_bookmark_h is created internally and available through media bookmark foreach function such as media_info_foreach_bookmark_from_db().
+ *          To use this handle outside of these foreach functions, use this function.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remark The destination handle must be released with media_bookmark_destroy() by you.
+ * @remarks The destination handle must be released using media_bookmark_destroy().
  *
- * @param [out] dst A destination handle to media bookmark
- * @param [in] src The source handle to media bookmark
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[out] dst The destination handle to media bookmark
+ * @param[in]  src The source handle to media bookmark
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @see media_bookmark_destroy()
  * @see media_info_foreach_bookmark_from_db()
- *
  */
 int media_bookmark_clone(media_bookmark_h *dst, media_bookmark_h src);
 
 /**
- * @brief Destroys media bookmark.
- * @details Function frees all resources related to bookmark handle. This handle
- * no longer can be used to perform any operation. A new handle has to
- * be created before the next use.
- *
- * @param [in] bookmark The handle to media bookmark
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @brief Destroys a media bookmark.
+ * @details This function frees all the resources related to the bookmark handle. This handle
+ *          no longer can be used to perform any operation. A new handle has to
+ *          be created before the next use.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] bookmark The handle to media bookmark
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre Get copy of bookmark handle by calling media_bookmark_clone()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre Get copy of bookmark handle by calling media_bookmark_clone().
+ *
  * @see media_bookmark_clone()
  */
 int media_bookmark_destroy(media_bookmark_h bookmark);
 
 /**
- * @brief Gets bookmark's id.
+ * @brief Gets the bookmark ID.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in]  bookmark    The handle to media bookmark
+ * @param[out] bookmark_id The media bookmark ID
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
- * @param [in] bookmark The handle to media bookmark
- * @param [out] bookmark_id The id of media bookmark
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_bookmark_get_bookmark_id(media_bookmark_h bookmark, int *bookmark_id);
 
 /**
- * @brief Gets bookmark's time marked parameter.
- * @details Function returns time offset in milliseconds from beginning of the movie on which bookmark
- * was placed.
- *
- * @param [in] bookmark The handle to media bookmark
- * @param [out] marked_time The bookmark time offset(in milliseconds)
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @brief Gets the bookmark time marked parameter.
+ * @details This function returns time offset in milliseconds from beginning of the movie on which bookmark
+ *          was placed.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in]  bookmark    The handle to media bookmark
+ * @param[out] marked_time The bookmark time offset (in milliseconds)
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_bookmark_get_marked_time(media_bookmark_h bookmark, time_t *marked_time);
 
 /**
- * @brief Gets the media bookmark's thumbnail.
+ * @brief Gets the media bookmark thumbnail.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remarks You must release @a path using free().
+ *
+ * @param[in]  bookmark The handle to media bookmark
+ * @param[out] path     The thumbnail path of media bookmark
  *
- * @remarks @a path must be released with free() by you.
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
- * @param [in] bookmark The handle to media bookmark
- * @param [out] path The thumbnail path of media bookmark
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_bookmark_get_thumbnail_path(media_bookmark_h bookmark, char **path);
 
index d26e865..51588a5 100755 (executable)
 #include <media_playlist.h>
 #include <media_bookmark.h>
 
-
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
 
 /**
+ * @file media_content.h
+ * @brief This file contains API providing functions for media content in DB. \n
+ *        Operations include connect and disconnect the media content service, scanning media file and folder with subfolders, \n
+ *        subscribing and unsubscribing notifications of media DB change.
+ */
+
+/**
  * @addtogroup CAPI_MEDIA_CONTENT_MODULE
  * @{
  */
 
-
 /**
  * @brief Connects to the media content service.
  * @details Any media content related function call should be invoked after this function call.
  *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed 
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE      Successful
+ * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @post media_content_disconnect()
- * @see media_content_disconnect()
  *
+ * @see media_content_disconnect()
  */
 int media_content_connect(void);
 
 /**
  * @brief Disconnects from the media content service.
  * @details This function closes connection to the media content service. Any further media content related operation
- * cannot be performed after this function is called.
+ *          cannot be performed after this function is called.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE      Successful
+ * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed 
  * @pre media_content_connect()
+ *
  * @see media_content_connect()
  *
  */
 int media_content_disconnect(void);
 
 /**
+ * @brief Requests to scan a media file.
+ * @details This function requests to scan a media file to the media server.
+ *          If media file is not registered to DB yet, that media file information will be added to the media DB. If it is already registered to the DB, then this tries to refresh information.
+ *          If requested file does not exist on file system, information of the media file will be removed from the media DB.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write \n
+ *                   %http://tizen.org/privilege/mediastorage \n
+ *                   %http://tizen.org/privilege/externalstorage
+ *
+ * @remarks You must add privilege http://tizen.org/privilege/content.write. And You add more privilege depending on your choice of contents path. \n
+ *                   If you want to access only internal storage by using  this API, you should add privilege http://tizen.org/privilege/mediastorage. \n
+ *                   Or if you want to access only external storage by using  this API, you shold add privilege http://tizen.org/privilege/externalstorage. \n
+ *                   If you can access both storage, you must add all privilege.
+ *
+ * @param[in] path The file path
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre This function requires opened connection to content service by media_content_connect().
+ */
+int media_content_scan_file(const char *path);
+
+/**
+ * @brief Requests to scan a media folder, asynchronously.
+ * @details This function requests to scan a media folder to the media server with given completed callback function.
+ *          media_scan_completed_cb() function will be called when the scanning is finished.
+ *          The sub folders are also scanned, if there are sub folders in that folder. \n
+ *          If any folder must not be scanned, a blank file ".scan_ignore" has to be created in that folder.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write \n
+ *                   %http://tizen.org/privilege/mediastorage \n
+ *                   %http://tizen.org/privilege/externalstorage
+ *
+ * @remarks You must add privilege http://tizen.org/privilege/content.write. And You add more privilege depending on your choice of contents path. \n
+ *                   If you want to access only internal storage by using  this API, you should add privilege http://tizen.org/privilege/mediastorage. \n
+ *                   Or if you want to access only external storage by using  this API, you shold add privilege http://tizen.org/privilege/externalstorage. \n
+ *                   If you can access both storage, you must add all privilege.
+ *
+ * @param[in] path         The folder path
+ * @param[in] is_recursive Set @c true to scan recursively subdirectories,
+ *                         otherwise @c false to scan only the current directory
+ * @param[in] callback     The callback to be invoked when the scanning is finished
+ * @param[in] user_data    The user data to be passed to the callback function
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @see media_scan_completed_cb()
+ */
+int media_content_scan_folder(const char *path, bool is_recursive, media_scan_completed_cb callback, void *user_data);
+
+/**
+ * @brief Subscribes notifications of the media DB change.
+ * @details This function subscribes notifications of the media DB change which are published by the media server or other apps.
+ *          media_content_db_update_cb() function will be called when notification of the media DB change is subscribed.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] callback  The callback to be invoked when the scanning is finished
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @see media_content_db_update_cb()
+ * @see media_content_unset_db_updated_cb()
+ */
+int media_content_set_db_updated_cb(media_content_db_update_cb callback, void *user_data);
+
+/**
+ * @brief Unsubscribes notifications of the media DB change.
+ * @details This function unsubscribes notifications of the media DB change which are published by the media server or other apps.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre media_content_set_db_updated_cb()
+ *
+ * @see media_content_set_db_updated_cb()
+ */
+int media_content_unset_db_updated_cb(void);
+
+/**
  * @}
  */
 
index 715c385..a3f9a6d 100755 (executable)
@@ -31,207 +31,279 @@ extern "C" {
 #endif
 
 /**
+ * @file media_content_type.h
+ * @brief This file contains API related to media-content enumerations for media data types, groups, orientations, \n
+ *        classes of errors and definitions of media-data. \n
+ *        Listed APIs are called when iterating over lists of album, group, bookmark and other media,  \n
+ *        when media items and burst shot are inserted completely and when notification of media DB change is subscribed.
+ */
+
+/**
 * @addtogroup CAPI_MEDIA_CONTENT_MODULE
-* @{
-*/
+ * @{
+ */
 
 /**
  * @ingroup CAPI_MEDIA_CONTENT_MODULE
- * @brief The enumerations of the media file format.
+ * @brief Enumeration for the media file format.
  */
 typedef enum
 {
-       MEDIA_CONTENT_TYPE_IMAGE                = 0,            /**<The type of image */
-       MEDIA_CONTENT_TYPE_VIDEO                = 1,            /**<The type of video */
-       MEDIA_CONTENT_TYPE_SOUND        = 2,            /**<The type of sound */
-       MEDIA_CONTENT_TYPE_MUSIC                = 3,            /**<The type of music */
-       MEDIA_CONTENT_TYPE_OTHERS       = 4,            /**<The type of other */
+    MEDIA_CONTENT_TYPE_IMAGE   = 0,  /**<The type of an image */
+    MEDIA_CONTENT_TYPE_VIDEO   = 1,  /**<The type of a video */
+    MEDIA_CONTENT_TYPE_SOUND   = 2,  /**<The type of sound */
+    MEDIA_CONTENT_TYPE_MUSIC   = 3,  /**<The type of music */
+    MEDIA_CONTENT_TYPE_OTHERS  = 4,  /**<The type of other */
 } media_content_type_e;
 
 /**
  * @ingroup CAPI_CONTENT_MEDIA_FOLDER_MODULE
- * @brief The enumerations of the storage type.
- * @detail This information is used to establish where the folder is.
+ * @brief Enumeration for the storage type.
+ * @details This information is used to establish where the folder is.
  */
 typedef enum
 {
-       MEDIA_CONTENT_STORAGE_INTERNAL  = 0,            /**< The device's internal storage */
-       MEDIA_CONTENT_STORAGE_EXTERNAL  = 1,            /**< The device's external storage */
+    MEDIA_CONTENT_STORAGE_INTERNAL  = 0,  /**< The device's internal storage */
+    MEDIA_CONTENT_STORAGE_EXTERNAL  = 1,  /**< The device's external storage */
 } media_content_storage_e;
 
 /**
+ * @ingroup CAPI_MEDIA_CONTENT_MODULE
+ * @brief Enumeration for media content DB update items.
+ */
+typedef enum {
+    MEDIA_ITEM_FILE       = 0,              /**< File type, an item updated to DB */
+    MEDIA_ITEM_DIRECTORY  = 1,              /**< Directory type, an item updated to DB */
+} media_content_db_update_item_type_e;
+
+/**
+ * @ingroup CAPI_MEDIA_CONTENT_MODULE
+ * @brief Enumeration for media content DB update types.
+ */
+typedef enum {
+    MEDIA_CONTENT_INSERT  = 0,              /**< Insert, the type of DB update */
+    MEDIA_CONTENT_DELETE  = 1,              /**< Delete, The type of DB update */
+    MEDIA_CONTENT_UPDATE  = 2,              /**< Update, The type of DB update */
+} media_content_db_update_type_e;
+
+/**
  * @ingroup CAPI_CONTENT_MEDIA_INFO_MODULE
- * @brief The type of orientation.
+ * @brief Enumeration for orientation types.
  */
 typedef enum {
-       MEDIA_CONTENT_ORIENTATION_NOT_AVAILABLE         = 0,            /**< Not available*/
-       MEDIA_CONTENT_ORIENTATION_NORMAL                        = 1,            /**< Normal*/
-       MEDIA_CONTENT_ORIENTATION_HFLIP                         = 2,            /**< Flip horizontal*/
-       MEDIA_CONTENT_ORIENTATION_ROT_180                       = 3,            /**< Rotate 180 degrees*/
-       MEDIA_CONTENT_ORIENTATION_VFLIP                         = 4,            /**< Flip vertical*/
-       MEDIA_CONTENT_ORIENTATION_TRANSPOSE                     = 5,            /**< Transpose*/
-       MEDIA_CONTENT_ORIENTATION_ROT_90                        = 6,            /**< Rotate 90 degrees*/
-       MEDIA_CONTENT_ORIENTATION_TRANSVERSE            = 7,            /**< Transverse*/
-       MEDIA_CONTENT_ORIENTATION_ROT_270                       = 8,            /**< Rotate 270 degrees*/
+    MEDIA_CONTENT_ORIENTATION_NOT_AVAILABLE  = 0,       /**< Not available*/
+    MEDIA_CONTENT_ORIENTATION_NORMAL         = 1,       /**< Normal*/
+    MEDIA_CONTENT_ORIENTATION_HFLIP          = 2,       /**< Flip horizontal*/
+    MEDIA_CONTENT_ORIENTATION_ROT_180        = 3,       /**< Rotate 180 degrees*/
+    MEDIA_CONTENT_ORIENTATION_VFLIP          = 4,       /**< Flip vertical*/
+    MEDIA_CONTENT_ORIENTATION_TRANSPOSE      = 5,       /**< Transpose*/
+    MEDIA_CONTENT_ORIENTATION_ROT_90         = 6,       /**< Rotate 90 degrees*/
+    MEDIA_CONTENT_ORIENTATION_TRANSVERSE     = 7,       /**< Transverse*/
+    MEDIA_CONTENT_ORIENTATION_ROT_270        = 8,       /**< Rotate 270 degrees*/
 } media_content_orientation_e;
 
 /**
  * @ingroup CAPI_MEDIA_CONTENT_MODULE
- * @brief The enumerations of ordering.
+ * @brief Enumeration for ordering.
  */
 typedef enum
 {
-       MEDIA_CONTENT_ORDER_ASC         = 0,            /**< ascending order*/
-       MEDIA_CONTENT_ORDER_DESC        = 1,            /**< descending order*/
+    MEDIA_CONTENT_ORDER_ASC   = 0,      /**< Ascending order*/
+    MEDIA_CONTENT_ORDER_DESC  = 1,      /**< Descending order*/
 } media_content_order_e;
 
 /**
  * @ingroup CAPI_MEDIA_CONTENT_MODULE
- * @brief The enumerations of collations.
+ * @brief Enumeration for collations.
  */
 typedef enum
 {
-       MEDIA_CONTENT_COLLATE_DEFAULT   = 0,            /**< default collation BINARY */
-       MEDIA_CONTENT_COLLATE_NOCASE    = 1,            /**< collation NOCASE, not case sensitive */
-       MEDIA_CONTENT_COLLATE_RTRIM             = 2,            /**< collation RTRIM, trailing space characters are ignored */
+    MEDIA_CONTENT_COLLATE_DEFAULT   = 0,        /**< Default collation BINARY */
+    MEDIA_CONTENT_COLLATE_NOCASE    = 1,        /**< Collation NOCASE, not case sensitive */
+    MEDIA_CONTENT_COLLATE_RTRIM     = 2,        /**< Collation RTRIM, trailing space characters are ignored */
+    MEDIA_CONTENT_COLLATE_LOCALIZED = 3,        /**< Collation LOCALIZATION, NOCASE also applied */
 } media_content_collation_e;
 
+#define MEDIA_CONTENT_ERROR_CLASS                              TIZEN_ERROR_MEDIA_CONTENT
+
 /**
  * @ingroup CAPI_MEDIA_CONTENT_MODULE
- * @brief The enumerations of media content error
+ * @brief Enumeration for a media content error.
  */
-typedef enum
+ typedef enum
 {
-       MEDIA_CONTENT_ERROR_NONE                                        = TIZEN_ERROR_NONE,                                     /**< Successful */
-       MEDIA_CONTENT_ERROR_INVALID_PARAMETER           = TIZEN_ERROR_INVALID_PARAMETER,        /**< Invalid parameter */
-       MEDIA_CONTENT_ERROR_OUT_OF_MEMORY                       = TIZEN_ERROR_OUT_OF_MEMORY,            /**< Out of memory */
-       MEDIA_CONTENT_ERROR_DB_FAILED                           = TIZEN_ERROR_CONTENT_CLASS | 0x01,     /**< DB operation failed */
-       MEDIA_CONTENT_ERROR_DB_BUSY                             = TIZEN_ERROR_CONTENT_CLASS | 0x02,     /**< DB operation BUSY */
-       MEDIA_CONTENT_ERROR_NETWORK                                     = TIZEN_ERROR_CONTENT_CLASS | 0x03,     /**< Network Fail */
-       MEDIA_CONTENT_ERROR_UNSUPPORTED_CONTENT         = TIZEN_ERROR_CONTENT_CLASS | 0x04,     /**< Unsupported Content */
-       MEDIA_CONTENT_ERROR_INVALID_OPERATION           = TIZEN_ERROR_CONTENT_CLASS | 0x05,     /**< Invalid Operation */
+    MEDIA_CONTENT_ERROR_NONE                    = TIZEN_ERROR_NONE,                    /**< Successful */
+    MEDIA_CONTENT_ERROR_INVALID_PARAMETER       = TIZEN_ERROR_INVALID_PARAMETER,       /**< Invalid parameter */
+    MEDIA_CONTENT_ERROR_OUT_OF_MEMORY           = TIZEN_ERROR_OUT_OF_MEMORY,           /**< Out of memory */
+    MEDIA_CONTENT_ERROR_INVALID_OPERATION       = TIZEN_ERROR_INVALID_OPERATION,       /**< Invalid Operation */
+    MEDIA_CONTENT_FILE_NO_SPACE_ON_DEVICE       = TIZEN_ERROR_FILE_NO_SPACE_ON_DEVICE, /**< No space left on device */
+    MEDIA_CONTENT_ERROR_PERMISSION_DENIED                = TIZEN_ERROR_PERMISSION_DENIED,                /**< Permission denied */
+    MEDIA_CONTENT_ERROR_DB_FAILED               = MEDIA_CONTENT_ERROR_CLASS | 0x01,    /**< DB operation failed */
+    MEDIA_CONTENT_ERROR_DB_BUSY                 = MEDIA_CONTENT_ERROR_CLASS | 0x02,    /**< DB operation BUSY */
+    MEDIA_CONTENT_ERROR_NETWORK                 = MEDIA_CONTENT_ERROR_CLASS | 0x03,    /**< Network Fail */
+    MEDIA_CONTENT_ERROR_UNSUPPORTED_CONTENT     = MEDIA_CONTENT_ERROR_CLASS | 0x04,    /**< Unsupported Content */
 } media_content_error_e;
 
 /**
  * @ingroup CAPI_MEDIA_CONTENT_MODULE
- * @brief The enumerations of media group
+ * @brief Enumeration for a media group.
  */
 typedef enum {
-       MEDIA_CONTENT_GROUP_DISPLAY_NAME = 0,
-       MEDIA_CONTENT_GROUP_TYPE,
-       MEDIA_CONTENT_GROUP_MIME_TYPE,
-       MEDIA_CONTENT_GROUP_SIZE,
-       MEDIA_CONTENT_GROUP_ADDED_TIME,
-       MEDIA_CONTENT_GROUP_MODIFIED_TIME,
-       MEDIA_CONTENT_GROUP_TITLE,
-       MEDIA_CONTENT_GROUP_ARTIST,
-       MEDIA_CONTENT_GROUP_GENRE,
-       MEDIA_CONTENT_GROUP_COMPOSER,
-       MEDIA_CONTENT_GROUP_YEAR,
-       MEDIA_CONTENT_GROUP_RECORDED_DATE,
-       MEDIA_CONTENT_GROUP_COPYRIGHT,
-       MEDIA_CONTENT_GROUP_TRACK_NUM,
-       MEDIA_CONTENT_GROUP_DESCRIPTION,
-       MEDIA_CONTENT_GROUP_LONGITUDE,
-       MEDIA_CONTENT_GROUP_LATIITUDE,
-       MEDIA_CONTENT_GROUP_ALTITUDE,
-       MEDIA_CONTENT_GROUP_RATING,
-       MEDIA_CONTENT_GROUP_AUTHOR,
-       MEDIA_CONTENT_GROUP_PROVIDER,
-       MEDIA_CONTENT_GROUP_CONTENT_NAME,
-       MEDIA_CONTENT_GROUP_CATEGORY,
-       MEDIA_CONTENT_GROUP_LOCATION_TAG,
-       MEDIA_CONTENT_GROUP_AGE_RATING,
-       MEDIA_CONTENT_GROUP_KEYWORD
+    MEDIA_CONTENT_GROUP_DISPLAY_NAME = 0,    /**< Media group ID for display name */
+    MEDIA_CONTENT_GROUP_TYPE,                /**< Media group ID for a media type */
+    MEDIA_CONTENT_GROUP_MIME_TYPE,           /**< Media group ID for a mime type */
+    MEDIA_CONTENT_GROUP_SIZE,                /**< Media group ID for content size */
+    MEDIA_CONTENT_GROUP_ADDED_TIME,          /**< Media group ID for the added time */
+    MEDIA_CONTENT_GROUP_MODIFIED_TIME,       /**< Media group ID for the modified time */
+    MEDIA_CONTENT_GROUP_TITLE,               /**< Media group ID for a content title */
+    MEDIA_CONTENT_GROUP_ARTIST,              /**< Media group ID for an artist*/
+    MEDIA_CONTENT_GROUP_ALBUM_ARTIST,        /**< Media group ID for an album artist */
+    MEDIA_CONTENT_GROUP_GENRE,               /**< Media group ID for a genre*/
+    MEDIA_CONTENT_GROUP_COMPOSER,            /**< Media group ID for a composer*/
+    MEDIA_CONTENT_GROUP_YEAR,                /**< Media group ID for a year*/
+    MEDIA_CONTENT_GROUP_RECORDED_DATE,       /**< Media group ID for the recorded date*/
+    MEDIA_CONTENT_GROUP_COPYRIGHT,           /**< Media group ID for the copyright*/
+    MEDIA_CONTENT_GROUP_TRACK_NUM,           /**< Media group ID for a track number*/
+    MEDIA_CONTENT_GROUP_DESCRIPTION,         /**< Media group ID for a description */
+    MEDIA_CONTENT_GROUP_LONGITUDE,           /**< Media group ID for the longitude*/
+    MEDIA_CONTENT_GROUP_LATITUDE,            /**< Media group ID for the latitude*/
+    MEDIA_CONTENT_GROUP_ALTITUDE,            /**< Media group ID for the altitude*/
+    MEDIA_CONTENT_GROUP_BURST_IMAGE,         /**< Media group ID for the burst shot*/
+    MEDIA_CONTENT_GROUP_RATING,              /**< Media group ID for a rating*/
+    MEDIA_CONTENT_GROUP_AUTHOR,              /**< Media group ID for an author*/
+    MEDIA_CONTENT_GROUP_PROVIDER,            /**< Media group ID for a provider*/
+    MEDIA_CONTENT_GROUP_CONTENT_NAME,        /**< Media group ID for the content name*/
+    MEDIA_CONTENT_GROUP_CATEGORY,            /**< Media group ID for a category*/
+    MEDIA_CONTENT_GROUP_LOCATION_TAG,        /**< Media group ID for a location tag*/
+    MEDIA_CONTENT_GROUP_AGE_RATING,          /**< Media group ID for an age rating*/
+    MEDIA_CONTENT_GROUP_KEYWORD,             /**< Media group ID for a keyword*/
+    MEDIA_CONTENT_GROUP_WEATHER,             /**< Media group ID for the weather*/
+    MEDIA_CONTENT_GROUP_MAX                  /**< Max count of the media group ID */
 } media_group_e;
 
 /**
  * @ingroup CAPI_CONTENT_MEDIA_INFO_MODULE
- * @brief The handle to media info.
+ * @brief The structure type for the Media info handle.
  */
 typedef struct media_info_s *media_info_h;
 
 /**
  * @ingroup CAPI_CONTENT_MEDIA_FOLDER_MODULE
- * @brief The handle to media folder.
+ * @brief The structure type for the Media folder handle.
  */
 typedef struct media_folder_s *media_folder_h;
 
 /**
  * @ingroup CAPI_CONTENT_MEDIA_PLAYLIST_MODULE
- * @brief The handle to media playlist.
+ * @brief The structure type for the Media playlist handle.
  */
 typedef struct media_playlist_s *media_playlist_h;
 
 /**
  * @ingroup CAPI_CONTENT_MEDIA_TAG_MODULE
- * @brief The handle to media tag.
+ * @brief The structure type for the Media tag handle.
  */
 typedef struct media_tag_s *media_tag_h;
 
 /**
  * @ingroup CAPI_CONTENT_MEDIA_BOOKMARK_MODULE
- * @brief The handle to media bookmark.
+ * @brief The structure type for the Media bookmark handle.
  */
 typedef struct media_bookmark_s *media_bookmark_h;
 
 /**
  * @ingroup CAPI_CONTENT_MEDIA_ALBUM_MODULE
- * @brief The handle to media album.
+ * @brief The structure type for the Media album handle.
  */
 typedef struct media_album_s *media_album_h;
 
-
-typedef struct media_artist_s *media_artist_h;
-typedef struct media_genre_s *media_genre_h;
-typedef struct media_composer_s *media_composer_h;
-typedef struct media_year_s *media_year_h;
-
 /**
  * @ingroup CAPI_CONTENT_MEDIA_IMAGE_MODULE
- * @brief The handle to image metadata.
+ * @brief The structure type for the Image metadata handle.
  */
 typedef struct image_meta_s *image_meta_h;
 
 /**
  * @ingroup CAPI_CONTENT_MEDIA_VIDEO_META_MODULE
- * @brief The handle to video metadata.
+ * @brief The structure type for the Video metadata handle.
  */
 typedef struct video_meta_s *video_meta_h;
 
 /**
  * @ingroup CAPI_CONTENT_MEDIA_AUDIO_META_MODULE
- * @brief The handle to audio metadata.
+ * @brief The structure type for the Audio metadata handle.
  */
 typedef struct audio_meta_s *audio_meta_h;
 
 /**
  * @ingroup CAPI_CONTENT_MEDIA_FILTER_MODULE
- * @brief The handle to media filter.
+ * @brief The structure type for the Media filter handle.
  */
 typedef struct filter_s *filter_h;
 
 /**
+ * @ingroup CAPI_MEDIA_CONTENT_MODULE
+ * @brief Called when the media scanning is finished.
+ *
+ * @param[in] error     The error code
+ * @param[in] user_data The user data passed from the foreach function
+ *
+ * @pre media_content_scan().
+ *
+ * @see media_content_scan()
+ *
+ */
+typedef void (*media_scan_completed_cb)(media_content_error_e error, void * user_data);
+
+/**
+ * @ingroup CAPI_MEDIA_CONTENT_MODULE
+ * @brief Called when the notification of the media DB change is subscribed.
+ *
+ * @param[in] error       The error code
+ * @param[in] pid         The PID which publishes notification
+ * @param[in] update_item The update item of notification
+ * @param[in] update_type The update type of notification
+ * @param[in] media_type  The type of the media content (#media_content_type_e)
+ * @param[in] uuid        The UUID of media or directory, which is updated
+ * @param[in] path        The path of the media or directory
+ * @param[in] mime_type   The mime type of the media info
+ * @param[in] user_data   The user data passed from the foreach function
+ *
+ * @pre media_content_db_update_subscribe().
+ * @see media_content_db_update_subscribe()
+ */
+typedef void (*media_content_db_update_cb)(
+                                    media_content_error_e error,
+                                    int pid,
+                                    media_content_db_update_item_type_e update_item,
+                                    media_content_db_update_type_e update_type,
+                                    media_content_type_e media_type,
+                                    char *uuid,
+                                    char *path,
+                                    char *mime_type,
+                                    void *user_data);
+
+
+/**
  * @ingroup CAPI_CONTENT_MEDIA_INFO_MODULE
- * @brief Iterates over a list of media info.
+ * @brief Called for every available media info.
  *
- * @details This callback is called for every available media info.\n
+ * @details Iterates over a list of media info.
  *
- * @remarks To use the @a media outside this function, copy the handle with #media_info_clone() function.
+ * @remarks To use the @a media outside this function, copy the handle with media_info_clone() function.
  *
- * @param[in] media The handle to media info
+ * @param[in] media     The handle to the media info
  * @param[in] user_data The user data passed from the foreach function
- * @return true to continue with the next iteration of the loop,
- * @return false to break out of the loop.
+ *
+ * @return @c true to continue with the next iteration of the loop,
+ *         otherwise @c false to break out of the loop
+ *
  * @pre media_tag_foreach_media_from_db(), media_playlist_foreach_media_from_db(), media_genre_foreach_media_from_db(),
- *     media_album_foreach_media_from_db(), media_artist_foreach_media_from_db(), media_composer_foreach_media_from_db(),
- *     media_info_foreach_media_from_db(), media_folder_foreach_media_from_db() will invoke this function.
+ *      media_info_foreach_media_from_db(), media_folder_foreach_media_from_db() will invoke this function.
+ *
  * @see media_info_clone()
  * @see media_album_foreach_media_from_db()
  * @see media_playlist_foreach_media_from_db()
- * @see media_artist_foreach_media_from_db()
- * @see media_composer_foreach_media_from_db()
- * @see media_genre_get_media_count_from_db()
  * @see media_tag_foreach_media_from_db()
  * @see media_info_foreach_media_from_db()
  * @see media_folder_foreach_media_from_db()
@@ -241,14 +313,45 @@ typedef bool (*media_info_cb)(media_info_h media, void *user_data);
 
 /**
  * @ingroup CAPI_CONTENT_MEDIA_INFO_MODULE
- * @brief Creates a thumbnail image.
+ * @brief Called when media items are inserted completely.
+ *
+ * @param[in] media     The handle to the media info
+ * @param[in] user_data The user data passed from the foreach function
+ *
+ * @pre media_info_insert_batch_to_db()
+ *
+ * @see media_info_insert_batch_to_db()
+ */
+typedef void (*media_insert_completed_cb)(media_content_error_e error, void * user_data);
+
+
+/**
+ * @ingroup CAPI_CONTENT_MEDIA_INFO_MODULE
+ * @brief Called when the burst shot is inserted completely.
  *
- * @details This callback is called for completion of generating the thumbnail image.\n
+ * @param[in] media     The handle to the media info
+ * @param[in] user_data The user data passed from the foreach function
+ *
+ * @pre media_info_insert_burst_shot_to_db()
+ *
+ * @see media_info_insert_burst_shot_to_db()
  *
- * @param[in] error The Error code
- * @param[in] path The Path of thumbnail which is generated
+ */
+typedef void (*media_insert_burst_shot_completed_cb)(media_content_error_e error, void * user_data);
+
+
+/**
+ * @ingroup CAPI_CONTENT_MEDIA_INFO_MODULE
+ * @brief Called when creating a thumbnail image.
+ *
+ * @details This callback is called for completion of generating the thumbnail image.
+ *
+ * @param[in] error     The error code
+ * @param[in] path      The path of the thumbnail which is generated
  * @param[in] user_data The user data passed from the foreach function
+ *
  * @pre media_info_create_thumbnail()
+ *
  * @see media_info_create_thumbnail()
  */
 typedef void (*media_thumbnail_completed_cb)(media_content_error_e error, const char *path, void *user_data);
@@ -256,16 +359,18 @@ typedef void (*media_thumbnail_completed_cb)(media_content_error_e error, const
 
 /**
  * @ingroup CAPI_CONTENT_MEDIA_FOLDER_MODULE
- * @brief Iterates over a list of folders.
+ * @brief Called for every available media folder.
  *
- * @details This callback is called for every available media folder.\n
+ * @details Iterates over a list of folders.
  *
- * @remarks To use the @a folder outside this function, copy the handle with #media_folder_clone() function.
+ * @remarks To use the @a folder outside this function, copy the handle with the media_folder_clone() function.
  *
- * @param[in] folder The handle to media folder
+ * @param[in] folder    The handle to the media folder
  * @param[in] user_data The user data passed from the foreach function
- * @return true to continue with the next iteration of the loop,
- * @return false to break out of the loop.
+ *
+ * @return @c true to continue with the next iteration of the loop,
+ *         otherwise @c false to break out of the loop
+ *
  * @pre media_folder_foreach_folder_from_db() will invoke this function.
  * @see media_folder_clone()
  * @see media_folder_foreach_folder_from_db()
@@ -274,17 +379,20 @@ typedef bool (*media_folder_cb)(media_folder_h folder, void *user_data);
 
 /**
  * @ingroup CAPI_CONTENT_MEDIA_PLAYLIST_MODULE
- * @brief Iterates over playlist list.
+ * @brief Called for every playlist in the obtained list of playlists.
  *
- * @details This callback is called for every playlist in obtained list of playlists.\n
+ * @details Iterates over a playlist list.
  *
- * @remarks To use the @a playlist outside this function, copy the handle with #media_playlist_clone() function.
+ * @remarks To use the @a playlist outside this function, copy the handle with the media_playlist_clone() function.
  *
- * @param[in] playlist The handle to media playlist
+ * @param[in] playlist  The handle to the media playlist
  * @param[in] user_data The user data passed from the foreach function
- * @return true to continue with the next iteration of the loop,
- * @return false to break out of the loop.
+ *
+ * @return @c true to continue with the next iteration of the loop,
+ *         otherwise @c false to break out of the loop
+ *
  * @pre media_playlist_foreach_playlist_from_db() will invoke this function.
+ *
  * @see media_playlist_clone()
  * @see media_playlist_foreach_playlist_from_db()
  */
@@ -292,18 +400,21 @@ typedef bool (*media_playlist_cb)(media_playlist_h playlist, void *user_data);
 
 /**
  * @ingroup CAPI_CONTENT_MEDIA_PLAYLIST_MODULE
- * @brief Iterates over playlist member.
+ * @brief Called for every media info with playlist member ID in the obtained list of media info.
  *
- * @details This callback is called for every media info with playlist member ID in obtained list of media info.\n
+ * @details Iterates over playlist members.
  *
- * @remarks To use the @a media outside this function, copy the handle with #media_info_clone() function.
+ * @remarks To use the @a media outside this function, copy the handle with the media_info_clone() function.
+ *
+ * @param[in] playlist_member_id The ID to member of the playlist
+ * @param[in] media              The handle to the media info
+ * @param[in] user_data          The user data passed from the foreach function
+ *
+ * @return @c true to continue with the next iteration of the loop,
+ *         otherwise @c false to break out of the loop
  *
- * @param[in] playlist_member_id The ID to member of playlist
- * @param[in] media The handle to media info
- * @param[in] user_data The user data passed from the foreach function
- * @return true to continue with the next iteration of the loop,
- * @return false to break out of the loop.
  * @pre media_playlist_foreach_media_from_db() will invoke this function.
+ *
  * @see media_info_clone()
  * @see media_playlist_foreach_media_from_db()
  */
@@ -311,17 +422,20 @@ typedef bool(* playlist_member_cb)(int playlist_member_id, media_info_h media, v
 
 /**
  * @ingroup CAPI_CONTENT_MEDIA_TAG_MODULE
- * @brief Iterates over a list of tags
+ * @brief Called for every tag in the obtained list of tags.
  *
- * @details This callback is called for every tag in the obtained list of tags.\n
+ * @details Iterates over a list of tags.
  *
- * @remarks To use the @a tag outside this function, copy the handle with #media_tag_clone() function.
+ * @remarks To use the @a tag outside this function, copy the handle with the media_tag_clone() function.
  *
- * @param[in] tag The handle to media tag
+ * @param[in] tag       The handle to the media tag
  * @param[in] user_data The user data passed from the foreach function
- * @return true to continue with the next iteration of the loop,
- * @return false to break out of the loop.
+ *
+ * @return @c true to continue with the next iteration of the loop,
+ *         otherwise @c false to break out of the loop
+ *
  * @pre media_tag_foreach_tag_from_db(), media_info_foreach_tag_from_db() will invoke this function.
+ *
  * @see media_tag_clone()
  * @see media_tag_foreach_tag_from_db()
  * @see media_info_foreach_tag_from_db()
@@ -330,57 +444,61 @@ typedef bool (*media_tag_cb)(media_tag_h tag, void *user_data);
 
 /**
  * @ingroup CAPI_CONTENT_MEDIA_BOOKMARK_MODULE
- * @brief Iterates over bookmark list
+ * @brief Called for every bookmark in the obtained list of bookmarks.
  *
- * @details This callback is called for every bookmark in obtained list of bookmarks.\n
+ * @details Iterates over a bookmark list.
  *
- * @remarks To use the @a bookmark outside this function, copy the handle with #media_bookmark_clone() function.
+ * @remarks To use the @a bookmark outside this function, copy the handle with the media_bookmark_clone() function.
  *
- * @param[in] bookmark The handle to video bookmark
+ * @param[in] bookmark  The handle to the video bookmark
  * @param[in] user_data The user data passed from the foreach function
- * @return true to continue with the next iteration of the loop,
- * @return false to break out of the loop.
- * @pre media_bookmark_foreach_bookmark_from_db() will invoke this function.
- * @see media_bookmark_foreach_bookmark_from_db()
+ *
+ * @return @c true to continue with the next iteration of the loop,
+ *         otherwise @c false to break out of the loop
+ *
+ * @pre media_info_foreach_bookmark_from_db() will invoke this function.
+ *
+ * @see media_info_foreach_bookmark_from_db()
  */
 typedef bool (*media_bookmark_cb)(media_bookmark_h bookmark, void *user_data);
 
 /**
  * @ingroup CAPI_CONTENT_MEDIA_ALBUM_MODULE
- * @brief Iterates over album list
+ * @brief Called for every album in the obtained list of groups.
  *
- * @details This callback is called for every album in obtained list of groups.\n
+ * @details Iterates over an album list.
  *
- * @remarks To use the @a album outside this function, copy the handle with #media_album_clone() function.
+ * @remarks To use the @a album outside this function, copy the handle with the media_album_clone() function.
  *
- * @param[in] album The handle to media album
+ * @param[in] album     The handle to the media album
  * @param[in] user_data The user data passed from the foreach function
- * @return true to continue with the next iteration of the loop,
- * @return false to break out of the loop.
+ *
+ * @return @c true to continue with the next iteration of the loop,
+ *         otherwise @c false to break out of the loop
+ *
  * @pre media_album_foreach_album_from_db() will invoke this function.
+ *
  * @see media_album_clone()
  * @see media_album_foreach_album_from_db()
  */
 typedef bool (*media_album_cb)(media_album_h album, void *user_data);
 
-typedef bool (*media_artist_cb)(const char *artist, void *user_data);
-typedef bool (*media_genre_cb)(const char *genre, void *user_data);
-typedef bool (*media_composer_cb)(const char *composer, void *user_data);
-typedef bool (*media_year_cb)(const char *year, void *user_data);
-
 /**
  * @ingroup CAPI_CONTENT_MEDIA_GROUP_MODULE
- * @brief Iterates over media group list
+ * @brief Called for every group in the obtained list of groups.
  *
- * @details This callback is called for every group in obtained list of groups.\n
+ * @details Iterates over a media group list.
  *
- * @remarks You should not free group_name returned by this function.
+ * @remarks You should not free @a group_name returned by this function.
+ *
+ * @param[in] group_name The name of the media group
+ * @param[in] user_data  The user data passed from the foreach function
+ *
+ * @return @c true to continue with the next iteration of the loop,
+ *         otherwise @c false to break out of the loop
  *
- * @param[in] group_name The name of media group
- * @param[in] user_data The user data passed from the foreach function
- * @return true to continue with the next iteration of the loop,
- * @return false to break out of the loop.
  * @pre media_group_foreach_group_from_db() will invoke this function.
+ *
  * @see media_group_foreach_group_from_db()
  */
 typedef bool (*media_group_cb)(const char *group_name, void *user_data);
@@ -390,54 +508,78 @@ typedef bool (*media_group_cb)(const char *group_name, void *user_data);
  */
 
 /**
- * @addtogroup CAPI_CONTENT_MEDIA_INFO_MODULE
+ * @addtogroup CAPI_CONTENT_MEDIA_FILTER_MODULE
  * @{
+ * @brief You can use above defines to set the condition of media filter and order keyword.
  *
  */
-#define MEDIA_ID "MEDIA_ID"    /**< media id */
-#define MEDIA_PATH "MEDIA_PATH"        /**< media full path */
-#define MEDIA_DISPLAY_NAME "MEDIA_DISPLAY_NAME"        /**< media base name */
-#define MEDIA_TYPE "MEDIA_TYPE"                /**< media type. 0-image, 1-video, 2-sound, 3-music, 4-other*/
-#define MEDIA_MIME_TYPE "MEDIA_MIME_TYPE"      /**< media mime type */
-#define MEDIA_SIZE "MEDIA_SIZE"                                /**< media mime size */
-#define MEDIA_ADDED_TIME "MEDIA_ADDED_TIME"    /**< media added time */
-#define MEDIA_MODIFIED_TIME "MEDIA_MODIFIED_TIME"              /**< media modified time */
-#define MEDIA_THUMBNAIL_PATH "MEDIA_THUMBNAIL_PATH"    /**< media thumbnail path */
-#define MEDIA_TITLE "MEDIA_TITLE"              /**< media title get from tag or file name */
-#define MEDIA_ALBUM "MEDIA_ALBUM"      /**< media album name*/
-#define MEDIA_ARTIST "MEDIA_ARTIST"            /**< media artist*/
-#define MEDIA_GENRE "MEDIA_GENRE"              /**< media genre*/
-#define MEDIA_COMPOSER "MEDIA_COMPOSER"        /**< media composer*/
-#define MEDIA_YEAR "MEDIA_YEAR"                /**< media year*/
-#define MEDIA_RECORDED_DATE "MEDIA_RECORDED_DATE"      /**< media recorded date*/
-#define MEDIA_COPYRIGHT "MEDIA_COPYRIGHT"              /**< media copyright*/
-#define MEDIA_TRACK_NUM "MEDIA_TRACK_NUM"      /**< media track number*/
-#define MEDIA_DESCRIPTION "MEDIA_DESCRIPTION"  /**< media description*/
-#define MEDIA_BITRATE "MEDIA_BITRATE"          /**< media bitrate*/
-#define MEDIA_SAMPLERATE "MEDIA_SAMPLERATE"    /**< media sample rate*/
-#define MEDIA_CHANNEL "MEDIA_CHANNEL"  /**< media channel*/
-#define MEDIA_DURATION "MEDIA_DURATION"        /**< media duration */
-#define MEDIA_LONGITUDE "MEDIA_LONGITUDE"              /**< media longitude */
-#define MEDIA_LATITUDE "MEDIA_LATITUDE"        /**< media latitude */
-#define MEDIA_ALTITUDE "MEDIA_ALTITUDE"        /**< media altitude */
-#define MEDIA_WIDTH "MEDIA_WIDTH"      /**< media width*/
-#define MEDIA_HEIGHT "MEDIA_HEIGHT"    /**< media height*/
-#define MEDIA_DATETAKEN "MEDIA_DATETAKEN"      /**< media datetaken*/
-#define MEDIA_ORIENTATION "MEDIA_ORIENTATION"  /**< media orientation*/
-#define MEDIA_PLAYED_COUNT "MEDIA_PLAYED_COUNT"        /**< media playedcount*/
-#define MEDIA_LAST_PLAYED_TIME "MEDIA_LAST_PLAYED_TIME"        /**< media last played time*/
-#define MEDIA_LAST_PLAYED_POSITION "MEDIA_LAST_PLAYED_POSITION"        /**< media last played position of file*/
-#define MEDIA_RATING "MEDIA_RATING"    /**< media rating*/
-#define MEDIA_FAVOURITE "MEDIA_FAVORITE"       /**< 0-not favourite, 1-favourite*/
-#define MEDIA_AUTHOR "MEDIA_AUTHOR"    /**< media authore*/
-#define MEDIA_PROVIDER "MEDIA_PROVIDER"        /**< media provider*/
-#define MEDIA_CONTENT_NAME "MEDIA_CONTENT_NAME"        /**< media content name*/
-#define MEDIA_CATEGORY "MEDIA_CATEGORY"        /**< media category*/
-#define MEDIA_LOCATION_TAG "MEDIA_LOCATION_TAG"        /**< media location tag*/
-#define MEDIA_AGE_RATING "MEDIA_AGE_RATING"    /**< media age rating*/
-#define MEDIA_KEYWORD "MEDIA_KEYWORD"  /**< media keyword*/
-#define MEDIA_IS_DRM "MEDIA_IS_DRM"    /**< is drm. 0-not drm, 1-drm*/
-#define MEDIA_STORAGE_TYPE "MEDIA_STORAGE_TYPE"        /**< media storage. 0-internal storage, 1-external storage*/
+#define MEDIA_ID "MEDIA_ID" /**< Media ID */
+#define MEDIA_PATH "MEDIA_PATH"  /**< Media full path */
+#define MEDIA_DISPLAY_NAME "MEDIA_DISPLAY_NAME"  /**< Media base name */
+#define MEDIA_TYPE "MEDIA_TYPE"  /**< Media type: 0-image, 1-video, 2-sound, 3-music, 4-other*/
+#define MEDIA_MIME_TYPE "MEDIA_MIME_TYPE"  /**< Media MIME type */
+#define MEDIA_SIZE "MEDIA_SIZE"  /**< Media MIME size */
+#define MEDIA_ADDED_TIME "MEDIA_ADDED_TIME"  /**< Media added time */
+#define MEDIA_MODIFIED_TIME "MEDIA_MODIFIED_TIME"  /**< Media modified time */
+#define MEDIA_TIMELINE "MEDIA_TIMELINE"  /**< Media modified time */
+#define MEDIA_THUMBNAIL_PATH "MEDIA_THUMBNAIL_PATH"  /**< Media thumbnail path */
+#define MEDIA_TITLE "MEDIA_TITLE"  /**< Media title get from tag or file name */
+#define MEDIA_ALBUM "MEDIA_ALBUM"  /**< Media album name*/
+#define MEDIA_ARTIST "MEDIA_ARTIST"  /**< Media artist*/
+#define MEDIA_ALBUM_ARTIST "MEDIA_ALBUM_ARTIST"  /**< Media album_artist*/
+#define MEDIA_GENRE "MEDIA_GENRE"  /**< Media genre*/
+#define MEDIA_COMPOSER "MEDIA_COMPOSER"  /**< Media composer*/
+#define MEDIA_YEAR "MEDIA_YEAR"  /**< Media year*/
+#define MEDIA_RECORDED_DATE "MEDIA_RECORDED_DATE"  /**< Media recorded date*/
+#define MEDIA_COPYRIGHT "MEDIA_COPYRIGHT"  /**< Media copyright*/
+#define MEDIA_TRACK_NUM "MEDIA_TRACK_NUM"  /**< Media track number*/
+#define MEDIA_DESCRIPTION "MEDIA_DESCRIPTION"  /**< Media description*/
+#define MEDIA_BITRATE "MEDIA_BITRATE"  /**< Media bitrate*/
+#define MEDIA_BITPERSAMPLE "MEDIA_BITPERSAMPLE"  /**< Media bit per sample*/
+#define MEDIA_SAMPLERATE "MEDIA_SAMPLERATE"  /**< Media sample rate*/
+#define MEDIA_CHANNEL "MEDIA_CHANNEL"  /**< Media channel*/
+#define MEDIA_DURATION "MEDIA_DURATION"  /**< Media duration */
+#define MEDIA_LONGITUDE "MEDIA_LONGITUDE"  /**< Media longitude */
+#define MEDIA_LATITUDE "MEDIA_LATITUDE"  /**< Media latitude */
+#define MEDIA_ALTITUDE "MEDIA_ALTITUDE"  /**< Media altitude */
+#define MEDIA_WIDTH "MEDIA_WIDTH"  /**< Media width*/
+#define MEDIA_HEIGHT "MEDIA_HEIGHT"  /**< Media height*/
+#define MEDIA_DATETAKEN "MEDIA_DATETAKEN"  /**< Media datetaken*/
+#define MEDIA_ORIENTATION "MEDIA_ORIENTATION"  /**< Media orientation*/
+#define MEDIA_BURST_ID "BURST_ID"  /**< Media burst ID*/
+#define MEDIA_PLAYED_COUNT "MEDIA_PLAYED_COUNT"  /**< Media playedcount*/
+#define MEDIA_LAST_PLAYED_TIME "MEDIA_LAST_PLAYED_TIME"  /**< Media last played time*/
+#define MEDIA_LAST_PLAYED_POSITION "MEDIA_LAST_PLAYED_POSITION"  /**< Media last played position of file*/
+#define MEDIA_RATING "MEDIA_RATING"  /**< Media rating*/
+#define MEDIA_FAVOURITE "MEDIA_FAVOURITE"  /**< 0-not favourite, 1-favourite*/
+#define MEDIA_AUTHOR "MEDIA_AUTHOR"  /**< Media authore*/
+#define MEDIA_PROVIDER "MEDIA_PROVIDER"  /**< Media provider*/
+#define MEDIA_CONTENT_NAME "MEDIA_CONTENT_NAME"  /**< Media content name*/
+#define MEDIA_CATEGORY "MEDIA_CATEGORY"  /**< Media category*/
+#define MEDIA_LOCATION_TAG "MEDIA_LOCATION_TAG"  /**< Media location tag*/
+#define MEDIA_AGE_RATING "MEDIA_AGE_RATING"  /**< Media age rating*/
+#define MEDIA_KEYWORD "MEDIA_KEYWORD"  /**< Media keyword*/
+#define MEDIA_WEATHER "MEDIA_WEATHER"  /**< Media weather*/
+#define MEDIA_IS_DRM "MEDIA_IS_DRM"  /**< Is DRM. 0-not drm, 1-drm*/
+#define MEDIA_STORAGE_TYPE "MEDIA_STORAGE_TYPE"  /**< Media storage. 0-internal storage, 1-external storage*/
+
+#define MEDIA_FILE_NAME_PINYIN "MEDIA_FILE_NAME_PINYIN"  /**< Media file name pinyin */
+#define MEDIA_TITLE_PINYIN "MEDIA_TITLE_PINYIN"  /**< Media title pinyin */
+#define MEDIA_ALBUM_PINYIN "MEDIA_ALBUM_PINYIN"  /**< Media album pinyin*/
+#define MEDIA_ARTIST_PINYIN "MEDIA_ARTIST_PINYIN"  /**< Media artist pinyin*/
+#define MEDIA_ALBUM_ARTIST_PINYIN "MEDIA_ALBUM_ARTIST_PINYIN"  /**< Media album_artist pinyin*/
+#define MEDIA_GENRE_PINYIN "MEDIA_GENRE_PINYIN"  /**< Media genre pinyin*/
+#define MEDIA_COMPOSER_PINYIN "MEDIA_COMPOSER_PINYIN"  /**< Media composer pinyin*/
+#define MEDIA_COPYRIGHT_PINYIN "MEDIA_COPYRIGHT_PINYIN"  /**< Media copyright pinyin*/
+#define MEDIA_DESCRIPTION_PINYIN "MEDIA_DESCRIPTION_PINYIN"  /**< Media description pinyin*/
+#define MEDIA_AUTHOR_PINYIN "MEDIA_AUTHOR_PINYIN"  /**< Media authore pinyin*/
+#define MEDIA_PROVIDER_PINYIN "MEDIA_PROVIDER_PINYIN"  /**< Media provider pinyin*/
+#define MEDIA_CONTENT_NAME_PINYIN "MEDIA_CONTENT_NAME_PINYIN"  /**< Media content name pinyin*/
+#define MEDIA_CATEGORY_PINYIN "MEDIA_CATEGORY_PINYIN"  /**< Media category pinyin*/
+#define MEDIA_LOCATION_TAG_PINYIN "MEDIA_LOCATION_TAG_PINYIN"  /**< Media location tag pinyin*/
+#define MEDIA_AGE_RATING_PINYIN "MEDIA_AGE_RATING_PINYIN"  /**< Media age rating pinyin*/
+#define MEDIA_KEYWORD_PINYIN "MEDIA_KEYWORD_PINYIN"  /**< Media keyword pinyin*/
+
 /**
  * @}
  */
@@ -448,11 +590,12 @@ typedef bool (*media_group_cb)(const char *group_name, void *user_data);
  * @addtogroup CAPI_CONTENT_MEDIA_FOLDER_MODULE
  * @{
  */
-#define FOLDER_ID "FOLDER_ID"  /**< folder id */
-#define FOLDER_PATH "FOLDER_PATH"      /**< folder full path */
-#define FOLDER_NAME "FOLDER_NAME"              /**< folder base name */
-#define FOLDER_MODIFIED_TIME "FOLDER_MODIFIED_TIME"    /**< folder modified time */
-#define FOLDER_STORAGE_TYPE "FOLDER_STORAGE_TYPE"      /**< folder storage. 0-internal storage, 1-external storage*/
+#define FOLDER_ID "FOLDER_ID"  /**< Folder ID */
+#define FOLDER_PATH "FOLDER_PATH"  /**< Folder full path */
+#define FOLDER_NAME "FOLDER_NAME"  /**< Folder base name */
+#define FOLDER_MODIFIED_TIME "FOLDER_MODIFIED_TIME"  /**< Folder modified time */
+#define FOLDER_STORAGE_TYPE "FOLDER_STORAGE_TYPE"  /**< Folder storage. 0-internal storage, 1-external storage*/
+#define FOLDER_NAME_PINYIN "FOLDER_NAME_PINYIN"  /**< Folder base name pinyin*/
 
 /**
  * @}
@@ -462,9 +605,9 @@ typedef bool (*media_group_cb)(const char *group_name, void *user_data);
  * @addtogroup CAPI_CONTENT_MEDIA_PLAYLIST_MODULE
  * @{
  */
-#define PLAYLIST_NAME "PLAYLIST_NAME"  /**< playlist name */
-#define PLAYLIST_MEMBER_ORDER "PLAYLIST_MEMBER_ORDER"  /**< playlist name */
-#define PLAYLIST_MEDIA_COUNT "PLAYLIST_MEDIA_COUNT" /**< media count in playlist view */
+#define PLAYLIST_NAME "PLAYLIST_NAME"  /**< Playlist name */
+#define PLAYLIST_MEMBER_ORDER "PLAYLIST_MEMBER_ORDER"  /**< Playlist name */
+#define PLAYLIST_MEDIA_COUNT "PLAYLIST_MEDIA_COUNT"  /**< Media count in playlist view */
 
 /**
  * @}
@@ -474,8 +617,8 @@ typedef bool (*media_group_cb)(const char *group_name, void *user_data);
  * @addtogroup CAPI_CONTENT_MEDIA_TAG_MODULE
  * @{
  */
-#define TAG_NAME "TAG_NAME"    /**< tag name */
-#define TAG_MEDIA_COUNT "TAG_MEDIA_COUNT"      /**< media count in tag view */
+#define TAG_NAME "TAG_NAME"  /**< Tag name */
+#define TAG_MEDIA_COUNT "TAG_MEDIA_COUNT"  /**< Media count in tag view */
 
 /**
  * @}
@@ -485,7 +628,7 @@ typedef bool (*media_group_cb)(const char *group_name, void *user_data);
  * @addtogroup CAPI_CONTENT_MEDIA_BOOKMARK_MODULE
  * @{
  */
-#define BOOKMARK_MARKED_TIME "BOOKMARK_MARKED_TIME"    /**< bookmark marked time */
+#define BOOKMARK_MARKED_TIME "BOOKMARK_MARKED_TIME"  /**< Bookmark marked time */
 
 /**
  * @}
index 0592961..3508df0 100755 (executable)
@@ -27,6 +27,14 @@ extern "C" {
 #endif /* __cplusplus */
 
 /**
+ * @file media_filter.h
+ * @brief This file contains the media filter API and related operation with filters. \n
+ *        The functions include: creating and destroying media filter handles that are used to get the filtered information,  \n
+ *        making free all resources related to the filter handle, limiting number of items returned, setting conditions for the filter,  \n
+ *        setting and getting media filter's content order and ordering keyword either descending or ascending.
+ */
+
+/**
  * @addtogroup CAPI_CONTENT_MEDIA_FILTER_MODULE
  * @{
  */
@@ -34,131 +42,182 @@ extern "C" {
 /**
  * @brief Creates a media filter handle.
  * @details This function creates a media filter handle. The handle can be
- * used to get filtered information based on filter properties i.e. offset, count, condition for searching and order.
- * @remarks The @a filter handle must be released with media_info_filter_destroy() by you.
- * @param[out] filter A handle to media filter
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ *          used to get the filtered information based on filter properties i.e. offset, count, condition for searching and order.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remarks You must release the @a filter handle using media_info_filter_destroy().
+ *
+ * @param[out] filter A handle to the media filter
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @see media_filter_destroy()
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  *
+ * @see media_filter_destroy()
  */
 int media_filter_create(filter_h *filter);
 
 /**
  * @brief Destroys a media filter handle.
  * @details The function frees all resources related to the media filter handle. The filter
- * handle no longer can be used to perform any operation. A new filter handle
- * has to be created before the next usage.
+ *          handle no longer can be used to perform any operation. A new filter handle
+ *          has to be created before the next usage.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] filter The handle to media filter
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in] filter The handle to the media filter
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @see media_filter_create()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  *
+ * @see media_filter_create()
  */
 int media_filter_destroy(filter_h filter);
 
 /**
- * @brief Set the media filter's offset and count.
- * @details This function set the @a offset and @a count for the given filter used to limit number of items returned.
- * For example, if you set the @a offset as 10 and @a count as 5, then only searched data from 10 to 14 will be returned when the filter is used with foreach functions.
- *
- * @param[in] filter The handle to media filter
- * @param[in] offset The start position of the given filter(Starting from zero).
- * @param[in] count The number of items to be searched with respect to offset
- * @return return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @brief Sets the media filter offset and count.
+ * @details This function sets the @a offset and @a count for the given filter used to limit number of items returned.
+ *          For example, if you set the @a offset as @c 10 and @a count as @c 5, then only searched data from @c 10 to @c 14 will be returned when the filter is used with foreach functions.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] filter The handle to the media filter
+ * @param[in] offset The start position of the given filter (Starting from zero)
+ * @param[in] count  The number of items to be searched with respect to the offset
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @see media_filter_create()
  * @see media_filter_destroy()
  */
 int media_filter_set_offset(filter_h filter, int offset, int count);
 
 /**
- * @brief Set the @a condition for given @a filter.
+ * @brief Sets the @a condition for the given @a filter.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] filter The handle to media filter
- * @param[in] condition The condition which is used WHERE clause on a query
+ * @param[in] filter       The handle to the media filter
+ * @param[in] condition    The condition which is used WHERE clause on a query
  * @param[in] collate_type The collate type for comparing two strings
- * @return return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @see media_filter_create()
  * @see media_filter_destroy()
  */
 int media_filter_set_condition(filter_h filter, const char *condition, media_content_collation_e collate_type);
 
 /**
- * @brief Set the media filter's content @a order and @a order @a keyword either descending or ascending.
+ * @brief Sets the media filter content @a order and order keyword i.e. either descending or ascending.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] filter The handle to media filter
- * @param[in] order_type The search order type
+ * @param[in] filter        The handle to the media filter
+ * @param[in] order_type    The search order type
  * @param[in] order_keyword The search order keyword
- * @param[in] collate_type The collate type for comparing two strings
- * @return return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in] collate_type  The collate type for comparing two strings
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @see media_filter_create()
  * @see media_filter_destroy()
  */
 int media_filter_set_order(filter_h filter, media_content_order_e order_type, const char *order_keyword, media_content_collation_e collate_type);
 
 /**
- * @brief Gets the @a offset and @a count for the given @a filter used to limit number of items returned.
+ * @brief Gets the @a offset and @a count for the given @a filter used to limit the number of items returned.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in]  filter The handle to the media filter
+ * @param[out] offset The start position of the given filter (Starting from zero)
+ * @param[out] count  The number of items to be searched with respect to the offset
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
- * @param[in] filter The handle to Media filter
- * @param[out] offset The start position of the given filter(Starting from zero)
- * @param[out] count The number of items to be searched with respect to offset
- * @return return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @see media_filter_create()
  * @see media_filter_destroy()
  */
 int media_filter_get_offset(filter_h filter, int *offset, int *count);
 
 /**
- * @brief Get the @a condition for given @a filter.
+ * @brief Gets the @a condition for the given @a filter.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remarks You must release @a condition using free().
  *
- * @remarks @a condition must be released with free() by you.
- * @param[in] filter The handle to media info filter
- * @param[out] condition The condition which is used WHERE clause on a query
+ * @param[in]  filter       The handle to the media info filter
+ * @param[out] condition    The condition which is used WHERE clause on a query
  * @param[out] collate_type The collate type for comparing two strings
- * @return return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @see media_filter_create()
  * @see media_filter_destroy()
  */
 int media_filter_get_condition(filter_h filter, char **condition, media_content_collation_e *collate_type);
 
 /**
- * @brief Get the media filter's content @a order and @a order @a keyword either descending or ascending.
+ * @brief Gets the media filter's content @a order and order keyword i.e. either descending or ascending.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a order_keyword must be released with free() by you.
- * @param[in] filter The handle to media filter
- * @param[out] order_type The search order type
+ * @remarks You must release @a order_keyword using free().
+ *
+ * @param[in]  filter        The handle to the media filter
+ * @param[out] order_type    The search order type
  * @param[out] order_keyword The search order keyword
- * @param[out] collate_type The collate type for comparing two strings
- * @return return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[out] collate_type  The collate type for comparing two strings
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @see media_filter_create()
  * @see media_filter_destroy()
  */
 int media_filter_get_order(filter_h filter, media_content_order_e* order_type, char **order_keyword, media_content_collation_e *collate_type);
 
-
 /**
  * @}
  */
 
-
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index 38f7899..1660b46 100755 (executable)
@@ -27,97 +27,154 @@ extern "C" {
 #endif /* __cplusplus */
 
 /**
+ * @file media_folder.h
+ * @brief This file contains API related to all operations with media folder in DB. \n
+ *        These functions include getting the number of folders and media files filtered from DB,  \n
+ *        iterating through media files and folders filtered in the given folder from DB;  \n
+ *        cloning and destroying the media folder, getting its name, ID, absolute path and date \n
+ *        and updating the media folder to the media database.
+ */
+
+/**
  * @addtogroup CAPI_CONTENT_MEDIA_FOLDER_MODULE
  * @{
  */
 
+
 /**
- * @brief Gets the number of folder for the passed @a filter from the media database.
+ * @brief Gets the count of folder for the passed @a filter from the media database.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in]  filter       The handle to filter \n
+ *                          To allow searching over different content types, you should use #filter_h.
+ * @param[out] folder_count The count of the media folder
  *
- * @param[in] filter The handle to filter. \n To allow searching over different content types, you should use @a filter_h.
- * @param[out] folder_count The count of media folder
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
- * @see media_content_connect()
  *
+ * @see media_content_connect()
  */
 int media_folder_get_folder_count_from_db(filter_h filter, int *folder_count);
 
 /**
  * @brief Iterates through available media folders with optional @a filter from the media database.
- * @details This function gets media folder handles meeting the given 
- * @a filter. The @a callback function will be invoked for every retrieved
- * folder. If NULL is passed to the @a filter, no filtering is applied.
+ * @details This function gets the media folder meeting the given @a filter.
+ *          The @a callback function will be invoked for every retrieved
+ *          folder. If @c NULL is passed to the @a filter, no filtering is applied.
  *
- * @param[in] filter The handle to media folder filter
- * @param[in] callback The callback function to invoke
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remarks Do not call updating DB fuction like media_folder_update_to_db() in your callback function, your callback function is invoked as inline function.\n
+ *                   So, your callback function is in read state in SQLite. When you are in read state, sometimes you do not update DB. \n
+ *                   We do not recommend you call updating DB function in callback of foreach function.
+ *
+ * @param[in] filter    The handle to the media folder filter
+ * @param[in] callback  The callback function to be invoked
  * @param[in] user_data The user data to be passed to the callback function
- * @return return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @pre This function requires opened connection to content service by media_content_connect().
- * @pre A filter handle has to be created by calling media_folder_filter_create()
- * @post This function invokes media_folder_cb()
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre  This function requires opened connection to content service by media_content_connect().
+ * @pre  A filter handle has to be created by calling media_filter_create().
+ * @post This function invokes media_folder_cb().
+ *
  * @see media_content_connect()
- * @see #media_folder_cb
+ * @see media_folder_cb()
  * @see media_filter_create()
  */
 int media_folder_foreach_folder_from_db(filter_h filter, media_folder_cb callback, void *user_data);
 
 /**
- * @brief Gets the number of media files for the passed @a filter in the given @a folder from the media database.
+ * @brief Gets the count of media files for the passed @a filter in the given @a folder from the media database.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] folder_id The ID of media folder
- * @param[in] filter The filter of media content
+ * @param[in] folder_id    The ID of the media folder
+ * @param[in] filter       The filter of the media content
  * @param[out] media_count The count of media folder items
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
- * @see media_content_connect()
  *
+ * @see media_content_connect()
  */
 int media_folder_get_media_count_from_db(const char *folder_id, filter_h filter, int *media_count);
 
 /**
- * @brief Iterates through the media files with optional @a filter in the given @a folder from the media database.
+ * @brief Iterates through the media files with an optional @a filter in the given @a folder from the media database.
  * @details This function gets all media files associated with the given folder and
- * meeting desired filter option and calls registered callback function for
- * every retrieved media item. If NULL is passed to the @a filter, no filtering is applied.
+ *          meeting desired filter option and calls registered callback function for
+ *          every retrieved media item. If @c NULL is passed to the @a filter, no filtering is applied.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] folder_id The ID of media folder
- * @param[in] filter The handle to media info filter
- * @param[in] callback The callback function to invoke
+ * @remarks   Do not call updating DB function like media_info_update_to_db(), media_info_refresh_metadata_to_db(), audio_meta_update_to_db(), image_meta_update_to_db() and video_meta_update_to_db()  in your callback function,
+ *                    your callback function is invoked as inline function. \n
+ *                    So, your callback function is in read state in SQLite. When you are in read state, sometimes you do not update DB. \n
+ *                    We do not recommend you call updating DB function in callback of foreach function.
+ *
+ * @param[in] folder_id The ID of the media folder
+ * @param[in] filter    The handle to the media info filter
+ * @param[in] callback  The callback function to be invoked
  * @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @pre This function requires opened connection to content service by media_content_connect().
- * @post This function invokes media_info_cb()
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre  This function requires opened connection to content service by media_content_connect().
+ * @post This function invokes media_info_cb().
+ *
  * @see #media_info_cb
  * @see media_content_connect()
- * @see media_folder_filter_create()
+ * @see media_filter_create()
  */
 int media_folder_foreach_media_from_db(const char *folder_id, filter_h filter, media_info_cb callback, void *user_data);
 
 /**
  * @brief Clones the media folder.
  * @details This function copies the media folder handle from a source to
- * destination. There is no media_folder_create() function. The media_folder_h is created internally and available through 
- * media folder foreach function such as media_folder_foreach_folder_from_db(). To use this handle outside of these foreach functions, 
- * use this function.
- * @remark The destination handle must be released with media_folder_destroy() by you.
- * @param[out] dst A destination handle to media folder
- * @param[in] src The source handle to media folder
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ *          destination. There is no media_folder_create() function. The media_folder_h is created internally and available through
+ *          media folder foreach function such as media_folder_foreach_folder_from_db(). To use this handle outside of these foreach functions,
+ *          use this function.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remarks The destination handle must be released with media_folder_destroy().
+ *
+ * @param[out] dst The destination handle to the media folder
+ * @param[in]  src The source handle to the media folder
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @see media_folder_destroy()
  * @see media_folder_foreach_folder_from_db()
  */
@@ -126,99 +183,135 @@ int media_folder_clone(media_folder_h *dst, media_folder_h src);
 /**
  * @brief Destroys the media folder.
  * @details The function frees all resources related to the folder handle. This handle
- * no longer can be used to perform any operation. A new handle has to
- * be created before the next use.
+ *          no longer can be used to perform any operation. A new handle has to
+ *          be created before the next use.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] folder The handle to the media folder
  *
- * @param[in] folder The handle to media folder
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre A copy of the media folder handle created by calling media_folder_clone()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre A copy of the media folder handle created by calling media_folder_clone().
+ *
  * @see media_folder_clone()
  */
 int media_folder_destroy(media_folder_h folder);
 
 /**
- * @brief Gets media folder's ID.
+ * @brief Gets the media folder ID.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remarks You must release @a folder_id using free().
  *
- * @remarks @a folder_id must be released with free() by you.
+ * @param[in]  folder    The handle to the media folder
+ * @param[out] folder_id The ID of the media folder
  *
- * @param [in] folder The handle to media folder
- * @param [out] folder_id The ID of media folder
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_folder_get_folder_id(media_folder_h folder, char **folder_id);
 
 /**
- * @brief Gets the absolute path to the folder.
+ * @brief Gets the absolute path to the media folder.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remarks You must release @a path using free().
  *
- * @remarks @a path must be released with free() by you.
+ * @param[in]  folder The handle to the media folder
+ * @param[out] path   The path of the media folder
  *
- * @param[in] folder The handle to media folder
- * @param[out] path The path of the media folder
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  *
  */
 int media_folder_get_path(media_folder_h folder, char **path);
 
 /**
- * @brief Gets the folder name.
+ * @brief Gets the media folder name.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a folder_name must be released with free() by you.
+ * @remarks You must release @a folder_name using free().
  *
- * @param[in] folder The handle to media folder
+ * @param[in]  folder      The handle to the media folder
  * @param[out] folder_name The name of the media folder
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
  *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_folder_get_name(media_folder_h folder, char **folder_name);
 
 /**
  * @brief Gets the modified date of the folder.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] folder The handle to media folder
- * @param[out] date The modified date of folder
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in]  folder The handle to the media folder
+ * @param[out] date   The modified date of the folder
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
  */
 int media_folder_get_modified_time(media_folder_h folder, time_t *date);
 
 /**
  * @brief Gets the folder storage type.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] folder The handle to media folder
+ * @param[in]  folder       The handle to the media folder
  * @param[out] storage_type The storage type of the media folder
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
  *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_folder_get_storage_type(media_folder_h folder, media_content_storage_e *storage_type);
 
 /**
  * @brief Gets the media folder from the media database.
  *
- * @details This function creates a new media folder handle from the media database by the given folder_id.
- * media folder will be created, which is filled with folder information.
+ * @details This function creates a new media folder handle from the media database by the given @a folder_id.
+ *          Media folder will be created, which is filled with folder information.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remarks You must release @a folder using media_folder_destroy().
  *
- * @remarks @a folder must be released with media_folder_destroy() by you.
+ * @param[in]  folder_id The ID of the media folder
+ * @param[out] folder    The media folder handle associated with the folder ID
  *
- * @param[in] folder_id The ID of media folder
- * @param[out] folder The media folder handle associated with the folder ID
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
+ *
  * @see media_content_connect()
  * @see media_folder_destroy()
  *
@@ -228,33 +321,49 @@ int media_folder_get_folder_from_db(const char *folder_id, media_folder_h *folde
 /**
  * @brief Updates the media folder to the media database.
  *
- * @details The function updates the given media folder in the media database. The function should be called after any change in folder attributes, to be updated to the media 
- * database. For example, after using media_folder_set_name() for setting the name of the folder, media_folder_update_to_db() function should be called so as to update 
- * the given folder attibutes in the media database.
+ * @details The function updates the given media folder in the media database. The function should be called after any change in folder attributes, to be updated to the media
+ *          database. For example, after using media_folder_set_name() for setting the name of the folder, the media_folder_update_to_db() function should be called so as to update
+ *          the given folder attributes in the media database.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write
+ *
+ * @param[in] folder The handle to the media folder
  *
- * @param[in] folder The handle to media folder
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
+ * @pre If you do not set new name of folder by using media_folder_set_name(), your updating function is failed.
+ *
  * @see media_content_connect()
  * @see media_folder_destroy()
  * @see media_folder_set_name()
- *
  */
 int media_folder_update_to_db(media_folder_h folder);
 
 /**
  * @brief Sets the folder name.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] folder The handle to media folder
- * @param[in] name The name of the media folder
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in] folder The handle to the media folder
+ * @param[in] name   The name of the media folder
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @post media_folder_update_to_db()
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  *
+ * @post media_folder_update_to_db()
  */
 int media_folder_set_name(media_folder_h folder, const char *name);
 
index 9159a85..ab3e021 100755 (executable)
@@ -26,76 +26,113 @@ extern "C" {
 #endif /* __cplusplus */
 
 /**
+ * @file media_group.h
+ * @brief This file contains API related to handling different operations with album and other media data groups in DB.
+ *        The following APIs are capable to get number of albums, media info in the given album from DB, \n
+ *        to clone, destroy and get all albums and media files associated with the given media album from DB,  \n
+ *        to get name, ID, artist, album art path from album; to get number of groups and their names, \n
+ *        to get the number of media files and their content associated with the given group from DB.
+ */
+
+/**
  * @addtogroup CAPI_CONTENT_MEDIA_ALBUM_MODULE
  * @{
  */
 
 /**
- * @brief Gets the number of album for the passed @a filter from the media database.
+ * @brief Gets the number of the album for the passed @a filter from the media database.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] filter The handle to media filter.
- * @param[out] album_count The count of media album
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  filter      The media filter handle
+ * @param[out] album_count The count of the media album
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
- * @see media_content_connect()
  *
+ * @see media_content_connect()
  */
 int media_album_get_album_count_from_db(filter_h filter, int *album_count);
 
 /**
  * @brief Iterates through the media album with optional @a filter from the media database.
  * @details This function gets all media album handles meeting the given filter.
- * The callback function will be invoked for every retrieved media album.
- * If NULL is passed to the filter, no filtering is applied.
- *
- * @param [in] filter The handle to media filter
- * @param [in] callback The callback function to invoke
- * @param [in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ *          The callback function will be invoked for every retrieved media album.
+ *          If @c NULL is passed to the filter, no filtering is applied.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] filter    The media filter handle
+ * @param[in] callback  The callback function to be invoked
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @pre This function requires opened connection to content service by media_content_connect().
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre  This function requires opened connection to content service by media_content_connect().
  * @post This function invokes media_album_cb().
+ *
  * @see #media_album_cb
  * @see media_content_connect()
  * @see media_filter_create()
- *
  */
 int media_album_foreach_album_from_db(filter_h filter, media_album_cb callback, void *user_data);
 
 /**
- * @brief Gets number of media info for the given album present in the media database.
+ * @brief Gets the number of media info for the given album present in the media database.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] album_id The ID of media album
- * @param [in] filter The handle to media filter
- * @param [out] media_count A count of album
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  album_id    The ID of the media album
+ * @param[in]  filter      The media filter handle
+ * @param[out] media_count The count of the album
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
+ *
  * @see media_content_connect()
  */
 int media_album_get_media_count_from_db (int album_id, filter_h filter, int *media_count);
 
 /**
- * @brief Iterates through the media files with optional @a filter in the given @a media @a album from the media database.
+ * @brief Iterates through the media files with an optional @a filter in the given media album from the media database.
  * @details This function gets all media files associated with the given media album and
- * meeting desired filter option and calls registered callback function for
- * every retrieved media info. If NULL is passed to the @a filter, no filtering is applied.
- *
- * @param [in] album_id The ID of media album
- * @param [in] filter The handle to media filter
- * @param [in] callback The callback function to invoke
- * @param [in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ *          meeting desired filter option and calls registered callback function for
+ *          every retrieved media info. If @c NULL is passed to the @a filter, no filtering is applied.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] album_id  The ID of the media album
+ * @param[in] filter    The media filter handle
+ * @param[in] callback  The callback function to be invoked
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre This function requires opened connection to content service by media_content_connect().
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre  This function requires opened connection to content service by media_content_connect().
  * @post This function invokes media_info_cb().
+ *
  * @see #media_info_cb
  * @see media_content_connect()
  * @see media_filter_create()
@@ -103,116 +140,155 @@ int media_album_get_media_count_from_db (int album_id, filter_h filter, int *med
 int media_album_foreach_media_from_db(int album_id, filter_h filter, media_info_cb callback, void *user_data);
 
 /**
- * @brief Destroys album handle.
- * @details Function frees all resources related to album handle. This handle
- * no longer can be used to perform any operation. A new handle has to
- * be created before the next use.
- *
- * @param [in] album The handle to media album
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @brief Destroys the album handle.
+ * @details This function frees all resources related to the album handle. This handle
+ *          can no longer be used to perform any operation. A new handle has to
+ *          be created before the next use.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] album The media album handle
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre Get copy of album handle by calling media_album_clone()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre Get copy of album handle by calling media_album_clone().
+ *
  * @see media_album_clone()
  */
 int media_album_destroy(media_album_h album);
 
 /**
- * @brief Clones media album.
+ * @brief Clones media album.
  * @details This function copies the media album handle from a source to
- * destination. There is no media_album_create() function. The media_album_h is created internally and available through 
- * media album foreach function such as media_album_foreach_album_from_db(). To use this handle outside of these foreach functions, 
- * use this function.
+ *          destination. There is no media_album_create() function. The media_album_h is created internally and available through
+ *          media album foreach function such as media_album_foreach_album_from_db(). To use this handle outside of these foreach functions,
+ *          use this function.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remarks You must release the destination handle using media_album_destroy().
+ *
+ * @param[in]  src  The source handle to the media album
+ * @param[out] dst  The destination handle to the media album
  *
- * @remark The destination handle must be released with media_album_destroy() by you.
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
- * @param [in] src The source handle to media album
- * @param [out] dst A destination handle to media album
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @see media_album_destroy()
  * @see media_album_foreach_album_from_db()
  */
 int media_album_clone(media_album_h *dst, media_album_h src);
 
 /**
- * @brief Gets a ID of the album.
+ * @brief Gets the ID of the album.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in]  album    The media album handle
+ * @param[out] album_id The media album ID
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
- * @param [in] album The handle to media album
- * @param [out] album_id A ID of media album
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @see media_album_foreach_album_from_db()
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  *
+ * @see media_album_foreach_album_from_db()
  */
 int media_album_get_album_id(media_album_h album, int *album_id);
 
 /**
- * @brief Gets a name of the album.
+ * @brief Gets the name of the album.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a album_name must be released with free() by you.
+ * @remarks You must release @a album_name using free().
  *
- * @param [in] album The handle to media album
- * @param [out] album_name A name of media album handle
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @param[in]  album       The media album handle
+ * @param[out] album_name  The name of the media album handle
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_album_get_name(media_album_h album, char **album_name);
 
 /**
- * @brief Gets a name of the artist from album.
+ * @brief Gets the name of the artist from the given album.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a artist must be released with free() by you.
+ * @remarks You must release @a artist using free().
  *
- * @param [in] album The handle to media album
- * @param [out] artist A name of media artist
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @param[in]  album  The media album handle
+ * @param[out] artist The name of the media artist
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_album_get_artist(media_album_h album, char **artist);
 
 /**
- * @brief Gets a album art path from album.
+ * @brief Gets the album art path from the album.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a album_art must be released with free() by you.
+ * @remarks You must release @a album_art using free().
  *
- * @param [in] album The handle to media album
- * @param [out] album_art A path of media album_art
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @param[in]  album     The media album handle
+ * @param[out] album_art The path of the media album_art
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_album_get_album_art(media_album_h album, char **album_art);
 
 /**
  * @brief Gets the media album from the media database.
  *
- * @details This function creates a new media album handle from the media database by the given album_id.
- * media album will be created, which is filled with album information.
+ * @details This function creates a new media album handle from the media database by the given @a album_id.
+ *          Media album will be created and will be filled with the album information.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a folder must be released with media_album_destroy() by you.
+ * @remarks You must release @a folder using media_album_destroy().
  *
- * @param[in] album_id The ID of media album
- * @param[out] album The album handle associated with the album ID
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  album_id The ID of the media album
+ * @param[out] album    The album handle associated with the album ID
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
+ *
  * @see media_content_connect()
  * @see media_album_destroy()
- *
  */
 int media_album_get_album_from_db(int album_id, media_album_h *album);
 
@@ -228,36 +304,49 @@ int media_album_get_album_from_db(int album_id, media_album_h *album);
 */
 
  /**
- * @brief Gets the number of group for the passed @a filter from the media database.
+ * @brief Gets the number of the group for the passed @a filter from the media database.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] filter The handle to media filter
- * @param [in] group The type of media group
- * @param[out] group_count The count of media group
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  filter       The media filter handle
+ * @param[in]  group        The type of the media group
+ * @param[out] group_count  The count of the media group
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB operation failed
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
- * @see media_content_connect()
  *
+ * @see media_content_connect()
  */
 int media_group_get_group_count_from_db(filter_h filter, media_group_e group, int *group_count);
 
  /**
- * @brief Iterates through the media group with optional @a filter from the media database.
- * @details This function gets the names of media group meeting the given filter.
- * The callback function will be invoked for every retrieved media group.
- * If NULL is passed to the filter, no filtering is applied.
- *
- * @param [in] filter The handle to media filter
- * @param [in] group The type of media group
- * @param [in] callback The callback function to invoke
- * @param [in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @brief Iterates through the media group with an optional @a filter from the media database.
+ * @details This function gets names of media group meeting the given filter.
+ *          The callback function will be invoked for every retrieved media group.
+ *          If @c NULL is passed to the filter, no filtering is applied.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] filter    The media filter handle
+ * @param[in] group     The type of the media group
+ * @param[in] callback  The callback function to be invoked
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre This function requires opened connection to content service by media_content_connect().
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre  This function requires opened connection to content service by media_content_connect().
  * @post This function invokes media_group_cb().
+ *
  * @see #media_group_cb
  * @see media_content_connect()
  * @see media_filter_create()
@@ -265,37 +354,52 @@ int media_group_get_group_count_from_db(filter_h filter, media_group_e group, in
 int media_group_foreach_group_from_db(filter_h filter, media_group_e group, media_group_cb callback, void *user_data);
 
  /**
- * @brief Gets number of media info for the given media group present in the media database.
- *
- * @param [in] group_name The name of media group
- * @param [in] group The type of media group
- * @param [in] filter The handle to media filter
- * @param [out] media_count The count of media
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @brief Gets the count of the media info for the given media group present in the media database.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in]  group_name  The name of the media group
+ * @param[in]  group       The type of the media group
+ * @param[in]  filter      The media filter handle
+ * @param[out] media_count The count of the media
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
+ *
  * @see media_content_connect()
  */
 int media_group_get_media_count_from_db(const char *group_name, media_group_e group, filter_h filter, int *media_count);
 
  /**
- * @brief Iterates through the media files with optional @a filter in the given @a group from the media database.
+ * @brief Iterates through the media files with an optional @a filter in the given @a group from the media database.
  * @details This function gets all media files associated with the given group and
- * meeting desired filter option and calls registered callback function for
- * every retrieved media info. If NULL is passed to the @a filter, no filtering is applied.
- *
- * @param [in] group_name The name of media group
- * @param [in] group The type of media group
- * @param [in] filter The handle to media filter
- * @param [in] callback The callback function to invoke
- * @param [in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ *          meeting desired filter option and calls registered callback function for
+ *          every retrieved media info. If @c NULL is passed to the @a filter, no filtering is applied.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] group_name The name of the media group
+ * @param[in] group      The type of the media group
+ * @param[in] filter     The media filter handle
+ * @param[in] callback   The callback function to be invoked
+ * @param[in] user_data  The user data to be passed to the callback function
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre This function requires opened connection to content service by media_content_connect().
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre  This function requires opened connection to content service by media_content_connect().
  * @post This function invokes media_info_cb().
- * @see #media_info_cb
+ *
+ * @see media_info_cb()
  * @see media_content_connect()
  * @see media_filter_create()
  */
index e6d7762..a7dd03e 100755 (executable)
 extern "C" {
 #endif /* __cplusplus */
 
+/**
+ * @brief This file contains the image metadata API and related functions to proceed with them.
+ *        Functions include cloning and destroying the image metadata, getting image metadata such as width, height, \n
+ *        orientation, date taken, title, burst shot id and updating image to DB.
+ */
 
 /**
  * @addtogroup CAPI_CONTENT_MEDIA_IMAGE_MODULE
  * @{
  */
 
+
 /**
- * @brief Clones image metadata.
- * @details Function copies the image metadata handle from source to destination.
+ * @brief Clones the image metadata.
+ * @details The function copies the image metadata handle from a source to destination.
  *
- * @remark The destination handle must be released with image_meta_destroy() by you.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [out] dst A destination handle to image metadata
- * @param [in] src The source handle to image metadata
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @remarks The destination handle must be released with image_meta_destroy().
+ *
+ * @param[out] dst  The destination handle to the image metadata
+ * @param[in]  src  The source handle to the image metadata
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @see image_meta_destroy()
  */
 int image_meta_clone(image_meta_h *dst, image_meta_h src);
 
 /**
- * @brief Destroys image metadata.
+ * @brief Destroys the image metadata.
  * @details The function frees all resources related to the image metadata handle. This handle
- * no longer can be used to perform any operation. A new handle has to
- * be created before next usage.
+ *          no longer can be used to perform any operation. A new handle has to
+ *          be created before next usage.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] image The image metadata handle
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
- * @param [in] image The handle to image metadata
- * @return 0 on success, otherwise a negative error value.
  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @pre Get copy of image_meta handle by calling image_meta_clone()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre Get a copy of image_meta handle by calling image_meta_clone().
+ *
  * @see image_meta_clone()
  */
 int image_meta_destroy(image_meta_h image);
 
 /**
- * @brief Gets the ID of image.
+ * @brief Gets the ID of an image.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] image The handle to image metadata
- * @param [out] media_id The ID of image
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  image    The image metadata handle
+ * @param[out] media_id The ID of an image
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int image_meta_get_media_id(image_meta_h image, char **media_id);
 
 /**
- * @brief Gets image's width in pixels.
+ * @brief Gets the image width in pixels.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] image The handle to image metadata
- * @param [out] width The image width in pixels
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  image The image metadata handle
+ * @param[out] width The image width in pixels
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int image_meta_get_width(image_meta_h image, int *width);
 
 /**
- * @brief Gets image's height in pixels.
+ * @brief Gets the image height in pixels.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] image The handle to image metadata
- * @param [out] height The image height in pixels
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  image  The image metadata handle
+ * @param[out] height The image height in pixels
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int image_meta_get_height(image_meta_h image, int *height);
 
 /**
  * @brief Gets the image orientation.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] image The handle to image metadata
- * @param [out] orientation The image orientation
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  image       The image metadata handle
+ * @param[out] orientation The image orientation
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int image_meta_get_orientation(image_meta_h image, media_content_orientation_e *orientation);
 
 /**
- * @brief Gets the date, when image was created as time_t structure.
+ * @brief Gets the image creation time.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] image The handle to image metadata
- * @param [out] date_taken The time, when image was taken (in seconds, since the Epoch)
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  image      The image metadata handle
+ * @param[out] date_taken The time, when image was taken (in seconds, since the Epoch)
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int image_meta_get_date_taken(image_meta_h image, char **date_taken);
 
 /**
- * @brief Sets the image orientation.
+ * @brief Gets the burst shot ID.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] image The handle to image metadata
- * @param [in] orientation The image orientation
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @remarks You must release @a burst_id using free().
+ *
+ * @param[in]  image    The image metadata handle
+ * @param[out] burst_id The ID of burst shot\ n
+ *                      If @a burst_id is @c NULL, this is not burst shot.
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ */
+int image_meta_get_burst_id(image_meta_h image, char **burst_id);
+
+/**
+ * @brief Checks whether the media is a burst shot image.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in]  image         The image metadata handle
+ * @param[out] is_burst_shot @c true if the media is a burst shot image,
+ *                           otherwise @c false if the media is not a burst shot image
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ */
+int image_meta_is_burst_shot(image_meta_h image, bool *is_burst_shot);
+
+/**
+ * @brief Sets an orientation of the image.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] image       The image metadata handle
+ * @param[in] orientation The image orientation
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @post image_meta_update_to_db()
  */
 int image_meta_set_orientation(image_meta_h image, media_content_orientation_e orientation);
@@ -131,18 +219,30 @@ int image_meta_set_orientation(image_meta_h image, media_content_orientation_e o
 /**
  * @brief Updates the image to the media database.
  *
- * @details The function updates the given image meta in the media database. The function should be called after any change in image attributes, to be updated to the media 
- * database. For example, after using image_meta_set_orientation() for setting the orientation of the image, image_meta_update_to_db() function should be called so as to update 
- * the given image attibutes in the media database.
+ * @details The function updates the given image meta in the media database. The function should be called after any change in image attributes, to be updated to the media
+ *          database. For example, after using image_meta_set_orientation() for setting the orientation of the image, the image_meta_update_to_db() function should be called so as to update
+ *          the given image attributes in the media database.
  *
- * @param[in] image The handle to image
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write
+ *
+ * @remarks Do not call this function in callback function of foreach function like media_info_foreach_media_from_db().
+ *
+ * @param[in] image The handle to the image
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
+ *
  * @see media_content_connect()
  * @see image_meta_set_orientation()
- *
  */
 int image_meta_update_to_db(image_meta_h image);
 
index 0b35ae3..393f4a8 100755 (executable)
 extern "C" {
 #endif /* __cplusplus */
 
+/**
+ * @file media_info.h
+ * @brief This file contains the media info API and related functions to proceed with it. \n
+ *        You can use the functions to insert, clone, delete, get the number and content of files from DB. \n
+ *        You can get and set properties and parameters such as storage type, provider, and category of media info, \n
+ *        handling with thumbnail and updating media info to DB.
+ */
+
 
 /**
  * @addtogroup CAPI_CONTENT_MEDIA_INFO_MODULE
@@ -33,47 +41,189 @@ extern "C" {
  */
 
 /**
- * @brief Inserts media file into the media database.
- * @details This function inserts an media item into the content storage.
- * Normally, inserting a media file in database is done automatically by media server, without calling this function.
- * This function is only called when media server is busy and user needs to get quick result of inserting
- * e.g. Taking a photo while media server is busy and user want to see the quick snapshot of the photo taken.
- * @remark The handle must be released with media_info_destroy() by you.
- *
- * @param[in] path The path to the media file
+ * @brief  Inserts a media file into the media database.
+ * @details This function inserts a media item into the content storage.
+ *          Normally, inserting a media file in database is done automatically by the media server, without calling this function.
+ *          This function is only called when the media server is busy and the user needs to get quick result of inserting
+ *          e.g. Taking a photo while media server is busy and the user wants to see the quick snapshot of the photo taken.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write \n
+ *                   %http://tizen.org/privilege/mediastorage \n
+ *                   %http://tizen.org/privilege/externalstorage
+ *
+ * @remarks You must release the handle using media_info_destroy(). \n
+ *                   You must add privilege http://tizen.org/privilege/content.write. And You add more privilege depending on your choice of contents path. \n
+ *                   If you want to access only internal storage by using  this API, you should add privilege http://tizen.org/privilege/mediastorage. \n
+ *                   Or if you want to access only external storage by using  this API, you shold add privilege http://tizen.org/privilege/externalstorage. \n
+ *                   If you can access both storage, you must add all privilege.
+ *
+ * @param[in]  path The path to the media file
  * @param[out] info The handle to the media info
- * @return 0 on success, otherwise a negative error value.
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
+ *
  * @see media_content_connect()
  */
 int media_info_insert_to_db (const char *path, media_info_h *info);
 
 /**
- * @brief Deletes media file from the media database.
- * @details This function deletes an media item from the content storage.
- * Normally, deleting a media file in database is done automatically by media server, without calling this function.
- * This function is only called when media server is busy and user needs to get quick result of deleting
+ * @brief Inserts media files into the media database, asynchronously.
+ * @details This function inserts media items into the content storage.
+ *          Normally, inserting a media file in database is done automatically by the media server, without calling this function.
+ *          This function invokes media_insert_completed_cb() callback function when insertion to the media database is finished.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write \n
+ *                   %http://tizen.org/privilege/mediastorage \n
+ *                   %http://tizen.org/privilege/externalstorage
+ *
+ * @remarks You must add privilege http://tizen.org/privilege/content.write. And You add more privilege depending on your choice of contents path. \n
+ *                   If you want to access only internal storage by using  this API, you should add privilege http://tizen.org/privilege/mediastorage. \n
+ *                   Or if you want to access only external storage by using  this API, you shold add privilege http://tizen.org/privilege/externalstorage. \n
+ *                   If you can access both storage, you must add all privilege.
+ *
+ * @param[in] path_array   The path array to the media files
+ * @param[in] array_length The length of the array
+ * @param[in] callback     The callback to be invoked when media items inserted completely
+ * @param[in] user_data    The user data to be passed to the callback function
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre This function requires opened connection to content service by media_content_connect().
+ *
+ * @see media_content_connect()
+ * @see media_insert_completed_cb()
+ */
+int media_info_insert_batch_to_db(const char **path_array,unsigned int array_length, media_insert_completed_cb callback, void *user_data);
+
+/**
+ * @brief Inserts the burst shot images into the media database, asynchronously.
+ * @details This function inserts burst images into the content storage.
+ *          media_insert_burst_shot_completed_cb() will be called when insertion to media database is finished.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write \n
+ *                   %http://tizen.org/privilege/mediastorage \n
+ *                   %http://tizen.org/privilege/externalstorage
+ *
+ * @remarks You must add privilege http://tizen.org/privilege/content.write. And You add more privilege depending on your choice of contents path. \n
+ *                   If you want to access only internal storage with this API, you should add privilege http://tizen.org/privilege/mediastorage. \n
+ *                   Or if you want to access only external storage with this API, you shold add privilege http://tizen.org/privilege/externalstorage. \n
+ *                   If you can access both storage, you must add all privilege.
+ *
+ * @param[in] path_array   The path array to the burst shot images
+ * @param[in] array_length The length of the array
+ * @param[in] callback     The callback to be invoked when the images are inserted completely
+ * @param[in] user_data    The user data to be passed to the callback function
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre This function requires opened connection to content service by media_content_connect().
+ *
+ * @see media_content_connect()
+ * @see media_insert_burst_shot_completed_cb()
+ */
+int media_info_insert_burst_shot_to_db(const char **path_array,unsigned int array_length, media_insert_burst_shot_completed_cb callback, void *user_data);
+
+/**
+ * @brief Deletes a media file from the media database.
+ * @details This function deletes a media item from the content storage.
+ *          Normally, deleting a media file in the database is done automatically by the media server, without calling this function.
+ *          This function is only called when the media server is busy and user needs to get quick result of deleting.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write
+ *
+ * @param[in] media_id  The ID to the media file
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
- * @param[in] media_id The ID to the media file
- * @return 0 on success, otherwise a negative error value.
  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
+ *
  * @see media_content_connect()
  */
 int media_info_delete_from_db(const char *media_id);
 
 /**
- * @brief Destroys the media info.
- * @details The function frees all resources related to the media info handle. This handle
- * no longer can be used to perform any operation. New media info handle has to
- * be created before next usage.
+ * @brief Deletes media files from the media database. 
+ *        The media files for deletion can be specified as a condition in a filter.
+ * @details This function deletes the media items from the content storage.
+ *          Normally, deleting  media files in the database are done automatically by the media server, without calling this function.
+ *          This function is only called when the media server is busy and user needs to get quick result of deleting.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write
+ *
+ * @param[in] filter  The handle to filter
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
- * @param[in] media The handle to media info
- * @return 0 on success, otherwise a negative error value.
  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre Get copy of media_info handle by calling media_info_clone()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre This function requires opened connection to content service by media_content_connect().
+ *
+ * @see media_content_connect()
+ */
+int media_info_delete_batch_from_db(filter_h filter);
+
+
+/**
+ * @brief Destroys media info.
+ * @details The function frees all resources related to the media info handle. This handle
+ *          can no longer be used to perform any operation. New media info handle has to
+ *          be created before the next usage.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in]  media  The media info handle
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre Get copy of media_info handle by calling media_info_clone().
+ *
  * @see media_info_clone()
  */
 int media_info_destroy(media_info_h media);
@@ -81,732 +231,1068 @@ int media_info_destroy(media_info_h media);
 /**
  * @brief Clones the media info handle.
  *
- * @details This function copies the media info handle from a source to destination.
- * There is no media_info_create() function. The media_info_h is created internally and
- * available through media info foreach function such as media_info_foreach_media_from_db().
- * To use this handle outside of these foreach functions, use this function.
- * @remark The destination handle must be released with media_info_destroy() by you.
+ * @details This function copies the media info handle from a source to the destination.
+ *          There is no media_info_create() function. The media_info_h is created internally and
+ *          available through media info foreach function such as media_info_foreach_media_from_db().
+ *          To use this handle outside of these foreach functions, use this function.
  *
- * @param[out] dst A destination handle to media info
- * @param[in] src The source handle to media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remarks You must release the destination handle using media_info_destroy().
+ *
+ * @param[out] dst  The destination handle to the media info
+ * @param[in]  src  The source handle to media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @see media_info_destroy()
- * @see audio_album_foreach_media_from_db()
- * @see audio_playlist_foreach_media_from_db()
- * @see audio_artist_foreach_media_from_db()
- * @see audio_author_foreach_media_from_db()
- * @see audio_genre_get_media_count_from_db()
+ * @see media_album_foreach_media_from_db()
+ * @see media_playlist_foreach_media_from_db()
+ * @see media_group_foreach_media_from_db
  * @see media_tag_foreach_media_from_db()
  * @see media_info_foreach_media_from_db()
  * @see media_folder_foreach_media_from_db()
- *
  */
 int media_info_clone(media_info_h *dst, media_info_h src);
 
 /**
- * @brief Gets the number of media info for the passed @a filter from the media database.
+ * @brief Gets the count of media info for the passed @a filter from the media database.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] filter The handle to filter.
- * @param[out] media_count The count of media tag
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  filter      The handle to filter
+ * @param[out] media_count The count of media
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
- * @see media_content_connect()
  *
+ * @see media_content_connect()
  */
 int media_info_get_media_count_from_db(filter_h filter, int *media_count);
 
 /**
  * @brief Iterates through media info from the media database.
- * @details This function gets all media info handles meeting the given @a filter. The @a callback function will be invoked for every retrieved media info.
- * If NULL is passed to the @a filter, no filtering is applied.
- * @param[in] filter The handle to media info filter
- * @param[in] callback The callback function to invoke
+ * @details This function gets all media info handles meeting the given @a filter.
+ *          The @a callback function will be invoked for every retrieved media info.
+ *          If @c NULL is passed to the @a filter, then no filtering is applied.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remarks Do not call updating DB function like media_info_update_to_db(), media_info_refresh_metadata_to_db(), audio_meta_update_to_db(), image_meta_update_to_db() and video_meta_update_to_db()  in your callback function,
+ *                   your callback function is invoked as inline function.
+ *                   So, your callback function is in read state in SQLite. When you are in read state, sometimes you do not update DB.
+ *                   We do not recommend you call updating DB function in callback of foreach function.
+ *
+ * @param[in] filter    The media info handle filter
+ * @param[in] callback  The callback function to be invoked
  * @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @pre This function requires opened connection to content service by media_content_connect().
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre  This function requires opened connection to content service by media_content_connect().
  * @post This function invokes media_info_cb().
+ *
  * @see media_content_connect()
  * @see #media_info_cb
  * @see media_info_filter_create()
- *
  */
 int media_info_foreach_media_from_db(filter_h filter, media_info_cb callback, void *user_data);
 
 /**
- * @brief Gets the number of media tag for the passed @a filter in the given @a media ID from the media database.
+ * @brief Gets the count of media tags for the passed @a filter in the given @a media_id from the media database.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media_id The ID of media info
- * @param[in] filter The handle to media filter
- * @param[out] tag_count The count of media tag
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  media_id  The ID of the media info
+ * @param[in]  filter    The handle to the media filter
+ * @param[out] tag_count The count of the media tag
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
- * @see media_content_connect()
  *
+ * @see media_content_connect()
  */
 int media_info_get_tag_count_from_db(const char *media_id, filter_h filter, int *tag_count);
 
 /**
- * @brief Iterates through the media tag in the given @a media @a info from the media database.
- * @details This function gets all media tag associated with the given @a media and calls registered callback function for every retrieved media tag.
- * @param[in] media_id The ID of media info
- * @param[in] filter The handle to media filter
- * @param[in] callback The callback function to invoke
+ * @brief Iterates through the media tag in the given media info from the media database.
+ * @details This function gets all the media tags associated with the given @a media_id and calls registered callback function for every retrieved media tag.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] media_id  The ID of the media info
+ * @param[in] filter    The handle to the media filter
+ * @param[in] callback  The callback function to be invoked
  * @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre This function requires opened connection to content service by media_content_connect().
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre  This function requires opened connection to content service by media_content_connect().
  * @post This function invokes media_tag_cb().
+ *
  * @see media_content_connect()
  * @see #media_tag_cb
  */
 int media_info_foreach_tag_from_db(const char *media_id, filter_h filter, media_tag_cb callback, void *user_data);
 
 /**
- * @brief Gets the number of bookmark for the passed @a filter in the given @a media ID from the media database.
+ * @brief Gets the number of bookmarks for the passed @a filter in the given media ID from the media database.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media_id The ID of media info
- * @param[in] filter The handle to media filter
- * @param[out] bookmark_count The count of media tag
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  media_id        The ID of the media info
+ * @param[in]  filter          The handle to the media filter
+ * @param[out] bookmark_count  The count of the media tag
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
- * @see media_content_connect()
  *
+ * @see media_content_connect()
  */
 int media_info_get_bookmark_count_from_db(const char *media_id, filter_h filter, int *bookmark_count);
 
 /**
- * @brief Iterates through the media bookmark in the given @a media @a info from the media database.
- * @details This function gets all media bookmark associated with the given @a media and calls registered callback function for every retrieved media bookmark.
- * @param[in] media_id The ID of media info
- * @param[in] filter The handle to media filter
- * @param[in] callback The callback function to invoke
+ * @brief Iterates through the media bookmark in the given media info from the media database.
+ * @details This function gets all media bookmarks associated with the given media and calls registered callback function for every retrieved media bookmark.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] media_id  The ID of the media info
+ * @param[in] filter    The handle to the media filter
+ * @param[in] callback  The callback function to be invoked
  * @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre This function requires opened connection to content service by media_content_connect().
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre  This function requires opened connection to content service by media_content_connect().
  * @post This function invokes media_bookmark_cb().
+ *
  * @see media_content_connect()
- * @see #media_bookmark_cb
+ * @see media_bookmark_cb()
  */
 int media_info_foreach_bookmark_from_db (const char *media_id, filter_h filter, media_bookmark_cb callback, void *user_data);
 
 /**
- * @brief Gets image metadata for a given media info.
+ * @brief Gets the image metadata for a given media info.
  * @details This function returns an image metadata handle retrieved from the media info.
  *
- * @remark The @a image handle must be released with image_meta_destroy() by you.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] media The handle to media info
- * @param[out] image A handle to image meta
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @remarks You must release the @a image handle using image_meta_destroy().
+ *
+ * @param[in]  media  The media info handle
+ * @param[out] image  A handle to image metadata
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @see image_meta_destroy()
  */
 int media_info_get_image(media_info_h media, image_meta_h *image);
 
 /**
- * @brief Gets video metadata for a given media info.
+ * @brief Gets video metadata for a given media info.
  * @details This function returns a video metadata handle retrieved from the media info handle.
  *
- * @remark The @a video handle must be released with video_meta_destroy() by you.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] media The handle to media info
+ * @remarks You must release the @a video handle using video_meta_destroy().
+ *
+ * @param[in]  media The media info handle
  * @param[out] video A handle to the video meta
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @see video_meta_destroy()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  *
+ * @see video_meta_destroy()
  */
 int media_info_get_video(media_info_h media, video_meta_h *video);
 
 /**
- * @brief Gets audio metadata for a given media info.
+ * @brief Gets an audio metadata for a given media info.
  * @details This function returns an audio metadata handle retrieved from the media info handle.
  *
- * @remark The @a audio handle must be released with audio_meta_destroy() by you.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] media The handle to media info
+ * @remarks You must release the @a audio handle using audio_meta_destroy().
+ *
+ * @param[in]  media The media info handle
  * @param[out] audio A handle to the audio meta
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @see audio_meta_destroy()
  */
 int media_info_get_audio(media_info_h media, audio_meta_h *audio);
 
 /**
- * @brief Gets ID to media info.
+ * @brief Gets the tag ID for the media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
+ * @param[in]  media The media info handle
+ * @param[out] media_id     The ID of the media tag
  *
- * @param [in] media_id The ID if media info
- * @param [out] media_id The ID of media tag
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_info_get_media_id(media_info_h media, char **media_id);
 
 /**
- * @brief Gets path to media info.
+ * @brief Gets the path to the media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a path must be released with free() by you.
+ * @remarks You must release @a path using free().
  *
- * @param[in] media The handle to media info
- * @param[out] path The path of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  media The media info handle
+ * @param[out] path  The path of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  *
  */
 int media_info_get_file_path(media_info_h media, char **path);
 
 /**
- * @brief Gets name to media info.
+ * @brief Gets the name of the media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a name must be released with free() by you.
+ * @remarks You must release @a name using free().
  *
- * @param[in] media The handle to media info
- * @param[out] name The name of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in]  media The media info handle
+ * @param[out] name  The name of media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_info_get_display_name(media_info_h media, char **name);
 
 /**
- * @brief Gets media info's content type.
+ * @brief Gets the content type of the media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media The handle to media info
- * @param[out] type The type of media content(#media_content_type_e)
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in]  media The media info handle
+ * @param[out] type  The type of the media content (#media_content_type_e)
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_info_get_media_type(media_info_h media, media_content_type_e *type);
 
 /**
- * @brief Gets name to media info.
+ * @brief Gets the MIME type from the media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a mime_type must be released with free() by you.
+ * @remarks You must release @a mime_type using free().
  *
- * @param[in] media The handle to media info
- * @param[out] mime_type The mime type of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in]  media     The media info handle
+ * @param[out] mime_type The MIME type of the media info
  *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_info_get_mime_type(media_info_h media, char **mime_type);
 
 /**
- * @brief Gets media file's size.
+ * @brief Gets the media file size.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media The handle to media info
- * @param[out] size The type of media content
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in]  media The media info handle
+ * @param[out] size  The type of the media content
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_info_get_size(media_info_h media, unsigned long long *size);
 
 /**
- * @brief Gets added time.
+ * @brief Gets the addition time of the media.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media The handle to media info
- * @param[out] added_time The added time
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in]  media      The media info handle
+ * @param[out] added_time The added time to the DB
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_info_get_added_time(media_info_h media, time_t *added_time);
 
 /**
- * @brief Gets media info's date of modification.
+ * @brief Gets the date of modification of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media The handle to media info
- * @param[out] time The date of modification
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in]  media The media info handle
+ * @param[out] time  The date of modification of the file \n
+ *                   Get from the file.
  *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_info_get_modified_time(media_info_h media, time_t *time);
 
 /**
- * @brief Gets the thumbnail to media info.
+ * @brief Gets the timeline of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a path must be released with free() by you.
+ * @param[in]  media The media info handle
+ * @param[out] time  The date of the timeline
  *
- * @param[in] media The handle to media info
- * @param[out] path The path to thumbnail of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ */
+int media_info_get_timeline(media_info_h media, time_t* time);
+
+/**
+ * @brief Gets the thumbnail of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remarks You must release @a path using free().
  *
+ * @param[in]  media The media info handle
+ * @param[out] path  The path to the thumbnail of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_info_get_thumbnail_path(media_info_h media, char **path);
 
 /**
- * @brief Gets the description to media info.
+ * @brief Gets the description of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a description must be released with free() by you.
+ * @remarks You must release @a description using free().
  *
- * @param[in] media The handle to media info
- * @param[out] description The description of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in]  media       The media info handle
+ * @param[out] description The description of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_info_get_description(media_info_h media, char **description);
 
 /**
- * @brief Gets media info's longitude.
+ * @brief Gets the longitude of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media The handle to media info
- * @param[out] longitude The longitude of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in]  media     The media info handle
+ * @param[out] longitude The longitude of the media info
  *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_info_get_longitude(media_info_h media, double* longitude);
 
 /**
- * @brief Gets media info's latitude.
+ * @brief Gets the latitude of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media The handle to media info
- * @param[out] latitude The latitude of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  media    The media info handle
+ * @param[out] latitude The latitude of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  *
  */
 int media_info_get_latitude(media_info_h media, double* latitude);
 
 /**
- * @brief Gets media info's altitude of modification.
+ * @brief Gets the altitude of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media The handle to media info
- * @param[out] altitude The altitude of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in]  media    The media info handle
+ * @param[out] altitude The altitude of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_info_get_altitude(media_info_h media, double* altitude);
 
 /**
- * @brief Gets media info's rating.
+ * @brief Gets the weather of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media The handle to media info
- * @param[out] rating The rating of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  media   The media info handle
+ * @param[out] weather The weather of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ */
+int media_info_get_weather(media_info_h media, char **weather);
+
+/**
+ * @brief Gets the rating of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in]  media  The media info handle
+ * @param[out] rating The rating of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_info_get_rating(media_info_h media, int *rating);
 
 /**
- * @brief Gets the given media info's favorite status.
+ * @brief Gets the favorite status of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] media The handle to media info
- * @param [out] favorite The media favorite status(non zero if favorite, 0 if not favorite)
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in]  media     The media info handle
+ * @param[out] favorite  @c true if media info is set as favorite, 
+ *                       otherwise @c false if media info is not set as favorite
  *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_info_get_favorite(media_info_h media, bool* favorite);
 
 /**
- * @brief Gets the author to media info.
+ * @brief Gets the author of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a author must be released with free() by you.
+ * @remarks You must release @a author using free().
  *
- * @param[in] media The handle to media info
- * @param[out] author The author of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in]  media  The media info handle
+ * @param[out] author The author of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_info_get_author(media_info_h media, char **author);
 
 /**
- * @brief Gets the provider to media info.
+ * @brief Gets the provider of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a provider must be released with free() by you.
+ * @remarks You must release @a provider using free().
  *
- * @param[in] media The handle to media info
- * @param[out] provider The provider of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in]  media    The media info handle
+ * @param[out] provider The provider of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_info_get_provider(media_info_h media, char **provider);
 
 /**
- * @brief Gets the content name to media info.
+ * @brief Gets the content name of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a content_name must be released with free() by you.
+ * @remarks You must release @a content_name using free().
  *
- * @param[in] media The handle to media info
- * @param[out] content_name The content name of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in]  media        The media info handle
+ * @param[out] content_name The content name of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_info_get_content_name(media_info_h media, char **content_name);
 
 /**
- * @brief Gets the provider to media info.
+ * @brief Gets the title of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a category must be released with free() by you.
+ * @remarks You must release @a title using free().
  *
- * @param[in] media The handle to media info
- * @param[out] category The category of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @param[in]  media  The media info handle
+ * @param[out] title  The title of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ */
+int media_info_get_title(media_info_h media, char **title);
+
+/**
+ * @brief Gets the category of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remarks You must release @a category using free().
+ *
+ * @param[in]  media    The media info handle
+ * @param[out] category The category of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_info_get_category(media_info_h media, char **category);
 
 /**
- * @brief Gets the location_tag to media info.
+ * @brief Gets the location tag of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a location_tag must be released with free() by you.
+ * @remarks You must release @a location_tag using free().
  *
- * @param[in] media The handle to media info
- * @param[out] location_tag The location of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in]  media        The media info handle
+ * @param[out] location_tag The location of the media info
  *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_info_get_location_tag(media_info_h media, char **location_tag);
 
 /**
- * @brief Gets the age_rating to media info.
+ * @brief Gets the age_rating of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a age_rating must be released with free() by you.
+ * @remarks You must release @a age_rating using free().
  *
- * @param[in] media The handle to media info
- * @param[out] age_rating The age rating of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in]  media      The media info handle
+ * @param[out] age_rating The age rating of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_info_get_age_rating(media_info_h media, char **age_rating);
 
 /**
- * @brief Gets the keyword to media info.
+ * @brief Gets the keyword of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a keyword must be released with free() by you.
+ * @remarks You must release @a keyword using free().
  *
- * @param[in] media The handle to media info
- * @param[out] keyword The keyword of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in]  media   The media info handle
+ * @param[out] keyword The keyword of the media info
  *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_info_get_keyword(media_info_h media, char **keyword);
 
 /**
- * @brief Checks whether the media is protected via drm.
+ * @brief Checks whether the media is protected via DRM.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media The handle to media info
- * @param[out] is_drm /@a true if the drm media,
- *                    /@a false if not drm.
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in]  media  The media info handle
+ * @param[out] is_drm @c true if media is DRM media,
+ *                    otherwise @c false if media is not DRM media
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_info_is_drm(media_info_h media, bool *is_drm);
 
 /**
- * @brief Gets media info's storage_type.
+ * @brief Gets the storage type of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media The handle to media info
- * @param[out] storage_type The storage type of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in]  media        The media info handle
+ * @param[out] storage_type The storage type of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_info_get_storage_type(media_info_h media, media_content_storage_e *storage_type);
 
 /**
  * @brief Gets the media info from the media database.
  *
- * @details This function creates a new media handle from the media database by the given media_id.
- * media info will be created, which is filled with info information.
+ * @details This function creates a new media handle from the media database by the given @a media_id.
+ *          Media info will be created and filled with information.
  *
- * @remarks @a media must be released with media_tag_destroy() by you.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media_id The ID of media info
- * @param[out] media The media handle associated with the media ID
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @remarks You must release @a media using media_tag_destroy().
+ *
+ * @param[in]  media_id The ID of media info
+ * @param[out] media    The media handle associated with the media ID
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
+ *
  * @see media_content_connect()
  * @see media_info_destroy()
- *
  */
 int media_info_get_media_from_db(const char *media_id, media_info_h *media);
 
 /**
- * @brief Sets display name to media info.
+ * @brief Sets the display name of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media The handle to media info
- * @param[in] display_name The display name of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @param[in] media        The media info handle
+ * @param[in] display_name The display name of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @post media_info_update_to_db()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @post media_info_update_to_db().
  *
  */
 int media_info_set_display_name(media_info_h media, const char *display_name);
 
 /**
- * @brief Sets description to media info.
+ * @brief Sets the description of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media The handle to media info
- * @param[in] description The description of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @param[in] media       The media info handle
+ * @param[in] description The description of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @post media_info_update_to_db()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @post media_info_update_to_db().
  *
  */
 int media_info_set_description(media_info_h media, const char *description);
 
 /**
- * @brief Sets longitude to media info.
+ * @brief Sets the longitude of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media The handle to media info
- * @param[in] longitude The longitude of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @param[in] media     The media info handle
+ * @param[in] longitude The longitude of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @post media_info_update_to_db()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  *
+ * @post media_info_update_to_db().
  */
 int media_info_set_longitude(media_info_h media, double longitude);
 
 /**
- * @brief Sets latitude to media info.
+ * @brief Sets the latitude of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media The handle to media info
- * @param[in] latitude The latitude of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @param[in] media    The media info handle
+ * @param[in] latitude The latitude of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @post media_info_update_to_db()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  *
+ * @post media_info_update_to_db().
  */
 int media_info_set_latitude(media_info_h media, double latitude);
 
 /**
- * @brief Sets altitude to media info.
+ * @brief Sets the altitude of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media The handle to media info
- * @param[in] altitude The altitude of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @param[in] media    The media info handle
+ * @param[in] altitude The altitude of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @post media_info_update_to_db()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  *
+ * @post media_info_update_to_db().
  */
 int media_info_set_altitude(media_info_h media, double altitude);
 
 /**
- * @brief Sets rating to media info.
+ * @brief Sets the weather of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media The handle to media info
- * @param[in] rating The rating of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @param[in] media   The media info handle
+ * @param[in] weather The weather of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @post media_info_update_to_db()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @post media_info_update_to_db().
  *
  */
-int media_info_set_rating(media_info_h media, int rating);
+int media_info_set_weather(media_info_h media, const char *weather);
 
 /**
- * @brief Sets favorite to media info.
+ * @brief Sets the rating of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media The handle to media info
- * @param[in] favorite The favorite of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @param[in] media  The media info handle
+ * @param[in] rating The rating of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  *
+ * @post media_info_update_to_db().
  */
-int media_info_set_favorite(media_info_h media, bool favorite);
+int media_info_set_rating(media_info_h media, int rating);
 
 /**
- * @brief Sets author to media info.
+ * @brief Sets the favorite of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media The handle to media info
- * @param[in] author The author of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @param[in] media    The media info handle
+ * @param[in] favorite Set @c true to set the media info as favorite,
+ *                     otherwise set @c false to not set the media info as favorite
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ */
+int media_info_set_favorite(media_info_h media, bool favorite);
+
+/**
+ * @brief Sets the author of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] media  The media info handle
+ * @param[in] author The author of the media info
  *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_info_set_author(media_info_h media, const char *author);
 
 /**
- * @brief Sets provider to media info.
+ * @brief Sets the provider of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media The handle to media info
- * @param[in] provider The provider of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in] media    The media info handle
+ * @param[in] provider The provider of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_info_set_provider(media_info_h media, const char *provider);
 
 /**
- * @brief Sets content name to media info.
+ * @brief Sets the content name of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media The handle to media info
- * @param[in] content_name The content name of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @param[in] media        The media info handle
+ * @param[in] content_name The content name of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @post media_info_update_to_db()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  *
+ * @post media_info_update_to_db()
  */
 int media_info_set_content_name(media_info_h media, const char *content_name);
 
 /**
- * @brief Sets category to media info.
+ * @brief Sets the category of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media The handle to media info
- * @param[in] category The category of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @param[in] media    The media info handle
+ * @param[in] category The category of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @post media_info_update_to_db()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  *
+ * @post media_info_update_to_db()
  */
 int media_info_set_category(media_info_h media, const char *category);
 
 /**
- * @brief Sets location tag to media info.
+ * @brief Sets the location tag of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media The handle to media info
- * @param[in] location_tag The location of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @param[in] media        The media info handle
+ * @param[in] location_tag The location of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @post media_info_update_to_db()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  *
+ * @post media_info_update_to_db()
  */
 int media_info_set_location_tag(media_info_h media, const char *location_tag);
 
 /**
- * @brief Sets age rating to media info.
+ * @brief Sets the age rating of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media The handle to media info
- * @param[in] age_rating The age rating of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @param[in] media      The media info handle
+ * @param[in] age_rating The age rating of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @post media_info_update_to_db()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  *
+ * @post media_info_update_to_db()
  */
 int media_info_set_age_rating(media_info_h media, const char *age_rating);
 
 /**
- * @brief Sets keyword to media info.
+ * @brief Sets the keyword of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media The handle to media info
- * @param[in] keyword The keyword of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @param[in] media   The media info handle
+ * @param[in] keyword The keyword of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @post media_info_update_to_db()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  *
+ * @post media_info_update_to_db()
  */
 int media_info_set_keyword(media_info_h media, const char *keyword);
 
 /**
  * @brief Updates the media info to the media database.
+ * 
+ * @details The function updates the given media info in the media database.
  *
- * @details The function updates the given media info in the media database. The function should be called after any change in media, to be updated to the media
- * database. For example, after using media_info_set_display_name() for setting the name of the media, media_info_update_to_db() function should be called so as to update
- * the given media info attibutes in the media database.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write
  *
- * @param[in] media The handle to media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @remarks The function should be called after any change in media, to be updated to the media
+ *          database. For example, after using media_info_set_display_name()
+ *          for setting the name of the media, the media_info_update_to_db() function should be called so as to update
+ *          the given media info attributes in the media database.
+ *
+ * @param[in] media The media info handle
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
+ *
  * @see media_content_connect()
  * @see media_info_set_display_name()
  * @see media_info_set_description()
@@ -821,73 +1307,139 @@ int media_info_set_keyword(media_info_h media, const char *keyword);
  * @see media_info_set_category()
  * @see media_info_set_location_tag()
  * @see media_info_set_age_rating()
- *
  */
 int media_info_update_to_db(media_info_h media);
 
 /**
- * @brief Refresh the metadata of media to media database.
+ * @brief Refreshes the media metadata to the media database.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media_id The ID of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write \n
+ *                   %http://tizen.org/privilege/mediastorage \n
+ *                   %http://tizen.org/privilege/externalstorage
+ *
+ * @remarks You must add privilege http://tizen.org/privilege/content.write. And You add more privilege depending on your choice of contents path. \n
+ *                   If you want to access only internal storage by using  this API, you should add privilege http://tizen.org/privilege/mediastorage. \n
+ *                   Or if you want to access only external storage by using  this API, you shold add privilege http://tizen.org/privilege/externalstorage. \n
+ *                   If you can access both storage, you should add all privilege.
+ *
+ * @param[in] media_id The ID of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
- * @see media_content_connect()
  *
+ * @see media_content_connect()
  */
 int media_info_refresh_metadata_to_db(const char *media_id);
 
 /**
- * @brief Sets added_time to media info.
+ * @brief Sets the added time of media info.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] media The handle to media info
- * @param[in] added_time The added time of media info
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @param[in] media      The media info handle
+ * @param[in] added_time The added time of the media info
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @post media_info_update_to_db()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  *
+ * @post media_info_update_to_db()
  */
 int media_info_set_added_time(media_info_h media, time_t added_time);
 
 /**
  * @brief Moves the media info to the given destination path in the media database.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write \n
+ *                   %http://tizen.org/privilege/mediastorage \n
+ *                   %http://tizen.org/privilege/externalstorage
  *
- * @param[in] media The handle to media info
+ * @remarks You must add privilege http://tizen.org/privilege/content.write. And You add more privilege depending on your choice of contents path. \n
+ *                   If you want to access only internal storage by using  this API, you should add privilege http://tizen.org/privilege/mediastorage. \n
+ *                   Or if you want to access only external storage by using this API, you shold add privilege http://tizen.org/privilege/externalstorage. \n
+ *                   If you can access both storage, you should add all privilege.
+ *
+ * @param[in] media    The media info handle
  * @param[in] dst_path The path of destination
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
- * @see media_content_connect()
  *
+ * @see media_content_connect()
  */
 int media_info_move_to_db(media_info_h media, const char* dst_path);
-int media_info_move_media_to_db(media_info_h media, const char* dst_path);
-
 
 /**
- * @brief Creates a thumbnail image for given the media, asynchronously.
- * @details This function creates an thumbnail image for given media item and and calls registered callback function for completion of creating the thumbnail.
- * If there already exist a thumbnail for given media, then the path of thumbnail will be return in callback function.
+ * @brief Creates a thumbnail image for the given media, asynchronously.
+ * @details This function creates an thumbnail image for given media item and calls registered callback function for completion of creating the thumbnail.
+ *          If a thumbnail already exists for the given media, then the path of thumbnail will be returned in callback function.
  *
- * @param[in] media The handle to media info
- * @param[in] callback The callback function to invoke
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write
+ *
+ * @param[in] media     The media info handle
+ * @param[in] callback  The callback function to be invoked
  * @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter (Especially, if the request is duplicated, this error returns.)
+ * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
+ *
  * @see media_content_connect()
  */
 int media_info_create_thumbnail(media_info_h media, media_thumbnail_completed_cb callback, void *user_data);
 
 /**
+ * @brief Cancels the creation of image's thumbnail for the given media.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write
+ *
+ * @param[in] media The media info handle
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre This function requires opened connection to content service by media_content_connect().
+ * @see media_content_connect()
+ */
+int media_info_cancel_thumbnail(media_info_h media);
+
+/**
  * @}
  */
 
index d60f68c..f6c00ba 100755 (executable)
@@ -19,6 +19,8 @@
 #define __TIZEN_MEDIA_INFO_PRIVATE_H__
 
 
+#include <unistd.h>
+#include <asm/unistd.h>
 #include <string.h>
 #include <sqlite3.h>
 #include <stdlib.h>
@@ -27,6 +29,9 @@
 #include <media-svc.h>
 #include <media_content_type.h>
 #include <dlog.h>
+#include <media-util.h>
+#include <errno.h>
+
 
 #ifdef __cplusplus
 extern "C" {
@@ -36,7 +41,20 @@ extern "C" {
 #undef LOG_TAG
 #endif
 
-#define LOG_TAG "TIZEN_N_MEDIACONTENT"
+
+/**
+ * @addtogroup CAPI_CONTENT_MEDIA_INFO_MODULE
+* @{
+*
+* @file media_info_private.h
+* @brief This file contains the media info API and related structure and enumeration. \n
+*        Description of the audio, video,image content involves: album, artist, album_artist, author, genre and description tags. \n
+*        Parameters of the recording are also supported, as: format, bitrate, duration, size etc. \n
+*        Defenitions of media DB fields and tables, operations with media data relating to DB and handling with media filter attributes.
+*/
+
+
+#define LOG_TAG "CAPI_CONTENT_MEDIA_CONTENT"
 
 #define SAFE_STRLCPY(dst, src, n)      ((g_strlcpy(dst, src, n) < n) ? TRUE : FALSE)
 #define SAFE_STRLCAT(dst, src, n)      g_strlcat(dst, src, n);
@@ -44,15 +62,14 @@ extern "C" {
 #define STRING_VALID(str)              ((str != NULL && strlen(str) > 0) ? TRUE : FALSE)
 #define SQLITE3_FINALIZE(x)    {if(x != NULL) {sqlite3_finalize(x);}}
 
-#define MEDIA_CONTENT_PATH_PHONE       "/opt/media"    /**< File path prefix of files stored in phone */
-#define MEDIA_CONTENT_PATH_MMC                 "/mnt/mmc"              /**< File path prefix of files stored in mmc card */
+#define MEDIA_CONTENT_THUMB_DEFAULT_PATH       MEDIA_THUMB_ROOT_PATH"/.thumb/thumb_default.png"
+#define MEDIA_CONTENT_INSERT_FILES_PATH                MEDIA_DATA_PATH"/"
 
 #define MAX_QUERY_SIZE 4096
-#define MIN_QUERY_SIZE 256
 #define DEFAULT_QUERY_SIZE 1024
-#define MAX_KEYWORD_SIZE 2048
 #define COLLATE_STR_SIZE 32
 #define MEDIA_CONTENT_UUID_SIZE        36
+#define BATCH_REQUEST_MAX 300
 
 typedef enum {
        MEDIA_CONTENT_TYPE = 0,
@@ -61,14 +78,6 @@ typedef enum {
 } media_info_error_type_e;
 
 typedef enum {
-       Table_Media,
-       Table_Folder,
-       Table_Bookmark,
-       Table_Tag,
-       Table_TagMap,
-} media_info_table_e;
-
-typedef enum {
        MEDIA_TAG_ADD,
        MEDIA_TAG_REMOVE,
        MEDIA_TAG_UPDATE_TAG_NAME,
@@ -78,6 +87,7 @@ typedef enum {
        MEDIA_PLAYLIST_ADD,
        MEDIA_PLAYLIST_REMOVE,
        MEDIA_PLAYLIST_UPDATE_PLAYLIST_NAME,
+       MEDIA_PLAYLIST_UPDATE_THUMBNAIL_PATH,
        MEDIA_PLAYLIST_UPDATE_PLAY_ORDER,
 } playlist_function_e;
 
@@ -92,6 +102,11 @@ typedef enum {
        MEDIA_GROUP_BOOKMARK_BY_MEDIA_ID,
 } group_list_e;
 
+typedef enum {
+       MEDIA_BATCH_INSERT_NORMAL,
+       MEDIA_BATCH_INSERT_BURSTSHOT,
+} media_batch_insert_e;
+
 typedef struct _filter_s
 {
        char *condition;
@@ -109,13 +124,14 @@ typedef struct
        char *path;
        char *name;
        time_t modified_time;
-       media_content_storage_e storage_type;
+       int storage_type;
 }media_folder_s;
 
 typedef struct
 {
        int tag_id;
        char *name;
+       GList *item_list;
 }media_tag_s;
 
 typedef struct
@@ -138,6 +154,8 @@ typedef struct
 {
        int playlist_id;        //playlist id
        char *name;             // playlist name
+       char *thumbnail_path;           //playlist thumbnail path
+       GList *item_list;
 }media_playlist_s;
 
 typedef struct
@@ -146,6 +164,9 @@ typedef struct
        int width;
        int height;
        char *date_taken;
+       char *title;
+       char *burst_id;
+       char *weather;
        media_content_orientation_e orientation;
 }image_meta_s;
 
@@ -155,6 +176,7 @@ typedef struct
        char *title;
        char *album;
        char *artist;
+       char *album_artist;
        char *genre;
        char *composer;
        char *year;
@@ -176,6 +198,7 @@ typedef struct
        char *title;
        char *album;
        char *artist;
+       char *album_artist;
        char *genre;
        char *composer;
        char *year;
@@ -183,6 +206,7 @@ typedef struct
        char *copyright;
        char *track_num;
        int bitrate;
+       int bitpersample;
        int samplerate;
        int channel;
        int duration;
@@ -201,13 +225,16 @@ typedef struct
        unsigned long long size;
        time_t added_time;
        time_t modified_time;
+       time_t timeline;
        char *thumbnail_path;
        char *description;
        double longitude;
        double latitude;
        double altitude;
+       char *weather;
        int rating;
-       int favourite;
+       time_t favourite;
+       char *title;
        char *author;
        char *provider;
        char *content_name;
@@ -217,6 +244,7 @@ typedef struct
        char *keyword;
        int is_drm;
        int storage_type;
+       int sync_status;
        image_meta_s *image_meta;
        video_meta_s *video_meta;
        audio_meta_s *audio_meta;
@@ -224,26 +252,6 @@ typedef struct
 
 typedef struct
 {
-       char *name;
-}media_artist_s;
-
-typedef struct
-{
-       char *name;
-}media_genre_s;
-
-typedef struct
-{
-       char *name;
-}media_composer_s;
-
-typedef struct
-{
-       char *name;
-}media_year_s;
-
-typedef struct
-{
        char *media_id;         // media_uuid
        int function;                   // Add, remove, modify
        char *tag_name;         // tag_name
@@ -254,6 +262,7 @@ typedef struct
        char *media_id;         // media_uuid
        int function;                   // Add, remove, modify
        char *playlist_name;    // playlist_name
+       char *thumbnail_path;           //playlist thumbnail path
        int playlist_member_id; // playlist unique id of media. Same content which has same media_id can be added to Playlist
        int play_order;         //play_order
 }media_playlist_item_s;
@@ -270,8 +279,28 @@ typedef struct
        media_thumbnail_completed_cb thumbnail_completed_cb;
 }media_thumbnail_cb_s;
 
+typedef struct
+{
+       media_insert_completed_cb insert_completed_cb;
+       char *insert_list_path;
+       void *user_data;
+} media_insert_cb_s;
+
+typedef struct
+{
+       media_content_db_update_cb update_noti_cb;
+       void *user_data;
+} media_noti_cb_s;
+
 typedef struct attribute_s *attribute_h;
 
+
+typedef struct _media_content_cb_data {
+       media_scan_completed_cb callback;
+       void *user_data;
+} media_content_scan_cb_data;
+
+
 /* DB Table */
 #define DB_TABLE_MEDIA                 "media"
 #define DB_TABLE_FOLDER                "folder"
@@ -304,10 +333,12 @@ typedef struct attribute_s *attribute_h;
 #define DB_FIELD_MEDIA_SIZE                                    "size"
 #define DB_FIELD_MEDIA_ADDED_TIME                      "added_time"
 #define DB_FIELD_MEDIA_MODIFIED_TIME           "modified_time"
+#define DB_FIELD_MEDIA_TIMELINE                                "timeline"
 #define DB_FIELD_MEDIA_THUMBNAIL_PATH  "thumbnail_path"
 #define DB_FIELD_MEDIA_TITLE                           "title"
 #define DB_FIELD_MEDIA_ALBUM                           "album"
 #define DB_FIELD_MEDIA_ARTIST                          "artist"
+#define DB_FIELD_MEDIA_ALBUM_ARTIST                    "album_artist"
 #define DB_FIELD_MEDIA_GENRE                           "genre"
 #define DB_FIELD_MEDIA_COMPOSER                        "composer"
 #define DB_FIELD_MEDIA_YEAR                            "year"
@@ -316,6 +347,7 @@ typedef struct attribute_s *attribute_h;
 #define DB_FIELD_MEDIA_TRACK_NUM                       "track_num"
 #define DB_FIELD_MEDIA_DESCRIPTION                     "description"
 #define DB_FIELD_MEDIA_BITRATE                         "bitrate"
+#define DB_FIELD_MEDIA_BITPERSAMPLE            "bitpersample"
 #define DB_FIELD_MEDIA_SAMPLERATE                      "samplerate"
 #define DB_FIELD_MEDIA_CHANNEL                 "channel"
 #define DB_FIELD_MEDIA_DURATION                        "duration"
@@ -326,6 +358,7 @@ typedef struct attribute_s *attribute_h;
 #define DB_FIELD_MEDIA_HEIGHT                          "height"
 #define DB_FIELD_MEDIA_DATETAKEN                       "datetaken"
 #define DB_FIELD_MEDIA_ORIENTATION             "orientation"
+#define DB_FIELD_MEDIA_BURST_ID                        "burst_id"
 #define DB_FIELD_MEDIA_PLAYED_COUNT            "played_count"
 #define DB_FIELD_MEDIA_LAST_PLAYED_TIME                "last_played_time"
 #define DB_FIELD_MEDIA_LAST_PLAYED_POSITION    "last_played_position"
@@ -338,15 +371,35 @@ typedef struct attribute_s *attribute_h;
 #define DB_FIELD_MEDIA_LOCATION_TAG            "location_tag"
 #define DB_FIELD_MEDIA_AGE_RATING                      "age_rating"
 #define DB_FIELD_MEDIA_KEYWORD                 "keyword"
+#define DB_FIELD_MEDIA_WEATHER                 "weather"
 #define DB_FIELD_MEDIA_IS_DRM                          "is_drm"
 #define DB_FIELD_MEDIA_STORAGE_TYPE            "storage_type"
 
+#define DB_FIELD_MEDIA_FILE_NAME_PINYIN                        "file_name_pinyin"
+#define DB_FIELD_MEDIA_TITLE_PINYIN                                    "title_pinyin"
+#define DB_FIELD_MEDIA_ALBUM_PINYIN                            "album_pinyin"
+#define DB_FIELD_MEDIA_ARTIST_PINYIN                           "artist_pinyin"
+#define DB_FIELD_MEDIA_ALBUM_ARTIST_PINYIN             "album_artist_pinyin"
+#define DB_FIELD_MEDIA_GENRE_PINYIN                            "genre_pinyin"
+#define DB_FIELD_MEDIA_COMPOSER_PINYIN                 "composer_pinyin"
+#define DB_FIELD_MEDIA_COPYRIGHT_PINYIN                        "copyright_pinyin"
+#define DB_FIELD_MEDIA_DESCRIPTION_PINYIN                      "description_pinyin"
+#define DB_FIELD_MEDIA_AUTHOR_PINYIN                           "author_pinyin"
+#define DB_FIELD_MEDIA_PROVIDER_PINYIN                 "provider_pinyin"
+#define DB_FIELD_MEDIA_CONTENT_NAME_PINYIN             "content_name_pinyin"
+#define DB_FIELD_MEDIA_CATEGORY_PINYIN                 "category_pinyin"
+#define DB_FIELD_MEDIA_LOCATION_TAG_PINYIN             "location_tag_pinyin"
+#define DB_FIELD_MEDIA_AGE_RATING_PINYIN                       "age_rating_pinyin"
+#define DB_FIELD_MEDIA_KEYWORD_PINYIN                          "keyword_pinyin"
+
 /* DB field for folder */
 #define DB_FIELD_FOLDER_ID                             "folder_uuid"
 #define DB_FIELD_FOLDER_PATH                   "path"
 #define DB_FIELD_FOLDER_NAME                   "name"
 #define DB_FIELD_FOLDER_MODIFIED_TIME  "modified_time"
 #define DB_FIELD_FOLDER_STORAGE_TYPE   "storage_type"
+#define DB_FIELD_FOLDER_NAME_PINYIN    "name_pinyin"
+
 
 /* DB field for playlist */
 #define DB_FIELD_PLAYLIST_ID                                   "playlist_id"
@@ -375,19 +428,11 @@ typedef struct attribute_s *attribute_h;
 #define QUERY_KEYWORD_LIMIT "limit"
 #define QUERY_KEYWORD_DESC "DESC"
 #define QUERY_KEYWORD_SPACE " "
+#define QUERY_KEYWORD_OPEN_BRACKET "("
 #define QUERY_KEYWORD_BRACKET ")"
-#define UPDATE_SQL "UPDATE %s SET %s WHERE %s"
 
 /* DB TABLE JOIN */
-#define SELECT_EMPTY_PLAYLIST          "SELECT playlist_id, name FROM "DB_TABLE_PLAYLIST" WHERE playlist_id NOT IN (select playlist_id from "DB_TABLE_PLAYLIST_MAP")"
-#define SELECT_EMPTY_TAG                       "SELECT tag_id, name FROM "DB_TABLE_TAG" WHERE tag_id NOT IN (SELECT tag_id FROM "DB_TABLE_TAG_MAP")"
 #define FOLDER_MEDIA_JOIN                                      "("DB_TABLE_FOLDER" AS f INNER JOIN "DB_TABLE_MEDIA" AS m ON f.folder_uuid=m.folder_uuid) WHERE m.validity=1"
-#define PLAYLISTMAP_MEDIA_JOIN                         "("DB_TABLE_PLAYLIST_MAP" AS pm INNER JOIN "DB_TABLE_MEDIA" AS m \
-                                                                                       ON (pm.media_uuid = m.media_uuid)) WHERE m.validity=1"
-#define SELECT_PLAYLIST_FROM_PLAYLIST_PLAYLISTMAP_MEDIA_JOIN           "SELECT DISTINCT p.playlist_id, p.name FROM "DB_TABLE_PLAYLIST" AS p INNER JOIN "DB_TABLE_PLAYLIST_MAP" AS pm INNER JOIN "DB_TABLE_MEDIA" AS m \
-                                                                                       ON (p.playlist_id=pm.playlist_id AND pm.media_uuid = m.media_uuid) WHERE m.validity=1"
-#define SELECT_TAG_FROM_TAG_TAGMAP_MEDIA_JOIN                                  "SELECT DISTINCT t.tag_id, t.name FROM "DB_TABLE_TAG" AS t INNER JOIN "DB_TABLE_MEDIA" AS m INNER JOIN "DB_TABLE_TAG_MAP" AS tm \
-                                                                                       ON (tm.media_uuid = m.media_uuid and tm.tag_id=t.tag_id) WHERE m.validity=1"
 #define BOOKMARK_MEDIA_JOIN                            "("DB_TABLE_BOOKMARK" AS b INNER JOIN "DB_TABLE_MEDIA" AS m \
                                                                                        ON (b.media_uuid = m.media_uuid)) WHERE m.validity=1"
 #define ALBUM_MEDIA_JOIN                                       "("DB_TABLE_ALBUM" AS a INNER JOIN "DB_TABLE_MEDIA" AS m \
@@ -395,28 +440,15 @@ typedef struct attribute_s *attribute_h;
 
 /* Get Group List */
 #define SELECT_ALBUM_LIST                      "SELECT DISTINCT a.album_id, a.name, a.artist, a.album_art FROM "ALBUM_MEDIA_JOIN
-#define SELECT_ARTIST_LIST                     "SELECT DISTINCT artist FROM "DB_TABLE_MEDIA" WHERE validity=1"
-#define SELECT_GENRE_LIST                      "SELECT DISTINCT genre FROM "DB_TABLE_MEDIA" WHERE validity=1"
-#define SELECT_COMPOSER_LIST           "SELECT DISTINCT composer FROM "DB_TABLE_MEDIA" WHERE validity=1 "
-#define SELECT_YEAR_LIST                               "SELECT DISTINCT year FROM "DB_TABLE_MEDIA" WHERE validity=1 "
 #define SELECT_MEDIA_GROUP_LIST        "SELECT DISTINCT %s FROM "DB_TABLE_MEDIA" WHERE validity=1 "
 
 #define SELECT_FOLDER_LIST                     "SELECT DISTINCT f.folder_uuid, f.path, f.name, f.storage_type, f.modified_time FROM "FOLDER_MEDIA_JOIN
-//#define SELECT_TAG_LIST                              SELECT_EMPTY_TAG" UNION "SELECT_TAG_FROM_TAG_TAGMAP_MEDIA_JOIN
-//#define SELECT_PLAYLIST_LIST                 SELECT_EMPTY_PLAYLIST" UNION "SELECT_PLAYLIST_FROM_PLAYLIST_PLAYLISTMAP_MEDIA_JOIN
 #define SELECT_TAG_LIST                                "SELECT DISTINCT tag_id, name FROM "DB_VIEW_TAG" WHERE 1 "
-#define SELECT_PLAYLIST_LIST           "SELECT DISTINCT playlist_id, name FROM "DB_VIEW_PLAYLIST" WHERE 1 "
-#define SELECT_BOOKMARK_LIST           "SELECT DISTINCT b.bookmark_id, b.media_uuid, b.marked_time, b.thumbnail_path FROM "BOOKMARK_MEDIA_JOIN
+#define SELECT_PLAYLIST_LIST                   "SELECT DISTINCT playlist_id, name, p_thumbnail_path FROM "DB_VIEW_PLAYLIST" WHERE 1 "
 
 /* Get Group Count */
 #define SELECT_ALBUM_COUNT             "SELECT COUNT(DISTINCT a.album_id) FROM "ALBUM_MEDIA_JOIN
-#define SELECT_ARTIST_COUNT            "SELECT COUNT(DISTINCT artist) FROM "DB_TABLE_MEDIA" WHERE validity=1"
-#define SELECT_GENRE_COUNT                     "SELECT COUNT(DISTINCT genre) FROM "DB_TABLE_MEDIA" WHERE validity=1"
-#define SELECT_COMPOSER_COUNT  "SELECT COUNT(DISTINCT composer) FROM "DB_TABLE_MEDIA" WHERE validity=1"
-#define SELECT_YEAR_COUNT                      "SELECT COUNT(DISTINCT year) FROM "DB_TABLE_MEDIA" WHERE validity=1"
 #define SELECT_FOLDER_COUNT            "SELECT COUNT(DISTINCT f.folder_uuid) FROM "FOLDER_MEDIA_JOIN
-//#define SELECT_TAG_COUNT                     "SELECT COUNT(*) FROM ("SELECT_TAG_LIST
-//#define SELECT_PLAYLIST_COUNT                "SELECT COUNT(*) FROM ("SELECT_PLAYLIST_LIST
 #define SELECT_TAG_COUNT                       "SELECT COUNT(DISTINCT tag_id) FROM "DB_VIEW_TAG" WHERE 1 "
 #define SELECT_PLAYLIST_COUNT          "SELECT COUNT(DISTINCT playlist_id) FROM "DB_VIEW_PLAYLIST" WHERE 1 "
 #define SELECT_BOOKMARK_COUNT  "SELECT COUNT(DISTINCT b.bookmark_id) FROM "BOOKMARK_MEDIA_JOIN
@@ -425,18 +457,13 @@ typedef struct attribute_s *attribute_h;
 
 /* Get Media Count of Group */
 #define SELECT_MEDIA_COUNT_FROM_MEDIA                  "SELECT COUNT(*) FROM ("SELECT_MEDIA_ITEM               //to apply limit condition. "SELECT COUNT(*) FROM "DB_TABLE_MEDIA" WHERE validity=1"
+#define SELECT_MEDIA_COUNT_FROM_MEDIA_SIMPLE   "SELECT COUNT(*) FROM "DB_TABLE_MEDIA" WHERE validity=1 "
 #define SELECT_MEDIA_COUNT_FROM_ALBUM                  "SELECT COUNT(*) FROM "DB_TABLE_MEDIA" WHERE validity=1 AND album_id='%d'"
-#define SELECT_MEDIA_COUNT_FROM_ARTIST                 "SELECT COUNT(*) FROM "DB_TABLE_MEDIA" WHERE validity=1 AND artist='%q'"
-#define SELECT_MEDIA_COUNT_FROM_GENRE                  "SELECT COUNT(*) FROM "DB_TABLE_MEDIA" WHERE validity=1 AND genre='%q'"
-#define SELECT_MEDIA_COUNT_FROM_COMPOSER               "SELECT COUNT(*) FROM "DB_TABLE_MEDIA" WHERE validity=1 AND composer='%q'"
-#define SELECT_MEDIA_COUNT_FROM_YEAR                           "SELECT COUNT(*) FROM "DB_TABLE_MEDIA" WHERE validity=1 AND year='%q'"
 #define SELECT_MEDIA_COUNT_FROM_GROUP                  "SELECT COUNT(*) FROM ("SELECT_MEDIA_FROM_GROUP         //to apply limit condition.
 #define SELECT_MEDIA_COUNT_FROM_GROUP_NULL             "SELECT COUNT(*) FROM ("SELECT_MEDIA_FROM_GROUP_NULL    //to apply limit condition.
 #define SELECT_MEDIA_COUNT_FROM_FOLDER                 "SELECT COUNT(*) FROM "DB_TABLE_MEDIA" WHERE validity=1 AND folder_uuid='%q'"
-//#define SELECT_MEDIA_COUNT_FROM_TAG                          "SELECT COUNT(*) FROM "DB_TABLE_TAG_MAP" WHERE tag_id=%d AND media_uuid IN                                                                                                      (SELECT media_uuid FROM "DB_TABLE_MEDIA" WHERE validity=1"
-//#define SELECT_MEDIA_COUNT_FROM_PLAYLIST             "SELECT COUNT(*) FROM "DB_TABLE_PLAYLIST_MAP" WHERE playlist_id=%d AND media_uuid IN                                                                                                    (SELECT media_uuid FROM "DB_TABLE_MEDIA" WHERE validity=1"
 #define SELECT_MEDIA_COUNT_FROM_TAG                            "SELECT COUNT(*) FROM "DB_VIEW_TAG" WHERE (tag_id=%d AND media_count>0) "
-#define SELECT_MEDIA_COUNT_FROM_PLAYLIST               "SELECT COUNT(*) FROM "DB_VIEW_PLAYLIST" WHERE (playlist_id=%d and media_count>0) "
+#define SELECT_MEDIA_COUNT_FROM_PLAYLIST                       "SELECT COUNT(*) FROM "DB_VIEW_PLAYLIST" WHERE (playlist_id=%d and media_count>0) "
 
 /* Get Group Info by Group ID*/
 #define SELECT_ALBUM_FROM_ALBUM                "SELECT * FROM "DB_TABLE_ALBUM" WHERE album_id=%d"
@@ -450,69 +477,50 @@ typedef struct attribute_s *attribute_h;
 #define INSERT_TAG_TO_TAG                                              "INSERT INTO "DB_TABLE_TAG" (name) VALUES (%Q)"
 #define REMOVE_TAG_ITEM_FROM_TAG_MAP           "DELETE FROM "DB_TABLE_TAG_MAP" WHERE tag_id=%d AND media_uuid='%q'"
 #define UPDATE_TAG_NAME_FROM_TAG                       "UPDATE "DB_TABLE_TAG" SET name='%q' WHERE tag_id=%d"
-//#define SELECT_TAG_COUNT_BY_MEDIA_ID                 "SELECT COUNT(*) FROM "DB_TABLE_TAG" WHERE tag_id IN (SELECT tag_id FROM "DB_TABLE_TAG_MAP" WHERE media_uuid = '%q')"
-//#define SELECT_TAG_LIST_BY_MEDIA_ID                          "SELECT * FROM "DB_TABLE_TAG" WHERE tag_id IN (SELECT tag_id FROM "DB_TABLE_TAG_MAP" WHERE media_uuid = '%s')"
-#define SELECT_TAG_COUNT_BY_MEDIA_ID                   "SELECT COUNT(*) FROM "DB_VIEW_TAG" WHERE media_uuid = '%q'"
+#define SELECT_TAG_COUNT_BY_MEDIA_ID                   "SELECT COUNT(*) FROM "DB_VIEW_TAG" WHERE media_uuid = '%s'"
 #define SELECT_TAG_LIST_BY_MEDIA_ID                            "SELECT tag_id, name FROM "DB_VIEW_TAG" WHERE media_uuid = '%s'"
 
+/* Get Media list of Group */
+#define MEDIA_INFO_ITEM "media_uuid, path, file_name, media_type, mime_type, size, added_time, modified_time, thumbnail_path, description, \
+                                                       rating, favourite, author, provider, content_name, category, location_tag, age_rating, keyword, is_drm, storage_type, longitude, latitude, altitude, width, height, datetaken, orientation, title, album, artist, album_artist, genre, composer, year, recorded_date, copyright, track_num, bitrate, bitpersample, duration, played_count, last_played_time, last_played_position, samplerate, channel, burst_id, timeline, weather, sync_status"
+
 /* Playlist Info */
 #define INSERT_PLAYLIST_TO_PLAYLIST                                            "INSERT INTO "DB_TABLE_PLAYLIST" (name) VALUES (%Q)"
 #define UPDATE_PLAYLIST_NAME_FROM_PLAYLIST                     "UPDATE "DB_TABLE_PLAYLIST" SET name='%q' WHERE playlist_id=%d"
+#define UPDATE_PLAYLIST_THUMBNAIL_FROM_PLAYLIST                "UPDATE "DB_TABLE_PLAYLIST" SET thumbnail_path='%q' WHERE playlist_id=%d"
 #define SELECT_PLAYLIST_ID_FROM_PLAYLIST                               "SELECT playlist_id FROM "DB_TABLE_PLAYLIST" WHERE name='%q'"
-//#define SELECT_PLAYLIST_ITEM_ID_FROM_PLAYLIST_MAP            "SELECT pm._id, pm.media_uuid FROM "PLAYLISTMAP_MEDIA_JOIN" AND pm.playlist_id=%d"
-#define SELECT_PLAYLIST_ITEM_ID_FROM_PLAYLIST_VIEW             "SELECT pm_id, media_uuid FROM "DB_VIEW_PLAYLIST" WHERE playlist_id=%d "
-
-//#define SELECT_PLAY_ORDER_FROM_PLAYLIST_MAP                  "SELECT play_order FROM "DB_TABLE_PLAYLIST_MAP" WHERE playlist_id=%d and _id=%d"
+#define SELECT_PLAYLIST_ITEM_ID_FROM_PLAYLIST_VIEW     "SELECT pm_id, media_uuid FROM "DB_VIEW_PLAYLIST" WHERE (playlist_id=%d and media_count>0) "
+#define SELECT_PLAYLIST_ITEM_ALL_FROM_PLAYLIST_VIEW    "SELECT "MEDIA_INFO_ITEM" , pm_id FROM "DB_VIEW_PLAYLIST" WHERE (playlist_id=%d and media_count>0) "
 #define SELECT_PLAY_ORDER_FROM_PLAYLIST_VIEW                   "SELECT play_order FROM "DB_VIEW_PLAYLIST" WHERE playlist_id=%d and pm_id=%d"
-//#define SELECT_MAX_PLAY_ORDER_FROM_PLAYLIST_MAP      "SELECT MAX(play_order) FROM "DB_TABLE_PLAYLIST_MAP" WHERE playlist_id=%d"
 #define SELECT_MAX_PLAY_ORDER_FROM_PLAYLIST_VIEW       "SELECT MAX(play_order) FROM "DB_VIEW_PLAYLIST" WHERE playlist_id=%d"
 #define REMOVE_PLAYLIST_ITEM_FROM_PLAYLIST_MAP         "DELETE FROM "DB_TABLE_PLAYLIST_MAP" WHERE playlist_id=%d AND _id=%d"
 #define UPDATE_PLAYLIST_ORDER_FROM_PLAYLIST_MAP                "UPDATE "DB_TABLE_PLAYLIST_MAP" SET play_order=%d WHERE playlist_id=%d AND _id=%d"
 
 /* Bookmark */
-#define INSERT_BOOKMARK_TO_BOOKMARK    "INSERT INTO "DB_TABLE_BOOKMARK" (media_uuid, marked_time, thumbnail_path) VALUES ('%q', '%d', %Q)"
-#define SELECT_BOOKMARK_COUNT_BY_MEDIA_ID      "SELECT COUNT(*) FROM "DB_TABLE_BOOKMARK" WHERE media_uuid='%q'"
-#define SELECT_BOOKMARK_LIST_BY_MEDIA_ID       "SELECT * FROM "DB_TABLE_BOOKMARK" WHERE media_uuid='%q'"
-#define SELECT_BOOKMARK_LIST_BY_MEDIA_ID_USUAL "SELECT * FROM "DB_TABLE_BOOKMARK" WHERE media_uuid='%s'"
-
-/* Get Meta */
-#define MEDIA_AV_META                  "media_uuid, title, album, artist, genre, composer, year, recorded_date, copyright, track_num, bitrate, duration, played_count, last_played_time, last_played_position"
-#define MEDIA_IMAGE_META               "media_uuid, width, height, datetaken, orientation"
-#define SELECT_IMAGE_FROM_MEDIA        "SELECT "MEDIA_IMAGE_META" FROM "DB_TABLE_MEDIA" WHERE media_uuid='%s'"
-#define SELECT_AUDIO_FROM_MEDIA        "SELECT "MEDIA_AV_META", samplerate, channel FROM "DB_TABLE_MEDIA" WHERE media_uuid='%s'"
-#define SELECT_VIDEO_FROM_MEDIA        "SELECT "MEDIA_AV_META", width, height FROM "DB_TABLE_MEDIA" WHERE media_uuid='%s'"
+#define INSERT_BOOKMARK_TO_BOOKMARK                    "INSERT INTO "DB_TABLE_BOOKMARK" (media_uuid, marked_time, thumbnail_path) VALUES ('%q', '%d', %Q)"
+#define SELECT_BOOKMARK_COUNT_BY_MEDIA_ID              "SELECT COUNT(*) FROM "BOOKMARK_MEDIA_JOIN" AND b.media_uuid='%s'"
+#define SELECT_BOOKMARK_LIST_BY_MEDIA_ID                       "SELECT b.bookmark_id, b.media_uuid, b.marked_time, b.thumbnail_path FROM "BOOKMARK_MEDIA_JOIN" AND b.media_uuid='%s'"
 
 /* Update Meta*/
 #define UPDATE_AV_META_FROM_MEDIA      "UPDATE "DB_TABLE_MEDIA" SET played_count=%d, last_played_time=%d, last_played_position=%d WHERE media_uuid='%q'"
-#define UPDATE_IMAGE_META_FROM_MEDIA   "UPDATE "DB_TABLE_MEDIA" SET orientation=%d WHERE media_uuid='%q'"
-
-/* Get Media list of Group */
-//#define MEDIA_INFO_ITEM "media_uuid, path, file_name, media_type, mime_type, size, added_time, modified_time, thumbnail_path, description,
-//                                                     rating, favourite, author, provider, content_name, category, location_tag, age_rating, is_drm, storage_type"
-#define MEDIA_INFO_ITEM "media_uuid, path, file_name, media_type, mime_type, size, added_time, modified_time, thumbnail_path, description, \
-                                                       rating, favourite, author, provider, content_name, category, location_tag, age_rating, keyword, is_drm, storage_type, longitude, latitude, altitude, width, height, datetaken, orientation, title, album, artist, genre, composer, year, recorded_date, copyright, track_num, bitrate, duration, played_count, last_played_time, last_played_position, samplerate, channel"
+#define UPDATE_IMAGE_META_FROM_MEDIA   "UPDATE "DB_TABLE_MEDIA" SET orientation=%d, weather=%Q WHERE media_uuid='%q'"
 
 #define SELECT_MEDIA_ITEM                                      "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE validity=1"
 #define SELECT_MEDIA_FROM_MEDIA                        "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE validity=1 AND media_uuid='%s'"
 #define SELECT_MEDIA_BY_PATH                           "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE validity=1 AND path='%q'"
 #define SELECT_MEDIA_FROM_ALBUM                        "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE validity=1 AND album_id=%d"
-#define SELECT_MEDIA_FROM_ARTIST                       "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE validity=1 AND artist='%q'"
-#define SELECT_MEDIA_FROM_GENRE                        "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE validity=1 AND genre='%q'"
-#define SELECT_MEDIA_FROM_COMPOSER             "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE validity=1 AND author='%q'"
-#define SELECT_MEDIA_FROM_YEAR                 "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE validity=1 AND year='%q'"
 #define SELECT_MEDIA_FROM_GROUP                        "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE validity=1 AND %s='%q'"
 #define SELECT_MEDIA_FROM_GROUP_NULL   "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE validity=1 AND %s IS NULL"
-#define SELECT_MEDIA_FROM_FOLDER                       "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE validity=1 AND folder_uuid='%q'"
+#define SELECT_MEDIA_FROM_FOLDER                       "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE validity=1 AND folder_uuid='%s'"
 #define SELECT_MEDIA_FROM_TAG                          "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE media_uuid IN (SELECT media_uuid FROM "DB_TABLE_TAG_MAP" WHERE tag_id=%d) AND validity=1"
 #define SELECT_MEDIA_FROM_PLAYLIST             "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE media_uuid IN (SELECT media_uuid FROM "DB_TABLE_PLAYLIST_MAP" WHERE playlist_id=%d) AND validity=1"
+#define SELECT_MEDIA_PATH_BY_ID                        "SELECT path FROM "DB_TABLE_MEDIA" WHERE media_uuid='%q'"
 
 /* Delete */
-#define DELETE_MEDIA_FROM_MEDIA                                "DELETE FROM "DB_TABLE_MEDIA" WHERE media_uuid='%q'"
-#define DELETE_FOLDER_FROM_FOLDER                      "DELETE FROM "DB_TABLE_FOLDER" WHERE folder_uuid='%q'"
-#define DELETE_PLAYLIST_FROM_PLAYLIST                  "DELETE FROM "DB_TABLE_PLAYLIST" WHERE playlist_id=%d"
-#define DELETE_TAG_FROM_TAG                                    "DELETE FROM "DB_TABLE_TAG" WHERE tag_id=%d"
-#define DELETE_BOOKMARK_FROM_BOOKMARK          "DELETE FROM "DB_TABLE_BOOKMARK" WHERE bookmark_id=%d"
-
+#define DELETE_MEDIA_FROM_MEDIA_BATCH  "DELETE FROM "DB_TABLE_MEDIA" WHERE %s"
+#define DELETE_PLAYLIST_FROM_PLAYLIST          "DELETE FROM "DB_TABLE_PLAYLIST" WHERE playlist_id=%d"
+#define DELETE_TAG_FROM_TAG                            "DELETE FROM "DB_TABLE_TAG" WHERE tag_id=%d"
+#define DELETE_BOOKMARK_FROM_BOOKMARK  "DELETE FROM "DB_TABLE_BOOKMARK" WHERE bookmark_id=%d"
 
 /**
  *@internal
@@ -547,6 +555,11 @@ attribute_h _content_get_alias_attirbute_handle(void);
 /**
  *@internal
  */
+int _media_info_get_media_info_from_db(const char *path, media_info_h media);
+
+/**
+ *@internal
+ */
 void _media_info_item_get_detail(sqlite3_stmt *stmt, media_info_h media);
 
 /**
@@ -617,14 +630,15 @@ int _media_db_get_group_item(const char *group_name, filter_h filter, media_info
 /**
  *@internal
  */
-int _media_db_get_media_group_item_count(const char *group_name, media_group_e group, filter_h filter, int *item_count);
+int _media_db_get_media_group_item_count(const char *group_name, filter_h filter, media_group_e group, int *item_count);
 
 /**
  *@internal
  */
-int _media_db_get_media_group_item(const char *group_name, media_group_e group, filter_h filter, media_info_cb callback, void *user_data);
+int _media_db_get_media_group_item(const char *group_name, filter_h filter, media_group_e group, media_info_cb callback, void *user_data);
 
 /**
+ * @internal
  * @brief Creates a media filter attribute handle.
  * @details This function creates a media filter attribute handle. The handle can be
  * used to convert to attributes of database from attributes of user.
@@ -634,12 +648,14 @@ int _media_db_get_media_group_item(const char *group_name, media_group_e group,
  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  * @see media_filter_attribute_destory()
  *
  */
 int _media_filter_attribute_create(attribute_h *attr);
 
 /**
+ * @internal
  * @brief Add the attributes to the handle.
  * @details This function add the attribute to handle.
  * @param[in] filter The handle to media filter attribute
@@ -649,12 +665,14 @@ int _media_filter_attribute_create(attribute_h *attr);
  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  * @see media_filter_attribute_remove()
  *
  */
 int _media_filter_attribute_add(attribute_h atrr, char *user_attr, char *platform_attr);
 
 /**
+ * @internal
  * @brief Destroys a media filter attribute handle.
  * @details The function frees all resources related to the media filter attribute handle. The filter attribute
  * handle no longer can be used to perform any operation. A new handle
@@ -664,12 +682,14 @@ int _media_filter_attribute_add(attribute_h atrr, char *user_attr, char *platfor
  * @return 0 on success, otherwise a negative error value.
  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  * @see media_filter_create()
  *
  */
 int _media_filter_attribute_destory(attribute_h attr);
 
 /**
+ * @internal
  * @brief Replace to platform attributes from user attributes.
  * @details This function replace to platform attributes from user attributes to generate the WHERE clause
  * @param[in] filter The handle to media filter attribute
@@ -679,30 +699,84 @@ int _media_filter_attribute_destory(attribute_h attr);
  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  * @see media_filter_attribute_create()
  * @see media_filter_attribute_destory()
  *
  */
 int _media_filter_attribute_generate(attribute_h attr, char *condition, media_content_collation_e collate_type, char **generated_condition);
+
+
+/**
+ * @internal
+ * @brief Replace to platform attributes from user attributes.
+ * @details This function replace to platform attributes from user attributes to generate the WHERE clause
+ * @param[in] filter The handle to media filter attribute
+ * @param[in] attr The attribute
+ * @param[in] generated_option The handle to generated option
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_DB_FAILED Filed DB
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ * @see media_filter_attribute_create()
+ * @see media_filter_attribute_destory()
+ *
+ */
+
 int _media_filter_attribute_option_generate(attribute_h attr, filter_h filter, char **generated_option);
 
+#define FONT_COLOR_RESET    "\033[0m"
+#define FONT_COLOR_RED      "\033[31m"
+#define FONT_COLOR_GREEN    "\033[32m"
+#define FONT_COLOR_YELLOW   "\033[33m"
+#define FONT_COLOR_BLUE     "\033[34m"
+#define FONT_COLOR_PURPLE   "\033[35m"
+#define FONT_COLOR_CYAN     "\033[36m"
+#define FONT_COLOR_GRAY     "\033[37m"
+
+#define media_content_gettid() syscall(__NR_gettid)
+
 #define media_content_retv_if(expr, val) do { \
                        if(expr) { \
-                               LOGE("[%s-%d]", __FUNCTION__, __LINE__);    \
+                               LOGE(FONT_COLOR_RED"[%d]", media_content_gettid());    \
                                return (val); \
                        } \
                } while (0)
 
 #define media_content_debug(fmt, arg...) do { \
-                       LOGD("[%s-%d]"fmt"", __FUNCTION__, __LINE__,##arg);     \
+                       LOGD(FONT_COLOR_RESET"[%d]"fmt"", media_content_gettid(), ##arg);     \
+               } while (0)
+
+#define media_content_info(fmt, arg...) do { \
+                       LOGI(FONT_COLOR_GREEN"[%d]"fmt"", media_content_gettid() ,##arg);     \
                } while (0)
 
 #define media_content_error(fmt, arg...) do { \
-                       LOGE("[%s-%d]"fmt"", __FUNCTION__, __LINE__,##arg);     \
+                       LOGE(FONT_COLOR_RED"[%d]"fmt"",media_content_gettid(), ##arg);     \
                } while (0)
 
 #define media_content_debug_func() do { \
-                       LOGD("[%s-%d]", __FUNCTION__, __LINE__);     \
+                       LOGD(FONT_COLOR_RESET"[%d]", media_content_gettid());     \
+               } while (0)
+
+#define media_content_sec_debug(fmt, arg...) do { \
+                       SECURE_LOGD(FONT_COLOR_RESET"[%d]"fmt"", media_content_gettid(), ##arg);     \
+               } while (0)
+
+#define media_content_sec_warn(fmt, arg...) do { \
+                       SECURE_LOGW(FONT_COLOR_GREEN"[%d]"fmt"",media_content_gettid(), ##arg);     \
+               } while (0)
+
+#define media_content_sec_error(fmt, arg...) do { \
+                       SECURE_LOGE(FONT_COLOR_RED"[%d]"fmt"",media_content_gettid(), ##arg);     \
+               } while (0)
+
+#define ERR_BUF_LENGTH 256
+#define media_content_stderror(fmt) do { \
+                       char buf[ERR_BUF_LENGTH] = {0, }; \
+                       strerror_r(errno, buf, ERR_BUF_LENGTH); \
+                       LOGE(FONT_COLOR_RED fmt" : STANDARD ERROR [%s]", buf); \
                } while (0)
 
 #ifdef __cplusplus
index 5786395..1df2ab9 100755 (executable)
 extern "C" {
 #endif /* __cplusplus */
 
-
+/**
+ * @file
+ * @brief This file contains the playlist API and functions related with handling playlists. \n
+ *        Functions include operations to get the number of playlists, the number of media-info for the playlist  \n
+ *        and all media files in the playlist, to clone, destroy, insert and delete playlist from DB,  \n
+ *        to handle with name, ID, thumbnail, played order and media info of the playlist.
+ */
 
 /**
  * @addtogroup CAPI_CONTENT_MEDIA_PLAYLIST_MODULE
  * @{
  */
 
+
 /**
- * @brief Gets the number of playlist for the passed @a filter from the media database.
+ * @brief Gets the number of playlists for the passed @a filter from the media database.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] filter The handle to filter.
- * @param[out] playlist_count The count of media playlist
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  filter         The handle to the filter
+ * @param[out] playlist_count The count of the media playlist
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
- * @see media_content_connect()
  *
+ * @see media_content_connect()
  */
 int media_playlist_get_playlist_count_from_db(filter_h filter, int *playlist_count);
 
 /**
- * @brief Iterates through the media playlist with optional @a filter from the media database.
- * @details This function gets all media playlist handles meeting the given filter.
- * The callback function will be invoked for every retrieved media playlist.
- * If NULL is passed to the filter, no filtering is applied.
- *
- * @param [in] filter The handle to audio filter
- * @param [in] callback The callback function to invoke
- * @param [in] user_data User data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @brief Iterates through the media playlists with an optional @a filter from the media database.
+ * @details This function gets all media playlists meeting the given filter.
+ *          The callback function will be invoked for every retrieved media playlist.
+ *          If @c NULL is passed to the filter, no filtering is applied.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] filter    The handle to the audio filter
+ * @param[in] callback  The callback function to be invoked
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @pre This function requires opened connection to content service by media_content_connect().
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre  This function requires opened connection to content service by media_content_connect().
  * @post This function invokes media_playlist_cb().
- * @see #media_playlist_cb
+ *
+ * @see media_playlist_cb()
  * @see media_content_connect()
  * @see media_filter_create()
- *
  */
 int media_playlist_foreach_playlist_from_db(filter_h filter, media_playlist_cb callback, void *user_data);
 
 /**
- * @brief Gets number of media info for the given playlist present in the media database.
+ * @brief Gets the number of the media info for the given playlist present in the media database.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in]  playlist_id  The ID of the media playlist
+ * @param[in]  filter       The media filter handle
+ * @param[out] media_count  The number of media items
  *
- * @param [in] playlist_id The ID of media playlist
- * @param [in] filter The handle to media filter
- * @param [out] media_count The number of media items
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
- * @see media_content_connect()
  *
+ * @see media_content_connect()
  */
 int media_playlist_get_media_count_from_db(int playlist_id, filter_h filter, int *media_count);
 
 /**
- * @brief Iterates through the media files with optional @a filter in the given @a audio @a playlist from the media database.
+ * @brief Iterates through the media files with an optional @a filter in the given audio playlist from the media database.
  * @details This function gets all media files associated with the given media playlist and
- * meeting desired filter option and calls registered callback function for
- * every retrieved media info. If NULL is passed to the @a filter, no filtering is applied.
- *
- * @param [in] playlist_id The ID of media playlist
- * @param [in] filter The handle to audio filter
- * @param [in] callback The callback function to invoke
- * @param [in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ *          meeting desired filter option and calls registered callback function for
+ *          every retrieved media info. If @c NULL is passed to the @a filter, no filtering is applied.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] playlist_id The ID of the media playlist
+ * @param[in] filter      The audio filter handle
+ * @param[in] callback    The callback function to be invoked
+ * @param[in] user_data   The user data to be passed to the callback function
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @pre This function requires opened connection to content service by media_content_connect().
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre  This function requires opened connection to content service by media_content_connect().
  * @post This function invokes media_info_cb().
- * @see #media_info_cb
+ *
+ * @see media_info_cb()
  * @see media_content_connect()
  * @see media_filter_create()
- *
  */
 int media_playlist_foreach_media_from_db(int playlist_id, filter_h filter, playlist_member_cb callback, void *user_data);
 
 /**
- * @brief Inserts a new playlist with given name in the media database.
+ * @brief Inserts a new playlist with the given name into the media database.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write
+ *
+ * @remarks You must release the created handle using media_playlist_destroy().
  *
- * @remark The created handle must be released with media_playlist_destroy() by you.
- * @param [in] name The name of the inserted playlist
- * @param [out] playlist A created handle to media playlist
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  name     The name of the inserted playlist
+ * @param[out] playlist A created handle to media playlist
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB Operation failed
+ * @retval #MEDIA_CONTENT_ERROR_DB_BUSY           DB Operation busy
+ * @retval #MEDIA_CONTENT_ERROR_NETWORK           Network fail
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
+ *
  * @see media_content_connect()
  * @see media_playlist_delete_from_db()
- *
  */
 int media_playlist_insert_to_db(const char *name, media_playlist_h *playlist);
 
 /**
  * @brief Deletes the given playlist from the media database.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] playlist The handle to media playlist
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write
+ *
+ * @param[in] playlist_id The ID of media playlist
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
+ *
  * @see media_content_connect()
  * @see media_playlist_insert_to_db()
- *
  */
 int media_playlist_delete_from_db(int playlist_id);
 
 /**
  * @brief Gets the media playlist from the media database.
  *
- * @details This function creates a new media playlist handle from the media database by the given playlist_id.
- * media playlist will be created, which is filled with playlist information.
+ * @details This function creates a new media playlist handle from the media database by the given @a playlist_id.
+ *          The media playlist will be created and will be filled with the playlist information.
  *
- * @remarks @a playlist must be released with media_playlist_destroy() by you.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] playlist_id The ID of media playlist
- * @param [in] filter The handle to audio filter
- * @param[out] playlist The media playlist handle associated with the playlist ID
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @remarks You must release @a playlist using media_playlist_destroy().
+ *
+ * @param[in]  playlist_id The ID of the media playlist
+ * @param[out] playlist    The media playlist handle associated with the playlist ID
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
+ *
  * @see media_content_connect()
  * @see media_playlist_destroy()
- *
  */
-int media_playlist_get_playlist_from_db(int playlist_id, filter_h filter, media_playlist_h *playlist);
+int media_playlist_get_playlist_from_db(int playlist_id, media_playlist_h *playlist);
 
 /**
  * @brief Destroys a playlist handle.
- * @details Function frees all resources related to playlist handle. This
- * handle no longer can be used to perform any operation. New handle has to
- * be created before next usage.
+ * @details This function frees all resources related to the playlist handle. This
+ *          handle no longer can be used to perform any operation. A new handle has to
+ *          be created before next usage.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] playlist The media playlist handle
  *
- * @param [in] playlist The handle to media playlist
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @see media_playlist_clone()
- * @pre Get copy of playlist handle by calling media_playlist_clone() or media_playlist_insert_to_db()
- * @see media_playlist_clone()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  *
+ * @pre Get a copy of playlist handle by calling media_playlist_clone() or media_playlist_insert_to_db().
+ *
+ * @see media_playlist_clone()
  */
 int media_playlist_destroy(media_playlist_h playlist);
 
 /**
- * @brief Clones playlist handle.
+ * @brief Clones playlist handle.
  * @details This function copies the media playlist handle from a source to
- * destination. There is no media_playlist_create() function. The media_playlist_h is created internally and available through 
- * media playlist foreach function such as media_playlist_foreach_playlist_from_db(). To use this handle outside of these foreach functions, 
- * use this function.
+ *          destination. There is no media_playlist_create() function. The media_playlist_h is created internally and available through
+ *          media playlist foreach function such as media_playlist_foreach_playlist_from_db().
+ *          To use this handle outside of these foreach functions, use this function.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remarks The destination handle must be released using media_playlist_destroy().
  *
- * @remark The destination handle must be released with media_playlist_destroy() by you.
+ * @param[in]  src  The source handle of a media playlist
+ * @param[out] dst  The destination handle to a media playlist
  *
- * @param [in] src The source handle to media playlist
- * @param [out] dst A destination handle to media playlist
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @see media_playlist_destroy()
  * @see media_playlist_foreach_playlist_from_db()
  */
 int media_playlist_clone(media_playlist_h *dst, media_playlist_h src);
 
 /**
- * @brief Gets media playlist's ID.
+ * @brief Gets the media playlist ID.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in]  playlist    The media playlist handle
+ * @param[out] playlist_id The ID of the media playlist
  *
- * @param [in] playlist The handle to media playlist
- * @param [out] playlist_id The ID of media playlist
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_playlist_get_playlist_id(media_playlist_h playlist, int *playlist_id);
 
 /**
  * @brief Gets a name of the playlist.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a playlist_name must be released with free() by you.
+ * @remarks You must release @a playlist_name using free().
  *
- * @param [in] playlist The handle to media playlist
- * @param [out] playlist_name The playlist name
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @param[in]  playlist      The media playlist handle
+ * @param[out] playlist_name The playlist name
  *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_playlist_get_name(media_playlist_h playlist, char **playlist_name);
 
 /**
- * @brief Sets the playlist name.
+ * @brief Sets the name of the playlist.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] playlist The handle to media playlist
+ * @param[in] playlist      The media playlist handle
  * @param[in] playlist_name The name of the media playlist
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @post media_playlist_update_to_db()
  *
  */
 int media_playlist_set_name(media_playlist_h playlist, const char *playlist_name);
 
 /**
- * @brief Sets the played order in the playlist.
+ * @brief Gets a thumbnail path of the playlist.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] playlist The handle to media playlist
- * @param[in] playlist_member_id The ID to member of playlist
- * @param[in] play_order The played order
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @remarks You must release @a path using free().
+ *
+ * @param[in]  playlist The media playlist handle
+ * @param[out] path     The path of the thumbnail
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ */
+int media_playlist_get_thumbnail_path(media_playlist_h playlist, char **path);
+
+/**
+ * @brief Sets the thumbnail path of the playlist.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] playlist The media playlist handle
+ * @param[in] path     The path of the thumbnail
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @post media_playlist_update_to_db()
+ */
+int media_playlist_set_thumbnail_path(media_playlist_h playlist, const char *path);
+
+
+/**
+ * @brief Sets the playing order in the playlist.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] playlist           The media playlist handle
+ * @param[in] playlist_member_id The playlist member ID
+ * @param[in] play_order         The playing order
  *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @post media_playlist_update_to_db()
  */
 int media_playlist_set_play_order(media_playlist_h playlist, int playlist_member_id, int play_order);
 
 /**
  * @brief Adds a new media info to the playlist.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] playlist The media playlist handle
+ * @param[in] media_id The ID to the media info which is added
  *
- * @param[in] playlist The handle to media playlist
- * @param[in] media_id The ID to media info which is added
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @pre This function requires opened connection to content service by media_content_connect().
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre  This function requires opened connection to content service by media_content_connect().
  * @post media_playlist_update_to_db()
+ *
  * @see media_content_connect()
  * @see media_playlist_remove_media()
- *
  */
 int media_playlist_add_media(media_playlist_h playlist, const char *media_id);
 
 /**
- * @brief Removes the playlist member related with media from the given playlist.
+ * @brief Removes the playlist members related with the media from the given playlist.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] playlist           The media playlist handle
+ * @param[in] playlist_member_id The playlist member ID
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
- * @param[in] playlist The handle to media playlist
- * @param[in] playlist_member_id The ID to member of playlist
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @pre This function requires opened connection to content service by media_content_connect().
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre  This function requires opened connection to content service by media_content_connect().
  * @post media_playlist_update_to_db()
+ *
  * @see media_content_connect()
  * @see media_playlist_add_media()
- *
  */
 int media_playlist_remove_media(media_playlist_h playlist, int playlist_member_id);
 
 /**
- * @brief Gets the played order in the playlist.
+ * @brief Gets the played order of the playlist.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] playlist The handle to media playlist
- * @param[in] playlist_member_id The ID to member of playlist
- * @param [out] play_order The played order
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in] playlist           The media playlist handle
+ * @param[in] playlist_member_id The playlist member ID
+ * @param[out] play_order        The played order
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_playlist_get_play_order(media_playlist_h playlist, int playlist_member_id, int *play_order);
 
 /**
  * @brief Updates the media playlist to the media database.
  *
- * @details The function updates the given media playlist in the media database. The function should be called after any change in playlist, to be updated to the media 
- * database. For example, after using media_playlist_set_name() for setting the name of the playlist, media_playlist_update_to_db() function should be called so as to update 
- * the given playlist attibutes in the media database.
+ * @details The function updates the given media playlist in the media database.
+ *          The function should be called after any change in the playlist, to be updated to the media database.
+ *          For example, after using media_playlist_set_name() for setting the name of the playlist, the
+ *          media_playlist_update_to_db() function should be called so as to update
+ *          the given playlist attributes in the media database.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] playlist The handle to media playlist
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write
+ *
+ * @param[in] playlist The media playlist handle
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
+ *
  * @see media_content_connect()
  * @see media_playlist_destroy()
  * @see media_playlist_add_media()
  * @see media_playlist_remove_media()
  * @see media_playlist_set_name()
  * @see media_playlist_set_play_order()
- *
  */
 int media_playlist_update_to_db(media_playlist_h playlist);
 
index 2d0eee8..e660720 100755 (executable)
 extern "C" {
 #endif /* __cplusplus */
 
+/**
+ * @file media_tag.h
+ * @brief This file contains the media tag API and functions related with handling tags. \n
+ *        Functions include operations to get the number and content of the tag, the number of media files  \n
+ *        and all media items in the tag, to clone, destroy, insert and delete tag from DB,  \n
+ *        to handle with name, ID, and media info of the tag.
+ */
+
 
 /**
  * @addtogroup CAPI_CONTENT_MEDIA_TAG_MODULE
@@ -33,107 +41,153 @@ extern "C" {
 
 /**
  * @brief Inserts a new tag in the media database.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write
+ *
+ * @remarks The created tag handle must be released using media_tag_destroy().
+ *
+ * @param[in]  tag_name The tag name to be inserted
+ * @param[out] tag      The created handle to the media tag
  *
- * @remark The created tag handle must be released with media_tag_destroy() by you.
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
- * @param[in] tag_name The tag name to be inserted
- * @param[out] tag A created handle to media tag
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
+ *
  * @see media_content_connect()
  * @see media_tag_delete_from_db()
  * @see media_tag_destroy()
- *
  */
 int media_tag_insert_to_db(const char *tag_name, media_tag_h *tag);
 
 /**
  * @brief Deletes a given tag from the media database.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write
+ *
+ * @param[in] tag_id The ID of media tag
  *
- * @param[in] tag The handle to media tag
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
+ *
  * @see media_content_connect()
  * @see media_tag_insert_to_db()
- *
  */
 int media_tag_delete_from_db(int tag_id);
 
 /**
- * @brief Gets the number of tag for the passed @a filter from the media database.
+ * @brief Gets the count of the tag for the passed @a filter from the media database.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in]  filter    The handle to the filter
+ * @param[out] tag_count The count of the media tag
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
- * @param[in] filter The handle to filter
- * @param[out] tag_count The count of media tag
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
- * @see media_content_connect()
  *
+ * @see media_content_connect()
  */
 int media_tag_get_tag_count_from_db(filter_h filter, int *tag_count);
 
 /**
  * @brief Iterates through tags from the media database.
  * @details This function gets all tags meeting a desired @a filter
- * and calls a registered callback function for every retrieved tag. If NULL is passed to the @a filter, no filtering is applied.
+ *          and calls a registered callback function for every retrieved tag.
+ *          If @c NULL is passed to the @a filter, no filtering is applied.
  *
- * @param[in] filter The handle to tag filter
- * @param[in] callback The callback function to invoke
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] filter    The tag filter handle
+ * @param[in] callback  The callback function to be invoked
  * @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre This function requires opened connection to content service by media_content_connect().
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre  This function requires opened connection to content service by media_content_connect().
  * @post This function invokes media_tag_cb().
+ *
  * @see media_content_connect()
  * @see #media_tag_cb
  * @see media_filter_create()
- *
  */
 int media_tag_foreach_tag_from_db (filter_h filter, media_tag_cb callback, void *user_data);
 
 /**
  * @brief Gets the number of media files for the passed @a filter in the given @a tag from the media database.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] tag_id The ID of media tag
- * @param[in] filter The handle to media filter
+ * @param[in]  tag_id      The ID of the media tag
+ * @param[in]  filter      The handle to the media filter
  * @param[out] media_count The count of media items
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
- * @see media_content_connect()
  *
+ * @see media_content_connect()
  */
 int media_tag_get_media_count_from_db (int tag_id, filter_h filter, int *media_count);
 
 /**
  * @brief Iterates through media items for a given tag from the media database.
  * @details This function gets all media items associated with a given tag and
- * meeting a desired @a filter and calls a registered callback function for
- * every retrieved media item. If NULL is passed to the @a filter, no filtering is applied.
+ *          meeting a desired @a filter and calls a registered callback function for
+ *          every retrieved media item. If @c NULL is passed to the @a filter, no filtering is applied.
  *
- * @param[in] tag_id The ID of media tag
- * @param[in] filter The handle to media filter
- * @param[in] callback The callback function to invoke
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] tag_id    The ID of the media tag
+ * @param[in] filter    The handle to the media filter
+ * @param[in] callback  The callback function to be invoked
  * @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @pre This function requires opened connection to content service by media_content_connect().
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre  This function requires opened connection to content service by media_content_connect().
  * @post This function invokes media_info_cb().
+ *
  * @see media_content_connect()
- * @see #media_info_cb
+ * @see media_info_cb()
  * @see media_filter_create()
  */
 int media_tag_foreach_media_from_db(int tag_id, filter_h filter, media_info_cb callback, void *user_data);
@@ -141,151 +195,206 @@ int media_tag_foreach_media_from_db(int tag_id, filter_h filter, media_info_cb c
 /**
  * @brief Clones the media tag.
  * @details This function copies the media tag handle from a source to destination.
- * There is no media_tag_create() function. The media_tag_h is created internally and available through media tag foreach function 
- * such as media_tag_foreach_tag_from_db().
- * To use this handle outside of these foreach functions, use this function.
- * @remark The destination handle must be released with media_tag_destroy() by you.
- *
- * @param[out] dst A destination handle to media tag
- * @param[in] src The source handle to media tag
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ *          There is no media_tag_create() function. The media_tag_h is created internally and available through media tag foreach function
+ *          such as media_tag_foreach_tag_from_db().
+ *          To use this handle outside of these foreach functions, use this function.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remarks You must release the destination handle using media_tag_destroy().
+ *
+ * @param[out] dst The destination handle to the media tag
+ * @param[in]  src The source handle to the media tag
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @see media_tag_destroy()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  *
+ * @see media_tag_destroy()
  */
 int media_tag_clone(media_tag_h *dst, media_tag_h src);
 
 /**
  * @brief Destroys the media tag.
  * @details This function frees all resources related to the tag handle. The tag handle can no longer
- * be used for any operation. A new tag handle has to be created before next usage.
+ *          be used for any operation. A new tag handle has to be created before next usage.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
  * @param[in] tag The media tag handle
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre A copy of the media tag handle created by calling media_tag_clone() or media_tag_insert_to_db()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre A copy of the media tag handle created by calling media_tag_clone() or media_tag_insert_to_db().
+ *
  * @see media_tag_clone()
  * @see media_tag_insert_to_db()
- *
  */
 int media_tag_destroy(media_tag_h tag);
 
 /**
- * @brief Gets media tag's ID.
+ * @brief Gets the media tag ID.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
+ * @param[in]  tag     The media tag handle
+ * @param[out] tag_id  The ID of the media tag
  *
- * @param [in] tag The handle to media tag
- * @param [out] tag_id The ID of media tag
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_tag_get_tag_id(media_tag_h tag, int *tag_id);
 
 /**
  * @brief Gets the tag name.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a tag_name must be released with free() by you.
+ * @remarks You must release @a tag_name using free().
  *
- * @param[in] tag The handle to media tag
+ * @param[in]  tag      The media tag handle
  * @param[out] tag_name The name of the tag
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
  *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int media_tag_get_name(media_tag_h tag, char **tag_name);
 
 /**
  * @brief Gets the media tag from the media database.
  *
- * @details This function creates a new media tag handle from the media database by the given tag_id.
- * media tag will be created, which is filled with tag information.
+ * @details This function creates a new media tag handle from the media database by the given @a tag_id.
+ *          Media tag will be created and will be filled with tag information.
  *
- * @remarks @a folder must be released with media_tag_destroy() by you.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] tag_id The ID of media tag
- * @param[out] tag The media tag handle associated with the tag ID
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @remarks You must release @a folder using media_tag_destroy().
+ *
+ * @param[in]  tag_id The ID of the media tag
+ * @param[out] tag    The media tag handle associated with the tag ID
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
+ *
  * @see media_content_connect()
  * @see media_tag_destroy()
- *
  */
 int media_tag_get_tag_from_db(int tag_id, media_tag_h *tag);
 
 /**
  * @brief Adds a new media info to the tag.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] tag      The media tag handle
+ * @param[in] media_id The ID to the media info which is added
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
- * @param[in] tag The handle to media tag
- * @param[in] media_id The ID to media info which is added
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @pre This function requires opened connection to content service by media_content_connect().
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre  This function requires opened connection to content service by media_content_connect().
  * @post media_tag_update_to_db()
+ *
  * @see media_content_connect()
  * @see media_tag_remove_media()
- *
  */
 int media_tag_add_media(media_tag_h tag, const char *media_id);
 
 /**
  * @brief Removes the media info from the given tag.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] tag      The media tag handle
+ * @param[in] media_id The ID to the media info which is removed
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
- * @param[in] tag The handle to media tag
- * @param[in] media_id The ID to media info which is removed
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @pre This function requires opened connection to content service by media_content_connect().
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre  This function requires opened connection to content service by media_content_connect().
  * @post media_tag_update_to_db()
+ *
  * @see media_content_connect()
  * @see media_tag_add_media()
- *
  */
 int media_tag_remove_media(media_tag_h tag, const char *media_id);
 
 /**
- * @brief Sets the tag name.
+ * @brief Sets the name of the tag.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param[in] tag The handle to media tag
+ * @param[in] tag      The media tag handle
  * @param[in] tag_name The name of the media tag
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @post media_tag_update_to_db()
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  *
+ * @post media_tag_update_to_db()
  */
 int media_tag_set_name(media_tag_h tag, char *tag_name);
 
 /**
  * @brief Updates the media tag to the media database.
  *
- * @details The function updates the given media tag in the media database. The function should be called after any change in tag attributes, to be updated to the media 
- * database. For example, after using media_tag_set_name() for setting the name of the tag, media_tag_update_to_db() function should be called so as to update 
- * the given tag attibutes in the media database.
+ * @details The function updates the given media tag in the media database. The function should be called after any change in tag attributes, to be updated to the media
+ *          database. For example, after using media_tag_set_name() for setting the name of the tag, the media_tag_update_to_db() function should be called so as to update
+ *          the given tag attributes in the media database.
  *
- * @param[in] tag The handle to media tag
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write
+ *
+ * @param[in] tag The media tag handle
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
+ *
  * @see media_content_connect()
  * @see media_tag_destroy()
  * @see media_tag_add_media()
  * @see media_tag_remove_media()
  * @see media_tag_set_name()
- *
  */
 int media_tag_update_to_db(media_tag_h tag);
 
index 59dd538..dc388d0 100755 (executable)
 extern "C" {
 #endif /* __cplusplus */
 
+#include <stdbool.h>
+
 
 /**
  *@internal
  */
-int _media_util_get_store_type_by_path(const char *path, int *storage_type);
+
+int _media_util_check_file(const char *path);
+
+int _media_util_check_ignore_dir(const char *dir_path, bool *ignore);
 
 
 #ifdef __cplusplus
index c657755..07ae882 100755 (executable)
 extern "C" {
 #endif /* __cplusplus */
 
+/**
+ * @file media_video.h
+ * @brief This file contains the video metadata API and related functions to proceed with video metadata. \n
+ *        Functions include cloning and destroying video metadata, getting video metadata such as width, height, \n
+ *        album, genre, played parameters etc. and updating video to DB.
+ */
 
 /**
  * @addtogroup CAPI_CONTENT_MEDIA_VIDEO_META_MODULE
@@ -32,318 +38,460 @@ extern "C" {
  */
 
 /**
- * @brief Clones video metadata.
- * @details This function copies the video metadata handle from a source to
- * destination.
-
- * @remark The destination handle must be released with video_meta_destroy() by you.
+ * @brief Clones the video metadata.
+ * @details This function copies the video metadata handle from a source to 
+ *          destination.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remarks You must release the destination handle using video_meta_destroy().
+ *
+ * @param[out] dst The destination handle to the video metadata
+ * @param[in]  src The source handle to the video metadata
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
  *
- * @param [out] dst A destination handle to video metadata
- * @param [in] src The source handle to video metadata
- * @return 0 on success, otherwise a negative error value.
  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @see video_meta_destroy()
  */
 int video_meta_clone(video_meta_h *dst, video_meta_h src);
 
 /**
- * @brief Destroys video metadata.
- * @details Function frees all resources related to video metadata handle. This handle
- * no longer can be used to perform any operation. A new handle has to
- * be created before the next use.
+ * @brief Destroys the video metadata.
+ * @details This function frees all resources related to the video metadata handle. This handle
+ *          no longer can be used to perform any operation. A new handle has to
+ *          be created before the next use.
  *
- * @param [in] video The handle to video metadata
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] video The video metadata handle
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre Get copy of video metadata handle by calling video_meta_clone()
- * @see video_meta_clone()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre Get copy of video metadata handle by calling video_meta_clone().
  *
+ * @see video_meta_clone()
  */
 int video_meta_destroy(video_meta_h video);
 
 /**
- * @brief Gets id of media of given video metadata.
+ * @brief Gets the ID of the media of the given video metadata.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a media id must be released with free() by you.
+ * @remarks You must release @a media_id using free().
  *
- * @param [in] video The handle to video metadata
- * @param [out] media_id The id of the video
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  video    The video metadata handle
+ * @param[out] media_id The ID of the video
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int video_meta_get_media_id(video_meta_h video, char **media_id);
 
 /**
- * @brief Gets the video's title.
+ * @brief Gets the video's album.
+ * @details If the value is an empty string, the method returns "Unknown".
  *
- * @remarks @a title must be released with free() by you.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] video The handle to video metadata
- * @param [out] title The title of video metadata
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @remarks You must release @a album using free().
+ *
+ * @param[in]  video The video metadata handle
+ * @param[out] album The video album or @c NULL
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
-int video_meta_get_title(video_meta_h video, char **title);
+int video_meta_get_album(video_meta_h video, char **album);
 
 /**
- * @brief Gets the video's album.
- * If the value is an empty string, the method returns "Unknown".
+ * @brief Gets the video artist.
+ * @details If the value is an empty string, the method returns "Unknown".
  *
- * @remarks @a album must be released with free() by you.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] video The handle to video metadata
- * @param [out] album The video album or NULL
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @remarks You must release @a artist using free().
+ *
+ * @param[in]  video  The video metadata handle
+ * @param[out] artist The artist of the video metadata
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
-int video_meta_get_album(video_meta_h video, char **album);
+int video_meta_get_artist(video_meta_h video, char **artist);
 
 /**
- * @brief Gets the video's artist.
- * If the value is an empty string, the method returns "Unknown".
+ * @brief Gets the video album artist.
+ * @details If the value is an empty string, the method returns "Unknown".
  *
- * @remarks @a artist must be released with free() by you.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] video The handle to video metadata
- * @param [out] artist The artist of video metadata
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @remarks You must release @a album_artist using free().
+ *
+ * @param[in]  video        The video metadata handle
+ * @param[out] album_artist The album artist of the video metadata
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
-int video_meta_get_artist(video_meta_h video, char **artist);
+int video_meta_get_album_artist(video_meta_h video, char **album_artist);
 
 /**
- * @brief Gets the video's genre.
- * If the value is an empty string, the method returns "Unknown".
+ * @brief Gets the video genre.
+ * @details If the value is an empty string, the method returns "Unknown".
  *
- * @remarks @a genre must be released with free() by you.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] video The handle to video metadata
- * @param [out] genre The genre of video metadata
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @remarks You must release @a genre using free().
+ *
+ * @param[in]  video The video metadata handle
+ * @param[out] genre The genre of the video metadata
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int video_meta_get_genre(video_meta_h video, char **genre);
 
 /**
- * @brief Gets the video's composer.
- * If the value is an empty string, the method returns "Unknown".
+ * @brief Gets the video composer.
+ * @details If the value is an empty string, the method returns "Unknown".
  *
- * @remarks @a composer must be released with free() by you.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] video The handle to video metadata
- * @param [out] composer The composer of video metadata
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @remarks You must release @a composer using free().
+ *
+ * @param[in]  video    The video metadata handle
+ * @param[out] composer The composer of the video metadata
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int video_meta_get_composer(video_meta_h video, char **composer);
 
 /**
- * @brief Gets the video's year.
- * If the value is an empty string, the method returns "Unknown".
+ * @brief Gets the year of the video.
+ * @details If the value is an empty string, the method returns "Unknown".
  *
- * @remarks @a year must be released with free() by you.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] video The handle to video metadata
- * @param [out] year The year of video metadata
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @remarks You must release @a year using free().
+ *
+ * @param[in]  video The video metadata handle
+ * @param[out] year  The year of the video metadata
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int video_meta_get_year(video_meta_h video, char **year);
 
 /**
- * @brief Gets the video's recorded_date.
+ * @brief Gets the recorded date of the video.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a recorded_date must be released with free() by you.
+ * @remarks You must release @a recorded_date using free().
  *
- * @param [in] video The handle to video metadata
- * @param [out] recorded_date The recorded_date of video metadata
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  video         The video metadata handle
+ * @param[out] recorded_date The recorded date of the video metadata
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int video_meta_get_recorded_date(video_meta_h video, char **recorded_date);
 
 /**
- * @brief Gets the video's copyright.
+ * @brief Gets the video copyright.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a copyright must be released with free() by you.
+ * @remarks You must release @a copyright using free().
  *
- * @param [in] video The handle to video metadata
- * @param [out] copyright The copyright of video metadata
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  video     The video metadata handle
+ * @param[out] copyright The copyright of the video metadata
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int video_meta_get_copyright(video_meta_h video, char **copyright);
 
 /**
- * @brief Gets the video's track number.
- * If the value is an empty string, the method returns "Unknown".
+ * @brief Gets the track number of the video.
+ * @details If the value is an empty string, the method returns "Unknown".
  *
- * @remarks @a track_num must be released with free() by you.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] video The handle to video metadata
- * @param [out] track_num The track number of video metadata
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @remarks You must release @a track_num using free().
+ *
+ * @param[in]  video     The video metadata handle
+ * @param[out] track_num The track number of the video metadata
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int video_meta_get_track_num(video_meta_h video, char **track_num);
 
 /**
- * @brief Gets the video's bit rate.
+ * @brief Gets the video bit rate.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks @a bit_rate must be released with free() by you.
+ * @remarks You must release @a bit_rate using free().
  *
- * @param [in] video The handle to video metadata
- * @param [out] bit_rate The bit rate of video metadata
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  video     The video metadata handle
+ * @param[out] bit_rate  The bit rate of the video metadata
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int video_meta_get_bit_rate(video_meta_h video, int *bit_rate);
 
 /**
- * @brief Gets duration of video metadata.
+ * @brief Gets the duration of video metadata.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] video The handle to video metadata
- * @param [out] duration The video duration in milliseconds
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  video    The video metadata handle
+ * @param[out] duration The video duration in milliseconds
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int video_meta_get_duration(video_meta_h video, int *duration);
 
 /**
- * @brief Gets the video's width in pixels.
+ * @brief Gets the video width in pixels.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] video The handle to video metadata
- * @param [out] width The video width in pixels
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  video The video metadata handle
+ * @param[out] width The video width in pixels
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int video_meta_get_width(video_meta_h video, int *width);
 
 /**
- * @brief Gets the video's height in pixels.
+ * @brief Gets the video height in pixels.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] video The handle to video metadata
- * @param [out] height The video height in pixels
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  video  The video metadata handle
+ * @param[out] height The video height in pixels
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int video_meta_get_height(video_meta_h video, int *height);
 
 /**
- * @brief Gets the video's played count.
+ * @brief Gets the played count of the video.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] video The handle to video metadata
- * @param [out] played_count The number of played
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  video        The video metadata handle
+ * @param[out] played_count The number of played
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int video_meta_get_played_count(video_meta_h video, int *played_count);
 
 /**
- * @brief Gets the video's time last played parameter.
+ * @brief Gets the last played time parameter of the video.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] video The handle to video metadata
- * @param [out] played_time The time last played in the video
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in]  video       The video metadata handle
+ * @param[out] played_time The time last played in the video
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int video_meta_get_played_time(video_meta_h video, time_t *played_time);
 
 /**
- * @brief Gets the video's position played parameter.
- * @details Function returns video's elapsed playback time parameter as period
- * starting from the beginning of the movie.
+ * @brief Gets the position played parameter of the video.
+ * @details This function returns the elapsed playback time parameter of the video as period
+ *          starting from the beginning of the movie.
  *
- * @param [in] video The handle to video metadata
- * @param [out] played_position The position from the beginning of the video (in milliseconds)
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in]  video           The video metadata handle
+ * @param[out] played_position The position from the beginning of the video (in milliseconds)
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  */
 int video_meta_get_played_position(video_meta_h video, int *played_position);
 
 /**
- * @brief Sets the video's played count.
+ * @brief Sets the played count of the video.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] video The handle to video metadata
- * @param [in] played_count The number of played
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in] video        The video metadata handle
+ * @param[in] played_count The number of played
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @post video_meta_update_to_db()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @post video_meta_update_to_db().
  */
 int video_meta_set_played_count(video_meta_h video, int played_count);
 
 /**
- * @brief Sets the video's time last played parameter.
+ * @brief Sets the time last played parameter of the video.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @param [in] video The handle to video metadata
- * @param [in] played_time The time last played in the video
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @param[in] video       The video metadata handle
+ * @param[in] played_time The time last played in the video
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @post video_meta_update_to_db()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @post video_meta_update_to_db().
  */
 int video_meta_set_played_time(video_meta_h video, time_t played_time);
 
 /**
- * @brief Sets the video's position played parameter.
- * @details Function returns video's elapsed playback time parameter as period
- * starting from the beginning of the movie.
+ * @brief Sets the position played parameter of the video.
+ * @details This function returns video's elapsed playback time parameter as period
+ *          starting from the beginning of the movie.
  *
- * @param [in] video The handle to video metadata
- * @param [in] played_position The position from the beginning of the video (in milliseconds)
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] video           The video metadata handle
+ * @param[in] played_position The position from the beginning of the video (in milliseconds)
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @post video_meta_update_to_db()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @post video_meta_update_to_db().
  */
 int video_meta_set_played_position(video_meta_h video, int played_position);
 
 /**
  * @brief Updates the video to the media database.
  *
- * @details The function updates the given video meta in the media database. The function should be called after any change in video attributes, to be updated to the media 
- * database. For example, after using video_meta_set_orientation() for setting the orientation of the video, video_meta_update_to_db() function should be called so as to update 
- * the given video attibutes in the media database.
+ * @details The function updates the given video meta in the media database. The function should be called after any change in video attributes, to be updated to the media
+ *          database. For example, after using video_meta_get_played_time() for setting the played time of the video, the video_meta_update_to_db() function should be called so as to update
+ *          the given video attributes in the media database.
  *
- * @param[in] image The handle to image
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write
+ *
+ * @remarks Do not call this function in callback function of foreach function like media_info_foreach_media_from_db().
+ *
+ * @param[in] video The video metadata handle
+ *
+ * @return @c 0 on success, 
+ *         otherwise a negative error value
+ *
+ * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
+ *
  * @see media_content_connect()
- * @see video_meta_set_orientation()
+ * @see video_meta_set_played_time()
+ * @see video_meta_set_played_count()s
+ * @see video_meta_set_played_position()
  */
 int video_meta_update_to_db(video_meta_h video);
 
index fb21402..89dc8dc 100755 (executable)
@@ -1,7 +1,7 @@
 Name:       capi-content-media-content
 Summary:    A Media content library in SLP C API
-Version: 0.2.14
-Release:    2
+Version: 0.2.136
+Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
@@ -11,6 +11,8 @@ BuildRequires:  pkgconfig(capi-base-common)
 BuildRequires:  pkgconfig(libmedia-service)
 BuildRequires:  pkgconfig(media-thumbnail)
 BuildRequires:  pkgconfig(libmedia-utils)
+BuildRequires:  pkgconfig(icu-i18n)
+BuildRequires:  pkgconfig(vconf)
 
 
 Requires(post): /sbin/ldconfig
@@ -31,7 +33,14 @@ Requires: %{name} = %{version}-%{release}
 
 
 %build
+
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+
+%if 0%{?sec_build_binary_debug_enable}
+export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
+export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
+export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
+%endif
 cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
 
 
@@ -41,13 +50,20 @@ make %{?jobs:-j%jobs}
 rm -rf %{buildroot}
 %make_install
 
+#License
+mkdir -p %{buildroot}/%{_datadir}/license
+cp -rf %{_builddir}/%{name}-%{version}/LICENSE.APLv2.0 %{buildroot}/%{_datadir}/license/%{name}
+
 %post -p /sbin/ldconfig
 
 %postun -p /sbin/ldconfig
 
 
 %files
+%manifest capi-content-media-content.manifest
 %{_libdir}/libcapi-content-media-content.so.*
+#License
+%{_datadir}/license/%{name}
 
 %files devel
 %{_includedir}/media-content/*.h
index 651b6bf..baf0291 100755 (executable)
@@ -15,7 +15,6 @@
 */
 
 
-#include <media_content.h>
 #include <media_info_private.h>
 
 
@@ -30,6 +29,7 @@ int audio_meta_destroy(audio_meta_h audio)
                SAFE_FREE(_audio->title);
                SAFE_FREE(_audio->album);
                SAFE_FREE(_audio->artist);
+               SAFE_FREE(_audio->album_artist);
                SAFE_FREE(_audio->genre);
                SAFE_FREE(_audio->composer);
                SAFE_FREE(_audio->year);
@@ -109,6 +109,17 @@ int audio_meta_clone(audio_meta_h *dst, audio_meta_h src)
                        }
                }
 
+               if(STRING_VALID(_src->album_artist))
+               {
+                       _dst->album_artist = strdup(_src->album_artist);
+                       if(_dst->album_artist == NULL)
+                       {
+                               audio_meta_destroy((audio_meta_h)_dst);
+                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+                       }
+               }
+
                if(STRING_VALID(_src->genre))
                {
                        _dst->genre = strdup(_src->genre);
@@ -176,6 +187,7 @@ int audio_meta_clone(audio_meta_h *dst, audio_meta_h src)
                }
 
                _dst->bitrate = _src->bitrate;
+               _dst->bitpersample = _src->bitpersample;
                _dst->samplerate = _src->samplerate;
                _dst->channel = _src->channel;
                _dst->duration = _src->duration;
@@ -227,16 +239,16 @@ int audio_meta_get_media_id(audio_meta_h audio, char **media_id)
        return ret;
 }
 
-int audio_meta_get_title(audio_meta_h audio, char **title)
+int audio_meta_get_album(audio_meta_h audio, char **album_name)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
        audio_meta_s *_audio = (audio_meta_s*)audio;
        if(_audio)
        {
-               if(STRING_VALID(_audio->title))
+               if(STRING_VALID(_audio->album))
                {
-                       *title = strdup(_audio->title);
-                       if(*title == NULL)
+                       *album_name = strdup(_audio->album);
+                       if(*album_name == NULL)
                        {
                                media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
                                return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
@@ -244,7 +256,7 @@ int audio_meta_get_title(audio_meta_h audio, char **title)
                }
                else
                {
-                       *title = NULL;
+                       *album_name = NULL;
                }
                ret = MEDIA_CONTENT_ERROR_NONE;
 
@@ -258,16 +270,17 @@ int audio_meta_get_title(audio_meta_h audio, char **title)
        return ret;
 }
 
-int audio_meta_get_album(audio_meta_h audio, char **album_name)
+int audio_meta_get_artist(audio_meta_h audio, char **artist_name)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
        audio_meta_s *_audio = (audio_meta_s*)audio;
+
        if(_audio)
        {
-               if(STRING_VALID(_audio->album))
+               if(STRING_VALID(_audio->artist))
                {
-                       *album_name = strdup(_audio->album);
-                       if(*album_name == NULL)
+                       *artist_name = strdup(_audio->artist);
+                       if(*artist_name == NULL)
                        {
                                media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
                                return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
@@ -275,7 +288,7 @@ int audio_meta_get_album(audio_meta_h audio, char **album_name)
                }
                else
                {
-                       *album_name = NULL;
+                       *artist_name = NULL;
                }
                ret = MEDIA_CONTENT_ERROR_NONE;
 
@@ -289,17 +302,17 @@ int audio_meta_get_album(audio_meta_h audio, char **album_name)
        return ret;
 }
 
-int audio_meta_get_artist(audio_meta_h audio, char **artist_name)
+int audio_meta_get_album_artist(audio_meta_h audio, char **album_artist_name)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
        audio_meta_s *_audio = (audio_meta_s*)audio;
 
        if(_audio)
        {
-               if(STRING_VALID(_audio->artist))
+               if(STRING_VALID(_audio->album_artist))
                {
-                       *artist_name = strdup(_audio->artist);
-                       if(*artist_name == NULL)
+                       *album_artist_name = strdup(_audio->album_artist);
+                       if(*album_artist_name == NULL)
                        {
                                media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
                                return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
@@ -307,7 +320,7 @@ int audio_meta_get_artist(audio_meta_h audio, char **artist_name)
                }
                else
                {
-                       *artist_name = NULL;
+                       *album_artist_name = NULL;
                }
                ret = MEDIA_CONTENT_ERROR_NONE;
 
@@ -526,6 +539,25 @@ int audio_meta_get_bit_rate(audio_meta_h audio, int *bit_rate)
        return ret;
 }
 
+int audio_meta_get_bitpersample(audio_meta_h audio, int *bitpersample)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       audio_meta_s *_audio = (audio_meta_s*)audio;
+
+       if(_audio && bitpersample)
+       {
+               *bitpersample = _audio->bitpersample;
+               ret = MEDIA_CONTENT_ERROR_NONE;
+       }
+       else
+       {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       return ret;
+}
+
 int audio_meta_get_sample_rate(audio_meta_h audio, int *sample_rate)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
index 04bb17a..466e6e3 100755 (executable)
 */
 
 
-#include <media_content.h>
 #include <media_info_private.h>
-#include <media-svc.h>
 
-int media_bookmark_foreach_bookmark_from_db (filter_h filter, media_bookmark_cb callback, void *user_data);
-int media_bookmark_get_media_id(media_bookmark_h bookmark, char **media_id);
 
 int media_bookmark_insert_to_db(const char *media_id, time_t time, const char *thumbnail_path)
 {
@@ -66,8 +62,6 @@ int media_bookmark_get_bookmark_count_from_db(filter_h filter, int *bookmark_cou
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
        if (bookmark_count == NULL)
        {
                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
@@ -79,23 +73,6 @@ int media_bookmark_get_bookmark_count_from_db(filter_h filter, int *bookmark_cou
        return ret;
 }
 
-int media_bookmark_foreach_bookmark_from_db (filter_h filter, media_bookmark_cb callback, void *user_data)
-{
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-
-       media_content_debug_func();
-
-       if(callback == NULL)
-       {
-               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
-               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
-       }
-
-       ret = _media_db_get_bookmark(NULL, filter, callback, user_data);
-
-       return ret;
-}
-
 int media_bookmark_destroy(media_bookmark_h bookmark)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
@@ -189,38 +166,6 @@ int media_bookmark_get_bookmark_id(media_bookmark_h bookmark, int *bookmark_id)
        return ret;
 }
 
-int media_bookmark_get_media_id(media_bookmark_h bookmark, char **media_id)
-{
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-       media_bookmark_s *_bookmark = (media_bookmark_s*)bookmark;
-
-       if(_bookmark)
-       {
-               if(STRING_VALID(_bookmark->media_id))
-               {
-                       *media_id = strdup(_bookmark->media_id);
-                       if(*media_id == NULL)
-                       {
-                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
-                               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
-                       }
-               }
-               else
-               {
-                       *media_id = NULL;
-               }
-
-               ret = MEDIA_CONTENT_ERROR_NONE;
-       }
-       else
-       {
-               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
-               ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
-       }
-
-       return ret;
-}
-
 int media_bookmark_get_marked_time(media_bookmark_h bookmark, time_t* marked_time)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
index 823b1bd..d09853c 100755 (executable)
 
 
 #include <media-thumb-error.h>
-#include <media_content.h>
 #include <media_info_private.h>
-#include <media-util-err.h>
+#include <media_util_private.h>
+
+#include <unicode/uscript.h>
+#include <unicode/uloc.h>
+#include <unicode/ucol.h>
+#include <vconf.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <fcntl.h>
 
 
 static attribute_h g_attr_handle = NULL;
 static attribute_h g_alias_attr_handle = NULL;
 static MediaSvcHandle *db_handle = NULL;
 static int ref_count = 0;
+static GMutex *db_mutex = NULL;
 
+static  media_noti_cb_s *g_noti_info = NULL;
 
 static int __media_content_create_attr_handle(void);
 static int __media_content_create_alias_attr_handle(void);
 static int __media_content_create_attribute_handle(void);
 static int __media_content_destroy_attribute_handle(void);
 
+#if 0
+static void __collate_icu_close(void* ucol)
+{
+       media_content_debug("close icu collator");
+       ucol_close((UCollator *) ucol);
+}
+
+static int __collate_icu_8(void *ucol, int str1_len, const void *str1, int str2_len, const void *str2)
+{
+       UCharIterator uiter1, uiter2;
+       UErrorCode error = U_ZERO_ERROR;
+
+       uiter_setUTF8(&uiter1, (const char *) str1, str1_len);
+       uiter_setUTF8(&uiter2, (const char *) str2, str2_len);
+
+       UCollationResult result = ucol_strcollIter(
+       (UCollator *) ucol,
+       &uiter1,
+       &uiter2,
+       &error);
+
+       if(U_FAILURE(error)) {
+               media_content_error("__collate_icu_8 ucol_strcollIter error: %d", error);
+               return error;
+       }
+
+#if 0
+       if (result == UCOL_LESS) {
+               media_content_debug("less");
+       } else if (result == UCOL_GREATER) {
+               media_content_debug("greater");
+       } else {
+               media_content_debug("equal");
+       }
+#endif
+
+       return result;
+}
+
+static int __media_content_create_collate(void)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       UErrorCode status = U_ZERO_ERROR;
+       UCollator *myCollator = NULL;
+       char *lang = NULL;
+       int32_t apiRules[1];
+
+       lang = vconf_get_str(VCONFKEY_LANGSET);
+       media_content_debug("lang[%s]", lang);
+
+       myCollator = ucol_open(lang, &status);
+
+       if(U_FAILURE(status))
+       {
+               media_content_error("Collator open failed(%s)", u_errorName(status));
+               SAFE_FREE(lang);
+               return MEDIA_CONTENT_ERROR_DB_FAILED;
+       }
+
+       char script[ULOC_SCRIPT_CAPACITY];
+       char maximizedLocale[ULOC_FULLNAME_CAPACITY];
+       UScriptCode scriptCode = USCRIPT_COMMON;
+
+       uloc_addLikelySubtags(lang, maximizedLocale, sizeof(maximizedLocale), &status);
+       uloc_getScript(maximizedLocale, script, sizeof(script), &status);
+       uscript_getCode(script, &scriptCode, 1, &status);
+       media_content_debug("locale[%s] script[%s]", maximizedLocale, script);
+       media_content_debug("[%d]", scriptCode);
+
+       if(scriptCode == USCRIPT_KOREAN)
+               scriptCode = USCRIPT_HANGUL;
+       else if((scriptCode == USCRIPT_SIMPLIFIED_HAN) || (scriptCode == USCRIPT_TRADITIONAL_HAN))
+               scriptCode = USCRIPT_HAN;
+       else if((scriptCode == USCRIPT_JAPANESE) || (scriptCode == USCRIPT_HIRAGANA) || (scriptCode == USCRIPT_KATAKANA) )
+               scriptCode = USCRIPT_KATAKANA_OR_HIRAGANA;
+
+       apiRules[0] = scriptCode;
+
+       SAFE_FREE(lang);
+
+       ucol_setReorderCodes(myCollator, apiRules, 1, &status);
+
+       if(U_FAILURE(status))
+       {
+               media_content_error("setReorder failed(%s)", u_errorName(status));
+               ucol_close(myCollator);
+               return MEDIA_CONTENT_ERROR_DB_FAILED;
+       }
+
+       ucol_setStrength(myCollator, UCOL_PRIMARY);
+
+       ret = sqlite3_create_collation_v2(db_handle, "PREFERRED_LANG", SQLITE_UTF8, myCollator, __collate_icu_8, (void(*)(void*))__collate_icu_close);
+       if (SQLITE_OK != ret)
+       {
+               media_content_error("create_collation failed(%s)", sqlite3_errmsg(db_handle));
+               ucol_close(myCollator);
+               return MEDIA_CONTENT_ERROR_DB_FAILED;
+       }
+
+       return MEDIA_CONTENT_ERROR_NONE;
+}
+#endif
 
 static int __media_content_create_attr_handle(void)
 {
@@ -65,6 +177,9 @@ static int __media_content_create_attr_handle(void)
        ret = _media_filter_attribute_add(g_attr_handle, MEDIA_MODIFIED_TIME, DB_FIELD_MEDIA_MODIFIED_TIME);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
+       ret = _media_filter_attribute_add(g_attr_handle, MEDIA_TIMELINE, DB_FIELD_MEDIA_TIMELINE);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
        ret = _media_filter_attribute_add(g_attr_handle, MEDIA_THUMBNAIL_PATH, DB_FIELD_MEDIA_THUMBNAIL_PATH);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
@@ -77,6 +192,9 @@ static int __media_content_create_attr_handle(void)
        ret = _media_filter_attribute_add(g_attr_handle, MEDIA_ARTIST, DB_FIELD_MEDIA_ARTIST);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
+       ret = _media_filter_attribute_add(g_attr_handle, MEDIA_ALBUM_ARTIST, DB_FIELD_MEDIA_ALBUM_ARTIST);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
        ret = _media_filter_attribute_add(g_attr_handle, MEDIA_GENRE, DB_FIELD_MEDIA_GENRE);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
@@ -101,6 +219,9 @@ static int __media_content_create_attr_handle(void)
        ret = _media_filter_attribute_add(g_attr_handle, MEDIA_BITRATE, DB_FIELD_MEDIA_BITRATE);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
+       ret = _media_filter_attribute_add(g_attr_handle, MEDIA_BITPERSAMPLE, DB_FIELD_MEDIA_BITPERSAMPLE);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
        ret = _media_filter_attribute_add(g_attr_handle, MEDIA_SAMPLERATE, DB_FIELD_MEDIA_SAMPLERATE);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
@@ -131,6 +252,9 @@ static int __media_content_create_attr_handle(void)
        ret = _media_filter_attribute_add(g_attr_handle, MEDIA_ORIENTATION, DB_FIELD_MEDIA_ORIENTATION);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
+       ret = _media_filter_attribute_add(g_attr_handle, MEDIA_BURST_ID, DB_FIELD_MEDIA_BURST_ID);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
        ret = _media_filter_attribute_add(g_attr_handle, MEDIA_PLAYED_COUNT, DB_FIELD_MEDIA_PLAYED_COUNT);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
@@ -167,12 +291,64 @@ static int __media_content_create_attr_handle(void)
        ret = _media_filter_attribute_add(g_attr_handle, MEDIA_KEYWORD, DB_FIELD_MEDIA_KEYWORD);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
+       ret = _media_filter_attribute_add(g_attr_handle, MEDIA_WEATHER, DB_FIELD_MEDIA_WEATHER);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
        ret = _media_filter_attribute_add(g_attr_handle, MEDIA_IS_DRM, DB_FIELD_MEDIA_IS_DRM);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
        ret = _media_filter_attribute_add(g_attr_handle, MEDIA_STORAGE_TYPE, DB_FIELD_MEDIA_STORAGE_TYPE);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
+       /* Pinyin*/
+       ret = _media_filter_attribute_add(g_attr_handle, MEDIA_FILE_NAME_PINYIN,  DB_FIELD_MEDIA_FILE_NAME_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_attr_handle, MEDIA_TITLE_PINYIN,  DB_FIELD_MEDIA_TITLE_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_attr_handle, MEDIA_ALBUM_PINYIN,  DB_FIELD_MEDIA_ALBUM_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_attr_handle, MEDIA_ARTIST_PINYIN,  DB_FIELD_MEDIA_ARTIST_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_attr_handle, MEDIA_ALBUM_ARTIST_PINYIN,  DB_FIELD_MEDIA_ALBUM_ARTIST_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_attr_handle, MEDIA_GENRE_PINYIN,  DB_FIELD_MEDIA_GENRE_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_attr_handle, MEDIA_COMPOSER_PINYIN,  DB_FIELD_MEDIA_COMPOSER_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_attr_handle, MEDIA_COPYRIGHT_PINYIN,  DB_FIELD_MEDIA_COPYRIGHT_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_attr_handle, MEDIA_DESCRIPTION_PINYIN,  DB_FIELD_MEDIA_DESCRIPTION_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_attr_handle, MEDIA_AUTHOR_PINYIN,  DB_FIELD_MEDIA_AUTHOR_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_attr_handle, MEDIA_PROVIDER_PINYIN,  DB_FIELD_MEDIA_PROVIDER_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_attr_handle, MEDIA_CONTENT_NAME_PINYIN,  DB_FIELD_MEDIA_CONTENT_NAME_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_attr_handle, MEDIA_CATEGORY_PINYIN,  DB_FIELD_MEDIA_CATEGORY_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_attr_handle, MEDIA_LOCATION_TAG_PINYIN,  DB_FIELD_MEDIA_LOCATION_TAG_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_attr_handle, MEDIA_AGE_RATING_PINYIN,  DB_FIELD_MEDIA_AGE_RATING_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_attr_handle, MEDIA_KEYWORD_PINYIN,  DB_FIELD_MEDIA_KEYWORD_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
        /* Playlist*/
        ret = _media_filter_attribute_add(g_attr_handle, PLAYLIST_NAME, DB_FIELD_PLAYLIST_NAME);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
@@ -231,6 +407,9 @@ static int __media_content_create_alias_attr_handle(void)
        ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_MODIFIED_TIME, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_MODIFIED_TIME);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
+       ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_TIMELINE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_TIMELINE);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
        ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_THUMBNAIL_PATH, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_THUMBNAIL_PATH);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
@@ -243,6 +422,9 @@ static int __media_content_create_alias_attr_handle(void)
        ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_ARTIST, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ARTIST);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
+       ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_ALBUM_ARTIST, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ALBUM_ARTIST);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
        ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_GENRE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_GENRE);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
@@ -267,6 +449,9 @@ static int __media_content_create_alias_attr_handle(void)
        ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_BITRATE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_BITRATE);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
+       ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_BITPERSAMPLE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_BITPERSAMPLE);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
        ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_SAMPLERATE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_SAMPLERATE);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
@@ -297,6 +482,9 @@ static int __media_content_create_alias_attr_handle(void)
        ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_ORIENTATION, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ORIENTATION);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
+       ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_BURST_ID, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_BURST_ID);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
        ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_PLAYED_COUNT, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_PLAYED_COUNT);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
@@ -330,7 +518,10 @@ static int __media_content_create_alias_attr_handle(void)
        ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_AGE_RATING, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_AGE_RATING);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
-       ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_KEYWORD, DB_TABLE_ALIAS_MEDIA"."MEDIA_KEYWORD);
+       ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_KEYWORD, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_KEYWORD);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_WEATHER, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_WEATHER);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
        ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_IS_DRM, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_IS_DRM);
@@ -339,6 +530,55 @@ static int __media_content_create_alias_attr_handle(void)
        ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_STORAGE_TYPE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_STORAGE_TYPE);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
+       /* Pinyin*/
+       ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_FILE_NAME_PINYIN,  DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_FILE_NAME_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_TITLE_PINYIN,  DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_TITLE_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_ALBUM_PINYIN,  DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ALBUM_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_ARTIST_PINYIN,  DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ARTIST_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_ALBUM_ARTIST_PINYIN,  DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ALBUM_ARTIST_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_GENRE_PINYIN,  DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_GENRE_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_COMPOSER_PINYIN,  DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_COMPOSER_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_COPYRIGHT_PINYIN,  DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_COPYRIGHT_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_DESCRIPTION_PINYIN,  DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_DESCRIPTION_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_AUTHOR_PINYIN,  DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_AUTHOR_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_PROVIDER_PINYIN,  DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_PROVIDER_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_CONTENT_NAME_PINYIN,  DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_CONTENT_NAME_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_CATEGORY_PINYIN,  DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_CATEGORY_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_LOCATION_TAG_PINYIN,  DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_LOCATION_TAG_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_AGE_RATING_PINYIN,  DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_AGE_RATING_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_KEYWORD_PINYIN,  DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_KEYWORD_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
        /* Folder */
        ret = _media_filter_attribute_add(g_alias_attr_handle, FOLDER_ID, DB_TABLE_ALIAS_FOLDER"."DB_FIELD_FOLDER_ID);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
@@ -355,6 +595,9 @@ static int __media_content_create_alias_attr_handle(void)
        ret = _media_filter_attribute_add(g_alias_attr_handle, FOLDER_STORAGE_TYPE, DB_TABLE_ALIAS_FOLDER"."DB_FIELD_FOLDER_STORAGE_TYPE);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
+       ret = _media_filter_attribute_add(g_alias_attr_handle, FOLDER_NAME_PINYIN, DB_TABLE_ALIAS_FOLDER"."DB_FIELD_FOLDER_NAME_PINYIN);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
        /* Playlist*/
        ret = _media_filter_attribute_add(g_alias_attr_handle, PLAYLIST_NAME, DB_TABLE_ALIAS_PLAYLIST"."DB_FIELD_PLAYLIST_NAME);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
@@ -370,8 +613,6 @@ static int __media_content_create_alias_attr_handle(void)
        ret = _media_filter_attribute_add(g_alias_attr_handle, BOOKMARK_MARKED_TIME, DB_TABLE_ALIAS_BOOKMARK"."DB_FIELD_BOOKMARK_MARKED_TIME);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
-       /* Album */
-
        return ret;
 }
 
@@ -383,6 +624,8 @@ static int __media_content_create_attribute_handle(void)
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
        ret = __media_content_create_alias_attr_handle();
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               _media_filter_attribute_destory(g_attr_handle);
 
        return ret;
 }
@@ -392,10 +635,11 @@ static int __media_content_destroy_attribute_handle(void)
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
        ret = _media_filter_attribute_destory(g_attr_handle);
-       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
        ret = _media_filter_attribute_destory(g_alias_attr_handle);
 
+       g_attr_handle = NULL;
+       g_alias_attr_handle = NULL;
+
        return ret;
 }
 
@@ -427,36 +671,46 @@ int _content_query_prepare(sqlite3_stmt **stmt, char *select_query, char *condit
                return MEDIA_CONTENT_ERROR_DB_FAILED;
        }
 
-       if(STRING_VALID(select_query)) {
-               if(!STRING_VALID(condition_query)) {
+       if(STRING_VALID(select_query))
+       {
+               if(!STRING_VALID(condition_query))
+               {
                        condition_query = " ";
                }
 
-               if(!STRING_VALID(option_query)) {
+               if(!STRING_VALID(option_query))
+               {
                        option_query = " ";
-
                }
 
                //query = sqlite3_mprintf("%s %s %s", select_query, condition_query, option_query);
                len = snprintf(query, sizeof(query), "%s %s %s", select_query, condition_query, option_query);
-               if (len > 0) {
+               if (len > 0 && len < MAX_QUERY_SIZE) {
                        query[len] = '\0';
+               } else if (len >= MAX_QUERY_SIZE) {
+                       query[MAX_QUERY_SIZE -1] = '\0';
                } else {
                        media_content_error("snprintf failed");
                        return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
                }
 
-               media_content_debug("Query : [%s]", query);
+               media_content_sec_debug("Query : [%s]", query);
 
                err = sqlite3_prepare_v2((sqlite3*)db_handle, query, strlen(query), stmt, NULL);
                if(err != SQLITE_OK)
                {
                        media_content_error("DB_FAILED(0x%08x) fail to sqlite3_prepare(), %s", MEDIA_CONTENT_ERROR_DB_FAILED, sqlite3_errmsg((sqlite3*)db_handle));
 
-                       if (err == SQLITE_BUSY)
+                       if (err == SQLITE_BUSY) {
+                               media_content_error(" BUSY ERROR");
                                return MEDIA_CONTENT_ERROR_DB_BUSY;
-                       else
+                       } else if (err == SQLITE_PERM) {
+                               media_content_error("PERMISSION EROR");
+                               return MEDIA_INFO_ERROR_DATABASE_PERMISSION;
+                       } else {
+                               media_content_error("OTHER ERROR");
                                return MEDIA_CONTENT_ERROR_DB_FAILED;
+                       }
                }
        }
        else
@@ -470,7 +724,10 @@ int _content_query_prepare(sqlite3_stmt **stmt, char *select_query, char *condit
 
 int _content_error_capi(int type, int content_error)
 {
-       media_content_debug("[type : %d] content_error : %d ", type, content_error);
+       if(content_error != MEDIA_CONTENT_ERROR_NONE)
+       {
+               media_content_error("[type : %d] content_error : %d ", type, content_error);
+       }
 
        if(type == MEDIA_CONTENT_TYPE)
        {
@@ -478,24 +735,23 @@ int _content_error_capi(int type, int content_error)
                        return MEDIA_CONTENT_ERROR_NONE;
                else if(content_error == MEDIA_INFO_ERROR_INVALID_PARAMETER)
                        return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
-               else if(content_error == MEDIA_INFO_ERROR_DATABASE_INTERNAL)
-                       return MEDIA_CONTENT_ERROR_DB_FAILED;
-               else if(content_error == MEDIA_INFO_ERROR_DATABASE_CONNECT)
+               else if((content_error == MEDIA_INFO_ERROR_DATABASE_CONNECT) || (content_error == MEDIA_INFO_ERROR_DATABASE_DISCONNECT) ||
+                               (content_error == MEDIA_INFO_ERROR_DATABASE_NO_RECORD) ||(content_error == MEDIA_INFO_ERROR_DATABASE_INTERNAL))
                        return MEDIA_CONTENT_ERROR_DB_FAILED;
-               else if(content_error == MEDIA_INFO_ERROR_DATABASE_DISCONNECT)
-                       return MEDIA_CONTENT_ERROR_DB_FAILED;
-               else if(content_error == MEDIA_INFO_ERROR_DATABASE_NO_RECORD)
-                       return MEDIA_CONTENT_ERROR_DB_FAILED;
-
+               else if (content_error == MEDIA_INFO_ERROR_DATABASE_BUSY)
+                       return MEDIA_CONTENT_ERROR_DB_BUSY;
+               else if((content_error == MS_MEDIA_ERR_SOCKET_CONN) ||(content_error == MS_MEDIA_ERR_SOCKET_INTERNAL) ||
+                               (content_error == MS_MEDIA_ERR_SOCKET_SEND) ||(content_error == MS_MEDIA_ERR_SOCKET_RECEIVE) || (content_error == MS_MEDIA_ERR_SOCKET_RECEIVE_TIMEOUT))
+                       return MEDIA_CONTENT_ERROR_NETWORK;
+               else if (content_error == MEDIA_INFO_ERROR_DATABASE_PERMISSION)
+                       return MEDIA_CONTENT_ERROR_PERMISSION_DENIED;
        } else if(type == MEDIA_THUMBNAIL_TYPE) {
                if(content_error == MEDIA_THUMB_ERROR_NONE)
                        return MEDIA_CONTENT_ERROR_NONE;
-               else if(content_error == MEDIA_THUMB_ERROR_INVALID_PARAMETER)
+               else if(content_error == MEDIA_THUMB_ERROR_INVALID_PARAMETER || content_error == MEDIA_THUMB_ERROR_DUPLICATED_REQUEST)
                        return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
                else if(content_error == MEDIA_THUMB_ERROR_DB)
                        return MEDIA_CONTENT_ERROR_DB_FAILED;
-               else if(content_error == MEDIA_THUMB_ERROR_DB)
-                       return MEDIA_CONTENT_ERROR_DB_FAILED;
                else if(content_error == MEDIA_THUMB_ERROR_NETWORK)
                        return MEDIA_CONTENT_ERROR_NETWORK;
                else if(content_error == MEDIA_THUMB_ERROR_TIMEOUT)
@@ -514,8 +770,18 @@ int _content_error_capi(int type, int content_error)
                        return MEDIA_CONTENT_ERROR_NONE;
                else if(content_error == MS_MEDIA_ERR_INVALID_PARAMETER || content_error == MS_MEDIA_ERR_INVALID_PATH)
                        return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
-               else if(content_error == MS_MEDIA_ERR_INSERT_FAIL || content_error == MS_MEDIA_ERR_DRM_INSERT_FAIL)
+               else if(content_error == MS_MEDIA_ERR_DB_INSERT_FAIL)
                        return MEDIA_CONTENT_ERROR_DB_FAILED;
+               else if(content_error == MS_MEDIA_ERR_DB_BUSY_FAIL)
+                       return MEDIA_CONTENT_ERROR_DB_BUSY;
+               else if(content_error == MS_MEDIA_ERR_ALLOCATE_MEMORY_FAIL)
+                       return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+               else if(content_error == MS_MEDIA_ERR_DBUS_GET || content_error == MS_MEDIA_ERR_DBUS_ADD_FILTER)
+                       return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
+               else if(content_error == MS_MEDIA_ERR_VCONF_GET_FAIL)
+                       return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
+               else if(content_error == MS_MEDIA_ERR_PERMISSION_DENIED)
+                       return MEDIA_CONTENT_ERROR_PERMISSION_DENIED;
        }
 
        return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
@@ -523,93 +789,339 @@ int _content_error_capi(int type, int content_error)
 
 int _content_query_sql(char *query_str)
 {
-       int err = MEDIA_CONTENT_ERROR_NONE;
-       char *err_msg;
+       int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       if(db_handle == NULL)
-       {
-               media_content_error("DB_FAILED(0x%08x) database is not connected", MEDIA_CONTENT_ERROR_DB_FAILED);
-               return MEDIA_CONTENT_ERROR_DB_FAILED;
-       }
+       //DB will be updated by Media Server.
+       ret = media_svc_request_update_db(query_str);
 
-       err = sqlite3_exec(db_handle, query_str, NULL, NULL, &err_msg);
-       if(SQLITE_OK != err)
-       {
-               if(err_msg)
+       return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+}
+
+int media_content_connect(void)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+
+       if (!db_mutex)
+               db_mutex = g_mutex_new();
+
+       if (db_mutex != NULL) {
+               g_mutex_lock(db_mutex);
+
+               media_content_info("ref count : %d", ref_count);
+
+               if(ref_count == 0)
                {
-                       media_content_error("DB_FAILED : %s", err_msg);
-                       media_content_error("DB_FAILED SQL: %s", query_str);
-                       sqlite3_free(err_msg);
+                       if(db_handle == NULL)
+                       {
+                               ret = __media_content_create_attribute_handle();
+                               if(ret == MEDIA_CONTENT_ERROR_NONE) {
+                                       ret = media_svc_connect(&db_handle);
+                                       ret = _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+                                       if(ret == MEDIA_CONTENT_ERROR_NONE) {
+                                               ref_count++;
+                                               //__media_content_create_collate();
+                                       } else {
+                                               __media_content_destroy_attribute_handle();
+                                       }
+                               } else {
+                                       media_content_error("Internal DB Connection Error");
+                               }
+                       } else {
+                               media_content_error("Wrong DB Connection status");
+                               ret = MEDIA_CONTENT_ERROR_DB_FAILED;
+                       }
+               } else {
+                       if(db_handle != NULL) {
+                               ref_count++;
+                       } else {
+                               media_content_error("Wrong DB Handle status");
+                               ret = MEDIA_CONTENT_ERROR_DB_FAILED;
+                       }
                }
 
-               media_content_error("DB_FAILED(0x%08x) database operation is failed", MEDIA_CONTENT_ERROR_DB_FAILED);
+               media_content_info("ref count changed to: %d", ref_count);
+               g_mutex_unlock(db_mutex);
+       } else {
+               media_content_error("mutex is NULL");
+               ret = MEDIA_CONTENT_ERROR_DB_FAILED;
+       }
 
-               if (err == SQLITE_BUSY)
-                       return MEDIA_CONTENT_ERROR_DB_BUSY;
+       return ret;
+}
+
+int media_content_disconnect(void)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+
+       if (db_mutex != NULL) {
+               g_mutex_lock(db_mutex);
+
+               media_content_debug("ref count : %d", ref_count);
+               if(ref_count > 0)
+               {
+                       if(db_handle != NULL) {
+                               ref_count--;
+                       } else {
+                               media_content_error("Wrong DB Handle status");
+                               ret = MEDIA_CONTENT_ERROR_DB_FAILED;
+                       }
+               }
                else
+               {
+                       media_content_error("DB_FAILED(0x%08x) database is not connected", MEDIA_CONTENT_ERROR_DB_FAILED);
+                       g_mutex_unlock(db_mutex);
                        return MEDIA_CONTENT_ERROR_DB_FAILED;
-       }
-       else
-       {
-               media_content_debug("DB_SUCCESS: %s", query_str);
+               }
+
+               if(ref_count == 0)
+               {
+                       if(db_handle != NULL)
+                       {
+                               ret = media_svc_disconnect(db_handle);
+                               ret = _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+                               if(ret == MEDIA_CONTENT_ERROR_NONE) {
+                                       ret = __media_content_destroy_attribute_handle();
+                                       db_handle = NULL;
+                               } else {
+                                       media_content_error("database disconnect fail");
+                                       ref_count++;
+                               }
+                       } else {
+                               media_content_error("Wrong DB Handle status");
+                               ret = MEDIA_CONTENT_ERROR_DB_FAILED;
+                       }
+
+                       g_mutex_unlock(db_mutex);
+                       g_mutex_free(db_mutex);
+                       db_mutex = NULL;
+
+                       media_content_info("ref count changed to: %d", ref_count);
+
+                       return ret;
+               }
+
+               g_mutex_unlock(db_mutex);
+       } else {
+               media_content_error("mutex is NULL");
+               ret = MEDIA_CONTENT_ERROR_INVALID_OPERATION;
        }
 
-       if(err_msg)
-               sqlite3_free(err_msg);
+       media_content_info("ref count changed to: %d", ref_count);
 
-       return MEDIA_CONTENT_ERROR_NONE;
+       return ret;
 }
 
-int media_content_connect(void)
+int media_content_scan_file(const char *path)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
+       bool ignore_dir = FALSE;
+       char *folder_path = NULL;
+       int check_file = MEDIA_CONTENT_ERROR_NONE;
 
-       if(ref_count == 0)
-       {
-               if(db_handle == NULL)
-               {
-                       ret = media_svc_connect(&db_handle);
+       if (!STRING_VALID(path)) {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       media_content_sec_debug("Path : %s", path);
+
+       check_file = _media_util_check_file(path);
+       if (check_file == MEDIA_CONTENT_ERROR_NONE) {
+               /* This means this path has to be inserted or refreshed */
+               folder_path = g_path_get_dirname(path);
+               ret = _media_util_check_ignore_dir(folder_path, &ignore_dir);
+               SAFE_FREE(folder_path);
+
+               if(ignore_dir) {
+                       media_content_error("Invalid folder path");
+                       return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
                }
 
-               ret = _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+               media_svc_storage_type_e storage_type;
 
-               if(ret == MEDIA_CONTENT_ERROR_NONE) {
-                       ret = __media_content_create_attribute_handle();
+               ret = media_svc_get_storage_type(path, &storage_type);
+               if(ret != MEDIA_INFO_ERROR_NONE) {
+                       media_content_sec_error("media_svc_get_storage_type failed : %d (%s)", ret, path);
+                       return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+               }
+
+               ret = media_svc_check_item_exist_by_path(_content_get_db_handle(), path);
+               if (ret == MEDIA_INFO_ERROR_NONE) {
+                       /* Refresh */
+                       ret = media_svc_refresh_item(_content_get_db_handle(), storage_type, path);
+                       if(ret != MEDIA_INFO_ERROR_NONE) {
+                               media_content_error("media_svc_refresh_item failed : %d", ret);
+                               return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+                       }
+
+               } else if (ret == MEDIA_INFO_ERROR_DATABASE_NO_RECORD) {
+                       /* Insert */
+                       ret = media_svc_insert_item_immediately(_content_get_db_handle(), storage_type, path);
+                       if(ret != MEDIA_INFO_ERROR_NONE) {
+                               if (ret == MEDIA_INFO_ERROR_DATABASE_CONSTRAINT) {
+                                       media_content_sec_error("This item is already inserted. This may be normal operation because other process already did this (%s)", path);
+                                       ret = MEDIA_INFO_ERROR_NONE;
+                               } else {
+                                       media_content_sec_error("media_svc_insert_item_immediately failed : %d (%s)", ret, path);
+                               }
+
+                               return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+                       }
+               } else {
+                       media_content_error("media_svc_check_item_exist_by_path failed : %d", ret);
+                       return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+               }
+       } else if (check_file == MEDIA_CONTENT_ERROR_PERMISSION_DENIED) {
+               media_content_error("You have no permission for this file %d", ret);
+               return MEDIA_CONTENT_ERROR_PERMISSION_DENIED;
+       } else {
+               /* This means this path has to be deleted */
+               media_content_debug("This path doesn't exists in file system... So now start to delete it from DB");
+               ret = media_svc_delete_item_by_path(_content_get_db_handle(), path);
+               if(ret != MEDIA_INFO_ERROR_NONE) {
+                       media_content_error("media_svc_delete_item_by_path failed : %d", ret);
+                       return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
                }
        }
 
-       ref_count++;
+       return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+}
 
-       return ret;
+void _media_content_scan_cb(media_request_result_s* result, void *user_data)
+{
+       int err = -1;
+       media_content_scan_cb_data *cb_data = user_data;
+
+       err = result->result;
+
+       if (cb_data && cb_data->callback) {
+               media_content_debug("User callback is being called now");
+               cb_data->callback(err, cb_data->user_data);
+       }
+
+       SAFE_FREE(cb_data);
+
+       return;
 }
 
-int media_content_disconnect(void)
+static int __media_content_check_dir(const char *path)
+{
+       DIR *dp = NULL;
+
+       dp = opendir(path);
+       if (dp == NULL) {
+               media_content_sec_error("path [%s]", path);
+               media_content_stderror("open dir fail");
+               if (errno == EACCES || errno == EPERM) {
+                       return MEDIA_CONTENT_ERROR_PERMISSION_DENIED;
+               } else {
+                       return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+               }
+       }
+
+       closedir(dp);
+
+       return MEDIA_CONTENT_ERROR_NONE;
+}
+
+
+int media_content_scan_folder(const char *path, bool is_recursive, media_scan_completed_cb callback, void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
+       bool ignore_dir = FALSE;
 
-       if(ref_count > 0)
-       {
-               ref_count--;
+       if (!STRING_VALID(path)) {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
-       else
-       {
-               media_content_error("DB_FAILED(0x%08x) database is not connected", MEDIA_CONTENT_ERROR_DB_FAILED);
-               return MEDIA_CONTENT_ERROR_DB_FAILED;
+
+       ret = _media_util_check_ignore_dir(path, &ignore_dir);
+       if(ignore_dir) {
+               media_content_error("Invalid folder path");
+               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       ret = __media_content_check_dir(path);
+       if (ret == MEDIA_CONTENT_ERROR_PERMISSION_DENIED) {
+               return ret;
+       }
+
+       media_content_scan_cb_data *cb_data = NULL;
+       cb_data = (media_content_scan_cb_data *)malloc(sizeof(media_content_scan_cb_data));
+       if (cb_data == NULL) {
+               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
        }
 
-       if(ref_count == 0)
+       cb_data->callback = callback;
+       cb_data->user_data = user_data;
+
+       ret = media_directory_scanning_async(path, is_recursive, _media_content_scan_cb, cb_data);
+       if(ret != MS_MEDIA_ERR_NONE) {
+               media_content_error("media_directory_scanning_async failed : %d", ret);
+       }
+
+       return _content_error_capi(MEDIA_REGISTER_TYPE, ret);
+}
+
+void _media_content_db_update_noti_cb(
+                                                       int pid,
+                                                       media_item_type_e item,
+                                                       media_item_update_type_e update_type,
+                                                       char* path,
+                                                       char* uuid,
+                                                       media_type_e content_type,
+                                                       char *mime_type,
+                                                       void *user_data)
+{
+       int error_value = MEDIA_CONTENT_ERROR_NONE;
+
+       media_noti_cb_s *_noti_info = (media_noti_cb_s *)user_data;
+
+       if(_noti_info != NULL)
        {
-               if(db_handle != NULL)
-               {
-                       ret = media_svc_disconnect(db_handle);
-                       ret = _content_error_capi(MEDIA_CONTENT_TYPE, ret);
-                       if(ret == MEDIA_CONTENT_ERROR_NONE)
-                       {
-                               ret = __media_content_destroy_attribute_handle();
-                               db_handle = NULL;
-                       }
-               }
+               if (_noti_info->update_noti_cb)
+                       _noti_info->update_noti_cb(error_value, pid, item, update_type, content_type, uuid, path, mime_type, _noti_info->user_data);
        }
 
-       return ret;
+       return;
 }
+
+int media_content_set_db_updated_cb(media_content_db_update_cb callback, void *user_data)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+
+       if (callback == NULL) {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (g_noti_info != NULL) {
+               media_content_error("Noti callback is alreay set");
+               return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
+       }
+
+       g_noti_info = (media_noti_cb_s*)calloc(1, sizeof(media_noti_cb_s));
+       if (g_noti_info == NULL) {
+               media_content_error("Failed to create noti info");
+               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+       }
+
+       g_noti_info->update_noti_cb = callback;
+       g_noti_info->user_data = user_data;
+
+       ret = media_db_update_subscribe(_media_content_db_update_noti_cb, (void *)g_noti_info);
+
+       return _content_error_capi(MEDIA_REGISTER_TYPE, ret);
+}
+
+int media_content_unset_db_updated_cb(void)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+
+       SAFE_FREE(g_noti_info);
+       ret = media_db_update_unsubscribe();
+
+       return _content_error_capi(MEDIA_REGISTER_TYPE, ret);
+}
+
index 6a60c56..b53cfe3 100755 (executable)
@@ -19,6 +19,7 @@
 #include <media_info_private.h>
 
 static char * __media_db_get_group_name(media_group_e group);
+static int __media_db_make_query(filter_h filter, attribute_h attr, char *select_query, int select_query_size, char **condition_query, char **option_query);
 
 static char * __media_db_get_group_name(media_group_e group)
 {
@@ -40,6 +41,8 @@ static char * __media_db_get_group_name(media_group_e group)
                        return DB_FIELD_MEDIA_TITLE;
                case MEDIA_CONTENT_GROUP_ARTIST:
                        return DB_FIELD_MEDIA_ARTIST;
+               case MEDIA_CONTENT_GROUP_ALBUM_ARTIST:
+                       return DB_FIELD_MEDIA_ALBUM_ARTIST;
                case MEDIA_CONTENT_GROUP_GENRE:
                        return DB_FIELD_MEDIA_GENRE;
                case MEDIA_CONTENT_GROUP_COMPOSER:
@@ -56,10 +59,12 @@ static char * __media_db_get_group_name(media_group_e group)
                        return DB_FIELD_MEDIA_DESCRIPTION;
                case MEDIA_CONTENT_GROUP_LONGITUDE:
                        return DB_FIELD_MEDIA_LONGITUDE;
-               case MEDIA_CONTENT_GROUP_LATIITUDE:
+               case MEDIA_CONTENT_GROUP_LATITUDE:
                        return DB_FIELD_MEDIA_LATITUDE;
                case MEDIA_CONTENT_GROUP_ALTITUDE:
                        return DB_FIELD_MEDIA_ALTITUDE;
+               case MEDIA_CONTENT_GROUP_BURST_IMAGE:
+                       return DB_FIELD_MEDIA_BURST_ID;
                case MEDIA_CONTENT_GROUP_RATING:
                        return DB_FIELD_MEDIA_RATING;
                case MEDIA_CONTENT_GROUP_AUTHOR:
@@ -76,6 +81,8 @@ static char * __media_db_get_group_name(media_group_e group)
                        return DB_FIELD_MEDIA_AGE_RATING;
                case MEDIA_CONTENT_GROUP_KEYWORD:
                        return DB_FIELD_MEDIA_KEYWORD;
+               case MEDIA_CONTENT_GROUP_WEATHER:
+                       return DB_FIELD_MEDIA_WEATHER;
                default:
                        return NULL;
        }
@@ -83,21 +90,59 @@ static char * __media_db_get_group_name(media_group_e group)
        return NULL;
 }
 
+static int __media_db_make_query(filter_h filter, attribute_h attr, char *select_query, int select_query_size, char **condition_query, char **option_query)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       filter_s *_filter = NULL;
+
+       if(filter != NULL)
+       {
+               _filter = (filter_s*)filter;
+
+               if(STRING_VALID(_filter->condition))
+               {
+                       /*bracket should be added to condition. If application use "OR" condition, F/W restriction condition like "validity=1" is disregared
+                       ex) select path from media where validity=1 and media_type=3 or media_type=1;*/
+                       char bracket_added_condition[MAX_QUERY_SIZE] = {0, };
+                       memset(bracket_added_condition, 0x00, sizeof(bracket_added_condition));
+
+                       SAFE_STRLCAT(bracket_added_condition, QUERY_KEYWORD_OPEN_BRACKET, MAX_QUERY_SIZE);
+                       SAFE_STRLCAT(bracket_added_condition, _filter->condition, MAX_QUERY_SIZE);
+                       SAFE_STRLCAT(bracket_added_condition, QUERY_KEYWORD_BRACKET, MAX_QUERY_SIZE);
+                       {
+                       ret = _media_filter_attribute_generate(attr, bracket_added_condition, _filter->condition_collate_type, condition_query);
+                       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+                       }
+               }
+
+               ret = _media_filter_attribute_option_generate(attr, filter, option_query);
+               if(ret != MEDIA_CONTENT_ERROR_NONE)
+               {
+                       SAFE_FREE(*condition_query);
+                       return ret;
+               }
+
+               if(STRING_VALID(*condition_query))
+               {
+                       SAFE_STRLCAT(select_query, QUERY_KEYWORD_SPACE, select_query_size);
+                       SAFE_STRLCAT(select_query, QUERY_KEYWORD_AND, select_query_size);
+               }
+       }
+
+       return ret;
+}
+
 int _media_db_get_group_count(filter_h filter, group_list_e group_type, int *group_count)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
        sqlite3_stmt *stmt = NULL;
-       filter_s *_filter = NULL;
-       char select_query[DEFAULT_QUERY_SIZE];
+       char select_query[MAX_QUERY_SIZE] = {0, };
        char *condition_query = NULL;
        char *option_query = NULL;
-       attribute_h attr;
-
-       media_content_debug_func();
-
-       memset(select_query, 0x00, sizeof(select_query));
+       attribute_h attr = NULL;
 
        attr = _content_get_attirbute_handle();
+       memset(select_query, 0x00, sizeof(select_query));
 
        switch(group_type) {
                case MEDIA_GROUP_NONE:
@@ -110,7 +155,6 @@ int _media_db_get_group_count(filter_h filter, group_list_e group_type, int *gro
                        break;
                case MEDIA_GROUP_ALBUM:
                        attr = _content_get_alias_attirbute_handle();
-                       //snprintf(select_query, sizeof(select_query), SELECT_ALBUM_COUNT);
                        if(!SAFE_STRLCPY(select_query, SELECT_ALBUM_COUNT, sizeof(select_query)))
                        {
                                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
@@ -120,7 +164,6 @@ int _media_db_get_group_count(filter_h filter, group_list_e group_type, int *gro
                        break;
                case MEDIA_GROUP_FOLDER:
                        attr = _content_get_alias_attirbute_handle();
-                       //snprintf(select_query, sizeof(select_query), SELECT_FOLDER_COUNT);
                        if(!SAFE_STRLCPY(select_query, SELECT_FOLDER_COUNT, sizeof(select_query)))
                        {
                                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
@@ -128,8 +171,6 @@ int _media_db_get_group_count(filter_h filter, group_list_e group_type, int *gro
                        }
                        break;
                case MEDIA_GROUP_PLAYLIST:
-                       //attr = _content_get_alias_attirbute_handle();
-                       //snprintf(select_query, sizeof(select_query), SELECT_PLAYLIST_COUNT);
                        if(!SAFE_STRLCPY(select_query, SELECT_PLAYLIST_COUNT, sizeof(select_query)))
                        {
                                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
@@ -137,8 +178,6 @@ int _media_db_get_group_count(filter_h filter, group_list_e group_type, int *gro
                        }
                        break;
                case MEDIA_GROUP_TAG:
-                       //attr = _content_get_alias_attirbute_handle();
-                       //snprintf(select_query, sizeof(select_query), SELECT_TAG_COUNT);
                        if(!SAFE_STRLCPY(select_query, SELECT_TAG_COUNT, sizeof(select_query)))
                        {
                                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
@@ -147,7 +186,6 @@ int _media_db_get_group_count(filter_h filter, group_list_e group_type, int *gro
                        break;
                case MEDIA_GROUP_BOOKMARK:
                        attr = _content_get_alias_attirbute_handle();
-                       //snprintf(select_query, sizeof(select_query), SELECT_BOOKMARK_COUNT);
                        if(!SAFE_STRLCPY(select_query, SELECT_BOOKMARK_COUNT, sizeof(select_query)))
                        {
                                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
@@ -156,25 +194,8 @@ int _media_db_get_group_count(filter_h filter, group_list_e group_type, int *gro
                        break;
        }
 
-       if(filter != NULL)
-       {
-               _filter = (filter_s*)filter;
-
-               if(STRING_VALID(_filter->condition))
-               {
-                       ret = _media_filter_attribute_generate(attr, _filter->condition, _filter->condition_collate_type, &condition_query);
-                       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-               }
-
-               ret = _media_filter_attribute_option_generate(attr, filter, &option_query);
-               media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
-               if(STRING_VALID(condition_query))
-               {
-                       SAFE_STRLCAT(select_query, QUERY_KEYWORD_SPACE, sizeof(select_query));
-                       SAFE_STRLCAT(select_query, QUERY_KEYWORD_AND, sizeof(select_query));
-               }
-       }
+       ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
        ret = _content_query_prepare(&stmt, select_query, condition_query, option_query);
        SAFE_FREE(condition_query);
@@ -184,7 +205,6 @@ int _media_db_get_group_count(filter_h filter, group_list_e group_type, int *gro
        while(sqlite3_step(stmt) == SQLITE_ROW)
        {
                *group_count = (int)sqlite3_column_int(stmt, 0);
-               media_content_debug("group count : [%d]", *group_count);
        }
 
        SQLITE3_FINALIZE(stmt);
@@ -196,48 +216,29 @@ int _media_db_get_media_group_count(media_group_e group, filter_h filter, int *g
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
        sqlite3_stmt *stmt = NULL;
-       filter_s *_filter = NULL;
-       char select_query[DEFAULT_QUERY_SIZE];
+       char select_query[MAX_QUERY_SIZE] = {0, };
        char *condition_query = NULL;
        char *option_query = NULL;
+       attribute_h attr = NULL;
 
-       media_content_debug_func();
-
+       attr = _content_get_attirbute_handle();
        memset(select_query, 0x00, sizeof(select_query));
 
        snprintf(select_query, sizeof(select_query), SELECT_MEDIA_GROUP_COUNT, __media_db_get_group_name(group));
 
-       if(filter != NULL)
-       {
-               _filter = (filter_s*)filter;
-
-               if(STRING_VALID(_filter->condition))
-               {
-                       ret = _media_filter_attribute_generate(_content_get_attirbute_handle(), _filter->condition, _filter->condition_collate_type, &condition_query);
-                       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-               }
-
-               ret = _media_filter_attribute_option_generate(_content_get_attirbute_handle(), filter, &option_query);
-               media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
-               if(STRING_VALID(condition_query))
-               {
-                       SAFE_STRLCAT(select_query, QUERY_KEYWORD_SPACE, sizeof(select_query));
-                       SAFE_STRLCAT(select_query, QUERY_KEYWORD_AND, sizeof(select_query));
-               }
-
-               SAFE_STRLCAT(select_query, QUERY_KEYWORD_SPACE, sizeof(select_query));
-               if(STRING_VALID(condition_query))
-                       SAFE_STRLCAT(select_query, condition_query, sizeof(select_query));
-               if(STRING_VALID(option_query))
-                       SAFE_STRLCAT(select_query, option_query, sizeof(select_query));
-
-               SAFE_FREE(condition_query);
-               SAFE_FREE(option_query);
-       }
+       ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
+       SAFE_STRLCAT(select_query, QUERY_KEYWORD_SPACE, sizeof(select_query));
+       if(STRING_VALID(condition_query))
+               SAFE_STRLCAT(select_query, condition_query, sizeof(select_query));
+       if(STRING_VALID(option_query))
+               SAFE_STRLCAT(select_query, option_query, sizeof(select_query));
        SAFE_STRLCAT(select_query, QUERY_KEYWORD_BRACKET, sizeof(select_query));
 
+       SAFE_FREE(condition_query);
+       SAFE_FREE(option_query);
+
        ret = _content_query_prepare(&stmt, select_query, condition_query, option_query);
        SAFE_FREE(condition_query);
        SAFE_FREE(option_query);
@@ -246,7 +247,6 @@ int _media_db_get_media_group_count(media_group_e group, filter_h filter, int *g
        while(sqlite3_step(stmt) == SQLITE_ROW)
        {
                *group_count = (int)sqlite3_column_int(stmt, 0);
-               media_content_debug("group count : [%d]", *group_count);
        }
 
        SQLITE3_FINALIZE(stmt);
@@ -257,36 +257,20 @@ int _media_db_get_media_group_count(media_group_e group, filter_h filter, int *g
 int _media_db_get_media_group(media_group_e group, filter_h filter, media_group_cb callback, void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       char select_query[DEFAULT_QUERY_SIZE];
+       char select_query[MAX_QUERY_SIZE] = {0, };
        char *condition_query = NULL;
        char *option_query = NULL;
        char *name = NULL;
        sqlite3_stmt *stmt = NULL;
-       filter_s *_filter = NULL;
+       attribute_h attr = NULL;
 
+       attr = _content_get_attirbute_handle();
        memset(select_query, 0x00, sizeof(select_query));
 
        snprintf(select_query, sizeof(select_query), SELECT_MEDIA_GROUP_LIST, __media_db_get_group_name(group));
 
-       if(filter != NULL)
-       {
-               _filter = (filter_s*)filter;
-
-               if(_filter->condition)
-               {
-                       ret = _media_filter_attribute_generate(_content_get_attirbute_handle(), _filter->condition, _filter->condition_collate_type, &condition_query);
-                       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-               }
-
-               ret = _media_filter_attribute_option_generate(_content_get_attirbute_handle(), filter, &option_query);
-               media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
-               if(STRING_VALID(condition_query))
-               {
-                       SAFE_STRLCAT(select_query, QUERY_KEYWORD_SPACE, sizeof(select_query));
-                       SAFE_STRLCAT(select_query, QUERY_KEYWORD_AND, sizeof(select_query));
-               }
-       }
+       ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
        ret = _content_query_prepare(&stmt, select_query, condition_query, option_query);
        SAFE_FREE(condition_query);
@@ -298,7 +282,6 @@ int _media_db_get_media_group(media_group_e group, filter_h filter, media_group_
                if(STRING_VALID((const char *)sqlite3_column_text(stmt, 0)))
                {
                        name = strdup((const char *)sqlite3_column_text(stmt, 0));
-                       media_content_debug("group name : [%s]", name);
                }
 
                if(callback(name, user_data) == false)
@@ -318,40 +301,23 @@ int _media_db_get_media_group(media_group_e group, filter_h filter, media_group_
 int _media_db_get_album(filter_h filter, media_album_cb callback, void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       char select_query[DEFAULT_QUERY_SIZE];
+       char select_query[MAX_QUERY_SIZE] = {0, };
        char *condition_query = NULL;
        char *option_query = NULL;
        sqlite3_stmt *stmt = NULL;
-       filter_s *_filter = NULL;
+       attribute_h attr = NULL;
 
+       attr = _content_get_alias_attirbute_handle();
        memset(select_query, 0x00, sizeof(select_query));
 
-       //snprintf(select_query, sizeof(select_query), SELECT_ALBUM_LIST);
        if(!SAFE_STRLCPY(select_query, SELECT_ALBUM_LIST, sizeof(select_query)))
        {
                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
-       if(filter != NULL)
-       {
-               _filter = (filter_s*)filter;
-
-               if(_filter->condition)
-               {
-                       ret = _media_filter_attribute_generate(_content_get_alias_attirbute_handle(), _filter->condition, _filter->condition_collate_type, &condition_query);
-                       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-               }
-
-               ret = _media_filter_attribute_option_generate(_content_get_alias_attirbute_handle(), filter, &option_query);
-               media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
-               if(STRING_VALID(condition_query))
-               {
-                       SAFE_STRLCAT(select_query, QUERY_KEYWORD_SPACE, sizeof(select_query));
-                       SAFE_STRLCAT(select_query, QUERY_KEYWORD_AND, sizeof(select_query));
-               }
-       }
+       ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
        ret = _content_query_prepare(&stmt, select_query, condition_query, option_query);
        SAFE_FREE(condition_query);
@@ -397,42 +363,30 @@ int _media_db_get_album(filter_h filter, media_album_cb callback, void *user_dat
 int _media_db_get_folder(filter_h filter, media_folder_cb callback, void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       char select_query[DEFAULT_QUERY_SIZE];
+       char select_query[MAX_QUERY_SIZE] = {0, };
        char *condition_query = NULL;
        char *option_query = NULL;
        sqlite3_stmt *stmt = NULL;
-       filter_s *_filter = NULL;
+       attribute_h attr = NULL;
 
+       attr = _content_get_alias_attirbute_handle();
        memset(select_query, 0x00, sizeof(select_query));
 
-       //snprintf(select_query, sizeof(select_query), SELECT_FOLDER_LIST);
        if(!SAFE_STRLCPY(select_query, SELECT_FOLDER_LIST, sizeof(select_query)))
        {
                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
-       if(filter != NULL)
-       {
-               _filter = (filter_s*)filter;
-
-               if(_filter->condition)
-               {
-                       ret = _media_filter_attribute_generate(_content_get_alias_attirbute_handle(), _filter->condition, _filter->condition_collate_type, &condition_query);
-                       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-               }
+       ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
-               ret = _media_filter_attribute_option_generate(_content_get_alias_attirbute_handle(), filter, &option_query);
-               media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+       ret = _content_query_prepare(&stmt, select_query, condition_query, option_query);
 
-               if(STRING_VALID(condition_query))
-               {
-                       SAFE_STRLCAT(select_query, QUERY_KEYWORD_SPACE, sizeof(select_query));
-                       SAFE_STRLCAT(select_query, QUERY_KEYWORD_AND, sizeof(select_query));
-               }
-       }
+       /*this is temporary log to fix bug*/
+       if (condition_query != NULL) media_content_error("condition_query %s", condition_query);
+       if (option_query != NULL) media_content_error("condition_query %s", option_query);
 
-       ret = _content_query_prepare(&stmt, select_query, condition_query, option_query);
        SAFE_FREE(condition_query);
        SAFE_FREE(option_query);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
@@ -478,43 +432,23 @@ int _media_db_get_folder(filter_h filter, media_folder_cb callback, void *user_d
 int _media_db_get_playlist(filter_h filter, media_playlist_cb callback, void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       char select_query[DEFAULT_QUERY_SIZE];
+       char select_query[MAX_QUERY_SIZE] = {0, };
        char *condition_query = NULL;
        char *option_query = NULL;
        sqlite3_stmt *stmt = NULL;
-       filter_s *_filter = NULL;
+       attribute_h attr = NULL;
 
+       attr = _content_get_attirbute_handle();
        memset(select_query, 0x00, sizeof(select_query));
 
-       //snprintf(select_query, sizeof(select_query), SELECT_PLAYLIST_LIST);
        if(!SAFE_STRLCPY(select_query, SELECT_PLAYLIST_LIST, sizeof(select_query)))
        {
                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
-
-       if(filter != NULL)
-       {
-               _filter = (filter_s*)filter;
-
-               if(_filter->condition)
-               {
-                       //ret = _media_filter_attribute_generate(_content_get_alias_attirbute_handle(), _filter->condition, _filter->condition_collate_type, &condition_query);
-                       ret = _media_filter_attribute_generate(_content_get_attirbute_handle(), _filter->condition, _filter->condition_collate_type, &condition_query);
-                       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-               }
-
-               //ret = _media_filter_attribute_option_generate(_content_get_alias_attirbute_handle(), filter, &option_query);
-               ret = _media_filter_attribute_option_generate(_content_get_attirbute_handle(), filter, &option_query);
-               media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
-               if(STRING_VALID(condition_query))
-               {
-                       SAFE_STRLCAT(select_query, QUERY_KEYWORD_SPACE, sizeof(select_query));
-                       SAFE_STRLCAT(select_query, QUERY_KEYWORD_AND, sizeof(select_query));
-               }
-       }
+       ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
        ret = _content_query_prepare(&stmt, select_query, condition_query, option_query);
        SAFE_FREE(condition_query);
@@ -537,6 +471,9 @@ int _media_db_get_playlist(filter_h filter, media_playlist_cb callback, void *us
                if(STRING_VALID((const char *)sqlite3_column_text(stmt, 1)))
                        _playlist->name = strdup((const char *)sqlite3_column_text(stmt, 1));
 
+               if(STRING_VALID((const char *)sqlite3_column_text(stmt, 2)))
+                       _playlist->thumbnail_path = strdup((const char *)sqlite3_column_text(stmt, 2));
+
                if(callback((media_playlist_h)_playlist, user_data) == false)
                {
                        media_playlist_destroy((media_playlist_h)_playlist);
@@ -553,37 +490,20 @@ int _media_db_get_playlist(filter_h filter, media_playlist_cb callback, void *us
 int _media_db_get_playlist_item(int playlist_id, filter_h filter, playlist_member_cb callback, void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       char select_query[DEFAULT_QUERY_SIZE];
+       char select_query[MAX_QUERY_SIZE] = {0, };
        char *condition_query = NULL;
        char *option_query = NULL;
        sqlite3_stmt *stmt = NULL;
-       filter_s *_filter = NULL;
+       attribute_h attr = NULL;
 
+       attr = _content_get_attirbute_handle();
        memset(select_query, 0x00, sizeof(select_query));
 
-       snprintf(select_query, sizeof(select_query), SELECT_PLAYLIST_ITEM_ID_FROM_PLAYLIST_VIEW, playlist_id);
-
-       if(filter != NULL)
-       {
-               _filter = (filter_s*)filter;
-
-               if(_filter->condition)
-               {
-                       //ret = _media_filter_attribute_generate(_content_get_alias_attirbute_handle(), _filter->condition, _filter->condition_collate_type, &condition_query);
-                       ret = _media_filter_attribute_generate(_content_get_attirbute_handle(), _filter->condition, _filter->condition_collate_type, &condition_query);
-                       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-               }
-
-               //ret = _media_filter_attribute_option_generate(_content_get_alias_attirbute_handle(), filter, &option_query);
-               ret = _media_filter_attribute_option_generate(_content_get_attirbute_handle(), filter, &option_query);
-               media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+       //snprintf(select_query, sizeof(select_query), SELECT_PLAYLIST_ITEM_ID_FROM_PLAYLIST_VIEW, playlist_id);
+       snprintf(select_query, sizeof(select_query), SELECT_PLAYLIST_ITEM_ALL_FROM_PLAYLIST_VIEW, playlist_id);
 
-               if(STRING_VALID(condition_query))
-               {
-                       SAFE_STRLCAT(select_query, QUERY_KEYWORD_SPACE, sizeof(select_query));
-                       SAFE_STRLCAT(select_query, QUERY_KEYWORD_AND, sizeof(select_query));
-               }
-       }
+       ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
        ret = _content_query_prepare(&stmt, select_query, condition_query, option_query);
        SAFE_FREE(condition_query);
@@ -593,23 +513,26 @@ int _media_db_get_playlist_item(int playlist_id, filter_h filter, playlist_membe
        while(sqlite3_step(stmt) == SQLITE_ROW)
        {
                int playlist_member_id = 0;
-               char media_uuid[MEDIA_CONTENT_UUID_SIZE+1];
-               media_info_h media = NULL;
-               memset(media_uuid, 0x00, sizeof(media_uuid));
+               playlist_member_id = (int)sqlite3_column_int(stmt, 50); //50 is Just for Commercial!
 
-               playlist_member_id = (int)sqlite3_column_int(stmt, 0);
+               media_info_s *_media = (media_info_s*)calloc(1, sizeof(media_info_s));
 
-               if(STRING_VALID((const char *)sqlite3_column_text(stmt, 1)))
-                       strncpy(media_uuid, (const char *)sqlite3_column_text(stmt, 1), sizeof(media_uuid));
+               if(_media == NULL)
+               {
+                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                       SQLITE3_FINALIZE(stmt);
+                       return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+               }
 
-               ret = media_info_get_media_from_db(media_uuid, &media);
+               _media_info_item_get_detail(stmt, (media_info_h)_media);
 
-               if(callback(playlist_member_id, media, user_data) == false)
+               if(callback(playlist_member_id, (media_info_h)_media, user_data) == false)
                {
-                       media_info_destroy(media);
+                       media_info_destroy((media_info_h)_media);
                        break;
                }
-               media_info_destroy(media);
+               media_info_destroy((media_info_h)_media);
+
        }
 
        SQLITE3_FINALIZE(stmt);
@@ -617,24 +540,20 @@ int _media_db_get_playlist_item(int playlist_id, filter_h filter, playlist_membe
        return ret;
 }
 
-//same as _media_db_get_playlist
 int _media_db_get_tag(const char *media_id, filter_h filter, media_tag_cb callback, void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       char select_query[DEFAULT_QUERY_SIZE];
+       char select_query[MAX_QUERY_SIZE] = {0, };
        char *condition_query = NULL;
        char *option_query = NULL;
        sqlite3_stmt *stmt = NULL;
-       filter_s *_filter = NULL;
-       attribute_h attr;
+       attribute_h attr = NULL;
 
+       attr = _content_get_attirbute_handle();
        memset(select_query, 0x00, sizeof(select_query));
 
        if(!STRING_VALID(media_id))
        {
-               //attr = _content_get_alias_attirbute_handle();
-               attr = _content_get_attirbute_handle();
-               //snprintf(select_query, sizeof(select_query), SELECT_TAG_LIST);
                if(!SAFE_STRLCPY(select_query, SELECT_TAG_LIST, sizeof(select_query)))
                {
                        media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
@@ -643,29 +562,11 @@ int _media_db_get_tag(const char *media_id, filter_h filter, media_tag_cb callba
        }
        else
        {
-               attr = _content_get_attirbute_handle();
                snprintf(select_query, sizeof(select_query), SELECT_TAG_LIST_BY_MEDIA_ID, media_id);
        }
 
-       if(filter != NULL)
-       {
-               _filter = (filter_s*)filter;
-
-               if(_filter->condition)
-               {
-                       ret = _media_filter_attribute_generate(attr, _filter->condition, _filter->condition_collate_type, &condition_query);
-                       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-               }
-
-               ret = _media_filter_attribute_option_generate(attr, filter, &option_query);
-               media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
-               if(STRING_VALID(condition_query))
-               {
-                       SAFE_STRLCAT(select_query, QUERY_KEYWORD_SPACE, sizeof(select_query));
-                       SAFE_STRLCAT(select_query, QUERY_KEYWORD_AND, sizeof(select_query));
-               }
-       }
+       ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
        SAFE_STRLCAT(select_query, QUERY_KEYWORD_SPACE, sizeof(select_query));
 
@@ -706,50 +607,20 @@ int _media_db_get_tag(const char *media_id, filter_h filter, media_tag_cb callba
 int _media_db_get_bookmark(const char *media_id, filter_h filter, media_bookmark_cb callback, void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       char select_query[DEFAULT_QUERY_SIZE];
+       char select_query[MAX_QUERY_SIZE] = {0, };
        char *condition_query = NULL;
        char *option_query = NULL;
        sqlite3_stmt *stmt = NULL;
-       filter_s *_filter = NULL;
-       attribute_h attr;
-
-       memset(select_query, 0x00, sizeof(select_query));
-
-       if(!STRING_VALID(media_id))
-       {
-               attr = _content_get_alias_attirbute_handle();
-               //snprintf(select_query, sizeof(select_query), SELECT_BOOKMARK_LIST);
-               if(!SAFE_STRLCPY(select_query, SELECT_BOOKMARK_LIST, sizeof(select_query)))
-               {
-                       media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
-                       return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
-               }
-       }
-       else
-       {
-               attr = _content_get_attirbute_handle();
-               snprintf(select_query, sizeof(select_query), SELECT_BOOKMARK_LIST_BY_MEDIA_ID_USUAL, media_id);
-       }
+       attribute_h attr = NULL;
 
-       if(filter != NULL)
-       {
-               _filter = (filter_s*)filter;
+       attr = _content_get_attirbute_handle();
 
-               if(_filter->condition)
-               {
-                       ret = _media_filter_attribute_generate(attr, _filter->condition, _filter->condition_collate_type, &condition_query);
-                       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-               }
+       memset(select_query, 0x00, sizeof(select_query));
 
-               ret = _media_filter_attribute_option_generate(attr, filter, &option_query);
-               media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+       snprintf(select_query, sizeof(select_query), SELECT_BOOKMARK_LIST_BY_MEDIA_ID, media_id);
 
-               if(STRING_VALID(condition_query))
-               {
-                       SAFE_STRLCAT(select_query, QUERY_KEYWORD_SPACE, sizeof(select_query));
-                       SAFE_STRLCAT(select_query, QUERY_KEYWORD_AND, sizeof(select_query));
-               }
-       }
+       ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
        ret = _content_query_prepare(&stmt, select_query, condition_query, option_query);
        SAFE_FREE(condition_query);
@@ -796,30 +667,24 @@ int _media_db_get_group_item_count_by_id(int group_id, filter_h filter, group_li
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
        sqlite3_stmt *stmt = NULL;
-       filter_s *_filter = NULL;
-       char select_query[DEFAULT_QUERY_SIZE];
+       char select_query[MAX_QUERY_SIZE] = {0, };
        char *condition_query = NULL;
        char *option_query = NULL;
        attribute_h attr = NULL;
 
-       media_content_debug_func();
-
+       attr = _content_get_attirbute_handle();
        memset(select_query, 0x00, sizeof(select_query));
 
        if(group_type == MEDIA_GROUP_ALBUM)
        {
-               attr = _content_get_attirbute_handle();
                snprintf(select_query, sizeof(select_query), SELECT_MEDIA_COUNT_FROM_ALBUM, group_id);
        }
        else if(group_type == MEDIA_GROUP_PLAYLIST)
        {
-               //attr = _content_get_alias_attirbute_handle();
-               attr = _content_get_attirbute_handle();
                snprintf(select_query, sizeof(select_query), SELECT_MEDIA_COUNT_FROM_PLAYLIST, group_id);
        }
        else if(group_type == MEDIA_GROUP_TAG)
        {
-               attr = _content_get_attirbute_handle();
                snprintf(select_query, sizeof(select_query), SELECT_MEDIA_COUNT_FROM_TAG, group_id);
        }
        else
@@ -828,41 +693,9 @@ int _media_db_get_group_item_count_by_id(int group_id, filter_h filter, group_li
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
-       if(filter != NULL)
-       {
-               _filter = (filter_s*)filter;
-
-               if(_filter->condition)
-               {
-                       ret = _media_filter_attribute_generate(attr, _filter->condition, _filter->condition_collate_type, &condition_query);
-                       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-               }
-
-               ret = _media_filter_attribute_option_generate(attr, filter, &option_query);
-               media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
-               if(STRING_VALID(condition_query))
-               {
-                       SAFE_STRLCAT(select_query, QUERY_KEYWORD_SPACE, sizeof(select_query));
-                       SAFE_STRLCAT(select_query, QUERY_KEYWORD_AND, sizeof(select_query));
-               }
-       }
-/*
-       if((group_type == MEDIA_GROUP_PLAYLIST) || (group_type == MEDIA_GROUP_TAG))
-       {
-               strncat(select_query, QUERY_KEYWORD_SPACE, strlen(QUERY_KEYWORD_SPACE));
-
-               if(STRING_VALID(condition_query))
-                       strncat(select_query, condition_query, strlen(condition_query));
-               if(STRING_VALID(option_query))
-                       strncat(select_query, option_query, strlen(option_query));
-
-               strncat(select_query, QUERY_KEYWORD_BRACKET, strlen(QUERY_KEYWORD_BRACKET));
+       ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
-               SAFE_FREE(condition_query);
-               SAFE_FREE(option_query);
-       }
-*/
        ret = _content_query_prepare(&stmt, select_query, condition_query, option_query);
        SAFE_FREE(condition_query);
        SAFE_FREE(option_query);
@@ -871,7 +704,6 @@ int _media_db_get_group_item_count_by_id(int group_id, filter_h filter, group_li
        while(sqlite3_step(stmt) == SQLITE_ROW)
        {
                *item_count = (int)sqlite3_column_int(stmt, 0);
-               media_content_debug("group item count : [%d]", *item_count);
        }
 
        SQLITE3_FINALIZE(stmt);
@@ -884,28 +716,42 @@ int _media_db_get_group_item_count(const char *group_name, filter_h filter, grou
        int ret = MEDIA_CONTENT_ERROR_NONE;
        sqlite3_stmt *stmt = NULL;
        filter_s *_filter = NULL;
-       char complete_select_query[DEFAULT_QUERY_SIZE];
-       char *select_query = NULL;
+       char select_query[MAX_QUERY_SIZE] = {0, };
+       char *tmp_query = NULL;
        char *condition_query = NULL;
        char *option_query = NULL;
+       bool is_simple = FALSE;
+       attribute_h attr = NULL;
 
-       media_content_debug_func();
+       attr = _content_get_attirbute_handle();
+       memset(select_query, 0x00, sizeof(select_query));
 
        if(group_type == MEDIA_GROUP_NONE)
        {
-               select_query = sqlite3_mprintf(SELECT_MEDIA_COUNT_FROM_MEDIA);
+               /* There are 2 ways to get count for media table for performance
+                       If user wants to set offset and count, use SQL SELECT_MEDIA_COUNT_FROM_MEDIA.
+                       If user wants to get count without setting count, SELECT_MEDIA_COUNT_FROM_MEDIA_SIMPLE */
+               _filter = (filter_s*)filter;
+               if (_filter && ((_filter->offset < 0) && (_filter->count < 0))) {
+
+                               SAFE_STRLCAT(select_query, SELECT_MEDIA_COUNT_FROM_MEDIA_SIMPLE, sizeof(select_query));
+                               is_simple = TRUE;
+               } else {
+                       SAFE_STRLCAT(select_query, SELECT_MEDIA_COUNT_FROM_MEDIA, sizeof(select_query));
+               }
        }
        else if(group_type == MEDIA_GROUP_FOLDER)
        {
-               select_query = sqlite3_mprintf(SELECT_MEDIA_COUNT_FROM_FOLDER, group_name);
+               tmp_query = sqlite3_mprintf(SELECT_MEDIA_COUNT_FROM_FOLDER, group_name);
+               SAFE_STRLCAT(select_query, tmp_query, sizeof(select_query));
        }
        else if(group_type == MEDIA_GROUP_TAG_BY_MEDIA_ID)
        {
-               select_query = sqlite3_mprintf(SELECT_TAG_COUNT_BY_MEDIA_ID, group_name);
+               snprintf(select_query, sizeof(select_query), SELECT_TAG_COUNT_BY_MEDIA_ID, group_name);
        }
        else if(group_type == MEDIA_GROUP_BOOKMARK_BY_MEDIA_ID)
        {
-               select_query = sqlite3_mprintf(SELECT_BOOKMARK_COUNT_BY_MEDIA_ID, group_name);
+               snprintf(select_query, sizeof(select_query), SELECT_BOOKMARK_COUNT_BY_MEDIA_ID, group_name);
        }
        else
        {
@@ -913,55 +759,32 @@ int _media_db_get_group_item_count(const char *group_name, filter_h filter, grou
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
-       if(filter != NULL)
+       ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
        {
-               _filter = (filter_s*)filter;
-
-               if(_filter->condition)
-               {
-                       ret = _media_filter_attribute_generate(_content_get_attirbute_handle(), _filter->condition, _filter->condition_collate_type, &condition_query);
-                       if(ret != MEDIA_CONTENT_ERROR_NONE)
-                       {
-                               sqlite3_free(select_query);
-                               return ret;
-                       }
-               }
-
-               ret = _media_filter_attribute_option_generate(_content_get_attirbute_handle(), filter, &option_query);
-               if(ret != MEDIA_CONTENT_ERROR_NONE)
-               {
-                       sqlite3_free(select_query);
-                       return ret;
-               }
-
-               if(STRING_VALID(condition_query))
-               {
-                       snprintf(complete_select_query, sizeof(complete_select_query), "%s %s", select_query, QUERY_KEYWORD_AND);
-               }
-               else
-               {
-                       snprintf(complete_select_query, sizeof(complete_select_query), "%s", select_query);
-               }
-       } else {
-               snprintf(complete_select_query, sizeof(complete_select_query), "%s", select_query);
+               if(tmp_query != NULL)
+                       sqlite3_free(tmp_query);
+               return ret;
        }
 
        if(group_type == MEDIA_GROUP_NONE)
        {
-               SAFE_STRLCAT(complete_select_query, QUERY_KEYWORD_SPACE, sizeof(complete_select_query));
+               SAFE_STRLCAT(select_query, QUERY_KEYWORD_SPACE, sizeof(select_query));
                if(STRING_VALID(condition_query))
-                       SAFE_STRLCAT(complete_select_query, condition_query, sizeof(complete_select_query));
+                       SAFE_STRLCAT(select_query, condition_query, sizeof(select_query));
                if(STRING_VALID(option_query))
-                       SAFE_STRLCAT(complete_select_query, option_query, sizeof(complete_select_query));
+                       SAFE_STRLCAT(select_query, option_query, sizeof(select_query));
 
-               SAFE_STRLCAT(complete_select_query, QUERY_KEYWORD_BRACKET, sizeof(complete_select_query));
+               if (!is_simple)
+                       SAFE_STRLCAT(select_query, QUERY_KEYWORD_BRACKET, sizeof(select_query));
 
                SAFE_FREE(condition_query);
                SAFE_FREE(option_query);
        }
 
-       ret = _content_query_prepare(&stmt, complete_select_query, condition_query, option_query);
-       sqlite3_free(select_query);
+       ret = _content_query_prepare(&stmt, select_query, condition_query, option_query);
+       if(tmp_query != NULL)
+               sqlite3_free(tmp_query);
        SAFE_FREE(condition_query);
        SAFE_FREE(option_query);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
@@ -969,7 +792,6 @@ int _media_db_get_group_item_count(const char *group_name, filter_h filter, grou
        while(sqlite3_step(stmt) == SQLITE_ROW)
        {
                *item_count = (int)sqlite3_column_int(stmt, 0);
-               media_content_debug("group item count : [%d]", *item_count);
        }
 
        SQLITE3_FINALIZE(stmt);
@@ -980,12 +802,13 @@ int _media_db_get_group_item_count(const char *group_name, filter_h filter, grou
 int _media_db_get_group_item_by_id(int group_id, filter_h filter, media_info_cb callback, void *user_data, group_list_e group_type)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       char select_query[DEFAULT_QUERY_SIZE];
+       char select_query[MAX_QUERY_SIZE] = {0, };
        char *condition_query = NULL;
        char *option_query = NULL;
        sqlite3_stmt *stmt = NULL;
-       filter_s *_filter = NULL;
+       attribute_h attr = NULL;
 
+       attr = _content_get_attirbute_handle();
        memset(select_query, 0x00, sizeof(select_query));
 
        if(group_type == MEDIA_GROUP_ALBUM)
@@ -1006,25 +829,8 @@ int _media_db_get_group_item_by_id(int group_id, filter_h filter, media_info_cb
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
-       if(filter != NULL)
-       {
-               _filter = (filter_s*)filter;
-
-               if(_filter->condition)
-               {
-                       ret = _media_filter_attribute_generate(_content_get_attirbute_handle(), _filter->condition, _filter->condition_collate_type, &condition_query);
-                       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-               }
-
-               ret = _media_filter_attribute_option_generate(_content_get_attirbute_handle(), filter, &option_query);
-               media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
-               if(STRING_VALID(condition_query))
-               {
-                       SAFE_STRLCAT(select_query, QUERY_KEYWORD_SPACE, sizeof(select_query));
-                       SAFE_STRLCAT(select_query, QUERY_KEYWORD_AND, sizeof(select_query));
-               }
-       }
+       ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
        ret = _content_query_prepare(&stmt, select_query, condition_query, option_query);
        SAFE_FREE(condition_query);
@@ -1060,24 +866,22 @@ int _media_db_get_group_item_by_id(int group_id, filter_h filter, media_info_cb
 int _media_db_get_group_item(const char *group_name, filter_h filter, media_info_cb callback, void *user_data, group_list_e group_type)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       char complete_select_query[DEFAULT_QUERY_SIZE];
-       char *select_query = NULL;
+       char select_query[MAX_QUERY_SIZE] = {0, };
        char *condition_query = NULL;
        char *option_query = NULL;
        sqlite3_stmt *stmt = NULL;
-       filter_s *_filter = NULL;
+       attribute_h attr = NULL;
+
+       attr = _content_get_attirbute_handle();
+       memset(select_query, 0x00, sizeof(select_query));
 
        if(group_type == MEDIA_GROUP_NONE)
        {
-               select_query = sqlite3_mprintf(SELECT_MEDIA_ITEM);
+               SAFE_STRLCAT(select_query, SELECT_MEDIA_ITEM, sizeof(select_query));
        }
        else if(group_type == MEDIA_GROUP_FOLDER)
        {
-               select_query = sqlite3_mprintf(SELECT_MEDIA_FROM_FOLDER, group_name);
-       }
-       else if(group_type == MEDIA_GROUP_BOOKMARK_BY_MEDIA_ID)
-       {
-               select_query = sqlite3_mprintf(SELECT_BOOKMARK_LIST_BY_MEDIA_ID, group_name);
+               snprintf(select_query, sizeof(select_query), SELECT_MEDIA_FROM_FOLDER, group_name);
        }
        else
        {
@@ -1085,41 +889,10 @@ int _media_db_get_group_item(const char *group_name, filter_h filter, media_info
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
-       if(filter != NULL)
-       {
-               _filter = (filter_s*)filter;
-
-               if(_filter->condition)
-               {
-                       ret = _media_filter_attribute_generate(_content_get_attirbute_handle(), _filter->condition, _filter->condition_collate_type, &condition_query);
-                       if(ret != MEDIA_CONTENT_ERROR_NONE)
-                       {
-                               sqlite3_free(select_query);
-                               return ret;
-                       }
-               }
-
-               ret = _media_filter_attribute_option_generate(_content_get_attirbute_handle(), filter, &option_query);
-               if(ret != MEDIA_CONTENT_ERROR_NONE)
-               {
-                       sqlite3_free(select_query);
-                       return ret;
-               }
-
-               if(STRING_VALID(condition_query))
-               {
-                       snprintf(complete_select_query, sizeof(complete_select_query), "%s %s", select_query, QUERY_KEYWORD_AND);
-               }
-               else
-               {
-                       snprintf(complete_select_query, sizeof(complete_select_query), "%s", select_query);
-               }
-       } else {
-               snprintf(complete_select_query, sizeof(complete_select_query), "%s", select_query);
-       }
+       ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
-       ret = _content_query_prepare(&stmt, complete_select_query, condition_query, option_query);
-       sqlite3_free(select_query);
+       ret = _content_query_prepare(&stmt, select_query, condition_query, option_query);
        SAFE_FREE(condition_query);
        SAFE_FREE(option_query);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
@@ -1150,69 +923,50 @@ int _media_db_get_group_item(const char *group_name, filter_h filter, media_info
        return ret;
 }
 
-int _media_db_get_media_group_item_count(const char *group_name, media_group_e group, filter_h filter, int *item_count)
+int _media_db_get_media_group_item_count(const char *group_name, filter_h filter, media_group_e group, int *item_count)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
        sqlite3_stmt *stmt = NULL;
-       filter_s *_filter = NULL;
-       char complete_select_query[DEFAULT_QUERY_SIZE];
-       char *select_query = NULL;
+       char select_query[MAX_QUERY_SIZE] = {0, };
+       char *tmp_query = NULL;
        char *condition_query = NULL;
        char *option_query = NULL;
+       attribute_h attr = NULL;
 
-       media_content_debug_func();
+       attr = _content_get_attirbute_handle();
+       memset(select_query, 0x00, sizeof(select_query));
 
        if(group_name != NULL)
-               select_query = sqlite3_mprintf(SELECT_MEDIA_COUNT_FROM_GROUP, __media_db_get_group_name(group), group_name);
+       {
+               tmp_query = sqlite3_mprintf(SELECT_MEDIA_COUNT_FROM_GROUP, __media_db_get_group_name(group), group_name);
+               SAFE_STRLCAT(select_query, tmp_query, sizeof(select_query));
+       }
        else
-               select_query = sqlite3_mprintf(SELECT_MEDIA_COUNT_FROM_GROUP_NULL, __media_db_get_group_name(group));
-
-       if(filter != NULL)
        {
-               _filter = (filter_s*)filter;
-
-               if(_filter->condition)
-               {
-                       ret = _media_filter_attribute_generate(_content_get_attirbute_handle(), _filter->condition, _filter->condition_collate_type, &condition_query);
-                       if(ret != MEDIA_CONTENT_ERROR_NONE)
-                       {
-                               sqlite3_free(select_query);
-                               return ret;
-                       }
-               }
-
-               ret = _media_filter_attribute_option_generate(_content_get_attirbute_handle(), filter, &option_query);
-               if(ret != MEDIA_CONTENT_ERROR_NONE)
-               {
-                       sqlite3_free(select_query);
-                       return ret;
-               }
+               snprintf(select_query, sizeof(select_query), SELECT_MEDIA_COUNT_FROM_GROUP_NULL, __media_db_get_group_name(group));
+       }
 
-               if(STRING_VALID(condition_query))
-               {
-                       snprintf(complete_select_query, sizeof(complete_select_query), "%s %s", select_query, QUERY_KEYWORD_AND);
-               }
-               else
-               {
-                       snprintf(complete_select_query, sizeof(complete_select_query), "%s", select_query);
-               }
-       } else {
-               snprintf(complete_select_query, sizeof(complete_select_query), "%s", select_query);
+       ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+       {
+               if(tmp_query != NULL)
+                       sqlite3_free(tmp_query);
+               return ret;
        }
 
-       SAFE_STRLCAT(complete_select_query, QUERY_KEYWORD_SPACE, sizeof(complete_select_query));
+       SAFE_STRLCAT(select_query, QUERY_KEYWORD_SPACE, sizeof(select_query));
        if(STRING_VALID(condition_query))
-               SAFE_STRLCAT(complete_select_query, condition_query, sizeof(complete_select_query));
+               SAFE_STRLCAT(select_query, condition_query, sizeof(select_query));
        if(STRING_VALID(option_query))
-               SAFE_STRLCAT(complete_select_query, option_query, sizeof(complete_select_query));
-
-       SAFE_STRLCAT(complete_select_query, QUERY_KEYWORD_BRACKET, sizeof(complete_select_query));
+               SAFE_STRLCAT(select_query, option_query, sizeof(select_query));
+       SAFE_STRLCAT(select_query, QUERY_KEYWORD_BRACKET, sizeof(select_query));
 
        SAFE_FREE(condition_query);
        SAFE_FREE(option_query);
 
-       ret = _content_query_prepare(&stmt, complete_select_query, condition_query, option_query);
-       sqlite3_free(select_query);
+       ret = _content_query_prepare(&stmt, select_query, condition_query, option_query);
+       if(tmp_query != NULL)
+               sqlite3_free(tmp_query);
        SAFE_FREE(condition_query);
        SAFE_FREE(option_query);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
@@ -1220,7 +974,6 @@ int _media_db_get_media_group_item_count(const char *group_name, media_group_e g
        while(sqlite3_step(stmt) == SQLITE_ROW)
        {
                *item_count = (int)sqlite3_column_int(stmt, 0);
-               media_content_debug("group item count : [%d]", *item_count);
        }
 
        SQLITE3_FINALIZE(stmt);
@@ -1228,58 +981,40 @@ int _media_db_get_media_group_item_count(const char *group_name, media_group_e g
        return ret;
 }
 
-int _media_db_get_media_group_item(const char *group_name, media_group_e group, filter_h filter, media_info_cb callback, void *user_data)
+int _media_db_get_media_group_item(const char *group_name, filter_h filter, media_group_e group, media_info_cb callback, void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       char complete_select_query[DEFAULT_QUERY_SIZE];
-       char *select_query = NULL;
+       char select_query[MAX_QUERY_SIZE] = {0, };
+       char *tmp_query = NULL;
        char *condition_query = NULL;
        char *option_query = NULL;
        sqlite3_stmt *stmt = NULL;
-       filter_s *_filter = NULL;
+       attribute_h attr = NULL;
 
-       media_content_debug_func();
+       attr = _content_get_attirbute_handle();
+       memset(select_query, 0x00, sizeof(select_query));
 
        if(group_name != NULL)
-               select_query = sqlite3_mprintf(SELECT_MEDIA_FROM_GROUP, __media_db_get_group_name(group), group_name);
+       {
+               tmp_query = sqlite3_mprintf(SELECT_MEDIA_FROM_GROUP, __media_db_get_group_name(group), group_name);
+               SAFE_STRLCAT(select_query, tmp_query, sizeof(select_query));
+       }
        else
-               select_query = sqlite3_mprintf(SELECT_MEDIA_FROM_GROUP_NULL, __media_db_get_group_name(group));
-
-       if(filter != NULL)
        {
-               _filter = (filter_s*)filter;
-
-               if(_filter->condition)
-               {
-                       ret = _media_filter_attribute_generate(_content_get_attirbute_handle(), _filter->condition, _filter->condition_collate_type, &condition_query);
-                       if(ret != MEDIA_CONTENT_ERROR_NONE)
-                       {
-                               sqlite3_free(select_query);
-                               return ret;
-                       }
-               }
-
-               ret = _media_filter_attribute_option_generate(_content_get_attirbute_handle(), filter, &option_query);
-               if(ret != MEDIA_CONTENT_ERROR_NONE)
-               {
-                       sqlite3_free(select_query);
-                       return ret;
-               }
+               snprintf(select_query, sizeof(select_query), SELECT_MEDIA_FROM_GROUP_NULL, __media_db_get_group_name(group));
+       }
 
-               if(STRING_VALID(condition_query))
-               {
-                       snprintf(complete_select_query, sizeof(complete_select_query), "%s %s", select_query, QUERY_KEYWORD_AND);
-               }
-               else
-               {
-                       snprintf(complete_select_query, sizeof(complete_select_query), "%s", select_query);
-               }
-       } else {
-               snprintf(complete_select_query, sizeof(complete_select_query), "%s", select_query);
+       ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+       {
+               if(tmp_query != NULL)
+                       sqlite3_free(tmp_query);
+               return ret;
        }
 
-       ret = _content_query_prepare(&stmt, complete_select_query, condition_query, option_query);
-       sqlite3_free(select_query);
+       ret = _content_query_prepare(&stmt, select_query, condition_query, option_query);
+       if(tmp_query != NULL)
+               sqlite3_free(tmp_query);
        SAFE_FREE(condition_query);
        SAFE_FREE(option_query);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
index cf2467b..0176eb2 100755 (executable)
@@ -15,9 +15,8 @@
 */
 
 
-#include <media_content.h>
 #include <media_info_private.h>
-#include <media-svc.h>
+#include <vconf.h>
 
 static char *media_token[] =
 {
@@ -54,6 +53,37 @@ static char *__media_filter_replace_attr(attribute_h attr, char *name);
 static int __tokenize_operator(token_t *token, const char *str, int op_type);
 static int __tokenize(GList **token_list, const char *str);
 
+static bool __is_pinyin_needed(void)
+{
+       char *lang = NULL;
+       char *china = "zh_CN";
+       char *hongkong = "zh_HK";
+       int ret = FALSE;
+
+       /*Check CSC first*/
+       bool pinyin_support = FALSE;
+       media_svc_check_pinyin_support(&pinyin_support);
+       if(pinyin_support)
+       {
+               /*Check Language Setting*/
+               lang = vconf_get_str(VCONFKEY_LANGSET);
+               if (lang == NULL)
+               {
+                       media_content_error("Fail to get string of language set");
+                       return ret;
+               }
+               if((strncmp(china, lang, strlen(china)) == 0) ||
+                       (strncmp(hongkong, lang, strlen(hongkong)) == 0))
+               {
+                       ret = TRUE;
+               }
+
+               SAFE_FREE(lang);
+       }
+
+       return ret;
+}
+
 static char *__get_order_str(media_content_order_e order_enum)
 {
        switch(order_enum) {
@@ -73,6 +103,11 @@ static char *__get_collate_str(media_content_collation_e collate_type)
                        return "NOCASE";
                case MEDIA_CONTENT_COLLATE_RTRIM:
                        return "RTRIM";
+               case MEDIA_CONTENT_COLLATE_LOCALIZED:
+                       if(__is_pinyin_needed())
+                               return "NOCASE";
+                       else
+                               return "localized";
                default: return " ";
        }
 }
@@ -85,8 +120,8 @@ static void __filter_attribute_free_value(gpointer key, gpointer value, gpointer
 
 static char *__media_filter_replace_attr(attribute_h attr, char *name)
 {
-       char *key_temp;
-       char *generated_value;
+       char *key_temp = NULL;
+       char *generated_value = NULL;
        attribute_s *_attr = (attribute_s *)attr;
 
        if(!g_hash_table_lookup_extended(_attr->attr_map,
@@ -117,9 +152,21 @@ static int __tokenize_operator(token_t *token, const char *str, int op_type)
        {
                token->type = op_type;
                int token_size = strlen(media_token[op_type]);
+               if(token_size == 0)
+               {
+                       media_content_error("Invalid token_size. op_type[%d]", op_type);
+                       return -1;
+               }
+
                token->str = (char*)calloc(token_size+1, sizeof(char));
+               if(token->str == NULL)
+               {
+                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                       return -1;
+               }
+
                strncpy(token->str, tmp, token_size);
-               media_content_debug("type : [%d] str : [%s] \n", token->type, token->str);
+               //media_content_debug("type : [%d] str : [%s]", token->type, token->str);
                ret = token_size;
        }
        else
@@ -137,10 +184,15 @@ static int __tokenize_string(token_t *token, const char *str, int size)
 
        if(token != NULL && STRING_VALID(tmp) && size > 0)
        {
-               token->str      = (char*)calloc(size+1, sizeof(char));
+               token->str = (char*)calloc(size+1, sizeof(char));
+               if(token->str == NULL)
+               {
+                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                       return -1;
+               }
                token->type = UNKNOWN_TYPE;
                strncpy(token->str, tmp, size);
-               media_content_debug("type : [%d] str : [%s] \n", token->type, token->str);
+               //media_content_debug("type : [%d] str : [%s]", token->type, token->str);
        }
        else
        {
@@ -174,12 +226,22 @@ static int __tokenize_attribute(GList **token_list, const char *str)
                                idx = -1;
                                continue;
                        }
-
                        token_t *token = (token_t*)calloc(1, sizeof(token_t));
+                       if(token == NULL)
+                       {
+                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               return -1;
+                       }
                        token->type = UNKNOWN_TYPE;
                        token->str = (char*)calloc(idx+1, sizeof(char));
+                       if(token->str == NULL)
+                       {
+                               SAFE_FREE(token);
+                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               return -1;
+                       }
                        strncpy(token->str, tmp, idx);
-                       media_content_debug("type : [%d] str : [%s] \n", token->type, token->str);
+                       //media_content_debug("type : [%d] str : [%s]", token->type, token->str);
                        *token_list = g_list_append(*token_list, token);
                        tmp = tmp +idx + strlen(media_token[0]);
                        idx = -1;
@@ -189,10 +251,16 @@ static int __tokenize_attribute(GList **token_list, const char *str)
                        if(idx != 0)
                        {
                                token_t *token = (token_t*)calloc(1, sizeof(token_t));
+                               if(token == NULL)
+                               {
+                                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                                       return -1;
+                               }
                                ret = __tokenize_string(token, tmp, idx);
                                if (ret < 0)
                                {
-                                       media_content_error("tokenize error occued");
+                                       SAFE_FREE(token);
+                                       media_content_error("tokenize error occured");
                                        return -1;
                                }
                                else
@@ -201,6 +269,7 @@ static int __tokenize_attribute(GList **token_list, const char *str)
                                        tmp = tmp + idx;
                                }
                        }
+
                        token_t *token = (token_t*)calloc(1, sizeof(token_t));
                        int size = __tokenize_operator(token, tmp,3);
 
@@ -212,7 +281,8 @@ static int __tokenize_attribute(GList **token_list, const char *str)
                        }
                        else
                        {
-                               media_content_error("tokenize error occued");
+                               SAFE_FREE(token);
+                               media_content_error("tokenize error occured");
                                return -1;
                        }
                }
@@ -221,14 +291,28 @@ static int __tokenize_attribute(GList **token_list, const char *str)
        if(*tmp)                        //remained string
        {
                token_t *token = (token_t*)calloc(1, sizeof(token_t));
-               __tokenize_string(token, tmp, idx);
+               if(token == NULL)
+               {
+                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                       return -1;
+               }
+
+               ret = __tokenize_string(token, tmp, idx);
+               if (ret < 0)
+               {
+                       SAFE_FREE(token);
+                       media_content_error("tokenize error occured");
+                       return -1;
+               }
+
                if(token != NULL && STRING_VALID(token->str))
                {
                        *token_list = g_list_append(*token_list, token);
                }
                else
                {
-                       media_content_error("tokenize error occued");
+                       SAFE_FREE(token);
+                       media_content_error("tokenize error occured");
                        return -1;
                }
        }
@@ -262,10 +346,21 @@ static int __tokenize(GList **token_list, const char *str)
                        }
 
                        token_t *token = (token_t*)calloc(1, sizeof(token_t));
+                       if(token == NULL)
+                       {
+                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               return -1;
+                       }
                        token->type = UNKNOWN_TYPE;
                        token->str = (char*)calloc(idx+1, sizeof(char));
+                       if(token->str == NULL)
+                       {
+                               SAFE_FREE(token);
+                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               return -1;
+                       }
                        strncpy(token->str, tmp, idx);
-                       media_content_debug("type : [%d] str : [%s] \n", token->type, token->str);
+                       //media_content_debug("type : [%d] str : [%s]", token->type, token->str);
                        *token_list = g_list_append(*token_list, token);
                        tmp = tmp +idx + strlen(media_token[0]);
                        idx = -1;
@@ -273,34 +368,58 @@ static int __tokenize(GList **token_list, const char *str)
                else if(tmp[idx] == media_token[1][0])  // " \" "
                {
                        int j;
+                       bool flag = false;
                        for(j = idx+1; tmp[j]; j++)     //find next quotation
                        {
                                if(tmp[j] == media_token[1][0] && tmp[j+1] == media_token[1][0])
                                {
-                                       j += 2;
+                                       j += 1;
                                        continue;
                                }
                                if(tmp[j] == media_token[1][0])
                                {
                                        token_t *token = (token_t*)calloc(1, sizeof(token_t));
+                                       if(token == NULL)
+                                       {
+                                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                                               return -1;
+                                       }
                                        token->str = (char*) calloc(j+1+1, sizeof(char));
+                                       if(token->str == NULL)
+                                       {
+                                               SAFE_FREE(token);
+                                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                                               return -1;
+                                       }
                                        token->type = STRING_TYPE;
                                        strncpy(token->str, tmp, j+1);
-                                       media_content_debug("type : [%d] str : [%s], j : %d \n", token->type, token->str, j);
+                                       //media_content_debug("type : [%d] str : [%s], j : %d", token->type, token->str, j);
                                        *token_list = g_list_append(*token_list, token);
                                        tmp = tmp + strlen(token->str);
                                        idx = -1;
+                                       flag = true;
                                        break;
                                }
                        }
 
-                       if(*tmp != '\0' && tmp[j]=='\0')
+                       if(!flag && *tmp != '\0' && tmp[j]=='\0')
                        {
                                token_t *token = (token_t*)calloc(1, sizeof(token_t));
+                               if(token == NULL)
+                               {
+                                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                                       return -1;
+                               }
                                token->str = (char*) calloc(j+1,sizeof(char));
+                               if(token->str == NULL)
+                               {
+                                       SAFE_FREE(token);
+                                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                                       return -1;
+                               }
                                token->type = UNKNOWN_TYPE;
                                strncpy(token->str, tmp,j);
-                               media_content_debug("type : [%d] str : [%s] \n", token->type, token->str);
+                               //media_content_debug("type : [%d] str : [%s]", token->type, token->str);
                                *token_list = g_list_append(*token_list, token);
                                tmp = tmp +strlen(token->str);
                                idx = -1;
@@ -309,34 +428,58 @@ static int __tokenize(GList **token_list, const char *str)
                else if(tmp[idx] == media_token[2][0])  // " \' "
                {
                        int j;
+                       bool flag = false;
                        for(j = idx+1; tmp[j]; j++)
                        {
                                if(tmp[j] == media_token[2][0] && tmp[j+1] == media_token[2][0])
                                {
-                                       j += 2;
+                                       j += 1;
                                        continue;
                                }
                                if(tmp[j] == media_token[2][0])
                                {
                                        token_t *token = (token_t*)calloc(1, sizeof(token_t));
+                                       if(token == NULL)
+                                       {
+                                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                                               return -1;
+                                       }
                                        token->str = (char*) calloc(j+1+1, sizeof(char));
+                                       if(token->str == NULL)
+                                       {
+                                               SAFE_FREE(token);
+                                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                                               return -1;
+                                       }
                                        token->type = STRING_TYPE;
                                        strncpy(token->str, tmp, j+1);
-                                       media_content_debug("type : [%d] str : [%s] \n", token->type, token->str);
+                                       //media_content_debug("type : [%d] str : [%s]", token->type, token->str);
                                        *token_list = g_list_append(*token_list, token);
                                        tmp = tmp + strlen(token->str);
                                        idx = -1;
+                                       flag = true;
                                        break;
                                }
                        }
 
-                       if(*tmp != '\0' && tmp[j]=='\0')
+                       if(!flag && *tmp != '\0' && tmp[j]=='\0')
                        {
                                token_t *token = (token_t*)calloc(1, sizeof(token_t));
+                               if(token == NULL)
+                               {
+                                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                                       return -1;
+                               }
                                token->str = (char*) calloc(j+1,sizeof(char));
+                               if(token->str == NULL)
+                               {
+                                       SAFE_FREE(token);
+                                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                                       return -1;
+                               }
                                token->type = UNKNOWN_TYPE;
                                strncpy(token->str, tmp,j);
-                               media_content_debug("type : [%d] str : [%s] \n", token->type, token->str);
+                               //media_content_debug("type : [%d] str : [%s]", token->type, token->str);
                                *token_list = g_list_append(*token_list, token);
                                tmp = tmp + strlen(token->str);
                                idx = -1;
@@ -347,10 +490,16 @@ static int __tokenize(GList **token_list, const char *str)
                        if(idx != 0)
                        {
                                token_t *token = (token_t*)calloc(1, sizeof(token_t));
+                               if(token == NULL)
+                               {
+                                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                                       return -1;
+                               }
                                ret = __tokenize_string(token, tmp, idx);
                                if (ret < 0)
                                {
-                                       media_content_error("tokenize error occued");
+                                       SAFE_FREE(token);
+                                       media_content_error("tokenize error occured");
                                        return -1;
                                }
                                else
@@ -370,7 +519,8 @@ static int __tokenize(GList **token_list, const char *str)
                        }
                        else
                        {
-                               media_content_error("tokenize error occued");
+                               SAFE_FREE(token);
+                               media_content_error("tokenize error occured");
                                return -1;
                        }
 
@@ -380,10 +530,17 @@ static int __tokenize(GList **token_list, const char *str)
                        if(idx != 0)
                        {
                                token_t *token = (token_t*)calloc(1, sizeof(token_t));
+                               if(token == NULL)
+                               {
+                                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                                       return -1;
+                               }
+
                                ret = __tokenize_string(token, tmp, idx);
                                if (ret < 0)
                                {
-                                       media_content_error("tokenize error occued");
+                                       SAFE_FREE(token);
+                                       media_content_error("tokenize error occured");
                                        return -1;
                                }
                                else
@@ -403,7 +560,8 @@ static int __tokenize(GList **token_list, const char *str)
                        }
                        else
                        {
-                               media_content_error("tokenize error occued");
+                               SAFE_FREE(token);
+                               media_content_error("tokenize error occured");
                                return -1;
                        }
 
@@ -413,10 +571,17 @@ static int __tokenize(GList **token_list, const char *str)
                        if(idx != 0)
                        {
                                token_t *token = (token_t*)calloc(1, sizeof(token_t));
+                               if(token == NULL)
+                               {
+                                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                                       return -1;
+                               }
+
                                ret = __tokenize_string(token, tmp, idx);
                                if (ret < 0)
                                {
-                                       media_content_error("tokenize error occued");
+                                       SAFE_FREE(token);
+                                       media_content_error("tokenize error occured");
                                        return -1;
                                }
                                else
@@ -436,7 +601,8 @@ static int __tokenize(GList **token_list, const char *str)
                        }
                        else
                        {
-                               media_content_error("tokenize error occued");
+                               SAFE_FREE(token);
+                               media_content_error("tokenize error occured");
                                return -1;
                        }
 
@@ -446,10 +612,17 @@ static int __tokenize(GList **token_list, const char *str)
                        if(idx != 0)
                        {
                                token_t *token = (token_t*)calloc(1, sizeof(token_t));
+                               if(token == NULL)
+                               {
+                                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                                       return -1;
+                               }
+
                                ret = __tokenize_string(token, tmp, idx);
                                if (ret < 0)
                                {
-                                       media_content_error("tokenize error occued");
+                                       SAFE_FREE(token);
+                                       media_content_error("tokenize error occured");
                                        return -1;
                                }
                                else
@@ -469,7 +642,8 @@ static int __tokenize(GList **token_list, const char *str)
                        }
                        else
                        {
-                               media_content_error("tokenize error occued");
+                               SAFE_FREE(token);
+                               media_content_error("tokenize error occured");
                                return -1;
                        }
 
@@ -479,10 +653,17 @@ static int __tokenize(GList **token_list, const char *str)
                        if(idx != 0)
                        {
                                token_t *token = (token_t*)calloc(1, sizeof(token_t));
+                               if(token == NULL)
+                               {
+                                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                                       return -1;
+                               }
+
                                ret = __tokenize_string(token, tmp, idx);
                                if (ret < 0)
                                {
-                                       media_content_error("tokenize error occued");
+                                       SAFE_FREE(token);
+                                       media_content_error("tokenize error occured");
                                        return -1;
                                }
                                else
@@ -502,7 +683,8 @@ static int __tokenize(GList **token_list, const char *str)
                        }
                        else
                        {
-                               media_content_error("tokenize error occued");
+                               SAFE_FREE(token);
+                               media_content_error("tokenize error occured");
                                return -1;
                        }
 
@@ -512,10 +694,17 @@ static int __tokenize(GList **token_list, const char *str)
                        if(idx != 0)
                        {
                                token_t *token = (token_t*)calloc(1, sizeof(token_t));
+                               if(token == NULL)
+                               {
+                                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                                       return -1;
+                               }
+
                                ret = __tokenize_string(token, tmp, idx);
                                if (ret < 0)
                                {
-                                       media_content_error("tokenize error occued");
+                                       SAFE_FREE(token);
+                                       media_content_error("tokenize error occured");
                                        return -1;
                                }
                                else
@@ -535,7 +724,8 @@ static int __tokenize(GList **token_list, const char *str)
                        }
                        else
                        {
-                               media_content_error("tokenize error occued");
+                               SAFE_FREE(token);
+                               media_content_error("tokenize error occured");
                                return -1;
                        }
 
@@ -545,10 +735,17 @@ static int __tokenize(GList **token_list, const char *str)
                        if(idx != 0)
                        {
                                token_t *token = (token_t*)calloc(1, sizeof(token_t));
+                               if(token == NULL)
+                               {
+                                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                                       return -1;
+                               }
+
                                ret = __tokenize_string(token, tmp, idx);
                                if (ret < 0)
                                {
-                                       media_content_error("tokenize error occued");
+                                       SAFE_FREE(token);
+                                       media_content_error("tokenize error occured");
                                        return -1;
                                }
                                else
@@ -568,7 +765,8 @@ static int __tokenize(GList **token_list, const char *str)
                        }
                        else
                        {
-                               media_content_error("tokenize error occued");
+                               SAFE_FREE(token);
+                               media_content_error("tokenize error occured");
                                return -1;
                        }
 
@@ -578,14 +776,28 @@ static int __tokenize(GList **token_list, const char *str)
        if(*tmp)                        //remained string
        {
                token_t *token = (token_t*)calloc(1, sizeof(token_t));
-               __tokenize_string(token, tmp, idx);
+               if(token == NULL)
+               {
+                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                       return -1;
+               }
+
+               ret = __tokenize_string(token, tmp, idx);
+               if (ret < 0)
+               {
+                       SAFE_FREE(token);
+                       media_content_error("tokenize error occured");
+                       return -1;
+               }
+
                if(token != NULL && STRING_VALID(token->str))
                {
                        *token_list = g_list_append(*token_list, token);
                }
                else
                {
-                       media_content_error("tokenize error occued");
+                       SAFE_FREE(token);
+                       media_content_error("tokenize error occured");
                        return -1;
                }
        }
@@ -724,7 +936,7 @@ int _media_filter_attribute_generate(attribute_h attr, char *condition, media_co
                        }
 
                        total_str_size += strlen(token->str)+1;
-                       media_content_debug("[%d][type:%d]:%s\n", idx, token->type, token->str);
+                       //media_content_debug("[%d][type:%d]:%s", idx, token->type, token->str);
                }
 
                //make the statment
@@ -745,14 +957,14 @@ int _media_filter_attribute_generate(attribute_h attr, char *condition, media_co
                        }
                }
 
-               if(collate_type == MEDIA_CONTENT_COLLATE_NOCASE || collate_type == MEDIA_CONTENT_COLLATE_RTRIM) {
+               if(collate_type == MEDIA_CONTENT_COLLATE_NOCASE || collate_type == MEDIA_CONTENT_COLLATE_RTRIM ||collate_type == MEDIA_CONTENT_COLLATE_LOCALIZED) {
                        SAFE_STRLCAT(*generated_condition, "COLLATE ", size);
                        SAFE_STRLCAT(*generated_condition, __get_collate_str(collate_type), size);
                        SAFE_STRLCAT(*generated_condition, SPACE, size);
                }
 
-               media_content_debug("statement : %s(%d) (total:%d) \n", *generated_condition, strlen(*generated_condition), total_str_size);
-               media_content_debug("Condition : %s", *generated_condition);
+               //media_content_debug("statement : %s(%d) (total:%d)", *generated_condition, strlen(*generated_condition), total_str_size);
+               media_content_sec_debug("Condition : %s", *generated_condition);
 
                //if(*generated_condition != NULL)
                //      res = 1;
@@ -762,8 +974,8 @@ int _media_filter_attribute_generate(attribute_h attr, char *condition, media_co
        }
        else
        {
-               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
-               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+               media_content_error("DB field mapping table doesn't exist. Check db connection", MEDIA_CONTENT_ERROR_DB_FAILED);
+               return MEDIA_CONTENT_ERROR_DB_FAILED;
        }
 
        return ret;
@@ -778,8 +990,6 @@ int _media_filter_attribute_option_generate(attribute_h attr, filter_h filter, c
        int size = 0;
        //bool order_by = true;
 
-       media_content_debug_func();
-
        if(filter == NULL)
        {
                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
@@ -788,8 +998,8 @@ int _media_filter_attribute_option_generate(attribute_h attr, filter_h filter, c
 
        if(attr == NULL)
        {
-               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
-               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+               media_content_error("DB field mapping table doesn't exist. Check db connection", MEDIA_CONTENT_ERROR_DB_FAILED);
+               return MEDIA_CONTENT_ERROR_DB_FAILED;
        }
 
        _filter = (filter_s*)filter;
@@ -805,7 +1015,6 @@ int _media_filter_attribute_option_generate(attribute_h attr, filter_h filter, c
                token_t *token;
                char *attr_str;
 
-               media_content_debug("Tokenize for [%s]", _filter->order_keyword);
                if(__tokenize_attribute(&token_list, _filter->order_keyword) < 0)
                {
                        media_content_error("INVALID_PARAMETER(0x%08x):Invalid the condition", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
@@ -822,8 +1031,14 @@ int _media_filter_attribute_option_generate(attribute_h attr, filter_h filter, c
                                if(STRING_VALID(replace_str))
                                {
                                        attr_str = (char*)calloc(strlen(replace_str) + COLLATE_STR_SIZE + 1, sizeof(char));
+                                       if(attr_str == NULL)
+                                       {
+                                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                                               SAFE_FREE(replace_str);
+                                               continue;
+                                       }
 
-                                       if(_filter->order_collate_type == MEDIA_CONTENT_COLLATE_NOCASE || _filter->order_collate_type == MEDIA_CONTENT_COLLATE_RTRIM) {
+                                       if(_filter->order_collate_type == MEDIA_CONTENT_COLLATE_NOCASE || _filter->order_collate_type == MEDIA_CONTENT_COLLATE_RTRIM ||_filter->order_collate_type == MEDIA_CONTENT_COLLATE_LOCALIZED) {
                                                snprintf(attr_str, strlen(replace_str) + COLLATE_STR_SIZE + 1, "%s COLLATE %s %s", replace_str, __get_collate_str(_filter->order_collate_type), __get_order_str(_filter->order_type));
                                        } else {
                                                snprintf(attr_str, strlen(replace_str) + COLLATE_STR_SIZE + 1, "%s %s", replace_str, __get_order_str(_filter->order_type));
@@ -840,7 +1055,7 @@ int _media_filter_attribute_option_generate(attribute_h attr, filter_h filter, c
                        }
 
                        total_str_size += strlen(token->str) + 1;
-                       media_content_debug("[%d][type:%d]:%s\n", idx, token->type, token->str);
+                       //media_content_debug("[%d][type:%d]:%s", idx, token->type, token->str);
                }
 
                //make the statment
@@ -854,7 +1069,7 @@ int _media_filter_attribute_option_generate(attribute_h attr, filter_h filter, c
 
                        if((token != NULL) && STRING_VALID(token->str))
                        {
-                               media_content_debug("[%d] %s", idx, token->str);
+                               //media_content_debug("[%d] %s", idx, token->str);
                                SAFE_STRLCAT(generated_condition, token->str, size);
                                SAFE_STRLCAT(generated_condition, SPACE, size);
 
@@ -868,15 +1083,14 @@ int _media_filter_attribute_option_generate(attribute_h attr, filter_h filter, c
 
                if(token_list != NULL)
                        g_list_free(token_list);
+
+               SAFE_FREE(generated_condition);
        }
 
        /* offset */
-       if((_filter->offset >= 0) && (_filter->count >= 0))
-       {
-               SAFE_STRLCAT(option_query, SPACE, sizeof(option_query));
-               snprintf(condition, sizeof(condition), "LIMIT %d, %d", _filter->offset, _filter->count);
-               SAFE_STRLCAT(option_query, condition, sizeof(option_query));
-       }
+       SAFE_STRLCAT(option_query, SPACE, sizeof(option_query));
+       snprintf(condition, sizeof(condition), "LIMIT %d, %d", _filter->offset, _filter->count);
+       SAFE_STRLCAT(option_query, condition, sizeof(option_query));
 
        if(STRING_VALID(option_query))
        {
@@ -970,7 +1184,7 @@ int media_filter_set_condition(filter_h filter, const char *condition, media_con
        filter_s *_filter = (filter_s*)filter;
 
        if((_filter != NULL) && STRING_VALID(condition)
-               && ((collate_type >= MEDIA_CONTENT_COLLATE_DEFAULT) && (collate_type <= MEDIA_CONTENT_COLLATE_RTRIM)))
+               && ((collate_type >= MEDIA_CONTENT_COLLATE_DEFAULT) && (collate_type <= MEDIA_CONTENT_COLLATE_LOCALIZED)))
        {
                if(STRING_VALID(_filter->condition))
                {
@@ -984,7 +1198,7 @@ int media_filter_set_condition(filter_h filter, const char *condition, media_con
                        return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                }
 
-               media_content_debug("Condition string : %s", _filter->condition);
+               media_content_sec_debug("Condition string : %s", _filter->condition);
 
                _filter->condition_collate_type = collate_type;
        }
@@ -1004,7 +1218,7 @@ int media_filter_set_order(filter_h filter, media_content_order_e order_type, co
 
        if((_filter != NULL) && STRING_VALID(order_keyword)
                && ((order_type == MEDIA_CONTENT_ORDER_ASC) ||(order_type == MEDIA_CONTENT_ORDER_DESC))
-               && ((collate_type >= MEDIA_CONTENT_COLLATE_DEFAULT) && (collate_type <= MEDIA_CONTENT_COLLATE_RTRIM)))
+               && ((collate_type >= MEDIA_CONTENT_COLLATE_DEFAULT) && (collate_type <= MEDIA_CONTENT_COLLATE_LOCALIZED)))
        {
                SAFE_FREE(_filter->order_keyword);
 
index e0f104b..a59773f 100755 (executable)
@@ -15,7 +15,6 @@
  */
 
 
-#include <media_content.h>
 #include <media_info_private.h>
 #include <media_util_private.h>
 
@@ -27,36 +26,24 @@ static char *__media_folder_get_update_folder_sql(media_folder_h folder)
 {
        media_folder_s *_folder = (media_folder_s*)folder;
        char *return_sql = NULL;
+       char *name_pinyin = NULL;
+       bool pinyin_support = FALSE;
 
-       return_sql = sqlite3_mprintf("%q='%q', %q='%q', %q=%d ",
+       /*Update Pinyin If Support Pinyin*/
+       media_svc_check_pinyin_support(&pinyin_support);
+       if(pinyin_support)
+               media_svc_get_pinyin(_content_get_db_handle(), _folder->name, &name_pinyin);
+
+       return_sql = sqlite3_mprintf("%q='%q', %q='%q', %q=%d, %q='%q'",
                                                                                        DB_FIELD_FOLDER_PATH, _folder->path,
                                                                                        DB_FIELD_FOLDER_NAME, _folder->name,
-                                                                                       DB_FIELD_FOLDER_MODIFIED_TIME, _folder->modified_time);
+                                                                                       DB_FIELD_FOLDER_MODIFIED_TIME, _folder->modified_time,
+                                                                                       DB_FIELD_FOLDER_NAME_PINYIN, name_pinyin);
 
+       SAFE_FREE(name_pinyin);
        return return_sql;
 }
 
-int media_folder_delete_from_db(const char *folder_id)
-{
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-
-       char *query_string = NULL;
-
-       if(!STRING_VALID(folder_id))
-       {
-               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
-               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
-       }
-
-       query_string = sqlite3_mprintf(DELETE_FOLDER_FROM_FOLDER, folder_id);
-
-       ret = _content_query_sql(query_string);
-
-       sqlite3_free(query_string);
-
-       return ret;
-}
-
 int media_folder_get_folder_count_from_db(filter_h filter, int *folder_count)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
@@ -67,8 +54,6 @@ int media_folder_get_folder_count_from_db(filter_h filter, int *folder_count)
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
-       media_content_debug_func();
-
        ret = _media_db_get_group_count(filter, MEDIA_GROUP_FOLDER, folder_count);
 
        return ret;
@@ -78,8 +63,6 @@ int media_folder_foreach_folder_from_db(filter_h filter, media_folder_cb callbac
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
        if(callback == NULL)
        {
                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
@@ -95,8 +78,6 @@ int media_folder_get_media_count_from_db(const char *folder_id, filter_h filter,
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
        if(STRING_VALID(folder_id) && media_count)
        {
                ret = _media_db_get_group_item_count(folder_id, filter, MEDIA_GROUP_FOLDER, media_count);
@@ -114,8 +95,6 @@ int media_folder_foreach_media_from_db(const char *folder_id, filter_h filter, m
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
        if((callback != NULL) && STRING_VALID(folder_id))
        {
                ret = _media_db_get_group_item(folder_id, filter, callback, user_data, MEDIA_GROUP_FOLDER);
@@ -168,6 +147,7 @@ int media_folder_clone(media_folder_h *dst, media_folder_h src)
                        _dst->folder_id = strdup(_src->folder_id);
                        if(_dst->folder_id == NULL)
                        {
+                               SAFE_FREE(_dst);
                                media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
                                return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                        }
@@ -370,6 +350,8 @@ int media_folder_get_folder_from_db(const char *folder_id, media_folder_h *folde
                        return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                }
 
+               media_content_error("folder handle %x", _folder);
+
                if(STRING_VALID((const char *)sqlite3_column_text(stmt, 0)))
                        _folder->folder_id = strdup((const char *)sqlite3_column_text(stmt, 0));
 
@@ -390,13 +372,9 @@ int media_folder_get_folder_from_db(const char *folder_id, media_folder_h *folde
 int media_folder_update_to_db(media_folder_h folder)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       int len = 0;
        media_folder_s *_folder = (media_folder_s*)folder;
-
-       char sql[MAX_QUERY_SIZE];
-       memset(sql, '\0', sizeof(sql));
        char *set_sql = NULL;
-       char *where_sql = NULL;
+       char *sql = NULL;
 
        if((_folder != NULL) && STRING_VALID(_folder->folder_id) && g_src_path)
        {
@@ -412,20 +390,14 @@ int media_folder_update_to_db(media_folder_h folder)
                        return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                }
 
-               where_sql = sqlite3_mprintf("folder_uuid='%q'", _folder->folder_id);
-
-               len = snprintf(sql, sizeof(sql), UPDATE_SQL, DB_TABLE_FOLDER, set_sql, where_sql);
-               if (len > 0) {
-                       sql[len] = '\0';
-               } else {
-                       media_content_error("snprintf failed");
-                       return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
-               }
+               sql = sqlite3_mprintf("UPDATE %Q SET %s WHERE folder_uuid=%Q", DB_TABLE_FOLDER, set_sql, _folder->folder_id);
 
                ret = _content_query_sql(sql);
 
                sqlite3_free(set_sql);
-               sqlite3_free(where_sql);
+               sqlite3_free(sql);
+               if (ret != MEDIA_CONTENT_ERROR_NONE)
+                       return ret;
 
                /* Do folder rename operation using libmedia-service */
                ret = media_svc_rename_folder(_content_get_db_handle(), g_src_path, _folder->path);
@@ -452,15 +424,16 @@ int media_folder_set_name(media_folder_h folder, const char *name)
                        char new_folder_path[MAX_QUERY_SIZE] = {0,};
 
                        folder_path = g_path_get_dirname(_folder->path);
-                       media_content_debug("Existed Folder Path : %s", _folder->path);
+                       media_content_sec_debug("Existed Folder Path : %s", _folder->path);
                        snprintf(new_folder_path, sizeof(new_folder_path), "%s/%s", folder_path, name); 
-                       media_content_debug("New Path : %s", new_folder_path);
+                       media_content_sec_debug("New Path : %s", new_folder_path);
 
                        SAFE_FREE(g_src_path);
                        g_src_path = strdup(_folder->path);
 
                        SAFE_FREE(_folder->path);
                        SAFE_FREE(_folder->name);
+                       SAFE_FREE(folder_path);
                        _folder->path = strdup(new_folder_path);
 
                        if(_folder->path == NULL)
index 3312fbf..cc98ff2 100755 (executable)
@@ -24,8 +24,6 @@ int media_album_get_album_count_from_db(filter_h filter, int *album_count)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
        if(album_count != NULL)
        {
                ret = _media_db_get_group_count(filter, MEDIA_GROUP_ALBUM, album_count);
@@ -43,8 +41,6 @@ int media_album_foreach_album_from_db(filter_h filter, media_album_cb callback,
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
        if(callback == NULL)
        {
                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
@@ -60,8 +56,6 @@ int media_album_get_media_count_from_db(int album_id, filter_h filter, int *medi
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
        if((album_id > 0) && (media_count != NULL))
        {
                ret = _media_db_get_group_item_count_by_id(album_id, filter, MEDIA_GROUP_ALBUM, media_count);
@@ -79,8 +73,6 @@ int media_album_foreach_media_from_db(int album_id, filter_h filter, media_info_
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
        if((album_id > 0) && (callback != NULL))
        {
                ret = _media_db_get_group_item_by_id(album_id, filter, callback, user_data, MEDIA_GROUP_ALBUM);
@@ -100,8 +92,6 @@ int media_album_get_album_from_db(int album_id, media_album_h *album)
        sqlite3_stmt *stmt = NULL;
        char select_query[DEFAULT_QUERY_SIZE];
 
-       media_content_debug_func();
-
        if(album_id < 0)
        {
                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
@@ -118,6 +108,12 @@ int media_album_get_album_from_db(int album_id, media_album_h *album)
        while(sqlite3_step(stmt) == SQLITE_ROW)
        {
                media_album_s *_album = (media_album_s*)calloc(1, sizeof(media_album_s));
+               if(_album == NULL)
+               {
+                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                       SQLITE3_FINALIZE(stmt);
+                       return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+               }
 
                _album->album_id = (int)sqlite3_column_int(stmt, 0);
 
@@ -130,10 +126,7 @@ int media_album_get_album_from_db(int album_id, media_album_h *album)
                *album = (media_album_h)_album;
        }
 
-       if(stmt != NULL)
-       {
-               sqlite3_finalize(stmt);
-       }
+       SQLITE3_FINALIZE(stmt);
 
        return ret;
 }
@@ -143,8 +136,6 @@ int media_album_destroy(media_album_h album)
        int ret = MEDIA_CONTENT_ERROR_NONE;
        media_album_s *_album = (media_album_s*)album;
 
-       media_content_debug_func();
-
        if(_album)
        {
                SAFE_FREE(_album->name);
@@ -345,9 +336,7 @@ int media_group_get_group_count_from_db(filter_h filter, media_group_e group, in
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
-       if((group < MEDIA_CONTENT_GROUP_DISPLAY_NAME) || (group > MEDIA_CONTENT_GROUP_KEYWORD) || (group_count == NULL))
+       if((group < MEDIA_CONTENT_GROUP_DISPLAY_NAME) || (group >= MEDIA_CONTENT_GROUP_MAX) || (group_count == NULL))
        {
                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
                ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
@@ -364,9 +353,7 @@ int media_group_foreach_group_from_db(filter_h filter, media_group_e group, medi
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
-       if((callback == NULL) || (group < MEDIA_CONTENT_GROUP_DISPLAY_NAME) || (group > MEDIA_CONTENT_GROUP_KEYWORD))
+       if((callback == NULL) || (group < MEDIA_CONTENT_GROUP_DISPLAY_NAME) || (group >= MEDIA_CONTENT_GROUP_MAX))
        {
                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
                ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
@@ -383,16 +370,14 @@ int media_group_get_media_count_from_db(const char *group_name, media_group_e gr
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
-       if((media_count == NULL) || (group < MEDIA_CONTENT_GROUP_DISPLAY_NAME) || (group > MEDIA_CONTENT_GROUP_KEYWORD))
+       if((media_count == NULL) || (group < MEDIA_CONTENT_GROUP_DISPLAY_NAME) || (group >= MEDIA_CONTENT_GROUP_MAX))
        {
                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
                ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
        else
        {
-               ret = _media_db_get_media_group_item_count(group_name, group, filter, media_count);
+               ret = _media_db_get_media_group_item_count(group_name, filter, group, media_count);
        }
 
        return ret;
@@ -402,16 +387,14 @@ int media_group_foreach_media_from_db(const char *group_name, media_group_e grou
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
-       if((callback == NULL) || (group < MEDIA_CONTENT_GROUP_DISPLAY_NAME) || (group > MEDIA_CONTENT_GROUP_KEYWORD))
+       if((callback == NULL) || (group < MEDIA_CONTENT_GROUP_DISPLAY_NAME) || (group >= MEDIA_CONTENT_GROUP_MAX))
        {
                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
                ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
        else
        {
-               ret = _media_db_get_media_group_item(group_name, group, filter, callback, user_data);
+               ret = _media_db_get_media_group_item(group_name, filter, group, callback, user_data);
        }
 
        return ret;
index c317654..54f54b7 100755 (executable)
 */
 
 
-#include <media_image.h>
-#include <media_content.h>
 #include <media_info_private.h>
-#include <media-svc.h>
 
 
 int image_meta_destroy(image_meta_h image)
@@ -26,12 +23,13 @@ int image_meta_destroy(image_meta_h image)
        int ret = MEDIA_CONTENT_ERROR_NONE;
        image_meta_s *_image = (image_meta_s*)image;
 
-       media_content_debug_func();
-
        if(_image)
        {
                SAFE_FREE(_image->media_id);
                SAFE_FREE(_image->date_taken);
+               SAFE_FREE(_image->title);
+               SAFE_FREE(_image->weather);
+               SAFE_FREE(_image->burst_id);
                SAFE_FREE(_image);
 
                ret = MEDIA_CONTENT_ERROR_NONE;
@@ -50,8 +48,6 @@ int image_meta_clone(image_meta_h *dst, image_meta_h src)
        int ret = MEDIA_CONTENT_ERROR_NONE;
        image_meta_s *_src = (image_meta_s*)src;
 
-       media_content_debug_func();
-
        if(_src != NULL)
        {
                image_meta_s *_dst = (image_meta_s*)calloc(1, sizeof(image_meta_s));
@@ -70,7 +66,6 @@ int image_meta_clone(image_meta_h *dst, image_meta_h src)
                                image_meta_destroy((image_meta_h)_dst);
                                return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                        }
-                       _dst->media_id = strdup(_src->media_id);
                }
 
                if(STRING_VALID(_src->date_taken))
@@ -82,7 +77,39 @@ int image_meta_clone(image_meta_h *dst, image_meta_h src)
                                image_meta_destroy((image_meta_h)_dst);
                                return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                        }
-                       _dst->date_taken = strdup(_src->date_taken);
+               }
+
+               if(STRING_VALID(_src->title))
+               {
+                       _dst->title = strdup(_src->title);
+                       if(_dst->title == NULL)
+                       {
+                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               image_meta_destroy((image_meta_h)_dst);
+                               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+                       }
+               }
+
+               if(STRING_VALID(_src->weather))
+               {
+                       _dst->weather = strdup(_src->weather);
+                       if(_dst->weather == NULL)
+                       {
+                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               image_meta_destroy((image_meta_h)_dst);
+                               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+                       }
+               }
+
+               if(STRING_VALID(_src->burst_id))
+               {
+                       _dst->burst_id = strdup(_src->burst_id);
+                       if(_dst->burst_id == NULL)
+                       {
+                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               image_meta_destroy((image_meta_h)_dst);
+                               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+                       }
                }
 
                _dst->width = _src->width;
@@ -107,7 +134,7 @@ int image_meta_get_media_id(image_meta_h image, char **media_id)
        int ret = MEDIA_CONTENT_ERROR_NONE;
        image_meta_s *_image = (image_meta_s*)image;
 
-       if(_image)
+       if(_image && media_id)
        {
                if(STRING_VALID(_image->media_id))
                {
@@ -177,7 +204,8 @@ int image_meta_get_orientation(image_meta_h image, media_content_orientation_e*
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
        image_meta_s *_image = (image_meta_s*)image;
-       if(_image)
+
+       if(_image && orientation)
        {
                *orientation = _image->orientation;
                ret = MEDIA_CONTENT_ERROR_NONE;
@@ -196,7 +224,7 @@ int image_meta_get_date_taken(image_meta_h image, char **date_taken)
        int ret = MEDIA_CONTENT_ERROR_NONE;
        image_meta_s *_image = (image_meta_s*)image;
 
-       if(_image)
+       if(_image && date_taken)
        {
                if(STRING_VALID(_image->date_taken))
                {
@@ -224,6 +252,60 @@ int image_meta_get_date_taken(image_meta_h image, char **date_taken)
        return ret;
 }
 
+int image_meta_get_burst_id(image_meta_h image, char **burst_id)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       image_meta_s *_image = (image_meta_s*)image;
+
+       if(_image && burst_id)
+       {
+               if(STRING_VALID(_image->burst_id))
+               {
+                       *burst_id = strdup(_image->burst_id);
+                       if(*burst_id == NULL)
+                       {
+                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+                       }
+               }
+               else
+               {
+                       *burst_id = NULL;
+               }
+               ret = MEDIA_CONTENT_ERROR_NONE;
+       }
+       else
+       {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       return ret;
+}
+
+int image_meta_is_burst_shot(image_meta_h image, bool *is_burst_shot)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       image_meta_s *_image = (image_meta_s*)image;
+
+       if(_image && is_burst_shot)
+       {
+               if(STRING_VALID(_image->burst_id))
+                       *is_burst_shot = true;
+               else
+                       *is_burst_shot = false;
+
+               ret = MEDIA_CONTENT_ERROR_NONE;
+       }
+       else
+       {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       return ret;
+}
+
 int image_meta_set_orientation(image_meta_h image, media_content_orientation_e orientation)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
@@ -254,7 +336,7 @@ int image_meta_update_to_db(image_meta_h image)
 
        if(_image != NULL && STRING_VALID(_image->media_id))
        {
-               sql = sqlite3_mprintf(UPDATE_IMAGE_META_FROM_MEDIA, _image->orientation, _image->media_id);
+               sql = sqlite3_mprintf(UPDATE_IMAGE_META_FROM_MEDIA, _image->orientation, _image->weather, _image->media_id);
                ret = _content_query_sql(sql);
                sqlite3_free(sql);
        }
index cb067dc..a4937e1 100755 (executable)
 * limitations under the License.
 */
 
-
-#include <media_content.h>
+#include <media_info.h>
 #include <media-thumbnail.h>
 #include <media_info_private.h>
 #include <media_util_private.h>
-#include <media-svc.h>
-#include <media-util-register.h>
-#include <media-util-err.h>
-
 
-static int __media_info_get_media_info_from_db(char *path, media_info_h media);
+static void __media_info_insert_completed_cb(media_request_result_s *result, void *user_data);
 static void __media_info_thumbnail_completed_cb(int error, const char *path, void *user_data);
+static bool __media_info_delete_batch_cb(media_info_h media, void *user_data);
+static int __media_info_insert_batch(media_batch_insert_e insert_type, const char **path_array, unsigned int array_length, media_insert_completed_cb completed_cb, void *user_data);
 
-static int __media_info_get_media_info_from_db(char *path, media_info_h media)
+static int __media_info_get_media_path_by_id_from_db(const char *media_id, char **path)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
        sqlite3_stmt *stmt = NULL;
        char *select_query = NULL;
-       media_info_s *_media = (media_info_s*)media;
 
-       if(_media == NULL)
+       if(!STRING_VALID(media_id))
        {
                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
-       select_query = sqlite3_mprintf(SELECT_MEDIA_BY_PATH, path);
+       select_query = sqlite3_mprintf(SELECT_MEDIA_PATH_BY_ID, media_id);
 
        ret = _content_query_prepare(&stmt, select_query, NULL, NULL);
        sqlite3_free(select_query);
@@ -48,23 +44,45 @@ static int __media_info_get_media_info_from_db(char *path, media_info_h media)
 
        if(sqlite3_step(stmt) == SQLITE_ROW)
        {
-               _media_info_item_get_detail(stmt, (media_info_h)_media);
-               media_content_debug("New Media ID: %s", _media->media_id);
+               if(STRING_VALID((const char *)sqlite3_column_text(stmt, 0)))
+                       *path = strdup((const char *)sqlite3_column_text(stmt, 0));
        } else {
-               media_content_debug("There's no media!!");
-       }
-/*
-       while(sqlite3_step(stmt) == SQLITE_ROW)
-       {
-               _media_info_item_get_detail(stmt, (media_info_h)_media);
-               media_content_debug("New Media ID: %s", _media->media_id);
+               media_content_error("There's no media with this ID : %s", media_id);
+               *path = NULL;
+               ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
-*/
+
        SQLITE3_FINALIZE(stmt);
 
        return ret;
 }
 
+static void __media_info_insert_completed_cb(media_request_result_s *result, void *user_data)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       media_insert_cb_s *_cb_data = (media_insert_cb_s *)user_data;
+
+       if (_cb_data) {
+               if (result) {
+                       ret = _content_error_capi(MEDIA_CONTENT_TYPE, result->result);
+               }
+
+               if (_cb_data->insert_completed_cb)
+                       _cb_data->insert_completed_cb(ret, _cb_data->user_data);
+
+               if (STRING_VALID(_cb_data->insert_list_path)) {
+                       if (unlink(_cb_data->insert_list_path) < 0) {
+                               media_content_stderror("failed to delete");
+                       }
+                       SAFE_FREE(_cb_data->insert_list_path);
+               }
+       }
+
+       SAFE_FREE(_cb_data);
+
+       return;
+}
+
 static void __media_info_thumbnail_completed_cb(int error, const char *path, void *user_data)
 {
        int error_value = MEDIA_CONTENT_ERROR_NONE;
@@ -83,7 +101,8 @@ static void __media_info_thumbnail_completed_cb(int error, const char *path, voi
 
                media_content_debug("error [%d], thumbnail_path [%s]", error, path);
                error_value = _content_error_capi(MEDIA_THUMBNAIL_TYPE, error);
-               _thumb_cb->thumbnail_completed_cb(error_value, path, _thumb_cb->user_data);
+               if (_thumb_cb->thumbnail_completed_cb)
+                       _thumb_cb->thumbnail_completed_cb(error_value, path, _thumb_cb->user_data);
        }
 
        SAFE_FREE(_thumb_cb);
@@ -91,71 +110,273 @@ static void __media_info_thumbnail_completed_cb(int error, const char *path, voi
        return;
 }
 
+static bool __media_info_delete_batch_cb(media_info_h media, void *user_data)
+{
+       int err = MEDIA_INFO_ERROR_NONE;
+       char *thumb_path = NULL;
+       media_content_type_e media_type = 0;
+       GArray *thumb_list = (GArray *)user_data;
+
+       if(media == NULL)
+       {
+               media_content_debug("NO Item");
+               return true;
+       }
+
+       err = media_info_get_media_type(media, &media_type);
+       if (err == MEDIA_INFO_ERROR_NONE) {
+               media_content_debug("media_type : [%d]", media_type);
+
+               media_info_get_thumbnail_path(media, &thumb_path);
+               if (STRING_VALID(thumb_path)) {
+                       if (strncmp(MEDIA_CONTENT_THUMB_DEFAULT_PATH, thumb_path, strlen(MEDIA_CONTENT_THUMB_DEFAULT_PATH)) != 0) {
+                               g_array_append_val(thumb_list, thumb_path);
+                       } else {
+                               SAFE_FREE(thumb_path);
+                       }
+               } else {
+                       SAFE_FREE(thumb_path);
+               }
+       } else {
+               media_content_error("media_info_get_media_type failed");
+       }
+
+       return true;
+}
+
+static int __media_info_insert_batch(media_batch_insert_e insert_type, const char **path_array,
+                                       unsigned int array_length,
+                                       media_insert_completed_cb completed_cb,
+                                       void *user_data)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       FILE *fp = NULL;
+       char list_path[255] = {0,};
+       int idx = 0;
+       int nwrites = 0;
+
+       for (idx = 0; idx < BATCH_REQUEST_MAX; idx++) {
+               snprintf(list_path, sizeof(list_path), "%s/request-%ld-%d", MEDIA_CONTENT_INSERT_FILES_PATH, media_content_gettid(), idx);
+
+               if (g_file_test(list_path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
+                       memset(list_path, 0x00, sizeof(list_path));
+                       continue;
+               } else {
+                       media_content_debug("The request file list path : %s", list_path);
+                       break;
+               }
+       }
+
+       if (idx == BATCH_REQUEST_MAX) {
+               media_content_error("Too many batch request for one thread");
+               return MEDIA_CONTENT_ERROR_DB_BUSY;
+       }
+
+       fp = fopen(list_path, "w");
+       if (fp == NULL) {
+               media_content_error("failed to open file : [%s]", list_path);
+               media_content_stderror("failed to open file");
+               return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
+       }
+
+       for (idx = 0; idx < array_length; idx++) {
+               if (STRING_VALID(path_array[idx])) {
+                       int size = strlen(path_array[idx]);
+
+                       ret = _media_util_check_file(path_array[idx]);
+                       if (ret != MEDIA_CONTENT_ERROR_NONE) {
+                               fclose(fp);
+                               if (unlink(list_path) < 0) {
+                                       media_content_stderror("failed to delete");
+                               }
+                               return ret;
+                       }
+
+                       nwrites = fwrite(path_array[idx], 1, size, fp);
+                       if (nwrites != size) {
+                               media_content_stderror("failed to write");
+                               fclose(fp);
+                               if (unlink(list_path) < 0) {
+                                       media_content_stderror("failed to delete");
+                               }
+                               return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
+                       }
+
+                       nwrites = fwrite("\n", 1, 1, fp);
+                       if (nwrites != 1) {
+                               media_content_stderror("failed to write");
+                               fclose(fp);
+                               if (unlink(list_path) < 0) {
+                                       media_content_stderror("failed to delete");
+                               }
+                               return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
+                       }
+               } else {
+                       media_content_error("path[%d] is invalid string", idx);
+               }
+       }
+
+       fclose(fp);
+
+       media_insert_cb_s *_cb_data = (media_insert_cb_s *)calloc(1, sizeof(media_insert_cb_s));
+       if(_cb_data == NULL)
+       {
+               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+       }
+
+       _cb_data->insert_completed_cb = completed_cb;
+       _cb_data->user_data = user_data;
+       _cb_data->insert_list_path = strdup(list_path);
+
+       if(insert_type == MEDIA_BATCH_INSERT_NORMAL)
+               ret = media_files_register(list_path, __media_info_insert_completed_cb, _cb_data);
+       else if(insert_type == MEDIA_BATCH_INSERT_BURSTSHOT)
+               ret = media_burstshot_register(list_path, __media_info_insert_completed_cb, _cb_data);
+       else
+               ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+
+       if (ret != MEDIA_CONTENT_ERROR_NONE) {
+               media_content_error("media_files_register failed : %d", ret);
+               if (unlink(list_path) < 0) {
+                       media_content_stderror("failed to delete");
+               }
+               return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+       }
+
+       return ret;
+}
+
+typedef enum {
+       MEDIA_INFO_UUID = 0,
+       MEDIA_INFO_PATH,
+       MEDIA_INFO_FILE_NAME,
+       MEDIA_INFO_TYPE,
+       MEDIA_INFO_MIME_TYPE,
+       MEDIA_INFO_SIZE,
+       MEDIA_INFO_ADDED_TIME,
+       MEDIA_INFO_MODIFIED_TIME,
+       MEDIA_INFO_THUMBNAIL_PATH,
+       MEDIA_INFO_DESCRIPTION,
+       MEDIA_INFO_RATING,                      //10
+       MEDIA_INFO_FAVOURITE,
+       MEDIA_INFO_AUTHOR,
+       MEDIA_INFO_PROVIDER,
+       MEDIA_INFO_CONTENT_NAME,
+       MEDIA_INFO_CATEGORY,
+       MEDIA_INFO_LOCATION_TAG,
+       MEDIA_INFO_AGE_RATING,
+       MEDIA_INFO_KEYWORD,
+       MEDIA_INFO_IS_DRM,
+       MEDIA_INFO_STORAGE_TYPE,        //20
+       MEDIA_INFO_LONGITUDE,
+       MEDIA_INFO_LATITUDE,
+       MEDIA_INFO_ALTITUDE,
+       MEDIA_INFO_WIDTH,
+       MEDIA_INFO_HEIGHT,
+       MEDIA_INFO_DATETAKEN,
+       MEDIA_INFO_ORIENTATION,
+       MEDIA_INFO_TITLE,
+       MEDIA_INFO_ALBUM,
+       MEDIA_INFO_ARTIST,                      //30
+       MEDIA_INFO_ALBUM_ARTIST,
+       MEDIA_INFO_GENRE,
+       MEDIA_INFO_COMPOSER,
+       MEDIA_INFO_YEAR,
+       MEDIA_INFO_RECORDED_DATE,
+       MEDIA_INFO_COPYRIGHT,
+       MEDIA_INFO_TRACK_NUM,
+       MEDIA_INFO_BITRATE,
+       MEDIA_INFO_BITPERSAMPLE,
+       MEDIA_INFO_DURATION,
+       MEDIA_INFO_PLAYED_COUNT,        //40
+       MEDIA_INFO_LAST_PLAYED_TIME,
+       MEDIA_INFO_LAST_PLAYED_POSITION,
+       MEDIA_INFO_SAMPLERATE,
+       MEDIA_INFO_CHANNEL,
+       MEDIA_INFO_BURST_ID,
+       MEDIA_INFO_TIMELINE,
+       MEDIA_INFO_WEATHER,
+       MEDIA_INFO_SYNC_STATUS,
+       MEDIA_INFO_ITEM_MAX,
+} media_info_item_e;
+
 void _media_info_item_get_detail(sqlite3_stmt* stmt, media_info_h media)
 {
 //#define MEDIA_INFO_ITEM "media_uuid, path, file_name, media_type, mime_type, size, added_time, modified_time, thumbnail_path, description,
-//                                                     rating, favourite, author, provider, content_name, category, location_tag, age_rating, keyword, is_drm, storage_type, longitude, latitude, altitude, width, height, datetaken, orientation, title, album, artist, genre, composer, year, recorded_date, copyright, track_num, bitrate, duration, played_count, last_played_time, last_played_position, samplerate, channel"
+//                                                     rating, favourite, author, provider, content_name, category, location_tag, age_rating, keyword, is_drm, storage_type, longitude, latitude, altitude, width, height, datetaken, orientation, title, album, artist, album_artist, genre, composer, year, recorded_date, copyright, track_num, bitrate, duration, played_count, last_played_time, last_played_position, samplerate, channel, burst_id, timeline, weather"
 
        media_info_s *_media = (media_info_s*)media;
 
-       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 0)))
-               _media->media_id = strdup((const char *)sqlite3_column_text(stmt, 0));
+       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_UUID)))
+               _media->media_id = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_UUID));
+
+       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_PATH)))
+               _media->file_path = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_PATH));
+
+       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_FILE_NAME)))
+               _media->display_name = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_FILE_NAME));
+
+       _media->media_type = (int)sqlite3_column_int(stmt, MEDIA_INFO_TYPE);
+
+       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_MIME_TYPE)))
+               _media->mime_type = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_MIME_TYPE));
+
+       _media->size = (unsigned long long)sqlite3_column_int64(stmt, MEDIA_INFO_SIZE);
 
-       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 1)))
-               _media->file_path = strdup((const char *)sqlite3_column_text(stmt, 1));
+       _media->added_time = (int)sqlite3_column_int(stmt, MEDIA_INFO_ADDED_TIME);
 
-       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 2)))
-               _media->display_name = strdup((const char *)sqlite3_column_text(stmt, 2));
+       _media->modified_time = (int)sqlite3_column_int(stmt, MEDIA_INFO_MODIFIED_TIME);
 
-       _media->media_type = (int)sqlite3_column_int(stmt, 3);
+       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_THUMBNAIL_PATH)))
+               _media->thumbnail_path= strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_THUMBNAIL_PATH));
 
-       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 4)))
-               _media->mime_type = strdup((const char *)sqlite3_column_text(stmt, 4));
+       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_DESCRIPTION)))
+               _media->description = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_DESCRIPTION));
 
-       _media->size = (unsigned long long)sqlite3_column_int64(stmt, 5);
+       _media->rating = (int)sqlite3_column_int(stmt, MEDIA_INFO_RATING);
 
-       _media->added_time = (int)sqlite3_column_int(stmt, 6);
+       _media->favourite = (int)sqlite3_column_int(stmt, MEDIA_INFO_FAVOURITE);
 
-       _media->modified_time = (int)sqlite3_column_int(stmt, 7);
+       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_AUTHOR)))
+               _media->author = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_AUTHOR));
 
-       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 8)))
-               _media->thumbnail_path= strdup((const char *)sqlite3_column_text(stmt, 8));
+       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_PROVIDER)))
+               _media->provider = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_PROVIDER));
 
-       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 9)))
-               _media->description = strdup((const char *)sqlite3_column_text(stmt, 9));
+       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_CONTENT_NAME)))
+               _media->content_name = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_CONTENT_NAME));
 
-       _media->rating = (int)sqlite3_column_int(stmt,10);
+       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_CATEGORY)))
+               _media->category = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_CATEGORY));
 
-       _media->favourite = (int)sqlite3_column_int(stmt, 11);
+       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_LOCATION_TAG)))
+               _media->location_tag = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_LOCATION_TAG));
 
-       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 12)))
-               _media->author = strdup((const char *)sqlite3_column_text(stmt, 12));
+       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_AGE_RATING)))
+               _media->age_rating = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_AGE_RATING));
 
-       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 13)))
-               _media->provider = strdup((const char *)sqlite3_column_text(stmt, 13));
+       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_KEYWORD)))
+               _media->keyword = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_KEYWORD));
 
-       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 14)))
-               _media->content_name = strdup((const char *)sqlite3_column_text(stmt, 14));
+       _media->is_drm = (int)sqlite3_column_int(stmt, MEDIA_INFO_IS_DRM);
 
-       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 15)))
-               _media->category = strdup((const char *)sqlite3_column_text(stmt, 15));
+       _media->storage_type = (int)sqlite3_column_int(stmt, MEDIA_INFO_STORAGE_TYPE);
 
-       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 16)))
-               _media->location_tag = strdup((const char *)sqlite3_column_text(stmt, 16));
+       _media->longitude = (double)sqlite3_column_double(stmt, MEDIA_INFO_LONGITUDE);
+       _media->latitude = (double)sqlite3_column_double(stmt, MEDIA_INFO_LATITUDE);
+       _media->altitude = (double)sqlite3_column_double(stmt, MEDIA_INFO_ALTITUDE);
 
-       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 17)))
-               _media->age_rating = strdup((const char *)sqlite3_column_text(stmt, 17));
+       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_TITLE)))
+               _media->title = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_TITLE));
 
-       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 18)))
-               _media->keyword = strdup((const char *)sqlite3_column_text(stmt, 18));
+       _media->timeline = (double)sqlite3_column_double(stmt, MEDIA_INFO_TIMELINE);
 
-       _media->is_drm = (int)sqlite3_column_int(stmt, 19);
+       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_WEATHER)))
+               _media->weather = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_WEATHER));
 
-       _media->storage_type = (int)sqlite3_column_int(stmt, 20);
+       _media->sync_status = (int)sqlite3_column_int(stmt, MEDIA_INFO_SYNC_STATUS);
 
-       _media->longitude = (double)sqlite3_column_double(stmt, 21);
-       _media->latitude = (double)sqlite3_column_double(stmt, 22);
-       _media->altitude = (double)sqlite3_column_double(stmt, 23);
 
        if(_media->media_type == MEDIA_CONTENT_TYPE_IMAGE) {
                _media->image_meta = (image_meta_s *)calloc(1, sizeof(image_meta_s));
@@ -163,13 +384,22 @@ void _media_info_item_get_detail(sqlite3_stmt* stmt, media_info_h media)
                        if(STRING_VALID(_media->media_id))
                                _media->image_meta->media_id = strdup(_media->media_id);
 
-                       _media->image_meta->width = sqlite3_column_int(stmt, 24);
-                       _media->image_meta->height = sqlite3_column_int(stmt, 25);
+                       _media->image_meta->width = sqlite3_column_int(stmt, MEDIA_INFO_WIDTH);
+                       _media->image_meta->height = sqlite3_column_int(stmt, MEDIA_INFO_HEIGHT);
 
-                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 26)))
-                               _media->image_meta->date_taken = strdup((const char *)sqlite3_column_text(stmt, 26));
-               
-                       _media->image_meta->orientation = sqlite3_column_int(stmt, 27);
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_DATETAKEN)))
+                               _media->image_meta->date_taken = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_DATETAKEN));
+
+                       _media->image_meta->orientation = sqlite3_column_int(stmt, MEDIA_INFO_ORIENTATION);
+
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_TITLE)))
+                               _media->image_meta->title = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_TITLE));
+
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_BURST_ID)))
+                               _media->image_meta->burst_id = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_BURST_ID));
+
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_WEATHER)))
+                               _media->image_meta->weather = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_WEATHER));
                }
 
        } else if(_media->media_type == MEDIA_CONTENT_TYPE_VIDEO) {
@@ -178,40 +408,44 @@ void _media_info_item_get_detail(sqlite3_stmt* stmt, media_info_h media)
                        if(STRING_VALID(_media->media_id))
                                _media->video_meta->media_id = strdup(_media->media_id);
 
-                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 28)))
-                               _media->video_meta->title = strdup((const char *)sqlite3_column_text(stmt, 28));
+                       _media->video_meta->width = sqlite3_column_int(stmt, MEDIA_INFO_WIDTH);
+                       _media->video_meta->height = sqlite3_column_int(stmt, MEDIA_INFO_HEIGHT);
 
-                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 29)))
-                               _media->video_meta->album = strdup((const char *)sqlite3_column_text(stmt, 29));
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_TITLE)))
+                               _media->video_meta->title = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_TITLE));
 
-                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 30)))
-                               _media->video_meta->artist = strdup((const char *)sqlite3_column_text(stmt, 30));
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_ALBUM)))
+                               _media->video_meta->album = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_ALBUM));
 
-                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 31)))
-                               _media->video_meta->genre = strdup((const char *)sqlite3_column_text(stmt, 31));
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_ARTIST)))
+                               _media->video_meta->artist = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_ARTIST));
 
-                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 32)))
-                               _media->video_meta->composer = strdup((const char *)sqlite3_column_text(stmt, 32));
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_ALBUM_ARTIST)))
+                               _media->video_meta->album_artist = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_ALBUM_ARTIST));
 
-                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 33)))
-                               _media->video_meta->year = strdup((const char *)sqlite3_column_text(stmt, 33));
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_GENRE)))
+                               _media->video_meta->genre = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_GENRE));
 
-                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 34)))
-                               _media->video_meta->recorded_date = strdup((const char *)sqlite3_column_text(stmt, 34));
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_COMPOSER)))
+                               _media->video_meta->composer = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_COMPOSER));
 
-                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 35)))
-                               _media->video_meta->copyright = strdup((const char *)sqlite3_column_text(stmt, 35));
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_YEAR)))
+                               _media->video_meta->year = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_YEAR));
 
-                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 36)))
-                               _media->video_meta->track_num = strdup((const char *)sqlite3_column_text(stmt, 36));
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_RECORDED_DATE)))
+                               _media->video_meta->recorded_date = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_RECORDED_DATE));
 
-                       _media->video_meta->bitrate = sqlite3_column_int(stmt, 37);
-                       _media->video_meta->duration = sqlite3_column_int(stmt, 38);
-                       _media->video_meta->played_count = sqlite3_column_int(stmt, 39);
-                       _media->video_meta->played_time = sqlite3_column_int(stmt, 40);
-                       _media->video_meta->played_position = sqlite3_column_int(stmt, 41);
-                       _media->video_meta->width = sqlite3_column_int(stmt, 24);
-                       _media->video_meta->height = sqlite3_column_int(stmt, 25);
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_COPYRIGHT)))
+                               _media->video_meta->copyright = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_COPYRIGHT));
+
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_TRACK_NUM)))
+                               _media->video_meta->track_num = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_TRACK_NUM));
+
+                       _media->video_meta->bitrate = sqlite3_column_int(stmt, MEDIA_INFO_BITRATE);
+                       _media->video_meta->duration = sqlite3_column_int(stmt, MEDIA_INFO_DURATION);
+                       _media->video_meta->played_count = sqlite3_column_int(stmt, MEDIA_INFO_PLAYED_COUNT);
+                       _media->video_meta->played_time = sqlite3_column_int(stmt, MEDIA_INFO_LAST_PLAYED_TIME);
+                       _media->video_meta->played_position = sqlite3_column_int(stmt, MEDIA_INFO_LAST_PLAYED_POSITION);
                }
 
        }
@@ -221,47 +455,84 @@ void _media_info_item_get_detail(sqlite3_stmt* stmt, media_info_h media)
                        if(STRING_VALID(_media->media_id))
                                _media->audio_meta->media_id = strdup(_media->media_id);
 
-                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 28)))
-                               _media->audio_meta->title = strdup((const char *)sqlite3_column_text(stmt, 28));
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_TITLE)))
+                               _media->audio_meta->title = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_TITLE));
+
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_ALBUM)))
+                               _media->audio_meta->album = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_ALBUM));
 
-                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 29)))
-                               _media->audio_meta->album = strdup((const char *)sqlite3_column_text(stmt, 29));
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_ARTIST)))
+                               _media->audio_meta->artist = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_ARTIST));
 
-                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 30)))
-                               _media->audio_meta->artist = strdup((const char *)sqlite3_column_text(stmt, 30));
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_ALBUM_ARTIST)))
+                               _media->audio_meta->album_artist = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_ALBUM_ARTIST));
 
-                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 31)))
-                               _media->audio_meta->genre = strdup((const char *)sqlite3_column_text(stmt, 31));
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_GENRE)))
+                               _media->audio_meta->genre = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_GENRE));
 
-                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 32)))
-                               _media->audio_meta->composer = strdup((const char *)sqlite3_column_text(stmt, 32));
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_COMPOSER)))
+                               _media->audio_meta->composer = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_COMPOSER));
 
-                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 33)))
-                               _media->audio_meta->year = strdup((const char *)sqlite3_column_text(stmt, 33));
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_YEAR)))
+                               _media->audio_meta->year = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_YEAR));
 
-                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 34)))
-                               _media->audio_meta->recorded_date = strdup((const char *)sqlite3_column_text(stmt, 34));
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_RECORDED_DATE)))
+                               _media->audio_meta->recorded_date = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_RECORDED_DATE));
 
-                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 35)))
-                               _media->audio_meta->copyright = strdup((const char *)sqlite3_column_text(stmt, 35));
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_COPYRIGHT)))
+                               _media->audio_meta->copyright = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_COPYRIGHT));
 
-                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 36)))
-                               _media->audio_meta->track_num = strdup((const char *)sqlite3_column_text(stmt, 36));
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_INFO_TRACK_NUM)))
+                               _media->audio_meta->track_num = strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_TRACK_NUM));
 
-                       _media->audio_meta->bitrate = sqlite3_column_int(stmt, 37);
-                       _media->audio_meta->duration = sqlite3_column_int(stmt, 38);
-                       _media->audio_meta->played_count = sqlite3_column_int(stmt, 39);
-                       _media->audio_meta->played_time = sqlite3_column_int(stmt, 40);
-                       _media->audio_meta->played_position = sqlite3_column_int(stmt, 41);
-                       _media->audio_meta->samplerate = sqlite3_column_int(stmt, 42);
-                       _media->audio_meta->channel = sqlite3_column_int(stmt, 43);
+                       _media->audio_meta->bitrate = sqlite3_column_int(stmt, MEDIA_INFO_BITRATE);
+                       _media->audio_meta->bitpersample = sqlite3_column_int(stmt, MEDIA_INFO_BITPERSAMPLE);
+                       _media->audio_meta->duration = sqlite3_column_int(stmt, MEDIA_INFO_DURATION);
+                       _media->audio_meta->played_count = sqlite3_column_int(stmt, MEDIA_INFO_PLAYED_COUNT);
+                       _media->audio_meta->played_time = sqlite3_column_int(stmt, MEDIA_INFO_LAST_PLAYED_TIME);
+                       _media->audio_meta->played_position = sqlite3_column_int(stmt, MEDIA_INFO_LAST_PLAYED_POSITION);
+                       _media->audio_meta->samplerate = sqlite3_column_int(stmt, MEDIA_INFO_SAMPLERATE);
+                       _media->audio_meta->channel = sqlite3_column_int(stmt, MEDIA_INFO_CHANNEL);
                }
+       }
+}
+
+int _media_info_get_media_info_from_db(const char *path, media_info_h media)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       sqlite3_stmt *stmt = NULL;
+       char *select_query = NULL;
+       media_info_s *_media = (media_info_s*)media;
 
+       if(_media == NULL)
+       {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
+
+       select_query = sqlite3_mprintf(SELECT_MEDIA_BY_PATH, path);
+
+       ret = _content_query_prepare(&stmt, select_query, NULL, NULL);
+       sqlite3_free(select_query);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       if(sqlite3_step(stmt) == SQLITE_ROW)
+       {
+               _media_info_item_get_detail(stmt, (media_info_h)_media);
+       } else {
+               media_content_error("There's no media!!");
+               ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       SQLITE3_FINALIZE(stmt);
+
+       return ret;
 }
 
-int media_info_insert_to_db (const char *path, media_info_h *info)
+int media_info_insert_to_db(const char *path, media_info_h *info)
 {
+       bool ignore_dir = FALSE;
+       char *folder_path = NULL;
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
        if(!STRING_VALID(path))
@@ -276,12 +547,48 @@ int media_info_insert_to_db (const char *path, media_info_h *info)
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
-       media_content_debug("Register: %s", path);
-       ret = media_file_register(path);
-       if(ret != MS_MEDIA_ERR_NONE)
-       {
-               media_content_error("media_file_register failed");
-               return _content_error_capi(MEDIA_REGISTER_TYPE, ret);
+       ret = _media_util_check_file(path);
+       if (ret != MEDIA_CONTENT_ERROR_NONE) {
+               return ret;
+       }
+
+       folder_path = g_path_get_dirname(path);
+       ret = _media_util_check_ignore_dir(folder_path, &ignore_dir);
+       SAFE_FREE(folder_path);
+
+       if(ignore_dir) {
+               media_content_error("Invalid folder path");
+               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       ret = media_svc_check_item_exist_by_path(_content_get_db_handle(), path);
+       if (ret == MEDIA_INFO_ERROR_DATABASE_NO_RECORD) {
+               media_content_sec_debug("media_svc_check_item_exist_by_path : no record : %s", path);
+
+               media_svc_storage_type_e storage_type = 0;
+
+               ret = media_svc_get_storage_type(path, &storage_type);
+               if(ret != MEDIA_INFO_ERROR_NONE)
+               {
+                       media_content_sec_error("media_svc_get_storage_type failed : %d", ret);
+                       return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+               }
+
+               ret = media_svc_insert_item_immediately(_content_get_db_handle(), storage_type, path);
+
+               if(ret != MEDIA_INFO_ERROR_NONE) {
+                       if (ret == MEDIA_INFO_ERROR_DATABASE_CONSTRAINT) {
+                               media_content_sec_error("This item is already inserted. This may be normal operation because other process already did this (%s)", path);
+                               ret = MEDIA_INFO_ERROR_NONE;
+                       } else {
+                               media_content_sec_error("media_svc_insert_item_immediately failed : %d (%s)", ret, path);
+                       }
+
+                       return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+               }
+       } else if (ret != MEDIA_INFO_ERROR_NONE) {
+               media_content_sec_error("media_svc_check_item_exist_by_path failed : %d (%s)", ret, path);
+               return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
        }
 
        media_info_s *_media = (media_info_s*)calloc(1, sizeof(media_info_s));
@@ -291,37 +598,176 @@ int media_info_insert_to_db (const char *path, media_info_h *info)
                return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
        }
 
-       _media->file_path = strdup(path);
-       if(_media->file_path == NULL)
+       ret = _media_info_get_media_info_from_db(path, (media_info_h)_media);
+
+       *info = (media_info_h)_media;
+       return ret;
+}
+
+int media_info_insert_batch_to_db(
+                                       const char **path_array,
+                                       unsigned int array_length,
+                                       media_insert_completed_cb completed_cb,
+                                       void *user_data)
+{
+       if (path_array == NULL)
        {
-               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
-               SAFE_FREE(_media);
-               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
-       ret = __media_info_get_media_info_from_db(_media->file_path, (media_info_h)_media);
+       if (array_length <= 0)
+       {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
 
-       *info = (media_info_h)_media;
+       return __media_info_insert_batch(MEDIA_BATCH_INSERT_NORMAL, path_array, array_length, completed_cb, user_data);
+}
 
-       return ret;
+int media_info_insert_burst_shot_to_db(const char **path_array, unsigned int array_length, media_insert_burst_shot_completed_cb callback, void *user_data)
+{
+       if (path_array == NULL)
+       {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (array_length <= 0)
+       {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       return __media_info_insert_batch(MEDIA_BATCH_INSERT_BURSTSHOT, path_array, array_length, callback, user_data);
 }
 
 int media_info_delete_from_db(const char *media_id)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
+       char *path = NULL;
+
+       if(!STRING_VALID(media_id))
+       {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       ret = __media_info_get_media_path_by_id_from_db(media_id, &path);
+       if(ret != MEDIA_CONTENT_ERROR_NONE) {
+               media_content_error("__media_info_get_media_path_by_id_from_db failed : %d", ret);
+               SAFE_FREE(path);
+               return ret;
+       }
+
+       ret = media_svc_delete_item_by_path(_content_get_db_handle(), path);
+       SAFE_FREE(path);
+
+       return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+}
+
+static int __media_info_delete_thumb_from_list(GArray *thumb_list)
+{
+       int i = 0;
+       int list_len = 0;
+       char *thumb_path = NULL;
+
+       if (thumb_list != NULL) {
+
+               list_len = thumb_list->len;
+
+               for (i = 0; i < list_len; i ++) {
+                       thumb_path = g_array_index(thumb_list, char*, i);
+                       media_content_debug("thumb path [%s]", thumb_path);
+                       if (unlink(thumb_path) < 0) {
+                               media_content_stderror("failed to delete");
+                       }
+               }
+       }
+       return MEDIA_CONTENT_ERROR_NONE;
+}
+
+static int __media_info_release_thumb_list(GArray *thumb_list)
+{
+       int i = 0;
+       int list_len = 0;
+       char *thumb_path = NULL;
+
+       if (thumb_list != NULL) {
+
+               list_len = thumb_list->len;
+
+               for (i = 0; i < list_len; i ++) {
+                       thumb_path = g_array_index(thumb_list, char*, 0);
+                       g_array_remove_index(thumb_list,0);
+                       SAFE_FREE(thumb_path);
+               }
+
+               g_array_free(thumb_list, FALSE);
+       }
+
+       return MEDIA_CONTENT_ERROR_NONE;
+}
+
+int media_info_delete_batch_from_db(filter_h filter)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
 
        char *query_string = NULL;
+       filter_s *_filter = NULL;
+       attribute_h attr;
+       char *condition_query = NULL;
+       GArray *thumb_list = NULL;
 
-       if(!STRING_VALID(media_id))
+       if(filter == NULL)
        {
                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
-       query_string = sqlite3_mprintf(DELETE_MEDIA_FROM_MEDIA, media_id);
+       thumb_list = g_array_new(FALSE, FALSE, sizeof(char*));
+
+       /* Delete thumbnail of each item */
+       ret = _media_db_get_group_item(NULL, filter, __media_info_delete_batch_cb, thumb_list, MEDIA_GROUP_NONE);
+
+       _filter = (filter_s*)filter;
+       attr = _content_get_attirbute_handle();
+
+       if(_filter->condition)
+       {
+               ret = _media_filter_attribute_generate(attr, _filter->condition, _filter->condition_collate_type, &condition_query);
+               if (ret != MEDIA_CONTENT_ERROR_NONE) {
+                       __media_info_release_thumb_list(thumb_list);
+                       return ret;
+               }
+       }
+
+       if(STRING_VALID(condition_query))
+       {
+               query_string = sqlite3_mprintf(DELETE_MEDIA_FROM_MEDIA_BATCH, condition_query);
+       }
+       else
+       {
+               SAFE_FREE(condition_query);
+               __media_info_release_thumb_list(thumb_list);
+
+               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
 
        ret = _content_query_sql(query_string);
+       if (ret == MEDIA_CONTENT_ERROR_NONE) {
+               /*  Send notification for this
+                       In this case, send noti for internal storage and external storage
+               */
+               media_content_debug("Batch deletion is successfull. Send notification for this");
+               media_svc_publish_noti(_content_get_db_handle(), MS_MEDIA_ITEM_DIRECTORY, MS_MEDIA_ITEM_UPDATE, MEDIA_ROOT_PATH_INTERNAL, -1, NULL, NULL);
+               media_svc_publish_noti(_content_get_db_handle(), MS_MEDIA_ITEM_DIRECTORY, MS_MEDIA_ITEM_UPDATE, MEDIA_ROOT_PATH_SDCARD, -1, NULL, NULL);
 
+               __media_info_delete_thumb_from_list(thumb_list);
+               __media_info_release_thumb_list(thumb_list);
+       }
+
+       SAFE_FREE(condition_query);
        sqlite3_free(query_string);
 
        return ret;
@@ -347,10 +793,15 @@ int media_info_destroy(media_info_h media)
                SAFE_FREE(_media->location_tag);
                SAFE_FREE(_media->age_rating);
                SAFE_FREE(_media->keyword);
+               SAFE_FREE(_media->title);
+               SAFE_FREE(_media->weather);
 
                if(_media->image_meta) {
                        SAFE_FREE(_media->image_meta->media_id);
                        SAFE_FREE(_media->image_meta->date_taken);
+                       SAFE_FREE(_media->image_meta->burst_id);
+                       SAFE_FREE(_media->image_meta->title);
+                       SAFE_FREE(_media->image_meta->weather);
 
                        SAFE_FREE(_media->image_meta);
                } else if(_media->video_meta) {
@@ -358,6 +809,7 @@ int media_info_destroy(media_info_h media)
                        SAFE_FREE(_media->video_meta->title);
                        SAFE_FREE(_media->video_meta->album);
                        SAFE_FREE(_media->video_meta->artist);
+                       SAFE_FREE(_media->video_meta->album_artist);
                        SAFE_FREE(_media->video_meta->genre);
                        SAFE_FREE(_media->video_meta->composer);
                        SAFE_FREE(_media->video_meta->year);
@@ -371,6 +823,7 @@ int media_info_destroy(media_info_h media)
                        SAFE_FREE(_media->audio_meta->title);
                        SAFE_FREE(_media->audio_meta->album);
                        SAFE_FREE(_media->audio_meta->artist);
+                       SAFE_FREE(_media->audio_meta->album_artist);
                        SAFE_FREE(_media->audio_meta->genre);
                        SAFE_FREE(_media->audio_meta->composer);
                        SAFE_FREE(_media->audio_meta->year);
@@ -470,6 +923,28 @@ int media_info_clone(media_info_h *dst, media_info_h src)
                                return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                        }
                }
+
+               if(STRING_VALID(_src->weather))
+               {
+                       _dst->weather = strdup(_src->weather);
+                       if(_dst->weather == NULL)
+                       {
+                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               media_info_destroy((media_info_h)_dst);
+                               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+                       }
+               }
+
+               if(STRING_VALID(_src->title))
+               {
+                       _dst->title = strdup(_src->title);
+                       if(_dst->title == NULL)
+                       {
+                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               media_info_destroy((media_info_h)_dst);
+                               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+                       }
+               }
                if(STRING_VALID(_src->author))
                {
                        _dst->author = strdup(_src->author);
@@ -545,12 +1020,15 @@ int media_info_clone(media_info_h *dst, media_info_h src)
                _dst->size = _src->size;
                _dst->added_time = _src->added_time;
                _dst->modified_time = _src->modified_time;
+               _dst->timeline = _src->timeline;
                _dst->longitude = _src->longitude;
                _dst->latitude = _src->latitude;
                _dst->altitude = _src->altitude;
                _dst->rating = _src->rating;
                _dst->favourite = _src->favourite;
                _dst->is_drm = _src->is_drm;
+               _dst->storage_type = _src->storage_type;
+               _dst->sync_status = _src->sync_status;
 
                if(_src->media_type == MEDIA_CONTENT_TYPE_IMAGE && _src->image_meta) {
                        _dst->image_meta = (image_meta_s *)calloc(1, sizeof(image_meta_s));
@@ -571,6 +1049,7 @@ int media_info_clone(media_info_h *dst, media_info_h src)
                                        return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                                }
                        }
+
                        if(STRING_VALID(_src->image_meta->date_taken))
                        {
                                _dst->image_meta->date_taken = strdup(_src->image_meta->date_taken);
@@ -582,6 +1061,28 @@ int media_info_clone(media_info_h *dst, media_info_h src)
                                }
                        }
 
+                       if(STRING_VALID(_src->image_meta->burst_id))
+                       {
+                               _dst->image_meta->burst_id = strdup(_src->image_meta->burst_id);
+                               if(_dst->image_meta->burst_id == NULL)
+                               {
+                                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                                       media_info_destroy((media_info_h)_dst);
+                                       return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+                               }
+                       }
+
+                       if(STRING_VALID(_src->image_meta->weather))
+                       {
+                               _dst->image_meta->weather = strdup(_src->image_meta->weather);
+                               if(_dst->image_meta->weather == NULL)
+                               {
+                                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                                       media_info_destroy((media_info_h)_dst);
+                                       return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+                               }
+                       }
+
                        _dst->image_meta->width = _src->image_meta->width;
                        _dst->image_meta->height = _src->image_meta->height;
                        _dst->image_meta->orientation = _src->image_meta->orientation;
@@ -635,6 +1136,16 @@ int media_info_clone(media_info_h *dst, media_info_h src)
                                        return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                                }
                        }
+                       if(STRING_VALID(_src->video_meta->album_artist))
+                       {
+                               _dst->video_meta->album_artist = strdup(_src->video_meta->album_artist);
+                               if(_dst->video_meta->album_artist == NULL)
+                               {
+                                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                                       media_info_destroy((media_info_h)_dst);
+                                       return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+                               }
+                       }
                        if(STRING_VALID(_src->video_meta->genre))
                        {
                                _dst->video_meta->genre = strdup(_src->video_meta->genre);
@@ -688,7 +1199,7 @@ int media_info_clone(media_info_h *dst, media_info_h src)
                        if(STRING_VALID(_src->video_meta->track_num))
                        {
                                _dst->video_meta->track_num = strdup(_src->video_meta->track_num);
-                               if(_dst->video_meta->year == NULL)
+                               if(_dst->video_meta->track_num == NULL)
                                {
                                        media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
                                        media_info_destroy((media_info_h)_dst);
@@ -753,6 +1264,16 @@ int media_info_clone(media_info_h *dst, media_info_h src)
                                        return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                                }
                        }
+                       if(STRING_VALID(_src->audio_meta->album_artist))
+                       {
+                               _dst->audio_meta->album_artist = strdup(_src->audio_meta->album_artist);
+                               if(_dst->audio_meta->album_artist == NULL)
+                               {
+                                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                                       media_info_destroy((media_info_h)_dst);
+                                       return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+                               }
+                       }
                        if(STRING_VALID(_src->audio_meta->genre))
                        {
                                _dst->audio_meta->genre = strdup(_src->audio_meta->genre);
@@ -806,7 +1327,7 @@ int media_info_clone(media_info_h *dst, media_info_h src)
                        if(STRING_VALID(_src->audio_meta->track_num))
                        {
                                _dst->audio_meta->track_num = strdup(_src->audio_meta->track_num);
-                               if(_dst->audio_meta->year == NULL)
+                               if(_dst->audio_meta->track_num == NULL)
                                {
                                        media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
                                        media_info_destroy((media_info_h)_dst);
@@ -818,6 +1339,7 @@ int media_info_clone(media_info_h *dst, media_info_h src)
                        _dst->audio_meta->samplerate = _src->audio_meta->samplerate;
                        _dst->audio_meta->duration = _src->audio_meta->duration;
                        _dst->audio_meta->bitrate = _src->audio_meta->bitrate;
+                       _dst->audio_meta->bitpersample = _src->audio_meta->bitpersample;
                        _dst->audio_meta->played_count = _src->audio_meta->played_count;
                        _dst->audio_meta->played_time = _src->audio_meta->played_time;
                        _dst->audio_meta->played_position = _src->audio_meta->played_position;
@@ -840,8 +1362,6 @@ int media_info_get_media_count_from_db(filter_h filter, int *media_count)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
        if(media_count == NULL)
        {
                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
@@ -859,8 +1379,6 @@ int media_info_foreach_media_from_db(filter_h filter, media_info_cb callback, vo
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
        if(callback == NULL)
        {
                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
@@ -876,8 +1394,6 @@ int media_info_get_tag_count_from_db(const char *media_id, filter_h filter, int
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
        if(STRING_VALID(media_id) && tag_count)
        {
                ret = _media_db_get_group_item_count(media_id, filter, MEDIA_GROUP_TAG_BY_MEDIA_ID, tag_count);
@@ -895,8 +1411,6 @@ int media_info_foreach_tag_from_db(const char *media_id, filter_h filter, media_
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
        if((callback != NULL) && STRING_VALID(media_id))
        {
                ret = _media_db_get_tag(media_id, filter, callback, user_data);
@@ -914,8 +1428,6 @@ int media_info_get_bookmark_count_from_db(const char *media_id, filter_h filter,
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
        if(STRING_VALID(media_id) && bookmark_count)
        {
                ret = _media_db_get_group_item_count(media_id, filter, MEDIA_GROUP_BOOKMARK_BY_MEDIA_ID, bookmark_count);
@@ -933,8 +1445,6 @@ int media_info_foreach_bookmark_from_db (const char *media_id, filter_h filter,
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
        if((callback != NULL) && STRING_VALID(media_id))
        {
                ret = _media_db_get_bookmark(media_id, filter, callback, user_data);
@@ -953,7 +1463,6 @@ int media_info_get_image(media_info_h media, image_meta_h *image)
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
        media_info_s *_media = (media_info_s*)media;
-       media_content_debug_func();
 
        if(_media == NULL)
        {
@@ -993,6 +1502,18 @@ int media_info_get_image(media_info_h media, image_meta_h *image)
                _image->date_taken = strdup(_media->image_meta->date_taken);
        }
 
+       if(STRING_VALID(_media->image_meta->title)) {
+               _image->title = strdup(_media->image_meta->title);
+       }
+
+       if(STRING_VALID(_media->image_meta->burst_id)) {
+               _image->burst_id = strdup(_media->image_meta->burst_id);
+       }
+
+       if(STRING_VALID(_media->image_meta->weather)) {
+               _image->weather = strdup(_media->image_meta->weather);
+       }
+
        *image = (image_meta_h)_image;
 
        return ret;
@@ -1003,7 +1524,6 @@ int media_info_get_video(media_info_h media, video_meta_h *video)
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
        media_info_s *_media = (media_info_s*)media;
-       media_content_debug_func();
 
        if(_media == NULL)
        {
@@ -1044,6 +1564,9 @@ int media_info_get_video(media_info_h media, video_meta_h *video)
        if(STRING_VALID(_media->video_meta->artist)) {
                _video->artist = strdup(_media->video_meta->artist);
        }
+       if(STRING_VALID(_media->video_meta->album_artist)) {
+               _video->album_artist = strdup(_media->video_meta->album_artist);
+       }
        if(STRING_VALID(_media->video_meta->genre)) {
                _video->genre = strdup(_media->video_meta->genre);
        }
@@ -1081,7 +1604,6 @@ int media_info_get_audio(media_info_h media, audio_meta_h *audio)
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
        media_info_s *_media = (media_info_s*)media;
-       media_content_debug_func();
 
        if(_media == NULL)
        {
@@ -1122,6 +1644,9 @@ int media_info_get_audio(media_info_h media, audio_meta_h *audio)
        if(STRING_VALID(_media->audio_meta->artist)) {
                _audio->artist = strdup(_media->audio_meta->artist);
        }
+       if(STRING_VALID(_media->audio_meta->album_artist)) {
+               _audio->album_artist = strdup(_media->audio_meta->album_artist);
+       }
        if(STRING_VALID(_media->audio_meta->genre)) {
                _audio->genre = strdup(_media->audio_meta->genre);
        }
@@ -1143,6 +1668,7 @@ int media_info_get_audio(media_info_h media, audio_meta_h *audio)
 
        _audio->duration = _media->audio_meta->duration;
        _audio->bitrate = _media->audio_meta->bitrate;
+       _audio->bitpersample = _media->audio_meta->bitpersample;
        _audio->samplerate = _media->audio_meta->samplerate;
        _audio->channel = _media->audio_meta->channel;
        _audio->played_time = _media->audio_meta->played_time;
@@ -1352,6 +1878,24 @@ int media_info_get_modified_time(media_info_h media, time_t* time)
        return ret;
 }
 
+int media_info_get_timeline(media_info_h media, time_t* time)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       media_info_s *_media = (media_info_s*)media;
+       if(_media && time)
+       {
+               *time = _media->timeline;
+               ret = MEDIA_CONTENT_ERROR_NONE;
+       }
+       else
+       {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       return ret;
+}
+
 int media_info_get_thumbnail_path(media_info_h media, char **path)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
@@ -1383,6 +1927,37 @@ int media_info_get_thumbnail_path(media_info_h media, char **path)
        return ret;
 }
 
+int media_info_get_title(media_info_h media, char **title)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       media_info_s *_media = (media_info_s*)media;
+
+       if(_media && title)
+       {
+               if(STRING_VALID(_media->title))
+               {
+                       *title = strdup(_media->title);
+                       if(*title == NULL)
+                       {
+                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+                       }
+               }
+               else
+               {
+                       *title = NULL;
+               }
+               ret = MEDIA_CONTENT_ERROR_NONE;
+       }
+       else
+       {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       return ret;
+}
+
 int media_info_get_description(media_info_h media, char **description)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
@@ -1470,6 +2045,37 @@ int media_info_get_altitude(media_info_h media, double *altitude)
        return ret;
 }
 
+int media_info_get_weather(media_info_h media, char **weather)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       media_info_s *_media = (media_info_s*)media;
+
+       if(_media && weather)
+       {
+               if(STRING_VALID(_media->weather))
+               {
+                       *weather = strdup(_media->weather);
+                       if(*weather == NULL)
+                       {
+                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+                       }
+               }
+               else
+               {
+                       *weather = NULL;
+               }
+               ret = MEDIA_CONTENT_ERROR_NONE;
+       }
+       else
+       {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       return ret;
+}
+
 int media_info_get_rating(media_info_h media, int *rating)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
@@ -1915,6 +2521,39 @@ int media_info_set_altitude(media_info_h media, double altitude)
        return ret;
 }
 
+int media_info_set_weather(media_info_h media, const char *weather)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       media_info_s *_media = (media_info_s*)media;
+
+       if(_media != NULL)
+       {
+               SAFE_FREE(_media->weather);
+
+               if(STRING_VALID(weather))
+               {
+                       _media->weather = strdup(weather);
+
+                       if(_media->weather == NULL)
+                       {
+                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+                       }
+               }
+               else
+               {
+                       _media->weather = NULL;
+               }
+       }
+       else
+       {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       return ret;
+}
+
 int media_info_set_rating(media_info_h media, int rating)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
@@ -1959,7 +2598,14 @@ int media_info_set_favorite(media_info_h media, bool favorite)
 
        if(_media != NULL)
        {
-               _media->favourite = favorite;
+               if(favorite == TRUE)
+               {
+                       time(&_media->favourite);
+               }
+               else
+               {
+                       _media->favourite = 0;
+               }
        }
        else
        {
@@ -2195,29 +2841,84 @@ int media_info_set_keyword(media_info_h media, const char *keyword)
 int media_info_update_to_db(media_info_h media)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       int len = 0;
        media_info_s *_media = (media_info_s*)media;
        char *set_sql = NULL;
-       char sql[MAX_QUERY_SIZE];
-       memset(sql, '\0', sizeof(sql));
+       char *sql = NULL;
 
        if(_media != NULL && STRING_VALID(_media->media_id))
        {
+               /* This sql is due to sqlite3_mprintf's wrong operation when using floating point in the text format */
+               /* This code will be removed when sqlite3_mprintf works clearly */
+               char *test_sql = sqlite3_mprintf("%f, %f, %f", _media->longitude, _media->latitude, _media->altitude);
+               sqlite3_free(test_sql);
+
+               /*Update Pinyin If Support Pinyin*/
+               char *file_name_pinyin = NULL;
+               char *description_pinyin = NULL;
+               char *author_pinyin = NULL;
+               char *provider_pinyin = NULL;
+               char *content_name_pinyin = NULL;
+               char *category_pinyin = NULL;
+               char *location_tag_pinyin = NULL;
+               char *age_rating_pinyin = NULL;
+               char *keyword_pinyin = NULL;
+               bool pinyin_support = FALSE;
+
+               /*Update Pinyin If Support Pinyin*/
+               media_svc_check_pinyin_support(&pinyin_support);
+               if(pinyin_support)
+               {
+                       if(STRING_VALID(_media->display_name))
+                               media_svc_get_pinyin(_content_get_db_handle(), _media->display_name, &file_name_pinyin);
+                       if(STRING_VALID(_media->description))
+                               media_svc_get_pinyin(_content_get_db_handle(), _media->description, &description_pinyin);
+                       if(STRING_VALID(_media->author))
+                               media_svc_get_pinyin(_content_get_db_handle(), _media->author, &author_pinyin);
+                       if(STRING_VALID(_media->provider))
+                               media_svc_get_pinyin(_content_get_db_handle(), _media->provider, &provider_pinyin);
+                       if(STRING_VALID(_media->content_name))
+                               media_svc_get_pinyin(_content_get_db_handle(), _media->content_name, &content_name_pinyin);
+                       if(STRING_VALID(_media->category))
+                               media_svc_get_pinyin(_content_get_db_handle(), _media->category, &category_pinyin);
+                       if(STRING_VALID(_media->location_tag))
+                               media_svc_get_pinyin(_content_get_db_handle(), _media->location_tag, &location_tag_pinyin);
+                       if(STRING_VALID(_media->age_rating))
+                               media_svc_get_pinyin(_content_get_db_handle(), _media->age_rating, &age_rating_pinyin);
+                       if(STRING_VALID(_media->keyword))
+                               media_svc_get_pinyin(_content_get_db_handle(), _media->keyword, &keyword_pinyin);
+               }
+
                set_sql = sqlite3_mprintf("file_name=%Q, added_time=%d, description=%Q, longitude=%f, latitude=%f, altitude=%f, \
-                       rating=%d, favourite=%d, author=%Q, provider=%Q, content_name=%Q, category=%Q, location_tag=%Q, age_rating=%Q, keyword=%Q",
+                       rating=%d, favourite=%d, author=%Q, provider=%Q, content_name=%Q, category=%Q, location_tag=%Q, age_rating=%Q, keyword=%Q, weather=%Q, sync_status=%d, \
+                       file_name_pinyin=%Q, description_pinyin=%Q, author_pinyin=%Q, provider_pinyin=%Q, content_name_pinyin=%Q, category_pinyin=%Q, location_tag_pinyin=%Q, age_rating_pinyin=%Q, keyword_pinyin=%Q",
                        _media->display_name, _media->added_time, _media->description, _media->longitude, _media->latitude, _media->altitude, _media->rating, _media->favourite,
-                       _media->author, _media->provider, _media->content_name, _media->category, _media->location_tag, _media->age_rating, _media->keyword);
+                       _media->author, _media->provider, _media->content_name, _media->category, _media->location_tag, _media->age_rating, _media->keyword, _media->weather, _media->sync_status,
+                       file_name_pinyin, description_pinyin, author_pinyin, provider_pinyin, content_name_pinyin, category_pinyin, location_tag_pinyin, age_rating_pinyin, keyword_pinyin);
 
-               len = snprintf(sql, sizeof(sql), "UPDATE %s SET %s WHERE media_uuid='%s'", DB_TABLE_MEDIA, set_sql, _media->media_id);
-               sqlite3_free(set_sql);
-               if (len > 0) {
-                       sql[len] = '\0';
-               } else {
-                       media_content_error("snprintf failed");
-                       return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
-               }
+               sql = sqlite3_mprintf("UPDATE %Q SET %s WHERE media_uuid=%Q", DB_TABLE_MEDIA, set_sql, _media->media_id);
 
                ret = _content_query_sql(sql);
+               sqlite3_free(set_sql);
+               sqlite3_free(sql);
+
+               SAFE_FREE(description_pinyin);
+               SAFE_FREE(author_pinyin);
+               SAFE_FREE(provider_pinyin);
+               SAFE_FREE(content_name_pinyin);
+               SAFE_FREE(category_pinyin);
+               SAFE_FREE(location_tag_pinyin);
+               SAFE_FREE(age_rating_pinyin);
+               SAFE_FREE(keyword_pinyin);
+
+               if (ret == MEDIA_CONTENT_ERROR_NONE) {
+                       /*  Send notification for this update */
+                       media_content_debug("Update is successfull. Send notification for this");
+                       if (_media->file_path && _media->mime_type) {
+                               media_svc_publish_noti(_content_get_db_handle(), MS_MEDIA_ITEM_FILE, MS_MEDIA_ITEM_UPDATE, _media->file_path, _media->media_type, _media->media_id, _media->mime_type);
+                       } else {
+                               media_content_error("Can't Send Noti : path or mime type is NULL");
+                       }
+               }
        }
        else
        {
@@ -2231,9 +2932,8 @@ int media_info_update_to_db(media_info_h media)
 int media_info_refresh_metadata_to_db(const char *media_id)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       media_info_h media;
+       media_info_h media = NULL;
        char *file_path = NULL;
-       media_content_type_e media_type = 0;
        media_content_storage_e storage_type = 0;
 
        if(!STRING_VALID(media_id))
@@ -2243,9 +2943,6 @@ int media_info_refresh_metadata_to_db(const char *media_id)
        }
 
        ret = media_info_get_media_from_db(media_id, &media);
-       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
-       ret = media_info_get_media_type(media, &media_type);
        if(ret != MEDIA_CONTENT_ERROR_NONE)
        {
                media_info_destroy(media);
@@ -2266,7 +2963,18 @@ int media_info_refresh_metadata_to_db(const char *media_id)
                return ret;
        }
 
-       ret = media_svc_refresh_item(_content_get_db_handle(), storage_type, file_path, media_type);
+       ret = _media_util_check_file(file_path);
+       if (ret != MEDIA_CONTENT_ERROR_NONE) {
+               SAFE_FREE(file_path);
+               media_info_destroy(media);
+               return ret;
+       }
+
+       ret = media_svc_refresh_item(_content_get_db_handle(), storage_type, file_path);
+       if (ret != MEDIA_INFO_ERROR_NONE)
+       {
+               ret = _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+       }
 
        SAFE_FREE(file_path);
        media_info_destroy(media);
@@ -2278,8 +2986,8 @@ int media_info_move_to_db(media_info_h media, const char* dst_path)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       int src_storage_type = 0;
-       int dst_storage_type = 0;
+       media_svc_storage_type_e src_storage_type = 0;
+       media_svc_storage_type_e dst_storage_type = 0;
 
        if(media == NULL || !STRING_VALID(dst_path))
        {
@@ -2289,34 +2997,24 @@ int media_info_move_to_db(media_info_h media, const char* dst_path)
 
        media_info_s *_media = (media_info_s*)media;
 
-       ret = _media_util_get_store_type_by_path(_media->file_path, &src_storage_type);
-       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-       ret = _media_util_get_store_type_by_path(dst_path, &dst_storage_type);
-       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
-       ret = media_svc_move_item(_content_get_db_handle(), src_storage_type, _media->file_path, dst_storage_type, dst_path);
-       return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
-}
-
-int media_info_move_media_to_db(media_info_h media, const char* dst_path)
-{
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-
-       int src_storage_type = 0;
-       int dst_storage_type = 0;
+       ret = _media_util_check_file(dst_path);
+       if (ret != MEDIA_CONTENT_ERROR_NONE) {
+               return ret;
+       }
 
-       if(media == NULL || !STRING_VALID(dst_path))
+       ret = media_svc_get_storage_type(_media->file_path, &src_storage_type);
+       if(ret != MEDIA_INFO_ERROR_NONE)
        {
-               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
-               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+               media_content_sec_error("media_svc_get_storage_type failed : %d", ret);
+               return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
        }
 
-       media_info_s *_media = (media_info_s*)media;
-
-       ret = _media_util_get_store_type_by_path(_media->file_path, &src_storage_type);
-       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-       ret = _media_util_get_store_type_by_path(dst_path, &dst_storage_type);
-       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+       ret = media_svc_get_storage_type(dst_path, &dst_storage_type);
+       if(ret != MEDIA_INFO_ERROR_NONE)
+       {
+               media_content_sec_error("media_svc_get_storage_type failed : %d", ret);
+               return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+       }
 
        ret = media_svc_move_item(_content_get_db_handle(), src_storage_type, _media->file_path, dst_storage_type, dst_path);
        return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
@@ -2330,12 +3028,37 @@ int media_info_create_thumbnail(media_info_h media, media_thumbnail_completed_cb
        if(_media != NULL && STRING_VALID(_media->media_id) && STRING_VALID(_media->file_path))
        {
                media_thumbnail_cb_s *_thumb_cb = (media_thumbnail_cb_s*)calloc(1, sizeof(media_thumbnail_cb_s));
+               if(_thumb_cb == NULL)
+               {
+                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                       return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+               }
+
                _thumb_cb->handle = _media;
                _thumb_cb->user_data = user_data;
                _thumb_cb->thumbnail_completed_cb = callback;
 
                ret = thumbnail_request_from_db_async(_media->file_path, (ThumbFunc)__media_info_thumbnail_completed_cb, (void *)_thumb_cb);
-               _content_error_capi(MEDIA_THUMBNAIL_TYPE, ret);
+               ret = _content_error_capi(MEDIA_THUMBNAIL_TYPE, ret);
+       }
+       else
+       {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       return ret;
+}
+
+int media_info_cancel_thumbnail(media_info_h media)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       media_info_s *_media = (media_info_s*)media;
+
+       if(_media != NULL && STRING_VALID(_media->media_id) && STRING_VALID(_media->file_path))
+       {
+               ret = thumbnail_request_cancel_media(_media->file_path);
+               ret = _content_error_capi(MEDIA_THUMBNAIL_TYPE, ret);
        }
        else
        {
index 39be583..9af2d05 100755 (executable)
 #include <media_info_private.h>
 #include <media_playlist.h>
 
-
-static __thread GList *g_playlist_item_list = NULL;
-
-static void __media_playlist_item_add(media_playlist_item_s *item_s);
-static void __media_playlist_item_release(void);
+static void __media_playlist_item_add(media_playlist_s *playlist, media_playlist_item_s *item_s);
+static void __media_playlist_item_release(media_playlist_s *playlist);
 static int __media_playlist_insert_playlist_record(const char *playlist_name, int *playlist_id);
 static int __media_playlist_insert_item_to_playlist(int playlist_id, const char *media_id);
 static int __media_playlist_remove_item_from_playlist(int playlist_id, int playlist_member_id);
 static int __media_playlist_update_playlist_name(int playlist_id, const char *playlist_name);
+static int __media_playlist_update_thumbnail_path(int playlist_id, const char *path);
 static int __media_playlist_update_play_order(int playlist_id, int playlist_member_id, int play_order);
 
-static void __media_playlist_item_add(media_playlist_item_s *item_s)
+static void __media_playlist_item_add(media_playlist_s *playlist, media_playlist_item_s *item_s)
 {
-       g_playlist_item_list = g_list_append(g_playlist_item_list, item_s);
+       playlist->item_list = g_list_append(playlist->item_list, item_s);
 }
 
-static void __media_playlist_item_release(void)
+static void __media_playlist_item_release(media_playlist_s *playlist)
 {
        int idx = 0;
        int list_cnt = 0;
        media_playlist_item_s *item = NULL;
 
-       list_cnt = g_list_length(g_playlist_item_list);
+       list_cnt = g_list_length(playlist->item_list);
 
        media_content_debug("list_cnt : [%d]", list_cnt);
 
        for(idx = 0; idx < list_cnt; idx++)
        {
-               item = (media_playlist_item_s*)g_list_nth_data(g_playlist_item_list, idx);
+               item = (media_playlist_item_s*)g_list_nth_data(playlist->item_list, idx);
                if(item != NULL)
                {
                        SAFE_FREE(item->media_id);
                        SAFE_FREE(item->playlist_name);
+                       SAFE_FREE(item->thumbnail_path);
                        SAFE_FREE(item);
                }
        }
 
-       g_list_free(g_playlist_item_list);
-       g_playlist_item_list = NULL;
+       g_list_free(playlist->item_list);
+       playlist->item_list = NULL;
 
 }
 
@@ -150,6 +149,19 @@ static int __media_playlist_update_playlist_name(int playlist_id, const char *pl
        return ret;
 }
 
+static int __media_playlist_update_thumbnail_path(int playlist_id, const char *path)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       char *query_str = NULL;
+
+       query_str = sqlite3_mprintf(UPDATE_PLAYLIST_THUMBNAIL_FROM_PLAYLIST, path, playlist_id);
+
+       ret = _content_query_sql(query_str);
+       sqlite3_free(query_str);
+
+       return ret;
+}
+
 static int __media_playlist_update_play_order(int playlist_id, int playlist_member_id, int play_order)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
@@ -175,7 +187,6 @@ int media_playlist_insert_to_db(const char *name, media_playlist_h *playlist)
        }
 
        media_playlist_s *_playlist = (media_playlist_s*)calloc(1, sizeof(media_playlist_s));
-
        if(_playlist == NULL)
        {
                media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
@@ -229,8 +240,6 @@ int media_playlist_get_playlist_count_from_db(filter_h filter, int *playlist_cou
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
        if(playlist_count != NULL)
        {
                ret = _media_db_get_group_count(filter, MEDIA_GROUP_PLAYLIST, playlist_count);
@@ -248,8 +257,6 @@ int media_playlist_foreach_playlist_from_db(filter_h filter, media_playlist_cb c
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
        if(callback == NULL)
        {
                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
@@ -265,8 +272,6 @@ int media_playlist_get_media_count_from_db(int playlist_id, filter_h filter, int
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
        if((playlist_id > 0) && (media_count != NULL))
        {
                ret = _media_db_get_group_item_count_by_id(playlist_id, filter, MEDIA_GROUP_PLAYLIST, media_count);
@@ -284,11 +289,8 @@ int media_playlist_foreach_media_from_db(int playlist_id, filter_h filter, playl
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
        if((playlist_id > 0) && (callback != NULL))
        {
-               //ret = _media_db_get_group_item_by_id(playlist_id, filter, callback, user_data, MEDIA_GROUP_PLAYLIST);
                ret = _media_db_get_playlist_item(playlist_id, filter, callback, user_data);
        }
        else
@@ -305,11 +307,10 @@ int media_playlist_destroy(media_playlist_h playlist)
        int ret = MEDIA_CONTENT_ERROR_NONE;
        media_playlist_s *_playlist = (media_playlist_s*)playlist;
 
-       media_content_debug_func();
-
        if(_playlist)
        {
                SAFE_FREE(_playlist->name);
+               SAFE_FREE(_playlist->thumbnail_path);
                SAFE_FREE(_playlist);
 
                ret = MEDIA_CONTENT_ERROR_NONE;
@@ -328,8 +329,6 @@ int media_playlist_clone(media_playlist_h *dst, media_playlist_h src)
        int ret = MEDIA_CONTENT_ERROR_NONE;
        media_playlist_s *_src = (media_playlist_s*)src;
 
-       media_content_debug_func();
-
        if(_src != NULL)
        {
                media_playlist_s *_dst = (media_playlist_s*)calloc(1, sizeof(media_playlist_s));
@@ -365,7 +364,7 @@ int media_playlist_clone(media_playlist_h *dst, media_playlist_h src)
        return ret;
 }
 
-int media_playlist_get_playlist_from_db(int playlist_id, filter_h filter, media_playlist_h *playlist)
+int media_playlist_get_playlist_from_db(int playlist_id, media_playlist_h *playlist)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
        sqlite3_stmt *stmt = NULL;
@@ -383,10 +382,18 @@ int media_playlist_get_playlist_from_db(int playlist_id, filter_h filter, media_
                while(sqlite3_step(stmt) == SQLITE_ROW)
                {
                        media_playlist_s *_playlist = (media_playlist_s*)calloc(1, sizeof(media_playlist_s));
+                       if(_playlist == NULL)
+                       {
+                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               SQLITE3_FINALIZE(stmt);
+                               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+                       }
 
                        _playlist->playlist_id = (int)sqlite3_column_int(stmt, 0);
                        if(STRING_VALID((const char *)sqlite3_column_text(stmt, 1)))
                                _playlist->name = strdup((const char *)sqlite3_column_text(stmt, 1));
+                       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 3)))
+                               _playlist->thumbnail_path = strdup((const char *)sqlite3_column_text(stmt, 3));
 
                        *playlist = (media_playlist_h)_playlist;
                }
@@ -452,6 +459,37 @@ int media_playlist_get_name(media_playlist_h playlist, char **name)
        return ret;
 }
 
+int media_playlist_get_thumbnail_path(media_playlist_h playlist, char **path)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       media_playlist_s *_playlist = (media_playlist_s*)playlist;
+       if(_playlist)
+       {
+               if(STRING_VALID(_playlist->thumbnail_path))
+               {
+                       *path = strdup(_playlist->thumbnail_path);
+                       if(*path == NULL)
+                       {
+                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+                       }
+               }
+               else
+               {
+                       *path = NULL;
+               }
+
+               ret = MEDIA_CONTENT_ERROR_NONE;
+       }
+       else
+       {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       return ret;
+}
+
 int media_playlist_get_play_order(media_playlist_h playlist, int playlist_member_id, int *play_order)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
@@ -495,11 +533,17 @@ int media_playlist_set_name(media_playlist_h playlist, const char *playlist_name
                SAFE_FREE(_playlist->name);
 
                media_playlist_item_s *item = (media_playlist_item_s*)calloc(1, sizeof(media_playlist_item_s));
+               if(item == NULL)
+               {
+                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                       return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+               }
 
                item->playlist_name = strdup(playlist_name);
                item->function = MEDIA_PLAYLIST_UPDATE_PLAYLIST_NAME;
                if(item->playlist_name == NULL)
                {
+                       SAFE_FREE(item);
                        media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
                        return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                }
@@ -507,11 +551,58 @@ int media_playlist_set_name(media_playlist_h playlist, const char *playlist_name
                _playlist->name = strdup(playlist_name);
                if(_playlist->name == NULL)
                {
+                       SAFE_FREE(item->playlist_name);
+                       SAFE_FREE(item);
+                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                       return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+               }
+
+               __media_playlist_item_add(_playlist, item);
+       }
+       else
+       {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       return ret;
+}
+
+int media_playlist_set_thumbnail_path(media_playlist_h playlist, const char *path)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       media_playlist_s *_playlist = (media_playlist_s*)playlist;
+
+       if(_playlist != NULL && STRING_VALID(path))
+       {
+               SAFE_FREE(_playlist->thumbnail_path);
+
+               media_playlist_item_s *item = (media_playlist_item_s*)calloc(1, sizeof(media_playlist_item_s));
+               if(item == NULL)
+               {
+                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                       return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+               }
+
+               item->thumbnail_path = strdup(path);
+               item->function = MEDIA_PLAYLIST_UPDATE_THUMBNAIL_PATH;
+               if(item->thumbnail_path == NULL)
+               {
+                       SAFE_FREE(item);
+                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                       return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+               }
+
+               _playlist->thumbnail_path = strdup(path);
+               if(_playlist->thumbnail_path == NULL)
+               {
+                       SAFE_FREE(item->thumbnail_path);
+                       SAFE_FREE(item);
                        media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
                        return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                }
 
-               __media_playlist_item_add(item);
+               __media_playlist_item_add(_playlist, item);
        }
        else
        {
@@ -530,12 +621,17 @@ int media_playlist_set_play_order(media_playlist_h playlist, int playlist_member
        if((_playlist != NULL) && (playlist_member_id > 0) && (play_order >= 0))
        {
                media_playlist_item_s *item = (media_playlist_item_s*)calloc(1, sizeof(media_playlist_item_s));
+               if(item == NULL)
+               {
+                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                       return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+               }
 
                item->playlist_member_id = playlist_member_id;
                item->function = MEDIA_PLAYLIST_UPDATE_PLAY_ORDER;
                item->play_order = play_order;
 
-               __media_playlist_item_add(item);
+               __media_playlist_item_add(_playlist, item);
        }
        else
        {
@@ -554,17 +650,23 @@ int media_playlist_add_media(media_playlist_h playlist, const char *media_id)
        if(_playlist != NULL && STRING_VALID(media_id))
        {
                media_playlist_item_s *item = (media_playlist_item_s*)calloc(1, sizeof(media_playlist_item_s));
+               if(item == NULL)
+               {
+                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                       return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+               }
 
                item->media_id = strdup(media_id);
                item->function = MEDIA_PLAYLIST_ADD;
 
                if(item->media_id == NULL)
                {
+                       SAFE_FREE(item);
                        media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
                        return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                }
 
-               __media_playlist_item_add(item);
+               __media_playlist_item_add(_playlist, item);
        }
        else
        {
@@ -584,11 +686,16 @@ int media_playlist_remove_media(media_playlist_h playlist, int playlist_member_i
        if((_playlist != NULL) && (playlist_member_id > 0))
        {
                media_playlist_item_s *item = (media_playlist_item_s*)calloc(1, sizeof(media_playlist_item_s));
+               if(item == NULL)
+               {
+                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                       return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+               }
 
                item->playlist_member_id = playlist_member_id;
                item->function = MEDIA_PLAYLIST_REMOVE;
 
-               __media_playlist_item_add(item);
+               __media_playlist_item_add(_playlist, item);
        }
        else
        {
@@ -613,10 +720,15 @@ int media_playlist_update_to_db(media_playlist_h playlist)
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
-       length = g_list_length(g_playlist_item_list);
+       if(_playlist->item_list != NULL) {
+               length = g_list_length(_playlist->item_list);
+       } else {
+               media_content_error("operation list length is 0");
+               return MEDIA_CONTENT_ERROR_NONE;
+       }
 
        for (idx = 0; idx < length; idx++) {
-               _playlist_item = (media_playlist_item_s*)g_list_nth_data(g_playlist_item_list, idx);
+               _playlist_item = (media_playlist_item_s*)g_list_nth_data(_playlist->item_list, idx);
                if(_playlist_item != NULL) {
                        switch(_playlist_item->function) {
                                case MEDIA_PLAYLIST_ADD:
@@ -637,6 +749,12 @@ int media_playlist_update_to_db(media_playlist_h playlist)
                                }
                                break;
 
+                               case MEDIA_PLAYLIST_UPDATE_THUMBNAIL_PATH:
+                               {
+                                       ret = __media_playlist_update_thumbnail_path(_playlist->playlist_id, _playlist_item->thumbnail_path);
+                               }
+                               break;
+
                                case MEDIA_PLAYLIST_UPDATE_PLAY_ORDER:
                                {
                                        ret = __media_playlist_update_play_order(_playlist->playlist_id, _playlist_item->playlist_member_id, _playlist_item->play_order);
@@ -646,7 +764,7 @@ int media_playlist_update_to_db(media_playlist_h playlist)
                }
        }
 
-       __media_playlist_item_release();
+       __media_playlist_item_release(_playlist);
 
        return ret;
 }
index bec5271..16400d3 100755 (executable)
 */
 
 
-#include <media_content.h>
 #include <media_info_private.h>
 
-
-static __thread GList *g_tag_item_list = NULL;
-
-static void __media_tag_item_add(media_tag_item_s *item_s);
-static void __media_tag_item_release(void);
+static void __media_tag_item_add(media_tag_s *tag_s, media_tag_item_s *item_s);
+static void __media_tag_item_release(media_tag_s *tag_s);
 static int __media_tag_insert_item_to_tag(int tag_id, const char *media_id);
 static int __media_tag_remove_item_from_tag(int tag_id, const char *media_id);
 static int __media_tag_update_tag_name(int tag_id, const char *tag_name);
 static int __media_tag_get_tag_info_from_db(const char *name, media_tag_h tag);
 
-static void __media_tag_item_add(media_tag_item_s *item_s)
+static void __media_tag_item_add(media_tag_s *tag_s, media_tag_item_s *item_s)
 {
-       g_tag_item_list = g_list_append(g_tag_item_list, item_s);
+       tag_s->item_list = g_list_append(tag_s->item_list, item_s);
 }
 
-static void __media_tag_item_release(void)
+static void __media_tag_item_release(media_tag_s *tag_s)
 {
        int idx = 0;
        int list_cnt = 0;
        media_tag_item_s *item = NULL;
 
-       list_cnt = g_list_length(g_tag_item_list);
+       list_cnt = g_list_length(tag_s->item_list);
 
        media_content_debug("list_cnt : [%d]", list_cnt);
 
        for(idx = 0; idx < list_cnt; idx++)
        {
-               item = (media_tag_item_s*)g_list_nth_data(g_tag_item_list, idx);
+               item = (media_tag_item_s*)g_list_nth_data(tag_s->item_list, idx);
                if(item != NULL)
                {
                        SAFE_FREE(item->media_id);
@@ -54,8 +50,8 @@ static void __media_tag_item_release(void)
                }
        }
 
-       g_list_free(g_tag_item_list);
-       g_tag_item_list = NULL;
+       g_list_free(tag_s->item_list);
+       tag_s->item_list = NULL;
 
 }
 
@@ -143,19 +139,19 @@ int media_tag_insert_to_db(const char *tag_name, media_tag_h *tag)
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
-       media_tag_s *_tag = (media_tag_s*)calloc(1, sizeof(media_tag_s));
-       if(_tag == NULL)
-       {
-               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
-               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
-       }
-
        query_str = sqlite3_mprintf(INSERT_TAG_TO_TAG, tag_name);
        ret = _content_query_sql(query_str);
        sqlite3_free(query_str);
 
        if(ret == MEDIA_CONTENT_ERROR_NONE)
        {
+               media_tag_s *_tag = (media_tag_s*)calloc(1, sizeof(media_tag_s));
+               if(_tag == NULL)
+               {
+                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                       return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+               }
+
                ret = __media_tag_get_tag_info_from_db(tag_name, (media_tag_h)_tag);
                *tag = (media_tag_h)_tag;
        }
@@ -187,8 +183,6 @@ int media_tag_get_tag_count_from_db(filter_h filter, int *tag_count)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
        if(tag_count != NULL)
        {
                ret = _media_db_get_group_count(filter, MEDIA_GROUP_TAG, tag_count);
@@ -206,8 +200,6 @@ int media_tag_foreach_tag_from_db (filter_h filter, media_tag_cb callback, void
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
        if(callback == NULL)
        {
                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
@@ -223,8 +215,6 @@ int media_tag_get_media_count_from_db(int tag_id, filter_h filter, int *media_co
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
        if((tag_id > 0) && (media_count != NULL))
        {
                ret = _media_db_get_group_item_count_by_id(tag_id, filter, MEDIA_GROUP_TAG, media_count);
@@ -242,8 +232,6 @@ int media_tag_foreach_media_from_db(int tag_id, filter_h filter, media_info_cb c
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug_func();
-
        if(callback == NULL)
        {
                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
@@ -416,17 +404,23 @@ int media_tag_add_media(media_tag_h tag, const char *media_id)
        if((_tag != NULL) && STRING_VALID(media_id))
        {
                media_tag_item_s *_item = (media_tag_item_s*)calloc(1, sizeof(media_tag_item_s));
+               if(_item == NULL)
+               {
+                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                       return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+               }
 
                _item->media_id = strdup(media_id);
                _item->function = MEDIA_TAG_ADD;
 
                if(_item->media_id == NULL)
                {
+                       SAFE_FREE(_item);
                        media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
                        return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                }
 
-               __media_tag_item_add(_item);
+               __media_tag_item_add(_tag, _item);
        }
        else
        {
@@ -445,17 +439,23 @@ int media_tag_remove_media(media_tag_h tag, const char *media_id)
        if(_tag != NULL && STRING_VALID(media_id))
        {
                media_tag_item_s *_item = (media_tag_item_s*)calloc(1, sizeof(media_tag_item_s));
+               if(_item == NULL)
+               {
+                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                       return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+               }
 
                _item->media_id = strdup(media_id);
                _item->function = MEDIA_TAG_REMOVE;
 
                if(_item->media_id == NULL)
                {
+                       SAFE_FREE(_item);
                        media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
                        return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                }
 
-               __media_tag_item_add(_item);
+               __media_tag_item_add(_tag, _item);
        }
        else
        {
@@ -476,12 +476,18 @@ int media_tag_set_name(media_tag_h tag, char *tag_name)
                SAFE_FREE(_tag->name);
 
                media_tag_item_s *_item = (media_tag_item_s*)calloc(1, sizeof(media_tag_item_s));
+               if(_item == NULL)
+               {
+                       media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                       return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+               }
 
                _item->tag_name = strdup(tag_name);
                _item->function = MEDIA_TAG_UPDATE_TAG_NAME;
 
                if(_item->tag_name == NULL)
                {
+                       SAFE_FREE(_item);
                        media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
                        return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                }
@@ -489,11 +495,13 @@ int media_tag_set_name(media_tag_h tag, char *tag_name)
                _tag->name = strdup(tag_name);
                if(_tag->name == NULL)
                {
+                       SAFE_FREE(_item->tag_name);
+                       SAFE_FREE(_item);
                        media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
                        return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                }
 
-               __media_tag_item_add(_item);
+               __media_tag_item_add(_tag, _item);
        }
        else
        {
@@ -518,10 +526,15 @@ int media_tag_update_to_db(media_tag_h tag)
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
-       length = g_list_length(g_tag_item_list);
+       if(_tag->item_list != NULL) {
+               length = g_list_length(_tag->item_list);
+       } else {
+               media_content_error("operation list length is 0");
+               return MEDIA_CONTENT_ERROR_NONE;
+       }
 
        for (idx = 0; idx < length; idx++) {
-               _tag_item = (media_tag_item_s*)g_list_nth_data(g_tag_item_list, idx);
+               _tag_item = (media_tag_item_s*)g_list_nth_data(_tag->item_list, idx);
                if(_tag_item != NULL) {
                        switch(_tag_item->function) {
                                case MEDIA_TAG_ADD:
@@ -545,7 +558,7 @@ int media_tag_update_to_db(media_tag_h tag)
                }
        }
 
-       __media_tag_item_release();
+       __media_tag_item_release(_tag);
 
        return ret;
 }
index 10d518f..b72f991 100755 (executable)
 * limitations under the License.
 */
 
-
+#include <dirent.h>
 #include <string.h>
 #include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
 #include <media_util_private.h>
 #include <media_info_private.h>
 #include <media_content_type.h>
 
+int _media_util_check_file(const char *path)
+{
+       int exist;
+
+       /* check the file exits actually */
+       exist = open(path, O_RDONLY);
+       if(exist < 0) {
+               media_content_sec_debug("path [%s]", path);
+               media_content_stderror("open file fail");
+               if (errno == EACCES || errno == EPERM) {
+                       return MEDIA_CONTENT_ERROR_PERMISSION_DENIED;
+               } else {
+                       return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+               }
+       }
+
+       close(exist);
 
-int _media_util_get_store_type_by_path(const char *path, int *storage_type)
+       return MEDIA_CONTENT_ERROR_NONE;
+}
+
+int _media_util_check_ignore_dir(const char *dir_path, bool *ignore)
 {
-       if(STRING_VALID(path))
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       media_svc_storage_type_e storage_type = 0;
+       char *scan_ignore = ".scan_ignore";
+       bool find = false;
+
+       media_content_sec_debug("dir_path : %s", dir_path);
+
+       if(!STRING_VALID(dir_path))
+       {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       *ignore = FALSE;
+       /*1. Check Hidden Directory*/
+       if(strstr(dir_path, "/."))
+       {
+               *ignore = TRUE;
+               media_content_info("hidden path");
+               return MEDIA_CONTENT_ERROR_NONE;
+       }
+
+       /*2. Check Scan Ignore Directory*/
+       ret = media_svc_get_storage_type(dir_path, &storage_type);
+       if(ret != MEDIA_INFO_ERROR_NONE)
        {
-               if(strncmp(path, MEDIA_CONTENT_PATH_PHONE, strlen(MEDIA_CONTENT_PATH_PHONE)) == 0)
+               media_content_error("media_svc_get_storage_type failed : %d", ret);
+               return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+       }
+
+       DIR *dp = NULL;
+       struct dirent entry;
+       struct dirent *result = NULL;
+
+       char *leaf_path = NULL;
+       char search_path[4096] = {0, };
+
+       strncpy(search_path, dir_path, strlen(dir_path));
+       while(STRING_VALID(search_path))
+       {
+               dp = opendir(search_path);
+               if(dp == NULL)
                {
-                       *storage_type = MEDIA_CONTENT_STORAGE_INTERNAL;
+                       media_content_error("Fail Open Directory");
+                       return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
                }
-               else if(strncmp (path, MEDIA_CONTENT_PATH_MMC, strlen(MEDIA_CONTENT_PATH_MMC)) == 0)
+
+               while (!readdir_r(dp, &entry, &result))
                {
-                       *storage_type = MEDIA_CONTENT_STORAGE_EXTERNAL;
+                       if (result == NULL)
+                               break;
+
+                       if(STRING_VALID(entry.d_name) && (strcmp(entry.d_name, scan_ignore) == 0))
+                       {
+                               media_content_info("Find Ignore path");
+                               media_content_sec_debug("Ignore path[%s]", search_path);
+                               find = TRUE;
+                               break;
+                       }
+                       else
+                       {
+                               //media_content_sec_debug("entry.d_name[%s]", entry.d_name);
+                               continue;
+                       }
+               }
+
+               if (dp) closedir(dp);
+               dp = NULL;
+
+               if(find)
+               {
+                       *ignore = TRUE;
+                       break;
+               }
+               else
+               {
+                       /*If root path, Stop Scanning*/
+                       if((storage_type == MEDIA_SVC_STORAGE_INTERNAL) && (strcmp(search_path, MEDIA_ROOT_PATH_INTERNAL) == 0))
+                       {
+                               //media_content_debug("Internal root path. Stop Scanning. Not found Ignore information");
+                               break;
+                       }
+                       else if((storage_type == MEDIA_SVC_STORAGE_EXTERNAL) && (strcmp(search_path, MEDIA_ROOT_PATH_SDCARD) == 0))
+                       {
+                               //media_content_debug("Enternal root path. Stop Scanning. Not found Ignore information");
+                               break;
+                       }
+
+                       leaf_path = strrchr(search_path, '/');
+                       if(leaf_path != NULL)
+                       {
+                               int seek_len = leaf_path -search_path;
+                               search_path[seek_len] = '\0';
+                               //media_content_sec_debug("go to other dir [%s]", search_path);
+                       }
+                       else
+                       {
+                               media_content_debug("Fail to find leaf path");
+                               break;
+                       }
                }
-       }
-       else
-       {
-               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
-               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
        return MEDIA_CONTENT_ERROR_NONE;
index e8aa927..49b36ee 100755 (executable)
@@ -15,9 +15,7 @@
 */
 
 
-#include <media_content.h>
 #include <media_info_private.h>
-#include <media-svc.h>
 
 
 int video_meta_destroy(video_meta_h video)
@@ -31,6 +29,7 @@ int video_meta_destroy(video_meta_h video)
                SAFE_FREE(_video->title);
                SAFE_FREE(_video->album);
                SAFE_FREE(_video->artist);
+               SAFE_FREE(_video->album_artist);
                SAFE_FREE(_video->genre);
                SAFE_FREE(_video->composer);
                SAFE_FREE(_video->year);
@@ -111,6 +110,17 @@ int video_meta_clone(video_meta_h *dst, video_meta_h src)
                        }
                }
 
+               if(STRING_VALID(_src->album_artist))
+               {
+                       _dst->album_artist = strdup(_src->album_artist);
+                       if(_dst->album_artist == NULL)
+                       {
+                               video_meta_destroy((video_meta_h)_dst);
+                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+                       }
+               }
+
                if(STRING_VALID(_src->genre))
                {
                        _dst->genre = strdup(_src->genre);
@@ -230,25 +240,25 @@ int video_meta_get_media_id(video_meta_h video, char **media_id)
        return ret;
 }
 
-int video_meta_get_title(video_meta_h video, char **title)
+int video_meta_get_album(video_meta_h video, char **album)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
        video_meta_s *_video = (video_meta_s*)video;
        if(_video)
        {
-               if(STRING_VALID(_video->title))
+               if(STRING_VALID(_video->album))
                {
-                       char *new_string = strdup(_video->title);
+                       char *new_string = strdup(_video->album);
                        if(NULL == new_string)
                        {
                                media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
                                return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                        }
-                       *title = new_string;
+                       *album = new_string;
                }
                else
                {
-                       *title = NULL;
+                       *album = NULL;
                }
                ret = MEDIA_CONTENT_ERROR_NONE;
 
@@ -260,27 +270,27 @@ int video_meta_get_title(video_meta_h video, char **title)
        }
 
        return ret;
-}
 
-int video_meta_get_album(video_meta_h video, char **album)
+}
+int video_meta_get_artist(video_meta_h video, char **artist)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
        video_meta_s *_video = (video_meta_s*)video;
        if(_video)
        {
-               if(STRING_VALID(_video->album))
+               if(STRING_VALID(_video->artist))
                {
-                       char *new_string = strdup(_video->album);
+                       char *new_string = strdup(_video->artist);
                        if(NULL == new_string)
                        {
                                media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
                                return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                        }
-                       *album = new_string;
+                       *artist = new_string;
                }
                else
                {
-                       *album = NULL;
+                       *artist = NULL;
                }
                ret = MEDIA_CONTENT_ERROR_NONE;
 
@@ -294,25 +304,26 @@ int video_meta_get_album(video_meta_h video, char **album)
        return ret;
 
 }
-int video_meta_get_artist(video_meta_h video, char **artist)
+
+int video_meta_get_album_artist(video_meta_h video, char **album_artist)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
        video_meta_s *_video = (video_meta_s*)video;
        if(_video)
        {
-               if(STRING_VALID(_video->artist))
+               if(STRING_VALID(_video->album_artist))
                {
-                       char *new_string = strdup(_video->artist);
+                       char *new_string = strdup(_video->album_artist);
                        if(NULL == new_string)
                        {
                                media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
                                return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                        }
-                       *artist = new_string;
+                       *album_artist = new_string;
                }
                else
                {
-                       *artist = NULL;
+                       *album_artist = NULL;
                }
                ret = MEDIA_CONTENT_ERROR_NONE;
 
index 7097377..b978627 100755 (executable)
@@ -7,7 +7,7 @@ FOREACH(flag ${${fw_test}_CFLAGS})
     SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -pie")
 
 aux_source_directory(. sources)
 FOREACH(src ${sources})
index 566e13f..1f1a310 100755 (executable)
 #include <pthread.h>
 #include <glib.h>
 
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "TIZEN_N_MEDIACONTENT"
-
 filter_h g_filter = NULL;
 filter_h g_filter_g = NULL;    //filter for group like folder, tag, playlist, album, year ...
 
@@ -39,75 +34,111 @@ static int g_media_cnt = 0;
 #define test_audio_id  "0f999626-6218-450c-a4ad-181a3bab6ebf"
 #define test_video_id  "c1a92494-cc5b-4d74-aa7d-253199234548"
 #define test_image_id "db1c184c-6f31-43b4-b924-8c00ac5b6197"
+media_folder_h g_folder = NULL;
 
 bool get_audio_meta(audio_meta_h audio)
 {
        char *c_value = NULL;
        int i_value = 0;
        time_t t_value = 0;
+       int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug("=== audio meta === \n");
+       media_content_debug("=== audio meta ===");
 
-       audio_meta_get_media_id(audio, &c_value);
-       media_content_debug("audio_id : [%s] \n", c_value);
+       ret = audio_meta_get_media_id(audio, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("audio_id : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       audio_meta_get_title(audio, &c_value);
-       media_content_debug("title : [%s] \n", c_value);
+       ret = audio_meta_get_album(audio, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("album : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       audio_meta_get_album(audio, &c_value);
-       media_content_debug("album : [%s] \n", c_value);
+       ret = audio_meta_get_artist(audio, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("artist : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       audio_meta_get_artist(audio, &c_value);
-       media_content_debug("artist : [%s] \n", c_value);
+       ret = audio_meta_get_album_artist(audio, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("album_artist : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       audio_meta_get_genre(audio, &c_value);
-       media_content_debug("genre : [%s] \n", c_value);
+       ret = audio_meta_get_genre(audio, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("genre : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       audio_meta_get_composer(audio, &c_value);
-       media_content_debug("composer : [%s] \n", c_value);
+       ret = audio_meta_get_composer(audio, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("composer : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       audio_meta_get_year(audio, &c_value);
-       media_content_debug("year : [%s] \n", c_value);
+       ret = audio_meta_get_year(audio, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("year : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       audio_meta_get_recorded_date(audio, &c_value);
-       media_content_debug("recorded_date : [%s] \n", c_value);
+       ret = audio_meta_get_recorded_date(audio, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("recorded_date : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       audio_meta_get_copyright(audio, &c_value);
-       media_content_debug("copyright : [%s] \n", c_value);
+       ret = audio_meta_get_copyright(audio, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("copyright : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       audio_meta_get_track_num(audio, &c_value);
-       media_content_debug("track_num : [%s] \n", c_value);
+       ret = audio_meta_get_track_num(audio, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("track_num : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       audio_meta_get_bit_rate(audio, &i_value);
-       media_content_debug("bitrate : [%d] \n", i_value);
+       ret = audio_meta_get_bit_rate(audio, &i_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("bitrate : [%d]", i_value);
 
-       audio_meta_get_sample_rate(audio, &i_value);
-       media_content_debug("samplerate : [%d] \n", i_value);
+       ret = audio_meta_get_sample_rate(audio, &i_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("samplerate : [%d]", i_value);
 
-       audio_meta_get_channel(audio, &i_value);
-       media_content_debug("channel : [%d] \n", i_value);
+       ret = audio_meta_get_channel(audio, &i_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("channel : [%d]", i_value);
 
-       audio_meta_get_duration(audio, &i_value);
-       media_content_debug("duration : [%d] \n", i_value);
+       ret = audio_meta_get_duration(audio, &i_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("duration : [%d]", i_value);
 
-       audio_meta_get_played_count(audio, &i_value);
-       media_content_debug("played_count : [%d] \n", i_value);
+       ret = audio_meta_get_played_count(audio, &i_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("played_count : [%d]", i_value);
 
-       audio_meta_get_played_time(audio, &t_value);
-       media_content_debug("played_time : [%d] \n", t_value);
+       ret = audio_meta_get_played_time(audio, &t_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("played_time : [%d]", t_value);
 
-       audio_meta_get_played_position(audio, &i_value);
-       media_content_debug("played_position : [%d] \n", i_value);
+       ret = audio_meta_get_played_position(audio, &i_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("played_position : [%d]", i_value);
 
        return true;
 }
@@ -117,69 +148,104 @@ bool get_video_meta(video_meta_h video)
        char *c_value = NULL;
        int i_value = 0;
        time_t t_value = 0;
+       int ret = MEDIA_CONTENT_ERROR_NONE;
 
-       media_content_debug("=== video meta === \n");
+       media_content_debug("=== video meta ===");
 
-       video_meta_get_media_id(video, &c_value);
-       media_content_debug("video_id : [%s] \n", c_value);
+       ret = video_meta_get_media_id(video, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("video_id : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       video_meta_get_title(video, &c_value);
-       media_content_debug("title : [%s] \n", c_value);
+       ret = video_meta_get_album(video, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("album : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       video_meta_get_album(video, &c_value);
-       media_content_debug("album : [%s] \n", c_value);
+       ret = video_meta_get_artist(video, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("artist : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       video_meta_get_artist(video, &c_value);
-       media_content_debug("artist : [%s] \n", c_value);
+       ret = video_meta_get_album_artist(video, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("album_artist : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       video_meta_get_genre(video, &c_value);
-       media_content_debug("genre : [%s] \n", c_value);
+       ret = video_meta_get_genre(video, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("genre : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       video_meta_get_composer(video, &c_value);
-       media_content_debug("omposer : [%s] \n", c_value);
+       ret = video_meta_get_composer(video, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("omposer : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       video_meta_get_year(video, &c_value);
-       media_content_debug("year : [%s] \n", c_value);
+       ret = video_meta_get_year(video, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("year : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       video_meta_get_recorded_date(video, &c_value);
-       media_content_debug("recorded_date : [%s] \n", c_value);
+       ret = video_meta_get_recorded_date(video, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("recorded_date : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       video_meta_get_copyright(video, &c_value);
-       media_content_debug("copyright : [%s] \n", c_value);
+       ret = video_meta_get_copyright(video, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("copyright : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       video_meta_get_track_num(video, &c_value);
-       media_content_debug("track_num : [%s] \n", c_value);
+       ret = video_meta_get_track_num(video, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("track_num : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       video_meta_get_bit_rate(video, &i_value);
-       media_content_debug("bitrate : [%d] \n", i_value);
+       ret = video_meta_get_bit_rate(video, &i_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("bitrate : [%d]", i_value);
 
-       video_meta_get_duration(video, &i_value);
-       media_content_debug("duration : [%d] \n", i_value);
+       ret = video_meta_get_duration(video, &i_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("duration : [%d]", i_value);
 
-       video_meta_get_width(video, &i_value);
-       media_content_debug("width : [%d] \n", i_value);
+       ret = video_meta_get_width(video, &i_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("width : [%d]", i_value);
 
-       video_meta_get_height(video, &i_value);
-       media_content_debug("height : [%d] \n", i_value);
+       ret = video_meta_get_height(video, &i_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("height : [%d]", i_value);
 
-       video_meta_get_played_count(video, &i_value);
-       media_content_debug("played_count : [%d] \n", i_value);
+       ret = video_meta_get_played_count(video, &i_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("played_count : [%d]", i_value);
 
-       video_meta_get_played_time(video, &t_value);
-       media_content_debug("played_time : [%d] \n", t_value);
+       ret = video_meta_get_played_time(video, &t_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("played_time : [%d]", t_value);
 
-       video_meta_get_played_position(video, &i_value);
-       media_content_debug("played_position : [%d] \n", i_value);
+       ret = video_meta_get_played_position(video, &i_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get meta : [%d]", ret);
+       media_content_debug("played_position : [%d]", i_value);
 
        return true;
 }
@@ -220,7 +286,11 @@ bool gallery_tag_item_cb(media_tag_h tag, void *user_data)
 bool gallery_bookmarks_cb(media_bookmark_h bookmark, void *user_data)
 {
        media_bookmark_h new_bm = NULL;
-       media_bookmark_clone(&new_bm, bookmark);
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+
+       ret = media_bookmark_clone(&new_bm, bookmark);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_bookmark_clone : [%d]", ret);
 
        GList **list = (GList**)user_data;
        *list = g_list_append(*list, new_bm);
@@ -232,25 +302,37 @@ bool media_item_cb(media_info_h media, void *user_data)
 {
        char *c_value = NULL;
        char *media_id = NULL;
-       int i_value = 0;
-       time_t t_value = 0;
-       bool b_value = false;
        media_content_type_e media_type = 0;
-       unsigned long long size = 0;
+       int ret = MEDIA_CONTENT_ERROR_NONE;
 
        if(media == NULL)
        {
-               media_content_debug("NO Item \n");
+               media_content_debug("NO Item");
                return true;
        }
 
-       media_info_get_media_type(media, &media_type);
-       media_content_debug("media_type : [%d] \n", media_type);
+       ret = media_info_get_media_type(media, &media_type);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get info : [%d]", ret);
+       media_content_debug("media_type : [%d]", media_type);
+
+       ret = media_info_get_media_id(media, &media_id);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get info : [%d]", ret);
+       media_content_debug("media_id : [%s]", media_id);
+
+       ret = media_info_get_file_path(media, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get info : [%d]", ret);
+       media_content_debug("file_path : [%s]", c_value);
+       SAFE_FREE(c_value);
 
-       media_info_get_media_id(media, &media_id);
-       media_content_debug("media_id : [%s] \n", media_id);
+#if 0
+       int i_value = 0;
+       time_t t_value = 0;
+       bool b_value = false;
+       unsigned long long size = 0;
 
-#if 1
        if(media_type == MEDIA_CONTENT_TYPE_MUSIC)
        {
                audio_meta_h audio;
@@ -258,25 +340,50 @@ bool media_item_cb(media_info_h media, void *user_data)
                if(media_info_get_audio(media, &audio) == MEDIA_CONTENT_ERROR_NONE)
                {
                        get_audio_meta(audio);
-                       audio_meta_destroy(audio);
+                       ret = audio_meta_destroy(audio);
+                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                               media_content_error("error audio_meta_destroy : [%d]", ret);
                }
                else
-                       media_content_error("[audio_error] \n");
+                       media_content_error("[audio_error]");
 
        }
        else if(media_type == MEDIA_CONTENT_TYPE_IMAGE)
        {
                image_meta_h image;
                media_content_orientation_e orientation = 0;
+               bool is_burst_shot = false;
+               char *burst_id = NULL;
+               char *weather = NULL;
 
                if(media_info_get_image(media, &image) == MEDIA_CONTENT_ERROR_NONE)
                {
-                       image_meta_get_orientation(image, &orientation);
-                       media_content_debug("[image] orientation : %d\n", orientation);
-                       image_meta_destroy(image);
+                       ret = image_meta_get_orientation(image, &orientation);
+                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                               media_content_error("error image_meta_get_orientation : [%d]", ret);
+                       else
+                               media_content_debug("[image] orientation : %d", orientation);
+
+                       ret = image_meta_is_burst_shot(image, &is_burst_shot);
+                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                               media_content_error("error image_meta_is_burst_shot : [%d]", ret);
+                       if(is_burst_shot)
+                       {
+                               ret = image_meta_get_burst_id(image, &burst_id);
+                               if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                       media_content_error("error image_meta_get_burst_id : [%d]", ret);
+                               else
+                                       media_content_debug("[image] burst_id : [%s]", burst_id);
+
+                               SAFE_FREE(burst_id);
+                       }
+
+                       ret = image_meta_destroy(image);
+                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                               media_content_error("error image_meta_destroy : [%d]", ret);
                }
                else
-                       media_content_error("[image_error] \n");
+                       media_content_error("[image_error]");
 
        }
        else if(media_type == MEDIA_CONTENT_TYPE_VIDEO)
@@ -286,10 +393,12 @@ bool media_item_cb(media_info_h media, void *user_data)
                if(media_info_get_video(media, &video) == MEDIA_CONTENT_ERROR_NONE)
                {
                        get_video_meta(video);
-                       video_meta_destroy(video);
+                       ret = video_meta_destroy(video);
+                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                               media_content_error("error video_meta_destroy : [%d]", ret);
                }
                else
-                       media_content_error("[video_error] \n");
+                       media_content_error("[video_error]");
 
        }
        else
@@ -297,77 +406,131 @@ bool media_item_cb(media_info_h media, void *user_data)
                media_content_debug("Other Content");
        }
 
-       media_content_debug("=== media_info === \n");
-       media_info_get_file_path(media, &c_value);
-       media_content_debug("file_path : [%s] \n", c_value);
+       media_content_debug("=== media_info ===");
+       ret = media_info_get_file_path(media, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get info : [%d]", ret);
+       media_content_debug("file_path : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       media_info_get_display_name(media, &c_value);
-       media_content_debug("display_name : [%s] \n", c_value);
+       ret = media_info_get_display_name(media, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get info : [%d]", ret);
+       media_content_debug("display_name : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       media_info_get_mime_type(media, &c_value);
-       media_content_debug("mime_type : [%s] \n", c_value);
+       ret = media_info_get_mime_type(media, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get info : [%d]", ret);
+       media_content_debug("mime_type : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       media_info_get_thumbnail_path(media, &c_value);
-       media_content_debug("thumbnail_path : [%s] \n", c_value);
+       ret = media_info_get_thumbnail_path(media, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get info : [%d]", ret);
+       media_content_debug("thumbnail_path : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       media_info_get_description(media, &c_value);
-       media_content_debug("description : [%s] \n", c_value);
+       ret = media_info_get_description(media, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get info : [%d]", ret);
+       media_content_debug("description : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       media_info_get_author(media, &c_value);
-       media_content_debug("author : [%s] \n", c_value);
+       ret = media_info_get_author(media, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get info : [%d]", ret);
+       media_content_debug("author : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       media_info_get_provider(media, &c_value);
-       media_content_debug("provider : [%s] \n", c_value);
+       ret = media_info_get_provider(media, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get info : [%d]", ret);
+       media_content_debug("provider : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       media_info_get_content_name(media, &c_value);
-       media_content_debug("content_name : [%s] \n", c_value);
+       ret = media_info_get_content_name(media, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get info : [%d]", ret);
+       media_content_debug("content_name : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       media_info_get_category(media, &c_value);
-       media_content_debug("category : [%s] \n", c_value);
+       ret = media_info_get_category(media, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get info : [%d]", ret);
+       media_content_debug("category : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       media_info_get_location_tag(media, &c_value);
-       media_content_debug("location_tag : [%s] \n", c_value);
+       ret = media_info_get_location_tag(media, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get info : [%d]", ret);
+       media_content_debug("location_tag : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       media_info_get_age_rating(media, &c_value);
-       media_content_debug("age_rating : [%s] \n", c_value);
+       ret = media_info_get_age_rating(media, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get info : [%d]", ret);
+       media_content_debug("age_rating : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       media_info_get_keyword(media, &c_value);
-       media_content_debug("keyword : [%s] \n", c_value);
+       ret = media_info_get_keyword(media, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get info : [%d]", ret);
+       media_content_debug("keyword : [%s]", c_value);
        SAFE_FREE(c_value);
 
-       media_info_get_size(media, &size);
-       media_content_debug("size : [%lld] \n", size);
+       ret = media_info_get_size(media, &size);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get info : [%d]", ret);
+       media_content_debug("size : [%lld]", size);
+
+       ret = media_info_get_added_time(media, &t_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get info : [%d]", ret);
+       media_content_debug("added_time : [%d]", t_value);
+
+       ret = media_info_get_modified_time(media, &t_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get info : [%d]", ret);
+       media_content_debug("modified_time : [%d]", t_value);
+
+       ret = media_info_get_timeline(media, &t_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get info : [%d]", ret);
+       media_content_debug("timeline : [%d]", t_value);
 
-       media_info_get_added_time(media, &t_value);
-       media_content_debug("added_time : [%d] \n", t_value);
+       ret = media_info_get_rating(media, &i_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get info : [%d]", ret);
+       media_content_debug("rating : [%d]", i_value);
 
-       media_info_get_modified_time(media, &t_value);
-       media_content_debug("modified_time : [%d] \n", t_value);
+       ret = media_info_get_favorite(media, &b_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get info : [%d]", ret);
+       media_content_debug("favorite : [%d]", b_value);
 
-       media_info_get_rating(media, &i_value);
-       media_content_debug("rating : [%d] \n", i_value);
+       ret = media_info_is_drm(media, &b_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get info : [%d]", ret);
+       media_content_debug("is_drm : [%d]", b_value);
 
-       media_info_get_favorite(media, &b_value);
-       media_content_debug("favorite : [%d] \n", b_value);
+       ret = media_info_set_weather(media, "Sunny");
+       if(ret != MEDIA_CONTENT_ERROR_NONE) {
+               media_content_error("Fail to set weather");
+               return ret;
 
-       media_info_is_drm(media, &b_value);
-       media_content_debug("is_drm : [%d] \n", b_value);
+       ret = media_info_get_weather(media, &c_value);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error when get info : [%d]", ret);
+       media_content_debug("weather : [%s]", c_value);
+       SAFE_FREE(c_value);
 
-       media_info_set_location_tag(media, "Test location tag");
-       media_info_update_to_db(media);
+       /* Media server can't update when another db handle holds DB connection by sqlite3_prepare */
+       //ret = media_info_set_location_tag(media, "Test location tag");
+       //media_info_update_to_db(media);
        SAFE_FREE(media_id);
 #endif
+       SAFE_FREE(media_id);
        return true;
 }
 
@@ -383,47 +546,67 @@ bool folder_list_cb(media_folder_h folder, void *user_data)
 
        if(folder != NULL)
        {
-               media_folder_clone(_folder, folder);
+               if(_folder != NULL)
+                       media_folder_clone(_folder, folder);
 
                if(media_folder_get_folder_id(folder, &folder_id) != MEDIA_CONTENT_ERROR_NONE)
                {
-                       media_content_error("[ERROR] media_folder_get_folder_id is failed\n");
+                       media_content_error("[ERROR] media_folder_get_folder_id is failed");
                        return false;
                }
-               media_content_debug("folder_id = [%s] \n", folder_id);
+               media_content_debug("folder_id = [%s]", folder_id);
 
                if(media_folder_get_path(folder, &folder_path) != MEDIA_CONTENT_ERROR_NONE)
                {
-                       media_content_error("[ERROR] media_folder_get_path is failed\n");
+                       SAFE_FREE(folder_id);
+                       media_content_error("[ERROR] media_folder_get_path is failed");
                        return false;
                }
-               media_content_debug("folder_path = [%s] \n", folder_path);
+               media_content_debug("folder_path = [%s]", folder_path);
                SAFE_FREE(folder_path);
 
                if(media_folder_get_name(folder, &folder_name) != MEDIA_CONTENT_ERROR_NONE)
                {
-                       media_content_error("[ERROR] media_folder_get_name is failed\n");
+                       SAFE_FREE(folder_id);
+                       SAFE_FREE(folder_path);
+                       media_content_error("[ERROR] media_folder_get_name is failed");
                        return false;
                }
-               media_content_debug("folder_name = [%s] \n", folder_name);
+               media_content_debug("folder_name = [%s]", folder_name);
                SAFE_FREE(folder_name);
 
                if(media_folder_get_storage_type(folder, &storage_type) != MEDIA_CONTENT_ERROR_NONE)
                {
-                       media_content_error("[ERROR] media_folder_get_storage_type is failed\n");
+                       SAFE_FREE(folder_id);
+                       SAFE_FREE(folder_path);
+                       SAFE_FREE(folder_name);
+                       media_content_error("[ERROR] media_folder_get_storage_type is failed");
                        return false;
                }
-               media_content_debug("storage_type = [%d] \n", storage_type);
+               media_content_debug("storage_type = [%d]", storage_type);
 
                if(media_folder_get_media_count_from_db(folder_id, g_filter, &item_count) != MEDIA_CONTENT_ERROR_NONE)
                {
-                       media_content_error("[ERROR] media_folder_get_media_count_from_db is failed\n");
+                       SAFE_FREE(folder_id);
+                       SAFE_FREE(folder_path);
+                       SAFE_FREE(folder_name);
+                       media_content_error("[ERROR] media_folder_get_media_count_from_db is failed");
                        return false;
                }
 
-               media_folder_foreach_media_from_db(folder_id, g_filter, media_item_cb, NULL);
+               if(media_folder_foreach_media_from_db(folder_id, g_filter, media_item_cb, NULL) != MEDIA_CONTENT_ERROR_NONE)
+               {
+                       SAFE_FREE(folder_id);
+                       SAFE_FREE(folder_path);
+                       SAFE_FREE(folder_name);
+                       media_content_error("[ERROR] media_folder_foreach_media_from_db is failed");
+                       return false;
+               }
 
                SAFE_FREE(folder_id);
+               SAFE_FREE(folder_path);
+               SAFE_FREE(folder_name);
+
                ret = true;
        }
        else
@@ -445,24 +628,35 @@ bool test_album_from_db(int album_id)
        ret = media_album_get_album_from_db(album_id, &album_h);
        if(ret != MEDIA_CONTENT_ERROR_NONE)
        {
-               media_content_error("error when get album \n");
+               media_content_error("error when get album");
                return false;
        }
 
        if(media_album_get_album_id(album_h, &test_album_id) != MEDIA_CONTENT_ERROR_NONE)
+       {
+               media_album_destroy(album_h);
                return false;
+       }
 
-       media_content_debug("test_album_id : [%d] \n", test_album_id);
+       media_content_debug("test_album_id : [%d]", test_album_id);
 
        if(media_album_get_name(album_h, &album_name) != MEDIA_CONTENT_ERROR_NONE)
+       {
+               media_album_destroy(album_h);
                return false;
+       }
 
-       media_content_debug("album_name : [%s] \n", album_name);
+       media_content_debug("album_name : [%s]", album_name);
 
        if(media_album_get_artist(album_h, &artist) != MEDIA_CONTENT_ERROR_NONE)
+       {
+               media_album_destroy(album_h);
+               /* fix prevent: Resource Leak */
+               SAFE_FREE(album_name);
                return false;
+       }
 
-       media_content_debug("artist : [%s] \n", artist);
+       media_content_debug("artist : [%s]", artist);
 
        SAFE_FREE(album_name);
        SAFE_FREE(artist);
@@ -477,28 +671,33 @@ bool playlist_list_cb(media_playlist_h playlist, void *user_data)
        int playlist_id = 0;
        char *playlist_name = NULL;
        media_playlist_h playlist_h;
+       char *playlist_thumbnail_path = NULL;
 
-       media_content_debug("playlist_list_cb ====== \n");
+       media_content_debug("playlist_list_cb ======");
 
        GList **list = (GList**)user_data;
 
        if(playlist == NULL)
        {
-               media_content_debug(" playlist handle is NULL \n");
+               media_content_debug(" playlist handle is NULL");
                return false;
        }
 
        media_playlist_get_playlist_id(playlist, &playlist_id);
-       media_content_debug("playlist_id : %d \n", playlist_id);
+       media_content_debug("playlist_id : %d", playlist_id);
 
        if(user_data != NULL)
                *list = g_list_append(*list, (gpointer)playlist_id);
 
        media_playlist_get_name(playlist, &playlist_name);
-       media_content_debug("playlist_name : %s \n", playlist_name);
+       media_content_debug("playlist_name : %s", playlist_name);
        SAFE_FREE(playlist_name);
 
-       media_playlist_get_playlist_from_db(playlist_id, NULL, &playlist_h);
+       media_playlist_get_thumbnail_path(playlist, &playlist_thumbnail_path);
+       media_content_debug("playlist_thumbnail_path : %s", playlist_thumbnail_path);
+       SAFE_FREE(playlist_thumbnail_path);
+
+       media_playlist_get_playlist_from_db(playlist_id, &playlist_h);
 
        media_playlist_destroy(playlist_h);
 
@@ -509,18 +708,25 @@ bool tag_list_cb(media_tag_h tag, void *user_data)
 {
        int tag_id = 0;
        char *tag_name = NULL;
+       int ret = MEDIA_CONTENT_ERROR_NONE;
 
        if(tag == NULL)
        {
-               media_content_debug(" tag handle is NULL \n");
+               media_content_debug(" tag handle is NULL");
                return false;
        }
 
-       media_tag_get_tag_id(tag, &tag_id);
-       media_content_debug("tag_id : %d \n", tag_id);
+       ret = media_tag_get_tag_id(tag, &tag_id);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_get_tag_id : [%d]", ret);
+       else
+               media_content_debug("tag_id : %d", tag_id);
 
-       media_tag_get_name(tag, &tag_name);
-       media_content_debug("tag_name : %s \n", tag_name);
+       ret = media_tag_get_name(tag, &tag_name);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_get_name : [%d]", ret);
+       else
+               media_content_debug("tag_name : %s", tag_name);
        SAFE_FREE(tag_name);
 
        return true;
@@ -529,6 +735,7 @@ bool tag_list_cb(media_tag_h tag, void *user_data)
 bool bookmarks_cb(media_bookmark_h bookmark, void *user_data)
 {
        media_bookmark_h *_bookmark = (media_bookmark_h*)bookmark;
+       int ret = MEDIA_CONTENT_ERROR_NONE;
 
        if(_bookmark != NULL)
        {
@@ -536,15 +743,24 @@ bool bookmarks_cb(media_bookmark_h bookmark, void *user_data)
                time_t time = 0;
                int bookmark_id = 0;
 
-               media_bookmark_get_bookmark_id(bookmark, &bookmark_id);
-               media_content_debug("bookmark_id : %d \n", bookmark_id);
+               ret = media_bookmark_get_bookmark_id(bookmark, &bookmark_id);
+               if(ret != MEDIA_CONTENT_ERROR_NONE)
+                       media_content_error("error media_bookmark_get_bookmark_id : [%d]", ret);
+               else
+                       media_content_debug("bookmark_id : %d", bookmark_id);
 
-               media_bookmark_get_thumbnail_path(bookmark, &name);
-               media_content_debug("bookmark thumbnail_path : %s \n", name);
+               ret = media_bookmark_get_thumbnail_path(bookmark, &name);
+               if(ret != MEDIA_CONTENT_ERROR_NONE)
+                       media_content_error("error media_bookmark_get_thumbnail_path : [%d]", ret);
+               else
+                       media_content_debug("bookmark thumbnail_path : %s", name);
                SAFE_FREE(name);
 
-               media_bookmark_get_marked_time(bookmark, &time);
-               media_content_debug("bookmark marked_time : %d \n", time);
+               ret = media_bookmark_get_marked_time(bookmark, &time);
+               if(ret != MEDIA_CONTENT_ERROR_NONE)
+                       media_content_error("error media_bookmark_get_marked_time : [%d]", ret);
+               else
+                       media_content_debug("bookmark marked_time : %d", time);
        }
 
        return true;
@@ -558,69 +774,89 @@ bool album_list_cb(media_album_h album, void *user_data)
        char *album_art = NULL;
        int media_count = 0;
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       filter_h filter;
+       filter_h filter = NULL;
 
        /*Set Filter*/
        char *condition = "MEDIA_TYPE=3";       /*MEDIA_TYPE 0-image, 1-video, 2-sound, 3-music, 4-other*/
 
        ret = media_filter_create(&filter);
        if(ret != MEDIA_CONTENT_ERROR_NONE) {
-               media_content_error("Fail to create filter \n");
+               media_content_error("Fail to create filter");
                return ret;
        }
        ret = media_filter_set_condition(filter, condition, MEDIA_CONTENT_COLLATE_DEFAULT);
        if(ret != MEDIA_CONTENT_ERROR_NONE) {
-               media_content_error("Fail to set condition \n");
+               media_filter_destroy(filter);
+               media_content_error("Fail to set condition");
                return ret;
        }
        ret = media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_TITLE, MEDIA_CONTENT_COLLATE_NOCASE);
        if(ret != MEDIA_CONTENT_ERROR_NONE) {
-               media_content_error("Fail to set order \n");
+               media_filter_destroy(filter);
+               media_content_error("Fail to set order");
                return ret;
        }
 
        if(album != NULL)
        {
                if(media_album_get_album_id(album, &album_id) != MEDIA_CONTENT_ERROR_NONE)
+               {
+                       media_filter_destroy(filter);
                        return false;
+               }
 
-               media_content_debug("album_id : [%d] \n", album_id);
+               media_content_debug("album_id : [%d]", album_id);
 
                if(media_album_get_name(album, &album_name) != MEDIA_CONTENT_ERROR_NONE)
+               {
+                       media_filter_destroy(filter);
                        return false;
+               }
 
-               media_content_debug("album_name : [%s] \n", album_name);
+               media_content_debug("album_name : [%s]", album_name);
+               SAFE_FREE(album_name);
 
                if(media_album_get_artist(album, &artist) != MEDIA_CONTENT_ERROR_NONE)
+               {
+                       media_filter_destroy(filter);
                        return false;
+               }
 
-               media_content_debug("artist : [%s] \n", artist);
+               media_content_debug("artist : [%s]", artist);
+               SAFE_FREE(artist);
 
                if(media_album_get_album_art(album, &album_art) != MEDIA_CONTENT_ERROR_NONE)
+               {
+                       media_filter_destroy(filter);
                        return false;
+               }
 
-               media_content_debug("album_art : [%s] \n", album_art);
-
-               SAFE_FREE(album_name);
-               SAFE_FREE(artist);
+               media_content_debug("album_art : [%s]", album_art);
                SAFE_FREE(album_art);
 
                if(media_album_get_media_count_from_db(album_id, filter, &media_count) != MEDIA_CONTENT_ERROR_NONE)
+               {
+                       media_filter_destroy(filter);
                        return false;
+               }
 
-               media_content_debug("media_count : [%d] \n", media_count);
+               media_content_debug("media_count : [%d]", media_count);
 
                if(media_album_foreach_media_from_db(album_id, filter, media_item_cb, NULL) != MEDIA_CONTENT_ERROR_NONE)
+               {
+                       media_filter_destroy(filter);
                        return false;
+               }
 
                test_album_from_db(album_id);
        }
        else
        {
-               media_content_error("album item not Found!!\n");
-               return true;
+               media_content_error("album item not Found!!");
        }
 
+       media_filter_destroy(filter);
+
        return true;
 }
 
@@ -629,12 +865,12 @@ bool group_list_cb(const char *group_name, void *user_data)
        int media_count = 0;
        int *idx = user_data;
 
-       media_content_debug("group item : [%s] [%d]\n", group_name, *idx);
+       media_content_debug("group item : [%s] [%d]", group_name, *idx);
 
        if(media_group_get_media_count_from_db(group_name, *idx, g_filter, &media_count) != MEDIA_CONTENT_ERROR_NONE)
                return false;
 
-       media_content_debug("media_count : [%d] \n", media_count);
+       media_content_debug("media_count : [%d]", media_count);
 
        if(media_group_foreach_media_from_db(group_name, *idx, g_filter, media_item_cb, NULL) != MEDIA_CONTENT_ERROR_NONE)
                return false;
@@ -644,7 +880,7 @@ bool group_list_cb(const char *group_name, void *user_data)
 
 bool playlist_item_cb(int playlist_member_id, media_info_h media, void *user_data)
 {
-       media_content_debug("playlist_member_id : [%d] \n", playlist_member_id);
+       media_content_debug("playlist_member_id : [%d]", playlist_member_id);
 
        GList **list = (GList**)user_data;
        *list = g_list_append(*list, (gpointer)playlist_member_id);
@@ -661,7 +897,8 @@ int test_filter_create(void)
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
        /* Filter for media */
-       char *condition = "MEDIA_TYPE=0";       /*MEDIA_TYPE 0-image, 1-video, 2-sound, 3-music, 4-other*/
+       char *condition = "MEDIA_TYPE=3";       /*MEDIA_TYPE 0-image, 1-video, 2-sound, 3-music, 4-other*/
+       //char *condition = "MEDIA_TYPE IS NOT 0 AND MEDIA_DESCRIPTION IS NOT NULL";    /*MEDIA_TYPE 0-image, 1-video, 2-sound, 3-music, 4-other*/
 
        ret = media_filter_create(&g_filter);
 
@@ -682,7 +919,10 @@ int test_filter_create(void)
         * Or,
         * call media_filter_set_order(g_filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_ARTIST, MEDIA_CONTENT_COLLATE_DEFAULT);
         */
+       /* Able to set multi column to set order */
+       //ret = media_filter_set_order(g_filter, MEDIA_CONTENT_ORDER_ASC, "MEDIA_MODIFIED_TIME, MEDIA_DISPLAY_NAME", MEDIA_CONTENT_COLLATE_DEFAULT);
        ret = media_filter_set_order(g_filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_ARTIST, MEDIA_CONTENT_COLLATE_DEFAULT);
+       //ret = media_filter_set_order(g_filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_TRACK_NUM_INT, MEDIA_CONTENT_COLLATE_DEFAULT);
 
        /* Filter for group */
        char *g_condition = "TAG_NAME like \"\%my\%\"";
@@ -737,25 +977,31 @@ int test_gallery_scenario(void)
 
        /* First, Get folder list */
        ret = media_folder_foreach_folder_from_db(filter, gallery_folder_list_cb, &folder_list);
-       if(ret < 0) {
+       if(ret != MEDIA_CONTENT_ERROR_NONE) {
                media_content_error("media_folder_foreach_folder_from_db failed: %d", ret);
                return -1;
        } else {
                media_content_debug("media_folder_foreach_folder_from_db success!!");
-               char *folder_id;
-               char *folder_name;
-               char *folder_path;
+               char *folder_id = NULL;
+               char *folder_name = NULL;
+               char *folder_path = NULL;
 
                for(i = 0; i < g_list_length(folder_list); i++) {
                        folder_handle = (media_folder_h)g_list_nth_data(folder_list, i);
 
-                       media_folder_get_folder_id(folder_handle, &folder_id);
-                       media_folder_get_name(folder_handle, &folder_name);
-                       media_folder_get_path(folder_handle, &folder_path);
+                       ret = media_folder_get_folder_id(folder_handle, &folder_id);
+                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                               media_content_error("media_folder_get_folder_id failed: %d", ret);
+                       ret = media_folder_get_name(folder_handle, &folder_name);
+                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                               media_content_error("media_folder_get_name failed: %d", ret);
+                       ret = media_folder_get_path(folder_handle, &folder_path);
+                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                               media_content_error("media_folder_get_path failed: %d", ret);
 
-                       media_content_debug("folder_id [%d] : %s\n", i, folder_id);
-                       media_content_debug("folder_name [%d] : %s\n", i, folder_name);
-                       media_content_debug("folder_path [%d] : %s\n", i, folder_path);
+                       media_content_debug("folder_id [%d] : %s", i, folder_id);
+                       media_content_debug("folder_name [%d] : %s", i, folder_name);
+                       media_content_debug("folder_path [%d] : %s", i, folder_path);
 
 
                        ret = media_folder_get_media_count_from_db(folder_id, filter, &count);
@@ -763,11 +1009,11 @@ int test_gallery_scenario(void)
                        SAFE_FREE(folder_id);
                        SAFE_FREE(folder_name);
                        SAFE_FREE(folder_path);
-                       if(ret < 0) {
+                       if(ret != MEDIA_CONTENT_ERROR_NONE) {
                                media_content_error("media_folder_get_media_count_from_db failed: %d", ret);
                                return -1;
                        } else {
-                               media_content_debug("media count [%d] : %d\n", i, count);
+                               media_content_debug("media count [%d] : %d", i, count);
                        }
                }
        }
@@ -782,14 +1028,28 @@ int test_gallery_scenario(void)
 
        media_content_collation_e collate_type = MEDIA_CONTENT_COLLATE_NOCASE;
        media_content_order_e order_type = MEDIA_CONTENT_ORDER_DESC;
-       media_filter_create(&filter);
-       //media_filter_set_condition(filter, "MEDIA_TYPE = 0", collate_type);
-       media_filter_set_order(filter, order_type, MEDIA_DISPLAY_NAME, collate_type);
-       //media_filter_set_collate(filter, collate_type);
+       ret = media_filter_create(&filter);
+       if(ret != MEDIA_CONTENT_ERROR_NONE) {
+               media_content_error("Fail to create filter");
+               return ret;
+       }
+       ret = media_filter_set_condition(filter, "MEDIA_TYPE = 0", collate_type);
+       if(ret != MEDIA_CONTENT_ERROR_NONE) {
+               media_filter_destroy(filter);
+               media_content_error("Fail to set condition");
+               return ret;
+       }
+       ret = media_filter_set_order(filter, order_type, MEDIA_DISPLAY_NAME, collate_type);
+       if(ret != MEDIA_CONTENT_ERROR_NONE) {
+               media_filter_destroy(filter);
+               media_content_error("Fail to set order");
+               return ret;
+       }
 
        ret = media_info_foreach_media_from_db(filter, gallery_media_item_cb, &all_item_list);
-       if(ret < 0) {
+       if(ret != MEDIA_CONTENT_ERROR_NONE) {
                media_content_error("media_info_foreach_media_from_db failed: %d", ret);
+               media_filter_destroy(filter);
                return -1;
        } else {
                media_content_debug("media_info_foreach_media_from_db success");
@@ -801,62 +1061,98 @@ int test_gallery_scenario(void)
                for(i = 0; i < g_list_length(all_item_list); i++) {
                        media_handle = (media_info_h)g_list_nth_data(all_item_list, i);
 
-                       media_info_get_media_id(media_handle, &media_id);
-                       media_info_get_media_type(media_handle, &media_type);
-                       media_info_get_display_name(media_handle, &media_name);
-                       media_info_get_file_path(media_handle, &media_path);
+                       ret = media_info_get_media_id(media_handle, &media_id);
+                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                               media_content_error("media_info_get_media_id failed: %d", ret);
+                       ret = media_info_get_media_type(media_handle, &media_type);
+                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                               media_content_error("media_info_get_media_type failed: %d", ret);
+                       ret = media_info_get_display_name(media_handle, &media_name);
+                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                               media_content_error("media_info_get_display_name failed: %d", ret);
+                       ret = media_info_get_file_path(media_handle, &media_path);
+                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                               media_content_error("media_info_get_file_path failed: %d", ret);
 
                        if(media_type == MEDIA_CONTENT_TYPE_IMAGE) {
                                image_meta_h image_handle;
-                               int width, height;
-                               media_content_orientation_e orientation;
-                               char *datetaken;
+                               int width = 0, height = 0;
+                               media_content_orientation_e orientation = 0;
+                               char *datetaken = NULL;
+                               char *burst_id = NULL;
 
                                ret = media_info_get_image(media_handle, &image_handle);
-                               if(ret < 0) {
+                               if(ret != MEDIA_CONTENT_ERROR_NONE) {
                                        media_content_error("media_info_get_image failed: %d", ret);
                                } else {
-                                       image_meta_get_width(image_handle, &width);
-                                       image_meta_get_height(image_handle, &height);
-                                       image_meta_get_orientation(image_handle, &orientation);
-                                       image_meta_get_date_taken(image_handle, &datetaken);
-
-                                       media_content_debug("This is Image\n");
-                                       media_content_debug("Width : %d, Height : %d, Orientation : %d, Date taken : %s\n", width, height, orientation, datetaken);
+                                       ret = image_meta_get_width(image_handle, &width);
+                                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                               media_content_error("error image_meta_get_width : [%d]", ret);
+                                       ret = image_meta_get_height(image_handle, &height);
+                                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                               media_content_error("error image_meta_get_height : [%d]", ret);
+                                       ret = image_meta_get_orientation(image_handle, &orientation);
+                                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                               media_content_error("error image_meta_get_orientation : [%d]", ret);
+                                       ret = image_meta_get_date_taken(image_handle, &datetaken);
+                                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                               media_content_error("error image_meta_get_date_taken : [%d]", ret);
+                                       ret = image_meta_get_burst_id(image_handle, &burst_id);
+                                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                               media_content_error("error image_meta_get_burst_id : [%d]", ret);
+
+                                       media_content_debug("This is Image");
+                                       media_content_debug("Width : %d, Height : %d, Orientation : %d, Date taken : %s", width, height, orientation, datetaken);
                                }
 
                                SAFE_FREE(datetaken);
-                               image_meta_destroy(image_handle);
+                               SAFE_FREE(burst_id);
+                               ret = image_meta_destroy(image_handle);
+                               if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                       media_content_error("error image_meta_destroy : [%d]", ret);
 
                        } else if(media_type == MEDIA_CONTENT_TYPE_VIDEO) {
                                video_meta_h video_handle;
-                               char *title, *artist, *album;
-                               int duration;
-                               time_t time_played;
+                               char *title = NULL, *artist = NULL, *album = NULL, *album_artist = NULL;
+                               int duration = 0;
+                               time_t time_played = 0;
 
                                ret = media_info_get_video(media_handle, &video_handle);
-                               if(ret < 0) {
+                               if(ret != MEDIA_CONTENT_ERROR_NONE) {
                                        media_content_error("media_info_get_video failed: %d", ret);
                                } else {
-                                       video_meta_get_title(video_handle, &title);
-                                       video_meta_get_artist(video_handle, &artist);
-                                       video_meta_get_album(video_handle, &album);
-                                       video_meta_get_duration(video_handle, &duration);
-                                       video_meta_get_played_time(video_handle, &time_played);
-
-                                       media_content_debug("This is Video\n");
-                                       media_content_debug("Title: %s, Album: %s, Artist: %s\nDuration: %d, Played time: %d\n", title, artist, album, duration, time_played);
+                                       ret = video_meta_get_artist(video_handle, &artist);
+                                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                               media_content_error("error video_meta_get_artist : [%d]", ret);
+                                       ret = video_meta_get_album(video_handle, &album);
+                                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                               media_content_error("error video_meta_get_album : [%d]", ret);
+                                       ret = video_meta_get_album_artist(video_handle, &album_artist);
+                                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                               media_content_error("error video_meta_get_album_artist : [%d]", ret);
+                                       ret = video_meta_get_duration(video_handle, &duration);
+                                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                               media_content_error("error video_meta_get_duration : [%d]", ret);
+                                       ret = video_meta_get_played_time(video_handle, &time_played);
+                                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                               media_content_error("error video_meta_get_played_time : [%d]", ret);
+
+                                       media_content_debug("This is Video");
+                                       media_content_debug("Title: %s, Album: %s, Artist: %s, Album_artist: %s \n Duration: %d, Played time: %d", title, album, artist, album_artist, duration, time_played);
                                }
 
                                SAFE_FREE(title);
                                SAFE_FREE(artist);
                                SAFE_FREE(album);
+                               SAFE_FREE(album_artist);
 
-                               video_meta_destroy(video_handle);
+                               ret = video_meta_destroy(video_handle);
+                               if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                       media_content_error("error video_meta_destroy : [%d]", ret);
                        }
-                       //media_content_debug("media_id [%d] : %s\n", i, media_id);
-                       //media_content_debug("media_name [%d] : %s\n", i, media_name);
-                       //media_content_debug("media_path [%d] : %s\n", i, media_path);
+                       //media_content_debug("media_id [%d] : %s", i, media_id);
+                       //media_content_debug("media_name [%d] : %s", i, media_name);
+                       //media_content_debug("media_path [%d] : %s", i, media_path);
 
                        SAFE_FREE(media_id);
                        SAFE_FREE(media_name);
@@ -870,15 +1166,15 @@ int test_gallery_scenario(void)
        /* To check performance */
        gettimeofday(&end, NULL);
        long time = (end.tv_sec * 1000000 + end.tv_usec) - (start.tv_sec * 1000000 + start.tv_usec);
-       printf("Time : %ld\n", time);
+       media_content_debug("Time : %ld\n", time);
 
        /* Third, Get item list of a folder */
        GList *item_list = NULL;
 
        for(i = 0; i < g_list_length(folder_list); i++) {
-               int j;
-               char *folder_name;
-               char *folder_id;
+               int j = 0;
+               char *folder_id = NULL;
+               char *folder_name = NULL;
                folder_handle = (media_folder_h)g_list_nth_data(folder_list, i);
 
                media_folder_get_folder_id(folder_handle, &folder_id);
@@ -888,7 +1184,7 @@ int test_gallery_scenario(void)
                SAFE_FREE(folder_id);
                SAFE_FREE(folder_name);
 
-               if(ret < 0) {
+               if(ret != MEDIA_CONTENT_ERROR_NONE) {
                        media_content_error("media_folder_foreach_media_from_db failed: %d", ret);
                        return -1;
                } else {
@@ -901,84 +1197,120 @@ int test_gallery_scenario(void)
                        for(j = 0; j < g_list_length(item_list); j++) {
                                media_handle = (media_info_h)g_list_nth_data(item_list, j);
 
-                               media_info_get_media_id(media_handle, &media_id);
-                               media_info_get_display_name(media_handle, &media_name);
-                               media_info_get_file_path(media_handle, &media_path);
-                               media_info_get_media_type(media_handle, &media_type);
-
-                               media_content_debug("[%s] media_id [%d] : %s\n", folder_name, j, media_id);
-                               media_content_debug("[%s] media_type [%d] : %d\n", folder_name, j, media_type);
-                               media_content_debug("[%s] media_name [%d] : %s\n", folder_name, j, media_name);
-                               media_content_debug("[%s] media_path [%d] : %s\n", folder_name, j, media_path);
+                               ret = media_info_get_media_id(media_handle, &media_id);
+                               if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                       media_content_error("media_info_get_media_id failed: %d", ret);
+                               ret = media_info_get_display_name(media_handle, &media_name);
+                               if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                       media_content_error("media_info_get_display_name failed: %d", ret);
+                               ret = media_info_get_file_path(media_handle, &media_path);
+                               if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                       media_content_error("media_info_get_file_path failed: %d", ret);
+                               ret = media_info_get_media_type(media_handle, &media_type);
+                               if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                       media_content_error("media_info_get_media_type failed: %d", ret);
+
+                               media_content_debug("[%s] media_id [%d] : %s", folder_name, j, media_id);
+                               media_content_debug("[%s] media_type [%d] : %d", folder_name, j, media_type);
+                               media_content_debug("[%s] media_name [%d] : %s", folder_name, j, media_name);
+                               media_content_debug("[%s] media_path [%d] : %s", folder_name, j, media_path);
 
                                if(media_type == MEDIA_CONTENT_TYPE_IMAGE) {
                                        image_meta_h image_handle;
-                                       int width, height;
-                                       media_content_orientation_e orientation;
-                                       char *datetaken;
+                                       int width = 0, height = 0;
+                                       media_content_orientation_e orientation = 0;
+                                       char *datetaken = NULL;
 
                                        ret = media_info_get_image(media_handle, &image_handle);
-                                       if(ret < 0) {
+                                       if(ret != MEDIA_CONTENT_ERROR_NONE) {
                                                media_content_error("media_info_get_image failed: %d", ret);
                                        } else {
-                                               image_meta_get_width(image_handle, &width);
-                                               image_meta_get_height(image_handle, &height);
-                                               image_meta_get_orientation(image_handle, &orientation);
-                                               image_meta_get_date_taken(image_handle, &datetaken);
-
-                                               media_content_debug("This is Image\n");
-                                               media_content_debug("Width : %d, Height : %d, Orientation : %d, Date taken : %s\n", width, height, orientation, datetaken);
+                                               ret = image_meta_get_width(image_handle, &width);
+                                               if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                                       media_content_error("error image_meta_get_width : [%d]", ret);
+                                               ret = image_meta_get_height(image_handle, &height);
+                                               if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                                       media_content_error("error image_meta_get_height : [%d]", ret);
+                                               ret = image_meta_get_orientation(image_handle, &orientation);
+                                               if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                                       media_content_error("error image_meta_get_orientation : [%d]", ret);
+                                               ret = image_meta_get_date_taken(image_handle, &datetaken);
+                                               if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                                       media_content_error("error image_meta_get_date_taken : [%d]", ret);
+
+                                               media_content_debug("This is Image");
+                                               media_content_debug("Width : %d, Height : %d, Orientation : %d, Date taken : %s", width, height, orientation, datetaken);
                                        }
 
                                        SAFE_FREE(datetaken);
-                                       image_meta_destroy(image_handle);
+                                       ret = image_meta_destroy(image_handle);
+                                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                               media_content_error("error image_meta_destroy : [%d]", ret);
 
                                } else if(media_type == MEDIA_CONTENT_TYPE_VIDEO) {
                                        video_meta_h video_handle;
-                                       char *title, *artist, *album;
-                                       int duration;
+                                       char *title = NULL, *artist = NULL, *album = NULL, *album_artist = NULL;;
+                                       int duration = 0;
                                        time_t time_played;
 
                                        ret = media_info_get_video(media_handle, &video_handle);
-                                       if(ret < 0) {
+                                       if(ret != MEDIA_CONTENT_ERROR_NONE) {
                                                media_content_error("media_info_get_video failed: %d", ret);
                                        } else {
-                                               video_meta_get_title(video_handle, &title);
-                                               video_meta_get_artist(video_handle, &artist);
-                                               video_meta_get_album(video_handle, &album);
-                                               video_meta_get_duration(video_handle, &duration);
-                                               video_meta_get_played_time(video_handle, &time_played);
-
-                                               media_content_debug("This is Video\n");
-                                               media_content_debug("Title: %s, Album: %s, Artist: %s\nDuration: %d, Played time: %d\n", title, artist, album, duration, time_played);
+                                               ret = video_meta_get_artist(video_handle, &artist);
+                                               if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                                       media_content_error("error video_meta_get_artist : [%d]", ret);
+                                               ret = video_meta_get_album(video_handle, &album);
+                                               if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                                       media_content_error("error video_meta_get_album : [%d]", ret);
+                                               ret = video_meta_get_album_artist(video_handle, &album_artist);
+                                               if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                                       media_content_error("error video_meta_get_album_artist : [%d]", ret);
+                                               ret = video_meta_get_duration(video_handle, &duration);
+                                               if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                                       media_content_error("error video_meta_get_duration : [%d]", ret);
+                                               ret = video_meta_get_played_time(video_handle, &time_played);
+                                               if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                                       media_content_error("error video_meta_get_played_time : [%d]", ret);
+
+                                               media_content_debug("This is Video");
+                                               media_content_debug("Title: %s, Album: %s, Artist: %s, Album_artist: %s \n Duration: %d, Played time: %d\n", title, album, artist, album_artist, duration, time_played);
                                        }
 
                                        SAFE_FREE(title);
                                        SAFE_FREE(artist);
                                        SAFE_FREE(album);
+                                       SAFE_FREE(album_artist);
 
-                                       video_meta_destroy(video_handle);
+                                       ret = video_meta_destroy(video_handle);
+                                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                               media_content_error("error video_meta_destroy : [%d]", ret);
 
                                        /* Get bookmar list in case of video */
                                        media_bookmark_h bm_handle;
                                        GList *bm_list = NULL;
 
                                        ret = media_info_foreach_bookmark_from_db(media_id, filter, gallery_bookmarks_cb, &bm_list);
-                                       if(ret < 0) {
+                                       if(ret != MEDIA_CONTENT_ERROR_NONE) {
                                                media_content_error("media_info_foreach_bookmark_from_db failed: %d", ret);
                                        } else {
-                                               media_content_error("media_info_foreach_bookmark_from_db success");
-                                               int k;
+                                               media_content_debug("media_info_foreach_bookmark_from_db success");
+
+                                               int k = 0;
 
                                                for(k = 0; k < g_list_length(bm_list); k++) {
                                                        bm_handle = (media_bookmark_h)g_list_nth_data(bm_list, k);
                                                        time_t marked_time;
                                                        char *thumb_path = NULL;
 
-                                                       media_bookmark_get_marked_time(bm_handle, &marked_time);
-                                                       media_bookmark_get_thumbnail_path(bm_handle, &thumb_path);
+                                                       ret = media_bookmark_get_marked_time(bm_handle, &marked_time);
+                                                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                                               media_content_error("error media_bookmark_get_marked_time : [%d]", ret);
+                                                       ret = media_bookmark_get_thumbnail_path(bm_handle, &thumb_path);
+                                                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                                               media_content_error("error media_bookmark_get_thumbnail_path : [%d]", ret);
 
-                                                       media_content_error("Bookmark time : %d\nBookmar thumb: %s\n", marked_time, thumb_path);
+                                                       media_content_debug("Bookmark time : %d\nBookmar thumb: %s", marked_time, thumb_path);
                                                        SAFE_FREE(thumb_path);
                                                }
 
@@ -987,7 +1319,9 @@ int test_gallery_scenario(void)
                                                if(bm_list) {
                                                        for(l = 0; l < g_list_length(bm_list); l++) {
                                                                bm_handle = (media_bookmark_h)g_list_nth_data(bm_list, l);
-                                                               media_bookmark_destroy(bm_handle);
+                                                               ret = media_bookmark_destroy(bm_handle);
+                                                               if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                                                       media_content_error("error media_bookmark_destroy : [%d]", ret);
                                                        }
 
                                                        g_list_free(bm_list);
@@ -1010,12 +1344,12 @@ int test_gallery_scenario(void)
 
        ret = media_tag_foreach_tag_from_db (filter, gallery_tag_item_cb, &tag_list);
 
-       if(ret < 0) {
+       if(ret != MEDIA_CONTENT_ERROR_NONE) {
                media_content_error("media_tag_foreach_tag_from_db failed: %d", ret);
                return -1;
        } else {
                media_content_error("media_tag_foreach_tag_from_db success");
-               char *tag_name;
+               char *tag_name = NULL;
                int tag_id;
 
                for(i = 0; i < g_list_length(tag_list); i++) {
@@ -1023,10 +1357,10 @@ int test_gallery_scenario(void)
                        media_tag_get_tag_id(tag_handle, &tag_id);
                        media_tag_get_name(tag_handle, &tag_name);
 
-                       printf("[%d] %s", tag_id, tag_name);
+                       media_content_debug("[%d] %s", tag_id, tag_name);
 
                        ret = media_tag_foreach_media_from_db(tag_id, filter, gallery_media_item_cb, &media_list_in_tag);
-                       if(ret < 0) {
+                       if(ret != MEDIA_CONTENT_ERROR_NONE) {
                                media_content_error("media_tag_foreach_media_from_db failed: %d", ret);
                                return -1;
                        } else {
@@ -1040,15 +1374,23 @@ int test_gallery_scenario(void)
 
                                for(j = 0; j < g_list_length(media_list_in_tag); j++) {
                                        tag_media_handle = (media_info_h)g_list_nth_data(media_list_in_tag, j);
-                                       media_info_get_media_id(tag_media_handle, &media_id);
-                                       media_info_get_display_name(tag_media_handle, &media_name);
-                                       media_info_get_file_path(tag_media_handle, &media_path);
-                                       media_info_get_media_type(tag_media_handle, &media_type);
-
-                                       media_content_debug("[%s] media_id [%d] : %s\n", tag_name, j, media_id);
-                                       media_content_debug("[%s] media_type [%d] : %d\n", tag_name, j, media_type);
-                                       media_content_debug("[%s] media_name [%d] : %s\n", tag_name, j, media_name);
-                                       media_content_debug("[%s] media_path [%d] : %s\n", tag_name, j, media_path);
+                                       ret = media_info_get_media_id(tag_media_handle, &media_id);
+                                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                               media_content_error("media_info_get_media_id failed: %d", ret);
+                                       ret = media_info_get_display_name(tag_media_handle, &media_name);
+                                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                               media_content_error("media_info_get_display_name failed: %d", ret);
+                                       ret = media_info_get_file_path(tag_media_handle, &media_path);
+                                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                               media_content_error("media_info_get_file_path failed: %d", ret);
+                                       ret = media_info_get_media_type(tag_media_handle, &media_type);
+                                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                                               media_content_error("media_info_get_media_type failed: %d", ret);
+
+                                       media_content_debug("[%s] media_id [%d] : %s", tag_name, j, media_id);
+                                       media_content_debug("[%s] media_type [%d] : %d", tag_name, j, media_type);
+                                       media_content_debug("[%s] media_name [%d] : %s", tag_name, j, media_name);
+                                       media_content_debug("[%s] media_path [%d] : %s", tag_name, j, media_path);
                                }
                                SAFE_FREE(media_id);
                                SAFE_FREE(media_name);
@@ -1072,7 +1414,9 @@ int test_gallery_scenario(void)
        if(all_item_list) {
                for(i = 0; i < g_list_length(all_item_list); i++) {
                        media_handle = (media_info_h)g_list_nth_data(all_item_list, i);
-                       media_info_destroy(media_handle);
+                       ret = media_info_destroy(media_handle);
+                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                               media_content_error("media_info_destroy failed: %d", ret);
                }
 
                g_list_free(all_item_list);
@@ -1082,7 +1426,9 @@ int test_gallery_scenario(void)
        if(item_list) {
                for(i = 0; i < g_list_length(item_list); i++) {
                        media_handle = (media_info_h)g_list_nth_data(item_list, i);
-                       media_info_destroy(media_handle);
+                       ret = media_info_destroy(media_handle);
+                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                               media_content_error("media_info_destroy failed: %d", ret);
                }
 
                g_list_free(item_list);
@@ -1092,7 +1438,9 @@ int test_gallery_scenario(void)
        if(tag_list) {
                for(i = 0; i < g_list_length(tag_list); i++) {
                        tag_handle = (media_tag_h)g_list_nth_data(tag_list, i);
-                       media_tag_destroy(tag_handle);
+                       ret = media_tag_destroy(tag_handle);
+                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                               media_content_error("error media_tag_destroy : [%d]", ret);
                }
 
                g_list_free(tag_list);
@@ -1102,7 +1450,9 @@ int test_gallery_scenario(void)
        if(media_list_in_tag) {
                for(i = 0; i < g_list_length(media_list_in_tag); i++) {
                        media_handle = (media_info_h)g_list_nth_data(media_list_in_tag, i);
-                       media_info_destroy(media_handle);
+                       ret = media_info_destroy(media_handle);
+                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                               media_content_error("media_info_destroy failed: %d", ret);
                }
 
                g_list_free(media_list_in_tag);
@@ -1123,17 +1473,19 @@ int test_get_all_music_files(void)
 
        ret = media_filter_create(&filter);
        if(ret != MEDIA_CONTENT_ERROR_NONE) {
-               media_content_error("Fail to create filter \n");
+               media_content_error("Fail to create filter");
                return ret;
        }
-       ret = media_filter_set_condition(filter, condition, MEDIA_CONTENT_COLLATE_DEFAULT);
+       ret = media_filter_set_condition(filter, condition, MEDIA_CONTENT_COLLATE_LOCALIZED);
        if(ret != MEDIA_CONTENT_ERROR_NONE) {
-               media_content_error("Fail to set condition \n");
+               media_filter_destroy(filter);
+               media_content_error("Fail to set condition");
                return ret;
        }
-       ret = media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_TITLE, MEDIA_CONTENT_COLLATE_NOCASE);
+       ret = media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_TITLE, MEDIA_CONTENT_COLLATE_LOCALIZED);
        if(ret != MEDIA_CONTENT_ERROR_NONE) {
-               media_content_error("Fail to set order \n");
+               media_filter_destroy(filter);
+               media_content_error("Fail to set order");
                return ret;
        }
 
@@ -1141,19 +1493,21 @@ int test_get_all_music_files(void)
        ret = media_info_get_media_count_from_db(filter, &media_count);
        if(ret != MEDIA_CONTENT_ERROR_NONE) {
                media_filter_destroy(filter);
-               media_content_error("Fail to get media count \n");
+               media_content_error("Fail to get media count");
                return ret;
        }
 
-       media_content_debug("media_count : [%d],\n", media_count);
+       media_content_debug("media_count : [%d]", media_count);
 
        ret = media_info_foreach_media_from_db(filter, media_item_cb, NULL);
        if(ret != MEDIA_CONTENT_ERROR_NONE) {
                media_filter_destroy(filter);
-               media_content_error("Fail to get media \n");
+               media_content_error("Fail to get media");
                return ret;
        }
 
+       ret = media_filter_destroy(filter);
+
        return ret;
 }
 
@@ -1166,15 +1520,17 @@ int test_media_info_operation(void)
 
        test_filter_create();
 
-       media_info_get_media_count_from_db(g_filter, &media_count);
-       media_content_debug("media_count : [%d],\n", media_count);
+       ret = media_info_get_media_count_from_db(g_filter, &media_count);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("media_info_get_media_count_from_db failed: %d", ret);
+       else
+               media_content_debug("media_count : [%d]", media_count);
 
        ret = media_info_foreach_media_from_db(g_filter, media_item_cb, NULL);
-
        if(ret == MEDIA_CONTENT_ERROR_NONE)
-               media_content_debug("media_info_foreach_media_from_db is success\n\n");
+               media_content_debug("media_info_foreach_media_from_db is success");
        else
-               media_content_error("media_info_foreach_media_from_db is failed\n\n");
+               media_content_error("media_info_foreach_media_from_db is failed");
 
        test_filter_destroy();
 
@@ -1198,17 +1554,21 @@ int test_media_info_operation_2(void)
 
        media_info_get_bookmark_count_from_db(test_video_id, g_filter_g, &bookmark_count);
 
-       media_content_debug("bookmark_count : [%d],\n", bookmark_count);
+       media_content_debug("bookmark_count : [%d]", bookmark_count);
 
        ret = media_info_foreach_bookmark_from_db(test_video_id, g_filter_g, bookmarks_cb, NULL);
 #endif
 
        /* Tag */
-       media_info_get_tag_count_from_db(test_audio_id, g_filter_g, &bookmark_count);
-
-       media_content_debug("tag_count : [%d],\n", bookmark_count);
+       ret = media_info_get_tag_count_from_db(test_audio_id, g_filter_g, &bookmark_count);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("media_info_get_tag_count_from_db failed: %d", ret);
+       else
+               media_content_debug("tag_count : [%d]", bookmark_count);
 
        ret = media_info_foreach_tag_from_db(test_audio_id, g_filter_g, tag_list_cb, NULL);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("media_info_foreach_tag_from_db failed: %d", ret);
 
        test_filter_destroy();
 
@@ -1230,7 +1590,7 @@ int test_folder_operation(void)
        ret = media_filter_create(&filter);
        if(ret != MEDIA_CONTENT_ERROR_NONE)
        {
-               media_content_error("[ERROR] media_folder_filter_create is failed\n");
+               media_content_error("[ERROR] media_folder_filter_create is failed");
                return ret;
        }
 
@@ -1248,7 +1608,9 @@ int test_folder_operation(void)
        ret = media_filter_create(&m_filter);
        if(ret != MEDIA_CONTENT_ERROR_NONE)
        {
-               media_content_error("[ERROR] media_info_filter_create is failed\n");
+               test_filter_destroy();
+               media_filter_destroy(filter);
+               media_content_error("[ERROR] media_info_filter_create is failed");
                return ret;
        }
 
@@ -1263,13 +1625,84 @@ int test_folder_operation(void)
 
        if(ret != MEDIA_CONTENT_ERROR_NONE)
        {
-               media_content_error("[ERROR] media_folder_foreach_media_from_db is failed, error code : %d\n", ret);
+               media_content_error("[ERROR] media_folder_foreach_media_from_db is failed, error code : %d", ret);
        }
 
        media_filter_destroy(filter);
        media_filter_destroy(m_filter);
 
-       test_filter_create();
+       test_filter_destroy();
+
+       /* fix prevent: Resource Leak */
+       SAFE_FREE(folder_id);
+
+       return ret;
+}
+
+bool folder_update_cb(media_folder_h folder, void *user_data)
+{
+       char *folder_id = NULL;
+       char *folder_path = NULL;
+       char *folder_name = NULL;
+       bool ret = true;
+
+       if(folder != NULL)
+       {
+               ret = media_folder_get_folder_id(folder, &folder_id);
+               media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+               media_content_debug("folder_id = [%s]", folder_id);
+               SAFE_FREE(folder_id);
+
+               ret = media_folder_get_path(folder, &folder_path);
+               media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+               media_content_debug("folder_path = [%s]", folder_path);
+               SAFE_FREE(folder_path);
+
+               ret = media_folder_get_name(folder, &folder_name);
+               media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+               media_content_debug("folder_name = [%s]", folder_name);
+               SAFE_FREE(folder_name);
+
+               ret = media_folder_clone(&g_folder, folder);
+               media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+               ret = true;
+       }
+       else
+       {
+               ret = false;
+       }
+
+       return ret;
+}
+
+
+int test_folder_update(void)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       filter_h filter;
+       int folder_count = 0;
+
+       media_content_debug("\n============Folder Update Test============\n\n");
+
+       ret = media_filter_create(&filter);
+       media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       media_filter_set_condition(filter, "MEDIA_TYPE=0 and MEDIA_STORAGE_TYPE=0", MEDIA_CONTENT_COLLATE_DEFAULT);     /*MEDIA_TYPE 0-image, 1-video, 2-sound, 3-music, 4-other*/
+
+       ret = media_folder_get_folder_count_from_db(filter, &folder_count);
+
+       media_content_debug("Folder count : %d", folder_count);
+
+       ret = media_folder_foreach_folder_from_db(filter, folder_update_cb, NULL);
+
+       media_filter_destroy(filter);
+
+       ret = media_folder_set_name(g_folder, "test_folder");
+
+       ret = media_folder_update_to_db(g_folder);
+
+       ret = media_folder_destroy(g_folder);
 
        return ret;
 }
@@ -1301,13 +1734,10 @@ int test_playlist_operation(void)
        /* Filter for playlist */
 
        char *condition = "(MEDIA_TYPE=1 or MEDIA_TYPE=3)";     /*0-image, 1-video, 2-sound, 3-music, 4-other*/
-#if 0
-       ret = media_filter_create(&filter);
 
+       ret = media_filter_create(&filter);
        ret = media_filter_set_condition(filter, condition, MEDIA_CONTENT_COLLATE_NOCASE);
-
        ret = media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, PLAYLIST_NAME, MEDIA_CONTENT_COLLATE_NOCASE);
-#endif
 
        /* Create Playlist */
        media_playlist_insert_to_db(playlist_name_1, &playlist_1);
@@ -1320,6 +1750,12 @@ int test_playlist_operation(void)
                media_playlist_add_media(playlist_1, test_audio_id);
                media_playlist_add_media(playlist_1, test_audio_id);
                media_playlist_add_media(playlist_1, test_video_id);
+
+               #if 0
+               char *playlist_thumb_path = "/opt/usr/media/Images/Default.jpg";
+               media_playlist_set_thumbnail_path(playlist_1, playlist_thumb_path);
+               #endif
+
                media_playlist_update_to_db(playlist_1);
        }
 
@@ -1331,8 +1767,9 @@ int test_playlist_operation(void)
        }
 
        /* Get Playlist Count*/
-       media_playlist_get_playlist_count_from_db(filter, &playlist_count);
-       media_content_debug("playlist_count [%d] \n", playlist_count);
+       ret = media_playlist_get_playlist_count_from_db(filter, &playlist_count);
+       if (ret == 0)
+               media_content_debug("playlist_count [%d]", playlist_count);
 
        /* Get Playlist*/
        GList *playlist_id_list = NULL;
@@ -1342,9 +1779,9 @@ int test_playlist_operation(void)
        playlist_id_1 = (int)g_list_nth_data(playlist_id_list, 0);
        playlist_id_2 = (int)g_list_nth_data(playlist_id_list, 1);
        playlist_id_3 = (int)g_list_nth_data(playlist_id_list, 2);
-       media_content_debug("playlist_id_1 [%d] \n", playlist_id_1);
-       media_content_debug("playlist_id_2 [%d] \n", playlist_id_2);
-       media_content_debug("playlist_id_3 [%d] \n", playlist_id_3);
+       media_content_debug("playlist_id_1 [%d]", playlist_id_1);
+       media_content_debug("playlist_id_2 [%d]", playlist_id_2);
+       media_content_debug("playlist_id_3 [%d]", playlist_id_3);
 
        /* Filter for media*/
        ret = media_filter_create(&m_filter);
@@ -1355,13 +1792,13 @@ int test_playlist_operation(void)
 
        /* Get media count */
        media_playlist_get_media_count_from_db(playlist_id_1, m_filter, &media_count);
-       media_content_debug("playlist_1_media_count [%d] \n", media_count);
+       media_content_debug("playlist_1_media_count [%d]", media_count);
 
        media_playlist_get_media_count_from_db(playlist_id_2, m_filter, &media_count);
-       media_content_debug("playlist_2_media_count [%d] \n", media_count);
+       media_content_debug("playlist_2_media_count [%d]", media_count);
 
        media_playlist_get_media_count_from_db(playlist_id_3, m_filter, &media_count);
-       media_content_debug("playlist_3_media_count [%d] \n", media_count);
+       media_content_debug("playlist_3_media_count [%d]", media_count);
 
        /* Get media of playlist */
        GList *playlist_member_id_list = NULL;
@@ -1382,18 +1819,18 @@ int test_playlist_operation(void)
        playlist_member_id_2_1 = (int)g_list_nth_data(playlist_member_id_list_1, 0);
        playlist_member_id_2_2 = (int)g_list_nth_data(playlist_member_id_list_1, 1);
 
-       media_content_debug("playlist_member_id_1_1 [%d] \n", playlist_member_id_1_1);
-       media_content_debug("playlist_member_id_1_2 [%d] \n", playlist_member_id_1_2);
-       media_content_debug("playlist_member_id_1_3 [%d] \n", playlist_member_id_1_3);
-       media_content_debug("playlist_member_id_2_1 [%d] \n", playlist_member_id_2_1);
-       media_content_debug("playlist_member_id_2_2 [%d] \n", playlist_member_id_2_2);
+       media_content_debug("playlist_member_id_1_1 [%d]", playlist_member_id_1_1);
+       media_content_debug("playlist_member_id_1_2 [%d]", playlist_member_id_1_2);
+       media_content_debug("playlist_member_id_1_3 [%d]", playlist_member_id_1_3);
+       media_content_debug("playlist_member_id_2_1 [%d]", playlist_member_id_2_1);
+       media_content_debug("playlist_member_id_2_2 [%d]", playlist_member_id_2_2);
 
        media_playlist_get_play_order(playlist_1, playlist_member_id_1_1, &order_1);
        media_playlist_get_play_order(playlist_1, playlist_member_id_1_2, &order_2);
        media_playlist_get_play_order(playlist_1, playlist_member_id_1_3, &order_3);
        media_playlist_get_play_order(playlist_2, playlist_member_id_2_1, &order_4);
        media_playlist_get_play_order(playlist_2, playlist_member_id_2_2, &order_5);
-       media_content_debug("order_1 [%d] order_2 [%d] order_3 [%d] order_4 [%d] order_5 [%d]\n", order_1, order_2, order_3, order_4, order_5);
+       media_content_debug("order_1 [%d] order_2 [%d] order_3 [%d] order_4 [%d] order_5 [%d]", order_1, order_2, order_3, order_4, order_5);
 
        /* Update Playlist */
        media_playlist_remove_media(playlist_2, playlist_member_id_2_1);
@@ -1455,62 +1892,120 @@ int test_tag_operation(void)
        ret = media_filter_set_order(filter, MEDIA_CONTENT_ORDER_DESC, TAG_NAME, MEDIA_CONTENT_COLLATE_DEFAULT);
 
        /* Create Tag */
-       media_tag_insert_to_db(tag_name_1, &tag_1);
-       media_tag_insert_to_db(tag_name_2, &tag_2);
-       media_tag_insert_to_db(tag_name_3, &tag_3);
+       ret = media_tag_insert_to_db(tag_name_1, &tag_1);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_insert_to_db : [%d]", ret);
+       ret = media_tag_insert_to_db(tag_name_2, &tag_2);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_insert_to_db : [%d]", ret);
+       ret = media_tag_insert_to_db(tag_name_3, &tag_3);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_insert_to_db : [%d]", ret);
 
        /* Add media to Tag */
-       media_tag_add_media(tag_1, test_audio_id);
-       media_tag_add_media(tag_1, test_video_id);
-       media_tag_update_to_db(tag_1);
+       ret = media_tag_add_media(tag_1, test_audio_id);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_add_media : [%d]", ret);
+       ret = media_tag_add_media(tag_1, test_video_id);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_add_media : [%d]", ret);
+       ret = media_tag_update_to_db(tag_1);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_update_to_db : [%d]", ret);
 
-       media_tag_add_media(tag_2, test_audio_id);
-       media_tag_update_to_db(tag_2);
+       ret = media_tag_add_media(tag_2, test_audio_id);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_add_media : [%d]", ret);
+       ret = media_tag_update_to_db(tag_2);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_update_to_db : [%d]", ret);
 
        /* Get Tag Count*/
-       media_tag_get_tag_count_from_db(filter, &tag_count);
-       media_content_debug("tag_count [%d] \n", tag_count);
+       ret = media_tag_get_tag_count_from_db(filter, &tag_count);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_get_tag_count_from_db : [%d]", ret);
+       else
+               media_content_debug("tag_count [%d]", tag_count);
 
        /* Get Tag*/
-       media_tag_foreach_tag_from_db(filter, tag_list_cb, NULL);
+       ret = media_tag_foreach_tag_from_db(filter, tag_list_cb, NULL);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_foreach_tag_from_db : [%d]", ret);
 
        /* Get Tag id*/
-       media_tag_get_tag_id(tag_1, &tag_id_1);
-       media_content_debug("tag_id_1 [%d] \n", tag_id_1);
+       ret = media_tag_get_tag_id(tag_1, &tag_id_1);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_get_tag_id : [%d]", ret);
+       else
+               media_content_debug("tag_id_1 [%d]", tag_id_1);
 
-       media_tag_get_tag_id(tag_2, &tag_id_2);
-       media_content_debug("tag_id_2 [%d] \n", tag_id_2);
+       ret = media_tag_get_tag_id(tag_2, &tag_id_2);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_get_tag_id : [%d]", ret);
+       else
+               media_content_debug("tag_id_2 [%d]", tag_id_2);
 
-       media_tag_get_tag_id(tag_3, &tag_id_3);
-       media_content_debug("tag_id_3 [%d] \n", tag_id_3);
+       ret = media_tag_get_tag_id(tag_3, &tag_id_3);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_get_tag_id : [%d]", ret);
+       else
+               media_content_debug("tag_id_3 [%d]", tag_id_3);
 
        /* Get media count */
-       media_tag_get_media_count_from_db(tag_id_1, NULL, &media_count);
-       media_content_debug("tag_1_media_count [%d] \n", media_count);
+       ret = media_tag_get_media_count_from_db(tag_id_1, NULL, &media_count);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_get_media_count_from_db : [%d]", ret);
+       else
+               media_content_debug("tag_1_media_count [%d]", media_count);
 
-       media_tag_get_media_count_from_db(tag_id_2, NULL, &media_count);
-       media_content_debug("tag_2_media_count [%d] \n", media_count);
+       ret = media_tag_get_media_count_from_db(tag_id_2, NULL, &media_count);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_get_media_count_from_db : [%d]", ret);
+       else
+               media_content_debug("tag_2_media_count [%d]", media_count);
 
        /* Get media of Tag */
-       media_tag_foreach_media_from_db(tag_id_1, NULL, media_item_cb, NULL);
-       media_tag_foreach_media_from_db(tag_id_2, NULL, media_item_cb, NULL);
+       ret = media_tag_foreach_media_from_db(tag_id_1, NULL, media_item_cb, NULL);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_foreach_media_from_db : [%d]", ret);
+
+       ret = media_tag_foreach_media_from_db(tag_id_2, NULL, media_item_cb, NULL);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_foreach_media_from_db : [%d]", ret);
 
        /* Update Tag */
-       media_tag_add_media(tag_2, test_video_id);
-       media_tag_set_name(tag_2, "test_tag");
-       media_tag_update_to_db(tag_2);
+       ret = media_tag_add_media(tag_2, test_video_id);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_add_media : [%d]", ret);
+       ret = media_tag_set_name(tag_2, "test_tag");
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_set_name : [%d]", ret);
+       ret = media_tag_update_to_db(tag_2);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_update_to_db : [%d]", ret);
 
        /* Get Updated Tag*/
-       media_tag_foreach_tag_from_db(filter, tag_list_cb, NULL);
+       ret = media_tag_foreach_tag_from_db(filter, tag_list_cb, NULL);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_foreach_tag_from_db : [%d]", ret);
 
        /* deletes the tag */
-       media_tag_delete_from_db(tag_id_1);
-       media_tag_delete_from_db(tag_id_2);
-
-       media_tag_destroy(tag_1);
-       media_tag_destroy(tag_2);
+       ret = media_tag_delete_from_db(tag_id_1);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_delete_from_db : [%d]", ret);
+       ret = media_tag_delete_from_db(tag_id_2);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_delete_from_db : [%d]", ret);
 
+       ret = media_tag_destroy(tag_1);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_destroy : [%d]", ret);
+       ret = media_tag_destroy(tag_2);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_tag_destroy : [%d]", ret);
        ret = media_filter_destroy(filter);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_filter_destroy : [%d]", ret);
 
        return ret;
 }
@@ -1528,20 +2023,36 @@ int test_bookmark_operation(void)
        char *g_condition = "BOOKMARK_MARKED_TIME > 300";
 
        ret = media_filter_create(&filter);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_filter_create : [%d]", ret);
 
        ret = media_filter_set_condition(filter, g_condition, MEDIA_CONTENT_COLLATE_DEFAULT);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_filter_set_condition : [%d]", ret);
 
        ret = media_filter_set_order(filter, MEDIA_CONTENT_ORDER_DESC, BOOKMARK_MARKED_TIME, MEDIA_CONTENT_COLLATE_DEFAULT);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_filter_set_order : [%d]", ret);
 
        //insert bookmark to video
-       char *thumbnail_path1 = "/opt/media/Images and videos/My video clips/teat11.jpg";
-       media_bookmark_insert_to_db(test_video_id, 400, thumbnail_path1);
-       media_bookmark_insert_to_db(test_video_id, 600, thumbnail_path1);
+       char *thumbnail_path1 = "/opt/usr/media/Images and videos/My video clips/teat11.jpg";
+       ret = media_bookmark_insert_to_db(test_video_id, 400, thumbnail_path1);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_bookmark_insert_to_db : [%d]", ret);
 
-       media_bookmark_get_bookmark_count_from_db(filter, &bookmark_count);
-       media_content_debug("bookmark_count = [%d]\n", bookmark_count);
+       ret = media_bookmark_insert_to_db(test_video_id, 600, thumbnail_path1);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_bookmark_insert_to_db : [%d]", ret);
 
-       media_filter_destroy(filter);
+       ret = media_bookmark_get_bookmark_count_from_db(filter, &bookmark_count);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_bookmark_get_bookmark_count_from_db : [%d]", ret);
+       else
+               media_content_debug("bookmark_count = [%d]", bookmark_count);
+
+       ret = media_filter_destroy(filter);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_filter_destroy : [%d]", ret);
 
        return ret;
 }
@@ -1559,17 +2070,19 @@ int test_album_list(void)
 
        ret = media_filter_create(&filter);
        if(ret != MEDIA_CONTENT_ERROR_NONE) {
-               media_content_error("Fail to create filter \n");
+               media_content_error("Fail to create filter");
                return ret;
        }
        ret = media_filter_set_condition(filter, condition, MEDIA_CONTENT_COLLATE_DEFAULT);
        if(ret != MEDIA_CONTENT_ERROR_NONE) {
-               media_content_error("Fail to set condition \n");
+               media_filter_destroy(filter);
+               media_content_error("Fail to set condition");
                return ret;
        }
        ret = media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_ALBUM, MEDIA_CONTENT_COLLATE_NOCASE);
        if(ret != MEDIA_CONTENT_ERROR_NONE) {
-               media_content_error("Fail to set order \n");
+               media_filter_destroy(filter);
+               media_content_error("Fail to set order");
                return ret;
        }
 
@@ -1578,12 +2091,16 @@ int test_album_list(void)
                media_filter_destroy(filter);
                return ret;
        } else {
-               media_content_debug("album_count [%d] \n", album_count);
+               media_content_debug("album_count [%d]", album_count);
        }
 
        ret = media_album_foreach_album_from_db(filter, album_list_cb, NULL);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_album_foreach_album_from_db : [%d]", ret);
 
        ret = media_filter_destroy(filter);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("error media_filter_destroy : [%d]", ret);
 
        return ret;
 }
@@ -1598,11 +2115,11 @@ int test_group_operation(void)
 
        ret = test_filter_create();
        if(ret != MEDIA_CONTENT_ERROR_NONE) {
-               media_content_error("[%d]error(0x%08x)", __LINE__, ret);
+               media_content_error("[error(0x%08x)", ret);
                return ret;
        }
 
-       for(idx = 0; idx <= MEDIA_CONTENT_GROUP_KEYWORD; idx++)
+       for(idx = 0; idx < MEDIA_CONTENT_GROUP_MAX; idx++)
        {
                ret = media_group_get_group_count_from_db(g_filter, idx, &group_count);
                if(ret != MEDIA_CONTENT_ERROR_NONE) {
@@ -1610,7 +2127,7 @@ int test_group_operation(void)
                        media_content_error("media_group_get_group_count_from_db fail. idx=[%d]", ret, idx);
                        return ret;
                } else {
-                       media_content_debug("[%2d]group_count [%d] \n", idx, group_count);
+                       media_content_debug("[%2d]group_count [%d]", idx, group_count);
                }
 
                ret = media_group_foreach_group_from_db(g_filter, idx, group_list_cb, &idx);
@@ -1629,7 +2146,7 @@ int test_update_operation()
 
        /* Get all item list */
        ret = media_info_foreach_media_from_db(NULL, gallery_media_item_cb, &all_item_list);
-       if(ret < 0) {
+       if(ret != MEDIA_CONTENT_ERROR_NONE) {
                media_content_error("media_info_foreach_media_from_db failed: %d", ret);
                return -1;
        } else {
@@ -1641,20 +2158,26 @@ int test_update_operation()
                for(i = 0; i < g_list_length(all_item_list); i++) {
                        media_handle = (media_info_h)g_list_nth_data(all_item_list, i);
 
-                       media_info_get_media_id(media_handle, &media_id);
-                       media_info_get_file_path(media_handle, &media_path);
-                       media_info_get_media_type(media_handle, &media_type);
-
-                       media_content_debug("media_id [%d] : %s\n", i, media_id);
-                       media_content_debug("media_type [%d] : %d\n", i, media_type);
-                       media_content_debug("media_path [%d] : %s\n", i, media_path);
+                       ret = media_info_get_media_id(media_handle, &media_id);
+                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                               media_content_error("media_info_get_media_id failed: %d", ret);
+                       ret = media_info_get_file_path(media_handle, &media_path);
+                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                               media_content_error("media_info_get_file_path failed: %d", ret);
+                       ret = media_info_get_media_type(media_handle, &media_type);
+                       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                               media_content_error("media_info_get_media_type failed: %d", ret);
+
+                       media_content_debug("media_id [%d] : %s", i, media_id);
+                       media_content_debug("media_type [%d] : %d", i, media_type);
+                       media_content_debug("media_path [%d] : %s", i, media_path);
 #if 0
                        if(media_type == MEDIA_CONTENT_TYPE_IMAGE) {
                                image_meta_h image_handle;
                                media_content_orientation_e orientation;
 
                                ret = media_info_get_image(media_handle, &image_handle);
-                               if(ret < 0) {
+                               if(ret != MEDIA_CONTENT_ERROR_NONE) {
                                        media_content_error("media_info_get_image failed: %d", ret);
                                } else {
                                        media_content_debug("media_info_get_image success");
@@ -1664,7 +2187,7 @@ int test_update_operation()
                                        image_meta_set_orientation(image_handle, orientation);
 
                                        ret = image_meta_update_to_db(image_handle);
-                                       if(ret < 0) {
+                                       if(ret != MEDIA_CONTENT_ERROR_NONE) {
                                                media_content_error("image_meta_update_to_db failed: %d", ret);
                                        } else {
                                                media_content_debug("image_meta_update_to_db success");
@@ -1675,7 +2198,7 @@ int test_update_operation()
                                video_meta_h video_handle;
 
                                ret = media_info_get_video(media_handle, &video_handle);
-                               if(ret < 0) {
+                               if(ret != MEDIA_CONTENT_ERROR_NONE) {
                                        media_content_error("media_info_get_video failed: %d", ret);
                                } else {
                                        media_content_debug("media_info_get_video success");
@@ -1687,7 +2210,7 @@ int test_update_operation()
                                        video_meta_update_to_db(video_handle);
 
                                        ret = video_meta_update_to_db(video_handle);
-                                       if(ret < 0) {
+                                       if(ret != MEDIA_CONTENT_ERROR_NONE) {
                                                media_content_error("video_meta_update_to_db failed: %d", ret);
                                        } else {
                                                media_content_debug("video_meta_update_to_db success");
@@ -1696,7 +2219,7 @@ int test_update_operation()
                        } else if(media_type == MEDIA_CONTENT_TYPE_MUSIC) {//update audio meta
                                audio_meta_h audio_handle = NULL;
                                ret = media_info_get_audio(media_handle, &audio_handle);
-                               if(ret < 0) {
+                               if(ret != MEDIA_CONTENT_ERROR_NONE) {
                                        media_content_error("media_info_get_audio failed: %d", ret);
                                } else {
                                        media_content_debug("media_info_get_audio success");
@@ -1706,7 +2229,7 @@ int test_update_operation()
                                        audio_meta_set_played_position(audio_handle,180);
 
                                        ret = audio_meta_update_to_db(audio_handle);
-                                       if(ret < 0) {
+                                       if(ret != MEDIA_CONTENT_ERROR_NONE) {
                                                media_content_error("audio_meta_update_to_db failed: %d", ret);
                                        } else {
                                                media_content_debug("audio_meta_update_to_db success");
@@ -1716,6 +2239,10 @@ int test_update_operation()
                        }
 #endif
                }
+
+               /* fix prevent: Resource Leak */
+               SAFE_FREE(media_id);
+               SAFE_FREE(media_path);
        }
 
        return MEDIA_CONTENT_ERROR_NONE;
@@ -1724,30 +2251,44 @@ int test_update_operation()
 int test_insert(void)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       //char *path = "/opt/media/Images/Default.jpg";
-       char *path = "/opt/media/Others/other.txt";
+       char *path = "/opt/usr/media/Images/Default.jpg";
+       //char *path = "/opt/usr/media/Others/other.txt";
        //char *path = NULL;
        media_info_h media_item = NULL;
        media_content_debug("\n============DB Insert Test============\n\n");
 
        ret = media_info_insert_to_db(path, &media_item);
 
-       if(ret == MEDIA_CONTENT_ERROR_NONE)
-               media_content_debug("Insertion is success\n\n");
+       if((ret == MEDIA_CONTENT_ERROR_NONE) && (media_item != NULL))
+       {
+               media_content_debug("Insertion is success");
+       }
        else
-               media_content_error("Insertion is failed\n\n");
+       {
+               media_content_error("Insertion is failed");
+               ret = media_info_destroy(media_item);
+               return ret;
+       }
 
        char *media_id = NULL;
 
-       media_info_get_media_id(media_item, &media_id);
+       ret = media_info_get_media_id(media_item, &media_id);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("media_info_get_media_id failed: %d", ret);
+       else
+               media_content_debug("Media ID: %s", media_id);
 
-       printf("Media ID: %s\n", media_id);
+       SAFE_FREE(media_id);
 
        ret = media_info_update_to_db(media_item);
        if(ret == MEDIA_CONTENT_ERROR_NONE)
-               media_content_debug("media_info_update_to_db is success\n");
+               media_content_debug("media_info_update_to_db is success");
        else
-               media_content_error("media_info_update_to_db is failed\n");
+               media_content_error("media_info_update_to_db is failed");
+
+       ret = media_info_destroy(media_item);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("media_info_destroy failed: %d", ret);
 
        return ret;
 }
@@ -1756,14 +2297,14 @@ int test_move(void)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
        const char *move_media_id = "60aea677-4742-408e-b5f7-f2628062d06d";
-       char *dst_path = "/opt/media/Images/XX/Default1.jpg";
+       char *dst_path = "/opt/usr/media/Images/XX/Default1.jpg";
        media_info_h move_media = NULL;
 
        ret = media_info_get_media_from_db(move_media_id, &move_media);
        if(ret == MEDIA_CONTENT_ERROR_NONE)
-               media_content_debug("media_info_get_media_from_db success\n\n");
+               media_content_debug("media_info_get_media_from_db success");
        else
-               media_content_error("media_info_get_media_from_db failed: %d\n\n", ret);
+               media_content_error("media_info_get_media_from_db failed: %d", ret);
 
        media_content_debug("\n============DB Move Test============\n\n");
 
@@ -1771,11 +2312,13 @@ int test_move(void)
                ret = media_info_move_to_db(move_media, dst_path);
 
                if(ret == MEDIA_CONTENT_ERROR_NONE)
-                       media_content_debug("Move is success\n\n");
+                       media_content_debug("Move is success");
                else
-                       media_content_error("Move is failed\n\n");
+                       media_content_error("Move is failed");
+
+               ret = media_info_destroy(move_media);
        } else {
-               media_content_debug("There is no item : %s\n", move_media_id);
+               media_content_debug("There is no item : %s", move_media_id);
        }
 
        return ret;
@@ -1784,18 +2327,24 @@ int test_move(void)
 void thumbnail_completed_cb(media_content_error_e error, const char *path, void *user_data)
 {
        char *thumbnail_path = NULL;
+       int ret = MEDIA_CONTENT_ERROR_NONE;
        g_cnt++;
 
-       printf("=================[%d][%d]\n", g_media_cnt, g_cnt);
-       printf("error_code [%d]\n", error);
-       printf("thumbnail_path [%s]\n", path);
+       media_content_debug("=================[%d][%d]", g_media_cnt, g_cnt);
+       media_content_debug("error_code [%d]", error);
+       media_content_debug("thumbnail_path [%s]", path);
        if(user_data != NULL)
        {
                media_info_h media = (media_info_h)user_data;
-               media_info_get_thumbnail_path(media, &thumbnail_path);
-               printf("thumbnail_path get from media[%s]\n", thumbnail_path);
+               ret = media_info_get_thumbnail_path(media, &thumbnail_path);
+               if(ret != MEDIA_CONTENT_ERROR_NONE)
+                       media_content_error("media_info_get_thumbnail_path failed: %d", ret);
+               else
+                       media_content_debug("thumbnail_path get from media[%s]", thumbnail_path);
                SAFE_FREE(thumbnail_path);
-               media_info_destroy(media);
+               ret = media_info_destroy(media);
+               if(ret != MEDIA_CONTENT_ERROR_NONE)
+                       media_content_error("media_info_destroy failed: %d", ret);
        }
 
        if(g_cnt == g_media_cnt)
@@ -1808,18 +2357,74 @@ bool thumbnail_create_cb(media_info_h media, void *user_data)
 {
        char *media_id = NULL;
        media_info_h dst = NULL;
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+
+       if(media == NULL)
+       {
+               media_content_debug("NO Item");
+               return true;
+       }
+
+       ret = media_info_get_media_id(media, &media_id);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("media_info_get_media_id failed: %d", ret);
+       else
+               media_content_debug("media_id : [%s]", media_id);
+
+       ret = media_info_clone(&dst, media);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("media_info_clone failed: %d", ret);
+       else
+       {
+               ret = media_info_create_thumbnail(dst, thumbnail_completed_cb, dst);
+               if(ret != MEDIA_CONTENT_ERROR_NONE)
+                       media_content_error("media_info_create_thumbnail failed: %d", ret);
+       }
+
+       /* fix prevent: Resource leak */
+       SAFE_FREE(media_id);
+
+       return true;
+}
+
+bool thumbnail_cancel_cb(media_info_h media, void *user_data)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+
+       char *media_id = NULL;
+       media_info_h dst = NULL;
+
+       g_cnt++;
 
        if(media == NULL)
        {
-               media_content_debug("NO Item \n");
+               media_content_debug("NO Item");
                return true;
        }
 
-       media_info_get_media_id(media, &media_id);
-       media_content_debug("media_id : [%s] \n", media_id);
+       ret = media_info_get_media_id(media, &media_id);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("media_info_get_media_id failed: %d", ret);
+       else
+               media_content_debug("media_id : [%s]", media_id);
+
+       ret = media_info_clone(&dst, media);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("media_info_clone failed: %d", ret);
+
+       ret = media_info_cancel_thumbnail(dst);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("media_info_cancel_thumbnail failed: %d", ret);
 
-       media_info_clone(&dst, media);
-       media_info_create_thumbnail(dst, thumbnail_completed_cb, dst);
+       ret = media_info_destroy(dst);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+                       media_content_error("media_info_destroy failed: %d", ret);
+
+       if(g_cnt == g_media_cnt)
+               g_main_loop_quit(g_loop);
+
+       /* fix prevent: Resource leak */
+       SAFE_FREE(media_id);
 
        return true;
 }
@@ -1831,14 +2436,28 @@ gboolean create_thumbnail_start(gpointer data)
        ret = media_info_foreach_media_from_db(g_filter, thumbnail_create_cb, NULL);
 
        if(ret == MEDIA_CONTENT_ERROR_NONE)
-               media_content_debug("media_info_foreach_media_from_db is success\n\n");
+               media_content_debug("media_info_foreach_media_from_db is success");
        else
-               media_content_error("media_info_foreach_media_from_db is failed\n\n");
+               media_content_error("media_info_foreach_media_from_db is failed");
 
        return false;
 }
 
-int test_create_thumbnail(void)
+gboolean cancel_thumbnail_start(gpointer data)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+
+       ret = media_info_foreach_media_from_db(g_filter, thumbnail_cancel_cb, NULL);
+
+       if(ret == MEDIA_CONTENT_ERROR_NONE)
+               media_content_debug("media_info_foreach_media_from_db is success");
+       else
+               media_content_error("media_info_foreach_media_from_db is failed");
+
+       return false;
+}
+
+int test_create_thumbnail(int cancel)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
        GSource *source = NULL;
@@ -1846,8 +2465,11 @@ int test_create_thumbnail(void)
 
        test_filter_create();
 
-       media_info_get_media_count_from_db(g_filter, &g_media_cnt);
-       media_content_debug("media_count : [%d],\n", g_media_cnt);
+       ret = media_info_get_media_count_from_db(g_filter, &g_media_cnt);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("media_info_get_media_count_from_db failed: %d", ret);
+       else
+               media_content_debug("media_count : [%d]", g_media_cnt);
 
        g_loop = g_main_loop_new(NULL, FALSE);
        context = g_main_loop_get_context(g_loop);
@@ -1855,6 +2477,14 @@ int test_create_thumbnail(void)
        g_source_set_callback (source, create_thumbnail_start, NULL, NULL);
        g_source_attach (source, context);
 
+       /* Logic to cancel */
+       if (cancel) {
+               GSource *cancel_src = NULL;
+               cancel_src = g_idle_source_new();
+               g_source_set_callback (cancel_src, cancel_thumbnail_start, NULL, NULL);
+               g_source_attach (cancel_src, context);
+       }
+
        g_main_loop_run(g_loop);
        g_main_loop_unref(g_loop);
 
@@ -1871,9 +2501,37 @@ int test_disconnect_database(void)
        ret = media_content_disconnect();
 
        if(ret == MEDIA_CONTENT_ERROR_NONE)
-               media_content_debug("disconnection is success\n\n");
+               media_content_debug("disconnection is success");
+       else
+               media_content_error("disconnection is failed");
+
+       return ret;
+}
+
+int test_request_update_db(void)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       media_info_h media = NULL;
+
+       //get the content of Over the horizon
+       ret = media_info_get_media_from_db("0f999626-6218-450c-a4ad-181a3bab6ebf", &media);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("media_info_get_media_from_db failed: %d", ret);
+
+       test_disconnect_database();
+
+       ret = media_info_set_content_name(media, "TEST_content_name");
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("media_info_set_content_name failed: %d", ret);
+
+       ret = media_info_update_to_db(media);
+       if(ret == MEDIA_CONTENT_ERROR_NONE)
+               media_content_debug("media_info_update_to_db is success");
        else
-               media_content_error("disconnection is failed\n\n");
+               media_content_error("media_info_update_to_db is failed");
+
+       if(media != NULL)
+               media_info_destroy(media);
 
        return ret;
 }
@@ -1888,15 +2546,22 @@ bool dft_cb(media_info_h media, void *user_data)
        unsigned long long file_size = 0;
        media_content_type_e media_type = -1;
        char *mime_type = NULL;
+       int ret = MEDIA_CONTENT_ERROR_NONE;
 
        if(media == NULL)
        {
                return true;
        }
 
-       media_info_get_media_type(media, &media_type);
-       media_info_get_size(media, &file_size);
-       media_info_get_mime_type(media, &mime_type);
+       ret = media_info_get_media_type(media, &media_type);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("media_info_get_media_type failed: %d", ret);
+       ret = media_info_get_size(media, &file_size);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("media_info_get_size failed: %d", ret);
+       ret = media_info_get_mime_type(media, &mime_type);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               media_content_error("media_info_get_mime_type failed: %d", ret);
 
        if(media_type == MEDIA_CONTENT_TYPE_IMAGE)
        {
@@ -1923,7 +2588,7 @@ bool dft_cb(media_info_h media, void *user_data)
        }
        else
        {
-               printf("invalid media_type\n");
+               media_content_debug("invalid media_type");
        }
 
        if(mime_type != NULL)
@@ -1936,7 +2601,7 @@ bool dft_cb(media_info_h media, void *user_data)
 int DFT_test(void)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       printf("\n============DFT_test============\n\n");
+       media_content_debug("\n============DFT_test============\n\n");
 
        filter_h filter = NULL;
        int media_cnt = 0;
@@ -1946,50 +2611,50 @@ int DFT_test(void)
        ret = media_filter_create(&filter);
 
 /*Internal Memory*/
-       printf("[Internal Memory]\n");
+       media_content_debug("[Internal Memory]\n");
        /*1. Photo ============================================================*/
        ret = media_filter_set_condition(filter, "MEDIA_STORAGE_TYPE=0 AND MEDIA_TYPE=0", MEDIA_CONTENT_COLLATE_DEFAULT);
 
        /*Get Photo Count*/
        ret = media_info_get_media_count_from_db(filter, &media_cnt);
-       printf("Photo count = [%d]\n", media_cnt);
+       media_content_debug("Photo count = [%d]\n", media_cnt);
 
        /*Get Photo Size*/
        ret = media_info_foreach_media_from_db(filter, dft_cb, NULL);
-       printf("Photo size = [%d]\n", g_total_photo_size);
+       media_content_debug("Photo size = [%d]\n", g_total_photo_size);
 
        /*2. Video ============================================================*/
        ret = media_filter_set_condition(filter, "MEDIA_STORAGE_TYPE=0 AND MEDIA_TYPE=1", MEDIA_CONTENT_COLLATE_DEFAULT);
 
        /*Get Video Count*/
        ret = media_info_get_media_count_from_db(filter, &media_cnt);
-       printf("Video count = [%d]\n", media_cnt);
+       media_content_debug("Video count = [%d]\n", media_cnt);
 
        /*Get Video Size*/
        ret = media_info_foreach_media_from_db(filter, dft_cb, NULL);
-       printf("Video size = [%d]\n", g_total_video_size);
+       media_content_debug("Video size = [%d]\n", g_total_video_size);
 
        /*3. MP3 ============================================================*/
        ret = media_filter_set_condition(filter, "MEDIA_STORAGE_TYPE=0 AND MEDIA_TYPE=3 AND MEDIA_MIME_TYPE=\"audio/mpeg\"", MEDIA_CONTENT_COLLATE_DEFAULT);
 
        /*Get MP3 Count*/
        ret = media_info_get_media_count_from_db(filter, &media_cnt);
-       printf("MP3 count = [%d]\n", media_cnt);
+       media_content_debug("MP3 count = [%d]\n", media_cnt);
 
        /*Get MP3 Size*/
        ret = media_info_foreach_media_from_db(filter, dft_cb, NULL);
-       printf("MP3 size = [%d]\n", g_total_mp3_size);
+       media_content_debug("MP3 size = [%d]\n", g_total_mp3_size);
 
        /*4. Voice Memo ============================================================*/
        ret = media_filter_set_condition(filter, "MEDIA_STORAGE_TYPE=0 AND (MEDIA_MIME_TYPE=\"audio/AMR\" OR MEDIA_MIME_TYPE=\"audio/mp4\")", MEDIA_CONTENT_COLLATE_DEFAULT);
 
        /*Get Voice Memo Count*/
        ret = media_info_get_media_count_from_db(filter, &media_cnt);
-       printf("Voice Memo count = [%d]\n", media_cnt);
+       media_content_debug("Voice Memo count = [%d]\n", media_cnt);
 
        /*Get Voice Memo Size*/
        ret = media_info_foreach_media_from_db(filter, dft_cb, NULL);
-       printf("Voice Memo size = [%d]\n", g_total_voice_memo_size);
+       media_content_debug("Voice Memo size = [%d]\n", g_total_voice_memo_size);
 
        g_total_photo_size = 0;
        g_total_video_size = 0;
@@ -1997,55 +2662,344 @@ int DFT_test(void)
        g_total_voice_memo_size = 0;
 
 /*External Memory*/
-       printf("\n[External Memory]\n");
+       media_content_debug("\n[External Memory]\n");
        /*1. Photo ============================================================*/
        ret = media_filter_set_condition(filter, "MEDIA_STORAGE_TYPE=1 AND MEDIA_TYPE=0", MEDIA_CONTENT_COLLATE_DEFAULT);
 
        /*Get Photo Count*/
        ret = media_info_get_media_count_from_db(filter, &media_cnt);
-       printf("Photo count = [%d]\n", media_cnt);
+       media_content_debug("Photo count = [%d]\n", media_cnt);
 
        /*Get Photo Size*/
        ret = media_info_foreach_media_from_db(filter, dft_cb, NULL);
-       printf("Photo size = [%d]\n", g_total_photo_size);
+       media_content_debug("Photo size = [%d]\n", g_total_photo_size);
 
        /*2. Video ============================================================*/
        ret = media_filter_set_condition(filter, "MEDIA_STORAGE_TYPE=1 AND MEDIA_TYPE=1", MEDIA_CONTENT_COLLATE_DEFAULT);
 
        /*Get Video Count*/
        ret = media_info_get_media_count_from_db(filter, &media_cnt);
-       printf("Video count = [%d]\n", media_cnt);
+       media_content_debug("Video count = [%d]\n", media_cnt);
 
        /*Get Video Size*/
        ret = media_info_foreach_media_from_db(filter, dft_cb, NULL);
-       printf("Video size = [%d]\n", g_total_video_size);
+       media_content_debug("Video size = [%d]\n", g_total_video_size);
 
        /*3. MP3 ============================================================*/
        ret = media_filter_set_condition(filter, "MEDIA_STORAGE_TYPE=1 AND MEDIA_TYPE=3 AND MEDIA_MIME_TYPE=\"audio/mpeg\"", MEDIA_CONTENT_COLLATE_DEFAULT);
 
        /*Get MP3 Count*/
        ret = media_info_get_media_count_from_db(filter, &media_cnt);
-       printf("MP3 count = [%d]\n", media_cnt);
+       media_content_debug("MP3 count = [%d]\n", media_cnt);
 
        /*Get MP3 Size*/
        ret = media_info_foreach_media_from_db(filter, dft_cb, NULL);
-       printf("MP3 size = [%d]\n", g_total_mp3_size);
+       media_content_debug("MP3 size = [%d]\n", g_total_mp3_size);
 
        /*4. Voice Memo ============================================================*/
        ret = media_filter_set_condition(filter, "MEDIA_STORAGE_TYPE=1 AND (MEDIA_MIME_TYPE=\"audio/AMR\" OR MEDIA_MIME_TYPE=\"audio/mp4\")", MEDIA_CONTENT_COLLATE_DEFAULT);
 
        /*Get Voice Memo Count*/
        ret = media_info_get_media_count_from_db(filter, &media_cnt);
-       printf("Voice Memo count = [%d]\n", media_cnt);
+       media_content_debug("Voice Memo count = [%d]\n", media_cnt);
 
        /*Get Voice Memo Size*/
        ret = media_info_foreach_media_from_db(filter, dft_cb, NULL);
-       printf("Voice Memo size = [%d]\n", g_total_voice_memo_size);
+       media_content_debug("Voice Memo size = [%d]\n", g_total_voice_memo_size);
+       ret = media_filter_destroy(filter);
+
+       return ret;
+}
+
+void insert_batch_cb(media_content_error_e error, void * user_data)
+{
+       media_content_debug("media_info_insert_batch_to_db completed!\n");
+}
+
+int test_batch_operations()
+{
+       int ret = -1;
+       int i;
+       char *file_list[10];
+
+       for (i = 0; i < 10; i++) {
+               char filepath[255] = {0,};
+               snprintf(filepath, sizeof(filepath), "%s%d.jpg", "/opt/usr/media/test/image", i+1);
+               media_content_debug("File : %s\n", filepath);
+               file_list[i] = strdup(filepath);
+       }
+
+       ret = media_info_insert_batch_to_db((const char **)file_list, 10, insert_batch_cb, NULL);
+       if(ret != MEDIA_CONTENT_ERROR_NONE) {
+               media_content_error("media_info_insert_batch_to_db failed : %d\n", ret);
+       }
+
+       filter_h filter;
+       char *condition = "MEDIA_PATH LIKE \'/opt/usr/media/test/image%%jpg\'";
+
+       ret = media_filter_create(&filter);
+       if(ret != MEDIA_CONTENT_ERROR_NONE) {
+               media_content_error("Fail to create filter");
+               return ret;
+       }
+
+       ret = media_filter_set_condition(filter, condition, MEDIA_CONTENT_COLLATE_DEFAULT);
+       if(ret != MEDIA_CONTENT_ERROR_NONE) {
+               media_filter_destroy(filter);
+               media_content_error("Fail to set condition");
+               return ret;
+       }
+
+       ret = media_info_delete_batch_from_db(filter);
+       if(ret != MEDIA_CONTENT_ERROR_NONE) {
+               media_filter_destroy(filter);
+               media_content_error("media_info_delete_batch_from_db failed : %d\n", ret);
+               return ret;
+       }
+
        ret = media_filter_destroy(filter);
 
+       return ret;
+}
+
+void insert_burst_shot_cb(media_content_error_e error, void * user_data)
+{
+       media_content_debug("media_info_insert_burst_shot_to_db completed![%d]\n", error);
+       g_main_loop_quit(g_loop);
+}
+
+gboolean test_insert_burst_shot_to_db_start(gpointer data)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       int i = 0;
+       char *file_list[10];
+
+       for (i = 0; i < 10; i++) {
+               char filepath[255] = {0,};
+               snprintf(filepath, sizeof(filepath), "%s%d.jpg", "/opt/usr/media/test/image", i+1);
+               media_content_debug("File : %s\n", filepath);
+               file_list[i] = strdup(filepath);
+       }
+
+       ret = media_info_insert_burst_shot_to_db((const char **)file_list, 10, insert_burst_shot_cb, NULL);
+       if(ret != MEDIA_CONTENT_ERROR_NONE) {
+               media_content_error("media_info_insert_burst_shot_to_db failed : %d\n", ret);
+       }
+
+       return ret;
+}
+
+int test_insert_burst_shot_to_db(void)
+{
+       GSource *source = NULL;
+       GMainContext *context = NULL;
+
+       g_loop = g_main_loop_new(NULL, FALSE);
+       context = g_main_loop_get_context(g_loop);
+       source = g_idle_source_new();
+       g_source_set_callback (source, test_insert_burst_shot_to_db_start, NULL, NULL);
+       g_source_attach (source, context);
+
+       g_main_loop_run(g_loop);
+       g_main_loop_unref(g_loop);
+
+       return 0;
+}
+
+void _scan_cb(media_content_error_e err, void *user_data)
+{
+       media_content_debug("scan callback is called : %d\n", err);
+       g_main_loop_quit(g_loop);
+
+       return;
+}
+
+int test_scan_file()
+{
+       int ret = -1;
+
+       const char *file_path = "/opt/usr/media/test/image1.jpg";
+
+       ret = media_content_scan_file(file_path);
+       if(ret != MEDIA_CONTENT_ERROR_NONE) {
+               media_content_error("Fail to media_content_scan_file : %d", ret);
+               return ret;
+       }
+
        return 0;
 }
 
+gboolean test_scan_dir_start(gpointer data)
+{
+       int ret = -1;
+
+       const char *dir_path = "/opt/usr/media";
+
+       ret = media_content_scan_folder(dir_path, TRUE, _scan_cb, NULL);
+
+       if(ret != MEDIA_CONTENT_ERROR_NONE) {
+               media_content_error("Fail to test_scan_dir_start : %d", ret);
+               return ret;
+       }
+
+       return 0;
+}
+
+int test_scan_dir()
+{
+       GSource *source = NULL;
+       GMainContext *context = NULL;
+
+       g_loop = g_main_loop_new(NULL, FALSE);
+       context = g_main_loop_get_context(g_loop);
+       source = g_idle_source_new();
+       g_source_set_callback (source, test_scan_dir_start, NULL, NULL);
+       g_source_attach (source, context);
+
+       g_main_loop_run(g_loop);
+       g_main_loop_unref(g_loop);
+
+       return 0;
+}
+
+void _noti_cb(media_content_error_e error,
+                               int pid,
+                               media_content_db_update_item_type_e update_item,
+                               media_content_db_update_type_e update_type,
+                               media_content_type_e media_type,
+                               char *uuid,
+                               char *path,
+                               char *mime_type,
+                               void *user_data)
+{
+       if (error == 0) {
+               media_content_debug("noti success! : %d\n", error);
+       } else {
+               media_content_debug("error occured! : %d\n", error);
+       }
+
+       media_content_debug("Noti from PID(%d)\n", pid);
+
+       if (update_item == MEDIA_ITEM_FILE) {
+               media_content_debug("Noti item : MEDIA_ITEM_FILE\n");
+       } else if (update_item == MEDIA_ITEM_DIRECTORY) {
+               media_content_debug("Noti item : MEDIA_ITEM_DIRECTORY\n");
+       }
+
+       if (update_type == MEDIA_CONTENT_INSERT) {
+               media_content_debug("Noti type : MEDIA_CONTENT_INSERT\n");
+       } else if (update_type == MEDIA_CONTENT_DELETE) {
+               media_content_debug("Noti type : MEDIA_CONTENT_DELETE\n");
+       } else if (update_type == MEDIA_CONTENT_UPDATE) {
+               media_content_debug("Noti type : MEDIA_CONTENT_UPDATE\n");
+       }
+
+       media_content_debug("content type : %d\n", media_type);
+
+       if (path)
+               media_content_debug("path : %s\n", path);
+       else
+               media_content_debug("path not\n");
+
+       if (uuid)
+               media_content_debug("uuid : %s\n", uuid);
+       else
+               media_content_debug("uuid not\n");
+
+       if (mime_type)
+               media_content_debug("mime_type : %s\n", mime_type);
+       else
+               media_content_debug("mime not\n");
+
+       if (user_data) media_content_debug("String : %s\n", (char *)user_data);
+
+       //g_main_loop_quit(g_loop);
+       return;
+}
+
+gboolean _send_noti_operations(gpointer data)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+
+       /* First of all, noti subscription */
+       char *user_str = strdup("hi");
+       media_content_set_db_updated_cb(_noti_cb, (void*)user_str);
+
+       /* media_info_insert_to_db */
+       media_info_h media_item = NULL;
+       char *path = "/opt/usr/media/test/image1.jpg";
+
+       ret = media_info_insert_to_db(path, &media_item);
+       if (ret != MEDIA_CONTENT_ERROR_NONE) {
+               media_content_error("media_info_insert_to_db failed : %d", ret);
+               media_info_destroy(media_item);
+               return FALSE;
+       }
+
+       media_content_debug("media_info_insert_to_db success");
+
+       /* media_info_delete_batch_from_db */
+       filter_h filter;
+       char *condition = "MEDIA_PATH LIKE \'/opt/usr/media/test/image%%jpg\'";
+
+       ret = media_filter_create(&filter);
+       if(ret != MEDIA_CONTENT_ERROR_NONE) {
+               media_content_error("Fail to create filter");
+               media_info_destroy(media_item);
+               return ret;
+       }
+
+       ret = media_filter_set_condition(filter, condition, MEDIA_CONTENT_COLLATE_DEFAULT);
+       if(ret != MEDIA_CONTENT_ERROR_NONE) {
+               media_filter_destroy(filter);
+               media_info_destroy(media_item);
+               media_content_error("Fail to set condition");
+               return ret;
+       }
+       ret = media_info_delete_batch_from_db(filter);
+       if(ret != MEDIA_CONTENT_ERROR_NONE) {
+               media_filter_destroy(filter);
+               media_info_destroy(media_item);
+               media_content_error("media_info_delete_batch_from_db failed : %d\n", ret);
+               return ret;
+       }
+
+       media_filter_destroy(filter);
+
+       /* media_info_update_to_db */
+       ret = media_info_update_to_db(media_item);
+       if(ret != MEDIA_CONTENT_ERROR_NONE) {
+               media_content_error("media_info_update_to_db failed : %d\n", ret);
+               media_info_destroy(media_item);
+               return ret;
+       }
+
+       media_info_destroy(media_item);
+
+       return FALSE;
+}
+
+int test_noti()
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       GSource *source = NULL;
+       GMainContext *context = NULL;
+
+       g_loop = g_main_loop_new(NULL, FALSE);
+       context = g_main_loop_get_context(g_loop);
+       source = g_idle_source_new();
+       g_source_set_callback (source, _send_noti_operations, NULL, NULL);
+       g_source_attach (source, context);
+
+       g_main_loop_run(g_loop);
+       g_main_loop_unref(g_loop);
+
+       test_filter_destroy();
+       media_content_unset_db_updated_cb();
+
+       return ret;
+}
+
 int main(int argc, char *argv[])
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
@@ -2077,6 +3031,10 @@ int main(int argc, char *argv[])
        if(ret != MEDIA_CONTENT_ERROR_NONE)
                return ret;
 
+       ret = test_folder_update();
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               return ret;
+
        ret = test_playlist_operation();
        if(ret != MEDIA_CONTENT_ERROR_NONE)
                return ret;
@@ -2109,13 +3067,37 @@ int main(int argc, char *argv[])
        if(ret != MEDIA_CONTENT_ERROR_NONE)
                return ret;
 
-       ret = test_create_thumbnail();
+       ret = test_create_thumbnail(TRUE);
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               return ret;
+
+       ret = test_request_update_db();
        if(ret != MEDIA_CONTENT_ERROR_NONE)
                return ret;
 
        ret = DFT_test();
        if(ret != MEDIA_CONTENT_ERROR_NONE)
                return ret;
+
+       ret = test_batch_operations();
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               return MEDIA_CONTENT_ERROR_NONE;
+
+       ret = test_insert_burst_shot_to_db();
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               return MEDIA_CONTENT_ERROR_NONE;
+
+       ret = test_scan_file();
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               return MEDIA_CONTENT_ERROR_NONE;
+
+       ret = test_scan_dir();
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               return MEDIA_CONTENT_ERROR_NONE;
+
+       ret = test_noti();
+       if(ret != MEDIA_CONTENT_ERROR_NONE)
+               return MEDIA_CONTENT_ERROR_NONE;
 #endif
 
        ret = test_disconnect_database();