diff options
-rwxr-xr-x | doc/metadata_extractor_doc.h | 45 | ||||
-rwxr-xr-x | include/metadata_extractor.h | 232 | ||||
-rwxr-xr-x | include/metadata_extractor_type.h | 82 | ||||
-rwxr-xr-x | packaging/capi-media-metadata-extractor.spec | 3 | ||||
-rwxr-xr-x | src/metadata_extractor.c | 36 |
5 files changed, 255 insertions, 143 deletions
diff --git a/doc/metadata_extractor_doc.h b/doc/metadata_extractor_doc.h new file mode 100755 index 0000000..20aed5d --- /dev/null +++ b/doc/metadata_extractor_doc.h @@ -0,0 +1,45 @@ +/* + * 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_METADATA_EXTRACTOR_DOC_H__ +#define __TIZEN_MEDIA_METADATA_EXTRACTOR_DOC_H__ + +/** + * @file metadata_extractor_doc.h + * @brief File contains the high level documentation for the Metadata Extractor API. + * + */ + +/** + * @defgroup CAPI_METADATA_EXTRACTOR_MODULE Metadata Extractor + * @ingroup CAPI_MEDIA_FRAMEWORK + */ + +/** + * @addtogroup CAPI_METADATA_EXTRACTOR_MODULE + * @brief The @ref CAPI_METADATA_EXTRACTOR_MODULE API provides functions for extracting the metadata from an input media file. + * @ingroup CAPI_MEDIA_FRAMEWORK + * @section CAPI_METADATA_EXTRACTOR_MODULE_HEADER Required Header + * \#include <metadata_extractor.h> + * + * @section CAPI_METADATA_EXTRACTOR_OVERVIEW Overview + * The @ref CAPI_METADATA_EXTRACTOR_MODULE API allows you to extract the metadata from a media file. To extract a particular type of metadata(#metadata_extractor_attr_e), create/destory the handle(#metadata_extractor_create()/#metadata_extractor_destroy). To set the path for extracting, and call metadata_extractor_get_metadata(). + */ + +#endif /* __TIZEN_MEDIA_METADATA_EXTRACTOR_DOC_H__ */ + + diff --git a/include/metadata_extractor.h b/include/metadata_extractor.h index e399ab5..fd5528a 100755 --- a/include/metadata_extractor.h +++ b/include/metadata_extractor.h @@ -27,172 +27,206 @@ extern "C" { #endif /* __cplusplus */ /** - * @addtogroup CAPI_METADATA_EXTRACTOR_MODULE - * @{ - * * @file metadata_extractor.h - * @brief This file contains the multimedia content metadata extractor API and related structure and enumeration. \n - * Description of metadata: duration, bitrate, album, artist, author, genre and description etc. \n + * @brief This file contains the multimedia content metadata extractor API and related structure and enumeration. + * It also contains the description of metadata: duration, bitrate, album, artist, author, genre, description, and so on. */ +/** + * @addtogroup CAPI_METADATA_EXTRACTOR_MODULE + * @{ + */ /** - * @brief Create metadata - * - * @remarks @a metadata must be released metadata_extractor_destroy() by you + * @brief Creates metadata. + * @since_tizen 2.3 + * @remarks You must release @a metadata using metadata_extractor_destroy(). * - * @param [in] metadata The handle to metadata - * @return 0 on success, otherwise a negative error value + * @param[in] metadata The handle to metadata + * @return @c 0 on success, + * otherwise a negative error value * @retval #METADATA_EXTRACTOR_ERROR_NONE Successful * @retval #METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER Invalid parameter * @retval #METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY Not enough memory is available + * @retval #METADATA_EXTRACTOR_ERROR_PERMISSION_DENIED Permission denied * @see metadata_extractor_destroy() */ int metadata_extractor_create(metadata_extractor_h *metadata); - /** - * @brief Set file path to extract - * + * @brief Sets the file path to extract. + * @since_tizen 2.3 * @param [in] metadata The handle to metadata - * @param [in] path path to extract metadata - * @return 0 on success, otherwise a negative error value + * @param [in] path The path to extract metadata + * @return @c 0 on success, + * otherwise a negative error value * @retval #METADATA_EXTRACTOR_ERROR_NONE Successful * @retval #METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #METADATA_EXTRACTOR_ERROR_FILE_EXISTS File not exist - * @retval #METADATA_EXTRACTOR_ERROR_OPERATION_FAILED Internal Operation Fail - * @pre Create metadata handle by calling metadata_extractor_create() - * @see metadata_extractor_create(), metadata_extractor_destroy() + * @retval #METADATA_EXTRACTOR_ERROR_FILE_EXISTS File does not exist + * @retval #METADATA_EXTRACTOR_ERROR_OPERATION_FAILED Internal operation failed + * @retval #METADATA_EXTRACTOR_ERROR_PERMISSION_DENIED Permission denied + * @pre Create a metadata handle by calling metadata_extractor_create(). + * @see metadata_extractor_create() + * @see metadata_extractor_destroy() */ int metadata_extractor_set_path(metadata_extractor_h metadata, const char *path); /** - * @brief Set buffer to extract - * + * @brief Sets the buffer to extract. + * @since_tizen 2.3 * @param [in] metadata The handle to metadata - * @param [in] buffer buffer to extract metadata - * @param [in] size buffer size - * @return 0 on success, otherwise a negative error value + * @param [in] buffer The buffer to extract metadata + * @param [in] size The buffer size + * @return @c 0 on success, + * otherwise a negative error value * @retval #METADATA_EXTRACTOR_ERROR_NONE Successful * @retval #METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #METADATA_EXTRACTOR_ERROR_OPERATION_FAILED Internal Operation Fail - * @pre Create metadata handle by calling metadata_extractor_create() - * @see metadata_extractor_create(), metadata_extractor_destroy() + * @retval #METADATA_EXTRACTOR_ERROR_OPERATION_FAILED Internal operation failed + * @retval #METADATA_EXTRACTOR_ERROR_PERMISSION_DENIED Permission denied + * @pre Create a metadata handle by calling metadata_extractor_create(). + * @see metadata_extractor_create() + * @see metadata_extractor_destroy() */ - int metadata_extractor_set_buffer(metadata_extractor_h metadata, const void *buffer, int size); /** - * @brief Destroy metadata - * + * @brief Destroys metadata. + * @since_tizen 2.3 * @param [in] metadata The handle to metadata - * @return 0 on success, otherwise a negative error value + * @return @c 0 on success, + * otherwise a negative error value * @retval #METADATA_EXTRACTOR_ERROR_NONE Successful * @retval #METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #METADATA_EXTRACTOR_ERROR_OPERATION_FAILED Internal Operation Fail - * @pre Create metadata handle by calling metadata_extractor_create() + * @retval #METADATA_EXTRACTOR_ERROR_OPERATION_FAILED Internal operation failed + * @retval #METADATA_EXTRACTOR_ERROR_PERMISSION_DENIED Permission denied + * @pre Create a metadata handle by calling metadata_extractor_create(). * @see metadata_extractor_create() */ int metadata_extractor_destroy(metadata_extractor_h metadata); - /** - * @brief Get metadata - * - * @remarks @a value must be released with @c free() by you - * - * @param [in] metadata The handle to metadata - * @param [in] attribute key attribute name to get - * @param [out] value The value of the attribute - * @return 0 on success, otherwise a negative error value + * @brief Gets metadata. + * @since_tizen 2.3 + * + * @remarks You must release @a value using @c free(). \n + * In case of accessing specific path in internal storage or external storage, you may add the privilege for accessing the path. \n + * For example, if you get the specific path by using storage_get_directory(). you should add previlege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage. + * + * @param[in] metadata The handle to metadata + * @param[in] attribute The key attribute name to get + * @param[out] value The value of the attribute + * @return @c 0 on success, + * otherwise a negative error value * @retval #METADATA_EXTRACTOR_ERROR_NONE Successful * @retval #METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER Invalid parameter * @retval #METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY Not enough memory is available - * @retval #METADATA_EXTRACTOR_ERROR_OPERATION_FAILED Internal Operation Fail - * @pre Set path to extract by calling metadata_extractor_set_path() - * @see metadata_extractor_create(), metadata_extractor_destroy() + * @retval #METADATA_EXTRACTOR_ERROR_OPERATION_FAILED Internal operation failed + * @retval #METADATA_EXTRACTOR_ERROR_PERMISSION_DENIED Permission denied + * @pre Set the path to extract by calling metadata_extractor_set_path(). + * @see metadata_extractor_create() + * @see metadata_extractor_destroy() */ int metadata_extractor_get_metadata(metadata_extractor_h metadata, metadata_extractor_attr_e attribute, char **value); - /** - * @brief Get artwork image in media file - * - * @remarks @a artwork and @a artwork_mime must be released with @c free() by you - * - * @param [in] metadata The handle to metadata - * @param [out] artwork encoded artwork image - * @param [out] size encoded artwork size - * @param [out] mime_type mime type of artwork - * @return 0 on success, otherwise a negative error value + * @brief Gets the artwork image in a media file. + * @since_tizen 2.3 + * + * @remarks You must release @a artwork and @a artwork_mime using @c free(). \n + * In case of accessing specific path in internal storage or external storage, you may add the privilege for accessing the path. \n + * For example, if you get the specific path by using storage_get_directory(). you should add previlege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage. + * + * @param[in] metadata The handle to metadata + * @param[out] artwork The encoded artwork image + * @param[out] size The encoded artwork size + * @param[out] mime_type The mime type of artwork + * @return @c 0 on success, + * otherwise a negative error value * @retval #METADATA_EXTRACTOR_ERROR_NONE Successful * @retval #METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER Invalid parameter * @retval #METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY Not enough memory is available - * @retval #METADATA_EXTRACTOR_ERROR_OPERATION_FAILED Internal Operation Fail - * @pre Set path to extract by calling metadata_extractor_set_path() - * @see metadata_extractor_create(), metadata_extractor_destroy() + * @retval #METADATA_EXTRACTOR_ERROR_OPERATION_FAILED Internal operation failed + * @retval #METADATA_EXTRACTOR_ERROR_PERMISSION_DENIED Permission denied + * @pre Set the path to extract by calling metadata_extractor_set_path(). + * @see metadata_extractor_create() + * @see metadata_extractor_destroy() */ int metadata_extractor_get_artwork(metadata_extractor_h metadata, void **artwork, int *size, char **mime_type); - /** - * @brief Get frame of video media file - * - * @remarks @a frame must be released with @c free() by you - * - * @param [in] metadata The handle to metadata - * @param [out] frame raw frame data in RGB888 - * @param [out] size The frame data size - * @return 0 on success, otherwise a negative error value + * @brief Gets the frame of a video media file. + * @since_tizen 2.3 + * + * @remarks You must release @a frame using @c free(). + * In case of accessing specific path in internal storage or external storage, you may add the privilege for accessing the path. \n + * For example, if you get the specific path by using storage_get_directory(). you should add previlege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage. + * + * @param[in] metadata The handle to metadata + * @param[out] frame The raw frame data in RGB888 + * @param[out] size The frame data size + * @return @c 0 on success, + * otherwise a negative error value * @retval #METADATA_EXTRACTOR_ERROR_NONE Successful * @retval #METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER Invalid parameter * @retval #METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY Not enough memory is available - * @retval #METADATA_EXTRACTOR_ERROR_OPERATION_FAILED Internal Operation Fail - * @pre Set path to extract by calling metadata_extractor_set_path() - * @see metadata_extractor_create(), metadata_extractor_destroy() + * @retval #METADATA_EXTRACTOR_ERROR_OPERATION_FAILED Internal operation failed + * @retval #METADATA_EXTRACTOR_ERROR_PERMISSION_DENIED Permission denied + * @pre Set the path to extract by calling metadata_extractor_set_path(). + * @see metadata_extractor_create() + * @see metadata_extractor_destroy() */ int metadata_extractor_get_frame(metadata_extractor_h metadata, void **frame, int *size); - /** - * @brief Get synclyric of media file - * - * @remarks @a lyrics must be released with @c free() by you - * - * @param [in] metadata The handle to metadata - * @param [in] index Index of time/lyrics set - * @param [out] time_info Time information of index - * @param [out] lyrics Lyric of index - * @return 0 on success, otherwise a negative error value + * @brief Gets the synclyrics of a media file. + * @since_tizen 2.3 + * + * @remarks You must release @a lyrics using @c free(). + * In case of accessing specific path in internal storage or external storage, you may add the privilege for accessing the path. \n + * For example, if you get the specific path by using storage_get_directory(). you should add previlege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage. + * + * @param[in] metadata The handle to metadata + * @param[in] index The index of time/lyrics to set + * @param[out] time_stamp The time information of the index + * @param[out] lyrics The lyrics of the index + * @return @c 0 on success, + * otherwise a negative error value * @retval #METADATA_EXTRACTOR_ERROR_NONE Successful * @retval #METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #METADATA_EXTRACTOR_ERROR_OPERATION_FAILED Internal Operation Fail - * @pre Set path to extract by calling metadata_extractor_set_path() - * @pre Get time/lyrics set number by calling metadata_extractor_get_metadata(METADATA_SYNCLYRICS_NUM) - * @see metadata_extractor_create(), metadata_extractor_destroy() + * @retval #METADATA_EXTRACTOR_ERROR_OPERATION_FAILED Internal operation failed + * @retval #METADATA_EXTRACTOR_ERROR_PERMISSION_DENIED Permission denied + * @pre Set the path to extract by calling metadata_extractor_set_path(). + * @pre Get the time/lyrics set number by calling metadata_extractor_get_metadata(METADATA_SYNCLYRICS_NUM). + * @see metadata_extractor_create() + * @see metadata_extractor_destroy() */ int metadata_extractor_get_synclyrics(metadata_extractor_h metadata, int index, unsigned long *time_stamp, char **lyrics); /** - * @brief Get a frame of video media - * - * @remarks @a frame must be released with @c free() by you - * - * @param [in] metadata The handle to metadata - * @param [in] timestamp The timestamp in milliseconds - * @param [in] is_accurate @a true, user can get an accurated frame for given the timestamp.\n - * @a false, user can only get the nearest i-frame of video rapidly. - * @param [out] frame raw frame data in RGB888 - * @param [out] size The frame data size - * @return 0 on success, otherwise a negative error value + * @brief Gets the frame of a video media. + * @since_tizen 2.3 + * + * @remarks You must release @a frame using @c free(). + * In case of accessing specific path in internal storage or external storage, you may add the privilege for accessing the path. \n + * For example, if you get the specific path by using storage_get_directory(). you should add previlege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage. + * + * @param[in] metadata The handle to metadata + * @param[in] timestamp The timestamp in milliseconds + * @param[in] is_accurate If @c true the user can get an accurate frame for the given timestamp,\n + * otherwise @c false if the user can only get the nearest i-frame of the video rapidly + * @param[out] frame The raw frame data in RGB888 + * @param[out] size The frame data size + * @return @c 0 on success, + * otherwise a negative error value * @retval #METADATA_EXTRACTOR_ERROR_NONE Successful * @retval #METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER Invalid parameter * @retval #METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY Not enough memory is available - * @retval #METADATA_EXTRACTOR_ERROR_OPERATION_FAILED Internal Operation Fail - * @pre Set path to extract by calling metadata_extractor_set_path() - * @see metadata_extractor_create(), metadata_extractor_destroy() + * @retval #METADATA_EXTRACTOR_ERROR_OPERATION_FAILED Internal operation failed + * @retval #METADATA_EXTRACTOR_ERROR_PERMISSION_DENIED Permission denied + * @pre Set the path to extract by calling metadata_extractor_set_path(). + * @see metadata_extractor_create() + * @see metadata_extractor_destroy() */ - int metadata_extractor_get_frame_at_time(metadata_extractor_h metadata, unsigned long timestamp, bool is_accurate, void **frame, int *size); /** diff --git a/include/metadata_extractor_type.h b/include/metadata_extractor_type.h index 85afe06..164610f 100755 --- a/include/metadata_extractor_type.h +++ b/include/metadata_extractor_type.h @@ -1,4 +1,3 @@ - /* * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved * @@ -15,8 +14,6 @@ * limitations under the License. */ - - #ifndef __TIZEN_MEDIA_METADATA_EXTRACTOR_TYPE_H__ #define __TIZEN_MEDIA_METADATA_EXTRACTOR_TYPE_H__ @@ -26,72 +23,76 @@ extern "C" { #endif /* __cplusplus */ +/** + * @file metadata_extractor_type.h + */ /** * @addtogroup CAPI_METADATA_EXTRACTOR_MODULE * @{ */ -/** Content Error Class */ -#define METADATA_EXTRACTOR_ERROR_CLASS TIZEN_ERROR_MULTIMEDIA_CLASS | 0x80 +/** @brief Definition for Content Error Class */ +#define METADATA_EXTRACTOR_ERROR_CLASS TIZEN_ERROR_METADATA_EXTRACTOR /** * @ingroup CAPI_METADATA_EXTRACTOR_MODULE - * @brief The enumerations of metadata extractor error + * @brief Enumeration for metadata extractor error. */ typedef enum { - METADATA_EXTRACTOR_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ - METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ - METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */ - METADATA_EXTRACTOR_ERROR_FILE_EXISTS = TIZEN_ERROR_FILE_EXISTS, /**< File not exist */ - METADATA_EXTRACTOR_ERROR_OPERATION_FAILED = METADATA_EXTRACTOR_ERROR_CLASS |0x01, /**< Invalid internal operation */ + METADATA_EXTRACTOR_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ + METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ + METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */ + METADATA_EXTRACTOR_ERROR_FILE_EXISTS = TIZEN_ERROR_FILE_EXISTS, /**< File does not exist */ + METADATA_EXTRACTOR_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */ + METADATA_EXTRACTOR_ERROR_OPERATION_FAILED = METADATA_EXTRACTOR_ERROR_CLASS |0x01, /**< Invalid internal operation */ } metadata_extractor_error_e; /** * @ingroup CAPI_METADATA_EXTRACTOR_MODULE - * @brief The enumerations of attribute + * @brief Enumeration for attribute. */ typedef enum { METADATA_DURATION = 0, /**< Duration */ METADATA_VIDEO_BITRATE, /**< Video Bitrate */ METADATA_VIDEO_FPS, /**< Video FPS */ - METADATA_VIDEO_WIDTH, /**< Video Width*/ - METADATA_VIDEO_HEIGHT, /**< Video Height*/ + METADATA_VIDEO_WIDTH, /**< Video Width */ + METADATA_VIDEO_HEIGHT, /**< Video Height */ METADATA_HAS_VIDEO, /**< Video stream count */ - METADATA_AUDIO_BITRATE, /**< Audio Bitrate*/ - METADATA_AUDIO_CHANNELS, /**< Audio Channels*/ - METADATA_AUDIO_SAMPLERATE, /**< Audio Samplerate*/ + METADATA_AUDIO_BITRATE, /**< Audio Bitrate */ + METADATA_AUDIO_CHANNELS, /**< Audio Channels */ + METADATA_AUDIO_SAMPLERATE, /**< Audio Samplerate */ + METADATA_AUDIO_BITPERSAMPLE, /**< Audio bit per sample */ METADATA_HAS_AUDIO, /**< Audio stream count */ - METADATA_ARTIST, /**< Artist*/ - METADATA_TITLE, /**< Title*/ - METADATA_ALBUM, /**< Album*/ - METADATA_ALBUM_ARTIST, /**< Album_Artist*/ - METADATA_GENRE, /**< Genre*/ - METADATA_AUTHOR, /**< Author*/ - METADATA_COPYRIGHT, /**< Copyright*/ - METADATA_DATE, /**< Date*/ - METADATA_DESCRIPTION, /**< Description*/ - METADATA_COMMENT, /**< Comment*/ - METADATA_TRACK_NUM, /**< Track number info*/ - METADATA_CLASSIFICATION, /**< Classification*/ - METADATA_RATING, /**< Rating*/ - METADATA_LONGITUDE, /**< Longitude*/ - METADATA_LATITUDE, /**< Latitude*/ - METADATA_ALTITUDE, /**< Altitude*/ - METADATA_CONDUCTOR, /**< Conductor*/ - METADATA_UNSYNCLYRICS, /**< Unsyncronized lyric*/ - METADATA_SYNCLYRICS_NUM, /**< Syncronized lyric (time/lyric set) number*/ - METADATA_RECDATE, /**< Recording date*/ - METADATA_ROTATE, /**< Rotate(Orientation) Information*/ + METADATA_ARTIST, /**< Artist */ + METADATA_TITLE, /**< Title */ + METADATA_ALBUM, /**< Album */ + METADATA_ALBUM_ARTIST, /**< Album_Artist */ + METADATA_GENRE, /**< Genre */ + METADATA_AUTHOR, /**< Author */ + METADATA_COPYRIGHT, /**< Copyright */ + METADATA_DATE, /**< Date */ + METADATA_DESCRIPTION, /**< Description */ + METADATA_COMMENT, /**< Comment */ + METADATA_TRACK_NUM, /**< Track number info */ + METADATA_CLASSIFICATION, /**< Classification */ + METADATA_RATING, /**< Rating */ + METADATA_LONGITUDE, /**< Longitude */ + METADATA_LATITUDE, /**< Latitude */ + METADATA_ALTITUDE, /**< Altitude */ + METADATA_CONDUCTOR, /**< Conductor */ + METADATA_UNSYNCLYRICS, /**< Unsynchronized lyric */ + METADATA_SYNCLYRICS_NUM, /**< Synchronized lyric (time/lyric set) number */ + METADATA_RECDATE, /**< Recording date */ + METADATA_ROTATE, /**< Rotate(Orientation) Information */ } metadata_extractor_attr_e; - /** * @ingroup CAPI_METADATA_EXTRACTOR_MODULE - * @brief The handle of metadata extractor + * @brief The metadata extractor handle. */ typedef struct metadata_extractor_s* metadata_extractor_h; @@ -103,5 +104,4 @@ typedef struct metadata_extractor_s* metadata_extractor_h; } #endif /* __cplusplus */ - #endif /*__TIZEN_MEDIA_METADATA_EXTRACTOR_TYPE_H__*/ diff --git a/packaging/capi-media-metadata-extractor.spec b/packaging/capi-media-metadata-extractor.spec index 8c05bda..ba68cf1 100755 --- a/packaging/capi-media-metadata-extractor.spec +++ b/packaging/capi-media-metadata-extractor.spec @@ -1,8 +1,7 @@ Name: capi-media-metadata-extractor Summary: A media metadata extractor library in SLP C API -Version: 0.1.8 +Version: 0.1.12 Release: 1 -VCS: framework/api/metadata-extractor#capi-media-metadata-extracor_0.1.0-18-19-gfadce61f1fd37610563c17b97e0e41ff893c598c Group: System/Libraries License: Apache License, Version 2.0 Source0: %{name}-%{version}.tar.gz diff --git a/src/metadata_extractor.c b/src/metadata_extractor.c index 4b5affa..d5f1881 100755 --- a/src/metadata_extractor.c +++ b/src/metadata_extractor.c @@ -447,6 +447,34 @@ static int __metadata_extractor_get_audio_samplerate(metadata_extractor_s *metad return ret; } +static int __metadata_extractor_get_audio_bitpersample(metadata_extractor_s *metadata, int *bitpersample) +{ + int ret = METADATA_EXTRACTOR_ERROR_NONE; + char *err_attr_name = NULL; + int _audio_bit_per_sample = 0; + + if((!metadata) ||(!metadata->attr_h)) + { + metadata_extractor_error("INVALID_PARAMETER(0x%08x)", METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER); + return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER; + } + + if(metadata->audio_track_cnt > 0) + { + ret = mm_file_get_attrs(metadata->attr_h, &err_attr_name, MM_FILE_CONTENT_AUDIO_BITPERSAMPLE, &_audio_bit_per_sample, NULL); + if(ret != MM_ERROR_NONE) + { + metadata_extractor_error("METADATA_EXTRACTOR_ERROR_OPERATION_FAILED(0x%08x)", ret); + SAFE_FREE(err_attr_name); + return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED; + } + } + + *bitpersample = _audio_bit_per_sample; + + return ret; +} + static int __metadata_extractor_get_audio_track_count(metadata_extractor_s *metadata, int *track_cnt) { int ret = METADATA_EXTRACTOR_ERROR_NONE; @@ -1377,6 +1405,12 @@ int metadata_extractor_get_metadata(metadata_extractor_h metadata, metadata_extr ret = __metadata_extractor_get_audio_samplerate(_metadata, &i_value); break; } + case METADATA_AUDIO_BITPERSAMPLE: + { + is_string = 0; + ret = __metadata_extractor_get_audio_bitpersample(_metadata, &i_value); + break; + } case METADATA_HAS_AUDIO: { is_string = 0; @@ -1636,7 +1670,7 @@ int metadata_extractor_get_frame(metadata_extractor_h metadata, void **frame, in return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER; } - ret = __metadata_extractor_check_and_extract_meta(_metadata, METADATA_TYPE_TAG); + ret = __metadata_extractor_check_and_extract_meta(_metadata, METADATA_TYPE_ATTR); if(ret != METADATA_EXTRACTOR_ERROR_NONE) { return ret; |