2 * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef _MTP_MEDIA_INFO_H_
18 #define _MTP_MEDIA_INFO_H_
25 #include <media_content.h>
26 #include "mtp_config.h"
27 #include "mtp_datatype.h"
29 #define MEDIA_PATH_COND "MEDIA_PATH="
30 #define MEDIA_PATH_COND_LEN 13 /* MEDIA_PATH="" */
31 #define MEDIA_PATH_COND_OR " OR "
32 #define MEDIA_PATH_COND_OR_LEN 4
33 #define MEDIA_PATH_COND_MAX_LEN MEDIA_PATH_COND_LEN + MTP_MAX_PATHNAME_SIZE
35 #define MTP_PAL_SAFE_FREE(src) { g_free(src); src = NULL; }
38 * struct MtpCommonMetadata
39 * This structure contains common metadata fields between
40 * video and audio files.
43 mtp_char *artist; /* A pointer to Artist */
44 mtp_char *album; /* A pointer to Album name. */
45 mtp_char *genre; /* A pointer to Genre */
46 mtp_char *author; /* A pointer to Author name */
47 mtp_char *copyright; /* A pointer to Copyright info */
48 mtp_char *year; /* A pointer to release year */
49 mtp_char *description; /* A pointer to description */
50 mtp_int32 duration; /* Duration of the track */
51 mtp_int32 audio_bitrate; /* Audio bitrate */
52 mtp_int32 sample_rate;
53 mtp_int32 num_channel;
54 mtp_int32 audio_codec;
76 common_meta_t commonmeta;
77 audio_meta_t audiometa;
81 common_meta_t commonmeta;
82 video_meta_t videometa;
89 pthread_mutex_t *lock;
92 mtp_bool _util_get_audio_metadata(const mtp_char *filepath,
93 comp_audio_meta_t *audio_data);
94 mtp_bool _util_get_video_metadata(mtp_char *filepath,
95 comp_video_meta_t *video_data);
96 mtp_bool _util_get_image_ht_wt(const mtp_char *filepath, image_meta_t *image_data);
97 mtp_bool _util_get_audio_meta_from_extractor(const mtp_char *filepath,
98 comp_audio_meta_t *audio_data);
99 mtp_bool _util_get_video_meta_from_extractor(const mtp_char *filepath,
100 comp_video_meta_t *video_data);
101 void _util_flush_db(void);
102 void _util_delete_file_from_db(const mtp_char *filepath);
103 void _util_add_file_to_db(const mtp_char *filepath);
104 void _util_scan_folder_contents_in_db(const mtp_char *filepath);
105 void _util_free_common_meta(common_meta_t *metadata);
106 void _util_free_video_meta(video_meta_t *video);
107 void _util_free_image_meta(image_meta_t *image);
113 #endif /* _MTP_MEDIA_INFO_H_ */