Update to the latest
[platform/core/multimedia/libmedia-service.git] / include / visual-svc.h
1 /*
2  * libmedia-service
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Hyunjun Ko <zzoon.ko@samsung.com>, Haejeong Kim <backto.kim@samsung.com>
7  *
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
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
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.
19  *
20  */
21         
22 #ifndef _VISUAL_SVC_H_
23 #define _VISUAL_SVC_H_
24
25 /** 
26  * This file defines minfo apis for media service..
27  *
28  * @file        visual-svc.h
29  * @author      Hyunjun Ko <zzoon.ko@samsung.com>
30  * @version     1.0
31  * @brief       This file defines apis for visual media service.
32  */
33
34 #include "media-svc-types.h"
35 #include "visual-svc-types.h"
36 #include "visual-svc-error.h"
37
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif /* __cplusplus */
42
43 /**
44         @mainpage VISUAL_SVC
45
46         @par
47         This document provides necessary visual media information for developers who are
48         going to implement gallery application and ug-imageviewer or other
49         3rd party applications.
50  */
51
52 /**
53  *  @ingroup MEDIA_SVC
54         @defgroup VISUAL_SVC_API        Media Service
55         @{
56
57         @par
58         Call Directly.
59  */
60
61
62 /**
63  * minfo_get_item_list
64  * This function gets mitem list, which include all or portion of a cluster or folder specified by 
65  * @p cluster_id. @p filter could specify some filter conditions, like, type of got items, sort by type,
66  * start and end positions of items, including meta data or not, whether just get the favorites, etc.
67  * Menawhile data of each mitem instance mainly derive from media table record. However meta data
68  * is composed of video_meta or image_meta record.
69  *
70  * @param       mb_svc_handle   [in]    the handle of DB
71  * @param       cluster_id              [in]    the folder id in which media files are in. if the parameter is NULL, then query all folders.
72  * @param       filter                  [in]    the filter to specify some filter conditions, like, type of got items, sort by type, start and end positions of items, including meta data or not, whether just get the favorites, etc.
73  * @param       func                    [in]  Iterative callback implemented by a user. This callback is called when an item has to be inserted to user's list.
74  * @param       user_data               [out]   user's data structure to contain items of the type Mitem. It is passed to the iterative callback.
75  
76  * @return      This function returns 0 on success, or negative value with error code.
77  * @remarks     type of data memeber of list is pointer to the structure type 'Mitem'
78  *                      when free list, it need free every item first and then free list itself. 
79  * @see         None.
80  * @pre         None
81  * @post        None
82  * @par example
83  * @code
84  
85     #include <media-svc.h>
86      
87         int mitem_ite_cb(Mitem *item, void *user_data)
88         {
89                 GList** list = (GList**)user_data;
90                 //append an item to linked list.
91                 *list = g_list_append(*list, item);
92         }
93
94         void test_minfo_get_item_list(MediaSvcHandle *mb_svc_handle)
95         {
96                 int ret = -1;
97                 int img_cnt = 0;
98                 GList *p_list = NULL;
99                 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
100
101                 minfo_item_filter item_filter = {MINFO_ITEM_VIDEO,MINFO_MEDIA_SORT_BY_DATE_ASC,3,10,true,true};
102                 //get a set of items
103                 ret = minfo_get_item_list(mb_svc_handle, cluster_id, item_filter, mitem_ite_cb, &p_list);
104
105                 if(ret< 0) { 
106                         printf("minfo_get_item_list error\n");
107                         return;
108                 }
109         }
110  * @endcode  
111
112  */
113
114 int
115 minfo_get_item_list(MediaSvcHandle *mb_svc_handle, const char *cluster_id, const minfo_item_filter filter, minfo_item_ite_cb func, void *user_data);
116
117 /**
118  * minfo_get_all_item_list
119  * This function gets mitem list, which include all or portion of a or many clusters or folders specified by 
120  * @p cluster_type. @p filter could specify some filter conditions, like, type of got items, sort by type,
121  * start and end positions of items, including meta data or not, whether just get the favorites, etc.
122  * Meanwhile data of each mitem instance mainly derive from media table record. However meta data
123  * is composed of video_meta or image_meta record.
124  *
125  * @param       mb_svc_handle   [in]    the handle of DB
126  * @param       cluster_type    [in]    the folder type which specify media files belong to.
127  * @param       filter                  [in]    the filter to specify some filter conditions, like, type of got items, sort by type, start and end positions of items, including meta data or not, whether just get the favorites, etc.
128  * @param       func                    [in]  Iterative callback implemented by a user. This callback is called when an item has to be inserted to user's list.
129  * @param       user_data               [out]   user's data structure to contain items of the type Mitem. It is passed to the iterative callback.
130  
131  * @return      This function returns 0 on success, or negative value with error code.
132  * @remarks     type of data memeber of list is pointer to the structure type 'Mitem'
133  *                      when free list, it need free every item first and then free list itself. 
134  * @see         minfo_get_item_list.
135  * @pre         None
136  * @post        None
137  * @par example
138  * @code
139  
140     #include <media-svc.h>
141
142         int mitem_ite_cb(Mitem *item, void *user_data)
143         {
144                 GList** list = (GList**)user_data;
145                 //append an item to linked list.
146                 *list = g_list_append(*list, item);
147         }
148
149         void test_minfo_get_all_item_list(MediaSvcHandle *mb_svc_handle)
150         {
151                 int ret = -1;
152                 int img_cnt = 0;
153                 GList *p_list = NULL;
154
155                 minfo_item_filter item_filter = {MINFO_ITEM_VIDEO,MINFO_MEDIA_SORT_BY_DATE_ASC,3,10,true,true};
156                 //get a set of items, which all reside on local storage, including MMC and phone.
157                 ret = minfo_get_all_item_list(mb_svc_handle, MINFO_CLUSTER_TYPE_LOCAL_ALL, item_filter, mitem_ite_cb, &p_list);
158
159                 if(ret< 0) { 
160                         printf("minfo_get_item_list error\n");
161                         return;
162                 }
163         }
164  * @endcode
165
166  */
167
168 int
169 minfo_get_all_item_list(MediaSvcHandle *mb_svc_handle, const minfo_folder_type cluster_type, const minfo_item_filter filter, minfo_item_ite_cb func, void *user_data);
170
171 /**
172  * minfo_get_item_list_search
173  * This function gets mitem list, which is searched by string specified by user.
174  * @p search_field is a field to want to search. @p search_str could specify string to search.
175  * Menawhile data of each mitem instance mainly derive from media table record. However meta data
176  * is composed of video_meta or image_meta record.
177  *
178  * @param       mb_svc_handle   [in] the handle of DB
179  * @param       search_field    [in] A field to want search. Please refer the enum type minfo_search_field_t in 'minfo-types.h'.
180  * @param       search_str              [in] A string to search.
181  * @param       folder_type             [in] the folder type which specify media files belong to.
182  * @param       filter                  [in] the filter to specify some filter conditions, like, type of got items, sort by type, start and end positions of items, including meta data or not, whether just get the favorites, etc.
183  * @param       func                    [in]  Iterative callback implemented by a user. This callback is called when an item has to be inserted to user's list.
184  * @param       user_data               [out] user's data structure to contain items of the type Mitem. It is passed to the iterative callback.
185  
186  * @return      This function returns 0 on success, or negative value with error code.
187  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
188  * @remarks     type of data memeber of list is pointer to the structure type 'Mitem'
189  *                      when free list, it need free every item first and then free list itself. 
190  * @see         None.
191  * @pre         None
192  * @post        None
193  * @par example
194  * @code
195
196         #include <media-svc.h>
197
198         int mitem_ite_cb(Mitem *item, void *user_data)
199         {
200                 GList **list = (GList **)user_data;
201                 //append an item to linked list.
202                 *list = g_list_append(*list, item);
203         }
204
205         void test_minfo_get_item_list_search(MediaSvcHandle *mb_svc_handle)
206         {
207                 int ret = -1;
208                 GList *p_list = NULL;
209                 const char *search_str = "Hiphop";
210                 minfo_search_field_t search_field = MINFO_SEARCH_BY_NAME;
211                 minfo_folder_type folder_type = MINFO_CLUSTER_TYPE_ALL;
212
213                 minfo_item_filter item_filter = {MINFO_ITEM_VIDEO, MINFO_MEDIA_SORT_BY_NAME_ASC, 0, 9, false, MINFO_MEDIA_FAV_ALL};
214
215                 ret = minfo_get_item_list_search(mb_svc_handle, search_field, search_str, folder_type, item_filter, mitem_ite_cb, &p_list);
216
217                 if (ret< 0) {
218                         printf("minfo_get_item_list_search error\n");
219                         return;
220                 }
221         }
222  * @endcode  
223
224  */
225
226 int
227 minfo_get_item_list_search(MediaSvcHandle *mb_svc_handle, minfo_search_field_t search_field, const char *search_str, minfo_folder_type folder_type, const minfo_item_filter filter, minfo_item_ite_cb func, void *user_data);
228
229 /**
230  * minfo_get_all_item_cnt
231  * This function gets count of all records in media table. This function returns the count of all items, which are unlocked excluding web media.
232  *
233  * @param       cnt         [out]   returned value, count of all records
234  * @return      This function returns zero(MB_SVC_ERROR_BASE) on success, or negative value with error code.
235  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
236  * @remarks     None. 
237  * @see         None.
238  * @pre         None
239  * @post        None
240  * @par example
241  * @code
242
243
244      #include <media-svc.h>
245      
246         void test_minfo_get_all_item_cnt(MediaSvcHandle *mb_svc_handle)
247         {
248                 int ret = -1;
249                 int cnt = 0;
250
251                 ret = minfo_get_all_item_cnt(mb_svc_handle, &cnt);
252                 if(ret< 0) { 
253                         printf("minfo_get_all_item_cnt error\n");
254                         return;
255                 }
256         }
257  * @endcode
258  */
259
260 DEPRECATED_API int
261 minfo_get_all_item_cnt(MediaSvcHandle *mb_svc_handle, int *cnt);
262
263 /**
264  * minfo_get_all_item_count
265  * This function gets count of all records in the specific storage.
266  * User can specify folder type like MINFO_CLUSTER_TYPE_ALL, MINFO_CLUSTER_TYPE_LOCAL_PHONE, etc.
267  * Please refer 'visual-svc-types.h' to know what folder type exists.
268  * This function returns the count of all items, which are unlocked.
269  *
270  * @param       mb_svc_handle   [in] the handle of DB
271  * @param       folder_type     [in]    folder type
272  * @param       file_type       [in]    file type
273  * @param       fav_type        [in]    favortie type
274  * @param       cnt             [out]   returned value, count of all records
275  * @return      This function returns zero(MB_SVC_ERROR_BASE) on success, or negative value with error  code.
276  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
277  * @remarks     None.
278  * @see         None.
279  * @pre         None
280  * @post        None
281  * @par example
282  * @code
283
284 #include <media-svc.h>
285
286 void test_minfo_get_all_item_count(MediaSvcHandle *mb_svc_handle)
287 {
288         int ret = -1;
289         int cnt = 0;
290         minfo_folder_type folder_type = MINFO_CLUSTER_TYPE_LOCAL_PHONE;
291         minfo_file_type file_type = MINFO_ITEM_ALL;
292         minfo_media_favorite_type fav_type = MINFO_MEDIA_FAV_ALL;
293
294         ret = minfo_get_all_item_count(mb_svc_handle, folder_type, file_type, fav_type, &cnt);
295         if(ret< 0) {
296                 printf("minfo_get_all_item_cnt error\n");
297                 return;
298         }
299 }
300 * @endcode
301 */
302
303 EXPORT_API int minfo_get_all_item_count(
304                                                 MediaSvcHandle *mb_svc_handle,
305                                                 minfo_folder_type folder_type,
306                                                 minfo_file_type file_type,
307                                                 minfo_media_favorite_type fav_type,
308                                                 int *cnt);
309
310 /**
311  * minfo_get_item_cnt
312  * This function gets count of matched records in media table with the specified @p filter, which 
313  * specify some filter conditions, like, type of got items, sort by type, start and end positions 
314  * of items, including meta data or not, whether just get the favorites, etc.
315  * The detail structure type of @p filter, could refer to the defination 'minfo_item_filter'
316  * in header file, minfo-types.h.
317  *
318  * @param       mb_svc_handle   [in]    the handle of DB
319  * @param       cluster_id              [in]    the folder id in which media files are in. if the parameter is -1, then query all folders.
320  * @param       filter                  [in]    the filter to specify some filter conditions, like, type of got items, sort by type, start and end positions of items, including meta data or not, whether just get the favorites, etc.
321  * @param       cnt                             [out]   returned value, count of matched records
322  
323  * @return      This function returns 0 on success, or negative value with error code.
324  * @remarks     list contains a set of full path string of cover file. 
325  * @see                 minfo_get_item_list.
326  * @pre         None
327  * @post        None
328  * @par example
329  * @code
330
331         #include <media-svc.h>
332
333         void test_minfo_get_item_cnt(MediaSvcHandle *mb_svc_handle)
334         {
335                 int ret = -1;
336                 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
337
338                 minfo_item_filter item_filter = {MINFO_ITEM_VIDEO,MINFO_MEDIA_SORT_BY_DATE_ASC,-1,10,true,true};
339
340                 //get count of a set of items.
341                 ret = minfo_get_item_cnt(mb_svc_handle, cluster_id, item_filter, &cnt);
342                 if(ret< 0) { 
343                         printf("test_minfo_get_item_cnt error\n");
344                         return;
345                 }
346         }
347  * @endcode
348  */
349
350 int
351 minfo_get_item_cnt(MediaSvcHandle *mb_svc_handle, const char *cluster_id, const minfo_item_filter filter, int *cnt);
352
353
354 /**
355  * minfo_get_cluster_cnt
356  * This function gets count of matched records from folder table  with the specified @p filter, which 
357  * specify some filter conditions, like, type of got clusters, sort by type, start and end positions 
358  * of clusters, etc. The detail structure type of @p filter, could refer to the defination 'minfo_cluster_filter'
359  * in header file, minfo-types.h.
360  *
361  * @param       mb_svc_handle   [in]    the handle of DB
362  * @param       filter                  [in]    filter to specify some filter conditions, like, type of got clusters, sort by type, start and end positions of clusters
363  * @param       cnt                             [out]  returned value, count of matched records
364  * @return      This function returns 0 on success, or negative value with error code.
365  * @remarks     None.
366  * @see         minfo_get_cluster_list.
367  * @pre         None
368  * @post        None
369  * @par example
370  * @code
371
372         #include <media-svc.h>
373
374         void test_minfo_get_cluster_cnt(MediaSvcHandle *mb_svc_handle)
375         {
376                 int ret = -1;
377                 minfo_cluster_filter cluster_filter ={MINFO_CLUSTER_TYPE_ALL,MINFO_CLUSTER_SORT_BY_NONE,-1,10};
378
379                 //get the count of items which is owned by a cluster.
380                 ret = minfo_get_cluster_cnt(mb_svc_handle, cluster_filter, &cnt);
381                 if(ret< 0) { 
382                         printf("test_minfo_get_cluster_cnt error\n");
383                         return;
384                 }
385         }
386  * @endcode
387  */
388
389 int
390 minfo_get_cluster_cnt(MediaSvcHandle *mb_svc_handle, const minfo_cluster_filter filter, int *cnt);
391
392
393 /**
394  * minfo_get_cluster_list
395  * This function gets Mcluster instances list. Data of each instance is composed of the matched records from folder table 
396  * with the @p filter, which specify some filter conditions, like, type of got clusters, sort by type, start and end positions 
397  * The detail structure type of @p filter, could refer to the defination 'minfo_cluster_filter'
398  * in header file, minfo-types.h.
399  *
400  * @param       mb_svc_handle   [in]    the handle of DB
401  * @param       filter                  [in]    filter to specify some filter conditions, like, type of got clusters, sort by type, start and end positions of clusters
402  * @param       func                    [in]  Iterative callback implemented by a user. This callback is called when an item has to be inserted to user's list.
403  * @param       user_data               [out]   user's data structure to contain items of the type Mcluster. It is passed to the iterative callback.
404  * @return      This function returns 0 on success, or negative value with error code.
405  * @remarks     item type in list is pointer to structure mcluster
406  *          when free list, it need free every item first and then free list itself.
407  * @see         None.
408  * @pre         None
409  * @post        None
410  * @par example
411  * @code
412
413     #include <media-svc.h>
414      
415         int mcluster_ite_cb(Mcluster *cluster, void *user_data)
416         {
417                 GList** list = (GList**)user_data;
418                 *list = g_list_append(*list, cluster);
419         }
420
421         void test_minfo_get_cluster_list(MediaSvcHandle *mb_svc_handle)
422         {
423                 int ret = -1;
424                 int i;
425                 int img_cnt;
426                 GList *p_list = NULL;
427                 Mcluster* cluster = NULL;
428
429         //get a linked list which include all of clusters based on a specified filter.
430                 minfo_cluster_filter cluster_filter ={MINFO_CLUSTER_TYPE_ALL,MINFO_CLUSTER_SORT_BY_NONE,0,10};
431
432                 ret = minfo_get_cluster_list(mb_svc_handle, cluster_filter, mcluster_ite_cb, &p_list);
433
434                 if( ret < 0) {
435                          return;
436                 }
437         }
438  * @endcode
439  */
440
441 int
442 minfo_get_cluster_list(MediaSvcHandle *mb_svc_handle, const minfo_cluster_filter filter, minfo_cluster_ite_cb func, void *user_data);
443
444
445 /**
446  * minfo_get_meta_info
447  * This function gets matched 'Mmeta' instances. Data of the instance is composed of the matched media record from 
448  * 'video_meta'/'image_meta' table, when finish using the Mmeta instance, should call API, minfo_mmeta_destroy to 
449  * destroy this created instance.
450  *
451  * @param       mb_svc_handle   [in]    the handle of DB
452  * @param       media_id                [in]    specified _id field in media table record
453  * @param       meta                    [out]   pointer to pointer of matched Mmeta instance
454  * @return      This function returns 0 on success, or negative value with error code.
455  * @remarks     after using meta, it must be freed.
456  * @see         None
457  * @pre         None
458  * @post        None
459  * @par example
460  * @code
461
462         #include <media-svc.h>
463
464         void test_minfo_get_meta_info(MediaSvcHandle *mb_svc_handle)
465         {
466                 int ret = -1;
467                 Mmeta* mt = NULL;
468                 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
469
470                 //get a matched meta data.
471                 ret = minfo_get_meta_info(mb_svc_handle, media_id, &mt);
472                 if( ret < 0) {
473                         printf("minfo_get_meta_info failed\n");
474                         return ret;
475                 }
476                 minfo_mmeta_destroy(mt);
477         }
478
479  * @endcode
480  */
481
482 int
483 minfo_get_meta_info(MediaSvcHandle *mb_svc_handle, const char *media_id, Mmeta** meta);
484
485 /**
486  * minfo_update_image_meta_info_int
487  * This function will update the corresponding field's value in database 'image_meta' table, this will be decided by the
488  * @p meta_field, whose type is 'minfo_image_meta_field_t', and indicate which field will be replaced by the value of int type
489  * pointered to by @p updated_value.
490  *
491  * @param       mb_svc_handle   [in]    the handle of DB
492  * @param       media_id                [in]    specified _id field in media table record
493  * @param       meta_field              [in]    the enum value indicate which field of database table will be updated
494  * @param       updated_value   [in]    value of int, which will replace the original value in database image meta table
495  * @return      This function returns 0 on success, or negative value with error code.
496  * @remarks     after using meta, it must be freed.
497  * @see         None.
498  * @pre         None
499  * @post        None
500  * @par example
501  * @code
502
503         #include <media-svc.h>
504
505         void test_minfo_update_image_meta_info_int(MediaSvcHandle *mb_svc_handle)
506         {
507                 int ret = -1;
508                 int width = 640;
509                 int height = 480;
510                 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
511
512                 // update image meta's 'width and height' member 
513                 ret = minfo_update_image_meta_info_int(mb_svc_handle, media_id, MINFO_IMAGE_META_WIDTH, width, MINFO_IMAGE_META_HEIGHT, height);
514                 if( ret < 0) {
515                         printf("minfo_update_image_meta_info_int failed\n");
516                         return;
517                 }
518         }
519
520  * @endcode
521  */
522
523 EXPORT_API int
524 minfo_update_image_meta_info_int(MediaSvcHandle *mb_svc_handle, const char *media_id,
525                                 minfo_image_meta_field_t meta_field,
526                                 const int updated_value,
527                                 ...);
528
529 /**
530  * minfo_update_video_meta_info_int
531  * This function will update the corresponding field's value in database 'video_meta' table, this will be decided by the
532  * @p meta_field, whose type is 'minfo_video_meta_field_t', and indicate which field will be replaced by the value of int type
533  * pointered to by @p updated_value.
534  *
535  * @param       mb_svc_handle   [in]    the handle of DB
536  * @param       media_id                [in]    specified _id field in media table record
537  * @param       meta_field              [in]    the enum value indicate which field of database table will be updated
538  * @param       updated_value   [in]    value of int, which will replace the original value in database video meta table
539  * @return      This function returns 0 on success, or negative value with error code.
540  * @remarks     after using meta, it must be freed.
541  * @see         None.
542  * @pre         None
543  * @post        None
544  * @par example
545  * @code
546
547         #include <media-svc.h>
548
549         void test_minfo_update_video_meta_info_int(MediaSvcHandle *mb_svc_handle)
550         {
551                 int ret = -1;
552                 int _value = 876;
553                 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
554
555                 //update video meta's 'last_played_time' member
556                 ret = minfo_update_video_meta_info_int(mb_svc_handle, media_id, MINFO_VIDEO_META_BOOKMARK_LAST_PLAYED, _value);
557
558                 if( ret < 0) {
559                         printf("minfo_update_video_meta_info_int failed\n");
560                         return;
561                 }
562         }
563
564  * @endcode
565  */
566
567 int
568 minfo_update_video_meta_info_int(MediaSvcHandle *mb_svc_handle, const char *media_id, minfo_video_meta_field_t meta_field, const int updated_value);
569
570
571 /**
572 * minfo_destroy_mtype_item
573 * This function free an type instantiated object, whose type may be any one recognized by media-svc, these type
574 * will include Mitem, Mimage, Mvideo, Mmeta, Mcluster, etc. In this function, it will check the concrete type for the 
575 * @p item, and then decide which free function will really be called.
576 *
577 * @return       This function returns 0 on success, and negativa value on failure.
578 * @param        item [in]        the input parameter, inlcuding the instanciated object.
579 * @exception    None.
580 * @remarks      This function is general one, it will be able to destroy any recognized instantiated object
581 *                               by media-svc, so when you create or get an instantiated object from media-svc, and then
582 *                               call this function to free it.
583 * @see  None
584 * @pre  None
585 * @post None
586 * @par example
587 * @code
588
589         #include <media-svc.h>
590
591         void test_minfo_destroy_mtype_item(void)
592         {
593                 int ret = -1;
594                 Mitem *mi = NULL;
595                 
596                 char* file_url = "/opt/media/Images/Wallpapers/Home_01.png";
597                 ret = minfo_get_item(file_url, &mi);
598
599                 //destroy an item whose type is 'Mitem'.
600                 ret = minfo_destroy_mtype_item(mi);
601
602                 if( ret < 0) {
603                          return ret;
604                 }
605                 
606         }
607  * @endcode
608 */
609
610 int
611 minfo_destroy_mtype_item(void* item);
612
613
614 /**
615  * minfo_add_media_start
616  * This function inserts new media file information into media table,video_meta table/image_meta table.
617    Or updates file information in these tables if the file is updated
618  *
619  * @param       mb_svc_handle   [in]    the handle of DB
620  * @param       trans_count             [in]    count of trasaction user wants
621  * @return      This function returns 0/positive on success, or negative value with error code. (0 : added, 1: updated, 2: skipped )
622  * @remarks     if invoke this function with same input parameter, it fails
623  * @see         minfo_add_media_end, minfo_add_media_batch
624  * @pre         None
625  * @post        None
626  * @par example
627  * @code
628
629         #include <media-svc.h>
630
631         void test_minfo_add_media_batch(MediaSvcHandle *mb_svc_handle)
632         {
633                 int err = -1, i;
634
635                 err = minfo_add_media_start(mb_svc_handle, 100);
636                 if( err < 0) {
637                         printf("minfo_add_media_start failed\n");
638                         return;
639                 }
640
641                 for (i = 0; i < 200; i++) {
642                         err = minfo_add_media_batch(mb_svc_handle, image_files[i], MINFO_ITEM_IMAGE);
643
644                         if( err < 0) {
645                                 printf("minfo_add_media_start failed\n");
646                                 return;
647                         }
648                 }
649
650                 err = minfo_add_media_end(mb_svc_handle);
651                 if( err < 0) {
652                         printf("minfo_add_media_end failed\n");
653                         return;
654                 }
655         }
656  * @endcode
657  */
658
659 int
660 minfo_add_media_start(MediaSvcHandle *mb_svc_handle, int trans_count);
661
662
663 /**
664  * minfo_add_media_batch
665  * This function inserts new media file information into media table,video_meta table/image_meta table.
666    Or updates file information in these tables if the file is updated
667  *
668  * @param       mb_svc_handle   [in]    the handle of DB
669  * @param       file_url                [in]    the local file full path
670  * @param       type                    [in]    the file type, maybe it's video file or image file
671  * @return      This function returns 0/positive on success, or negative value with error code. (0 : added, 1: updated, 2: skipped )
672  * @remarks     if invoke this function with same input parameter, it fails
673  * @see          minfo_add_media_start, minfo_add_media_end
674  * @pre None
675  * @post        None
676  * @par example
677  * @code
678
679     #include <media-svc.h>
680
681         void test_minfo_add_media_batch(MediaSvcHandle *mb_svc_handle)
682         {
683                 int err = -1, i;
684
685                 err = minfo_add_media_start(mb_svc_handle, 100);
686                 if( err < 0) {
687                         printf("minfo_add_media_start failed\n");
688                         return;
689                 }
690
691                 for (i = 0; i < 100; i++) {
692                         err = minfo_add_media_batch(mb_svc_handle, image_files[i], MINFO_ITEM_IMAGE);
693
694                         if( err < 0) {
695                                 printf("minfo_add_media_start failed\n");
696                                 return;
697                         }
698                 }
699
700                 err = minfo_add_media_end(mb_svc_handle);
701                 if( err < 0) {
702                         printf("minfo_add_media_end failed\n");
703                         return;
704                 }
705         }
706  * @endcode
707  */
708
709 int
710 minfo_add_media_batch(MediaSvcHandle *mb_svc_handle, const char* file_url, minfo_file_type content_type);
711
712 /**
713  * minfo_add_media_end
714  * This function inserts new media file information into media table,video_meta table/image_meta table.
715    Or updates file information in these tables if the file is updated
716  *
717  * @param       mb_svc_handle   [in]    the handle of DB
718  * @return      This function returns 0/positive on success, or negative value with error code. (0 : added, 1: updated, 2: skipped )
719  * @remarks     if invoke this function with same input parameter, it fails
720  * @see         minfo_add_media_start, minfo_add_media_batch
721  * @pre         None
722  * @post        None
723  * @par example
724  * @code
725
726         #include <media-svc.h>
727
728         void test_minfo_add_media_batch(MediaSvcHandle *mb_svc_handle)
729         {
730                 int err = -1, i;
731
732                 err = minfo_add_media_start(100);
733                 if( err < 0) {
734                         printf("minfo_add_media_start failed\n");
735                         return;
736                 }
737
738                 for (i = 0; i < 200; i++) {
739                         err = minfo_add_media_batch(mb_svc_handle, image_files[i], MINFO_ITEM_IMAGE);
740
741                         if( err < 0) {
742                                 printf("minfo_add_media_start failed\n");
743                                 return;
744                         }
745                 }
746
747                 err = minfo_add_media_end();
748                 if( err < 0) {
749                         printf("minfo_add_media_end failed\n");
750                         return;
751                 }
752         }
753  * @endcode
754  */
755
756 int
757 minfo_add_media_end(MediaSvcHandle *mb_svc_handle);
758
759 /**
760  * minfo_add_media
761  * This function inserts new media file information into media table,video_meta table/image_meta table.
762    Or updates file information in these tables if the file is updated
763  *
764  * @param       mb_svc_handle   [in]    the handle of DB
765  * @param       file_url                [in]    the local file full path
766  * @param       type                    [in]    the file type, maybe it's video file or image file
767  * @return      This function returns 0/positive on success, or negative value with error code. (0 : added, 1: updated, 2: skipped )
768  * @remarks     if invoke this function with same input parameter, it fails
769  * @see          minfo_delete_media
770  * @pre None
771  * @post None
772  * @par example
773  * @code
774
775         #include <media-svc.h>
776
777         void test_minfo_add_media(MediaSvcHandle *mb_svc_handle)
778         {
779                 int err = -1;
780                 char *file_url = "/opt/media/Images/Wallpapers/Home_01.png";
781
782                 //add a new media content whose url is 'file_url'.
783                 err = minfo_add_media(mb_svc_handle, file_url, MINFO_ITEM_IMAGE);
784
785                 if( err < 0) {
786                         printf("minfo_add_media failed\n");
787                         return;
788                 }
789         }
790  * @endcode
791  */
792
793
794 int
795 minfo_add_media(MediaSvcHandle *mb_svc_handle, const char* file_url, minfo_file_type content_type);
796
797
798
799 /**
800  * minfo_delete_media
801  * This function deletes matched media table record, video_meta/image_meta record. After that, if the folder which this file is in is empty, then delete the folder record.
802  * When user actually delete a media file in file system, he/she should call this function to delete the corresponding record in 'media' table, meanwhile it may delete the 
803  * folder record in 'folder' table if this folder will not include any media content.
804  *
805  * @param       mb_svc_handle   [in]    the handle of DB
806  * @param       file_url                [in]     matched local file full path
807  * @return      This function returns 0 on success, or negative value with error code.
808  * @remarks      None.
809  * @see  minfo_add_media
810  * @pre None
811  * @post None
812  * @par example
813  * @code
814
815         #include <media-svc.h>
816
817         void test_minfo_delete_media(void)
818         {
819                 int ret = -1;
820                 char *file_url = "/opt/media/Images/Wallpapers/Home_01.png";
821
822                 //delete a media reord from 'media' table.
823                 ret= minfo_delete_media(file_url);
824
825                 if( ret < 0) {
826                         printf("minfo_delete_media failed\n");
827                         return;
828                 }
829         }
830  * @endcode
831  */
832
833 int
834 minfo_delete_media(MediaSvcHandle *mb_svc_handle, const char* file_url);
835
836
837
838 /**
839  * minfo_move_media
840  * This function moves the media file to another place. When user actually move a media file ( @p old_file_url )in file system to the destination
841  * pathname ( @p new_file_url ), he/she need to call this function to move the record of 'media' table. Meanwhile user is responsible for identifying 
842  * the file's type, like image, video, etc. 
843  * @param       mb_svc_handle   [in]    the handle of DB
844  * @param       old_file_url    [in]    old local file full path of the media file
845  * @param       new_file_url    [in]    new local file full path of the media file
846  * @param       type                    [in]     media file type,maybe vidoe or image
847  * @return      This function returns 0 on success, or negative value with error code.
848  * @remarks     None.
849  * @see   minfo_mv_media, minfo_copy_media, minfo_update_media_name.
850  * @pre None
851  * @post        None
852  * @par example
853  * @code
854
855         #include <media-svc.h>
856
857         void test_minfo_move_media(MediaSvcHandle *mb_svc_handle)
858         {
859                 int ret = -1;
860                 char* old_file_url = "/opt/media/Images/Wallpapers/Home_01.png";
861                 char* new_file_url = "/opt/media/Images/Wallpapers/Home_01_1.png";
862
863                 //move an item to a specified location.
864                 ret = minfo_move_media(mb_svc_handle, old_file_url, new_file_url, MINFO_ITEM_IMAGE);
865
866                 if( ret < 0) {
867                         printf("minfo_move_media failed\n");
868                         return;
869                 }
870         }
871  * @endcode
872  */
873
874 int
875 minfo_move_media(MediaSvcHandle *mb_svc_handle, const char* old_file_url, const char *new_file_url, minfo_file_type content_type);
876
877 /**
878  * minfo_move_media_start
879  * This function starts to move multiple media files
880  *
881  * @param       mb_svc_handle   [in]    the handle of DB
882  * @param       trans_count             [in]    count of trasaction user wants
883  * @return      This function returns 0/positive on success, or negative value with error code.
884  * @remarks     if invoke this function with same input parameter, it fails
885  * @see         minfo_move_media_end, minfo_move_media
886  * @pre         None
887  * @post        None
888  * @par example
889  * @code
890
891         #include <media-svc.h>
892
893         void test_minfo_move_media_batch(MediaSvcHandle *mb_svc_handle)
894         {
895                 int err = -1, i;
896
897                 err = minfo_move_media_start(mb_svc_handle, 100);
898                 if( err < 0) {
899                         printf("minfo_move_media_start failed\n");
900                         return;
901                 }
902
903                 for (i = 0; i < 200; i++) {
904                         err = minfo_move_media(mb_svc_handle, src_image_file_path[i], dst_image_file_path[i], MINFO_ITEM_IMAGE);
905
906                         if( err < 0) {
907                                 printf("minfo_move_media failed\n");
908                                 return;
909                         }
910                 }
911
912                 err = minfo_move_media_end(mb_svc_handle);
913                 if( err < 0) {
914                         printf("minfo_move_media_end failed\n");
915                         return;
916                 }
917         }
918  * @endcode
919  */
920
921 int
922 minfo_move_media_start(MediaSvcHandle *mb_svc_handle, int trans_count);
923
924
925
926 /**
927  * minfo_move_media_end
928  * This function ends to move multiple media files
929  *
930  * @param       mb_svc_handle   [in]    the handle of DB
931  * @return      This function returns 0/positive on success, or negative value with error code.
932  * @remarks     if invoke this function with same input parameter, it fails
933  * @see         minfo_add_move_start, minfo_move_media
934  * @pre         None
935  * @post        None
936  * @par example
937  * @code
938
939         #include <media-svc.h>
940
941         void test_minfo_move_media_batch(void)
942         {
943                 int err = -1, i;
944
945                 err = minfo_move_media_start(mb_svc_handle, 100);
946                 if( err < 0) {
947                         printf("minfo_add_media_start failed\n");
948                         return;
949                 }
950
951                 for (i = 0; i < 200; i++) {
952                         err = minfo_move_media(mb_svc_handle, src_image_file_path[i], dst_image_file_path[i], MINFO_ITEM_IMAGE);
953
954                         if( err < 0) {
955                                 printf("minfo_move_media failed\n");
956                                 return;
957                         }
958                 }
959
960                 err = minfo_move_media_end(mb_svc_handle);
961                 if( err < 0) {
962                         printf("minfo_move_media_end failed\n");
963                         return;
964                 }
965         }
966  * @endcode
967  */
968
969 int
970 minfo_move_media_end(MediaSvcHandle *mb_svc_handle);
971
972
973 /**
974  * minfo_copy_media
975  * This function copies the media file to another place. User should pass the full pathnames for these parameters, @p old_file_url and @ new_file_url
976  * respectively. The @p old_file_url indicate the original full pathname of this media content, and @ new_file_url indicate the destination full pathname of
977  * the copied file.
978  * @param       mb_svc_handle   [in]    the handle of DB
979  * @param       old_file_url    [in]    old local file full path of the media file
980  * @param       new_file_url    [in]    new local file full path of the media file
981  * @param       type                    [in]    media file type, maybe vidoe or image
982  * @return      This function returns 0 on success, or negative value with error code.
983  * @remarks     This function will not return the thumbnail pathname of new media file, user could get this new thumnail file using the function, minfo_get_thumb_path.
984  * @see         minfo_cp_media, minfo_update_media_name, minfo_move_media
985  * @pre None
986  * @post        None
987  * @par example
988  * @code
989
990         #include <media-svc.h>
991
992     void test_minfo_copy_media(MediaSvcHandle *mb_svc_handle)
993     {
994         int ret =-1;
995
996         char *file_url = "/opt/media/Images/Wallpapers/Home_01.png";
997             char *new_file_url = "/opt/media/Images/Wallpapers/Home_01_1.png";
998
999             //copy a media file to other location whos name is specified by 'new_file_url'.
1000         ret  = minfo_copy_media(mb_svc_handle, old_file_url, new_file_url, file_type);
1001         if( ret < 0) {
1002               printf("minfo_copy_media failed\n");
1003               return;
1004                 }
1005
1006     }
1007  * @endcode
1008  */
1009
1010 int
1011 minfo_copy_media(MediaSvcHandle *mb_svc_handle, const char* old_file_url, const char *new_file_url, minfo_file_type content_type);
1012
1013
1014 /**
1015  * minfo_update_media_name
1016  * This function rename a image or video file. Here this function will assume the folder name of 
1017  * file whose name is changed keep unchanged. That is, this file which is changed name still is located in the same folder.
1018  * This function actually call sqlite3 
1019  * UPDATE %s SET ... WHERE _id = _id;
1020  * @param       mb_svc_handle   [in]    the handle of DB
1021  * @param       media_id                [in]    the id of specified media file
1022  * @param       new_name                [in]    new name of the media file
1023  * @return      This function returns 0 on success, or negative value with error code.
1024  * @remarks      None.
1025  * @see    minfo_move_media, minfo_copy_media.
1026  * @pre None
1027  * @post        None
1028  * @par example
1029  * @code
1030
1031         #include <media-svc.h>
1032
1033         void test_minfo_update_media_name(MediaSvcHandle *mb_svc_handle)
1034         {
1035                 int ret = -1;
1036                 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";  
1037
1038                 //update media name
1039                 ret = minfo_update_media_name(mb_svc_handle, media_id, new_name);
1040                 if( ret < 0) {
1041                         printf("test_minfo_update_media_name failed\n");
1042                         return;
1043                 }
1044         }
1045  * @endcode
1046  */
1047
1048 int
1049 minfo_update_media_name(MediaSvcHandle *mb_svc_handle, const char *media_id, const char* new_name);
1050
1051 /**
1052  * minfo_update_media_thumb
1053  * This function updates a thumbpath of the media in DB.
1054  * @param       mb_svc_handle   [in]    the handle of DB
1055  * @param       media_id                [in]    the id of specified media file
1056  * @param       thumb_path              [in]    new thumbnail path of the media file
1057  * @return      This function returns 0 on success, or negative value with error code.
1058  * @remarks      None.
1059  * @see None
1060  * @pre None
1061  * @post None
1062  * @par example
1063  * @code
1064
1065         #include <media-svc.h>
1066
1067         void test_minfo_update_media_thumb(MediaSvcHandle *mb_svc_handle)
1068         {
1069                 int ret = -1;
1070                 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
1071                 const char *thumb_path = "/opt/media/test.jpg";
1072
1073                 //update thumbnail path
1074                 ret = minfo_update_media_thumb(mb_svc_handle, media_id, thumb_path);
1075                 if( ret < 0) {
1076                         printf("minfo_update_media_thumb failed\n");
1077                         return;
1078                 }
1079         }
1080  * @endcode
1081  */
1082
1083 int
1084 minfo_update_media_thumb(MediaSvcHandle *mb_svc_handle, const char *media_id, const char* thumb_path);
1085
1086 /**
1087  * minfo_update_media_favorite
1088  * This function updates favorite field of image or video file in 'media' table. This function actually call the Sqlite3 UPDATE,
1089  * In Gallery application or ug-imageviewer, user could want to set a media file as favorite or unfovarite, so he/she could call
1090  * this API to do it.
1091  * @param       mb_svc_handle   [in]    the handle of DB
1092  * @param       media_id                [in]    Unique id of the media file
1093  * @param       favorite_level  [in]    new favorite_level of the media file, indicate whether this media content is favorite or unfavorite.
1094  * @return      This function returns 0 on success, or negative value with error code.
1095  * @remarks     None.
1096  * @see     None.
1097  * @pre         None
1098  * @post        None
1099  * @par example
1100  * @code
1101
1102         #include <media-svc.h>
1103
1104         void test_minfo_update_media_favorite(MediaSvcHandle *mb_svc_handle)
1105         {
1106                 int ret = -1;
1107                 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
1108
1109                 //update an item's favorite record
1110                 ret = minfo_update_media_favorite(mb_svc_handle, media_id, favorite_level);
1111
1112                 if( ret < 0) {
1113                         printf("minfo_update_media_favorite failed\n");
1114                         return;
1115                 }
1116         }
1117  * @endcode
1118  */
1119
1120 int  
1121 minfo_update_media_favorite(MediaSvcHandle *mb_svc_handle, const char *media_id, const int favorite_level);
1122
1123
1124 /**
1125  * minfo_update_media_date
1126  * This function updates modified date of image or video file in 'media' table. This function actually call the Sqlite3 UPDATE.
1127  * In Gallery application or ug-imageviewer, user could want to set moedified date of a media, so he/she could call this API to do it.
1128  * @return  This function returns zero(MB_SVC_ERROR_BASE) on success, or negative value with error code.
1129  * @param       mb_svc_handle   [in]    the handle of DB
1130  * @param       media_id                [in]    Unique id of the media file
1131  * @param       modified_date   [in]    date to modify, which is a type of time_t
1132  * @return      This function returns 0 on success, or negative value with error code.
1133  * @remarks     None.
1134  * @see     None.
1135  * @pre         None
1136  * @post        None
1137  * @par example
1138  * @code
1139
1140         #include <media-svc.h>
1141
1142         void test_minfo_update_media_date(MediaSvcHandle *mb_svc_handle)
1143         {
1144                 int ret = -1;
1145                 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
1146
1147                 time_t today;
1148                 time(&today);
1149
1150                 //update an item's date record
1151                 ret = minfo_update_media_date(mb_svc_handle, media_id, today);
1152                 if( ret < 0) {
1153                         printf("minfo_update_media_date failed\n");
1154                         return;
1155                 }
1156         }
1157  * @endcode
1158  */
1159
1160 int
1161 minfo_update_media_date(MediaSvcHandle *mb_svc_handle, const char *media_id, time_t modified_date);
1162
1163 /**
1164  * minfo_update_media_orientation
1165  * This function updates orientation of image file in 'image_meta' table. This function actually call the Sqlite3 UPDATE.
1166  * In Gallery application or ug-imageviewer, user could want to set orientation of an image, so he/she could call this API to do it.
1167  * @return  This function returns zero(MB_SVC_ERROR_BASE) on success, or negative value with error code.
1168  * @param       mb_svc_handle   [in]    the handle of DB
1169  * @param       media_id                [in]    Unique id of the media file
1170  * @param       orientation             [in]    orientation to modify, which is a type of int
1171  * @return      This function returns 0 on success, or negative value with error code.
1172  * @remarks     None.
1173  * @see     None.
1174  * @pre         None
1175  * @post        None
1176  * @par example
1177  * @code
1178
1179         #include <media-svc.h>
1180
1181         void test_minfo_update_media_orientation(MediaSvcHandle *mb_svc_handle)
1182         {
1183                 int ret = -1;
1184                 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
1185                 minfo_exif_orientation_t orientation = MINFO_ORIENT_ROT_90;
1186
1187                 //update an image's orientation
1188                 ret = minfo_update_media_orientation(mb_svc_handle, media_id, orientation);
1189                 if( ret < 0) {
1190                         printf("minfo_update_media_orientation failed\n");
1191                         return;
1192                 }
1193         }
1194  * @endcode
1195  */
1196 int
1197 minfo_update_media_orientation(MediaSvcHandle *mb_svc_handle, const char *media_id, minfo_exif_orientation_t orientation);
1198
1199 /**
1200  * minfo_add_cluster
1201  * This function adds new local folder. This function could be called when user want to add a Album(local folder)
1202  * in Gallery application. This function actually call the sqlite INSERT statement to insert the record in folder
1203  * table. Meanwhile it will return new added local folder's ID to @p id.
1204  * Sqlie3 statement looks like this, INSERT INTO folder (...);
1205  * @param       mb_svc_handle   [in]    the handle of DB
1206  * @param       cluster_url             [in]    the local directory of added folder, it should be full pathname of local folder
1207  * @param       id                              [out]   id of the added folder, this function will return a unique ID to calling application
1208  * @return      This function returns 0 on success, or negative value with error code.
1209  * @remarks     if invoke this function with same input parameter, it fails   
1210  * @see     minfo_delete_cluster
1211  * @pre         None
1212  * @post        None
1213  * @par example
1214  * @code
1215
1216         #include <media-svc.h>
1217  
1218         void test_minfo_add_cluster(MediaSvcHandle *mb_svc_handle)
1219         {
1220                 int ret = -1;
1221                 char *cluster_url = "/opt/media/Images/Wallpapers";
1222                 char cluster_id[256];
1223
1224                 //add a new cluster whose url is 'cluster_url'.
1225                 ret = minfo_add_cluster(mb_svc_handle, cluster_url, cluster_id, sizeof(cluster_id));
1226                 if( ret < 0) {
1227                         printf("minfo_add_cluster failed\n");
1228                         return;
1229                 }
1230         }
1231  * @endcode    
1232  */
1233
1234 int
1235 minfo_add_cluster(MediaSvcHandle *mb_svc_handle, const char* cluster_url, char *id, int max_length);
1236
1237
1238 /**
1239  * minfo_check_cluster_exist
1240  * This function checks to exist the cluster in media database by its path.
1241  * @param       mb_svc_handle   [in]    the handle of DB
1242  * @param       path                    [in]    the local directory to check if it exists, it should be full pathname of local folder
1243  * @return      This function returns 0 on success, or negative value with error code.
1244  * @remarks     if invoke this function with same input parameter, it fails
1245  * @see     minfo_check_item_exist
1246  * @pre         None
1247  * @post        None
1248  * @par example
1249  * @code
1250
1251         #include <media-svc.h>
1252
1253         void test_minfo_check_cluster_exist(MediaSvcHandle *mb_svc_handle)
1254         {
1255                 int ret = -1;
1256                 char *cluster_url = "/opt/media/Images/Wallpapers";
1257
1258                 //check if the cluster exists by path.
1259                 ret = minfo_check_cluster_exist(mb_svc_handle, cluster_url);
1260                 if( ret < 0) {
1261                         printf("minfo_check_cluster_exist failed\n");
1262                         return;
1263                 }
1264         }
1265  * @endcode
1266  */
1267
1268 int
1269 minfo_check_cluster_exist(MediaSvcHandle *mb_svc_handle, const char *path);
1270
1271 /**
1272  * minfo_check_item_exist
1273  * This function checks to exist the media in media database by its path.
1274  * @param       mb_svc_handle   [in]    the handle of DB
1275  * @param       path                    [in]    the local media path to check if it exists, it should be full pathname.
1276  * @return      This function returns 0 on success, or negative value with error code.
1277  * @remarks     if invoke this function with same input parameter, it fails
1278  * @see     minfo_check_cluster_exist
1279  * @pre         None
1280  * @post        None
1281  * @par example
1282  * @code
1283
1284         #include <media-svc.h>
1285
1286         void test_minfo_check_item_exist(MediaSvcHandle *mb_svc_handle)
1287         {
1288                 int ret = -1;
1289                 char *media_url = "/opt/media/Images/Wallpapers/Wallpaper1.jpg";
1290
1291                 //check if the item exists by path.
1292                 ret = minfo_check_item_exist(mb_svc_handle, media_url);
1293                 if( ret < 0) {
1294                         printf("minfo_check_item_exist failed\n");
1295                         return;
1296                 }
1297         }
1298  * @endcode
1299  */
1300
1301 int
1302 minfo_check_item_exist(MediaSvcHandle *mb_svc_handle, const char *path);
1303
1304 /**
1305  * minfo_get_item_by_id
1306  * This function gets mitem information. When user could get the unique ID of a media content, he/she
1307  * could get the detail information with the type 'Mitem', which include the below feilds, like, item's unique id,
1308  * media content type, media content's thumbnail name, media content's pathname, etc. The detail defination 
1309  * of this structute, could refer to the header, minfo-item.h.
1310  * @param       mb_svc_handle   [in]    the handle of DB
1311  * @param       media_id                [in]    the local file media id
1312  * @param       mitem                   [out]   the returned data structure whose type is Mitem.
1313  * @return      This function returns 0 on success, or negative value with error code.
1314  * @remarks        when invoking this function, *mitem must equals NULL, and
1315  *          the @p media_id should be valid ID, if it is invalid, like -1 or 0, this
1316  *                      function will return @p mitem whose content is NULL. If normally, @p mitem must be freed with minfo_mitem_destroy.
1317  * @see     minfo_get_item.
1318  * @pre         None
1319  * @post        None
1320  * @par example
1321  * @code
1322
1323         #include <media-svc.h>
1324
1325         void test_minfo_get_item_by_id(MediaSvcHandle *mb_svc_handle)
1326         {
1327                 int ret = -1;
1328                 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
1329                 Mitem *mi = NULL;
1330
1331                 //get an item based on its media ID.
1332                 ret = minfo_get_item_by_id(mb_svc_handle, media_id, &mi);
1333                 if(ret < 0) {
1334                         return;
1335                 }
1336
1337                 minfo_destroy_mtype_item(mi);
1338         }
1339  * @endcode
1340  */
1341
1342 int
1343 minfo_get_item_by_id(MediaSvcHandle *mb_svc_handle, const char *media_id, Mitem **mitem);
1344
1345
1346 /**
1347  * minfo_get_item
1348  * This function gets mitem information. When user could get the full pathname of a media content, he/she
1349  * could get the detail information with the type 'Mitem', which include the below feilds, like, item's unique id,
1350  * media content type, media content's thumbnail name, media content's pathname, etc. The detail defination 
1351  * of this structute, could refer to the header, minfo-item.h.
1352  * @param       mb_svc_handle   [in]    the handle of DB
1353  * @param       file_url                [in]    the local file full pathname
1354  * @param       mitem                   [out]   the returned data structure whose type is Mitem.
1355  * @return      This function returns 0 on success, or negative value with error code.
1356  * @remarks        when invoking this function, *mitem must equals NULL, and
1357  *                  after using mitem, it must be freed with minfo_mitem_destroy.
1358  * @see     minfo_get_item_by_id.
1359  * @pre         None
1360  * @post        None
1361  * @par example
1362  * @code
1363
1364         #include <media-svc.h>
1365
1366         void test_minfo_get_item(MediaSvcHandle *mb_svc_handle)
1367         {
1368                 int ret = -1;
1369                 Mitem *mi = NULL;
1370                 char* file_url = "/opt/media/Images/Wallpapers/Home_01.png";
1371
1372                 //get an item based on its url.
1373                 ret = minfo_get_item(mb_svc_handle, file_url, &mi);
1374                 if(ret < 0) {
1375                         return;
1376                 }
1377
1378                 minfo_destroy_mtype_item(mi);
1379         }
1380  * @endcode
1381  */
1382
1383 int
1384 minfo_get_item(MediaSvcHandle *mb_svc_handle, const char* file_url, Mitem **mitem);
1385
1386 /**
1387  * minfo_get_item_by_http_url
1388  * This function gets mitem information. When user could get the http url of a media content, which is downloaded from web, he/she
1389  * could get the detail information with the type 'Mitem', which include the below feilds, like, item's unique id,
1390  * media content type, media content's thumbnail name, etc. The detail defination 
1391  * of this structute, could refer to the header, minfo_item/minfo-item.h.
1392  * @param       mb_svc_handle   [in]    the handle of DB
1393  * @param       http_url                [in]    the http url of a media, which is downloaded from web.
1394  * @param       mitem                   [out]   the returned data structure whose type is Mitem.
1395  * @return      This function returns 0 on success, or negative value with error code.
1396  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
1397  * @remarks        when invoking this function, *mitem must equals NULL, and
1398  *                  after using mitem, it must be freed with minfo_mitem_destroy.
1399  * @see     minfo_get_item_by_id, minfo_get_item
1400  * @pre         None
1401  * @post        None
1402  * @par example
1403  * @code
1404
1405         #include <media-svc.h>
1406
1407         void test_minfo_get_item_by_http_url(MediaSvcHandle *mb_svc_handle)
1408         {
1409                 int ret = -1;
1410                 Mitem *mi = NULL;
1411                 char* http_url = "http://picasa.com/myaccount/Home_01.png";
1412
1413                 //get an item based on its http url.
1414                 ret = minfo_get_item_by_http_url(mb_svc_handle, http_url, &mi);
1415                 if(ret < 0) {
1416                         return;
1417                 }
1418
1419                 minfo_destroy_mtype_item(mi);
1420         }
1421  * @endcode
1422  */
1423
1424 int
1425 minfo_get_item_by_http_url(MediaSvcHandle *mb_svc_handle, const char* http_url, Mitem **mitem);
1426
1427
1428 /**
1429 * minfo_get_cluster
1430 * This function gets mcluster information by folder full path or cluster id when user could not know exact url of cluster. When user could get full path of a folder, he/she
1431 * could get the detail information with the type 'Mcluster' about this cluster/local folder, the type 'Mcluster'
1432 * mainly include folder/cluster ID, display name, count of included media content, etc. The detail defination
1433 * of this type could refer to the herder file, minfo-cluster.h.
1434 *
1435 * @return       This function returns 0 on success, or negative value with error code.
1436 * @param        mb_svc_handle   [in]    the handle of DB
1437 * @param        cluster_url             [in]    local folder full path, it indicate which folder user want to get it's detail information
1438 * @param        cluster_id              [in]    the cluster ID which indentify a cluster
1439 * @param        mcluster                [out]   mcluster to be returned, which is a 'Mcluster' type
1440 * @exception None.
1441 * @remarks  when user could not know exact url of a cluster, he/she could choose alternative way he/she pass cluster id to this function, so that
1442 *           this function still could get the wanted cluster.
1443 *           when invoking this function, *mcluster must equals NULL, and
1444 *           after using mitem, it must be freed with minfo_mcluster_destroy.
1445 * @see      minfo_mcluster_destroy
1446 * @pre          None
1447 * @post None
1448 * @par example
1449 * @code
1450
1451         #include <media-svc.h>
1452
1453         void test_minfo_get_cluster(MediaSvcHandle *mb_svc_handle)
1454         {
1455                 int ret = -1;
1456                 Mcluster *mc = NULL;
1457                 char *cluster_url = "/opt/media/Images/Wallpapers";
1458                 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
1459
1460                 //get a cluster using cluster's url.
1461                 ret = minfo_get_cluster(mb_svc_handle, cluster_url, cluster_id, &mc);
1462                 if(ret < 0) {
1463                         printf("minfo_get_cluster fail: %d \n", ret);
1464                         return;
1465                 }
1466
1467                 printf("minfo_get_cluster: %s \n", mc->display_name);
1468                 minfo_mcluster_destroy(mc);
1469         }
1470 * @endcode
1471 */
1472
1473 int 
1474 minfo_get_cluster(MediaSvcHandle *mb_svc_handle, const char* cluster_url, const char *cluster_id, Mcluster **mcluster);
1475
1476
1477 /**
1478  * minfo_get_cluster_cover
1479  * This function gets thumbnail path of cover files by cluster id. This function could get the cover of a cluster
1480  * or folder which may include first several items' thumbnails, maybe 5 or other number, user could specify it
1481  * using @p img_cnt.
1482  *
1483  * @param       mb_svc_handle   [in]    the handle of DB
1484  * @param       cluster_id              [in]    the folder id in which media files are in. if the parameter is -1, then query all folders.
1485  * @param       img_cnt                 [in]    the count of cover thumbnails
1486  * @param       func                    [in]  Iterative callback implemented by a user. This callback is called when an thumbnail path has to be inserted to user's list.
1487  * @param       user_data       [out]   user's data structure to contain items of thumbnail path. It is passed to the iterative callback.
1488  *
1489  * @return      This function returns 0 on success, or negative value with error code.
1490  * @remarks     type of item is pointer to char*,
1491  *                      when free list, needn't free every string.
1492  * @see         None.
1493  * @pre         None
1494  * @post        None
1495  * @par example
1496  * @code
1497
1498         #include <media-svc.h>
1499
1500         int cover_ite_cb(char *thumb_path, void *user_data)
1501         {
1502                 GList** list = (GList**)user_data;
1503                 *list = g_list_append(*list, thumb_path);
1504         }
1505
1506         void test_minfo_get_cluster_cover(MediaSvcHandle *mb_svc_handle)
1507         {
1508                 int ret = -1;
1509                 GList *p_list = NULL;
1510                 int img_cnt = 5;
1511                 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
1512
1513                 //get the cover of a cluster.
1514                 ret = minfo_get_cluster_cover(mb_svc_handle, cluster_id, img_cnt, cover_ite_cb, &p_list);
1515                 if(ret< 0) { 
1516                         printf("test_minfo_get_cluster_cover error\n");
1517                         return;
1518                 }
1519         }
1520
1521   * @endcode
1522   */
1523
1524 int 
1525 minfo_get_cluster_cover(MediaSvcHandle *mb_svc_handle, const char *cluster_id, const int img_cnt, minfo_cover_ite_cb func, void *user_data);
1526
1527
1528 /**
1529  * minfo_get_bookmark_list
1530  * This function gets the type 'Mbookmark' instances list. Data of each this type instance is 
1531  * composed of the matched record indentified by the media id from  'video_bookmark' table. 
1532  * The type 'Mbookmark' mainly include the these information, like, bookmark id, media id, 
1533  * marked time, corresponding thumbnail pathanme, etc.
1534  *
1535  * @param       mb_svc_handle   [in]    the handle of DB
1536  * @param       media_id                [in]    media_id field of video_bookmark table record
1537  * @param       func                    [in]  Iterative callback implemented by a user. This callback is called when an item has to be inserted to user's list.
1538  * @param       user_data               [out]   User's data structure to contain items of the type Mbookmark. It is passed to the iterative callback.
1539  * @return      This function returns 0 on success, or negative value with error code.
1540  * @remarks        member data in list is pointer to structure Mbookmark,
1541  *                    when free list, it need free every item first and then free list itself.
1542  * @see         None.
1543  * @pre         None
1544  * @post        None
1545  * @par example
1546  * @code
1547
1548         #include <media-svc.h>
1549
1550         int mbookmark_ite_cb(Mbookmark *bm, void *user_data)
1551         {
1552                 GList** list = (GList**)user_data;
1553                 *list = g_list_append(*list, bm);
1554         }
1555
1556         void test_minfo_get_bookmark_list(MediaSvcHandle *mb_svc_handle)
1557         {
1558                 int ret = -1;
1559                 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
1560                 GList *p_list = NULL;
1561
1562         //get a linked list which will include all of bookmarks of a media file.
1563                 ret = minfo_get_bookmark_list(mb_svc_handle, media_id, mbookmar_ite_cb, &p_list);
1564                 if( ret < 0) {
1565                         return;
1566                 }
1567         }
1568   * @endcode     
1569  */
1570
1571 int
1572 minfo_get_bookmark_list(MediaSvcHandle *mb_svc_handle, const char *media_id, minfo_bm_ite_cb func, void *user_data);
1573
1574
1575 /**
1576  * minfo_get_geo_item_list
1577  * This function gets the type 'Mitem' instances list. Data of each instance is composed of the matched record identified 
1578  * by @p filter from 'media' table. Except that the got items pass the criterion of  @p filter, they should position where the longitude
1579  * is between @p min_longitude and @p max_longitude, and the latitude is between @p min_latitude and @p max_latitude.
1580 *  This function gets 'Mitem' list matched with latitude, longitude, filter and cluster id.
1581  * @param       mb_svc_handle   [in]    the handle of DB
1582  * @param       cluster_id              [in]    indicate the value, 'fold_id' field in 'media' table record
1583  * @param       filter                  [in]    specified filter to get matched media record
1584  * @param       store_filter    [in]    specified storage filter to get matched media record
1585  * @param       min_longitude   [in]     minimum value of 'longitude' field in 'vidoe_meta'/'image_meta' table
1586  * @param       max_longitude   [in]     maximum value of longitude field in 'vidoe_meta'/'image_meta' table
1587  * @param       min_latitude    [in]     minimum value of 'latitude' field in 'video_meta'/'image_meta' record
1588  * @param       max_latitude    [in]     maximum value of 'latitude' field in 'video_meta'/'image_meta' record
1589  * @param       func                    [in]    Iterative callback implemented by a user. This callback is called when an item has to be inserted to user's list.
1590  * @param       user_data               [out]   user's data structure to contain items of the type Mitem. It is passed to the iterative callback.
1591  * @return      This function returns 0 on success, or negative value with error code.
1592  * @remarks          item type in list is pointer to structure Mitem,
1593  *                    when free list, it need free every item first  and then free list itself. 
1594  * @see         None.
1595  * @pre         None
1596  * @post        None
1597  * @par example
1598  * @code
1599
1600         #include <media-svc.h>
1601
1602         int mitem_ite_cb(Mitem *item, void *user_data)
1603         {
1604                 GList** list = (GList**)user_data;
1605                 *list = g_list_append(*list, item);
1606         }
1607
1608     void test_minfo_get_geo_item_list(MediaSvcHandle *mb_svc_handle)
1609     {
1610                 int ret = -1; 
1611                 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
1612                 int min_longitude = 120.0;
1613                 int max_longitude = 123.0;
1614                 int min_latitude = 19.0;
1615                 int max_latitude = 24.0;
1616                 GList *p_list = NULL;
1617
1618                 //get a linked list which include a set of items based on their location.
1619                 ret = minfo_get_geo_item_list(mb_svc_handle,
1620                                                 cluster_id,
1621                                                 store_filter,
1622                                                 filter,
1623                                                 min_longitude,
1624                                                 max_longitude,
1625                                                 min_latitude,
1626                                                 max_latitude,
1627                                                 mitem_ite_cb,
1628                                                 &p_list);
1629                 if( ret < 0) {
1630                         printf("minfo_get_geo_item_list failed\n");
1631                         return;
1632                 }
1633     }
1634   * @endcode
1635  */
1636
1637 int
1638 minfo_get_geo_item_list(MediaSvcHandle *mb_svc_handle,
1639                                                 const char *cluster_id, 
1640                                                 minfo_folder_type store_filter,
1641                                                 minfo_item_filter filter, 
1642                                                 double min_longitude, 
1643                                                 double max_longitude, 
1644                                                 double min_latitude, 
1645                                                 double max_latitude,
1646                                                 minfo_item_ite_cb func,
1647                         void *user_data);
1648
1649
1650
1651 /**
1652  * minfo_get_thumb_path
1653  * This function gets thumbnail path of specified image file. When user could get the full pathname of a image content.
1654  * He/She wants to get the thumbnail file corresponding to the image content identified by the @p file_url.
1655  * User is responsible for allocating the memory for @p thumb_path so that this function could fill up the thumbnail pathname to it.
1656  * @param       mb_svc_handle   [in]    the handle of DB
1657  * @param       file_url                [in]    local file full path, identify a media record in 'media' table
1658  * @param       thumb_path              [out]   the returned thumbnail path of specified file, user is responsible for allocating memory for it first
1659  * @param       max_thumb_path  [in]    The max length of the returned thumbnail path
1660  *
1661  * @return      This function returns 0 on success, or negative value with error code.
1662  * @remarks     one file full path always matches one thumbnail path,
1663             here, it returns thumbnail path , but maybe thumbnail file doesn't exist, return NULL.
1664  * @see         minfo_get_thumb_path_for_video.
1665  * @pre         None
1666  * @post        None
1667  * @par example
1668  * @code
1669
1670         #include <media-svc.h>
1671
1672         void test_minfo_get_thumb_path(MediaSvcHandle *mb_svc_handle)
1673         {
1674                 int ret = -1;
1675                 char thumb_path[256] = {'\0'};
1676                 char *file_url = "/opt/media/Images/Wallpapers/Home_01.png";
1677
1678                 //get thumbnail pathname of an item.
1679                 ret = minfo_get_thumb_path(mb_svc_handle, file_url, thumb_path, sizeof(thumb_path));
1680                 if( ret < 0) {
1681                         printf("minfo_get_thumb_path failed\n");
1682                         return;
1683                 }
1684         }
1685 * @endcode
1686  */
1687
1688 int
1689 minfo_get_thumb_path(MediaSvcHandle *mb_svc_handle, const char* file_url, char* thumb_path, size_t max_thumb_path);
1690
1691 /**
1692  * minfo_get_thumb_path_for_video
1693  * This function gets thumbnail path of specified video file. When user could get the full pathname of a video content.
1694  * He/She wants to get the thumbnail file corresponding to the video content identified by the @p file_url.
1695  * User is responsible for allocating the memory for @p thumb_path so that this function could fill up the thumbnail pathname to it.
1696  * @param       mb_svc_handle   [in]    the handle of DB
1697  * @param       file_url                [in]    local file full path, identify a media record in 'media' table
1698  * @param       thumb_path              [out]   the returned thumbnail path of specified file, user is responsible for allocating memory for it first
1699  * @param       max_thumb_path  [in] The max length of the returned thumbnail path
1700  *
1701  * @return      This function returns 0 on success, or negative value with error code.
1702  * @remarks     one file full path always matches one thumbnail path,
1703             here, it returns thumbnail path , but maybe thumbnail file doesn't exist, return NULL.
1704  * @see         minfo_get_thumb_path.
1705  * @pre         None
1706  * @post        None
1707  * @par example
1708  * @code
1709
1710         #include <media-svc.h>
1711
1712         void test_minfo_get_thumb_path_for_video(MediaSvcHandle *mb_svc_handle)
1713         {
1714                 int ret = -1;
1715                 char thumb_path[256] = {'\0'};
1716                 char *file_url = "/opt/media/Images and videos/My video clip/Helicopter.mp4";
1717
1718                 //get thumbnail pathname of an item.
1719                 ret = minfo_get_thumb_path_for_video(mb_svc_handle, file_url,thumb_path, sizeof(thumb_path));
1720                 if( ret < 0) {
1721                         printf("minfo_get_thumb_path_for_video failed\n");
1722                         return;
1723                 }
1724         }
1725 * @endcode
1726  */
1727
1728 int
1729 minfo_get_thumb_path_for_video(MediaSvcHandle *mb_svc_handle, const char* file_url, char* thumb_path, size_t max_thumb_path);
1730
1731 /**
1732  * minfo_delete_media_id
1733  * This function deletes matched record identified by the @p media_id from 'media' table , 'video_meta'/'image_meta' record. 
1734  * After that, if the folder which this deleted file is in becomes empty, then delete the folder record from 'folder' table, too. 
1735  * In order that user could successfully delete the corresponding record from 'media' table, he/she should be able to the correct _id 
1736  * of media content before it.
1737  *
1738  * @param       mb_svc_handle   [in]    the handle of DB
1739  * @param       media_id                [in]    represent the value, media '_id' in 'media' table record
1740  * @return      This function returns 0 on success, or negative value with error code.
1741  * @remarks     None.
1742  * @see     minfo_delete_media.
1743  * @pre         None
1744  * @post        None
1745  * @par example
1746  * @code
1747
1748         #include <media-svc.h>
1749
1750         void test_minfo_delete_media_id(MediaSvcHandle *mb_svc_handle)
1751         {
1752                 int ret = -1;
1753                 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
1754
1755                 //delete an item according to its ID.
1756                 ret = minfo_delete_media_id(mb_svc_handle, media_id);
1757                 if( ret < 0) {
1758                         printf("test_minfo_delete_media_id failed\n");
1759                         return;
1760                 }
1761         }
1762 * @endcode
1763  */
1764
1765 int
1766 minfo_delete_media_id(MediaSvcHandle *mb_svc_handle, const char *media_id);
1767
1768 /**
1769  *      minfo_delete_all_media_records:\n
1770  *      This function delete all media records in a type of storage like phone or MMC.
1771  *      This function is always used for MMC card insert/inject operation, in file manager service library.
1772  *
1773  * @param       mb_svc_handle   [in]    the handle of DB
1774  * @param       storage_type    [in]    information for storage type
1775  * @return      This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
1776  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
1777  *      @see    None
1778  *      @pre    None
1779  *      @post   None
1780  *      @remark None
1781  *      @par example
1782  *      @code
1783
1784         #include <media-svc.h>
1785
1786         void test_minfo_delete_all_media_records(MediaSvcHandle *mb_svc_handle)
1787         {
1788                 int ret = MB_SVC_ERROR_NONE;
1789
1790                 //delete all media records in MMC storage in db.
1791                 ret = minfo_delete_all_media_records(mb_svc_handle, MINFO_MMC);
1792                 if (ret < 0) {
1793                         printf( "failed to delete items. error code->%d", ret);
1794                         return;
1795                 }
1796         }
1797
1798  *      @endcode
1799  */
1800
1801 int
1802 minfo_delete_all_media_records(MediaSvcHandle *mb_svc_handle, const minfo_store_type storage_type);
1803
1804 /**
1805  * minfo_cp_media
1806  * This function copies specified media file to another folder, which is identified by the folder id, @p dst_cluster_id. Meanwhile the copied media file
1807  * is identified by it's media id. Compared to API, minfo_copy_media, the different is , this function copy a media content to specified folder,
1808  * according to the media content id and the destination folder's id, however the function, minfo_copy_media, copy a media content to specified folder
1809  * according to the media file's full pathname and folder's full name.
1810  * @param       mb_svc_handle   [in]    the handle of DB
1811  * @param       src_media_id    [in]    id of the source media file, it's value is from '_id' field of the 'media' table
1812  * @param       dst_cluster_id  [in]    id of the destination folder, it's value is from '_id' field of the 'folder' table
1813  * @return      This function returns 0 on success, or negative value with error code.
1814  * @remarks     This function will implement the same functionality as minfo_copy_media.
1815  * @see  minfo_copy_media
1816  * @pre         None
1817  * @post        None
1818  * @par example
1819  * @code
1820
1821         #include <media-svc.h>
1822
1823         void test_minfo_cp_media(MediaSvcHandle *mb_svc_handle)
1824         {
1825                 int ret = -1;
1826                 const char *src_media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
1827                 const char *dst_cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
1828
1829                 //copy the a media file whose ID is specified by, 'src_media_id', to a cluster.
1830                 ret = minfo_cp_media(mb_svc_handle, src_media_id, dst_cluster_id);
1831                 if( ret < 0) {
1832                         printf("minfo_cp_media failed\n");
1833                         return;
1834                 }
1835         }
1836 * @endcode
1837  */
1838
1839 int
1840 minfo_cp_media(MediaSvcHandle *mb_svc_handle, const char *src_media_id, const char *dst_cluster_id);
1841
1842
1843
1844 /**
1845  * minfo_mv_media
1846  * This function moves specified media file to another folder, which is identified by the folder id, @p dst_cluster_id. Meanwhile the moved media file
1847  * is identified by it's media id. Compared to API, minfo_move_media, the difference is that this function moves a media content to specified folder,
1848  * according to the media content id and the destination folder's id, however the function, minfo_move_media, move a media content to specified folder
1849  * according to the media file's full pathname and folder's full name.
1850  * @param       mb_svc_handle   [in]    the handle of DB
1851  * @param       src_media_id    [in]    id of the source media file, it's value is from '_id' field of the 'media' table
1852  * @param       dst_cluster_id  [in]    id of the destination folder, it's value is from '_id' field of the 'folder'
1853  * @return      This function returns 0 on success, or negative value with error code.
1854  * @remarks     None.
1855  * @see   minfo_move_media.
1856  * @pre         None
1857  * @post        None
1858  * @par example
1859  * @code
1860
1861         #include <media-svc.h>
1862
1863         void test_minfo_mv_media(MediaSvcHandle *mb_svc_handle)
1864         {
1865                 int ret = -1;
1866                 const char *src_media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
1867                 const char *dst_cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
1868
1869         //move an item to specified cluster.
1870                 ret = minfo_mv_media(mb_svc_handle, src_media_id, dst_cluster_id);
1871                 if( ret < 0) {
1872                         printf("minfo_mv_media failed\n");
1873                         return;
1874                 }
1875         }
1876 * @endcode
1877  */
1878
1879
1880 int
1881 minfo_mv_media(MediaSvcHandle *mb_svc_handle, const char *src_media_id, const char *dst_cluster_id);
1882
1883
1884
1885 /**
1886  * minfo_delete_cluster
1887  * This function deletes specified cluster, which is identified by the @p cluster_id. When user launch Gallery and in edit 'Albums' mode, if he/she
1888  * want to delete a cluster/folder, so call this function to do it. When delete a cluster/folder, the media-svc will not only delete the record in 'folder' table,
1889  * but delete all of records in 'media' table which are located in this folder, meanwhile delete the corresponding records in 'video_bookmark' table, etc.
1890  * @param       mb_svc_handle   [in]    the handle of DB
1891  * @param       cluster_id              [in]    cluster id, to indicate the deleted folder/cluster
1892  * @return      This function returns 0 on success, or negative value with error code.
1893  * @remarks delete all releated contents in cluster together with cluster
1894  *          like all media files, image/video meta,bookmark information.
1895  * @see   minfo_add_cluster
1896  * @pre         None
1897  * @post        None
1898  * @par example
1899  * @code
1900
1901
1902         #include <media-svc.h>
1903
1904         void test_minfo_delete_cluster(MediaSvcHandle *mb_svc_handle)
1905         {
1906         int ret = -1;
1907                 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
1908
1909                 //delete a cluster record, meanwhile this function will delete all of items owned by this cluster.
1910                 ret = minfo_delete_cluster(mb_svc_handle, cluster_id);
1911                 if( ret < 0) {
1912                         printf("minfo_delete_cluster failed\n");
1913                         return;
1914                 }
1915         }
1916 * @endcode
1917  */
1918
1919 int
1920 minfo_delete_cluster(MediaSvcHandle *mb_svc_handle, const char *cluster_id);
1921
1922
1923
1924 /**
1925  * minfo_update_cluster_name
1926  * This function updates the specified cluster name using @p new_name, which just indicate the new folder name. User could 
1927  * call this function, when he/she wants to change some folder/cluster name. This really update the corresponding record in 
1928  * 'folder' table.
1929  * @param       mb_svc_handle   [in]    the handle of DB
1930  * @param       cluster_id              [in]    cluster id, this value is from the '_id' field of 'folder' table
1931  * @param       new_name                [in]    new cluster name
1932  * @return      This function returns 0 on success, or negative value with error code.
1933  * @remarks     None.
1934  * @see   None.
1935  * @pre         None
1936  * @post        None
1937  * @par example
1938  * @code
1939
1940         #include <media-svc.h>
1941
1942         void test_minfo_update_cluster_name(MediaSvcHandle *mb_svc_handle)
1943         {
1944                 int ret = -1;
1945                 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
1946                 char *new_name = "newfolder";
1947
1948                 //update a cluster's name
1949                 ret = minfo_update_cluster_name(mb_svc_handle, cluster_id,new_name);
1950                 if( ret < 0) {
1951                         printf("minfo_update_cluster_name failed\n");
1952                         return;
1953                 }
1954         }
1955 * @endcode
1956  */
1957
1958 int
1959 minfo_update_cluster_name(MediaSvcHandle *mb_svc_handle, const char *cluster_id, const char* new_name);
1960
1961 /**
1962  * minfo_update_cluster_date
1963  * This function updates the specified cluster modified date using @p modified_date, which just indicate the new modified date. User could 
1964  * call this function, when he/she wants to change some clsuter's modified date. This really update the corresponding record in the DB
1965  * @param       mb_svc_handle   [in]    the handle of DB
1966  * @param       cluster_id              [in]    cluster id, this value is the identifier of the cluster
1967  * @param       modified_date   [in]    date to modify, which is a type of time_t
1968  * @return      This function returns zero(MB_SVC_ERROR_BASE) on success, or negative value with error code.
1969  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
1970  * @remarks     None.
1971  * @see   None.
1972  * @pre         None
1973  * @post        None
1974  * @par example
1975  * @code
1976
1977         #include <media-svc.h>
1978         #include <time.h>
1979
1980         void test_minfo_update_cluster_date(void)
1981         {
1982                 int ret = -1;
1983                 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
1984                 time_t today;
1985                 time(&today);
1986
1987                 //update a cluster's name
1988                 ret = minfo_update_cluster_date(cluster_id, today);
1989
1990                 if( ret < 0) {
1991                         printf("minfo_update_cluster_date failed\n");
1992                         return;
1993                 }
1994      }
1995 * @endcode
1996  */
1997
1998 int
1999 minfo_update_cluster_date(MediaSvcHandle *mb_svc_handle, const char *cluster_id,  time_t modified_date);
2000
2001
2002
2003 /**
2004  * minfo_add_bookmark
2005  * This function inserts new bookmark record into 'video_bookmark' table. The inserted data should include marked time of video content, @p position 
2006  * and @p thumb_path, current extracted thumbnail file in marked time, etc. User should use @p media_id to identify the 
2007  * video content, so that add bookmark to it.
2008  * @param       mb_svc_handle   [in]    the handle of DB
2009  * @param       media_id                [in]    media file id, uniquely identify the media content
2010  * @param       position                [in]    marked time of the media file
2011  * @param       thumb_path              [in]    the extracted thumbnail path for this marked time
2012  * @return      This function returns 0 on success, or negative value with error code.
2013  * @remarks                         if add same input parameters twice, it fails
2014  * @see    minfo_delete_bookmark
2015  * @pre         None
2016  * @post        None
2017  * @par example
2018  * @code
2019
2020
2021         #include <media-svc.h>
2022
2023         void test_minfo_add_bookmark(MediaSvcHandle *mb_svc_handle)
2024         {
2025                 int ret = -1;
2026                 int position = 2346;
2027                 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
2028                 char *thumb_path = "tmp1";
2029
2030                 //add a bookmark which include position, thumbnail, etc. to an item.
2031                 ret = minfo_add_bookmark(mb_svc_handle, media_id,position,thumb_path);
2032                 if( ret < 0) {
2033                         printf("minfo_add_bookmark failed\n");
2034                         return;
2035                 }
2036      }
2037 * @endcode
2038  */
2039
2040
2041 int
2042 minfo_add_bookmark(MediaSvcHandle *mb_svc_handle, const char *media_id, const int position, const char* thumb_path);
2043
2044
2045 /**
2046  * minfo_delete_bookmark
2047  * This function deletes specified bookmark record from 'video_bookmark' table, the deleted bookmark should be identified by @p bookmark_id.
2048  * This function actually call the sqlite3 statement, 
2049  * "DELETE FROM video_bookmark WHERE _id = bookmark_id; "
2050  * In gallery or ug-imageviewer, user could get a linked list bookmark for some media file, so he/she could delete one of them using @p bookmark_id.
2051  *
2052  * @param       mb_svc_handle   [in]    the handle of DB
2053  * @param       bookmark_id             [in]    _id field in video_bookmark table.
2054  * @return      This function returns 0 on success, or negative value with error code.
2055  * @remarks     user should give a correct bookmark ID to successfully delete it.
2056  * @see  minfo_add_bookmark
2057  * @pre         None
2058  * @post        None
2059  * @par example
2060  * @code
2061
2062
2063         #include <media-svc.h>
2064
2065         void test_minfo_delete_bookmark(MediaSvcHandle *mb_svc_handle)
2066         {
2067                 int ret = -1;
2068                 int bookmark_id = 1;
2069
2070                 //delete a bookmark record in 'video_bookmark' table.
2071                 ret = minfo_delete_bookmark(mb_svc_handle, bookmark_id);
2072
2073                 if( ret < 0) {
2074                         printf("minfo_delete_bookmark failed\n");
2075                         return;
2076                 }
2077      }
2078 * @endcode
2079  */
2080
2081 int
2082 minfo_delete_bookmark(MediaSvcHandle *mb_svc_handle, const int bookmark_id);
2083
2084
2085
2086
2087 /**
2088 * minfo_get_cluster_id_by_url
2089 * This function gets some folder's full path. This will be called when user want to know what one folder's unique
2090 * ID is.
2091 *
2092 * @return                                       This function returns 0 on success, and -1 on failure.
2093 * @param        mb_svc_handle   [in]    the handle of DB
2094 * @param        url                             [in]    folder  path
2095 * @param        cluster_id              [out]   folder ID
2096 * @exception    None.
2097 * @remarks              None.
2098 * @see  None.
2099 * @pre  None
2100 * @post None
2101 * @par example
2102 * @code
2103
2104         #include <media-svc.h>
2105
2106         void test_minfo_get_cluster_id_by_url(MediaSvcHandle *mb_svc_handle)
2107         {
2108                 int ret = -1;
2109                 char cluster_id[256] = {0,};
2110                 char *url = "/opt/media/Images/Wallpapers";
2111
2112                 //get cluster's ID using cluster's url.
2113                 ret = minfo_get_cluster_id_by_url(url, cluster_id, sizeof(mb_svc_handle, cluster_id));
2114                 if( ret < 0) {
2115                         printf("test_minfo_get_cluster_id_by_url failed\n");
2116                         return;
2117                 }
2118      }
2119 * @endcode
2120 */
2121 int 
2122 minfo_get_cluster_id_by_url(MediaSvcHandle *mb_svc_handle, const char* url, char* cluster_id, int max_length);
2123
2124
2125 /**
2126 * minfo_get_cluster_name_by_id
2127 * This function gets folder's name. This will be called when user want to know what one folder's name
2128 *
2129 * @return       This function returns 0 on success, and -1 on failure.
2130 * @param[in]    mb_svc_handle   the handle of DB
2131 * @param[in]    cluster_id              folder ID
2132 * @param[out]   cluster_name    folder name
2133 * @param[in]    max_length              The max length of the returned folder name.
2134 * @exception    None.
2135 * @remarks      None.
2136 * @see  None.
2137 * @pre  None
2138 * @post None
2139 * @par example
2140 * @code
2141
2142         #include <media-svc.h>
2143
2144         void test_minfo_get_cluster_name_by_id(MediaSvcHandle *mb_svc_handle)
2145         {
2146                 int ret = -1;
2147                 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
2148                 char *cluster_name[1024];
2149
2150                 //get cluster's name using cluster's id.
2151                 ret = minfo_get_cluster_name_by_id(mb_svc_handle, cluster_id, cluster_name, sizeof(cluster_name));
2152
2153                 if( ret < 0) {
2154                         printf("test_minfo_get_cluster_name_by_id failed\n");
2155                         return;
2156                 } else {
2157                         printf("cluster name is %s\n", cluster_name);
2158                         return;
2159                 }
2160         }
2161 * @endcode
2162 */
2163 int 
2164 minfo_get_cluster_name_by_id(MediaSvcHandle *mb_svc_handle, const char *cluster_id, char *cluster_name, int max_length );
2165
2166 /**
2167 * minfo_get_cluster_fullpath_by_id
2168 * This function gets folder's full path. This will be called when user want to know what one folder's full path.
2169 * User should specify the maximum length of the @p folder_path, so as to avoid over flow of the string.
2170 *
2171 * @return       This function returns 0 on success, and -1 on failure.
2172 * @param[in]    mb_svc_handle   the handle of DB
2173 * @param[in]    cluster_id              folder ID
2174 * @param[out]   folder_path             folder path name
2175 * @param[in]    max_length              specify the maximum length of @p folder_path.
2176 * @exception    None.
2177 * @remarks      None.
2178 * @see  None.
2179 * @pre  None
2180 * @post None
2181 * @par example
2182 * @code
2183
2184         #include <media-svc.h>
2185
2186         void test_minfo_get_cluster_fullpath_by_id(MediaSvcHandle *mb_svc_handle)
2187         {
2188                 int ret = -1;
2189                 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
2190                 char *folder_path[1024];
2191
2192                 //get cluster's path name using cluster's id.
2193                 ret = minfo_get_cluster_fullpath_by_id(mb_svc_handle, cluster_id, folder_path, sizeof(folder_path));
2194
2195                 if( ret < 0) {
2196                         printf("test_minfo_get_cluster_fullpath_by_id failed\n");
2197                         return;
2198                 } else {
2199                         printf("path name is %s\n", cluster_name);
2200                         return;
2201                 }
2202      }
2203 * @endcode
2204 */
2205
2206 int
2207 minfo_get_cluster_fullpath_by_id(MediaSvcHandle *mb_svc_handle, const char *cluster_id, char *folder_path, int max_length);
2208
2209
2210
2211 /**
2212 * minfo_set_cluster_lock_status
2213 * @fn     int  minfo_set_cluster_lock_status( int cluster_id, int lock_status );
2214 * This function set status for lock to DB. This will be called when user want to set to lock an album.
2215 *
2216 * @return       This function returns 0 on success, and -1 on failure.
2217 * @param[in]    mb_svc_handle   the handle of DB
2218 * @param[in]    cluster_id              folder ID
2219 * @param[in]    lock_status             status for lock to be saved ( 0 : unlock, 1 : lock )
2220 * @exception    None.
2221 * @remarks      None.
2222 * @see  minfo_get_cluster_lock_status.
2223 * @pre  None
2224 * @post None
2225 * @par example
2226 * @code
2227
2228         #include <media-svc.h>
2229
2230         void test_minfo_set_cluster_lock_status(MediaSvcHandle *mb_svc_handle)
2231         {
2232                 int ret = -1;
2233                 int status = 1;
2234                 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
2235
2236                 //set s cluster lock status.
2237                 ret = minfo_set_cluster_lock_status(mb_svc_handle, cluster_id, status);
2238
2239                 if( ret < 0) {
2240                         printf("test_minfo_set_cluster_lock_status failed\n");
2241                         return;
2242                 }
2243         }
2244 * @endcode
2245 */
2246
2247 int
2248 minfo_set_cluster_lock_status(MediaSvcHandle *mb_svc_handle, const char *cluster_id, int lock_status);
2249
2250 /**
2251 * minfo_get_cluster_lock_status
2252 * @fn     int  minfo_get_cluster_lock_status( int cluster_id, int *lock_status );
2253 * This function gets status for lock from DB.  This will be called when user want to get lock status for an album.
2254 *
2255 * @return       This function returns 0 on success, and -1 on failure.
2256 * @param[in]    mb_svc_handle   the handle of DB
2257 * @param[in]    cluster_id              folder ID
2258 * @param[out]   lock_status             status for cuurent lock status
2259 * @exception    None.
2260 * @remarks      None.
2261 * @see  minfo_set_cluster_lock_status.
2262 * @pre  None
2263 * @post None
2264 * @par example
2265 * @code
2266
2267         #include <media-svc.h>
2268
2269         void test_minfo_get_cluster_lock_status(MediaSvcHandle *mb_svc_handle)
2270         {
2271                 int ret = -1;
2272                 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
2273                 int status = -1;
2274
2275                 //get a cluster's status.
2276                 ret = minfo_get_cluster_lock_status(mb_svc_handle, cluster_id, &status);
2277
2278                 if( ret < 0) {
2279                         printf("test_minfo_get_cluster_lock_status failed\n");
2280                         return;
2281                 } else {
2282                         print("Current status : %d\n", status);
2283                         return;
2284                 }
2285         }
2286 * @endcode
2287 */
2288
2289 int
2290 minfo_get_cluster_lock_status(MediaSvcHandle *mb_svc_handle, const char *cluster_id, int *lock_status );
2291
2292 /**
2293 * @fn     int  minfo_get_media_path( minfo_store_type storage_type, char* media_path, size_t max_media_path);
2294 * This function gets the path of media.  This will be called when user want to get path of direcotry containing media in device.
2295 *
2296 * @return       This function returns 0 on success, and -1 on failure.
2297 * @param[in]    storage_type    store type, which means type of device containg media.
2298 * @param[out]   media_path              path of media
2299 * @param[in]    max_media_path  The max length of the returned media_path.
2300 * @exception    None.
2301 * @remarks      None.
2302 * @see  None.
2303 * @pre  None
2304 * @post None
2305 * @par example
2306 * @code
2307
2308         #include <media-svc.h>
2309
2310         void test_minfo_get_media_path(void)
2311         {
2312                 int ret = -1;
2313                 char media_path[256] = {'\0'};
2314
2315                 //get media's fullpath.
2316                 ret = minfo_get_media_path(MINFO_PHONE, media_path, sizeof(media_path));
2317
2318                 if( ret < 0) {
2319                         printf("minfo_get_media_path failed\n");
2320                         return;
2321                 } else {
2322                         print("The returned path : %s\n", media_path);
2323                         return;
2324                 }
2325         }
2326 * @endcode
2327 */
2328
2329 int
2330 minfo_get_media_path(minfo_store_type storage_type, char* media_path, size_t max_media_path );
2331
2332
2333 /**
2334  *      minfo_set_db_valid
2335  *      This function set whether all the media contents in a type of storage are valid, like phone or MMC.
2336  *      Actually media service will filter all the media contents query from database by the media validation.
2337  *      This function is always used for MMC card insert/inject operation, in file manager service library.
2338  *      When inject a MMC card, the media records for MMC are not deleted really, but are set to be invalid.
2339  *
2340  *      @param[in]      mb_svc_handle   the handle of DB
2341  *      @param[in]      storage_type    information for storage type
2342  *      @param[in]      valid                   whether the track item is valid.
2343  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2344  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2345  *      @see    minfo_delete_invalid_media_records.
2346  *      @pre    None
2347  *      @post   None
2348  *      @remarks        None
2349  *      @par example
2350  *      @code
2351
2352 #include <media-svc.h>
2353
2354 void set_db_valid(MediaSvcHandle *mb_svc_handle)
2355 {
2356         int ret = MB_SVC_ERROR_NONE;
2357         bool valid = TRUE;
2358
2359         //set the validation of medias in MMC storage in db.
2360         ret = minfo_set_db_valid(mb_svc_handle, MINFO_MMC, valid);
2361         if (ret < 0) {
2362                 printf( "failed to set db invalid. error code->%d", ret);
2363                 return;
2364         }
2365 }
2366
2367  *      @endcode
2368  */
2369
2370 int minfo_set_db_valid(MediaSvcHandle *mb_svc_handle, const minfo_store_type storage_type, int valid);
2371
2372 /**
2373  *      minfo_set_item_valid_start
2374  *      This function set whether the media content in a type of storage is valid, like phone or MMC.
2375  *      Actually media service will filter all the media contents query from database by the media validation.
2376  *
2377  *      @param[in]      mb_svc_handle   the handle of DB
2378  *      @param[in]      trans_count             count of trasaction user wants
2379  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2380  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2381  *      @see    minfo_set_item_valid, minfo_set_item_valid_end
2382  *      @pre    None
2383  *      @post   None
2384  *      @remarks        None
2385  *      @par example
2386  *      @code
2387
2388 #include <media-svc.h>
2389
2390 void set_item_valid_batch(MediaSvcHandle *mb_svc_handle)
2391 {
2392         int i;
2393         int ret = MB_SVC_ERROR_NONE;
2394         bool valid = TRUE;
2395
2396         ret = minfo_set_item_valid_start(mb_svc_handle, 100);
2397         if (ret < 0) {
2398                 printf( "minfo_set_item_valid_start failed. error code->%d", ret);
2399                 return;
2400         }
2401
2402         for (i = 0; i < 200; i++) {
2403                 //set the validation of a media in MMC storage in db.
2404                 ret = minfo_set_item_valid(mb_svc_handle, MINFO_MMC, image_files[i], valid);
2405                 if (ret < 0) {
2406                         printf( "failed to set item valid. error code->%d", ret);
2407                         return;
2408                 }
2409         }
2410
2411         ret = minfo_set_item_valid_end(mb_svc_handle);
2412         if (ret < 0) {
2413                 printf( "minfo_set_item_valid_end failed. error code->%d", ret);
2414                 return;
2415         }
2416
2417         return;
2418 }
2419
2420  *      @endcode
2421  */
2422
2423 int minfo_set_item_valid_start(MediaSvcHandle *mb_svc_handle, int trans_count);
2424
2425
2426 /**
2427  *      minfo_set_item_valid_end
2428  *      This function set whether the media content in a type of storage is valid, like phone or MMC.
2429  *      Actually media service will filter all the media contents query from database by the media validation.
2430  *
2431  *      @param[in]      mb_svc_handle   the handle of DB
2432  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2433  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2434  *      @see    minfo_set_item_valid_start, minfo_set_item_valid
2435  *      @pre    None
2436  *      @post   None
2437  *      @remarks        None
2438  *      @par example
2439  *      @code
2440
2441 #include <media-svc.h>
2442
2443 void set_item_valid_batch(MediaSvcHandle *mb_svc_handle)
2444 {
2445         int i;
2446         int ret = MB_SVC_ERROR_NONE;
2447         bool valid = TRUE;
2448
2449         ret = minfo_set_item_valid_start(mb_svc_handle, 100);
2450         if (ret < 0) {
2451                 printf( "minfo_set_item_valid_start failed. error code->%d", ret);
2452                 return;
2453         }
2454
2455         for (i = 0; i < 200; i++) {
2456                 //set the validation of a media in MMC storage in db.
2457                 ret = minfo_set_item_valid(mb_svc_handle, MINFO_MMC, image_files[i], valid);
2458                 if (ret < 0) {
2459                         printf( "failed to set item valid. error code->%d", ret);
2460                         return;
2461                 }
2462         }
2463
2464         ret = minfo_set_item_valid_end(mb_svc_handle);
2465         if (ret < 0) {
2466                 printf( "minfo_set_item_valid_end failed. error code->%d", ret);
2467                 return;
2468         }
2469
2470         return;
2471 }
2472
2473  *      @endcode
2474  */
2475 int minfo_set_item_valid_end(MediaSvcHandle *mb_svc_handle);
2476
2477
2478 /**
2479  *      minfo_set_item_valid
2480  *      This function set whether the media content in a type of storage is valid, like phone or MMC.
2481  *      Actually media service will filter all the media contents query from database by the media validation.
2482  *
2483  *      @param[in]      mb_svc_handle   the handle of DB
2484  *      @param[in]      storage_type    information for storage type
2485  *      @param[in]      full_path               The path of the media
2486  *      @param[in]      valid                   whether the track item is valid.
2487  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2488  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2489  *      @see    minfo_set_item_valid_start, minfo_set_item_valid_end
2490  *      @pre    None
2491  *      @post   None
2492  *      @remarks        None
2493  *      @par example
2494  *      @code
2495
2496 #include <media-svc.h>
2497
2498 void set_item_valid_batch(MediaSvcHandle *mb_svc_handle)
2499 {
2500         int i;
2501         int ret = MB_SVC_ERROR_NONE;
2502         bool valid = TRUE;
2503
2504         ret = minfo_set_item_valid_start(mb_svc_handle, 100);
2505         if (ret < 0) {
2506                 printf( "minfo_set_item_valid_start failed. error code->%d", ret);
2507                 return;
2508         }
2509
2510         for (i = 0; i < 200; i++) {
2511                 //set the validation of a media in MMC storage in db.
2512                 ret = minfo_set_item_valid(mb_svc_handle, MINFO_MMC, image_files[i], valid);
2513                 if (ret < 0) {
2514                         printf( "failed to set item valid. error code->%d", ret);
2515                         return;
2516                 }
2517         }
2518
2519         ret = minfo_set_item_valid_end(mb_svc_handle);
2520         if (ret < 0) {
2521                 printf( "minfo_set_item_valid_end failed. error code->%d", ret);
2522                 return;
2523         }
2524
2525         return;
2526 }
2527
2528  *      @endcode
2529  */
2530
2531
2532 int minfo_set_item_valid(MediaSvcHandle *mb_svc_handle,
2533                                 const minfo_store_type storage_type,
2534                                 const char *full_path,
2535                                 int valid);
2536
2537
2538 /**
2539  *      minfo_delete_invalid_media_records
2540  *      This function delete all of invalid media records in a type of storage are valid, like phone or MMC.
2541  *      Actually media service will filter all the media contents query from database by the media validation.
2542  *      This function is always used for MMC card insert/inject operation, in file manager service library.
2543  *      When inject a MMC card, the media records for MMC are not deleted really, but are set to be invalid.
2544  *
2545  *      @param[in]      mb_svc_handle   the handle of DB
2546  *      @param[in]   storage_type       information for storage type
2547  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2548  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2549  *      @see    minfo_set_db_valid.
2550  *      @pre    None
2551  *      @post   None
2552  *      @remarks        None
2553  *      @par example
2554  *      @code
2555
2556 #include <media-svc.h>
2557
2558 void test_minfo_delete_invalid_media_records(MediaSvcHandle *mb_svc_handle)
2559 {
2560         int ret = MB_SVC_ERROR_NONE;
2561
2562         //delete the invalid media records in MMC storage in db.
2563         ret = minfo_delete_invalid_media_records(mb_svc_handle, MINFO_MMC);
2564         if (ret < 0) {
2565                 printf( "failed to delete invalid items. error code->%d", ret);
2566                 return;
2567         }
2568 }
2569
2570  *      @endcode
2571  */
2572
2573 int
2574 minfo_delete_invalid_media_records(MediaSvcHandle *mb_svc_handle, const minfo_store_type storage_type);
2575
2576 /**
2577  *      minfo_delete_tag
2578  *      This function could delete a tag or some member of the tag in 'media_tag' table in database. When user pass @p media_id not equal
2579  *    to -1, the tag will be deleted, otherwise some member of the tag will be deleted. Whatever cases, user should pass the correct tag name with
2580  *    @p tag_name to successfully delete.
2581  *
2582  *      @param[in]      mb_svc_handle   the handle of DB
2583  *      @param[in]      media_id        identify a media item with this ID
2584  *      @param[in]      tag_name        name of deleted tag
2585  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2586  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2587  *      @see    None.
2588  *      @pre    None
2589  *      @post   None
2590  *      @remarks        None
2591  *      @par example
2592  *      @code
2593
2594 #include <media-svc.h>
2595
2596 void delete_a_tag(MediaSvcHandle *mb_svc_handle)
2597 {
2598         int ret = MB_SVC_ERROR_NONE;
2599
2600         //delete all tag records in 'media_tag' in db, whose tag name is 'test_tag'.
2601         ret = minfo_delete_tag(mb_svc_handle, -1, "test tag");
2602         if (ret < 0) {
2603                 printf( "failed to delete a tag record. error code->%d", ret);
2604                 return;
2605         }
2606 }
2607
2608  *      @endcode
2609  */
2610
2611 int
2612 minfo_delete_tag(MediaSvcHandle *mb_svc_handle, const char *media_id, const char* tag_name);
2613
2614
2615 /**
2616  *      minfo_rename_tag:
2617  *      This function could rename a tag_name  to another tag_name in 'media_tag' table in database. User need to pass @p src_tagname which indicate original 
2618  *    tag name, @p dst_tag_name which is new tag name replacing @p src_tagname. This function will check whether the new tag name, @p dst_tag_name, has
2619  *    existed in 'media_tag' table. If yes, this function will item by item replace old tag name, if no, this function will directly update old tag name to new tag name.
2620  *
2621  *      @param[in]      mb_svc_handle   the handle of DB
2622  *      @param[in]      src_tagname             identify original tag name
2623  *      @param[in]      dst_tag_name    new tag name.
2624  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2625  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2626  *      @see    None.
2627  *      @pre    None
2628  *      @post   None
2629  *      @remarks        None
2630  *      @par example
2631  *      @code
2632
2633 #include <media-svc.h>
2634
2635 void test_minfo_rename_tag(MediaSvcHandle *mb_svc_handle)
2636 {
2637         int ret = MB_SVC_ERROR_NONE;
2638
2639         //rename all tag records with new tag name 'test_tag2'.
2640         ret = minfo_rename_tag(mb_svc_handle, "test tag1", "test tag2");
2641         if (ret < 0) {
2642                 printf( "failed to rename tag records. error code->%d", ret);
2643                 return;
2644         }
2645 }
2646
2647  *      @endcode
2648  */
2649
2650 int
2651 minfo_rename_tag(MediaSvcHandle *mb_svc_handle, const char* src_tagname, const char* dst_tag_name);
2652
2653 /**
2654  *      minfo_rename_tag_by_id:
2655  *      This function could rename a tag_name for some tag record to another tag_name in 'media_tag' table in database. User need to pass @p src_tagname which indicate original 
2656  *    tag name, @p media_id which combine with the @p src_tagname to indentify one tag record, @p dst_tag_name which is new tag name replacing @p src_tagname. 
2657  *    This function will check whether the new tag name with @p media_id has existed in 'media_tag' table. If yes, this function will delete old tag record, if no, this function will directly 
2658  *    update old tag record  to new tag record.
2659  *
2660  *      @param[in]      mb_svc_handle   the handle of DB
2661  *      @param[in]      media_id                identify original tag record with @p src_tagname
2662  *      @param[in]      src_tagname             identify original tag record with @p media_id
2663  *      @param[in]      dst_tag_name    new tag name.
2664  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2665  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2666  *      @see    None.
2667  *      @pre    None
2668  *      @post   None
2669  *      @remarks        None
2670  *      @par example
2671  *      @code
2672
2673 #include <media-svc.h>
2674
2675 void test_minfo_rename_tag_by_id(MediaSvcHandle *mb_svc_handle)
2676 {
2677         int ret = MB_SVC_ERROR_NONE;
2678         const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
2679
2680         //rename some tag record with new tag name 'test_tag2'.
2681         ret = minfo_rename_tag_by_id(mb_svc_handle, media_id, "test tag1", "test tag2");
2682         if (ret < 0) {
2683                 printf( "failed to rename tag records. error code->%d", ret);
2684                 return;
2685         }
2686 }
2687
2688  *      @endcode
2689  */
2690
2691 int
2692 minfo_rename_tag_by_id(MediaSvcHandle *mb_svc_handle, const char *media_id, const char* src_tagname, const char* dst_tag_name);
2693
2694
2695
2696
2697 /**
2698  *      minfo_add_tag:
2699  *      This function could add a new tag into 'media_tag' table in database. When user create a new tag and will
2700  *    not add any media item to it, he/she should set @p media_id as 0. When user create a new tag and want to add 
2701  *    some media items to it, he/she should do a loop to insert them into 'media_tag' table in database, meanwhile
2702  *    should fill up @p media_id and @p tag_name with appropriate values.
2703  *
2704  *      @param[in]      mb_svc_handle   the handle of DB
2705  *      @param[in]      media_id                identify a media item with this ID
2706  *      @param[in]      tag_name                name of new added tag
2707  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2708  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2709  *      @see    None.
2710  *      @pre    None
2711  *      @post   None
2712  *      @remarks        None
2713  *      @par example
2714  *      @code
2715
2716 #include <media-svc.h>
2717
2718 void add_a_tag(MediaSvcHandle *mb_svc_handle)
2719 {
2720         int ret = MB_SVC_ERROR_NONE;
2721
2722         //add a tag record in 'media_tag' in db, and not add any media item to it.
2723         ret = minfo_add_tag(mb_svc_handle, NULL, "test tag");
2724         if (ret < 0)
2725         {
2726                 printf( "failed to add a tag record. error code->%d", ret);
2727                 return;
2728         }
2729
2730         return;
2731 }
2732
2733  *      @endcode
2734  */
2735
2736 int
2737 minfo_add_tag(MediaSvcHandle *mb_svc_handle, const char *media_id, const char* tag_name);
2738
2739 /**
2740  *      minfo_get_media_list_by_tagname:
2741  *      This function could get a media items' list who are included to the same tag according to tag name .
2742  *      User could dictate whether he/she hope to get meta data of media item with @p with_meta. Yes if TRUE,
2743  *    no if FALSE.
2744  *
2745  *      @param[in]      mb_svc_handle   the handle of DB
2746  *      @param[in]      tag_name        tag name
2747  *      @param[in]      with_meta       indicate whether want to get meta data of media item
2748  *      @param[in]      func            Iterative callback implemented by a user. This callback is called when an item has to be inserted to user's list.
2749  *      @param[out]     user_data       user's data structure to contain items of the type Mitem. It is passed to the iterative callback.
2750  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2751  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2752  *      @see    None.
2753  *      @pre    None
2754  *      @post   None
2755  *      @remarks        None
2756  *      @par example
2757  *      @code
2758
2759 #include <media-svc.h>
2760
2761 int mitem_ite_cb(Mitem *item, void *user_data)
2762 {
2763         GList** list = (GList**)user_data;
2764         *list = g_list_append(*list, item);
2765 }
2766
2767
2768 void get_media_list_tag_name(MediaSvcHandle *mb_svc_handle)
2769 {
2770         int ret = MB_SVC_ERROR_NONE;
2771         GList *p_list = NULL;
2772
2773         //get a media items' list who are included to the same tag with 'test tag'.
2774         ret = minfo_get_media_list_by_tagname(mb_svc_handle, "test tag", FALSE, mitem_ite_cb, &p_list);
2775         if (ret < 0) {
2776                 printf( "failed to get a media items' list. error code->%d", ret);
2777                 return;
2778         }
2779 }
2780
2781  *      @endcode
2782  */
2783
2784 int
2785 minfo_get_media_list_by_tagname(MediaSvcHandle *mb_svc_handle, const char* tag_name, bool with_meta, minfo_item_ite_cb func, void* user_data );
2786
2787 /**
2788  *      minfo_get_media_list_by_tagname_with_filter:
2789  *      This function could get a media items' list who are included to the same tag according to tag name and filter.
2790  *      User could dictate whether he/she hope to get meta data of media item with @p with_meta. Yes if TRUE,
2791  *  no if FALSE.
2792  *
2793  *      @param[in]      mb_svc_handle   the handle of DB
2794  *      @param[in]      tag_name                tag name
2795  *  @param[in]  filter                  the filter to specify some tag filter conditions, like, type of got items, sort by type, start and end positions of items, including meta data or not, etc.
2796  *      @param[in]      func                    Iterative callback implemented by a user. This callback is called when an item has to be inserted to user's list.
2797  *      @param[out]     user_data               user's data structure to contain items of the type Mitem. It is passed to the iterative callback.
2798  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2799  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2800  *      @see    None.
2801  *      @pre    None
2802  *      @post   None
2803  *      @remarks        None
2804  *      @par example
2805  *      @code
2806
2807 #include <media-svc.h>
2808
2809 int mitem_ite_cb(Mitem *item, void *user_data)
2810 {
2811         GList** list = (GList**)user_data;
2812         *list = g_list_append(*list, item);
2813 }
2814
2815
2816 void get_media_list_by_tagname_with_filter(MediaSvcHandle *mb_svc_handle)
2817 {
2818         int ret = MB_SVC_ERROR_NONE;
2819         GList *p_list = NULL;
2820         minfo_tag_filter filter;
2821
2822         filter.start_pos = 0;
2823         filter.end_pos = 3;
2824         filter.file_type = MINFO_ITEM_ALL;
2825         filter.with_meta = FALSE;
2826
2827         //get a media items' list who are included to the same tag with 'test tag'.
2828         ret = minfo_get_media_list_by_tagname_with_filter(mb_svc_handle, "test tag", filter, mitem_ite_cb, &p_list);
2829         if (ret < 0) {
2830                 printf( "failed to get a media items' list. error code->%d", ret);
2831                 return;
2832         }
2833 }
2834
2835  *      @endcode
2836  */
2837
2838 int
2839 minfo_get_media_list_by_tagname_with_filter(MediaSvcHandle *mb_svc_handle, const char* tag_name, minfo_tag_filter filter, minfo_item_ite_cb func, void* user_data );
2840
2841 /**
2842  *      minfo_get_media_count_by_tagname:
2843  *      This function could get count of media items, which are included to the same tag according to tag name .
2844  *      User could dictate whether he/she hope to get count of media items.
2845  *
2846  *      @param[in]      mb_svc_handle   the handle of DB
2847  *      @param[in]      tag_name                tag name
2848  *      @param[out]     count                   count of media items
2849  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2850  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2851  *      @see    None.
2852  *      @pre    None
2853  *      @post   None
2854  *      @remarks        None
2855  *      @par example
2856  *      @code
2857
2858 #include <media-svc.h>
2859
2860 void test_minfo_get_media_count_by_tagname(MediaSvcHandle *mb_svc_handle)
2861 {
2862         int ret = MB_SVC_ERROR_NONE;
2863         int count = 0;
2864
2865         //get count of media items, which are included to the same tag with 'test tag'.
2866         ret = minfo_get_media_count_by_tagname(mb_svc_handle, "test tag", &count);
2867         if (ret < 0) {
2868                 printf( "failed to get a media items' list. error code->%d", ret);
2869         } else {
2870                 printf( "Count is %d\n", count );       
2871         }
2872
2873         return;
2874 }
2875
2876  *      @endcode
2877  */
2878
2879 int
2880 minfo_get_media_count_by_tagname(MediaSvcHandle *mb_svc_handle, const char* tag_name, int* count );
2881
2882 /**
2883  *      minfo_get_tag_list_by_media_id:
2884  *      This function could get a tags' list whose memeber is Mtag type. User should pass @p media_id to indicate which
2885  *    media item will be searched. Also he/she should define a callback function to be called by this function.
2886  *
2887  *      @param[in]      mb_svc_handle   the handle of DB
2888  *      @param[in]      media_id                identify a media item with ID
2889  *      @param[in]      func                    Iterative callback implemented by a user. This callback is called when an item has to be inserted to user's list.
2890  *      @param[out]     user_data               user's data structure to contain items of the type Mtag. It is passed to the iterative callback.
2891  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2892  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2893  *      @see    minfo_set_db_valid.
2894  *      @pre    None
2895  *      @post   None
2896  *      @remark None
2897  *      @par example
2898  *      @code
2899
2900 #include <media-svc.h>
2901
2902 int mtag_ite_cb(Mtag *i_tag, void *user_data)
2903 {
2904         GList** list = (GList**)user_data;
2905         *list = g_list_append(*list, item);
2906 }
2907
2908
2909 void get_tag_list_media_id(MediaSvcHandle *mb_svc_handle)
2910 {
2911         int ret = MB_SVC_ERROR_NONE;
2912         const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
2913         GList *p_list = NULL;
2914
2915         //get a tags' list which include the same media item and it's media_id is b6a4f4ac-26ea-458c-a228-9aef7f70349d.
2916         ret = minfo_get_tag_list_by_media_id(mb_svc_handle, media_id, mtag_ite_cb, &p_list);
2917         if (ret < 0) {
2918                 printf( "failed to get a tags' list. error code->%d", ret);
2919                 return;
2920         }
2921 }
2922
2923  *      @endcode
2924  */
2925
2926 int
2927 minfo_get_tag_list_by_media_id(MediaSvcHandle *mb_svc_handle, const char *media_id, minfo_tag_ite_cb func, void* user_data);
2928
2929 /**
2930  *      minfo_add_web_cluster
2931  *      This function could add a web album through specifying it's @p name, @p account_id. After adding a web
2932  *    album, this function will return @p id.
2933  *
2934  *      @param[in]      mb_svc_handle   the handle of DB
2935  *      @param[in]      sns_type                sns type, like, facebook, flickr, etc.
2936  *      @param[in]      name            new added web album's name.
2937  *      @param[in]      account_id      account ID.
2938  *      @param[out]     id                      return album's id.
2939  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2940  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2941  *      @see    minfo_add_web_cluster_album_id.
2942  *      @pre    None
2943  *      @post   None
2944  *      @remarks        None
2945  *      @par example
2946  *      @code
2947
2948 #include <media-svc.h>
2949
2950
2951 void add_web_cluster(MediaSvcHandle *mb_svc_handle)
2952 {
2953         int ret = MB_SVC_ERROR_NONE;
2954         char cluster_id[256] = {0,};
2955         
2956         //add a web album.
2957         ret = minfo_add_web_cluster(mb_svc_handle, 1, "web_album",  "1", cluster_id, sizeof(cluster_id));
2958         if (ret < 0) {
2959                 printf( "failed to add a web album. error code->%d", ret);
2960         }
2961
2962         return;
2963 }
2964
2965  *      @endcode
2966  */
2967
2968 int
2969 minfo_add_web_cluster(MediaSvcHandle *mb_svc_handle, int sns_type, const char* name,const char *account_id, char* id, int max_length);
2970
2971
2972 /**
2973  *      minfo_add_web_cluster_album_id
2974  *      This function could add a web album through specifying it's @p name, @p account_id, @p album_id. After adding a web
2975  *    album, this function will return @p id.
2976  *
2977  *      @param[in]      mb_svc_handle   the handle of DB
2978  *      @param[in]      sns_type        sns type, like, facebook, flickr, etc.
2979  *      @param[in]      name            new added web album's name.
2980  *      @param[in]      account_id      account ID.
2981  *      @param[in]      album_id        web album id
2982  *      @param[out]     id                      return album's id.
2983  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2984  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2985  *      @see    minfo_add_web_cluster.
2986  *      @pre    None
2987  *      @post   None
2988  *      @remarks        None
2989  *      @par example
2990  *      @code
2991
2992 #include <media-svc.h>
2993
2994
2995 void add_web_cluster_album_id(MediaSvcHandle *mb_svc_handle)
2996 {
2997         int ret = MB_SVC_ERROR_NONE;
2998         char cluster_id[256] = {0,};
2999
3000         //add a web album.
3001         ret = minfo_add_web_cluster_album_id(mb_svc_handle, 1, "web_album",  "1", "1", cluster_id, sizeof(cluster_id));
3002         if (ret < 0) {
3003                 printf( "failed to add a web album. error code->%d", ret);
3004                 return;
3005         }
3006
3007         return;
3008 }
3009
3010  *      @endcode
3011  */
3012
3013 int
3014 minfo_add_web_cluster_album_id(MediaSvcHandle *mb_svc_handle, int sns_type, const char* name, const char *account_id, const char *album_id, char *id, int max_length);
3015
3016 /**
3017  *      minfo_delete_web_cluster
3018  *      This function could delete a web album through specifying @p cluster_id. After deleteing a web
3019  *    album, the application will not be able to get this web album displaying.
3020  *
3021  *      @param[in]      mb_svc_handle   the handle of DB
3022  *      @param[in]      cluster_id              cluster ID identifying a web album.
3023  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
3024  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
3025  *      @see    None.
3026  *      @pre    None
3027  *      @post   None
3028  *      @remarks        None
3029  *      @par example
3030  *      @code
3031
3032 #include <media-svc.h>
3033
3034 void delete_web_cluster(MediaSvcHandle *mb_svc_handle)
3035 {
3036         int ret = MB_SVC_ERROR_NONE;
3037         const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
3038         
3039         //delete a web album.
3040         ret = minfo_delete_web_cluster(mb_svc_handle, cluster_id);
3041         if (ret < 0) {
3042                 printf( "failed to delete a web album. error code->%d", ret);
3043                 return;
3044         }
3045
3046         return;
3047 }
3048
3049  *      @endcode
3050  */
3051
3052 int
3053 minfo_delete_web_cluster(MediaSvcHandle *mb_svc_handle, const char *cluster_id);
3054
3055 /**
3056 * minfo_get_web_cluster_by_web_account_id
3057 * This function gets list of mcluster by web account id. User could get the detail information with
3058 * the type 'Mcluster' about this cluster, the type 'Mcluster' mainly include folder/cluster ID, display name, 
3059 * count of included media content, etc. The detail defination of this type could refer to the herder file, minfo_item/minfo-cluster.h.
3060 *
3061 * @return This function returns 0 on success, or negative value with error code.
3062 *         Please refer 'media-svc-error.h' to know the exact meaning of the error.
3063 * @param        mb_svc_handle   [in]    the handle of DB
3064 * @param        web_account_id  [in]    the web account ID which indentify a cluster
3065 * @param        func                    [in]    Iterative callback implemented by a user. This callback is called when an item has to be inserted to user's list.
3066 * @param        user_data               [out]   user's data structure to contain items of the type Mcluster. It is passed to the iterative callback.
3067 * @exception None.
3068 * @remarks User could pass web account id to this function, so that
3069 *          this function still could get the wanted list of clusters
3070 *          when invoking this function.
3071 * @see  None.
3072 * @pre  None
3073 * @post None
3074 * @par example
3075 * @code
3076
3077
3078         #include <media-svc.h>
3079         int mcluster_ite_cb(Mcluster *cluster, void *user_data)
3080         {
3081                 GList** list = (GList**)user_data;
3082                 *list = g_list_append(*list, cluster);
3083         }
3084
3085         void test_minfo_get_web_cluster_by_web_account_id(MediaSvcHandle *mb_svc_handle)
3086         {
3087                 int ret = -1;
3088                 const char* account_id = "user";
3089                 GList *p_list = NULL;
3090                 
3091                 //get a web cluster using account id.
3092                 ret = minfo_get_web_cluster_by_web_account_id(mb_svc_handle, account_id, mcluster_ite_cb, &p_list);
3093                 if(ret < 0) {
3094                         printf("minfo_get_web_cluster_by_web_account_id fail: %d \n", ret);
3095                         return;
3096                 }
3097          }
3098 * @endcode
3099 */
3100
3101 int
3102 minfo_get_web_cluster_by_web_account_id(MediaSvcHandle *mb_svc_handle, const char* web_account_id, minfo_cluster_ite_cb func, void *user_data);
3103
3104 /**
3105 * minfo_get_web_cluster_web_album_id
3106 * This function gets mcluster information by web cluster id. User could get the detail information with
3107 * the type 'Mcluster' about this cluster, the type 'Mcluster' mainly include folder/cluster ID, display name,
3108 * count of included media content, etc. The detail defination of this type could refer to the herder file, minfo-cluster.h.
3109 *
3110 * @return       This function returns 0 on success, or negative value with error code.
3111 * @param        mb_svc_handle   [in]    the handle of DB
3112 * @param        cluster_id              [in]    the cluster ID which indentify a cluster
3113 * @param        mcluster                [out]   mcluster to be returned, which is a 'Mcluster' type
3114 * @exception None.
3115 * @remarks User could pass cluster id to this function, so that
3116 *          this function still could get the wanted cluster.
3117 *          when invoking this function, *mcluster must equals NULL, and
3118 *          after using mitem, it must be freed with minfo_destroy_mtype_item.
3119 * @see  None.
3120 * @pre  None
3121 * @post None
3122 * @par example
3123 * @code
3124
3125         #include <media-svc.h>
3126
3127         void test_minfo_get_web_cluster_web_album_id(MediaSvcHandle *mb_svc_handle)
3128         {
3129                 int ret = -1;
3130                 Mcluster *mc = NULL;
3131                 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
3132
3133                 //get a cluster using cluster's id.
3134                 ret = minfo_get_web_cluster_web_album_id(mb_svc_handle, cluster_id, &mc);
3135                 if(ret < 0) {
3136                         printf("minfo_get_web_cluster_web_album_id fail: %d \n", ret);
3137                         return;
3138                 }
3139
3140                 minfo_destroy_mtype_item(mc);
3141          }
3142 * @endcode
3143 */
3144
3145 int
3146 minfo_get_web_cluster_web_album_id(MediaSvcHandle *mb_svc_handle, const char *web_album_id, Mcluster **mcluster);
3147
3148 /**
3149  *      minfo_add_web_media
3150  *      This function could add a web media to web album specified by @p cluster_id, in addition, user need to pass @p http_url, @p file_name
3151  *    @p thumb_path. If failed to add it to web album, this function will return an error code.
3152  *
3153  *      @param[in]      mb_svc_handle   the handle of DB
3154  *      @param[in]      cluster_id              specify cluster id to indentify a web album.
3155  *      @param[in]      http_url                web media's url.
3156  *      @param[in]      file_name               file name.
3157  *      @param[in]      thumb_path              thumbnail full path of this web media
3158  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
3159  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
3160  *      @see    None.
3161  *      @pre    None
3162  *      @post   None
3163  *      @remarks        None
3164  *      @par example
3165  *      @code
3166
3167 #include <media-svc.h>
3168
3169 void test_minfo_add_web_media(MediaSvcHandle *mb_svc_handle)
3170 {
3171         int ret = MB_SVC_ERROR_NONE;
3172         const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
3173         
3174         //add a web media to a web album.
3175         ret = minfo_add_web_media(mb_svc_handle, cluster_id, "http://user/specifying/address",  "web_media", "thumbnail path");
3176         if (ret < 0) {
3177                 printf( "failed to add to a web album. error code->%d", ret);
3178                 return;
3179         }
3180
3181         return;
3182 }
3183
3184  *      @endcode
3185  */
3186
3187 DEPRECATED_API int
3188 minfo_add_web_media(MediaSvcHandle *mb_svc_handle, const char *cluster_id, const char* http_url, const char* file_name, const char* thumb_path);
3189
3190 /**
3191  *      minfo_add_web_media_with_type
3192  *      This function could add a web media to web album specified by @p cluster_id, in addition, user need to pass @p http_url, @p file_name, @p content_type, 
3193  *    @p thumb_path. If failed to add it to web album, this function will return an error code.
3194  *
3195  *      @param[in]      mb_svc_handle   the handle of DB
3196  *      @param[in]      cluster_id              specify cluster id to indentify a web album.
3197  *      @param[in]      http_url                web media's url.
3198  *      @param[in]      file_name               file name.
3199  *      @param[in]      content_type    type of the media.
3200  *      @param[in]      thumb_path              thumbnail full path of this web media
3201  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
3202  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
3203  *      @see    None.
3204  *      @pre    None
3205  *      @post   None
3206  *      @remark None
3207  *      @par example
3208  *      @code
3209
3210 #include <media-svc.h>
3211
3212
3213 void test_minfo_add_web_media_with_type(MediaSvcHandle *mb_svc_handle)
3214 {
3215         int ret = MB_SVC_ERROR_NONE;
3216         const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
3217         
3218         //add a web media to a web album.
3219         ret = minfo_add_web_media_with_type(mb_svc_handle, cluster_id, "http://user/specifying/address",  "web_media", MINFO_ITEM_IMAGE, "thumbnail name");
3220         if (ret < 0) {
3221                 printf( "failed to add to a web album. error code->%d", ret);
3222                 return;
3223         }
3224
3225         return;
3226 }
3227
3228  *      @endcode
3229  */
3230
3231 int
3232 minfo_add_web_media_with_type(MediaSvcHandle *mb_svc_handle, const char *cluster_id, const char* http_url, const char* file_name, minfo_file_type content_type, const char* thumb_path);
3233
3234 /**
3235         @}
3236  */
3237
3238
3239 #ifdef __cplusplus
3240 }
3241 #endif /* __cplusplus */
3242
3243
3244
3245
3246
3247 #endif /*_VISUAL_SVC_H_*/
3248
3249