4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Haejeong Kim <backto.kim@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
27 #include <sys/types.h>
33 #include "mm_file_traverse.h"
34 #include "mm_file_debug.h"
36 #define MM_TIME_CHECK_START \
37 { FILE *msg_tmp_fp = fopen("time_check.txt", "a+"); struct timeval start, finish; gettimeofday(&start, NULL);
38 #define MM_TIME_CHECK_FINISH(title) \
39 gettimeofday(&finish, NULL); \
40 double end_time = (finish.tv_sec + 1e-6*finish.tv_usec); \
41 double start_time = (start.tv_sec + 1e-6*start.tv_usec); \
42 if (msg_tmp_fp != NULL) { \
43 fprintf(msg_tmp_fp, "%s\n", title); \
44 fprintf(msg_tmp_fp, " - start_time: %3.5lf sec\n", start_time); \
45 fprintf(msg_tmp_fp, " - finish_time: %3.5lf sec\n", end_time); \
46 fprintf(msg_tmp_fp, " - elapsed time: %3.5lf sec\n", end_time - start_time); \
47 fflush(msg_tmp_fp); fclose(msg_tmp_fp); } }
49 typedef struct _mmfile_value {
59 typedef struct _TagContext {
60 mmfile_value_t artist;
63 mmfile_value_t album_artist;
65 mmfile_value_t author;
66 mmfile_value_t copyright;
67 mmfile_value_t date; /*string */
68 mmfile_value_t recdate; /*string */
69 mmfile_value_t part_of_set; /*string */
70 mmfile_value_t description;
71 mmfile_value_t comment;
72 mmfile_value_t artwork; /*data */
73 mmfile_value_t artwork_size; /*int */
74 mmfile_value_t artwork_mime;
75 mmfile_value_t track_num;
76 mmfile_value_t classfication;
77 mmfile_value_t rating;
78 mmfile_value_t conductor;
79 mmfile_value_t longitude; /*-> double */
80 mmfile_value_t latitude;
81 mmfile_value_t altitude; /*<-double */
82 mmfile_value_t unsynclyrics;
83 mmfile_value_t synclyrics_size;
84 mmfile_value_t rotate; /*string */
85 mmfile_value_t is_spherical;
86 mmfile_value_t is_stitched;
87 mmfile_value_t stitching_software; /*string */
88 mmfile_value_t projection_type; /*string */
89 mmfile_value_t stereo_mode; /*string */
90 mmfile_value_t source_count;
91 mmfile_value_t init_view_heading;
92 mmfile_value_t init_view_pitch;
93 mmfile_value_t init_view_roll;
94 mmfile_value_t timestamp;
95 mmfile_value_t full_pano_width;
96 mmfile_value_t full_pano_height;
97 mmfile_value_t cropped_area_image_width;
98 mmfile_value_t cropped_area_image_height;
99 mmfile_value_t cropped_area_left;
100 mmfile_value_t cropped_area_top;
101 mmfile_value_t ambisonic_type;
102 mmfile_value_t ambisonic_format;
103 mmfile_value_t ambisonic_order;
104 mmfile_value_t stereo_mode_v2;
105 mmfile_value_t proj_type_v2;
106 mmfile_value_t metadata_source_v2; /*string */
107 mmfile_value_t pose_yaw_degrees_v2;
108 mmfile_value_t pose_pitch_degrees_v2;
109 mmfile_value_t pose_roll_degrees_v2;
110 mmfile_value_t cbmp_layout_v2;
111 mmfile_value_t cbmp_padding_v2;
112 mmfile_value_t equi_projection_bounds_top_v2;
113 mmfile_value_t equi_projection_bounds_bottom_v2;
114 mmfile_value_t equi_projection_bounds_left_v2;
115 mmfile_value_t equi_projection_bounds_right_v2;
119 typedef struct _ContentContext {
131 int audio_samplerate;
134 int audio_bitpersample;
135 mmfile_value_t thumbnail;
139 const char *AudioCodecTypeString[] = {
140 "AMR", "G723.1", "MP3", "OGG", "AAC", "WMA", "MMF", "ADPCM", "WAVE", "WAVE NEW", /* 0~9 */
141 "MIDI", "IMELODY", "MXMF", "MPEG1-Layer1 codec", "MPEG1-Layer2 codec", /* 10~14 */
142 "G711", "G722", "G722.1", "G722.2 (AMR-WB)", "G723 wideband speech", /* 15~19 */
143 "G726 (ADPCM)", "G728 speech", "G729", "G729a", "G729.1", /* 20~24 */
144 "Real", "AAC-Low complexity", "AAC-Main profile", "AAC-Scalable sample rate", "AAC-Long term prediction", /* 25~29 */
145 "AAC-High Efficiency v1", "AAC-High efficiency v2", "DolbyDigital", "Apple Lossless", "Sony proprietary", /* 30~34 */
146 "SPEEX", "Vorbis", "AIFF", "AU", "None (will be deprecated)", /*35~39 */
147 "PCM", "ALAW", "MULAW", "MS ADPCM", "FLAC" /* 40~44 */
151 const char *VideoCodecTypeString[] = {
152 "None (will be deprecated)", /* 0 */
153 "H263", "H264", "H26L", "MPEG4", "MPEG1", /* 1~5 */
154 "WMV", "DIVX", "XVID", "H261", "H262/MPEG2-part2", /* 6~10 */
155 "H263v2", "H263v3", "Motion JPEG", "MPEG2", "MPEG4 part-2 Simple profile", /* 11~15 */
156 "MPEG4 part-2 Advanced Simple profile", "MPEG4 part-2 Main profile", "MPEG4 part-2 Core profile", "MPEG4 part-2 Adv Coding Eff profile", "MPEG4 part-2 Adv RealTime Simple profile", /* 16~20 */
157 "MPEG4 part-10 (h.264)", "Real", "VC-1", "AVS", "Cinepak", /* 21~25 */
158 "Indeo", "Theora", "Flv" /* 26~28 */
163 FILE *fpFailList = NULL;
165 static int mmfile_get_file_infomation(void *data, void *user_data, bool file_test);
166 static int mmfile_get_video_frame(void *data, void *accurate, bool file_test);
169 inline static int mm_file_is_little_endian(void)
172 return ((char *)&i)[0];
175 #define READ_FROM_FILE(FILE_PATH, data, size) \
177 FILE *fp = fopen(FILE_PATH, "r"); \
179 if (fseek(fp, 0, SEEK_END) < 0) { printf("fseek failed\n"); fclose(fp); break; } \
181 if (fseek(fp, 0, SEEK_SET) < 0) { printf("fseek failed\n"); fclose(fp); break; } \
182 if (size > 0) data = malloc(size); \
183 if (data != NULL) { if (fread(data, sizeof(char), size, fp) != size) { printf("fread error\n"); } } \
185 printf("file size = %d\n", size); \
190 _is_file_exist(const char *filename)
194 const char *to_access = (strstr(filename, "file://") != NULL) ? filename + 7 : filename;
195 ret = access(to_access, R_OK);
197 printf("file [%s] not found.\n", to_access);
204 int main(int argc, char **argv)
207 bool file_test = true; /*if you want to test mm_file_create_content_XXX_from_memory() set file_test to false */
209 if (_is_file_exist(argv[1])) {
210 int ret = lstat(argv[1], &statbuf);
212 printf("lstat error[%d]\n", ret);
216 if (fpFailList == NULL) {
217 fpFailList = fopen("/opt/var/log/mmfile_fails.txt", "w");
220 if (S_ISDIR(statbuf.st_mode)) {
221 mmfile_get_file_names(argv[1], mmfile_get_file_infomation, NULL);
224 mmfile_get_file_infomation(argv[1], NULL, file_test);
226 mmfile_get_video_frame(argv[1], argv[2], file_test);
229 if (fpFailList != NULL) {
235 return 0;/*exit(0); */
238 static int mmfile_get_file_infomation(void *data, void *user_data, bool file_test)
240 MMHandleType content_attrs = 0;
241 MMHandleType tag_attrs = 0;
242 int audio_track_num = 0;
243 int video_track_num = 0;
245 char filename[512] = {0, };
247 memset(filename, 0x00, sizeof(filename));
248 SAFE_STRLCPY(filename, (char *)data, sizeof(filename));
252 printf("Extracting information for [%s] \n", filename);
254 ret = mm_file_get_stream_info(filename, &audio_track_num, &video_track_num);
255 if (ret == FILEINFO_ERROR_NONE) {
256 printf("# audio=%d, video=%d\n", audio_track_num, video_track_num);
258 printf("Failed to mm_file_get_stream_info() error=[%x]\n", ret);
262 /* get content handle */
263 ret = mm_file_create_content_attrs(&content_attrs, filename);
265 unsigned int file_size = 0;
266 unsigned char *buffer = NULL;
268 READ_FROM_FILE(filename, buffer, file_size);
270 ret = mm_file_create_content_attrs_from_memory(&content_attrs, buffer, file_size, MM_FILE_FORMAT_3GP);
273 if (ret == FILEINFO_ERROR_NONE && content_attrs) {
274 ContentContext_t ccontent;
275 memset(&ccontent, 0, sizeof(ContentContext_t));
277 ret = mm_file_get_attrs(content_attrs, MM_FILE_CONTENT_DURATION, &ccontent.duration, NULL);
278 printf("# duration: %d\n", ccontent.duration);
280 if (ret != FILEINFO_ERROR_NONE)
281 printf("failed to get attrs\n");
283 if (audio_track_num) {
284 ret = mm_file_get_attrs(content_attrs,
285 MM_FILE_CONTENT_AUDIO_CODEC, &ccontent.audio_codec,
286 MM_FILE_CONTENT_AUDIO_SAMPLERATE, &ccontent.audio_samplerate,
287 MM_FILE_CONTENT_AUDIO_BITRATE, &ccontent.audio_bitrate,
288 MM_FILE_CONTENT_AUDIO_CHANNELS, &ccontent.audio_channel,
289 MM_FILE_CONTENT_AUDIO_TRACK_INDEX, &ccontent.audio_track_id,
290 MM_FILE_CONTENT_AUDIO_TRACK_COUNT, &ccontent.audio_track_num,
291 MM_FILE_CONTENT_AUDIO_BITPERSAMPLE, &ccontent.audio_bitpersample,
294 if (ret != FILEINFO_ERROR_NONE) {
295 printf("failed to get audio attrs\n");
297 printf("[Audio] ----------------------------------------- \n");
298 printf("# audio codec: %d ", ccontent.audio_codec);
299 printf("[%s]\n", (ccontent.audio_codec >= 0 && ccontent.audio_codec < MM_AUDIO_CODEC_NUM) ? AudioCodecTypeString[ccontent.audio_codec] : "Invalid");
300 printf("# audio samplerate: %d Hz\n", ccontent.audio_samplerate);
301 printf("# audio bitrate: %d bps\n", ccontent.audio_bitrate);
302 printf("# audio channel: %d\n", ccontent.audio_channel);
303 printf("# audio track id: %d\n", ccontent.audio_track_id);
304 printf("# audio track num: %d\n", ccontent.audio_track_num);
305 printf("# audio bit per sample: %d\n", ccontent.audio_bitpersample);
309 if (video_track_num) {
310 ret = mm_file_get_attrs(content_attrs,
311 MM_FILE_CONTENT_VIDEO_CODEC, &ccontent.video_codec,
312 MM_FILE_CONTENT_VIDEO_BITRATE, &ccontent.video_bitrate,
313 MM_FILE_CONTENT_VIDEO_FPS, &ccontent.video_fps,
314 MM_FILE_CONTENT_VIDEO_TRACK_INDEX, &ccontent.video_track_id,
315 MM_FILE_CONTENT_VIDEO_WIDTH, &ccontent.video_w,
316 MM_FILE_CONTENT_VIDEO_HEIGHT, &ccontent.video_h,
317 MM_FILE_CONTENT_VIDEO_THUMBNAIL, &ccontent.thumbnail.value.p_val, &ccontent.thumbnail.len,
320 if (ret != FILEINFO_ERROR_NONE) {
321 printf("failed to get video attrs\n");
323 printf("[Video] ----------------------------------------- \n");
324 printf("# video codec: %d ", ccontent.video_codec);
325 printf("[%s]\n", (ccontent.video_codec >= 0 && ccontent.video_codec < MM_VIDEO_CODEC_NUM) ? VideoCodecTypeString[ccontent.video_codec] : "Invalid");
326 printf("# video bitrate: %d bps\n", ccontent.video_bitrate);
327 printf("# video fps: %d\n", ccontent.video_fps);
328 printf("# video track id: %d\n", ccontent.video_track_id);
329 printf("# video width/height: %d x %d\n", ccontent.video_w, ccontent.video_h);
330 printf("# video thumbnail: %p\n", ccontent.thumbnail.value.p_val);
334 mm_file_destroy_content_attrs(content_attrs);
336 printf("Failed to mm_file_create_content_attrs() error=[%x]\n", ret);
341 ret = mm_file_create_tag_attrs(&tag_attrs, filename);
343 unsigned int file_size = 0;
344 unsigned char *buffer = NULL;
346 READ_FROM_FILE(filename, buffer, file_size);
348 ret = mm_file_create_tag_attrs_from_memory(&tag_attrs, buffer, file_size, MM_FILE_FORMAT_3GP);
351 if (ret == FILEINFO_ERROR_NONE && tag_attrs) {
353 memset(&ctag, 0, sizeof(TagContext_t));
354 /* get attributes of tag */
355 ret = mm_file_get_attrs(tag_attrs,
356 MM_FILE_TAG_ARTIST, &ctag.artist.value.s_val, &ctag.artist.len,
357 MM_FILE_TAG_ALBUM, &ctag.album.value.s_val, &ctag.album.len,
358 MM_FILE_TAG_ALBUM_ARTIST, &ctag.album_artist.value.s_val, &ctag.album_artist.len,
359 MM_FILE_TAG_TITLE, &ctag.title.value.s_val, &ctag.title.len,
360 MM_FILE_TAG_GENRE, &ctag.genre.value.s_val, &ctag.genre.len,
361 MM_FILE_TAG_AUTHOR, &ctag.author.value.s_val, &ctag.author.len,
362 MM_FILE_TAG_COPYRIGHT, &ctag.copyright.value.s_val, &ctag.copyright.len,
363 MM_FILE_TAG_DATE, &ctag.date.value.s_val, &ctag.date.len,
364 MM_FILE_TAG_RECDATE, &ctag.recdate.value.s_val, &ctag.recdate.len,
365 MM_FILE_TAG_POS, &ctag.part_of_set.value.s_val, &ctag.part_of_set.len,
366 MM_FILE_TAG_DESCRIPTION, &ctag.description.value.s_val, &ctag.description.len,
367 MM_FILE_TAG_COMMENT, &ctag.comment.value.s_val, &ctag.comment.len,
368 MM_FILE_TAG_ARTWORK, &ctag.artwork.value.p_val, &ctag.artwork.len,
369 MM_FILE_TAG_ARTWORK_SIZE, &ctag.artwork_size.value.i_val,
370 MM_FILE_TAG_ARTWORK_MIME, &ctag.artwork_mime.value.s_val, &ctag.artwork_mime.len,
371 MM_FILE_TAG_TRACK_NUM, &ctag.track_num.value.s_val, &ctag.track_num.len,
372 MM_FILE_TAG_CLASSIFICATION, &ctag.classfication.value.s_val, &ctag.classfication.len,
373 MM_FILE_TAG_RATING, &ctag.rating.value.s_val, &ctag.rating.len,
374 MM_FILE_TAG_LONGITUDE, &ctag.longitude.value.d_val,
375 MM_FILE_TAG_LATIDUE, &ctag.latitude.value.d_val,
376 MM_FILE_TAG_ALTIDUE, &ctag.altitude.value.d_val,
377 MM_FILE_TAG_CONDUCTOR, &ctag.conductor.value.s_val, &ctag.conductor.len,
378 MM_FILE_TAG_UNSYNCLYRICS, &ctag.unsynclyrics.value.s_val, &ctag.unsynclyrics.len,
379 MM_FILE_TAG_SYNCLYRICS_NUM, &ctag.synclyrics_size.value.i_val,
380 MM_FILE_TAG_ROTATE, &ctag.rotate.value.s_val, &ctag.rotate.len,
381 MM_FILE_TAG_SPHERICAL, &ctag.is_spherical.value.i_val,
382 MM_FILE_TAG_SPHERICAL_STITCHED, &ctag.is_stitched.value.i_val,
383 MM_FILE_TAG_SPHERICAL_STITCHING_SOFTWARE, &ctag.stitching_software.value.s_val, &ctag.stitching_software.len,
384 MM_FILE_TAG_SPHERICAL_PROJECTION_TYPE, &ctag.projection_type.value.s_val, &ctag.projection_type.len,
385 MM_FILE_TAG_SPHERICAL_STEREO_MODE, &ctag.stereo_mode.value.s_val, &ctag.stereo_mode.len,
386 MM_FILE_TAG_SPHERICAL_SOURCE_COUNT, &ctag.source_count.value.i_val,
387 MM_FILE_TAG_SPHERICAL_INIT_VIEW_HEADING, &ctag.init_view_heading.value.i_val,
388 MM_FILE_TAG_SPHERICAL_INIT_VIEW_PITCH, &ctag.init_view_pitch.value.i_val,
389 MM_FILE_TAG_SPHERICAL_INIT_VIEW_ROLL, &ctag.init_view_roll.value.i_val,
390 MM_FILE_TAG_SPHERICAL_TIMESTAMP, &ctag.timestamp.value.i_val,
391 MM_FILE_TAG_SPHERICAL_FULL_PANO_WIDTH, &ctag.full_pano_width.value.i_val,
392 MM_FILE_TAG_SPHERICAL_FULL_PANO_HEIGHT, &ctag.full_pano_height.value.i_val,
393 MM_FILE_TAG_SPHERICAL_CROPPED_AREA_IMAGE_WIDTH, &ctag.cropped_area_image_width.value.i_val,
394 MM_FILE_TAG_SPHERICAL_CROPPED_AREA_IMAGE_HEIGHT, &ctag.cropped_area_image_height.value.i_val,
395 MM_FILE_TAG_SPHERICAL_CROPPED_AREA_LEFT, &ctag.cropped_area_left.value.i_val,
396 MM_FILE_TAG_SPHERICAL_CROPPED_AREA_TOP, &ctag.cropped_area_top.value.i_val,
397 MM_FILE_TAG_AMBISONIC_TYPE, &ctag.ambisonic_type.value.i_val,
398 MM_FILE_TAG_AMBISONIC_FORMAT, &ctag.ambisonic_format.value.i_val,
399 MM_FILE_TAG_AMBISONIC_ORDER, &ctag.ambisonic_order.value.i_val,
400 MM_FILE_TAG_SPHERICAL_V2_STEREO_MODE, &ctag.stereo_mode_v2.value.i_val,
401 MM_FILE_TAG_SPHERICAL_V2_METADATA_SOURCE, &ctag.metadata_source_v2.value.s_val, &ctag.metadata_source_v2.len,
402 MM_FILE_TAG_SPHERICAL_V2_PROJ_TYPE, &ctag.proj_type_v2.value.i_val,
403 MM_FILE_TAG_SPHERICAL_V2_POSE_YAW, &ctag.pose_yaw_degrees_v2.value.i_val,
404 MM_FILE_TAG_SPHERICAL_V2_POSE_PITCH, &ctag.pose_pitch_degrees_v2.value.i_val,
405 MM_FILE_TAG_SPHERICAL_V2_POSE_ROLL, &ctag.pose_roll_degrees_v2.value.i_val,
406 MM_FILE_TAG_SPHERICAL_V2_CBMP_LAYOUT, &ctag.cbmp_layout_v2.value.i_val,
407 MM_FILE_TAG_SPHERICAL_V2_CBMP_PADDING, &ctag.cbmp_padding_v2.value.i_val,
408 MM_FILE_TAG_SPHERICAL_V2_EQUI_BOUNDS_TOP, &ctag.equi_projection_bounds_top_v2.value.i_val,
409 MM_FILE_TAG_SPHERICAL_V2_EQUI_BOUNDS_BOTTOM, &ctag.equi_projection_bounds_bottom_v2.value.i_val,
410 MM_FILE_TAG_SPHERICAL_V2_EQUI_BOUNDS_LEFT, &ctag.equi_projection_bounds_left_v2.value.i_val,
411 MM_FILE_TAG_SPHERICAL_V2_EQUI_BOUNDS_RIGHT, &ctag.equi_projection_bounds_right_v2.value.i_val,
412 MM_FILE_TAG_SMTA, &ctag.smta.value.i_val,
414 if (ret != FILEINFO_ERROR_NONE) {
415 printf("failed to get attrs\n");
417 if (msg_tmp_fp) { /* opened by MM_TIME_CHECK_START */
421 mm_file_destroy_tag_attrs(tag_attrs);
425 /* print tag information */
426 printf("[Tag] =================================== \n");
427 printf("# artist: [%s]\n", ctag.artist.value.s_val);
428 printf("# title: [%s]\n", ctag.title.value.s_val);
429 printf("# album: [%s]\n", ctag.album.value.s_val);
430 printf("# album_artist: [%s]\n", ctag.album_artist.value.s_val);
431 printf("# genre: [%s]\n", ctag.genre.value.s_val);
432 printf("# author: [%s]\n", ctag.author.value.s_val);
433 printf("# copyright: [%s]\n", ctag.copyright.value.s_val);
434 printf("# year: [%s]\n", ctag.date.value.s_val);
435 printf("# recdate: [%s]\n", ctag.recdate.value.s_val);
436 printf("# part of a set: [%s]\n", ctag.part_of_set.value.s_val);
437 printf("# description: [%s]\n", ctag.description.value.s_val);
438 printf("# comment: [%s]\n", ctag.comment.value.s_val);
439 printf("# artwork: [%p]\n", ctag.artwork.value.p_val);
440 printf("# artwork_size: [%d]\n", ctag.artwork_size.value.i_val);
441 printf("# artwork_mime: [%s]\n", ctag.artwork_mime.value.s_val);
442 printf("# track number: [%s]\n", ctag.track_num.value.s_val);
443 printf("# classification: [%s]\n", ctag.classfication.value.s_val);
444 printf("# rating: [%s]\n", ctag.rating.value.s_val);
445 printf("# longitude: [%f]\n", ctag.longitude.value.d_val);
446 printf("# latitude: [%f]\n", ctag.latitude.value.d_val);
447 printf("# altitude: [%f]\n", ctag.altitude.value.d_val);
448 printf("# conductor: [%s]\n", ctag.conductor.value.s_val);
449 printf("# unsynclyrics_length: [%d]\n", ctag.unsynclyrics.len);
450 printf("# unsynclyrics: [%s]\n", ctag.unsynclyrics.value.s_val);
451 printf("# synclyrics size: [%d]\n", ctag.synclyrics_size.value.i_val);
452 printf("# rotate: [%s]\n", ctag.rotate.value.s_val);
453 printf("# is_spherical: [%d]\n", ctag.is_spherical.value.i_val);
454 printf("# is_stitched: [%d]\n", ctag.is_stitched.value.i_val);
456 if (ctag.is_spherical.value.i_val > 0 && ctag.is_stitched.value.i_val > 0) {
457 printf("# stitching_software: [%s]\n", ctag.stitching_software.value.s_val);
458 printf("# projection_type: [%s]\n", ctag.projection_type.value.s_val);
459 printf("# stereo_mode [%s]\n", ctag.stereo_mode.value.s_val);
460 printf("# source_count: [%d]\n", ctag.source_count.value.i_val);
461 printf("# init_view_heading: [%d]\n", ctag.init_view_heading.value.i_val);
462 printf("# init_view_pitch: [%d]\n", ctag.init_view_pitch.value.i_val);
463 printf("# init_view_roll: [%d]\n", ctag.init_view_roll.value.i_val);
464 printf("# time_stamp: [%d]\n", ctag.timestamp.value.i_val);
465 printf("# full_pano_width: [%d]\n", ctag.full_pano_width.value.i_val);
466 printf("# full_pano_height: [%d]\n", ctag.full_pano_height.value.i_val);
467 printf("# cropped_area_image_width: [%d]\n", ctag.cropped_area_image_width.value.i_val);
468 printf("# cropped_area_image_height: [%d]\n", ctag.cropped_area_image_height.value.i_val);
469 printf("# cropped_area_left: [%d]\n", ctag.cropped_area_left.value.i_val);
470 printf("# cropped_area_top: [%d]\n", ctag.cropped_area_top.value.i_val);
473 printf("# ambisonic_type: [%d]\n", ctag.ambisonic_type.value.i_val);
475 if (ctag.ambisonic_type.value.i_val > 0) {
476 printf("# ambisonic_format: [%d]\n", ctag.ambisonic_format.value.i_val);
477 printf("# ambisonic_order: [%d]\n", ctag.ambisonic_order.value.i_val);
480 printf("# stereo_mode_v2: [%d]\n", ctag.stereo_mode_v2.value.i_val);
482 if (ctag.proj_type_v2.value.i_val >= 0) {
483 printf("# proj_type_v2: [%d]\n", ctag.proj_type_v2.value.i_val);
484 printf("# metadata_source_v2: [%s]\n", ctag.metadata_source_v2.value.s_val);
485 printf("# pose_yaw_degrees_v2: [%d]\n", ctag.pose_yaw_degrees_v2.value.i_val);
486 printf("# pose_pitch_degrees_v2: [%d]\n", ctag.pose_pitch_degrees_v2.value.i_val);
487 printf("# pose_roll_degrees_v2: [%d]\n", ctag.pose_roll_degrees_v2.value.i_val);
488 printf("# cbmp_layout_v2: [%d]\n", ctag.cbmp_layout_v2.value.i_val);
489 printf("# cbmp_padding_v2: [%d]\n", ctag.cbmp_padding_v2.value.i_val);
490 printf("# equi_projection_bounds_top_v2: [%d]\n", ctag.equi_projection_bounds_top_v2.value.i_val);
491 printf("# equi_projection_bounds_bottom_v2: [%d]\n", ctag.equi_projection_bounds_bottom_v2.value.i_val);
492 printf("# equi_projection_bounds_left_v2: [%d]\n", ctag.equi_projection_bounds_left_v2.value.i_val);
493 printf("# equi_projection_bounds_right_v2: [%d]\n", ctag.equi_projection_bounds_right_v2.value.i_val);
496 printf("# smta: [%d]\n", ctag.smta.value.i_val);
498 if (ctag.synclyrics_size.value.i_val > 0) {
500 unsigned long time_info = 0;
501 char *lyrics_info = NULL;
503 printf("# synclyrics: \n");
505 for (idx = 0; idx < ctag.synclyrics_size.value.i_val; idx++) {
506 ret = mm_file_get_synclyrics_info(tag_attrs, idx, &time_info, &lyrics_info);
507 if (ret == FILEINFO_ERROR_NONE) {
508 printf("[%2d][%6ld][%s]\n", idx, time_info, lyrics_info);
510 printf("Error when get lyrics\n");
517 ret = mm_file_destroy_tag_attrs(tag_attrs);
518 if (ret != FILEINFO_ERROR_NONE) {
519 printf("Error mm_file_destroy_tag_attrs: %d", ret);
527 printf("Failed to mm_file_create_tag_attrs() error=[%x]\n", ret);
531 printf("=================================================\n\n");
533 MM_TIME_CHECK_FINISH(filename);
538 static int mmfile_get_video_frame(void *data, void *accurate, bool file_test)
541 char filename[512] = {0, };
542 char accurate_mode[10] = {0, };
547 bool is_accurate = FALSE;
548 unsigned long long time_stamp = 5 * 1000 * 1000; //5sec
550 memset(filename, 0x00, sizeof(filename));
551 SAFE_STRLCPY(filename, (char *)data, sizeof(filename));
553 memset(accurate_mode, 0x00, sizeof(accurate_mode));
554 SAFE_STRLCPY(accurate_mode, (char *)accurate, sizeof(accurate_mode));
556 if (strlen(accurate_mode) > 0) {
557 if (strncmp(accurate_mode, "1", 1) == 0)
561 printf("Extracting video frame for [%s] [%llu] accurate [%d]\n", filename, time_stamp, is_accurate);
563 if (file_test == TRUE)
564 ret = mm_file_get_video_frame(filename, time_stamp, is_accurate, (unsigned char **)&_frame, &_frame_size, &width, &height);
566 unsigned int file_size = 0;
567 unsigned char *buffer = NULL;
569 READ_FROM_FILE(filename, buffer, file_size);
571 ret = mm_file_get_video_frame_from_memory(buffer, file_size, time_stamp, is_accurate, (unsigned char **)&_frame, &_frame_size, &width, &height);
574 if (ret != FILEINFO_ERROR_NONE)
575 printf("Failed to mm_file_get_video_frame() error=[%x]\n", ret);
577 printf("video_frame[%p], video_frame_len = [%d] width = [%d] height = [%d]\n", _frame, _frame_size, width, height);