--- /dev/null
+ 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.
--- /dev/null
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <mm_file.h>
+#include <mm_error.h>
+#include <dlog.h>
+#include <metadata_extractor.h>
+#include <metadata_extractor_private.h>
+
+#define SAFE_FREE(src) { if(src) {free(src); src = NULL;}}
+#define META_MAX_LEN 256
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "CAPI_MEDIA_METADATA_EXTRACTOR"
+
+static int __metadata_extractor_check_and_extract_meta(metadata_extractor_s *metadata);
+static int __metadata_extractor_create_content_attrs(metadata_extractor_s *metadata, const char *path);
+static int __metadata_extractor_create_tag_attr(metadata_extractor_s *metadata, const char *path);
+static int __metadata_extractor_get_artwork(metadata_extractor_s *metadata, void **artwork, int *artwork_size);
+static int __metadata_extractor_get_artwork_mime(metadata_extractor_s *metadata, char **artwork_mime);
+static int __metadata_extractor_get_video_thumbnail(metadata_extractor_s *metadata, void **thumbnail, int *thumbnail_len);
+static int __metadata_extractor_get_duration(metadata_extractor_s *metadata, int *duration);
+static int __metadata_extractor_get_audio_bitrate(metadata_extractor_s *metadata, int *bitrate);
+static int __metadata_extractor_get_audio_channel(metadata_extractor_s *metadata, int *channel);
+static int __metadata_extractor_get_audio_samplerate(metadata_extractor_s *metadata, int *samplerate);
+static int __metadata_extractor_get_audio_track_count(metadata_extractor_s *metadata, int *track_cnt);
+static int __metadata_extractor_get_video_bitrate(metadata_extractor_s *metadata, int *bitrate);
+static int __metadata_extractor_get_video_FPS(metadata_extractor_s *metadata, int *fps);
+static int __metadata_extractor_get_video_width(metadata_extractor_s *metadata, int *width);
+static int __metadata_extractor_get_video_height(metadata_extractor_s *metadata, int *height);
+static int __metadata_extractor_get_video_track_count(metadata_extractor_s *metadata, int *track_cnt);
+static int __metadata_extractor_get_artist(metadata_extractor_s *metadata, char **artist);
+static int __metadata_extractor_get_title(metadata_extractor_s *metadata, char **title);
+static int __metadata_extractor_get_album(metadata_extractor_s *metadata, char **album);
+static int __metadata_extractor_get_genre(metadata_extractor_s *metadata, char **genre);
+static int __metadata_extractor_get_author(metadata_extractor_s *metadata, char **author);
+static int __metadata_extractor_get_copyright(metadata_extractor_s *metadata, char **copyright);
+static int __metadata_extractor_get_date(metadata_extractor_s *metadata, char **date);
+static int __metadata_extractor_get_description(metadata_extractor_s *metadata, char **description);
+static int __metadata_extractor_get_track_num(metadata_extractor_s *metadata, char **track_num);
+static int __metadata_extractor_get_classification(metadata_extractor_s *metadata, char **classification);
+static int __metadata_extractor_get_rating(metadata_extractor_s *metadata, char **rating);
+static int __metadata_extractor_get_longitude(metadata_extractor_s *metadata, double *longitude);
+static int __metadata_extractor_get_latitude(metadata_extractor_s *metadata, double *latitude);
+static int __metadata_extractor_get_altitude(metadata_extractor_s *metadata, double *altitude);
+static int __metadata_extractor_get_conductor(metadata_extractor_s *metadata, char **conductor);
+static int __metadata_extractor_get_unsynclyrics(metadata_extractor_s *metadata, char **unsynclyrics);
+static int __metadata_extractor_get_recording_date(metadata_extractor_s *metadata, char **rec_date);
+static int __metadata_extractor_get_synclyrics_pair_num(metadata_extractor_s *metadata, int *synclyrics_num);
+static int __metadata_extractor_destroy_handle(metadata_extractor_s *metadata);
+
+static int __metadata_extractor_check_and_extract_meta(metadata_extractor_s *metadata)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+
+ LOGI("enter \n");
+
+ if(metadata->extract_meta)
+ {
+ LOGI("metadata already extracted \n");
+ return ret;
+ }
+
+ ret = __metadata_extractor_create_content_attrs(metadata, metadata->path);
+ if(ret != METADATA_EXTRACTOR_ERROR_NONE)
+ {
+ return ret;
+ }
+
+ ret = __metadata_extractor_create_tag_attr(metadata, metadata->path);
+ if(ret != METADATA_EXTRACTOR_ERROR_NONE)
+ {
+ return ret;
+ }
+
+ metadata->extract_meta = true;
+
+ LOGI("leave \n");
+
+ return ret;
+}
+
+static int __metadata_extractor_create_content_attrs(metadata_extractor_s *metadata, const char *path)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ MMHandleType content = 0;
+ char *err_attr_name = NULL;
+
+ int _audio_track_cnt = 0;
+ int _video_track_cnt = 0;
+
+ LOGI("enter \n");
+
+ ret = mm_file_create_content_attrs(&content, path);
+
+ if(ret != MM_ERROR_NONE)
+ {
+ if(ret == MM_ERROR_FILE_NOT_FOUND)
+ {
+ LOGE("FILE_NOT_EXISTS(0x%08x)", METADATA_EXTRACTOR_ERROR_FILE_EXISTS);
+ return METADATA_EXTRACTOR_ERROR_FILE_EXISTS;
+ }
+ else
+ {
+ LOGE("ERROR_UNKNOWN(0x%08x)", METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+
+ ret = mm_file_get_attrs(content, &err_attr_name,
+ MM_FILE_CONTENT_VIDEO_TRACK_COUNT, &_video_track_cnt,
+ MM_FILE_CONTENT_AUDIO_TRACK_COUNT, &_audio_track_cnt,
+ NULL);
+
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ mm_file_destroy_content_attrs(content);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ metadata->attr_h = content;
+ metadata->audio_track_cnt = _audio_track_cnt;
+ metadata->video_track_cnt = _video_track_cnt;
+
+ LOGI("leave \n");
+
+ return ret;
+
+}
+
+
+static int __metadata_extractor_create_tag_attr(metadata_extractor_s *metadata, const char *path)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ MMHandleType tag = 0;
+
+ LOGI("enter \n");
+ ret = mm_file_create_tag_attrs(&tag, path);
+
+ if(ret != MM_ERROR_NONE)
+ {
+ if(ret == MM_ERROR_FILE_NOT_FOUND)
+ {
+ LOGE("FILE_NOT_EXISTS(0x%08x)", METADATA_EXTRACTOR_ERROR_FILE_EXISTS);
+ return METADATA_EXTRACTOR_ERROR_FILE_EXISTS;
+ }
+ else
+ {
+ LOGE("ERROR_UNKNOWN(0x%08x)", METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+
+ metadata->tag_h= tag;
+
+ LOGI("leave \n");
+ return ret;
+
+}
+
+static int __metadata_extractor_get_duration(metadata_extractor_s *metadata, int *duration)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ int _duration = 0;
+
+ if((!metadata) ||(!metadata->attr_h))
+ {
+ LOGE("INVALID_PARAMETER(0x%08x)", METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = mm_file_get_attrs(metadata->attr_h, &err_attr_name, MM_FILE_CONTENT_DURATION, &_duration, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *duration = _duration;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_audio_bitrate(metadata_extractor_s *metadata, int *bitrate)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ int _audio_bitrate = 0;
+
+ if((!metadata) ||(!metadata->attr_h))
+ {
+ LOGE("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_BITRATE, &_audio_bitrate, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+
+ *bitrate = _audio_bitrate;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_audio_channel(metadata_extractor_s *metadata, int *channel)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ int _audio_channel = 0;
+
+ if((!metadata) ||(!metadata->attr_h))
+ {
+ LOGE("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_CHANNELS, &_audio_channel, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+
+ *channel = _audio_channel;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_audio_samplerate(metadata_extractor_s *metadata, int *samplerate)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ int _audio_samplerate = 0;
+
+ if((!metadata) ||(!metadata->attr_h))
+ {
+ LOGE("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_SAMPLERATE, &_audio_samplerate, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+
+ *samplerate = _audio_samplerate;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_audio_track_count(metadata_extractor_s *metadata, int *track_cnt)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+
+ if(!metadata)
+ {
+ LOGE("INVALID_PARAMETER(0x%08x)", METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ *track_cnt = metadata->audio_track_cnt;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_video_bitrate(metadata_extractor_s *metadata, int *bitrate)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ int _video_bitrate = 0;
+
+ if((!metadata) ||(!metadata->attr_h))
+ {
+ LOGE("INVALID_PARAMETER(0x%08x)", METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ if(metadata->video_track_cnt > 0)
+ {
+ ret = mm_file_get_attrs(metadata->attr_h, &err_attr_name, MM_FILE_CONTENT_VIDEO_BITRATE, &_video_bitrate, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+ *bitrate = _video_bitrate;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_video_FPS(metadata_extractor_s *metadata, int *fps)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ int _video_fps = 0;
+
+ if((!metadata) ||(!metadata->attr_h))
+ {
+ LOGE("INVALID_PARAMETER(0x%08x)", METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ if(metadata->video_track_cnt > 0)
+ {
+ ret = mm_file_get_attrs(metadata->attr_h, &err_attr_name, MM_FILE_CONTENT_VIDEO_FPS, &_video_fps, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+
+ *fps = _video_fps;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_video_width(metadata_extractor_s *metadata, int *width)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ int _video_width = 0;
+
+ if((!metadata) ||(!metadata->attr_h))
+ {
+ LOGE("INVALID_PARAMETER(0x%08x)", METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ if(metadata->video_track_cnt > 0)
+ {
+ ret = mm_file_get_attrs(metadata->attr_h, &err_attr_name, MM_FILE_CONTENT_VIDEO_WIDTH, &_video_width, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+
+ *width = _video_width;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_video_height(metadata_extractor_s *metadata, int *height)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ int _video_height = 0;
+
+ if((!metadata) ||(!metadata->attr_h))
+ {
+ LOGE("INVALID_PARAMETER(0x%08x)", METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ if(metadata->video_track_cnt > 0)
+ {
+ ret = mm_file_get_attrs(metadata->attr_h, &err_attr_name, MM_FILE_CONTENT_VIDEO_HEIGHT, &_video_height, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+
+ *height = _video_height;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_video_thumbnail(metadata_extractor_s *metadata, void **thumbnail, int *thumbnail_len)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ void *_video_thumbnail = NULL;
+ int _video_thumbnail_len = 0;
+
+ if((!metadata) ||(!metadata->attr_h))
+ {
+ LOGE("INVALID_PARAMETER(0x%08x)", METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ if(metadata->video_track_cnt > 0)
+ {
+ ret = mm_file_get_attrs(metadata->attr_h, &err_attr_name, MM_FILE_CONTENT_VIDEO_THUMBNAIL, &_video_thumbnail, &_video_thumbnail_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+
+ *thumbnail = _video_thumbnail;
+ *thumbnail_len = _video_thumbnail_len;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_video_track_count(metadata_extractor_s *metadata, int *track_cnt)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+
+ if(!metadata)
+ {
+ LOGE("INVALID_PARAMETER(0x%08x)", METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ *track_cnt = metadata->video_track_cnt;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_artist(metadata_extractor_s *metadata, char **artist)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ char *_artist = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_ARTIST, &_artist, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *artist = _artist;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_title(metadata_extractor_s *metadata, char **title)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ char *_title = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_TITLE, &_title, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *title = _title;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_album(metadata_extractor_s *metadata, char **album)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ char *_album = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_ALBUM, &_album, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *album = _album;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_genre(metadata_extractor_s *metadata, char **genre)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ char *_genre = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_GENRE, &_genre, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *genre = _genre;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_author(metadata_extractor_s *metadata, char **author)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ char *_author = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_AUTHOR, &_author, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *author = _author;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_copyright(metadata_extractor_s *metadata, char **copyright)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ char *_copyright = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_COPYRIGHT, &_copyright, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *copyright = _copyright;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_date(metadata_extractor_s *metadata, char **date)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ char *_date = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_DATE, &_date, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *date = _date;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_description(metadata_extractor_s *metadata, char **description)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ char *_description = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_DESCRIPTION, &_description, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *description = _description;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_artwork(metadata_extractor_s *metadata, void **artwork, int *artwork_size)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ void *_artwork = NULL;
+ int _artwork_size = 0;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_ARTWORK_SIZE, &_artwork_size, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ if(_artwork_size > 0)
+ {
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_ARTWORK, &_artwork, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+
+ *artwork = _artwork;
+ *artwork_size = _artwork_size;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_artwork_mime(metadata_extractor_s *metadata, char **artwork_mime)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ char *_artwork_mime = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_ARTWORK_MIME, &_artwork_mime, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *artwork_mime = _artwork_mime;
+
+ return ret;
+}
+
+
+static int __metadata_extractor_get_track_num(metadata_extractor_s *metadata, char **track_num)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ char *_track_num = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_TRACK_NUM, &_track_num, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *track_num = _track_num;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_classification(metadata_extractor_s *metadata, char **classification)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ char *_classification = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_CLASSIFICATION, &_classification, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *classification = _classification;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_rating(metadata_extractor_s *metadata, char **rating)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ char *_rating = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_RATING, &_rating, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *rating = _rating;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_longitude(metadata_extractor_s *metadata, double *longitude)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ double _longitude = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_LONGITUDE, &_longitude, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *longitude = _longitude;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_latitude(metadata_extractor_s *metadata, double *latitude)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ double _latitude = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_LATIDUE, &_latitude, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *latitude = _latitude;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_altitude(metadata_extractor_s *metadata, double *altitude)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ double _altitude = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_ALTIDUE, &_altitude, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *altitude = _altitude;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_conductor(metadata_extractor_s *metadata, char **conductor)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ char *_conductor = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_CONDUCTOR, &_conductor, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *conductor = _conductor;
+
+ return ret;
+}
+static int __metadata_extractor_get_unsynclyrics(metadata_extractor_s *metadata, char **unsynclyrics)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ char *_unsynclyrics = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_UNSYNCLYRICS, &_unsynclyrics, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *unsynclyrics = _unsynclyrics;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_recording_date(metadata_extractor_s *metadata, char **rec_date)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ char *_rec_date = NULL;
+ int _tag_len = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_RECDATE, &_rec_date, &_tag_len, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *rec_date = _rec_date;
+
+ return ret;
+}
+
+static int __metadata_extractor_get_synclyrics_pair_num(metadata_extractor_s *metadata, int *synclyrics_num)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *err_attr_name = NULL;
+ int _synclyrics_num = 0;
+
+ ret = mm_file_get_attrs(metadata->tag_h, &err_attr_name, MM_FILE_TAG_SYNCLYRICS_NUM, &_synclyrics_num, NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("err_attr_name(%s), ERROR_UNKNOWN(0x%08x)", err_attr_name, METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ SAFE_FREE(err_attr_name);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *synclyrics_num = _synclyrics_num;
+
+ return ret;
+}
+
+static int __metadata_extractor_destroy_handle(metadata_extractor_s *metadata)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+
+ LOGI("enter \n");
+
+ if(metadata->attr_h)
+ {
+ ret = mm_file_destroy_content_attrs(metadata->attr_h);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("ERROR_UNKNOWN(0x%08x)", METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+
+ if(metadata->tag_h)
+ {
+ ret = mm_file_destroy_tag_attrs(metadata->tag_h);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("ERROR_UNKNOWN(0x%08x)", METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+
+ LOGI("leave \n");
+
+ return ret;
+}
+
+
+int metadata_extractor_create(metadata_extractor_h *metadata)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+
+ LOGI("enter \n");
+
+ if(metadata == NULL)
+ {
+ LOGE("INVALID_PARAMETER(0x%08x)", METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ metadata_extractor_s *_metadata = (metadata_extractor_s*)calloc(1,sizeof(metadata_extractor_s));
+ if(_metadata == NULL)
+ {
+ LOGE("OUT_OF_MEMORY(0x%08x)", METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY);
+ return METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY;
+ }
+
+ _metadata->path = NULL;
+ _metadata->extract_meta = false;
+ _metadata->audio_track_cnt = 0;
+ _metadata->video_track_cnt = 0;
+
+ *metadata = (metadata_extractor_h)_metadata;
+
+ LOGI("leave \n");
+
+ return ret;
+}
+
+int metadata_extractor_set_path(metadata_extractor_h metadata, const char *path)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ metadata_extractor_s *_metadata = (metadata_extractor_s*)metadata;
+
+ LOGI("enter \n");
+
+ if((_metadata == NULL) || (path == NULL))
+ {
+ LOGE("INVALID_PARAMETER(0x%08x)", METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ LOGI("path [%s] \n", path);
+
+ if(_metadata->path != NULL)
+ {
+ __metadata_extractor_destroy_handle(_metadata);
+ SAFE_FREE(_metadata->path);
+ _metadata->extract_meta = false;
+ _metadata->attr_h = 0;
+ _metadata->tag_h = 0;
+ }
+
+ _metadata->path = strdup(path);
+ if(_metadata->path == NULL)
+ {
+ LOGE("OUT_OF_MEMORY(0x%08x)", METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY);
+ return METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY;
+ }
+
+ LOGI("leave \n");
+
+ return ret;
+}
+
+int metadata_extractor_destroy(metadata_extractor_h metadata)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ metadata_extractor_s *_metadata = (metadata_extractor_s*)metadata;
+
+ LOGI("enter \n");
+
+ if(!_metadata)
+ {
+ LOGE("INVALID_PARAMETER(0x%08x)", METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = __metadata_extractor_destroy_handle(_metadata);
+
+ SAFE_FREE(_metadata->path);
+
+ SAFE_FREE(_metadata);
+
+ LOGI("leave \n");
+
+ return ret;
+}
+
+int metadata_extractor_get_synclyrics(metadata_extractor_h metadata, int index, unsigned long *time_stamp, char **lyrics)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ metadata_extractor_s *_metadata = (metadata_extractor_s*)metadata;
+ unsigned long _time_info = 0;
+ char *_lyrics = NULL;
+ int _synclyrics_num = 0;
+
+ if((!_metadata) || (!_metadata->path))
+ {
+ LOGE("INVALID_PARAMETER(0x%08x)", METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = __metadata_extractor_check_and_extract_meta(_metadata);
+ if(ret != METADATA_EXTRACTOR_ERROR_NONE)
+ {
+ return ret;
+ }
+
+ ret = __metadata_extractor_get_synclyrics_pair_num(_metadata, &_synclyrics_num);
+ if(ret != METADATA_EXTRACTOR_ERROR_NONE)
+ {
+ return ret;
+ }
+
+ if((_synclyrics_num > 0) && (index < _synclyrics_num))
+ {
+ ret = mm_file_get_synclyrics_info((MMHandleType)_metadata->tag_h, index, &_time_info, &_lyrics);
+ if(ret != MM_ERROR_NONE)
+ {
+ LOGE("ERROR_UNKNOWN(0x%08x)", METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ *lyrics = _lyrics;
+ *time_stamp = _time_info;
+ }
+ else
+ {
+ *lyrics = NULL;
+ *time_stamp = 0;
+ }
+
+ return ret;
+}
+
+int metadata_extractor_get_metadata(metadata_extractor_h metadata, metadata_extractor_attr_e attribute, char **value)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ metadata_extractor_s *_metadata = (metadata_extractor_s*)metadata;
+ int i_value = 0;
+ double d_value = 0;
+ char *s_value = NULL;
+ int is_string = 0;
+ int is_double = 0;
+
+ if((!_metadata) || (!_metadata->path))
+ {
+ LOGE("INVALID_PARAMETER(0x%08x)", METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = __metadata_extractor_check_and_extract_meta(_metadata);
+ if(ret != METADATA_EXTRACTOR_ERROR_NONE)
+ {
+ return ret;
+ }
+
+ switch (attribute) {
+ case METADATA_DURATION:
+ {
+ is_string = 0;
+ ret = __metadata_extractor_get_duration(_metadata, &i_value);
+ break;
+ }
+ case METADATA_VIDEO_BITRATE:
+ {
+ is_string = 0;
+ ret = __metadata_extractor_get_video_bitrate(_metadata, &i_value);
+ break;
+ }
+ case METADATA_VIDEO_FPS:
+ {
+ is_string = 0;
+ ret = __metadata_extractor_get_video_FPS(_metadata, &i_value);
+ break;
+ }
+ case METADATA_VIDEO_WIDTH:
+ {
+ is_string = 0;
+ ret = __metadata_extractor_get_video_width(_metadata, &i_value);
+ break;
+ }
+ case METADATA_VIDEO_HEIGHT:
+ {
+ is_string = 0;
+ ret = __metadata_extractor_get_video_height(_metadata, &i_value);
+ break;
+ }
+ case METADATA_HAS_VIDEO:
+ {
+ is_string = 0;
+ ret = __metadata_extractor_get_video_track_count(_metadata, &i_value);
+ break;
+ }
+ case METADATA_AUDIO_BITRATE:
+ {
+ is_string = 0;
+ ret = __metadata_extractor_get_audio_bitrate(_metadata, &i_value);
+ break;
+ }
+ case METADATA_AUDIO_CHANNELS:
+ {
+ is_string = 0;
+ ret = __metadata_extractor_get_audio_channel(_metadata, &i_value);
+ break;
+ }
+ case METADATA_AUDIO_SAMPLERATE:
+ {
+ is_string = 0;
+ ret = __metadata_extractor_get_audio_samplerate(_metadata, &i_value);
+ break;
+ }
+ case METADATA_HAS_AUDIO:
+ {
+ is_string = 0;
+ ret = __metadata_extractor_get_audio_track_count(_metadata, &i_value);
+ break;
+ }
+ case METADATA_ARTIST:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_artist(_metadata, &s_value);
+ break;
+ }
+ case METADATA_TITLE:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_title(_metadata, &s_value);
+ break;
+ }
+ case METADATA_ALBUM:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_album(_metadata, &s_value);
+ break;
+ }
+ case METADATA_GENRE:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_genre(_metadata, &s_value);
+ break;
+ }
+ case METADATA_AUTHOR:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_author(_metadata, &s_value);
+ break;
+ }
+ case METADATA_COPYRIGHT:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_copyright(_metadata, &s_value);
+ break;
+ }
+ case METADATA_DATE:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_date(_metadata, &s_value);
+ break;
+ }
+ case METADATA_DESCRIPTION:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_description(_metadata, &s_value);
+ break;
+ }
+ case METADATA_TRACK_NUM:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_track_num(_metadata, &s_value);
+ break;
+ }
+ case METADATA_CLASSIFICATION:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_classification(_metadata, &s_value);
+ break;
+ }
+ case METADATA_RATING:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_rating(_metadata, &s_value);
+ break;
+ }
+ case METADATA_LONGITUDE:
+ {
+ is_double = 1;
+ ret = __metadata_extractor_get_longitude(_metadata, &d_value);
+ break;
+ }
+ case METADATA_LATITUDE:
+ {
+ is_double = 1;
+ ret = __metadata_extractor_get_latitude(_metadata, &d_value);
+ break;
+ }
+ case METADATA_ALTITUDE:
+ {
+ is_double = 1;
+ ret = __metadata_extractor_get_altitude(_metadata, &d_value);
+ break;
+ }
+ case METADATA_CONDUCTOR:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_conductor(_metadata, &s_value);
+ break;
+ }
+ case METADATA_UNSYNCLYRICS:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_unsynclyrics(_metadata, &s_value);
+ break;
+ }
+ case METADATA_SYNCLYRICS_NUM:
+ {
+ is_string = 0;
+ ret = __metadata_extractor_get_synclyrics_pair_num(_metadata, &i_value);
+ break;
+ }
+ case METADATA_RECDATE:
+ {
+ is_string = 1;
+ ret = __metadata_extractor_get_recording_date(_metadata, &s_value);
+ break;
+ }
+ default:
+ {
+ LOGE("INVALID_PARAMETER [%d] (0x%08x)", attribute, METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+ }
+
+ if(ret != METADATA_EXTRACTOR_ERROR_NONE)
+ {
+ *value = NULL;
+ return ret;
+ }
+
+ if(is_string)
+ {
+ if((s_value != NULL) && (strlen(s_value) > 0))
+ {
+ *value = strdup(s_value);
+ if(*value == NULL)
+ {
+ LOGE("OUT_OF_MEMORY(0x%08x)", METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY);
+ return METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY;
+ }
+ }
+ else
+ {
+ *value = NULL;
+ }
+ }
+ else
+ {
+ char metadata[META_MAX_LEN] = {0, };
+
+ if(is_double)
+ {
+ snprintf(metadata, sizeof(metadata), "%f", d_value);
+ }
+ else
+ {
+ snprintf(metadata, sizeof(metadata), "%d", i_value);
+ }
+
+ *value = strdup(metadata);
+ if(*value == NULL)
+ {
+ LOGE("OUT_OF_MEMORY(0x%08x)", METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY);
+ return METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY;
+ }
+ }
+
+ return ret;
+}
+
+int metadata_extractor_get_artwork(metadata_extractor_h metadata, void **artwork, int *size, char **mime_type)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ metadata_extractor_s *_metadata = (metadata_extractor_s*)metadata;
+ void *_artwork = NULL;
+ int _artwork_size = 0;
+ char *_artwork_mime = NULL;
+
+ LOGI("enter \n");
+
+ if((!_metadata) || (!_metadata->path))
+ {
+ LOGE("INVALID_PARAMETER(0x%08x)", METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = __metadata_extractor_check_and_extract_meta(_metadata);
+ if(ret != METADATA_EXTRACTOR_ERROR_NONE)
+ {
+ return ret;
+ }
+
+ ret = __metadata_extractor_get_artwork(_metadata, &_artwork, &_artwork_size);
+ if(ret != METADATA_EXTRACTOR_ERROR_NONE)
+ {
+ return ret;
+ }
+
+ if((_artwork_size > 0) && (_artwork != NULL))
+ {
+ ret = __metadata_extractor_get_artwork_mime(_metadata, &_artwork_mime);
+ if(ret != METADATA_EXTRACTOR_ERROR_NONE)
+ {
+ *artwork = NULL;
+ *size = 0;
+
+ return ret;
+ }
+
+ *artwork = calloc(1, _artwork_size);
+ memcpy(*artwork, _artwork, _artwork_size);
+ *size = _artwork_size;
+
+ if((_artwork_mime != NULL) && (strlen(_artwork_mime) > 0))
+ {
+ *mime_type = strdup(_artwork_mime);
+ if(*mime_type == NULL)
+ {
+ LOGE("OUT_OF_MEMORY(0x%08x)", METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY);
+ return METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY;
+ }
+ }
+ else
+ {
+ *mime_type = NULL;
+ }
+
+ }
+ else
+ {
+ *artwork = NULL;
+ *mime_type = NULL;
+ *size = 0;
+ }
+
+ LOGI("leave \n");
+
+ return ret;
+}
+
+int metadata_extractor_get_frame(metadata_extractor_h metadata, void **frame, int *size)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ metadata_extractor_s *_metadata = (metadata_extractor_s*)metadata;
+ void *_frame = NULL;
+ int _frame_size = 0;
+
+ LOGI("enter \n");
+
+ if((!_metadata) || (!_metadata->path) || (!size))
+ {
+ LOGE("INVALID_PARAMETER(0x%08x)", METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = __metadata_extractor_check_and_extract_meta(_metadata);
+ if(ret != METADATA_EXTRACTOR_ERROR_NONE)
+ {
+ return ret;
+ }
+
+ ret = __metadata_extractor_get_video_thumbnail(_metadata, &_frame, &_frame_size);
+ if(ret != METADATA_EXTRACTOR_ERROR_NONE)
+ {
+ return ret;
+ }
+
+ if((_frame_size > 0) && (_frame != NULL))
+ {
+ *frame = calloc(1, _frame_size);
+ if(*frame == NULL)
+ {
+ LOGE("OUT_OF_MEMORY(0x%08x)", METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY);
+ return METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY;
+ }
+ memcpy(*frame, _frame, _frame_size);
+ *size = _frame_size;
+ }
+ else
+ {
+ *frame = NULL;
+ *size = 0;
+ }
+
+ LOGI("leave \n");
+
+ return ret;
+}
+
+int metadata_extractor_get_frame_at_time(metadata_extractor_h metadata, unsigned long timestamp, bool is_accurate, void **frame, int *size)
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ metadata_extractor_s *_metadata = (metadata_extractor_s*)metadata;
+ void *_frame = NULL;
+ int _frame_size = 0;
+ int width = 0;
+ int height = 0;
+ long micro_timestamp = 0;
+
+ LOGI("enter \n");
+
+ if((!_metadata) || (!_metadata->path) ||(!size))
+ {
+ LOGE("INVALID_PARAMETER(0x%08x)", METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER);
+ return METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER;
+ }
+
+ micro_timestamp = timestamp * 1000;
+
+ ret = mm_file_get_video_frame(_metadata->path, micro_timestamp, is_accurate, (unsigned char **)&_frame, &_frame_size, &width, &height);
+ if(ret != MM_ERROR_NONE)
+ {
+ SAFE_FREE(_frame);
+ LOGE("ERROR_UNKNOWN(0x%08x)", METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+
+ if(_frame != NULL)
+ {
+ if((_frame_size > 0))
+ {
+ *frame = _frame;
+ *size = _frame_size;
+ }
+ else
+ {
+ SAFE_FREE(_frame);
+ LOGE("ERROR_UNKNOWN(0x%08x)", METADATA_EXTRACTOR_ERROR_OPERATION_FAILED);
+ return METADATA_EXTRACTOR_ERROR_OPERATION_FAILED;
+ }
+ }
+ else
+ {
+ *frame = NULL;
+ *size = 0;
+ }
+
+ LOGI("leave \n");
+
+ return ret;
+}
--- /dev/null
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdbool.h>
+#include <dlog.h>
+#include <metadata_extractor.h>
+
+#define SAFE_FREE(src) { if(src) {free(src); src = NULL;}}
+
+static int _is_file_exist (const char *filename);
+static bool __capi_metadata_extractor(metadata_extractor_h metadata);
+
+static int _is_file_exist (const char *filename)
+{
+ int ret = 1;
+ if (filename) {
+ const char *to_access = (strstr(filename,"file://")!=NULL)? filename+7:filename;
+ ret = access (to_access, R_OK );
+ if (ret != 0) {
+ printf("file [%s] not found.\n", to_access);
+ }
+ }
+ return !ret;
+}
+
+static bool __capi_metadata_extractor(metadata_extractor_h metadata)
+{
+ char *duration = 0;
+ char *audio_bitrate = 0;
+ char *audio_channel = 0;
+ char *audio_samplerate = 0;
+ char *audio_track_cnt = 0;
+ char *video_bitrate = 0;
+ char *video_fps = 0;
+ char *video_width = 0;
+ char *video_height = 0;
+ char *video_track_cnt = 0;
+ void *video_thumbnail = NULL;
+ int video_thumbnail_len = 0;
+ void *video_frame = NULL;
+ int video_frame_len = 0;
+
+ /*Tag info*/
+ char *artist = NULL;
+ char *title = NULL;
+ char *album = NULL;
+ char *genre = NULL;
+ char *author = NULL;
+ char *copyright = NULL;
+ char *date = NULL;
+ char *description = NULL;
+ void *artwork = NULL;
+ int artwork_size = 0;
+ char *artwork_mime = NULL;
+ char *track_num = NULL;
+ char *classification = NULL;
+ char *rating = NULL;
+ char *longitude = 0;
+ char *latitude = 0;
+ char *altitude = 0;
+ char *conductor = NULL;
+ char *unsynclyrics = NULL;
+ char *synclyrics_num = 0;
+ char *rec_date = NULL;
+
+ int idx = 0;
+ unsigned long time_info = 0;
+ char *lyrics = NULL;
+
+ if(metadata == NULL)
+ {
+ printf("Invalid handle \n");
+ return false;
+ }
+
+ /*Get metadata*/
+ metadata_extractor_get_metadata(metadata, METADATA_DURATION, &duration);
+ printf("duration = [%s]\n", duration);
+ metadata_extractor_get_metadata(metadata, METADATA_AUDIO_BITRATE, &audio_bitrate);
+ printf("audio_bitrate = [%s]bps\n", audio_bitrate);
+ metadata_extractor_get_metadata(metadata, METADATA_AUDIO_CHANNELS, &audio_channel);
+ printf("audio_channel = [%s]\n", audio_channel);
+ metadata_extractor_get_metadata(metadata, METADATA_AUDIO_SAMPLERATE, &audio_samplerate);
+ printf("audio_samplerate = [%s]Hz\n", audio_samplerate);
+ metadata_extractor_get_metadata(metadata, METADATA_HAS_AUDIO, &audio_track_cnt);
+ printf("audio_track_cnt = [%s]\n", audio_track_cnt);
+ metadata_extractor_get_metadata(metadata, METADATA_VIDEO_BITRATE, &video_bitrate);
+ printf("video_bitrate = [%s]bps\n", video_bitrate);
+ metadata_extractor_get_metadata(metadata, METADATA_VIDEO_FPS, &video_fps);
+ printf("video_fps = [%s]\n", video_fps);
+ metadata_extractor_get_metadata(metadata, METADATA_VIDEO_WIDTH, &video_width);
+ printf("video_width = [%s]\n", video_width);
+ metadata_extractor_get_metadata(metadata, METADATA_VIDEO_HEIGHT, &video_height);
+ printf("video_height = [%s]\n", video_height);
+ metadata_extractor_get_metadata(metadata, METADATA_HAS_VIDEO, &video_track_cnt);
+ printf("video_track_cnt = [%s]\n", video_track_cnt);
+
+ metadata_extractor_get_metadata(metadata, METADATA_ARTIST, &artist);
+ printf("artist = [%s]\n", artist);
+ metadata_extractor_get_metadata(metadata, METADATA_TITLE, &title);
+ printf("title = [%s]\n", title);
+ metadata_extractor_get_metadata(metadata, METADATA_ALBUM, &album);
+ printf("album = [%s]\n", album);
+ metadata_extractor_get_metadata(metadata, METADATA_GENRE, &genre);
+ printf("genre = [%s]\n", genre);
+ metadata_extractor_get_metadata(metadata, METADATA_AUTHOR, &author);
+ printf("author = [%s]\n", author);
+ metadata_extractor_get_metadata(metadata, METADATA_COPYRIGHT, ©right);
+ printf("copyright = [%s]\n", copyright);
+ metadata_extractor_get_metadata(metadata, METADATA_DATE, &date);
+ printf("date = [%s]\n", date);
+ metadata_extractor_get_metadata(metadata, METADATA_DESCRIPTION, &description);
+ printf("description = [%s]\n", description);
+ metadata_extractor_get_metadata(metadata, METADATA_TRACK_NUM, &track_num);
+ printf("track_num = [%s]\n", track_num);
+ metadata_extractor_get_metadata(metadata, METADATA_CLASSIFICATION, &classification);
+ printf("classification = [%s]\n", classification);
+ metadata_extractor_get_metadata(metadata, METADATA_RATING, &rating);
+ printf("rating = [%s]\n", rating);
+ metadata_extractor_get_metadata(metadata, METADATA_LONGITUDE, &longitude);
+ printf("longitude = [%s]\n", longitude);
+ metadata_extractor_get_metadata(metadata, METADATA_LATITUDE, &latitude);
+ printf("latitude = [%s]\n", latitude);
+ metadata_extractor_get_metadata(metadata, METADATA_ALTITUDE, &altitude);
+ printf("altitude = [%s]\n", altitude);
+ metadata_extractor_get_metadata(metadata, METADATA_CONDUCTOR, &conductor);
+ printf("conductor = [%s]\n", conductor);
+ metadata_extractor_get_metadata(metadata, METADATA_UNSYNCLYRICS, &unsynclyrics);
+ printf("unsynclyrics = [%s]\n", unsynclyrics);
+ metadata_extractor_get_metadata(metadata, METADATA_RECDATE, &rec_date);
+ printf("rec_date = [%s]\n", rec_date);
+
+ metadata_extractor_get_metadata(metadata, METADATA_SYNCLYRICS_NUM, &synclyrics_num);
+ int s_num = atoi(synclyrics_num);
+ for(idx = 0; idx < s_num; idx++)
+ {
+ metadata_extractor_get_synclyrics(metadata, idx, &time_info, &lyrics);
+ printf("[%2d][%6ld][%s]\n", idx, time_info, lyrics);
+ SAFE_FREE(lyrics);
+ }
+
+ /*Get Artwork*/
+ metadata_extractor_get_artwork(metadata, &artwork, &artwork_size, &artwork_mime);
+ printf("artwork = [%p], artwork_size = [%d]\n", artwork, artwork_size);
+ printf("artwork_mime = [%s]\n", artwork_mime);
+
+ /*Get Thumbnail*/
+ metadata_extractor_get_frame(metadata, &video_thumbnail, &video_thumbnail_len);
+ printf("video_thumbnail[%p], video_thumbnail_len = [%d]\n\n", video_thumbnail, video_thumbnail_len);
+
+ /*Get Video frame at time, extract frame of 22.5 sec and not key frame*/
+ metadata_extractor_get_frame_at_time(metadata, 22500, false, &video_frame, &video_frame_len);
+ printf("video_frame[%p], video_frame_len = [%d]\n\n", video_frame, video_frame_len);
+
+ SAFE_FREE(duration );
+ SAFE_FREE(audio_bitrate );
+ SAFE_FREE(audio_channel );
+ SAFE_FREE(audio_samplerate );
+ SAFE_FREE(audio_track_cnt );
+ SAFE_FREE(video_bitrate );
+ SAFE_FREE(video_fps );
+ SAFE_FREE(video_width );
+ SAFE_FREE(video_height );
+ SAFE_FREE(video_track_cnt );
+ SAFE_FREE(video_thumbnail);
+ SAFE_FREE(video_frame);
+
+ SAFE_FREE(artist);
+ SAFE_FREE(title);
+ SAFE_FREE(album);
+ SAFE_FREE(genre);
+ SAFE_FREE(author);
+ SAFE_FREE(copyright);
+ SAFE_FREE(date);
+ SAFE_FREE(description);
+ SAFE_FREE(artwork);
+ SAFE_FREE(artwork_mime);
+ SAFE_FREE(track_num);
+ SAFE_FREE(classification);
+ SAFE_FREE(rating);
+ SAFE_FREE(longitude);
+ SAFE_FREE(latitude);
+ SAFE_FREE(altitude);
+ SAFE_FREE(conductor);
+ SAFE_FREE(unsynclyrics);
+ SAFE_FREE(synclyrics_num);
+ SAFE_FREE(rec_date);
+
+ return true;
+
+}
+
+int main(int argc, char *argv[])
+{
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ metadata_extractor_h metadata;
+ int idx = 0;
+ int cnt = argc -1;
+ printf("--- metadata extractor test start ---\n\n");
+
+ if(cnt < 1)
+ {
+ printf("type file path plz. [%d]\n", cnt);
+ return 0;
+ }
+
+ ret = metadata_extractor_create(&metadata);
+ if(ret != METADATA_EXTRACTOR_ERROR_NONE)
+ {
+ LOGE("Fail metadata_extractor_create [%d]\n", ret);
+ return 0;
+ }
+
+ for(idx = 0; idx < cnt; idx++)
+ {
+ printf("--------------------------------------------\n");
+ if (!_is_file_exist (argv[idx+1]))
+ {
+ printf("there is no file [%s]\n", argv[idx+1]);
+ goto exception;
+ }
+
+ ret = metadata_extractor_set_path(metadata, argv[idx+1]);
+ if(ret != METADATA_EXTRACTOR_ERROR_NONE)
+ {
+ LOGE("Fail metadata_extractor_set_path [%d]\n", ret);
+ goto exception;
+ }
+
+ __capi_metadata_extractor(metadata);
+ printf("--------------------------------------------\n");
+
+ }
+
+exception:
+ ret = metadata_extractor_destroy(metadata);
+ printf("metadata_extractor_destroy [%d]\n", ret);
+
+ printf("--- metadata extractor test end ---\n\n");
+
+ return 0;
+
+}