Default bookmark name is empty string. even though user set name to NULL, get_name...
[platform/core/api/media-content.git] / include / media_info_private.h
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17
18 #ifndef __TIZEN_MEDIA_INFO_PRIVATE_H__
19 #define __TIZEN_MEDIA_INFO_PRIVATE_H__
20
21
22 #include <unistd.h>
23 #include <asm/unistd.h>
24 #include <string.h>
25 #include <sqlite3.h>
26 #include <stdlib.h>
27 #include <stdio.h>
28 #include <glib.h>
29 #include <media-svc.h>
30 #include <media_content_type.h>
31 #include <dlog.h>
32 #include <media-util.h>
33 #include <errno.h>
34 #include <tzplatform_config.h>
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif /* __cplusplus */
39
40 #ifdef LOG_TAG
41 #undef LOG_TAG
42 #endif
43
44
45 /**
46  * @addtogroup CAPI_CONTENT_MEDIA_INFO_MODULE
47 * @{
48 *
49 * @file media_info_private.h
50 * @brief This file contains the media info API and related structure and enumeration. \n
51 *        Description of the audio, video,image content involves: album, artist, album_artist, author, genre and description tags. \n
52 *        Parameters of the recording are also supported, as: format, bitrate, duration, size etc. \n
53 *        Defenitions of media DB fields and tables, operations with media data relating to DB and handling with media filter attributes.
54 */
55
56
57 #define LOG_TAG "CAPI_CONTENT_MEDIA_CONTENT"
58
59 #define SAFE_STRLCPY(dst, src, n)       ((g_strlcpy(dst, src, n) < n) ? TRUE : FALSE)
60 #define SAFE_STRLCAT(dst, src, n)       g_strlcat(dst, src, n);
61 #define SAFE_FREE(src)          {if (src) {free(src); src = NULL; } }
62 #define SAFE_G_FREE(src)        {if (src) {g_free(src); src = NULL; } }
63 #define STRING_VALID(str)               ((str != NULL && strlen(str) > 0) ? TRUE : FALSE)
64 #define SQLITE3_FINALIZE(x)     {if (x != NULL) sqlite3_finalize(x); }
65 #define SQLITE3_SAFE_FREE(x)    {if (x != NULL) {sqlite3_free(x); x = NULL; } }
66
67 #define MEDIA_CONTENT_THUMB_DEFAULT_PATH                tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/thumb_default.png")
68 #define MEDIA_CONTENT_INSERT_FILES_PATH         "/tmp"
69 #define MEDIA_CONTENT_EMPTY_STRING                      ""
70
71 #define MAX_QUERY_SIZE 4096
72 #define DEFAULT_QUERY_SIZE 1024
73 #define COLLATE_STR_SIZE 32
74 #define MEDIA_CONTENT_UUID_SIZE 36
75 #define BATCH_REQUEST_MAX 300
76
77 typedef enum {
78         MEDIA_INFO_UUID = 0,
79         MEDIA_INFO_PATH,
80         MEDIA_INFO_FILE_NAME,
81         MEDIA_INFO_TYPE,
82         MEDIA_INFO_MIME_TYPE,
83         MEDIA_INFO_SIZE,
84         MEDIA_INFO_ADDED_TIME,
85         MEDIA_INFO_MODIFIED_TIME,
86         MEDIA_INFO_THUMBNAIL_PATH,
87         MEDIA_INFO_DESCRIPTION,
88         MEDIA_INFO_RATING,
89         MEDIA_INFO_FAVOURITE,
90         MEDIA_INFO_AUTHOR,
91         MEDIA_INFO_PROVIDER,
92         MEDIA_INFO_CONTENT_NAME,
93         MEDIA_INFO_CATEGORY,
94         MEDIA_INFO_LOCATION_TAG,
95         MEDIA_INFO_AGE_RATING,
96         MEDIA_INFO_KEYWORD,
97         MEDIA_INFO_IS_DRM,
98         MEDIA_INFO_STORAGE_TYPE,
99         MEDIA_INFO_LONGITUDE,
100         MEDIA_INFO_LATITUDE,
101         MEDIA_INFO_ALTITUDE,
102         MEDIA_INFO_EXPOSURE_TIME,
103         MEDIA_INFO_FNUMBER,
104         MEDIA_INFO_ISO,
105         MEDIA_INFO_MODEL,
106         MEDIA_INFO_WIDTH,
107         MEDIA_INFO_HEIGHT,
108         MEDIA_INFO_DATETAKEN,
109         MEDIA_INFO_ORIENTATION,
110         MEDIA_INFO_TITLE,
111         MEDIA_INFO_ALBUM,
112         MEDIA_INFO_ARTIST,
113         MEDIA_INFO_ALBUM_ARTIST,
114         MEDIA_INFO_GENRE,
115         MEDIA_INFO_COMPOSER,
116         MEDIA_INFO_YEAR,
117         MEDIA_INFO_RECORDED_DATE,
118         MEDIA_INFO_COPYRIGHT,
119         MEDIA_INFO_TRACK_NUM,
120         MEDIA_INFO_BITRATE,
121         MEDIA_INFO_BITPERSAMPLE,
122         MEDIA_INFO_DURATION,
123         MEDIA_INFO_PLAYED_COUNT,
124         MEDIA_INFO_LAST_PLAYED_TIME,
125         MEDIA_INFO_LAST_PLAYED_POSITION,
126         MEDIA_INFO_SAMPLERATE,
127         MEDIA_INFO_CHANNEL,
128         MEDIA_INFO_BURST_ID,
129         MEDIA_INFO_TIMELINE,
130         MEDIA_INFO_WEATHER,
131         MEDIA_INFO_SYNC_STATUS,
132         MEDIA_INFO_STORAGE_UUID,
133         MEDIA_INFO_IS_360,
134         MEDIA_INFO_ITEM_MAX,
135 } media_info_item_e;
136
137 typedef enum {
138         MEDIA_CONTENT_TYPE = 0,
139         MEDIA_THUMBNAIL_TYPE,
140         MEDIA_REGISTER_TYPE
141 } media_info_error_type_e;
142
143 typedef enum {
144         MEDIA_TAG_ADD,
145         MEDIA_TAG_REMOVE,
146         MEDIA_TAG_UPDATE_TAG_NAME,
147 } tag_function_e;
148
149 typedef enum {
150         MEDIA_PLAYLIST_ADD,
151         MEDIA_PLAYLIST_REMOVE,
152         MEDIA_PLAYLIST_UPDATE_PLAYLIST_NAME,
153         MEDIA_PLAYLIST_UPDATE_THUMBNAIL_PATH,
154         MEDIA_PLAYLIST_UPDATE_PLAY_ORDER,
155 } playlist_function_e;
156
157 typedef enum {
158         MEDIA_GROUP_NONE,
159         MEDIA_GROUP_ALBUM,
160         MEDIA_GROUP_FOLDER,
161         MEDIA_GROUP_PLAYLIST,
162         MEDIA_GROUP_TAG,
163         MEDIA_GROUP_BOOKMARK,
164         MEDIA_GROUP_TAG_BY_MEDIA_ID,
165         MEDIA_GROUP_BOOKMARK_BY_MEDIA_ID,
166         MEDIA_GROUP_STORAGE,
167         MEDIA_GROUP_FACE_BY_MEDIA_ID,
168 } group_list_e;
169
170 typedef enum {
171         MEDIA_BATCH_INSERT_NORMAL,
172         MEDIA_BATCH_INSERT_BURSTSHOT,
173 } media_batch_insert_e;
174
175 typedef struct _filter_s {
176         char *storage_id;
177         char *condition;
178         char *order_keyword;
179         media_content_order_e order_type;
180         media_content_collation_e condition_collate_type;
181         media_content_collation_e order_collate_type;
182         int offset;
183         int count;
184 } filter_s;
185
186 typedef struct {
187         char *folder_id;
188         char *parent_folder_id;
189         char *path;
190         char *name;
191         time_t modified_time;
192         media_content_storage_e storage_type;
193         char *storage_uuid;
194         int folder_order;
195 } media_folder_s;
196
197 typedef struct {
198         int tag_id;
199         char *name;
200         GList *item_list;
201 } media_tag_s;
202
203 typedef struct {
204         int bookmark_id;
205         char *media_id;
206         time_t marked_time;
207         char *thumbnail_path;
208         char *name;
209 } media_bookmark_s;
210
211 typedef struct {
212         int album_id;
213         char *name;
214         char *artist;
215         char *album_art_path;
216 } media_album_s;
217
218 typedef struct {
219         int playlist_id;
220         char *name;
221         char *thumbnail_path;
222         GList *item_list;
223 } media_playlist_s;
224
225 typedef struct {
226         char *media_id;
227         int width;
228         int height;
229         char *date_taken;
230         char *title;
231         char *burst_id;
232         char *weather;
233         char *exposure_time;
234         double fnumber;
235         int iso;
236         char *model;
237         media_content_orientation_e orientation;
238 } image_meta_s;
239
240 typedef struct {
241         char *media_id;
242         char *title;
243         char *album;
244         char *artist;
245         char *album_artist;
246         char *genre;
247         char *composer;
248         char *year;
249         char *recorded_date;
250         char *copyright;
251         char *track_num;
252         int bitrate;
253         int duration;
254         int width;
255         int height;
256         int played_count;
257         int rotation;
258         time_t played_time;
259         int played_position;
260 } video_meta_s;
261
262 typedef struct {
263         char *media_id;
264         char *title;
265         char *album;
266         char *artist;
267         char *album_artist;
268         char *genre;
269         char *composer;
270         char *year;
271         char *recorded_date;
272         char *copyright;
273         char *track_num;
274         int bitrate;
275         int bitpersample;
276         int samplerate;
277         int channel;
278         int duration;
279         int played_count;
280         time_t played_time;
281         int played_position;
282 } audio_meta_s;
283
284 typedef struct {
285         char *media_id;
286         char *file_path;
287         char *display_name;
288         media_content_type_e media_type;
289         char *mime_type;
290         unsigned long long size;
291         time_t added_time;
292         time_t modified_time;
293         time_t timeline;
294         char *thumbnail_path;
295         char *description;
296         double longitude;
297         double latitude;
298         double altitude;
299         char *weather;
300         int rating;
301         time_t favourite;
302         char *title;
303         char *author;
304         char *provider;
305         char *content_name;
306         char *category;
307         char *location_tag;
308         char *age_rating;
309         char *keyword;
310         int is_drm;
311         int storage_type;
312         int played_count;
313         time_t played_time;
314         int played_position;
315         char *storage_uuid;
316         int sync_status;
317         unsigned int request_id;
318         unsigned int face_request_id;
319         int is_360;
320         image_meta_s *image_meta;
321         video_meta_s *video_meta;
322         audio_meta_s *audio_meta;
323 } media_info_s;
324
325 typedef struct {
326         char *media_id;
327         int function;
328         char *tag_name;
329 } media_tag_item_s;
330
331 typedef struct {
332         char *media_id;
333         int function;
334         char *playlist_name;
335         char *thumbnail_path;
336         int playlist_member_id;
337         int play_order;
338 } media_playlist_item_s;
339
340 typedef struct {
341         char *storage_id;
342         char *storage_name;
343         char *storage_path;
344         char *storage_account;
345         int storage_type;
346 } media_storage_s;
347
348 typedef struct {
349         char *face_id;                          /* face uuid */
350         char *media_id;                 /* media uuid */
351         unsigned int face_rect_x;       /* x position of face */
352         unsigned int face_rect_y;       /* y position of face */
353         unsigned int face_rect_w;       /* width of face */
354         unsigned int face_rect_h;       /* height of face */
355         int orientation;                        /* orientation */
356         char *face_tag;                 /* face tag */
357 } media_face_s;
358
359 typedef struct _attribute_map_s {
360         GHashTable *attr_map;
361 } attribute_s;
362
363 typedef struct {
364         media_info_s *handle;
365         void *user_data;
366         media_thumbnail_completed_cb thumbnail_completed_cb;
367 } media_thumbnail_cb_s;
368
369 typedef struct {
370         media_info_s *handle;
371         void *user_data;
372         media_face_detection_completed_cb face_completed_cb;
373 } media_face_cb_s;
374
375 typedef struct {
376         media_insert_completed_cb insert_completed_cb;
377         char *insert_list_path;
378         void *user_data;
379 } media_insert_cb_s;
380
381 typedef struct {
382         media_content_db_update_cb update_noti_cb;
383         void *user_data;
384 } media_noti_cb_s;
385
386 typedef struct attribute_s *attribute_h;
387
388
389 typedef struct _media_content_cb_data {
390         media_scan_completed_cb callback;
391         void *user_data;
392 } media_content_scan_cb_data;
393
394
395 /* DB Table */
396 #define DB_TABLE_MEDIA                  "media"
397 #define DB_TABLE_FOLDER         "folder"
398 #define DB_TABLE_ALBUM                  "album"
399 #define DB_TABLE_TAG                    "tag"
400 #define DB_TABLE_TAG_MAP                "tag_map"
401 #define DB_TABLE_PLAYLIST               "playlist"
402 #define DB_TABLE_PLAYLIST_MAP   "playlist_map"
403 #define DB_TABLE_BOOKMARK               "bookmark"
404 #define DB_TABLE_STORAGE                "storage"
405 #define DB_TABLE_MEDIA_VIEW     "media_view"
406 #define DB_TABLE_FACE                   "face"
407 #define DB_TABLE_FACE_SCAN_LIST "face_scan_list"
408
409 /* DB View */
410 #define DB_VIEW_PLAYLIST        "playlist_view"
411 #define DB_VIEW_TAG                     "tag_view"
412
413 /* DB Table Alias */
414 #define DB_TABLE_ALIAS_MEDIA                    "m"
415 #define DB_TABLE_ALIAS_FOLDER                   "f"
416 #define DB_TABLE_ALIAS_PLAYLIST                 "p"
417 #define DB_TABLE_ALIAS_PLAYLIST_MAP     "pm"
418 #define DB_TABLE_ALIAS_TAG                              "t"
419 #define DB_TABLE_ALIAS_BOOKMARK         "b"
420 #define DB_TABLE_ALIAS_ALBUM                    "a"
421
422 /* DB field for media */
423 #define DB_FIELD_MEDIA_ID                                       "media_uuid"
424 #define DB_FIELD_MEDIA_PATH                             "path"
425 #define DB_FIELD_MEDIA_DISPLAY_NAME             "file_name"
426 #define DB_FIELD_MEDIA_TYPE                                     "media_type"
427 #define DB_FIELD_MEDIA_MIME_TYPE                        "mime_type"
428 #define DB_FIELD_MEDIA_SIZE                                     "size"
429 #define DB_FIELD_MEDIA_ADDED_TIME                       "added_time"
430 #define DB_FIELD_MEDIA_MODIFIED_TIME            "modified_time"
431 #define DB_FIELD_MEDIA_TIMELINE                         "timeline"
432 #define DB_FIELD_MEDIA_THUMBNAIL_PATH   "thumbnail_path"
433 #define DB_FIELD_MEDIA_TITLE                            "title"
434 #define DB_FIELD_MEDIA_ALBUM                            "album"
435 #define DB_FIELD_MEDIA_ARTIST                           "artist"
436 #define DB_FIELD_MEDIA_ALBUM_ARTIST                     "album_artist"
437 #define DB_FIELD_MEDIA_GENRE                            "genre"
438 #define DB_FIELD_MEDIA_COMPOSER                 "composer"
439 #define DB_FIELD_MEDIA_YEAR                             "year"
440 #define DB_FIELD_MEDIA_RECORDED_DATE            "recorded_date"
441 #define DB_FIELD_MEDIA_COPYRIGHT                        "copyright"
442 #define DB_FIELD_MEDIA_TRACK_NUM                        "track_num"
443 #define DB_FIELD_MEDIA_DESCRIPTION                      "description"
444 #define DB_FIELD_MEDIA_BITRATE                          "bitrate"
445 #define DB_FIELD_MEDIA_BITPERSAMPLE             "bitpersample"
446 #define DB_FIELD_MEDIA_SAMPLERATE                       "samplerate"
447 #define DB_FIELD_MEDIA_CHANNEL                  "channel"
448 #define DB_FIELD_MEDIA_DURATION                 "duration"
449 #define DB_FIELD_MEDIA_LONGITUDE                        "longitude"
450 #define DB_FIELD_MEDIA_LATITUDE                 "latitude"
451 #define DB_FIELD_MEDIA_ALTITUDE                 "altitude"
452 #define DB_FIELD_MEDIA_WIDTH                            "width"
453 #define DB_FIELD_MEDIA_HEIGHT                           "height"
454 #define DB_FIELD_MEDIA_DATETAKEN                        "datetaken"
455 #define DB_FIELD_MEDIA_ORIENTATION              "orientation"
456 #define DB_FIELD_MEDIA_BURST_ID                 "burst_id"
457 #define DB_FIELD_MEDIA_PLAYED_COUNT             "played_count"
458 #define DB_FIELD_MEDIA_LAST_PLAYED_TIME         "last_played_time"
459 #define DB_FIELD_MEDIA_LAST_PLAYED_POSITION     "last_played_position"
460 #define DB_FIELD_MEDIA_RATING                           "rating"
461 #define DB_FIELD_MEDIA_FAVOURITE                        "favourite"
462 #define DB_FIELD_MEDIA_AUTHOR                           "author"
463 #define DB_FIELD_MEDIA_PROVIDER                 "provider"
464 #define DB_FIELD_MEDIA_CONTENT_NAME             "content_name"
465 #define DB_FIELD_MEDIA_CATEGORY                 "category"
466 #define DB_FIELD_MEDIA_LOCATION_TAG             "location_tag"
467 #define DB_FIELD_MEDIA_AGE_RATING                       "age_rating"
468 #define DB_FIELD_MEDIA_KEYWORD                  "keyword"
469 #define DB_FIELD_MEDIA_WEATHER                  "weather"
470 #define DB_FIELD_MEDIA_IS_DRM                           "is_drm"
471 #define DB_FIELD_MEDIA_STORAGE_TYPE             "storage_type"
472 #define DB_FIELD_MEDIA_EXPOSURE_TIME    "exposure_time"
473 #define DB_FIELD_MEDIA_FNUMBER                  "fnumber"
474 #define DB_FIELD_MEDIA_ISO                              "iso"
475 #define DB_FIELD_MEDIA_MODEL                    "model"
476 #define DB_FIELD_MEDIA_FILE_NAME_PINYIN                 "file_name_pinyin"
477 #define DB_FIELD_MEDIA_TITLE_PINYIN                                     "title_pinyin"
478 #define DB_FIELD_MEDIA_ALBUM_PINYIN                             "album_pinyin"
479 #define DB_FIELD_MEDIA_ARTIST_PINYIN                            "artist_pinyin"
480 #define DB_FIELD_MEDIA_ALBUM_ARTIST_PINYIN              "album_artist_pinyin"
481 #define DB_FIELD_MEDIA_GENRE_PINYIN                             "genre_pinyin"
482 #define DB_FIELD_MEDIA_COMPOSER_PINYIN                  "composer_pinyin"
483 #define DB_FIELD_MEDIA_COPYRIGHT_PINYIN                 "copyright_pinyin"
484 #define DB_FIELD_MEDIA_DESCRIPTION_PINYIN                       "description_pinyin"
485 #define DB_FIELD_MEDIA_AUTHOR_PINYIN                            "author_pinyin"
486 #define DB_FIELD_MEDIA_PROVIDER_PINYIN                  "provider_pinyin"
487 #define DB_FIELD_MEDIA_CONTENT_NAME_PINYIN              "content_name_pinyin"
488 #define DB_FIELD_MEDIA_CATEGORY_PINYIN                  "category_pinyin"
489 #define DB_FIELD_MEDIA_LOCATION_TAG_PINYIN              "location_tag_pinyin"
490 #define DB_FIELD_MEDIA_AGE_RATING_PINYIN                        "age_rating_pinyin"
491 #define DB_FIELD_MEDIA_KEYWORD_PINYIN                           "keyword_pinyin"
492 #define DB_FIELD_MEDIA_360                                                      "is_360"
493
494 /* DB field for folder */
495 #define DB_FIELD_FOLDER_ID                              "folder_uuid"
496 #define DB_FIELD_FOLDER_PATH                    "path"
497 #define DB_FIELD_FOLDER_NAME                    "name"
498 #define DB_FIELD_FOLDER_MODIFIED_TIME   "modified_time"
499 #define DB_FIELD_FOLDER_STORAGE_TYPE    "storage_type"
500 #define DB_FIELD_FOLDER_NAME_PINYIN     "name_pinyin"
501 #define DB_FIELD_FOLDER_ORDER                   "folder_order"
502 #define DB_FIELD_FOLDER_PARENT_FOLDER_ID        "parent_folder_uuid"
503
504 /* DB field for playlist */
505 #define DB_FIELD_PLAYLIST_ID                                    "playlist_id"
506 #define DB_FIELD_PLAYLIST_NAME                          "name"
507 #define DB_FIELD_PLAYLIST_MEMBER_ORDER  "play_order"
508 #define DB_FIELD_PLAYLIST_MEDIA_COUNT                   "media_count"
509
510 /* DB field for tag */
511 #define DB_FIELD_TAG_ID                 "tag_id"
512 #define DB_FIELD_TAG_NAME               "name"
513 #define DB_FIELD_TAG_MEDIA_COUNT                        "media_count"
514
515 /* DB field for bookmark */
516 #define DB_FIELD_BOOKMARK_ID    "bookmark_id"
517 #define DB_FIELD_BOOKMARK_MARKED_TIME   "marked_time"
518 #define DB_FIELD_BOOKMARK_NAME  "name"
519
520 /* DB field for album*/
521 #define DB_FIELD_ALBUM_ID                       "album_id"
522 #define DB_FIELD_ALBUM_NAME             "name"
523 #define DB_FIELD_ALBUM_ARTIST           "artist"
524
525 /* DB field for Storage*/
526 #define DB_FIELD_STORAGE_ID                     "storage_uuid"
527 #define DB_FIELD_STORAGE_PATH           "storage_path"
528
529 /* DB field for Face */
530 #define DB_FIELD_FACE_TAG                       "face_tag"
531
532 /* DB Query Keyword */
533 #define QUERY_KEYWORD_AND "AND"
534 #define QUERY_KEYWORD_OR "OR"
535 #define QUERY_KEYWORD_ORDER_BY "ORDER BY"
536 #define QUERY_KEYWORD_LIMIT "limit"
537 #define QUERY_KEYWORD_DESC "DESC"
538 #define QUERY_KEYWORD_SPACE " "
539 #define QUERY_KEYWORD_OPEN_BRACKET "("
540 #define QUERY_KEYWORD_BRACKET ")"
541
542 /* DB TABLE JOIN */
543 /*#define FOLDER_MEDIA_JOIN                                     "("DB_TABLE_FOLDER" AS f LEFT OUTER JOIN '%s' AS m ON f.folder_uuid=m.folder_uuid AND m.validity=1) WHERE f.storage_uuid IN (SELECT storage_uuid FROM "DB_TABLE_STORAGE" WHERE validity=1) " */
544 #define FOLDER_MEDIA_JOIN                                       "("DB_TABLE_FOLDER" AS f LEFT OUTER JOIN '%s' AS m ON f.folder_uuid=m.folder_uuid AND m.validity=1) WHERE f.validity=1 "
545 #define BOOKMARK_MEDIA_JOIN                             "("DB_TABLE_BOOKMARK" AS b INNER JOIN '%s' AS m \
546                                                                                         ON (b.media_uuid = m.media_uuid)) WHERE m.validity=1"
547 #define ALBUM_MEDIA_JOIN                                        "("DB_TABLE_ALBUM" AS a INNER JOIN '%s' AS m \
548                                                                                         ON (a.album_id = m.album_id)) WHERE m.validity=1"
549 #define FACE_MEDIA_JOIN                                         "("DB_TABLE_FACE" AS fa INNER JOIN '%s' AS m \
550                                                                                                 ON (fa.media_uuid = m.media_uuid)) WHERE m.validity=1"
551
552 /* Get Group List */
553 #define SELECT_ALBUM_LIST                       "SELECT DISTINCT a.album_id, a.name, a.artist, a.album_art FROM "ALBUM_MEDIA_JOIN
554 #define SELECT_MEDIA_GROUP_LIST "SELECT DISTINCT %s FROM '%s' WHERE validity=1 "
555
556 #define SELECT_FOLDER_LIST                      "SELECT DISTINCT f.folder_uuid, f.path, f.name, f.storage_type, f.modified_time, f.storage_uuid, f.folder_order, f.parent_folder_uuid FROM "FOLDER_MEDIA_JOIN
557 #define SELECT_FOLDER_LIST_BY_STORAGE_ID        SELECT_FOLDER_LIST"AND f.storage_uuid='%s' "
558 #define SELECT_TAG_LIST                         "SELECT DISTINCT tag_id, name FROM "DB_VIEW_TAG" WHERE 1 "
559 #define SELECT_PLAYLIST_LIST                    "SELECT DISTINCT playlist_id, name, p_thumbnail_path FROM "DB_VIEW_PLAYLIST" WHERE 1 "
560
561 /* Get Group Count */
562 #define SELECT_ALBUM_COUNT              "SELECT COUNT(DISTINCT a.album_id) FROM "ALBUM_MEDIA_JOIN
563 #define SELECT_FOLDER_COUNT             "SELECT COUNT(DISTINCT f.folder_uuid) FROM "FOLDER_MEDIA_JOIN
564 #define SELECT_FOLDER_COUNT_BY_STORAGE_ID               SELECT_FOLDER_COUNT"AND f.storage_uuid='%s' "
565 #define SELECT_TAG_COUNT                        "SELECT COUNT(DISTINCT tag_id) FROM "DB_VIEW_TAG" WHERE 1 "
566 #define SELECT_PLAYLIST_COUNT           "SELECT COUNT(DISTINCT playlist_id) FROM "DB_VIEW_PLAYLIST" WHERE 1 "
567 #define SELECT_BOOKMARK_COUNT   "SELECT COUNT(DISTINCT b.bookmark_id) FROM "BOOKMARK_MEDIA_JOIN
568 #define SELECT_MEDIA_GROUP_COUNT        "SELECT COUNT(*) FROM ("SELECT_MEDIA_GROUP_LIST
569 /*count(distinct x) count only non-null values, but select distinct X returns include null. so sync the result of count and list, don't use count(distinct x)*/
570
571 /* Get Media Count of Group */
572 #define SELECT_MEDIA_COUNT_FROM_MEDIA                   "SELECT COUNT(*) FROM ("SELECT_MEDIA_ITEM               /*to apply limit condition. "SELECT COUNT(*) FROM "DB_TABLE_MEDIA" WHERE validity=1" */
573 #define SELECT_MEDIA_COUNT_FROM_MEDIA_SIMPLE    "SELECT COUNT(*) FROM '%s' WHERE validity=1 "
574 #define SELECT_MEDIA_COUNT_FROM_ALBUM                   "SELECT COUNT(*) FROM '%s' WHERE validity=1 AND album_id='%d'"
575 #define SELECT_MEDIA_COUNT_FROM_GROUP                   "SELECT COUNT(*) FROM ("SELECT_MEDIA_FROM_GROUP         /*to apply limit condition. */
576 #define SELECT_MEDIA_COUNT_FROM_GROUP_NULL              "SELECT COUNT(*) FROM ("SELECT_MEDIA_FROM_GROUP_NULL    /* to apply limit condition. */
577 #define SELECT_MEDIA_COUNT_FROM_FOLDER                  "SELECT COUNT(*) FROM '%s' WHERE validity=1 AND folder_uuid='%q'"
578 #define SELECT_MEDIA_COUNT_FROM_STORAGE                 "SELECT COUNT(*) FROM '%s' WHERE validity=1 AND storage_uuid='%q'"
579 #define SELECT_MEDIA_COUNT_FROM_TAG                             "SELECT COUNT(*) FROM "DB_VIEW_TAG" WHERE (tag_id=%d AND media_count>0) "
580 #define SELECT_MEDIA_COUNT_FROM_PLAYLIST                        "SELECT COUNT(*) FROM "DB_VIEW_PLAYLIST" WHERE (playlist_id=%d and media_count>0) "
581
582 /* Get Group Info by Group ID*/
583 #define SELECT_ALBUM_FROM_ALBUM         "SELECT * FROM "DB_TABLE_ALBUM" WHERE album_id=%d"
584 #define SELECT_FOLDER_FROM_FOLDER               "SELECT * FROM "DB_TABLE_FOLDER" WHERE folder_uuid='%s'"
585 #define SELECT_FOLDER_BY_PATH                   "SELECT * FROM "DB_TABLE_FOLDER" WHERE path='%q'"
586 #define SELECT_PLAYLIST_FROM_PLAYLIST   "SELECT * FROM "DB_TABLE_PLAYLIST" WHERE playlist_id=%d"
587 #define SELECT_TAG_FROM_TAG                     "SELECT * FROM "DB_TABLE_TAG" WHERE tag_id=%d"
588 #define SELECT_TAG_BY_NAME                              "SELECT * FROM "DB_TABLE_TAG" WHERE name='%q'"
589
590 /* Tag info*/
591 #define INSERT_TAG_TO_TAG                                               "INSERT INTO "DB_TABLE_TAG" (name) VALUES (%Q)"
592 #define REMOVE_TAG_ITEM_FROM_TAG_MAP            "DELETE FROM "DB_TABLE_TAG_MAP" WHERE tag_id=%d AND media_uuid='%q';"
593 #define UPDATE_TAG_NAME_FROM_TAG                        "UPDATE "DB_TABLE_TAG" SET name='%q' WHERE tag_id=%d;"
594 #define SELECT_TAG_COUNT_BY_MEDIA_ID                    "SELECT COUNT(*) FROM "DB_VIEW_TAG" WHERE media_uuid = '%s'"
595 #define SELECT_TAG_LIST_BY_MEDIA_ID                             "SELECT tag_id, name FROM "DB_VIEW_TAG" WHERE media_uuid = '%s'"
596
597 /* Get Media list of Group */
598 #define MEDIA_INFO_ITEM "media_uuid, path, file_name, media_type, mime_type, size, added_time, modified_time, thumbnail_path, description, \
599                                                         rating, favourite, author, provider, content_name, category, location_tag, age_rating, keyword, is_drm, storage_type, longitude, latitude, altitude, exposure_time, fnumber, iso, model, width, height, datetaken, orientation, title, album, artist, album_artist, genre, composer, year, recorded_date, copyright, track_num, bitrate, bitpersample, duration, played_count, last_played_time, last_played_position, samplerate, channel, burst_id, timeline, weather, sync_status, storage_uuid, is_360"
600
601 /*Folder info*/
602 #define UPDATE_FOLDER_ORDER                                     "UPDATE "DB_TABLE_FOLDER" SET folder_order=%d WHERE folder_uuid=%Q"
603
604 /* Playlist Info */
605 #define INSERT_PLAYLIST_TO_PLAYLIST                                             "INSERT INTO "DB_TABLE_PLAYLIST" (name) VALUES (%Q)"
606 #define UPDATE_PLAYLIST_NAME_FROM_PLAYLIST                      "UPDATE "DB_TABLE_PLAYLIST" SET name='%q' WHERE playlist_id=%d;"
607 #define UPDATE_PLAYLIST_THUMBNAIL_FROM_PLAYLIST         "UPDATE "DB_TABLE_PLAYLIST" SET thumbnail_path='%q' WHERE playlist_id=%d;"
608 #define SELECT_PLAYLIST_ID_FROM_PLAYLIST                                "SELECT playlist_id FROM "DB_TABLE_PLAYLIST" WHERE name='%q'"
609 #define SELECT_PLAYLIST_ITEM_ID_FROM_PLAYLIST_VIEW      "SELECT pm_id, media_uuid FROM "DB_VIEW_PLAYLIST" WHERE (playlist_id=%d and media_count>0) "
610 #define SELECT_PLAYLIST_ITEM_ALL_FROM_PLAYLIST_VIEW     "SELECT "MEDIA_INFO_ITEM", pm_id FROM "DB_VIEW_PLAYLIST" WHERE (playlist_id=%d and media_count>0) "
611 #define SELECT_PLAY_ORDER_FROM_PLAYLIST_VIEW                    "SELECT play_order FROM "DB_VIEW_PLAYLIST" WHERE playlist_id=%d and pm_id=%d"
612 #define SELECT_MAX_PLAY_ORDER_FROM_PLAYLIST_VIEW        "SELECT MAX(play_order) FROM "DB_VIEW_PLAYLIST" WHERE playlist_id=%d"
613 #define REMOVE_PLAYLIST_ITEM_FROM_PLAYLIST_MAP          "DELETE FROM "DB_TABLE_PLAYLIST_MAP" WHERE playlist_id=%d AND _id=%d;"
614 #define UPDATE_PLAYLIST_ORDER_FROM_PLAYLIST_MAP         "UPDATE "DB_TABLE_PLAYLIST_MAP" SET play_order=%d WHERE playlist_id=%d AND _id=%d;"
615
616 /* Bookmark */
617 #define INSERT_BOOKMARK_TO_BOOKMARK                     "INSERT INTO "DB_TABLE_BOOKMARK" (media_uuid, marked_time, thumbnail_path, name) VALUES ('%q', '%d', %Q, %Q)"
618 #define SELECT_BOOKMARK_COUNT_BY_MEDIA_ID               "SELECT COUNT(*) FROM "BOOKMARK_MEDIA_JOIN" AND b.media_uuid='%s'"
619 #define SELECT_BOOKMARK_LIST_BY_MEDIA_ID                        "SELECT b.bookmark_id, b.media_uuid, b.marked_time, b.thumbnail_path, b.name FROM "BOOKMARK_MEDIA_JOIN" AND b.media_uuid='%s'"
620 #define UPDATE_BOOKMARK_FROM_BOOKMARK           "UPDATE "DB_TABLE_BOOKMARK" SET name=%Q WHERE bookmark_id=%d;"
621
622 /* Update Meta*/
623 #define UPDATE_AV_META_FROM_MEDIA       "UPDATE '%s' SET played_count=%d, last_played_time=%d, last_played_position=%d WHERE media_uuid='%q'"
624 #define UPDATE_IMAGE_META_FROM_MEDIA    "UPDATE '%s' SET orientation=%d, weather=%Q WHERE media_uuid='%q'"
625
626 #define SELECT_MEDIA_ITEM                                       "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1"
627 #define SELECT_MEDIA_FROM_MEDIA                 "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1 AND media_uuid='%s'"
628 #define SELECT_MEDIA_BY_PATH                            "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1 AND path='%q'"
629 #define SELECT_MEDIA_FROM_ALBUM                 "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1 AND album_id=%d"
630 #define SELECT_MEDIA_FROM_GROUP                 "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1 AND %s='%q'"
631 #define SELECT_MEDIA_FROM_GROUP_NULL    "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1 AND %s IS NULL"
632 #define SELECT_MEDIA_FROM_FOLDER                        "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1 AND folder_uuid='%s'"
633 #define SELECT_MEDIA_FROM_STORAGE               "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1 AND storage_uuid='%s'"
634 #define SELECT_MEDIA_FROM_TAG                           "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE media_uuid IN (SELECT media_uuid FROM "DB_TABLE_TAG_MAP" WHERE tag_id=%d) AND validity=1"
635 #define SELECT_MEDIA_FROM_PLAYLIST              "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE media_uuid IN (SELECT media_uuid FROM "DB_TABLE_PLAYLIST_MAP" WHERE playlist_id=%d) AND validity=1"
636 #define SELECT_MEDIA_PATH_BY_ID                 "SELECT path FROM "DB_TABLE_MEDIA_VIEW" WHERE media_uuid='%q'"
637 #define SELECT_MEDIA_STORAGE_ID_BY_ID           "SELECT storage_uuid FROM "DB_TABLE_MEDIA_VIEW" WHERE media_uuid='%q'"
638
639 /* Delete */
640 #define DELETE_MEDIA_FROM_MEDIA_BATCH   "DELETE FROM  '%s' WHERE %s"
641 #define DELETE_PLAYLIST_FROM_PLAYLIST           "DELETE FROM "DB_TABLE_PLAYLIST" WHERE playlist_id=%d"
642 #define DELETE_TAG_FROM_TAG                             "DELETE FROM "DB_TABLE_TAG" WHERE tag_id=%d"
643 #define DELETE_BOOKMARK_FROM_BOOKMARK   "DELETE FROM "DB_TABLE_BOOKMARK" WHERE bookmark_id=%d"
644
645 /* Storage*/
646 #define SELECT_STORAGE_COUNT                            "SELECT COUNT(*) FROM "DB_TABLE_STORAGE" WHERE validity=1"
647 #define SELECT_STORAGE_LIST                                     "SELECT * FROM "DB_TABLE_STORAGE" WHERE validity=1"
648 #define SELECT_STORAGE_INFO_FROM_STORAGE        "SELECT * FROM "DB_TABLE_STORAGE" WHERE validity=1 AND storage_uuid='%s'"
649
650 /* Face */
651 #define DELETE_FACE_FROM_FACE                   "DELETE FROM "DB_TABLE_FACE" WHERE face_uuid='%q'"
652 #define INSERT_FACE_TO_FACE                             "INSERT INTO "DB_TABLE_FACE" (face_uuid, media_uuid, face_rect_x , face_rect_y, face_rect_w, face_rect_h, orientation, face_tag) VALUES ('%q', '%q', %d, %d, %d, %d, %d, %Q);"
653 #define UPDATE_FACE_TO_FACE                     "UPDATE "DB_TABLE_FACE" SET face_rect_x=%d, face_rect_y=%d, face_rect_w=%d, face_rect_h=%d, orientation=%d, face_tag=%Q WHERE face_uuid='%q'"
654 #define SELECT_MEDIA_COUNT_FROM_MEDIA_BY_ID             "SELECT COUNT(*) FROM "DB_TABLE_MEDIA_VIEW" WHERE media_uuid='%q' AND validity=1"
655 #define SELECT_FACE_COUNT_BY_MEDIA_ID           "SELECT COUNT(*) FROM "FACE_MEDIA_JOIN" AND fa.media_uuid='%s'"
656 #define SELECT_FACE_LIST_BY_MEDIA_ID            "SELECT fa.face_uuid, fa.media_uuid, fa.face_rect_x, fa.face_rect_y, fa.face_rect_w, fa.face_rect_h, fa.orientation, fa.face_tag FROM "FACE_MEDIA_JOIN" AND fa.media_uuid='%s'"
657 #define SELECT_FACE_PATH_FROM_MEDIA             "SELECT path FROM "DB_TABLE_MEDIA_VIEW" media_uuid='%s'"
658
659 #define DEFAULT_MEDIA_STORAGE_ID                        "media"
660
661 int _content_query_prepare(sqlite3_stmt **stmt, char *select_query, char *condition_query, char *option_query);
662 int _content_error_capi(int type, int cotent_error);
663 int _content_query_sql(char *query_str);
664 MediaSvcHandle* _content_get_db_handle(void);
665 attribute_h _content_get_attirbute_handle(void);
666 attribute_h _content_get_alias_attirbute_handle(void);
667 int _media_info_get_media_info_from_db(const char *path, const char *storage_id, media_info_h media);
668 void _media_info_item_get_detail(sqlite3_stmt *stmt, media_info_h media);
669 int _media_db_get_group_count(filter_h filter, group_list_e group_type, int *group_count);
670 int _media_db_get_media_group_count(media_group_e group, filter_h filter, int *group_count);
671 int _media_db_get_media_group(media_group_e group, filter_h filter, media_group_cb callback, void *user_data);
672 int _media_db_get_album(filter_h filter, media_album_cb callback, void *user_data);
673 int _media_db_get_folder(filter_h filter, media_folder_cb callback, void *user_data);
674 int _media_db_get_playlist(filter_h filter, media_playlist_cb callback, void *user_data);
675 int _media_db_get_playlist_item(int playlist_id, filter_h filter, playlist_member_cb callback, void *user_data);
676 int _media_db_get_tag(const char *media_id, filter_h filter, media_tag_cb callback, void *user_data);
677 int _media_db_get_bookmark(const char *media_id, filter_h filter, media_bookmark_cb callback, void *user_data);
678 int _media_db_get_face(const char *media_id, filter_h filter, media_face_cb callback, void *user_data);
679 int _media_db_get_group_item_count_by_id(int group_id, filter_h filter, group_list_e group_type, int *item_count);
680 int _media_db_get_group_item_count(const char *group_name, filter_h filter, group_list_e group_type, int *item_count);
681 int _media_db_get_group_item_by_id(int group_id, filter_h filter, media_info_cb callback, void *user_data, group_list_e group_type);
682 int _media_db_get_group_item(const char *group_name, filter_h filter, media_info_cb callback, void *user_data, group_list_e group_type);
683 int _media_db_get_media_group_item_count(const char *group_name, filter_h filter, media_group_e group, int *item_count);
684 int _media_db_get_media_group_item(const char *group_name, filter_h filter, media_group_e group, media_info_cb callback, void *user_data);
685 int _media_db_get_storage(filter_h filter, media_storage_cb callback, void *user_data);
686 int _media_db_get_storage_id_by_media_id(const char *media_id, char *storage_id);
687
688 /**
689  * @internal
690  * @brief Creates a media filter attribute handle.
691  * @details This function creates a media filter attribute handle. The handle can be
692  * used to convert to attributes of database from attributes of user.
693  * @remarks The @a handle must be released with media_filter_attribute_destory() by you.
694  * @param[out] filter A handle to media filter attribute
695  * @return 0 on success, otherwise a negative error value.
696  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
697  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
698  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
699  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
700  * @see media_filter_attribute_destory()
701  *
702  */
703 int _media_filter_attribute_create(attribute_h *attr);
704
705 /**
706  * @internal
707  * @brief Add the attributes to the handle.
708  * @details This function add the attribute to handle.
709  * @param[in] filter The handle to media filter attribute
710  * @param[in] user_attr The user attribute
711  * @param[in] platform_attr The platform attribute
712  * @return 0 on success, otherwise a negative error value.
713  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
714  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
715  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
716  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
717  * @see media_filter_attribute_remove()
718  *
719  */
720 int _media_filter_attribute_add(attribute_h atrr, const char *user_attr, const char *platform_attr);
721
722 /**
723  * @internal
724  * @brief Destroys a media filter attribute handle.
725  * @details The function frees all resources related to the media filter attribute handle. The filter attribute
726  * handle no longer can be used to perform any operation. A new handle
727  * has to be created before the next usage.
728  *
729  * @param[in] filter The handle to media filter attribute
730  * @return 0 on success, otherwise a negative error value.
731  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
732  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
733  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
734  * @see media_filter_create()
735  *
736  */
737 int _media_filter_attribute_destory(attribute_h attr);
738
739 /**
740  * @internal
741  * @brief Replace to platform attributes from user attributes.
742  * @details This function replace to platform attributes from user attributes to generate the WHERE clause
743  * @param[in] filter The handle to media filter attribute
744  * @param[in] user_attr The user attribute
745  * @param[in] platform_attr The platform attribute
746  * @return 0 on success, otherwise a negative error value.
747  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
748  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
749  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
750  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
751  * @see media_filter_attribute_create()
752  * @see media_filter_attribute_destory()
753  *
754  */
755 int _media_filter_attribute_generate(attribute_h attr, char *condition, media_content_collation_e collate_type, char **generated_condition);
756
757
758 /**
759  * @internal
760  * @brief Replace to platform attributes from user attributes.
761  * @details This function replace to platform attributes from user attributes to generate the WHERE clause
762  * @param[in] filter The handle to media filter attribute
763  * @param[in] attr The attribute
764  * @param[in] generated_option The handle to generated option
765  * @return 0 on success, otherwise a negative error value.
766  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
767  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
768  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED Filed DB
769  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
770  * @see media_filter_attribute_create()
771  * @see media_filter_attribute_destory()
772  *
773  */
774
775 int _media_filter_attribute_option_generate(attribute_h attr, filter_h filter, char **generated_option);
776
777 #define FONT_COLOR_RESET    "\033[0m"
778 #define FONT_COLOR_RED      "\033[31m"
779 #define FONT_COLOR_GREEN    "\033[32m"
780 #define FONT_COLOR_YELLOW   "\033[33m"
781 #define FONT_COLOR_BLUE     "\033[34m"
782 #define FONT_COLOR_PURPLE   "\033[35m"
783 #define FONT_COLOR_CYAN     "\033[36m"
784 #define FONT_COLOR_GRAY     "\033[37m"
785
786 #define media_content_gettid() syscall(__NR_gettid)
787
788 #define media_content_retv_if(expr, val) do { \
789                         if (expr) { \
790                                 LOGE(FONT_COLOR_RED"[%d]"FONT_COLOR_RESET, media_content_gettid());    \
791                                 return (val); \
792                         } \
793                 } while (0)
794
795 #define media_content_retvm_if(expr, val, fmt, arg...) do { \
796                         if (expr) { \
797                                 LOGE(FONT_COLOR_RED"[%d]"fmt""FONT_COLOR_RESET, media_content_gettid(), ##arg);     \
798                                 return (val); \
799                         } \
800                 } while (0)
801
802 #define media_content_warn(fmt, arg...) do { \
803                         LOGW(FONT_COLOR_GREEN"[%d]"fmt""FONT_COLOR_RESET, media_content_gettid(), ##arg);     \
804                 } while (0)
805
806 #define media_content_debug(fmt, arg...) do { \
807                         LOGD(FONT_COLOR_RESET"[%d]"fmt"", media_content_gettid(), ##arg);     \
808                 } while (0)
809
810 #define media_content_info(fmt, arg...) do { \
811                         LOGI(FONT_COLOR_GREEN"[%d]"fmt""FONT_COLOR_RESET, media_content_gettid(), ##arg);     \
812                 } while (0)
813
814 #define media_content_error(fmt, arg...) do { \
815                         LOGE(FONT_COLOR_RED"[%d]"fmt""FONT_COLOR_RESET, media_content_gettid(), ##arg);     \
816                 } while (0)
817
818 #define media_content_debug_func() do { \
819                         LOGD(FONT_COLOR_RESET"[%d]", media_content_gettid());     \
820                 } while (0)
821
822 #define media_content_sec_debug(fmt, arg...) do { \
823                         SECURE_LOGD(FONT_COLOR_RESET"[%d]"fmt"", media_content_gettid(), ##arg);     \
824                 } while (0)
825
826 #define media_content_sec_warn(fmt, arg...) do { \
827                         SECURE_LOGW(FONT_COLOR_GREEN"[%d]"fmt""FONT_COLOR_RESET, media_content_gettid(), ##arg);     \
828                 } while (0)
829
830 #define media_content_sec_error(fmt, arg...) do { \
831                         SECURE_LOGE(FONT_COLOR_RED"[%d]"fmt""FONT_COLOR_RESET, media_content_gettid(), ##arg);     \
832                 } while (0)
833
834 #define ERR_BUF_LENGTH 256
835 #define media_content_stderror(fmt) do { \
836                         char media_content_stderror_buf[ERR_BUF_LENGTH] = {0, }; \
837                         strerror_r(errno, media_content_stderror_buf, ERR_BUF_LENGTH);  \
838                         LOGE(FONT_COLOR_RED fmt" : STANDARD ERROR [%s]"FONT_COLOR_RESET, media_content_stderror_buf); \
839                 } while (0)
840
841 #ifdef __cplusplus
842 }
843 #endif /* __cplusplus */
844 #endif /*__TIZEN_MEDIA_INFO_PRIVATE_H__*/