[ACR-1635] Support ebook format 27/259427/14 accepted/tizen/unified/20210716.131206 submit/tizen/20210716.025629
authorMinje Ahn <minje.ahn@samsung.com>
Mon, 7 Jun 2021 23:15:02 +0000 (08:15 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Fri, 16 Jul 2021 02:12:56 +0000 (11:12 +0900)
Change-Id: I4fcd5fd424bc96ae526d95acd7afdba7636de75b
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
13 files changed:
doc/media_content_doc.h
include/media_book.h [new file with mode: 0755]
include/media_content.h
include/media_content_type.h
include/media_info.h
include/media_info_private.h
include_product/media_book.h [new file with mode: 0755]
include_product/media_content.h
include_product/media_content_type.h
include_product/media_info.h
include_product/media_info_private.h
src/media_book.c [new file with mode: 0644]
src/media_info.c

index 082bac6..d46c6bb 100755 (executable)
@@ -29,7 +29,7 @@
  *
  * @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
+ * The information about media items i.e. image, audio, video and ebook, are managed in the content database and
  * operations that involve database requires an active connection with the media content service.\n
  * During media scanning, Media Service extract media information automatically. media information include basic file info like
  * path, size, modified time etc and some metadata like ID3tag, EXIF, thumbnail, etc. (thumbnail extracted only in Internal and SD card storage.) \n
  * </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
+ *    <td> Provide generic information about media content items (i.e. image, audio, video, ebook and others).\n
  *  Provide details about audio files (e.g. name, 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>
+ *  Provide details about video files (e.g. width, height, duration etc) present in the device.\n
+ *  Provide details about ebook files (e.g. subject, author etc) present in the device.</td>
  * </tr>
  * <tr>
  *    <td>@ref CAPI_CONTENT_MEDIA_PLAYLIST_MODULE </td>
  *   \#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.
+ * A Folder is used to organize media content files i.e. image, audio, video, ebook 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.
  *
  *
  * @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:
+ * Following information about video content (#video_meta_his provided:
  * <table>
  * <tr>
  * <th>Attribute</th>
  *
  */
 
+
+/**
+ * @defgroup CAPI_CONTENT_MEDIA_BOOK_META_MODULE Book Metadata
+ * @brief The Book Metadata API provides functions to get information about ebook files present in the device.
+ *
+ * @ingroup CAPI_CONTENT_MEDIA_INFO_MODULE
+ *
+ * @section CAPI_CONTENT_MEDIA_BOOK_META_MODULE_HEADER Required Header
+ *   \#include <media_content.h>
+ *
+ * @section CAPI_CONTENT_MEDIA_BOOK_META_MODULE_OVERVIEW Overview
+ * The Book Metadata API provides functions to get information about book files present in the device.
+ * Following information about book content (#book_meta_h) is provided:
+ * <table>
+ * <tr>
+ * <th>Attribute</th>
+ * <th>Filter Keyword</th>
+ * <th>Comments</th>
+ * </tr>
+ * <tr>
+ * <td>subject</td>
+ * <td>#MEDIA_GENRE</td>
+ * <td>Get from metadata if exist.</td>
+ * </tr>
+ * <tr>
+ * <td>author</td>
+ * <td>#MEDIA_COMPOSER</td>
+ * <td>Get from metadata if exist.</td>
+ * </tr>
+ * <tr>
+ * <td>date</td>
+ * <td>#MEDIA_RECORDED_DATE</td>
+ * <td>Get from metadata if exist.</td>
+ * </tr>
+ * <tr>
+ * <td>publisher</td>
+ * <td>#MEDIA_COPYRIGHT</td>
+ * <td>Get from metadata if exist.</td>
+ * </tr>
+ * </table>
+ * \n
+ *<p>
+ * For getting the book handle (#book_meta_h) from the media information (#media_info_h), call the media_info_get_book() function.\n
+ * For getting the information related to book files stored in the device call the respective get functions e.g. to get author of the ebook file
+ * call #book_meta_get_author() function  and so on.\n
+ * When the book handle is no longer needed, it should be destroyed by calling #book_meta_destroy() function.
+ */
+
 /**
  * @defgroup CAPI_CONTENT_MEDIA_FACE_DETECTION_MODULE Face Detection
  * @brief The Face Detection API provides functions to detect face information about stored image files.
diff --git a/include/media_book.h b/include/media_book.h
new file mode 100755 (executable)
index 0000000..a80a20b
--- /dev/null
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2021 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_CONTENT_MEDIA_BOOK_H__
+#define __TIZEN_CONTENT_MEDIA_BOOK_H__
+
+#include <media_content_type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @file media_book.h
+ * @brief This file contains the book metadata API and related functions to proceed with book metadata. \n
+ *        Description of the book content involves: author, publisher, date, and subject.
+ */
+
+/**
+ * @addtogroup CAPI_CONTENT_MEDIA_BOOK_META_MODULE
+ * @{
+ */
+
+/**
+ * @brief Clones the book metadata.
+ * @details This function copies the book metadata handle from a source to destination.
+ *
+ * @since_tizen 6.5
+ *
+ * @remarks The @a dst should be released using book_meta_destroy().
+ *
+ * @param[out] dst The destination handle to the book metadata
+ * @param[in] src The source handle to the book 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
+ *
+ * @see media_info_get_book()
+ * @see book_meta_destroy()
+ */
+int book_meta_clone(book_meta_h *dst, book_meta_h src);
+
+/**
+ * @brief Destroys the book metadata.
+ * @details This function frees all resources related to the book metadata handle. This handle
+ *          can no longer be used to perform any operations. A new handle has to
+ *          be created before the next use.
+ *
+ * @since_tizen 6.5
+ *
+ * @param[in] book The handle to the book 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
+ *
+ * @see book_meta_clone()
+ */
+int book_meta_destroy(book_meta_h book);
+
+/**
+ * @brief Gets the ID of the media of the given book metadata.
+ * @since_tizen 6.5
+ *
+ * @remarks The @a media_id should be released using free().
+ *
+ * @param[in] book The handle to the book metadata
+ * @param[out] media_id 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
+ */
+int book_meta_get_media_id(book_meta_h book, char **media_id);
+
+/**
+ * @brief Gets the subject of the given book metadata.
+ * @details If there is no information, @a subject will be NULL.
+ *
+ * @since_tizen 6.5
+ *
+ * @remarks The @a subject should be released using free().
+ *
+ * @param[in] book The handle to the book metadata
+ * @param[out] subject The subject of the book 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
+ */
+int book_meta_get_subject(book_meta_h book, char **subject);
+
+/**
+ * @brief Gets the author of the given book metadata.
+ * @details If there is no information, @a author will be NULL.
+ *
+ * @since_tizen 6.5
+ *
+ * @remarks The @a author should be released using free().
+ *
+ * @param[in] book The handle to the book metadata
+ * @param[out] author The author of the book 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
+ */
+int book_meta_get_author(book_meta_h book, char **author);
+
+/**
+ * @brief Gets the publication date of the given book metadata.
+ * @details If there is no information, @a date will be NULL.
+ *
+ * @since_tizen 6.5
+ *
+ * @remarks The @a date should be released using free().
+ *
+ * @param[in] book The handle to the book metadata
+ * @param[out] date The date of the book 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
+ */
+int book_meta_get_date(book_meta_h book, char **date);
+
+/**
+ * @brief Gets the publisher notice of the given book metadata.
+ * @details If there is no information, @a publisher will be NULL.
+ *
+ * @since_tizen 6.5
+ *
+ * @remarks The @a publisher should be released using free().
+ *
+ * @param[in] book The handle to the book metadata
+ * @param[out] publisher The publisher of the book 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
+ */
+int book_meta_get_publisher(book_meta_h book, char **publisher);
+
+/**
+ *@}
+ */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /*__TIZEN_CONTENT_MEDIA_BOOK_H__*/
index e675f0b..fd08487 100755 (executable)
@@ -18,7 +18,6 @@
 #define __TIZEN_CONTENT_MEDIA_CONTENT_H__
 
 #include <media_audio.h>
-#include <media_content_type.h>
 #include <media_filter.h>
 #include <media_folder.h>
 #include <media_image.h>
@@ -30,6 +29,7 @@
 #include <media_bookmark.h>
 #include <media_storage.h>
 #include <media_face.h>
+#include <media_book.h>
 
 #ifdef __cplusplus
 extern "C" {
index 3c3da0d..263a8b1 100755 (executable)
@@ -43,15 +43,16 @@ extern "C" {
  * @brief Enumeration for the media file format.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @remarks Since 4.0, #MEDIA_CONTENT_TYPE_OTHERS is related to the following feature:\n
- *              %http://tizen.org/feature/content.scanning.others\n
- *              If this feature is not supported on the device, #MEDIA_CONTENT_TYPE_OTHERS type file is not scanned.
+ *          %http://tizen.org/feature/content.scanning.others\n
+ *          If this feature is not supported on the device, #MEDIA_CONTENT_TYPE_OTHERS type file is not scanned.
  */
 typedef enum {
-       MEDIA_CONTENT_TYPE_IMAGE                = 0,    /**<The type of an image */
-       MEDIA_CONTENT_TYPE_VIDEO                = 1,    /**<The type of a video */
+       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_MUSIC        = 3,    /**<The type of music */
        MEDIA_CONTENT_TYPE_OTHERS       = 4,    /**<The type of other */
+       MEDIA_CONTENT_TYPE_BOOK         = 5,    /**<The type of book (Since 6.5)*/
 } media_content_type_e;
 
 /**
@@ -248,6 +249,13 @@ typedef struct video_meta_s *video_meta_h;
 typedef struct audio_meta_s *audio_meta_h;
 
 /**
+ * @ingroup CAPI_CONTENT_MEDIA_BOOK_META_MODULE
+ * @brief The structure type for the Book metadata handle.
+ * @since_tizen 6.5
+ */
+typedef struct book_meta_s *book_meta_h;
+
+/**
  * @ingroup CAPI_CONTENT_MEDIA_FILTER_MODULE
  * @brief The structure type for the Media filter handle.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
index 9d00fa4..15c13a0 100755 (executable)
@@ -506,6 +506,30 @@ int media_info_get_video(media_info_h media, video_meta_h *video);
 int media_info_get_audio(media_info_h media, audio_meta_h *audio);
 
 /**
+ * @brief Gets a book metadata handle for a given media info.
+ * @details This function returns a book metadata handle retrieved from the media info handle. \n
+ *          The title and description information of the book can be obtained from @a media.
+ *
+ * @since_tizen 6.5
+ *
+ * @remarks The @a book should be released using book_meta_destroy().
+ *
+ * @param[in] media The handle to the media info
+ * @param[out] book The handle to the book 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
+ *
+ * @see media_info_get_title()
+ * @see media_info_get_description()
+ * @see book_meta_destroy()
+ */
+int media_info_get_book(media_info_h media, book_meta_h *book);
+
+/**
  * @brief Gets the media ID.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @remarks The @a media_id should be released using free().
index 865af4b..eedab3c 100644 (file)
@@ -50,7 +50,7 @@ extern "C" {
 * @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, 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.
+*        Definitions of media DB fields and tables, operations with media data relating to DB and handling with media filter attributes.
 */
 
 
@@ -246,6 +246,14 @@ typedef struct {
 
 typedef struct {
        char *media_id;
+       char *author;
+       char *publisher;
+       char *date;
+       char *subject;
+} book_meta_s;
+
+typedef struct {
+       char *media_id;
        char *file_path;
        char *display_name;
        media_content_type_e media_type;
@@ -271,6 +279,7 @@ typedef struct {
        image_meta_s *image_meta;
        video_meta_s *video_meta;
        audio_meta_s *audio_meta;
+       book_meta_s *book_meta;
 } media_info_s;
 
 typedef struct {
diff --git a/include_product/media_book.h b/include_product/media_book.h
new file mode 100755 (executable)
index 0000000..a80a20b
--- /dev/null
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2021 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_CONTENT_MEDIA_BOOK_H__
+#define __TIZEN_CONTENT_MEDIA_BOOK_H__
+
+#include <media_content_type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @file media_book.h
+ * @brief This file contains the book metadata API and related functions to proceed with book metadata. \n
+ *        Description of the book content involves: author, publisher, date, and subject.
+ */
+
+/**
+ * @addtogroup CAPI_CONTENT_MEDIA_BOOK_META_MODULE
+ * @{
+ */
+
+/**
+ * @brief Clones the book metadata.
+ * @details This function copies the book metadata handle from a source to destination.
+ *
+ * @since_tizen 6.5
+ *
+ * @remarks The @a dst should be released using book_meta_destroy().
+ *
+ * @param[out] dst The destination handle to the book metadata
+ * @param[in] src The source handle to the book 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
+ *
+ * @see media_info_get_book()
+ * @see book_meta_destroy()
+ */
+int book_meta_clone(book_meta_h *dst, book_meta_h src);
+
+/**
+ * @brief Destroys the book metadata.
+ * @details This function frees all resources related to the book metadata handle. This handle
+ *          can no longer be used to perform any operations. A new handle has to
+ *          be created before the next use.
+ *
+ * @since_tizen 6.5
+ *
+ * @param[in] book The handle to the book 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
+ *
+ * @see book_meta_clone()
+ */
+int book_meta_destroy(book_meta_h book);
+
+/**
+ * @brief Gets the ID of the media of the given book metadata.
+ * @since_tizen 6.5
+ *
+ * @remarks The @a media_id should be released using free().
+ *
+ * @param[in] book The handle to the book metadata
+ * @param[out] media_id 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
+ */
+int book_meta_get_media_id(book_meta_h book, char **media_id);
+
+/**
+ * @brief Gets the subject of the given book metadata.
+ * @details If there is no information, @a subject will be NULL.
+ *
+ * @since_tizen 6.5
+ *
+ * @remarks The @a subject should be released using free().
+ *
+ * @param[in] book The handle to the book metadata
+ * @param[out] subject The subject of the book 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
+ */
+int book_meta_get_subject(book_meta_h book, char **subject);
+
+/**
+ * @brief Gets the author of the given book metadata.
+ * @details If there is no information, @a author will be NULL.
+ *
+ * @since_tizen 6.5
+ *
+ * @remarks The @a author should be released using free().
+ *
+ * @param[in] book The handle to the book metadata
+ * @param[out] author The author of the book 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
+ */
+int book_meta_get_author(book_meta_h book, char **author);
+
+/**
+ * @brief Gets the publication date of the given book metadata.
+ * @details If there is no information, @a date will be NULL.
+ *
+ * @since_tizen 6.5
+ *
+ * @remarks The @a date should be released using free().
+ *
+ * @param[in] book The handle to the book metadata
+ * @param[out] date The date of the book 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
+ */
+int book_meta_get_date(book_meta_h book, char **date);
+
+/**
+ * @brief Gets the publisher notice of the given book metadata.
+ * @details If there is no information, @a publisher will be NULL.
+ *
+ * @since_tizen 6.5
+ *
+ * @remarks The @a publisher should be released using free().
+ *
+ * @param[in] book The handle to the book metadata
+ * @param[out] publisher The publisher of the book 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
+ */
+int book_meta_get_publisher(book_meta_h book, char **publisher);
+
+/**
+ *@}
+ */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /*__TIZEN_CONTENT_MEDIA_BOOK_H__*/
index aa472a1..3ee302a 100755 (executable)
@@ -18,7 +18,6 @@
 #define __TIZEN_CONTENT_MEDIA_CONTENT_H__
 
 #include <media_audio.h>
-#include <media_content_type.h>
 #include <media_filter.h>
 #include <media_folder.h>
 #include <media_image.h>
@@ -30,6 +29,7 @@
 #include <media_bookmark.h>
 #include <media_storage.h>
 #include <media_face.h>
+#include <media_book.h>
 #include <media_content_product.h>
 
 #ifdef __cplusplus
index afc3764..422ae84 100755 (executable)
@@ -43,18 +43,19 @@ extern "C" {
  * @brief Enumeration for the media file format.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @remarks Since 4.0, #MEDIA_CONTENT_TYPE_OTHERS is related to the following feature:\n
- *              %http://tizen.org/feature/content.scanning.others\n
- *              If this feature is not supported on the device, #MEDIA_CONTENT_TYPE_OTHERS type file is not scanned.
+ *          %http://tizen.org/feature/content.scanning.others\n
+ *          If this feature is not supported on the device, #MEDIA_CONTENT_TYPE_OTHERS type file is not scanned.
  */
 typedef enum {
-       MEDIA_CONTENT_TYPE_IMAGE                = 0,    /**<The type of an image */
-       MEDIA_CONTENT_TYPE_VIDEO                = 1,    /**<The type of a video */
+       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_MUSIC        = 3,    /**<The type of music */
        MEDIA_CONTENT_TYPE_OTHERS       = 4,    /**<The type of other */
-       MEDIA_CONTENT_TYPE_PVR                  = 1001,         /**<The type of PVR */
-       MEDIA_CONTENT_TYPE_UHD                  = 1002,         /**<The type of UHD */
-       MEDIA_CONTENT_TYPE_SCSA                 = 1003,         /**<The type of SCSA */
+       MEDIA_CONTENT_TYPE_BOOK         = 5,    /**<The type of book (Since 6.5)*/
+       MEDIA_CONTENT_TYPE_PVR          = 1001, /**<The type of PVR */
+       MEDIA_CONTENT_TYPE_UHD          = 1002, /**<The type of UHD */
+       MEDIA_CONTENT_TYPE_SCSA         = 1003, /**<The type of SCSA */
 } media_content_type_e;
 
 /**
@@ -305,6 +306,13 @@ typedef struct video_meta_s *video_meta_h;
 typedef struct audio_meta_s *audio_meta_h;
 
 /**
+ * @ingroup CAPI_CONTENT_MEDIA_BOOK_META_MODULE
+ * @brief The structure type for the Book metadata handle.
+ * @since_tizen 6.5
+ */
+typedef struct book_meta_s *book_meta_h;
+
+/**
  * @ingroup CAPI_CONTENT_MEDIA_FILTER_MODULE
  * @brief The structure type for the Media filter handle.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
index 9d00fa4..15c13a0 100755 (executable)
@@ -506,6 +506,30 @@ int media_info_get_video(media_info_h media, video_meta_h *video);
 int media_info_get_audio(media_info_h media, audio_meta_h *audio);
 
 /**
+ * @brief Gets a book metadata handle for a given media info.
+ * @details This function returns a book metadata handle retrieved from the media info handle. \n
+ *          The title and description information of the book can be obtained from @a media.
+ *
+ * @since_tizen 6.5
+ *
+ * @remarks The @a book should be released using book_meta_destroy().
+ *
+ * @param[in] media The handle to the media info
+ * @param[out] book The handle to the book 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
+ *
+ * @see media_info_get_title()
+ * @see media_info_get_description()
+ * @see book_meta_destroy()
+ */
+int media_info_get_book(media_info_h media, book_meta_h *book);
+
+/**
  * @brief Gets the media ID.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @remarks The @a media_id should be released using free().
index f874dc8..290e334 100644 (file)
@@ -53,7 +53,7 @@ extern "C" {
 * @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, 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.
+*        Definitions of media DB fields and tables, operations with media data relating to DB and handling with media filter attributes.
 */
 
 
@@ -257,6 +257,14 @@ typedef struct {
 
 typedef struct {
        char *media_id;
+       char *author;
+       char *publisher;
+       char *date;
+       char *subject;
+} book_meta_s;
+
+typedef struct {
+       char *media_id;
        char *file_path;
        char *display_name;
        media_content_type_e media_type;
@@ -288,6 +296,7 @@ typedef struct {
        image_meta_s *image_meta;
        video_meta_s *video_meta;
        audio_meta_s *audio_meta;
+       book_meta_s *book_meta;
 } media_info_s;
 
 typedef struct {
@@ -442,7 +451,7 @@ typedef struct _media_content_scan_cb_data_v2 {
 
 /* DB field for media */
 #define DB_FIELD_MEDIA_DISPLAY_NAME            "media_display_name"
-#define DB_FIELD_MEDIA_TYPE                                    "media_type"
+#define DB_FIELD_MEDIA_TYPE                            "media_type"
 #define DB_FIELD_MEDIA_MIME_TYPE               "media_mime_type"
 #define DB_FIELD_MEDIA_SIZE                            "media_size"
 #define DB_FIELD_MEDIA_ADDED_TIME              "media_added_time"
diff --git a/src/media_book.c b/src/media_book.c
new file mode 100644 (file)
index 0000000..1d15204
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#include <media_info_private.h>
+
+int book_meta_destroy(book_meta_h book)
+{
+       book_meta_s *_book = (book_meta_s *)book;
+
+       content_retip_if_fail(book);
+
+       g_free(_book->media_id);
+       g_free(_book->author);
+       g_free(_book->publisher);
+       g_free(_book->subject);
+       g_free(_book->date);
+       g_free(_book);
+
+       return MEDIA_CONTENT_ERROR_NONE;
+}
+
+int book_meta_clone(book_meta_h *dst, book_meta_h src)
+{
+       book_meta_s *_src = (book_meta_s *)src;
+
+       content_retip_if_fail(dst);
+       content_retip_if_fail(src);
+
+       book_meta_s *_dst = g_new0(book_meta_s, 1);
+
+       _dst->media_id = g_strdup(_src->media_id);
+       _dst->author = g_strdup(_src->author);
+       _dst->date = g_strdup(_src->date);
+       _dst->publisher = g_strdup(_src->publisher);
+       _dst->subject = g_strdup(_src->subject);
+
+       *dst = (book_meta_h)_dst;
+
+       return MEDIA_CONTENT_ERROR_NONE;
+}
+
+int book_meta_get_media_id(book_meta_h book, char **media_id)
+{
+       book_meta_s *_book = (book_meta_s *)book;
+
+       content_retip_if_fail(book);
+       content_retip_if_fail(media_id);
+
+       *media_id = g_strdup(_book->media_id);
+
+       return MEDIA_CONTENT_ERROR_NONE;
+}
+
+int book_meta_get_subject(book_meta_h book, char **subject)
+{
+       book_meta_s *_book = (book_meta_s *)book;
+
+       content_retip_if_fail(book);
+       content_retip_if_fail(subject);
+
+       *subject = g_strdup(_book->subject);
+
+       return MEDIA_CONTENT_ERROR_NONE;
+}
+
+int book_meta_get_author(book_meta_h book, char **author)
+{
+       book_meta_s *_book = (book_meta_s *)book;
+
+       content_retip_if_fail(book);
+       content_retip_if_fail(author);
+
+       *author = g_strdup(_book->author);
+
+       return MEDIA_CONTENT_ERROR_NONE;
+}
+
+int book_meta_get_date(book_meta_h book, char **date)
+{
+       book_meta_s *_book = (book_meta_s *)book;
+
+       content_retip_if_fail(book);
+       content_retip_if_fail(date);
+
+       *date = g_strdup(_book->date);
+
+       return MEDIA_CONTENT_ERROR_NONE;
+}
+
+int book_meta_get_publisher(book_meta_h book, char **publisher)
+{
+       book_meta_s *_book = (book_meta_s *)book;
+
+       content_retip_if_fail(book);
+       content_retip_if_fail(publisher);
+
+       *publisher = g_strdup(_book->publisher);
+
+       return MEDIA_CONTENT_ERROR_NONE;
+}
index 32da74d..4441e69 100644 (file)
@@ -110,7 +110,7 @@ static void __media_info_thumbnail_completed_cb(int error, const char *path, voi
        return;
 }
 
-static bool __media_info_isFaceRecognition_feature_supported()
+static bool __media_info_isFaceRecognition_feature_supported(void)
 {
        bool isFaceRecognitionSupported = false;
 
@@ -343,7 +343,13 @@ void _media_info_item_get_detail(sqlite3_stmt* stmt, media_info_h media)
                _media->audio_meta->duration = sqlite3_column_int(stmt, MEDIA_INFO_DURATION);
                _media->audio_meta->samplerate = sqlite3_column_int(stmt, MEDIA_INFO_SAMPLERATE);
                _media->audio_meta->channel = sqlite3_column_int(stmt, MEDIA_INFO_CHANNEL);
+       } else if (_media->media_type == MEDIA_CONTENT_TYPE_BOOK) {
+               _media->book_meta = g_new0(book_meta_s, 1);
 
+               _media->book_meta->subject = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_GENRE));
+               _media->book_meta->author = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_COMPOSER));
+               _media->book_meta->date = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_RECORDED_DATE));
+               _media->book_meta->publisher = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_COPYRIGHT));
        }
 }
 #ifdef _USE_TVPD_MODE
@@ -596,6 +602,16 @@ int media_info_destroy(media_info_h media)
                g_free(_media->audio_meta);
        }
 
+       if (_media->book_meta) {
+               g_free(_media->book_meta->media_id);
+               g_free(_media->book_meta->author);
+               g_free(_media->book_meta->date);
+               g_free(_media->book_meta->publisher);
+               g_free(_media->book_meta->subject);
+
+               g_free(_media->book_meta);
+       }
+
        g_free(_media);
 
        return MEDIA_CONTENT_ERROR_NONE;
@@ -694,6 +710,14 @@ int media_info_clone(media_info_h *dst, media_info_h src)
                _dst->audio_meta->duration = _src->audio_meta->duration;
                _dst->audio_meta->bitrate = _src->audio_meta->bitrate;
                _dst->audio_meta->bitpersample = _src->audio_meta->bitpersample;
+       } else if (_src->media_type == MEDIA_CONTENT_TYPE_BOOK && _src->book_meta) {
+               _dst->book_meta = g_new0(book_meta_s, 1);
+
+               _dst->book_meta->media_id = g_strdup(_src->book_meta->media_id);
+               _dst->book_meta->author = g_strdup(_src->book_meta->author);
+               _dst->book_meta->date = g_strdup(_src->book_meta->date);
+               _dst->book_meta->publisher = g_strdup(_src->book_meta->publisher);
+               _dst->book_meta->subject = g_strdup(_src->book_meta->subject);
        }
 
        *dst = (media_info_h)_dst;
@@ -861,6 +885,29 @@ int media_info_get_audio(media_info_h media, audio_meta_h *audio)
        return ret;
 }
 
+int media_info_get_book(media_info_h media, book_meta_h *book)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+
+       media_info_s *_media = (media_info_s*)media;
+
+       content_retip_if_fail(media);
+       content_retip_if_fail(_media->media_type == MEDIA_CONTENT_TYPE_BOOK);
+       content_retip_if_fail(book);
+
+       book_meta_s *_book = g_new0(book_meta_s, 1);
+
+       _book->media_id = g_strdup(_media->media_id);
+       _book->author = g_strdup(_media->book_meta->author);
+       _book->publisher = g_strdup(_media->book_meta->publisher);
+       _book->date = g_strdup(_media->book_meta->date);
+       _book->subject = g_strdup(_media->book_meta->subject);
+
+       *book = (book_meta_h)_book;
+
+       return ret;
+}
+
 int media_info_get_media_id(media_info_h media, char **media_id)
 {
        media_info_s *_media = (media_info_s*)media;