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.
23 * This file declares data structures and functions of flie library.
28 * @brief This file declares data structures and functions of flie
38 #include "mm_file_error.h"
45 This part describes the APIs with respect to extract meta data or media
46 information directly from file.
56 MMFILE_360_NON_STITCHED = 0x00010000,
57 MMFILE_360_STITCHED = 0x00020000,
58 MMFILE_360_MASK = 0x00001111,
61 #define RFC_AMBISONIC_SA3DBOX_VERSION_SUPPORTED 0
62 #define RFC_AMBISONIC_TYPE_PERIPHONIC 0
63 #define RFC_AMBISONIC_CHANNEL_ORDERING_ACN 0
64 #define RFC_AMBISONIC_CHANNEL_ORDERING_FUMA 1 /* FIXME: Currently value is not defined in Spatial Audio RFC */
65 #define RFC_AMBISONIC_NORMALIZATION_SN3D 0
66 #define RFC_AMBISONIC_NORMALIZATION_FUMA 1 /* FIXME: Currently value is not defined in Spatial Audio RFC */
69 MMFILE_AMBISONIC_TYPE_UNKNOWN = 0,
70 MMFILE_AMBISONIC_TYPE_PERIPHONIC = 1, /**< To comply with Google's Spatial Audio RFC*/
71 MMFILE_AMBISONIC_TYPE_NON_PERIPHONIC = 2,
72 } MMFILE_AMBISONIC_TYPE;
75 MMFILE_AMBISONIC_FORMAT_UNKNOWN = 0,
76 MMFILE_AMBISONIC_FORMAT_AMBIX = 1, /**< AMBIX (Channel sequence: ACN, Normalization: SN3D) */
77 MMFILE_AMBISONIC_FORMAT_AMB = 2, /**< .AMB, Tetraproc (Channel sequence: FuMa, Normalization: FuMa) */
78 MMFILE_AMBISONIC_FORMAT_UA = 3, /**< Universal Ambisonics (Channel sequence: SID, Normalization: N3D) */
79 } MMFILE_AMBISONIC_FORMAT;
82 MMFILE_AMBISONIC_ORDER_UNKNOWN = 0,
83 MMFILE_AMBISONIC_ORDER_FOA = 1, /**< First order Ambisonics */
84 MMFILE_AMBISONIC_ORDER_SOA = 2, /**< Second order Ambisonics */
85 MMFILE_AMBISONIC_ORDER_TOA = 3, /**< Third order Ambisonics */
86 } MMFILE_AMBISONIC_ORDER;
89 MMFILE_AMBISONIC_CHANNEL_ORDERING_UNKNOWN = 0,
90 MMFILE_AMBISONIC_CHANNEL_ORDERING_ACN = 1, /**< Ambisonic Channel Number (ACN) system */
91 MMFILE_AMBISONIC_CHANNEL_ORDERING_FUMA = 2, /**< Furse-Malham ordering*/
92 MMFILE_AMBISONIC_CHANNEL_ORDERING_SID = 3, /**< Single Index Designation ordering */
93 } MMFILE_AMBISONIC_CHANNEL_ORDERING;
96 MMFILE_AMBISONIC_NORMALIZATION_UNKNOWN = 0,
97 MMFILE_AMBISONIC_NORMALIZATION_SN3D = 1, /**< Schmidt semi-normalization */
98 MMFILE_AMBISONIC_NORMALIZATION_FUMA = 2, /**< Furse-Malham MaxN normalization*/
99 MMFILE_AMBISONIC_NORMALIZATION_N3D = 3, /**< Full 3D normalization */
100 } MMFILE_AMBISONIC_NORMALIZATION;
103 * content attributes.
105 #define MM_FILE_CONTENT_DURATION "content-duration" /**< Duration of media */
106 #define MM_FILE_CONTENT_VIDEO_CODEC "content-video-codec" /**< Used video codec */
107 #define MM_FILE_CONTENT_VIDEO_FORMAT "content-video-format" /**< Used video format */
108 #define MM_FILE_CONTENT_VIDEO_BITRATE "content-video-bitrate" /**< Bitrate of video stream */
109 #define MM_FILE_CONTENT_VIDEO_FPS "content-video-fps" /**< Frames per second of video stream */
110 #define MM_FILE_CONTENT_VIDEO_WIDTH "content-video-width" /**< Width of video stream */
111 #define MM_FILE_CONTENT_VIDEO_HEIGHT "content-video-height" /**< Height of video stream */
112 #define MM_FILE_CONTENT_VIDEO_THUMBNAIL "content-video-thumbnail" /**< Thumbnail of video stream */
113 #define MM_FILE_CONTENT_VIDEO_TRACK_INDEX "content-video-track-index" /**< Current stream of video */
114 #define MM_FILE_CONTENT_VIDEO_TRACK_COUNT "content-video-track-count"/**< Number of video streams */
115 #define MM_FILE_CONTENT_AUDIO_CODEC "content-audio-codec" /**< Used audio codec */
116 #define MM_FILE_CONTENT_AUDIO_BITRATE "content-audio-bitrate" /**< Bitrate of audio stream */
117 #define MM_FILE_CONTENT_AUDIO_CHANNELS "content-audio-channels" /**< Channels of audio stream */
118 #define MM_FILE_CONTENT_AUDIO_SAMPLERATE "content-audio-samplerate" /**< Sampling rate of audio stream */
119 #define MM_FILE_CONTENT_AUDIO_TRACK_INDEX "content-audio-track-index" /**< Current stream of audio */
120 #define MM_FILE_CONTENT_AUDIO_TRACK_COUNT "content-audio-track-count"/**< Number of audio streams */
121 #define MM_FILE_CONTENT_AUDIO_BITPERSAMPLE "content-audio-bitpersample" /**< Bit per sample of audio stream */
126 #define MM_FILE_TAG_ARTIST "tag-artist" /**< Artist */
127 #define MM_FILE_TAG_TITLE "tag-title" /**< Title */
128 #define MM_FILE_TAG_ALBUM "tag-album" /**< Album */
129 #define MM_FILE_TAG_ALBUM_ARTIST "tag-album-artist" /**< Album_Artist */
130 #define MM_FILE_TAG_GENRE "tag-genre" /**< Genre */
131 #define MM_FILE_TAG_AUTHOR "tag-author" /**< Author / Composer */
132 #define MM_FILE_TAG_COPYRIGHT "tag-copyright" /**< Copyright */
133 #define MM_FILE_TAG_DATE "tag-date" /**< Year */
134 #define MM_FILE_TAG_DESCRIPTION "tag-description" /**< Description */
135 #define MM_FILE_TAG_COMMENT "tag-comment" /**< Comment */
136 #define MM_FILE_TAG_ARTWORK "tag-artwork" /**< Artwork */
137 #define MM_FILE_TAG_ARTWORK_SIZE "tag-artwork-size" /**< Artwork size */
138 #define MM_FILE_TAG_ARTWORK_MIME "tag-artwork-mime" /**< Artwork mime type */
139 #define MM_FILE_TAG_TRACK_NUM "tag-track-num" /**< Number of tracks */
140 #define MM_FILE_TAG_CLASSIFICATION "tag-classification" /**< Classification Information */
141 #define MM_FILE_TAG_RATING "tag-rating" /**< Rating Information */
142 #define MM_FILE_TAG_LONGITUDE "tag-longitude" /**< location Information*/
143 #define MM_FILE_TAG_LATIDUE "tag-latitude" /**< location Information*/
144 #define MM_FILE_TAG_ALTIDUE "tag-altitude" /**< location Information*/
145 #define MM_FILE_TAG_CONDUCTOR "tag-conductor" /**< Conductor Information*/
146 #define MM_FILE_TAG_UNSYNCLYRICS "tag-unsynclyrics" /**< Unsynchronized Lyrics Information*/
147 #define MM_FILE_TAG_SYNCLYRICS_NUM "tag-synclyrics-num" /**< Synchronized Lyrics Information*/
148 #define MM_FILE_TAG_RECDATE "tag-recdate" /**< Recoding date */
149 #define MM_FILE_TAG_POS "tag-part-of-set" /**< Part of a set */
150 #define MM_FILE_TAG_ROTATE "tag-rotate" /**< Rotate(Orientation) Information*/
151 #define MM_FILE_TAG_CDIS "tag-cdis" /**< CDIS in User Data Information*/
152 #define MM_FILE_TAG_SMTA "tag-smta" /**< SMTA in User Data Information*/
153 #define MM_FILE_TAG_SPHERICAL "tag-spherical" /**< Flag indicating if the video is a spherical video*/
154 #define MM_FILE_TAG_SPHERICAL_STITCHED "tag-stitched" /**< Flag indicating if the video is stitched*/
155 #define MM_FILE_TAG_SPHERICAL_STITCHING_SOFTWARE "tag-stitching-software" /**< Software used to stitch the spherical video*/
156 #define MM_FILE_TAG_SPHERICAL_PROJECTION_TYPE "tag-projection-type" /**< Projection type used in the video frames*/
157 #define MM_FILE_TAG_SPHERICAL_STEREO_MODE "tag-stereo-mode" /**< Description of stereoscopic 3D layout*/
158 #define MM_FILE_TAG_SPHERICAL_SOURCE_COUNT "tag-source-count" /**< Number of cameras used to create the spherical video*/
159 #define MM_FILE_TAG_SPHERICAL_INIT_VIEW_HEADING "tag-init-view-heading" /**< The heading angle of the initial view in degrees.*/
160 #define MM_FILE_TAG_SPHERICAL_INIT_VIEW_PITCH "tag-init-view-pitch" /**< The pitch angle of the initial view in degrees*/
161 #define MM_FILE_TAG_SPHERICAL_INIT_VIEW_ROLL "tag-init-view-roll" /**< The roll angle of the initial view in degrees*/
162 #define MM_FILE_TAG_SPHERICAL_TIMESTAMP "tag-timestamp" /**< Epoch timestamp of when the first frame in the video was recorded*/
163 #define MM_FILE_TAG_SPHERICAL_FULL_PANO_WIDTH "tag-full-pano-width" /**< Width of the encoded video frame in pixels*/
164 #define MM_FILE_TAG_SPHERICAL_FULL_PANO_HEIGHT "tag-full-pano-height" /**< Height of the encoded video frame in pixels*/
165 #define MM_FILE_TAG_SPHERICAL_CROPPED_AREA_IMAGE_WIDTH "tag-cropped-area-image-width" /**< Width of the video frame to display (e.g. cropping)*/
166 #define MM_FILE_TAG_SPHERICAL_CROPPED_AREA_IMAGE_HEIGHT "tag-cropped-area-image-height" /**< Height of the video frame to display (e.g. cropping)*/
167 #define MM_FILE_TAG_SPHERICAL_CROPPED_AREA_LEFT "tag-cropped-area-left" /**< Column where the left edge of the image was cropped from the full sized panorama*/
168 #define MM_FILE_TAG_SPHERICAL_CROPPED_AREA_TOP "tag-cropped-area-top" /**< Row where the top edge of the image was cropped from the full sized panorama*/
169 #define MM_FILE_TAG_AMBISONIC_TYPE "tag-ambisonic-type" /**< Ambisonics type in User Data Information*/
170 #define MM_FILE_TAG_AMBISONIC_FORMAT "tag-ambisonic-format" /**< Ambisonics format in User Data Information*/
171 #define MM_FILE_TAG_AMBISONIC_ORDER "tag-ambisonic-order" /**< Ambisonics order in User Data Information*/
172 #define MM_FILE_TAG_SPHERICAL_V2_STEREO_MODE "stereo-mode-v2" /**< Stereo frame layout*/
173 #define MM_FILE_TAG_SPHERICAL_V2_METADATA_SOURCE "metadata-source-v2" /**< Tool used to create the Spherical Video Metadata V2*/
174 #define MM_FILE_TAG_SPHERICAL_V2_PROJ_TYPE "proj-type-v2" /**< Projection type*/
175 #define MM_FILE_TAG_SPHERICAL_V2_POSE_YAW "pose-yaw-degrees-v2" /**< Counter-clockwise rotation in degrees around the up vector*/
176 #define MM_FILE_TAG_SPHERICAL_V2_POSE_PITCH "pose-pitch-degrees-v2" /**< Counter-clockwise rotation in degrees around the right vector post yaw transform*/
177 #define MM_FILE_TAG_SPHERICAL_V2_POSE_ROLL "pose-roll-degrees-v2" /**< Clockwise-rotation in degrees around the forward vector post yaw and pitch transform*/
178 #define MM_FILE_TAG_SPHERICAL_V2_CBMP_LAYOUT "cbmp-layout-v2" /**< Layout of cube faces for the Cubemap Projection*/
179 #define MM_FILE_TAG_SPHERICAL_V2_CBMP_PADDING "cbmp-padding-v2" /**< Number of pixels to pad from the edge of each cube face for the Cubemap Projection*/
180 #define MM_FILE_TAG_SPHERICAL_V2_EQUI_BOUNDS_TOP "equi-projection-bounds-top-v2" /**< Amount from the top of the frame to crop*/
181 #define MM_FILE_TAG_SPHERICAL_V2_EQUI_BOUNDS_BOTTOM "equi-projection-bounds-bottom-v2" /**< Amount from the bottom of the frame to crop*/
182 #define MM_FILE_TAG_SPHERICAL_V2_EQUI_BOUNDS_LEFT "equi-projection-bounds-left-v2" /**< Amount from the left of the frame to crop*/
183 #define MM_FILE_TAG_SPHERICAL_V2_EQUI_BOUNDS_RIGHT "equi-projection-bounds-right-v2" /**< Amount from the right of the frame to crop*/
186 * This function is to create tag attribute from given media file path.<BR>
187 * Handle can be used to get actual tag information by mm_file_get_attrs() after this function.<BR>
188 * Handle should be destroyed using mm_file_destroy_tag_attrs() after use.<BR>
190 * @param tag_attrs [out] tag attribute handle
191 * @param filename [in] media file path
193 * @return This function returns MM_ERROR_NONE on success, or negative value with error code.
195 * @remark Filename must be UTF-8 format.
197 * @pre File should be exists.
198 * @post Handle is ready to use.
199 * @see mm_file_destroy_tag_attrs, mm_file_get_attrs
204 MMHandleType tag_attrs = NULL;
206 mm_file_create_tag_attrs(&tag_attrs, filename);
208 // get attributes of tag
209 ret = mm_file_get_attrs(tag_attrs,
210 MM_FILE_TAG_ARTIST, &ctag.artist.value.s_val, &ctag.artist.len,
211 MM_FILE_TAG_ALBUM, &ctag.album.value.s_val, &ctag.album.len,
212 MM_FILE_TAG_TITLE, &ctag.title.value.s_val, &ctag.title.len,
213 MM_FILE_TAG_ALBUM_ARTIST, &ctag.album_artist.value.s_val, &ctag.album_artist.len,
214 MM_FILE_TAG_GENRE, &ctag.genre.value.s_val, &ctag.genre.len,
216 if (ret != MM_ERROR_NONE)
218 printf("failed to get %s attrs\n", *err_attr_name);
222 // Use tag information
225 mm_file_destroy_tag_attrs(tag_attrs);
229 int mm_file_create_tag_attrs(MMHandleType *tag_attrs, const char *filename);
232 * This function is to destory the tag attribute handle which is created by mm_file_create_tag_attrs().<BR>
233 * Handle should be destroyed using mm_file_destroy_tag_attrs() after use.
235 * @param tag_attrs [in] tag attribute handle
237 * @return This function returns MM_ERROR_NONE on success, or negative value with error code.
240 * @pre Handle should be valid.
241 * @post Handle is not valid any more.
242 * @see mm_file_create_tag_attrs, mm_file_get_attrs
247 MMHandleType tag_attrs = NULL;
249 mm_file_create_tag_attrs(&tag_attrs, filename);
251 // get attributes of tag
252 ret = mm_file_get_attrs(tag_attrs,
253 MM_FILE_TAG_ARTIST, &ctag.artist.value.s_val, &ctag.artist.len,
254 MM_FILE_TAG_ALBUM, &ctag.album.value.s_val, &ctag.album.len,
255 MM_FILE_TAG_TITLE, &ctag.title.value.s_val, &ctag.title.len,
256 MM_FILE_TAG_ALBUM_ARTIST, &ctag.album_artist.value.s_val, &ctag.album_artist.len,
257 MM_FILE_TAG_GENRE, &ctag.genre.value.s_val, &ctag.genre.len,
259 if (ret != MM_ERROR_NONE)
261 printf("failed to get %s attrs\n", *err_attr_name);
265 // Use tag information
268 mm_file_destroy_tag_attrs(tag_attrs);
272 int mm_file_destroy_tag_attrs(MMHandleType tag_attrs);
275 * This function is to create content attribute from media file.<BR>
276 * Handle can be used to get actual content information by mm_file_get_attrs() after this function.<BR>
277 * Handle should be destroyed using mm_file_destroy_content_attrs() after use.<BR>
279 * @param content_attrs [out] content attribute handle.
280 * @param filename [in] file path.
282 * @return This function returns MM_ERROR_NONE on success, or negative value with error code.
284 * @remark Filename must be UTF-8 format.
286 * @pre File should be exists.
287 * @post Handle is ready to use.
288 * @see mm_file_destroy_content_attrs, mm_file_get_attrs
294 mm_file_get_stream_info(filename, &audio_track_num, &video_track_num);
295 printf ("Testing mm_file_get_stream_info()....audio=%d, video=%d\n", audio_track_num, video_track_num);
297 // create content handle
298 mm_file_create_content_attrs(&content_attrs, filename);
300 // get duration information
301 ret = mm_file_get_attrs(content_attrs, MM_FILE_CONTENT_DURATION, &ccontent.duration, NULL);
302 printf("duration: %d\n", ccontent.duration);
304 if (ret != MM_ERROR_NONE)
306 printf("failed to get %s\n", *err_attr_name);
310 // if audio track exists, get audio related information
313 mm_file_get_attrs(content_attrs,
315 MM_FILE_CONTENT_AUDIO_CODEC, &ccontent.audio_codec,
316 MM_FILE_CONTENT_AUDIO_SAMPLERATE, &ccontent.audio_samplerate,
317 MM_FILE_CONTENT_AUDIO_BITRATE, &ccontent.audio_bitrate,
318 MM_FILE_CONTENT_AUDIO_CHANNELS, &ccontent.audio_channel,
319 MM_FILE_CONTENT_AUDIO_TRACK_INDEX, &ccontent.audio_track_id,
320 MM_FILE_CONTENT_AUDIO_TRACK_COUNT, &ccontent.audio_track_num,
323 // Use audio information
326 // if video track exists, get video related information
329 void *thumbnail = NULL;
331 mm_file_get_attrs(content_attrs,
332 MM_FILE_CONTENT_VIDEO_CODEC, &ccontent.video_codec,
333 MM_FILE_CONTENT_VIDEO_BITRATE, &ccontent.video_bitrate,
334 MM_FILE_CONTENT_VIDEO_FPS, &ccontent.video_fps,
335 MM_FILE_CONTENT_VIDEO_TRACK_INDEX, &ccontent.video_track_id,
336 MM_FILE_CONTENT_VIDEO_WIDTH, &ccontent.video_w,
337 MM_FILE_CONTENT_VIDEO_HEIGHT, &ccontent.video_h,
338 MM_FILE_CONTENT_VIDEO_THUMBNAIL, &ccontent.thumbnail.value.p_val, &ccontent.thumbnail.len,
341 // Use video information
344 // Destory content handle
345 mm_file_destroy_content_attrs(content_attrs);
348 int mm_file_create_content_attrs(MMHandleType *content_attrs, const char *filename);
351 * This function is to destroy content attribute handle.<BR>
352 * Handle should be destroyed using mm_file_destroy_content_attrs() after use.<BR>
354 * @param content_attrs [in] content attribute handle.
356 * @return This function returns MM_ERROR_NONE on success, or negative value with error code.
360 * @pre Handle should be valid.
361 * @post Handle is not valid anymore.
362 * @see mm_file_create_content_attrs, mm_file_get_attrs
368 mm_file_get_stream_info(filename, &audio_track_num, &video_track_num);
369 printf ("Testing mm_file_get_stream_info()....audio=%d, video=%d\n", audio_track_num, video_track_num);
371 // create content handle
372 mm_file_create_content_attrs(&content_attrs, filename);
374 // get duration information
375 ret = mm_file_get_attrs(content_attrs, MM_FILE_CONTENT_DURATION, &ccontent.duration, NULL);
376 printf("duration: %d\n", ccontent.duration);
378 if (ret != MM_ERROR_NONE)
380 printf("failed to get %s\n", *err_attr_name);
384 // if audio track exists, get audio related information
387 mm_file_get_attrs(content_attrs,
388 MM_FILE_CONTENT_AUDIO_CODEC, &ccontent.audio_codec,
389 MM_FILE_CONTENT_AUDIO_SAMPLERATE, &ccontent.audio_samplerate,
390 MM_FILE_CONTENT_AUDIO_BITRATE, &ccontent.audio_bitrate,
391 MM_FILE_CONTENT_AUDIO_CHANNELS, &ccontent.audio_channel,
392 MM_FILE_CONTENT_AUDIO_TRACK_INDEX, &ccontent.audio_track_id,
393 MM_FILE_CONTENT_AUDIO_TRACK_COUNT, &ccontent.audio_track_num,
396 // Use audio information
399 // if video track exists, get video related information
402 void *thumbnail = NULL;
404 mm_file_get_attrs(content_attrs,
405 MM_FILE_CONTENT_VIDEO_CODEC, &ccontent.video_codec,
406 MM_FILE_CONTENT_VIDEO_BITRATE, &ccontent.video_bitrate,
407 MM_FILE_CONTENT_VIDEO_FPS, &ccontent.video_fps,
408 MM_FILE_CONTENT_VIDEO_TRACK_INDEX, &ccontent.video_track_id,
409 MM_FILE_CONTENT_VIDEO_WIDTH, &ccontent.video_w,
410 MM_FILE_CONTENT_VIDEO_HEIGHT, &ccontent.video_h,
411 MM_FILE_CONTENT_VIDEO_THUMBNAIL, &ccontent.thumbnail.value.p_val, &ccontent.thumbnail.len,
414 // Use video information
417 // Destory content handle
418 mm_file_destroy_content_attrs(content_attrs);
421 int mm_file_destroy_content_attrs(MMHandleType content_attrs);
424 * This function is to get the attributes from media tag or content.<BR>
425 * Handle should be valid and created by using create functions such as mm_file_create_content_attrs(), mm_file_create_tag_attrs().<BR>
426 * Handle should be destroyed after use.
428 * @param attrs [in] tag or content attribute handle.
429 * @param first_attribute_name [in] Name of the first attribute to get
430 * @param ... [in] Value for the first attribute, followed optionally by more name/value pairs, terminated by NULL.
431 * But, in the case of data or string type, it should be name/value/size.
433 * @return This function returns MM_ERROR_NONE on success, or negative value.
435 * @remark This function must be terminated by NULL argument.<BR>
436 * And, if this function is failed, err_attr_name param must be free.
437 * @pre Handle should be valid.
438 * @post Every input parameters are set by each information attributes.
439 * @see mm_file_create_content_attrs, mm_file_create_tag_attrs
445 mm_file_get_stream_info(filename, &audio_track_num, &video_track_num);
446 printf ("Testing mm_file_get_stream_info()....audio=%d, video=%d\n", audio_track_num, video_track_num);
448 // create content handle
449 mm_file_create_content_attrs(&content_attrs, filename);
451 // get duration information
452 ret = mm_file_get_attrs(content_attrs, MM_FILE_CONTENT_DURATION, &ccontent.duration, NULL);
453 printf("duration: %d\n", ccontent.duration);
455 if (ret != MM_ERROR_NONE)
457 printf("failed to get %s\n", *err_attr_name);
461 // if audio track exists, get audio related information
464 mm_file_get_attrs(content_attrs,
465 MM_FILE_CONTENT_AUDIO_CODEC, &ccontent.audio_codec,
466 MM_FILE_CONTENT_AUDIO_SAMPLERATE, &ccontent.audio_samplerate,
467 MM_FILE_CONTENT_AUDIO_BITRATE, &ccontent.audio_bitrate,
468 MM_FILE_CONTENT_AUDIO_CHANNELS, &ccontent.audio_channel,
469 MM_FILE_CONTENT_AUDIO_TRACK_INDEX, &ccontent.audio_track_id,
470 MM_FILE_CONTENT_AUDIO_TRACK_COUNT, &ccontent.audio_track_num,
473 // Use audio information
476 // if video track exists, get video related information
479 void *thumbnail = NULL;
481 mm_file_get_attrs(content_attrs,
482 MM_FILE_CONTENT_VIDEO_CODEC, &ccontent.video_codec,
483 MM_FILE_CONTENT_VIDEO_BITRATE, &ccontent.video_bitrate,
484 MM_FILE_CONTENT_VIDEO_FPS, &ccontent.video_fps,
485 MM_FILE_CONTENT_VIDEO_TRACK_INDEX, &ccontent.video_track_id,
486 MM_FILE_CONTENT_VIDEO_WIDTH, &ccontent.video_w,
487 MM_FILE_CONTENT_VIDEO_HEIGHT, &ccontent.video_h,
488 MM_FILE_CONTENT_VIDEO_THUMBNAIL, &ccontent.thumbnail.value.p_val, &ccontent.thumbnail.len,
491 // Use video information
494 // Destory content handle
495 mm_file_destroy_content_attrs(content_attrs);
499 int mm_file_get_attrs(MMHandleType attrs, const char *first_attribute_name, ...)G_GNUC_NULL_TERMINATED;
502 * This function is to get the tag attributes from media data on memory while mm_file_create_tag_attrs() extracts from file.<BR>
503 * This function acts same functionality as mm_file_create_tag_attrs() except media source format (file/memory).
505 * @param tag_attrs [out] tag attributes handle.
506 * @param data [in] memory pointer of media data.
507 * @param size [in] size of media data.
508 * @param format [in] file format of media data.
510 * @return This function returns MM_ERROR_NONE on success, or negative value with error code.
512 * @remark Must be free return value.
514 * @pre Input data pointer and input size should be valid. format should be matched with actual data.
515 * @post Tag attribute handle is ready to use.
516 * @see mm_file_destroy_tag_attrs
520 // create tag handle from memory
521 mm_file_create_tag_attrs_from_memory(&tag_attrs, data, size, MM_FILE_FORMAT_MP3);
523 // get audio artist & album tag
524 mm_file_get_attrs(tag_attrs,
525 MM_FILE_TAG_ARTIST, &ctag.artist.value.s_val, &ctag.artist.len,
526 MM_FILE_TAG_ALBUM, &ctag.album.value.s_val, &ctag.album.len,
527 MM_FILE_TAG_ALBUM_ARTIST, &ctag.album_artist.value.s_val, &ctag.album_artist.len,
530 // Destory tag handle
531 mm_file_destroy_tag_attrs(tag_attrs);
534 int mm_file_create_tag_attrs_from_memory(MMHandleType *tag_attrs, const void *data, unsigned int size, int format);
537 * This function is to get the content attributes from media data on memory while mm_file_create_content_attrs() extracts from file.<BR>
538 * This function acts same functionality as mm_file_create_content_attrs() except media source format (file/memory).
540 * @param content_attrs [out] content attributes handle.
541 * @param data [in] memory pointer of media data.
542 * @param size [in] size of media data.
543 * @param format [in] file format of media data.
545 * @return This function returns MM_ERROR_NONE on success, or negative value with error code.
547 * @remark Must be free return value.
549 * @pre Input data pointer and input size should be valid. format should be matched with actual data.
550 * @post Content attribute handle is ready to use.
551 * @see mm_file_destroy_content_attrs
556 // create content handle from memory
557 mm_file_create_content_attrs_from_memory(&content_attrs, data, size, MM_FILE_FORMAT_MP3);
559 // get audio bit rate and sample rate
560 mm_file_get_attrs(content_attrs,
561 MM_FILE_CONTENT_AUDIO_SAMPLERATE, &ccontent.audio_samplerate,
562 MM_FILE_CONTENT_AUDIO_BITRATE, &ccontent.audio_bitrate,
565 // Destory content handle
566 mm_file_destroy_content_attrs(content_attrs);
569 int mm_file_create_content_attrs_from_memory(MMHandleType *content_attrs, const void *data, unsigned int size, int format);
572 * This function is to get the count of audio/video stream from media file.<BR>
573 * This function is useful for determining whether content is audio or video file.<BR>
574 * For example, If content contains video streams, then content can be treat as video contents.
576 * @param filename [in] file path
577 * @param audio_stream_num [out] number of audio stream of media file
578 * @param video_stream_num [out] number of video stream of media file
580 * @return This function returns MM_ERROR_NONE on success, or negative value with error code.
582 * @pre File path should be exists and input param should be valid.
583 * @post Audio/Video stream count will be set
590 mm_file_get_stream_info(filename, &audio_track_num, &video_track_num);
591 printf ("Testing mm_file_get_stream_info()....audio=%d, video=%d\n", audio_track_num, video_track_num);
595 int mm_file_get_stream_info(const char *filename, int *audio_stream_num, int *video_stream_num);
598 * This function is to get the content attributes without thumbnail from media file.<BR>
599 * This function is almost same as mm_file_create_content_attrs() except extracting thumbnail feature.<BR>
600 * As this function is not extracting thumbnail, this is faster than mm_file_create_content_attrs().
602 * @param content_attrs [out] content attribute handle.
603 * @param filename [in] file path.
605 * @return This function returns MM_ERROR_NONE on success, or negative value with error code.
607 * @remark Filename must be UTF-8 format.
609 * @pre File should be exists.
610 * @post Handle is ready to use.
611 * @see mm_file_destroy_content_attrs, mm_file_get_attrs
616 // create content handle
617 mm_file_create_content_attrs_simple(&content_attrs, filename);
619 // get width, height information
620 mm_file_get_attrs(content_attrs,
621 MM_FILE_CONTENT_VIDEO_WIDTH, &ccontent.video_w,
622 MM_FILE_CONTENT_VIDEO_HEIGHT, &ccontent.video_h,
625 // Destory content handle
626 mm_file_destroy_content_attrs(content_attrs);
629 int mm_file_create_content_attrs_simple(MMHandleType *content_attrs, const char *filename);
631 int mm_file_create_content_attrs_safe(MMHandleType *content_attrs, const char *filename);
633 int mm_file_get_synclyrics_info(MMHandleType tag_attrs, int index, unsigned long *time_info, char **lyrics);
636 * @brief Get a frame of video media. Not support for DRM Contents.
638 * @remarks @a frame must be released with @c free() by you
640 * @param [in] path The file path
641 * @param [in] timestamp The timestamp in milliseconds
642 * @param [in] is_accurate @a true, user can get an accurated frame for given the timestamp.\n
643 * @a false, user can only get the nearest i-frame of video rapidly.
644 * @param [out] frame raw frame data in RGB888
645 * @param [out] size The frame data size
646 * @param [out] width The frame width
647 * @param [out] height The frame height
648 * @return 0 on success, otherwise a negative error value
649 * @retval #METADATA_EXTRACTOR_ERROR_NONE Successful
650 * @retval #METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER Invalid parameter
651 * @retval #METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY Not enough memory is available
652 * @retval #METADATA_EXTRACTOR_ERROR_OPERATION_FAILED Internal Operation Fail
653 * @pre Set path to extract by calling metadata_extractor_set_path()
654 * @see metadata_extractor_create(), metadata_extractor_destroy()
657 int mm_file_get_video_frame(const char *path, double timestamp, bool is_accurate, unsigned char **frame, int *size, int *width, int *height);
659 int mm_file_get_video_frame_from_memory(const void *data, unsigned int datasize, double timestamp, bool is_accurate, unsigned char **frame, int *size, int *width, int *height);
661 int mm_file_check_uhqa(const char *filename, bool *is_uhqa);