Remove unused PVR, UHD APIs
[platform/core/api/media-content.git] / include_product / 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_CONTENT_MEDIA_INFO_PRIVATE_H__
19 #define __TIZEN_CONTENT_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 #ifdef _USE_TVPD_MODE
36 #include <media_content_type_product.h>
37 #endif
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif /* __cplusplus */
42
43 #ifdef LOG_TAG
44 #undef LOG_TAG
45 #endif
46
47
48 /**
49  * @addtogroup CAPI_CONTENT_MEDIA_INFO_MODULE
50 * @{
51 *
52 * @file media_info_private.h
53 * @brief This file contains the media info API and related structure and enumeration. \n
54 *        Description of the audio, video,image content involves: album, artist, album_artist, genre and description tags. \n
55 *        Parameters of the recording are also supported, as: format, bitrate, duration, size etc. \n
56 *        Definitions of media DB fields and tables, operations with media data relating to DB and handling with media filter attributes.
57 */
58
59
60 #define LOG_TAG "CAPI_CONTENT_MEDIA_CONTENT"
61
62 #define SAFE_STRLCPY(dst, src, n)       g_strlcpy(dst, src, n);
63 #define SAFE_STRLCAT(dst, src, n)       g_strlcat(dst, src, n);
64 #define SAFE_FREE(src)          {if (src) {free(src); src = NULL; } }
65 #define STRING_VALID(str)               ((str != NULL && strlen(str) > 0) ? TRUE : FALSE)
66 #define SQLITE3_FINALIZE(x)     {if (x != NULL) sqlite3_finalize(x); }
67 #define SQLITE3_SAFE_FREE(x)    {if (x != NULL) {sqlite3_free(x); x = NULL; } }
68
69 #define MEDIA_CONTENT_INSERT_FILES_PATH         "/tmp"
70 #define MEDIA_CONTENT_EMPTY_STRING                      ""
71
72 #define MAX_QUERY_SIZE 4096
73 #define MAX_PATH_LEN 4096
74 #define DEFAULT_QUERY_SIZE 1024
75 #define MEDIA_CONTENT_UUID_SIZE 36
76 #define BATCH_REQUEST_MAX 300
77 #define BATCH_REQUEST_FILE_LEN 255
78
79 typedef enum {
80         MEDIA_INFO_UUID = 0,
81         MEDIA_INFO_PATH,
82         MEDIA_INFO_FILE_NAME,
83         MEDIA_INFO_TYPE,
84         MEDIA_INFO_MIME_TYPE,
85         MEDIA_INFO_SIZE,
86         MEDIA_INFO_ADDED_TIME,
87         MEDIA_INFO_MODIFIED_TIME,
88         MEDIA_INFO_THUMBNAIL_PATH,
89         MEDIA_INFO_DESCRIPTION,
90         MEDIA_INFO_RATING,
91         MEDIA_INFO_FAVOURITE,
92         MEDIA_INFO_IS_DRM,
93         MEDIA_INFO_LONGITUDE,
94         MEDIA_INFO_LATITUDE,
95         MEDIA_INFO_ALTITUDE,
96         MEDIA_INFO_EXPOSURE_TIME,
97         MEDIA_INFO_FNUMBER,
98         MEDIA_INFO_ISO,
99         MEDIA_INFO_MODEL,
100         MEDIA_INFO_WIDTH,
101         MEDIA_INFO_HEIGHT,
102         MEDIA_INFO_DATETAKEN,
103         MEDIA_INFO_ORIENTATION,
104         MEDIA_INFO_TITLE,
105         MEDIA_INFO_ALBUM,
106         MEDIA_INFO_ARTIST,
107         MEDIA_INFO_ALBUM_ARTIST,
108         MEDIA_INFO_GENRE,
109         MEDIA_INFO_COMPOSER,
110         MEDIA_INFO_YEAR,
111         MEDIA_INFO_RECORDED_DATE,
112         MEDIA_INFO_COPYRIGHT,
113         MEDIA_INFO_TRACK_NUM,
114         MEDIA_INFO_BITRATE,
115         MEDIA_INFO_BITPERSAMPLE,
116         MEDIA_INFO_DURATION,
117         MEDIA_INFO_SAMPLERATE,
118         MEDIA_INFO_CHANNEL,
119         MEDIA_INFO_TIMELINE,
120         MEDIA_INFO_STORAGE_UUID,
121         MEDIA_INFO_IS_360,
122         MEDIA_INFO_PLAYED_COUNT,
123         MEDIA_INFO_LAST_PLAYED_TIME,
124         MEDIA_INFO_LAST_PLAYED_POSITION,
125         MEDIA_INFO_STITCHED_INFO,
126         MEDIA_INFO_EXTRACT_FLAG,
127         MEDIA_INFO_ITEM_MAX,
128 } media_info_item_e;
129
130 typedef enum {
131         MEDIA_TAG_ADD,
132         MEDIA_TAG_REMOVE,
133         MEDIA_TAG_UPDATE_TAG_NAME,
134 } tag_function_e;
135
136 typedef enum {
137         MEDIA_PLAYLIST_ADD,
138         MEDIA_PLAYLIST_REMOVE,
139         MEDIA_PLAYLIST_UPDATE_PLAYLIST_NAME,
140         MEDIA_PLAYLIST_UPDATE_THUMBNAIL_PATH,
141         MEDIA_PLAYLIST_UPDATE_PLAY_ORDER,
142 } playlist_function_e;
143
144 typedef enum {
145         MEDIA_GROUP_NONE,
146         MEDIA_GROUP_ALBUM,
147         MEDIA_GROUP_FOLDER,
148         MEDIA_GROUP_PLAYLIST,
149         MEDIA_GROUP_TAG,
150         MEDIA_GROUP_BOOKMARK,
151         MEDIA_GROUP_TAG_BY_MEDIA_ID,
152         MEDIA_GROUP_BOOKMARK_BY_MEDIA_ID,
153         MEDIA_GROUP_FACE,
154         MEDIA_GROUP_FACE_BY_MEDIA_ID,
155 } group_list_e;
156
157 typedef struct _filter_s {
158         char *storage_id;
159         char *condition;
160         char *order_keyword;
161         media_content_order_e order_type;
162         media_content_collation_e condition_collate_type;
163         media_content_collation_e order_collate_type;
164         int offset;
165         int count;
166         bool is_full_condition;
167         bool is_full_order;
168 } filter_s;
169
170 typedef struct {
171         char *folder_id;
172         char *path;
173         char *name;
174         char *storage_uuid;
175 } media_folder_s;
176
177 typedef struct {
178         int tag_id;
179         char *name;
180         GList *item_list;
181 } media_tag_s;
182
183 typedef struct {
184         int bookmark_id;
185         char *media_id;
186         time_t marked_time;
187         char *thumbnail_path;
188         char *name;
189 } media_bookmark_s;
190
191 typedef struct {
192         int album_id;
193         char *name;
194         char *artist;
195         char *album_art_path;
196 } media_album_s;
197
198 typedef struct {
199         int playlist_id;
200         char *name;
201         char *thumbnail_path;
202         GList *item_list;
203 } media_playlist_s;
204
205 typedef struct {
206         char *media_id;
207         int width;
208         int height;
209         char *date_taken;
210         char *exposure_time;
211         double fnumber;
212         int iso;
213         char *model;
214         media_content_orientation_e orientation;
215 } image_meta_s;
216
217 typedef struct {
218         char *media_id;
219         char *album;
220         char *artist;
221         char *album_artist;
222         char *genre;
223         char *composer;
224         char *year;
225         char *recorded_date;
226         char *copyright;
227         char *track_num;
228         int bitrate;
229         int duration;
230         int width;
231         int height;
232         int rotation;
233 } video_meta_s;
234
235 typedef struct {
236         char *media_id;
237         char *album;
238         char *artist;
239         char *album_artist;
240         char *genre;
241         char *composer;
242         char *year;
243         char *recorded_date;
244         char *copyright;
245         char *track_num;
246         int bitrate;
247         int bitpersample;
248         int samplerate;
249         int channel;
250         int duration;
251 } audio_meta_s;
252
253 typedef struct {
254         char *media_id;
255         char *author;
256         char *publisher;
257         char *date;
258         char *subject;
259 } book_meta_s;
260
261 typedef struct {
262         char *media_id;
263         char *file_path;
264         char *display_name;
265         media_content_type_e media_type;
266         char *mime_type;
267         unsigned long long size;
268         time_t added_time;
269         time_t modified_time;
270         time_t timeline;
271         char *thumbnail_path;
272         char *description;
273         double longitude;
274         double latitude;
275         double altitude;
276         int rating;
277         time_t favourite;
278         char *title;
279         int is_drm;
280         int played_count;
281         time_t played_time;
282         int played_position;
283         char *storage_uuid;
284         unsigned int face_request_id;
285         int is_360;
286         int stitched_info;
287         int extract_flag;
288         image_meta_s *image_meta;
289         video_meta_s *video_meta;
290         audio_meta_s *audio_meta;
291         book_meta_s *book_meta;
292 } media_info_s;
293
294 typedef struct {
295         char *media_id;
296         int function;
297         char *tag_name;
298 } media_tag_item_s;
299
300 typedef struct {
301         char *media_id;
302         int function;
303         char *playlist_name;
304         char *thumbnail_path;
305         int playlist_member_id;
306         int play_order;
307 } media_playlist_item_s;
308
309 typedef struct {
310         int face_id;                            /* face id */
311         char *media_id;                 /* media uuid */
312         unsigned int face_rect_x;       /* x position of face */
313         unsigned int face_rect_y;       /* y position of face */
314         unsigned int face_rect_w;       /* width of face */
315         unsigned int face_rect_h;       /* height of face */
316         int orientation;                        /* orientation */
317         char *face_tag;                 /* face tag */
318 } media_face_s;
319
320 typedef struct {
321         char *media_id;
322         char *storage_id;
323         char *path;
324         unsigned long long size;
325         int duration;
326         int timezone;
327         int ptc;
328         int major;
329         int minor;
330         int channel_type;
331         char *channel_name;
332         char *channel_num;
333         char *program_title;
334         int program_num;
335         char *program_crid;
336         char *guidance;
337         char *synopsis;
338         char *genre;
339         char *language;
340         int embargo_time;
341         int expiry_time;
342         int start_time;
343         int program_start_time;
344         int program_end_time;
345         int program_date;
346         int parental_rating;
347         int timer_record;
348         int series_record;
349         int hd;
350         int subtitle;
351         int ttx;
352         int ad;
353         int hard_of_hearing_radio;
354         int data_service;
355         int content_lock;
356         int content_watch;
357         int has_audio_only;
358         int is_local_record;
359         int resolution;
360         int aspectratio;
361         char* modified_month;
362         int sports_type;
363         int guidance_length;
364         int tvmode;
365         int play_count;
366         char* private_data;
367         unsigned int service_profile;
368 } media_pvr_s;
369
370 typedef struct {
371         char *media_id;
372         char *path;
373         unsigned long long size;
374         char *content_id;
375         char *content_title;
376         char *file_name;
377         char* release_date;
378         time_t modified_time;
379         int played_position;
380         int played_count;
381 } media_uhd_s;
382
383 typedef struct {
384         media_insert_completed_cb insert_completed_cb;
385         char *insert_list_path;
386         void *user_data;
387 } media_insert_cb_s;
388
389 typedef struct {
390         media_content_db_update_cb update_noti_cb;
391         void *user_data;
392 } media_noti_cb_s;
393
394 typedef struct _media_content_cb_data {
395         media_scan_completed_cb callback;
396         void *user_data;
397 } media_content_scan_cb_data;
398
399 typedef struct _media_content_scan_cb_data_v2 {
400         media_scan_completed_cb_v2 callback;
401         void *user_data;
402 } media_content_scan_cb_data_v2;
403
404 /* DB Table */
405 #define DB_TABLE_MEDIA                  "media"
406 #define DB_TABLE_FOLDER         "folder"
407 #define DB_TABLE_ALBUM                  "album"
408 #define DB_TABLE_TAG                    "tag"
409 #define DB_TABLE_TAG_MAP                "tag_map"
410 #define DB_TABLE_PLAYLIST               "playlist"
411 #define DB_TABLE_PLAYLIST_MAP   "playlist_map"
412 #define DB_TABLE_BOOKMARK               "bookmark"
413 #define DB_TABLE_STORAGE                "storage"
414 #define DB_TABLE_FACE                   "face"
415 #define DB_TABLE_FACE_SCAN_LIST "face_scan_list"
416 #define DB_TABLE_PVR                            "pvr"
417 #define DB_TABLE_UHD                                            "uhd"
418
419 /* DB View */
420 #define DB_VIEW_PLAYLIST        "playlist_view"
421 #define DB_VIEW_TAG                     "tag_view"
422 #define DB_VIEW_MEDIA           "media_view"
423
424 /* DB field for media */
425 #define DB_FIELD_MEDIA_DISPLAY_NAME             "media_display_name"
426 #define DB_FIELD_MEDIA_TYPE                             "media_type"
427 #define DB_FIELD_MEDIA_MIME_TYPE                "media_mime_type"
428 #define DB_FIELD_MEDIA_SIZE                             "media_size"
429 #define DB_FIELD_MEDIA_ADDED_TIME               "media_added_time"
430 #define DB_FIELD_MEDIA_MODIFIED_TIME    "media_modified_time"
431 #define DB_FIELD_MEDIA_TITLE                    "media_title"
432 #define DB_FIELD_MEDIA_ALBUM                    "media_album"
433 #define DB_FIELD_MEDIA_ARTIST                   "media_artist"
434 #define DB_FIELD_MEDIA_ALBUM_ARTIST             "media_album_artist"
435 #define DB_FIELD_MEDIA_GENRE                    "media_genre"
436 #define DB_FIELD_MEDIA_COMPOSER                 "media_composer"
437 #define DB_FIELD_MEDIA_YEAR                             "media_year"
438 #define DB_FIELD_MEDIA_RECORDED_DATE    "media_recorded_date"
439 #define DB_FIELD_MEDIA_COPYRIGHT                "media_copyright"
440 #define DB_FIELD_MEDIA_TRACK_NUM                "media_track_num"
441 #define DB_FIELD_MEDIA_DESCRIPTION              "media_description"
442 #define DB_FIELD_MEDIA_RATING                   "media_rating"
443 #define DB_FIELD_MEDIA_LONGITUDE                "media_longitude"
444 #define DB_FIELD_MEDIA_LATITUDE         "media_latitude"
445 #define DB_FIELD_MEDIA_ALTITUDE         "media_altitude"
446
447 #define DB_FIELD_MEDIA_PLAYED_COUNT             "played_count"
448 #define DB_FIELD_MEDIA_LAST_PLAYED_TIME         "last_played_time"
449 #define DB_FIELD_MEDIA_LAST_PLAYED_POSITION     "last_played_position"
450 #define DB_FIELD_MEDIA_MODIFIED_DATE    "modified_date"
451 #define DB_FIELD_MEDIA_STITCHED_INFO                            "stitched_info"
452
453 /* DB field for PVR*/
454 #define DB_FIELD_PVR_DURATION                                   "duration"
455 #define DB_FIELD_PVR_TIME_ZONE                                  "timezone"
456 #define DB_FIELD_PVR_PTC                                                "ptc"
457 #define DB_FIELD_PVR_MAJOR                                              "major"
458 #define DB_FIELD_PVR_MINOR                                              "minor"
459 #define DB_FIELD_PVR_CHANNEL_TYPE                               "channel_type"
460 #define DB_FIELD_PVR_CHANNEL_NAME                       "channel_name"
461 #define DB_FIELD_PVR_CHANNEL_NUM                        "channel_num"
462 #define DB_FIELD_PVR_PROGRAM_TITLE                      "program_title"
463 #define DB_FIELD_PVR_PROGRAM_NUM                        "program_num"
464 #define DB_FIELD_PVR_PROGRAM_CRID                               "program_crid"
465 #define DB_FIELD_PVR_GUIDANCE                                   "guidance"
466 #define DB_FIELD_PVR_SYNOPSIS                                   "synopsis"
467 #define DB_FIELD_PVR_GENRE                                              "genre"
468 #define DB_FIELD_PVR_LANGUAGE                                   "language"
469 #define DB_FIELD_PVR_EMBARGO_TIME                               "embargo_time"
470 #define DB_FIELD_PVR_EXPIRY_TIME                                "expiry_time"
471 #define DB_FIELD_PVR_START_TIME                         "start_time"
472 #define DB_FIELD_PVR_PROGRAM_START_TIME         "program_start_time"
473 #define DB_FIELD_PVR_PROGRAM_END_TIME           "program_end_time"
474 #define DB_FIELD_PVR_PROGRAM_DATE                       "program_date"
475 #define DB_FIELD_PVR_PARENTAL_RATING                    "parental_rating"
476 #define DB_FIELD_PVR_TIMER_RECORD                               "timer_record"
477 #define DB_FIELD_PVR_SERIES_RECORD                              "series_record"
478 #define DB_FIELD_PVR_HD                                                 "hd"
479 #define DB_FIELD_PVR_SUBTITLE                                   "subtitle"
480 #define DB_FIELD_PVR_TTX                                                "ttx"
481 #define DB_FIELD_PVR_AD                                                 "ad"
482 #define DB_FIELD_PVR_HARDOF_HEARINGRADIO        "hard_of_hearing_radio"
483 #define DB_FIELD_PVR_DATA_SERVICE                               "data_service"
484 #define DB_FIELD_PVR_CONTENT_LOCK                               "content_lock"
485 #define DB_FIELD_PVR_CONTENT_WATCH                      "content_watch"
486 #define DB_FIELD_PVR_HAS_AUDIO_ONLY                     "has_audio_only"
487 #define DB_FIELD_PVR_IS_LOCAL_RECORD                    "is_local_record"
488 #define DB_FIELD_PVR_RESOLUTION                         "resolution"
489 #define DB_FIELD_PVR_ASPECTRATIO                                "aspectratio"
490 #define DB_FIELD_PVR_MODIFIED_MONTH                     "modified_month"
491 #define DB_FIELD_PVR_MODIFIED_DATE                      "modified_date"
492 #define DB_FIELD_PVR_SPORTS_TYPE                                "sports_type"
493 #define DB_FIELD_PVR_GUIDANCE_LENGTH                    "guidance_length"
494 #define DB_FIELD_PVR_TVMODE                                             "tvmode"
495 #define DB_FIELD_PVR_PLAY_COUNT                                 "play_count"
496 #define DB_FIELD_PVR_PRIVATE_DATA               "private_data"
497
498 /* DB fiedl for UHD */
499 #define DB_FIELD_UHD_CONTENT_TITLE              "content_title"
500 #define DB_FIELD_UHD_RELEASE_DATE                       "release_date"
501 #define DB_FIELD_UHD_FILE_NAME                  "file_name"
502 #define DB_FIELD_UHD_PLAYED_COUNT                       "played_count"
503
504 /* DB TABLE JOIN */
505 #define FOLDER_MEDIA_JOIN               DB_TABLE_FOLDER" NATURAL LEFT OUTER JOIN '%s' WHERE validity=1 "
506 #define BOOKMARK_MEDIA_JOIN             DB_TABLE_BOOKMARK" NATURAL JOIN '%s' WHERE validity=1 "
507 #define ALBUM_MEDIA_JOIN                DB_TABLE_ALBUM" NATURAL JOIN '%s' WHERE validity=1 "
508 #define FACE_MEDIA_JOIN                 DB_TABLE_FACE" NATURAL JOIN '%s' WHERE validity=1 "
509
510 /* Get Group info */
511 #define SELECT_MEDIA_GROUP_AND_COUNT            "SELECT %s, COUNT(*) FROM '%s' WHERE validity=1 "
512
513 /* Get Group List */
514 #define SELECT_ALBUM_LIST                       "SELECT DISTINCT album_id, name, artist, album_art FROM "ALBUM_MEDIA_JOIN
515 #define SELECT_MEDIA_GROUP_LIST "SELECT DISTINCT %s FROM '%s' WHERE validity=1 "
516
517 #define SELECT_FOLDER_LIST                      "SELECT DISTINCT folder_id, folder_path, folder_name, storage_uuid FROM "FOLDER_MEDIA_JOIN
518 #define SELECT_FOLDER_LIST_BY_STORAGE_ID        SELECT_FOLDER_LIST"AND storage_uuid='%s' "
519 #define SELECT_TAG_LIST                         "SELECT DISTINCT tag_id, tag_name FROM "DB_VIEW_TAG" WHERE 1 "
520 #define SELECT_PLAYLIST_LIST                    "SELECT DISTINCT playlist_id, playlist_name, p_thumbnail_path FROM "DB_VIEW_PLAYLIST" WHERE 1 "
521
522 /* Get Group Count */
523 #define SELECT_ALBUM_COUNT              "SELECT COUNT(DISTINCT album_id) FROM "ALBUM_MEDIA_JOIN
524 #define SELECT_FOLDER_COUNT             "SELECT COUNT(DISTINCT folder_id) FROM "FOLDER_MEDIA_JOIN
525 #define SELECT_FOLDER_COUNT_BY_STORAGE_ID               SELECT_FOLDER_COUNT"AND storage_uuid='%s' "
526 #define SELECT_TAG_COUNT                        "SELECT COUNT(DISTINCT tag_id) FROM "DB_VIEW_TAG" WHERE 1 "
527 #define SELECT_PLAYLIST_COUNT           "SELECT COUNT(DISTINCT playlist_id) FROM "DB_VIEW_PLAYLIST" WHERE 1 "
528 #define SELECT_BOOKMARK_COUNT   "SELECT COUNT(*) FROM "BOOKMARK_MEDIA_JOIN
529 #define SELECT_MEDIA_GROUP_COUNT        "SELECT COUNT(*) FROM ("SELECT_MEDIA_GROUP_LIST
530 /*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)*/
531
532 /* Get Media Count of Group */
533 #define SELECT_MEDIA_COUNT_FROM_MEDIA                   "SELECT COUNT(*) FROM (SELECT media_id FROM '%s' WHERE validity=1 "             /*to apply limit condition. "SELECT COUNT(*) FROM "DB_TABLE_MEDIA" WHERE validity=1" */
534 #define SELECT_MEDIA_COUNT_FROM_MEDIA_SIMPLE    "SELECT COUNT(*) FROM '%s' WHERE validity=1 "
535 #define SELECT_MEDIA_COUNT_FROM_ALBUM                   "SELECT COUNT(*) FROM '%s' WHERE validity=1 AND album_id='%d'"
536 #define SELECT_MEDIA_COUNT_FROM_GROUP                   "SELECT COUNT(*) FROM ("SELECT_MEDIA_FROM_GROUP         /*to apply limit condition. */
537 #define SELECT_MEDIA_COUNT_FROM_GROUP_NULL              "SELECT COUNT(*) FROM ("SELECT_MEDIA_FROM_GROUP_NULL    /* to apply limit condition. */
538 #define SELECT_MEDIA_COUNT_FROM_FOLDER                  "SELECT COUNT(*) FROM '%s' WHERE validity=1 AND folder_id='%s'"
539 #define SELECT_MEDIA_COUNT_FROM_STORAGE                 "SELECT COUNT(*) FROM '%s' WHERE validity=1 AND storage_uuid='%s'"
540 #define SELECT_MEDIA_COUNT_FROM_TAG                             "SELECT COUNT(*) FROM "DB_VIEW_TAG" WHERE (tag_id=%d AND tag_media_count>0) "
541 #define SELECT_MEDIA_COUNT_FROM_PLAYLIST                        "SELECT COUNT(*) FROM "DB_VIEW_PLAYLIST" WHERE (playlist_id=%d and playlist_media_count>0) "
542
543 /* Get Group Info by Group ID*/
544 #define SELECT_ALBUM_FROM_ALBUM         "SELECT name, artist, album_art FROM "DB_TABLE_ALBUM" WHERE album_id=%d"
545 #define SELECT_FOLDER_FROM_FOLDER               "SELECT folder_path, folder_name, storage_uuid FROM "DB_TABLE_FOLDER" WHERE folder_id='%s'"
546 #define SELECT_PLAYLIST_FROM_PLAYLIST   "SELECT playlist_name, thumbnail_path FROM "DB_TABLE_PLAYLIST" WHERE playlist_id=%d"
547 #define SELECT_TAG_FROM_TAG                     "SELECT tag_name FROM "DB_TABLE_TAG" WHERE tag_id=%d"
548 #define SELECT_TAG_BY_NAME                              "SELECT tag_id FROM "DB_TABLE_TAG" WHERE tag_name='%q'"
549
550 /* Tag info*/
551 #define INSERT_TAG_TO_TAG                                               "INSERT INTO "DB_TABLE_TAG" (tag_name) VALUES (%Q)"
552 #define REMOVE_TAG_ITEM_FROM_TAG_MAP            "DELETE FROM "DB_TABLE_TAG_MAP" WHERE tag_id=%d AND media_id='%q';"
553 #define UPDATE_TAG_NAME_FROM_TAG                        "UPDATE "DB_TABLE_TAG" SET tag_name='%q' WHERE tag_id=%d;"
554 #define SELECT_TAG_COUNT_BY_MEDIA_ID                    "SELECT COUNT(*) FROM "DB_VIEW_TAG" WHERE media_id = '%s'"
555 #define SELECT_TAG_LIST_BY_MEDIA_ID                             "SELECT tag_id, tag_name FROM "DB_VIEW_TAG" WHERE media_id = '%s' "
556
557 /* Get Media list of Group */
558 #define MEDIA_INFO_ITEM "media_id, media_path, media_display_name, media_type, media_mime_type, media_size, media_added_time, media_modified_time, media_thumbnail_path, media_description, \
559                                                         media_rating, media_favourite, media_is_drm, media_longitude, media_latitude, media_altitude, exposure_time, fnumber, iso, \
560                                                         model, media_width, media_height, media_datetaken, orientation, media_title, media_album, media_artist, media_album_artist, media_genre, \
561                                                         media_composer, media_year, media_recorded_date, media_copyright, media_track_num, media_bitrate, media_bitpersample, media_duration, media_samplerate, media_channel, \
562                                                         media_timeline, storage_uuid, media_360, played_count, last_played_time, last_played_position, stitched_info, extract_flag, modified_date"
563
564 /* Playlist Info */
565 #define INSERT_PLAYLIST_TO_PLAYLIST                                             "INSERT INTO "DB_TABLE_PLAYLIST" (playlist_name) VALUES (%Q)"
566 #define UPDATE_PLAYLIST_NAME_FROM_PLAYLIST                      "UPDATE "DB_TABLE_PLAYLIST" SET playlist_name='%q' WHERE playlist_id=%d;"
567 #define UPDATE_PLAYLIST_THUMBNAIL_FROM_PLAYLIST         "UPDATE "DB_TABLE_PLAYLIST" SET thumbnail_path='%q' WHERE playlist_id=%d;"
568 #define SELECT_PLAYLIST_ID_FROM_PLAYLIST                                "SELECT playlist_id FROM "DB_TABLE_PLAYLIST" WHERE playlist_name='%q'"
569 #define SELECT_PLAYLIST_ITEM_ALL_FROM_PLAYLIST_VIEW     "SELECT "MEDIA_INFO_ITEM", pm_id FROM "DB_VIEW_PLAYLIST" WHERE (playlist_id=%d and playlist_media_count>0) "
570 #define SELECT_PLAY_ORDER_FROM_PLAYLIST_VIEW                    "SELECT playlist_member_order FROM "DB_VIEW_PLAYLIST" WHERE playlist_id=%d and pm_id=%d"
571 #define SELECT_MAX_PLAY_ORDER_FROM_PLAYLIST_VIEW        "SELECT MAX(playlist_member_order) FROM "DB_VIEW_PLAYLIST" WHERE playlist_id=%d"
572 #define REMOVE_PLAYLIST_ITEM_FROM_PLAYLIST_MAP          "DELETE FROM "DB_TABLE_PLAYLIST_MAP" WHERE playlist_id=%d AND _id=%d;"
573 #define UPDATE_PLAYLIST_ORDER_FROM_PLAYLIST_MAP         "UPDATE "DB_TABLE_PLAYLIST_MAP" SET playlist_member_order=%d WHERE playlist_id=%d AND _id=%d;"
574 #define INSERT_PLAYLIST_ITEM_TO_PLAYLIST_MAP            "INSERT INTO "DB_TABLE_PLAYLIST_MAP" (playlist_id, media_id, playlist_member_order) VALUES (%d, '%q', %d);"
575
576 /* Bookmark */
577 #define INSERT_BOOKMARK_TO_BOOKMARK                     "INSERT INTO "DB_TABLE_BOOKMARK" (media_id, bookmark_marked_time, bookmark_thumbnail_path, bookmark_name) VALUES ('%q', '%d', %Q, %Q)"
578 #define SELECT_BOOKMARK_COUNT_BY_MEDIA_ID               "SELECT COUNT(*) FROM "BOOKMARK_MEDIA_JOIN" AND media_id='%s'"
579 #define SELECT_BOOKMARK_LIST                                            "SELECT bookmark_id, media_id, bookmark_marked_time, bookmark_thumbnail_path, bookmark_name FROM "BOOKMARK_MEDIA_JOIN
580 #define SELECT_BOOKMARK_LIST_BY_MEDIA_ID                        "SELECT bookmark_id, media_id, bookmark_marked_time, bookmark_thumbnail_path, bookmark_name FROM "BOOKMARK_MEDIA_JOIN" AND media_id='%s'"
581 #define SELECT_BOOKMARK_ID_FROM_BOOKMARK               "SELECT bookmark_id FROM "DB_TABLE_BOOKMARK" WHERE media_id='%s' AND bookmark_marked_time=%d"
582
583 #define UPDATE_BOOKMARK_FROM_BOOKMARK           "UPDATE "DB_TABLE_BOOKMARK" SET bookmark_name=%Q WHERE bookmark_id=%d;"
584
585 #define SELECT_MEDIA_ITEM                                       "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1"
586 #define SELECT_MEDIA_FROM_MEDIA                 "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1 AND media_id='%s'"
587 #define SELECT_MEDIA_BY_PATH                            "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1 AND media_path='%q'"
588 #define SELECT_MEDIA_FROM_ALBUM                 "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1 AND album_id=%d"
589 #define SELECT_MEDIA_FROM_GROUP                 "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1 AND %s='%q'"
590 #define SELECT_MEDIA_FROM_GROUP_NULL    "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1 AND %s IS NULL"
591 #define SELECT_MEDIA_FROM_FOLDER                        "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1 AND folder_id='%s'"
592 #define SELECT_MEDIA_FROM_STORAGE               "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1 AND storage_uuid='%s'"
593 #define SELECT_MEDIA_FROM_TAG                           "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE media_id IN (SELECT media_id FROM "DB_TABLE_TAG_MAP" WHERE tag_id=%d) AND validity=1"
594 #define SELECT_MEDIA_FROM_PLAYLIST              "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE media_id IN (SELECT media_id FROM "DB_TABLE_PLAYLIST_MAP" WHERE playlist_id=%d) AND validity=1"
595 #define SELECT_MEDIA_PATH_BY_ID                 "SELECT media_path FROM "DB_VIEW_MEDIA" WHERE media_id='%q'"
596 #define SELECT_MEDIA_STORAGE_ID_BY_ID           "SELECT storage_uuid FROM "DB_VIEW_MEDIA" WHERE media_id='%q'"
597
598 /* Delete */
599 #define DELETE_PLAYLIST_FROM_PLAYLIST           "DELETE FROM "DB_TABLE_PLAYLIST" WHERE playlist_id=%d"
600 #define DELETE_TAG_FROM_TAG                             "DELETE FROM "DB_TABLE_TAG" WHERE tag_id=%d"
601 #define DELETE_BOOKMARK_FROM_BOOKMARK   "DELETE FROM "DB_TABLE_BOOKMARK" WHERE bookmark_id=%d"
602
603 /* Storage*/
604 #define SELECT_STORAGE_COUNT                            "SELECT COUNT(*) FROM "DB_TABLE_STORAGE" WHERE validity=1"
605 #define SELECT_STORAGE_LIST                                     "SELECT storage_id, storage_path FROM "DB_TABLE_STORAGE" WHERE validity=1"
606 #define SELECT_STORAGE_INFO_FROM_STORAGE        "SELECT storage_path FROM "DB_TABLE_STORAGE" WHERE validity=1 AND storage_id='%s'"
607
608 /* Face */
609 #define DELETE_FACE_FROM_FACE                   "DELETE FROM "DB_TABLE_FACE" WHERE media_face_id=%d"
610 #define INSERT_FACE_TO_FACE                             "INSERT INTO "DB_TABLE_FACE" (media_id, face_rect_x , face_rect_y, face_rect_w, face_rect_h, face_orientation, media_face_tag) VALUES ('%q', %d, %d, %d, %d, %d, %Q);"
611 #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, face_orientation=%d, media_face_tag=%Q WHERE media_face_id=%d"
612 #define SELECT_MEDIA_COUNT_FROM_MEDIA_BY_ID             "SELECT COUNT(*) FROM "DB_VIEW_MEDIA" WHERE media_id='%q' AND validity=1"
613 #define SELECT_IMAGE_COUNT_FROM_MEDIA_BY_ID             "SELECT COUNT(*) FROM "DB_VIEW_MEDIA" WHERE media_id='%q' AND media_type=0 AND validity=1"
614 #define SELECT_FACE_COUNT                                       "SELECT COUNT(*) FROM "FACE_MEDIA_JOIN
615 #define SELECT_FACE_COUNT_BY_MEDIA_ID           "SELECT COUNT(*) FROM "FACE_MEDIA_JOIN" AND media_id='%s'"
616 #define SELECT_FACE_LIST                                        "SELECT media_face_id, media_id, face_rect_x, face_rect_y, face_rect_w, face_rect_h, face_orientation, media_face_tag FROM "FACE_MEDIA_JOIN
617 #define SELECT_FACE_LIST_BY_MEDIA_ID            "SELECT media_face_id, media_id, face_rect_x, face_rect_y, face_rect_w, face_rect_h, face_orientation, media_face_tag FROM "FACE_MEDIA_JOIN" AND media_id='%s'"
618 #define UPDATE_MEDIA_INFO_IN_FACE_SCAN_LIST     "UPDATE "DB_TABLE_FACE_SCAN_LIST" SET modified_time = 0 WHERE media_id IN (SELECT media_id FROM "DB_TABLE_FACE" WHERE media_face_id=%d)"
619 #define SELECT_FACE_ID                  "SELECT media_face_id FROM "DB_TABLE_FACE" WHERE media_id='%q' AND face_rect_x=%d AND face_rect_y=%d AND face_rect_w=%d AND face_rect_h=%d AND face_orientation=%d"
620
621 #define SELECT_VALID_STORAGE_FROM_PVR   "WHERE storage_uuid IN (SELECT storage_id FROM "DB_TABLE_STORAGE" WHERE validity=1)"
622 #define SELECT_PVR_LIST                                 "SELECT * FROM "DB_TABLE_PVR" "SELECT_VALID_STORAGE_FROM_PVR
623 #define SELECT_PVR_LIST_BY_STORAGE_ID           SELECT_PVR_LIST" AND storage_uuid='%s'"
624 #define SELECT_PVR_FROM_PVR                             "SELECT * FROM "DB_TABLE_PVR" WHERE media_id='%q'"
625 #define UPDATE_PVR_META_FROM_PVR                "UPDATE "DB_TABLE_PVR" SET program_title=%Q, content_lock=%d, content_watch=%d, play_count=%d WHERE media_id='%q'"
626
627 #define SELECT_PVR_GROUP_LIST                                           "SELECT DISTINCT %s FROM "DB_TABLE_PVR" "SELECT_VALID_STORAGE_FROM_PVR
628 #define SELECT_PVR_GROUP_LIST_BY_STORAGE_ID             "SELECT DISTINCT %s FROM "DB_TABLE_PVR" WHERE storage_uuid='%s'"
629 #define SELECT_PVR_GROUP_COUNT                                  "SELECT COUNT(*) FROM ("SELECT_PVR_GROUP_LIST
630 #define SELECT_PVR_GROUP_COUNT_BY_STORAGE_ID    "SELECT COUNT(*) FROM ("SELECT_PVR_GROUP_LIST_BY_STORAGE_ID
631 #define SELECT_PVR_FROM_GROUP                                           "SELECT * FROM "DB_TABLE_PVR" "SELECT_VALID_STORAGE_FROM_PVR" AND %s='%q'"
632 #define SELECT_PVR_FROM_GROUP_BY_STORAGE_ID             "SELECT * FROM "DB_TABLE_PVR" WHERE storage_uuid='%s' AND %s='%q'"
633 #define SELECT_PVR_COUNT_FROM_GROUP                             "SELECT COUNT(*) FROM ("SELECT_PVR_FROM_GROUP
634 #define SELECT_PVR_COUNT_FROM_GROUP_BY_STORAGE_ID       "SELECT COUNT(*) FROM ("SELECT_PVR_FROM_GROUP_BY_STORAGE_ID
635 #define SELECT_PVR_FROM_GROUP_NULL                                      "SELECT * FROM "DB_TABLE_PVR" "SELECT_VALID_STORAGE_FROM_PVR" AND %s IS NULL"
636 #define SELECT_PVR_FROM_GROUP_NULL_BY_STORAGE_ID        "SELECT * FROM "DB_TABLE_PVR" WHERE storage_uuid='%s' AND %s IS NULL"
637 #define SELECT_PVR_COUNT_FROM_GROUP_NULL                        "SELECT COUNT(*) FROM ("SELECT_PVR_FROM_GROUP_NULL
638 #define SELECT_PVR_COUNT_FROM_GROUP_NULL_BY_STORAGE_ID  "SELECT COUNT(*) FROM ("SELECT_PVR_FROM_GROUP_NULL_BY_STORAGE_ID
639 #define SELECT_PVR_GROUP_AND_COUNT_BY_STORAGE_ID                "SELECT %s, COUNT(*) FROM "DB_TABLE_PVR" WHERE storage_uuid='%s'"
640 #define SELECT_PVR_GROUP_AND_COUNT                                              "SELECT %s, COUNT(*) FROM "DB_TABLE_PVR" "SELECT_VALID_STORAGE_FROM_PVR
641
642 #define SELECT_VALID_STORAGE_FROM_UHD   "WHERE storage_uuid IN (SELECT storage_id FROM "DB_TABLE_STORAGE" WHERE validity=1)"
643 #define SELECT_UHD_GROUP_LIST                                           "SELECT DISTINCT %s FROM "DB_TABLE_UHD" "SELECT_VALID_STORAGE_FROM_UHD
644 #define SELECT_UHD_GROUP_LIST_BY_STORAGE_ID             "SELECT DISTINCT %s FROM "DB_TABLE_UHD" WHERE storage_uuid='%s'"
645 #define SELECT_UHD_GROUP_COUNT                                  "SELECT COUNT(*) FROM ("SELECT_UHD_GROUP_LIST
646 #define SELECT_UHD_GROUP_COUNT_BY_STORAGE_ID    "SELECT COUNT(*) FROM ("SELECT_UHD_GROUP_LIST_BY_STORAGE_ID
647 #define SELECT_UHD_FROM_GROUP                                           "SELECT * FROM "DB_TABLE_UHD" "SELECT_VALID_STORAGE_FROM_UHD" AND %s='%q'"
648 #define SELECT_UHD_FROM_GROUP_BY_STORAGE_ID             "SELECT * FROM "DB_TABLE_UHD" WHERE storage_uuid='%s' AND %s='%q'"
649 #define SELECT_UHD_COUNT_FROM_GROUP                             "SELECT COUNT(*) FROM ("SELECT_UHD_FROM_GROUP
650 #define SELECT_UHD_COUNT_FROM_GROUP_BY_STORAGE_ID       "SELECT COUNT(*) FROM ("SELECT_UHD_FROM_GROUP_BY_STORAGE_ID
651 #define SELECT_UHD_FROM_GROUP_NULL                                      "SELECT * FROM "DB_TABLE_UHD" "SELECT_VALID_STORAGE_FROM_UHD" AND %s IS NULL"
652 #define SELECT_UHD_FROM_GROUP_NULL_BY_STORAGE_ID        "SELECT * FROM "DB_TABLE_UHD" WHERE storage_uuid='%s' AND %s IS NULL"
653 #define SELECT_UHD_COUNT_FROM_GROUP_NULL                        "SELECT COUNT(*) FROM ("SELECT_UHD_FROM_GROUP_NULL
654 #define SELECT_UHD_COUNT_FROM_GROUP_NULL_BY_STORAGE_ID  "SELECT COUNT(*) FROM ("SELECT_UHD_FROM_GROUP_NULL_BY_STORAGE_ID
655 #define SELECT_UHD_GROUP_AND_COUNT_BY_STORAGE_ID                "SELECT %s, COUNT(*) FROM "DB_TABLE_UHD" WHERE storage_uuid='%s'"
656 #define SELECT_UHD_GROUP_AND_COUNT                                              "SELECT %s, COUNT(*) FROM "DB_TABLE_UHD" "SELECT_VALID_STORAGE_FROM_UHD
657
658 #define SELECT_UHD_LIST                                 "SELECT * FROM "DB_TABLE_UHD" "SELECT_VALID_STORAGE_FROM_UHD
659 #define SELECT_UHD_LIST_BY_STORAGE_ID   SELECT_UHD_LIST" AND storage_uuid='%s'"
660 #define SELECT_UHD_FROM_UHD                             "SELECT * FROM "DB_TABLE_UHD" WHERE media_id='%q'"
661 #define UPDATE_UHD_META_FROM_UHD                "UPDATE "DB_TABLE_UHD" SET content_title=%Q, played_position=%d, played_count=%d WHERE media_id='%q'"
662
663 int _content_query_prepare(const char *select_query, const char *condition_query, const char *option_query, sqlite3_stmt **stmt);
664 int _content_get_result(char *query, sqlite3_stmt **stmt);
665 int _content_error_capi(int internal_error);
666 int _content_query_sql(char *query_str);
667 sqlite3 * _content_get_db_handle(void);
668 uid_t _content_get_uid(void);
669 int _media_info_get_media_info_from_db(const char *path, const char *storage_id, media_info_h media);
670 void _media_info_item_get_detail(sqlite3_stmt *stmt, media_info_h media);
671 int _media_db_get_group_count(filter_h filter, group_list_e group_type, int *group_count);
672 int _media_db_get_media_group_count(media_group_e group, filter_h filter, int *group_count);
673 int _media_db_get_media_group(media_group_e group, filter_h filter, media_group_cb callback, void *user_data);
674 int _media_db_get_media_group_and_count(media_group_e group, filter_h filter, media_group_and_count_cb callback, void *user_data);
675 int _media_db_get_album(filter_h filter, media_album_cb callback, void *user_data);
676 int _media_db_get_folder(filter_h filter, media_folder_cb callback, void *user_data);
677 int _media_db_get_playlist(filter_h filter, media_playlist_cb callback, void *user_data);
678 int _media_db_get_playlist_item(int playlist_id, filter_h filter, playlist_member_cb callback, void *user_data);
679 int _media_db_get_tag(const char *media_id, filter_h filter, media_tag_cb callback, void *user_data);
680 int _media_db_get_bookmark(const char *media_id, filter_h filter, media_bookmark_cb callback, void *user_data);
681 int _media_db_get_face(const char *media_id, filter_h filter, media_face_cb callback, void *user_data);
682 int _media_db_get_group_item_count_by_id(int group_id, filter_h filter, group_list_e group_type, int *item_count);
683 int _media_db_get_group_item_count(const char *group_name, filter_h filter, group_list_e group_type, int *item_count);
684 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);
685 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);
686 int _media_db_get_media_group_item_count(const char *group_name, filter_h filter, media_group_e group, int *item_count);
687 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);
688 int _media_db_get_storage_id_by_media_id(const char *media_id, char **storage_id);
689 int _media_db_get_pvr(filter_h filter, media_pvr_cb callback, void *user_data);
690 void _media_pvr_item_get_detail(sqlite3_stmt* stmt, media_pvr_h pvr);
691 int _media_db_get_uhd(filter_h filter, media_uhd_cb callback, void *user_data);
692 void _media_uhd_item_get_detail(sqlite3_stmt* stmt, media_uhd_h uhd);
693 int _media_db_get_storage(filter_h filter, media_storage_cb callback, void *user_data);
694 int _media_filter_build_condition(bool is_full, const char *condition, media_content_collation_e collate_type, char **result);
695 int _media_filter_build_option(filter_h filter, char **result);
696
697 GMutex* _content_get_db_mutex(void);
698
699
700 #define FONT_COLOR_RESET    "\033[0m"
701 #define FONT_COLOR_RED      "\033[31m"
702 #define FONT_COLOR_GREEN    "\033[32m"
703 #define FONT_COLOR_YELLOW   "\033[33m"
704 #define FONT_COLOR_BLUE     "\033[34m"
705 #define FONT_COLOR_PURPLE   "\033[35m"
706 #define FONT_COLOR_CYAN     "\033[36m"
707 #define FONT_COLOR_GRAY     "\033[37m"
708
709 #define media_content_gettid() syscall(__NR_gettid)
710
711 #define content_retv_if(expr, val) do { \
712                         if (expr) { \
713                                 LOGE(FONT_COLOR_RED"[%ld]"FONT_COLOR_RESET, media_content_gettid());    \
714                                 return (val); \
715                         } \
716                 } while (0)
717
718 #define content_retvm_if(expr, val, fmt, arg...) do { \
719                         if (expr) { \
720                                 LOGE(FONT_COLOR_RED"[%ld]"fmt""FONT_COLOR_RESET, media_content_gettid(), ##arg);     \
721                                 return (val); \
722                         } \
723                 } while (0)
724
725 #define content_retip_if_fail(expr) do { \
726                         if (!(expr)) { \
727                                 LOGE(FONT_COLOR_RED"[%ld] Invalid [%s]"FONT_COLOR_RESET, media_content_gettid(), #expr); \
728                                 return MEDIA_CONTENT_ERROR_INVALID_PARAMETER; \
729                         } \
730                 } while (0)
731
732 #define content_retipm_if_fail(expr, fmt, arg...) do { \
733                         if (!(expr)) { \
734                                 LOGE(FONT_COLOR_RED"[%ld] Cond[%s] value["fmt"]"FONT_COLOR_RESET, media_content_gettid(), #expr, ##arg); \
735                                 return MEDIA_CONTENT_ERROR_INVALID_PARAMETER; \
736                         } \
737                 } while (0)
738
739 #define content_warn(fmt, arg...) do { \
740                         LOGW(FONT_COLOR_GREEN"[%ld]"fmt""FONT_COLOR_RESET, media_content_gettid(), ##arg);     \
741                 } while (0)
742
743 #define content_debug(fmt, arg...) do { \
744                         LOGD(FONT_COLOR_RESET"[%ld]"fmt"", media_content_gettid(), ##arg);     \
745                 } while (0)
746
747 #define content_info(fmt, arg...) do { \
748                         LOGI(FONT_COLOR_GREEN"[%ld]"fmt""FONT_COLOR_RESET, media_content_gettid(), ##arg);     \
749                 } while (0)
750
751 #define content_error(fmt, arg...) do { \
752                         LOGE(FONT_COLOR_RED"[%ld]"fmt""FONT_COLOR_RESET, media_content_gettid(), ##arg);     \
753                 } while (0)
754
755 #define content_sec_debug(fmt, arg...) do { \
756                         SECURE_LOGD(FONT_COLOR_CYAN"[%ld]"fmt""FONT_COLOR_RESET, media_content_gettid(), ##arg);     \
757                 } while (0)
758
759 #define content_sec_error(fmt, arg...) do { \
760                         SECURE_LOGE(FONT_COLOR_RED"[%ld]"fmt""FONT_COLOR_RESET, media_content_gettid(), ##arg);     \
761                 } while (0)
762
763 #define ERR_BUF_LENGTH 256
764 #define content_stderror(fmt) do { \
765                         char media_content_stderror_buf[ERR_BUF_LENGTH] = {0, }; \
766                         strerror_r(errno, media_content_stderror_buf, ERR_BUF_LENGTH);  \
767                         LOGE(FONT_COLOR_RED fmt" : STANDARD ERROR [%s]"FONT_COLOR_RESET, media_content_stderror_buf); \
768                 } while (0)
769
770 #ifdef __cplusplus
771 }
772 #endif /* __cplusplus */
773 #endif /*__TIZEN_CONTENT_MEDIA_INFO_PRIVATE_H__*/