upload tizen1.0 source
[framework/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 /**
1165  * minfo_add_cluster
1166  * This function adds new local folder. This function could be called when user want to add a Album(local folder)
1167  * in Gallery application. This function actually call the sqlite INSERT statement to insert the record in folder
1168  * table. Meanwhile it will return new added local folder's ID to @p id.
1169  * Sqlie3 statement looks like this, INSERT INTO folder (...);
1170  * @param       mb_svc_handle   [in]    the handle of DB
1171  * @param       cluster_url             [in]    the local directory of added folder, it should be full pathname of local folder
1172  * @param       id                              [out]   id of the added folder, this function will return a unique ID to calling application
1173  * @return      This function returns 0 on success, or negative value with error code.
1174  * @remarks     if invoke this function with same input parameter, it fails   
1175  * @see     minfo_delete_cluster
1176  * @pre         None
1177  * @post        None
1178  * @par example
1179  * @code
1180
1181         #include <media-svc.h>
1182  
1183         void test_minfo_add_cluster(MediaSvcHandle *mb_svc_handle)
1184         {
1185                 int ret = -1;
1186                 char *cluster_url = "/opt/media/Images/Wallpapers";
1187                 char cluster_id[256];
1188
1189                 //add a new cluster whose url is 'cluster_url'.
1190                 ret = minfo_add_cluster(mb_svc_handle, cluster_url, cluster_id, sizeof(cluster_id));
1191                 if( ret < 0) {
1192                         printf("minfo_add_cluster failed\n");
1193                         return;
1194                 }
1195         }
1196  * @endcode    
1197  */
1198
1199 int
1200 minfo_add_cluster(MediaSvcHandle *mb_svc_handle, const char* cluster_url, char *id, int max_length);
1201
1202
1203 /**
1204  * minfo_check_cluster_exist
1205  * This function checks to exist the cluster in media database by its path.
1206  * @param       mb_svc_handle   [in]    the handle of DB
1207  * @param       path                    [in]    the local directory to check if it exists, it should be full pathname of local folder
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_check_item_exist
1211  * @pre         None
1212  * @post        None
1213  * @par example
1214  * @code
1215
1216         #include <media-svc.h>
1217
1218         void test_minfo_check_cluster_exist(MediaSvcHandle *mb_svc_handle)
1219         {
1220                 int ret = -1;
1221                 char *cluster_url = "/opt/media/Images/Wallpapers";
1222
1223                 //check if the cluster exists by path.
1224                 ret = minfo_check_cluster_exist(mb_svc_handle, cluster_url);
1225                 if( ret < 0) {
1226                         printf("minfo_check_cluster_exist failed\n");
1227                         return;
1228                 }
1229         }
1230  * @endcode
1231  */
1232
1233 int
1234 minfo_check_cluster_exist(MediaSvcHandle *mb_svc_handle, const char *path);
1235
1236 /**
1237  * minfo_check_item_exist
1238  * This function checks to exist the media in media database by its path.
1239  * @param       mb_svc_handle   [in]    the handle of DB
1240  * @param       path                    [in]    the local media path to check if it exists, it should be full pathname.
1241  * @return      This function returns 0 on success, or negative value with error code.
1242  * @remarks     if invoke this function with same input parameter, it fails
1243  * @see     minfo_check_cluster_exist
1244  * @pre         None
1245  * @post        None
1246  * @par example
1247  * @code
1248
1249         #include <media-svc.h>
1250
1251         void test_minfo_check_item_exist(MediaSvcHandle *mb_svc_handle)
1252         {
1253                 int ret = -1;
1254                 char *media_url = "/opt/media/Images/Wallpapers/Wallpaper1.jpg";
1255
1256                 //check if the item exists by path.
1257                 ret = minfo_check_item_exist(mb_svc_handle, media_url);
1258                 if( ret < 0) {
1259                         printf("minfo_check_item_exist failed\n");
1260                         return;
1261                 }
1262         }
1263  * @endcode
1264  */
1265
1266 int
1267 minfo_check_item_exist(MediaSvcHandle *mb_svc_handle, const char *path);
1268
1269 /**
1270  * minfo_get_item_by_id
1271  * This function gets mitem information. When user could get the unique ID of a media content, he/she
1272  * could get the detail information with the type 'Mitem', which include the below feilds, like, item's unique id,
1273  * media content type, media content's thumbnail name, media content's pathname, etc. The detail defination 
1274  * of this structute, could refer to the header, minfo-item.h.
1275  * @param       mb_svc_handle   [in]    the handle of DB
1276  * @param       media_id                [in]    the local file media id
1277  * @param       mitem                   [out]   the returned data structure whose type is Mitem.
1278  * @return      This function returns 0 on success, or negative value with error code.
1279  * @remarks        when invoking this function, *mitem must equals NULL, and
1280  *          the @p media_id should be valid ID, if it is invalid, like -1 or 0, this
1281  *                      function will return @p mitem whose content is NULL. If normally, @p mitem must be freed with minfo_mitem_destroy.
1282  * @see     minfo_get_item.
1283  * @pre         None
1284  * @post        None
1285  * @par example
1286  * @code
1287
1288         #include <media-svc.h>
1289
1290         void test_minfo_get_item_by_id(MediaSvcHandle *mb_svc_handle)
1291         {
1292                 int ret = -1;
1293                 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
1294                 Mitem *mi = NULL;
1295
1296                 //get an item based on its media ID.
1297                 ret = minfo_get_item_by_id(mb_svc_handle, media_id, &mi);
1298                 if(ret < 0) {
1299                         return;
1300                 }
1301
1302                 minfo_destroy_mtype_item(mi);
1303         }
1304  * @endcode
1305  */
1306
1307 int
1308 minfo_get_item_by_id(MediaSvcHandle *mb_svc_handle, const char *media_id, Mitem **mitem);
1309
1310
1311 /**
1312  * minfo_get_item
1313  * This function gets mitem information. When user could get the full pathname of a media content, he/she
1314  * could get the detail information with the type 'Mitem', which include the below feilds, like, item's unique id,
1315  * media content type, media content's thumbnail name, media content's pathname, etc. The detail defination 
1316  * of this structute, could refer to the header, minfo-item.h.
1317  * @param       mb_svc_handle   [in]    the handle of DB
1318  * @param       file_url                [in]    the local file full pathname
1319  * @param       mitem                   [out]   the returned data structure whose type is Mitem.
1320  * @return      This function returns 0 on success, or negative value with error code.
1321  * @remarks        when invoking this function, *mitem must equals NULL, and
1322  *                  after using mitem, it must be freed with minfo_mitem_destroy.
1323  * @see     minfo_get_item_by_id.
1324  * @pre         None
1325  * @post        None
1326  * @par example
1327  * @code
1328
1329         #include <media-svc.h>
1330
1331         void test_minfo_get_item(MediaSvcHandle *mb_svc_handle)
1332         {
1333                 int ret = -1;
1334                 Mitem *mi = NULL;
1335                 char* file_url = "/opt/media/Images/Wallpapers/Home_01.png";
1336
1337                 //get an item based on its url.
1338                 ret = minfo_get_item(mb_svc_handle, file_url, &mi);
1339                 if(ret < 0) {
1340                         return;
1341                 }
1342
1343                 minfo_destroy_mtype_item(mi);
1344         }
1345  * @endcode
1346  */
1347
1348 int
1349 minfo_get_item(MediaSvcHandle *mb_svc_handle, const char* file_url, Mitem **mitem);
1350
1351 /**
1352  * minfo_get_item_by_http_url
1353  * This function gets mitem information. When user could get the http url of a media content, which is downloaded from web, he/she
1354  * could get the detail information with the type 'Mitem', which include the below feilds, like, item's unique id,
1355  * media content type, media content's thumbnail name, etc. The detail defination 
1356  * of this structute, could refer to the header, minfo_item/minfo-item.h.
1357  * @param       mb_svc_handle   [in]    the handle of DB
1358  * @param       http_url                [in]    the http url of a media, which is downloaded from web.
1359  * @param       mitem                   [out]   the returned data structure whose type is Mitem.
1360  * @return      This function returns 0 on success, or negative value with error code.
1361  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
1362  * @remarks        when invoking this function, *mitem must equals NULL, and
1363  *                  after using mitem, it must be freed with minfo_mitem_destroy.
1364  * @see     minfo_get_item_by_id, minfo_get_item
1365  * @pre         None
1366  * @post        None
1367  * @par example
1368  * @code
1369
1370         #include <media-svc.h>
1371
1372         void test_minfo_get_item_by_http_url(MediaSvcHandle *mb_svc_handle)
1373         {
1374                 int ret = -1;
1375                 Mitem *mi = NULL;
1376                 char* http_url = "http://picasa.com/myaccount/Home_01.png";
1377
1378                 //get an item based on its http url.
1379                 ret = minfo_get_item_by_http_url(mb_svc_handle, http_url, &mi);
1380                 if(ret < 0) {
1381                         return;
1382                 }
1383
1384                 minfo_destroy_mtype_item(mi);
1385         }
1386  * @endcode
1387  */
1388
1389 int
1390 minfo_get_item_by_http_url(MediaSvcHandle *mb_svc_handle, const char* http_url, Mitem **mitem);
1391
1392
1393 /**
1394 * minfo_get_cluster
1395 * 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
1396 * could get the detail information with the type 'Mcluster' about this cluster/local folder, the type 'Mcluster'
1397 * mainly include folder/cluster ID, display name, count of included media content, etc. The detail defination
1398 * of this type could refer to the herder file, minfo-cluster.h.
1399 *
1400 * @return       This function returns 0 on success, or negative value with error code.
1401 * @param        mb_svc_handle   [in]    the handle of DB
1402 * @param        cluster_url             [in]    local folder full path, it indicate which folder user want to get it's detail information
1403 * @param        cluster_id              [in]    the cluster ID which indentify a cluster
1404 * @param        mcluster                [out]   mcluster to be returned, which is a 'Mcluster' type
1405 * @exception None.
1406 * @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
1407 *           this function still could get the wanted cluster.
1408 *           when invoking this function, *mcluster must equals NULL, and
1409 *           after using mitem, it must be freed with minfo_mcluster_destroy.
1410 * @see      minfo_mcluster_destroy
1411 * @pre          None
1412 * @post None
1413 * @par example
1414 * @code
1415
1416         #include <media-svc.h>
1417
1418         void test_minfo_get_cluster(MediaSvcHandle *mb_svc_handle)
1419         {
1420                 int ret = -1;
1421                 Mcluster *mc = NULL;
1422                 char *cluster_url = "/opt/media/Images/Wallpapers";
1423                 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
1424
1425                 //get a cluster using cluster's url.
1426                 ret = minfo_get_cluster(mb_svc_handle, cluster_url, cluster_id, &mc);
1427                 if(ret < 0) {
1428                         printf("minfo_get_cluster fail: %d \n", ret);
1429                         return;
1430                 }
1431
1432                 printf("minfo_get_cluster: %s \n", mc->display_name);
1433                 minfo_mcluster_destroy(mc);
1434         }
1435 * @endcode
1436 */
1437
1438 int 
1439 minfo_get_cluster(MediaSvcHandle *mb_svc_handle, const char* cluster_url, const char *cluster_id, Mcluster **mcluster);
1440
1441
1442 /**
1443  * minfo_get_cluster_cover
1444  * This function gets thumbnail path of cover files by cluster id. This function could get the cover of a cluster
1445  * or folder which may include first several items' thumbnails, maybe 5 or other number, user could specify it
1446  * using @p img_cnt.
1447  *
1448  * @param       mb_svc_handle   [in]    the handle of DB
1449  * @param       cluster_id              [in]    the folder id in which media files are in. if the parameter is -1, then query all folders.
1450  * @param       img_cnt                 [in]    the count of cover thumbnails
1451  * @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.
1452  * @param       user_data       [out]   user's data structure to contain items of thumbnail path. It is passed to the iterative callback.
1453  *
1454  * @return      This function returns 0 on success, or negative value with error code.
1455  * @remarks     type of item is pointer to char*,
1456  *                      when free list, needn't free every string.
1457  * @see         None.
1458  * @pre         None
1459  * @post        None
1460  * @par example
1461  * @code
1462
1463         #include <media-svc.h>
1464
1465         int cover_ite_cb(char *thumb_path, void *user_data)
1466         {
1467                 GList** list = (GList**)user_data;
1468                 *list = g_list_append(*list, thumb_path);
1469         }
1470
1471         void test_minfo_get_cluster_cover(MediaSvcHandle *mb_svc_handle)
1472         {
1473                 int ret = -1;
1474                 GList *p_list = NULL;
1475                 int img_cnt = 5;
1476                 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
1477
1478                 //get the cover of a cluster.
1479                 ret = minfo_get_cluster_cover(mb_svc_handle, cluster_id, img_cnt, cover_ite_cb, &p_list);
1480                 if(ret< 0) { 
1481                         printf("test_minfo_get_cluster_cover error\n");
1482                         return;
1483                 }
1484         }
1485
1486   * @endcode
1487   */
1488
1489 int 
1490 minfo_get_cluster_cover(MediaSvcHandle *mb_svc_handle, const char *cluster_id, const int img_cnt, minfo_cover_ite_cb func, void *user_data);
1491
1492
1493 /**
1494  * minfo_get_bookmark_list
1495  * This function gets the type 'Mbookmark' instances list. Data of each this type instance is 
1496  * composed of the matched record indentified by the media id from  'video_bookmark' table. 
1497  * The type 'Mbookmark' mainly include the these information, like, bookmark id, media id, 
1498  * marked time, corresponding thumbnail pathanme, etc.
1499  *
1500  * @param       mb_svc_handle   [in]    the handle of DB
1501  * @param       media_id                [in]    media_id field of video_bookmark table record
1502  * @param       func                    [in]  Iterative callback implemented by a user. This callback is called when an item has to be inserted to user's list.
1503  * @param       user_data               [out]   User's data structure to contain items of the type Mbookmark. It is passed to the iterative callback.
1504  * @return      This function returns 0 on success, or negative value with error code.
1505  * @remarks        member data in list is pointer to structure Mbookmark,
1506  *                    when free list, it need free every item first and then free list itself.
1507  * @see         None.
1508  * @pre         None
1509  * @post        None
1510  * @par example
1511  * @code
1512
1513         #include <media-svc.h>
1514
1515         int mbookmark_ite_cb(Mbookmark *bm, void *user_data)
1516         {
1517                 GList** list = (GList**)user_data;
1518                 *list = g_list_append(*list, bm);
1519         }
1520
1521         void test_minfo_get_bookmark_list(MediaSvcHandle *mb_svc_handle)
1522         {
1523                 int ret = -1;
1524                 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
1525                 GList *p_list = NULL;
1526
1527         //get a linked list which will include all of bookmarks of a media file.
1528                 ret = minfo_get_bookmark_list(mb_svc_handle, media_id, mbookmar_ite_cb, &p_list);
1529                 if( ret < 0) {
1530                         return;
1531                 }
1532         }
1533   * @endcode     
1534  */
1535
1536 int
1537 minfo_get_bookmark_list(MediaSvcHandle *mb_svc_handle, const char *media_id, minfo_bm_ite_cb func, void *user_data);
1538
1539
1540 /**
1541  * minfo_get_geo_item_list
1542  * This function gets the type 'Mitem' instances list. Data of each instance is composed of the matched record identified 
1543  * by @p filter from 'media' table. Except that the got items pass the criterion of  @p filter, they should position where the longitude
1544  * is between @p min_longitude and @p max_longitude, and the latitude is between @p min_latitude and @p max_latitude.
1545 *  This function gets 'Mitem' list matched with latitude, longitude, filter and cluster id.
1546  * @param       mb_svc_handle   [in]    the handle of DB
1547  * @param       cluster_id              [in]    indicate the value, 'fold_id' field in 'media' table record
1548  * @param       filter                  [in]    specified filter to get matched media record
1549  * @param       store_filter    [in]    specified storage filter to get matched media record
1550  * @param       min_longitude   [in]     minimum value of 'longitude' field in 'vidoe_meta'/'image_meta' table
1551  * @param       max_longitude   [in]     maximum value of longitude field in 'vidoe_meta'/'image_meta' table
1552  * @param       min_latitude    [in]     minimum value of 'latitude' field in 'video_meta'/'image_meta' record
1553  * @param       max_latitude    [in]     maximum value of 'latitude' field in 'video_meta'/'image_meta' record
1554  * @param       func                    [in]    Iterative callback implemented by a user. This callback is called when an item has to be inserted to user's list.
1555  * @param       user_data               [out]   user's data structure to contain items of the type Mitem. It is passed to the iterative callback.
1556  * @return      This function returns 0 on success, or negative value with error code.
1557  * @remarks          item type in list is pointer to structure Mitem,
1558  *                    when free list, it need free every item first  and then free list itself. 
1559  * @see         None.
1560  * @pre         None
1561  * @post        None
1562  * @par example
1563  * @code
1564
1565         #include <media-svc.h>
1566
1567         int mitem_ite_cb(Mitem *item, void *user_data)
1568         {
1569                 GList** list = (GList**)user_data;
1570                 *list = g_list_append(*list, item);
1571         }
1572
1573     void test_minfo_get_geo_item_list(MediaSvcHandle *mb_svc_handle)
1574     {
1575                 int ret = -1; 
1576                 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
1577                 int min_longitude = 120.0;
1578                 int max_longitude = 123.0;
1579                 int min_latitude = 19.0;
1580                 int max_latitude = 24.0;
1581                 GList *p_list = NULL;
1582
1583                 //get a linked list which include a set of items based on their location.
1584                 ret = minfo_get_geo_item_list(mb_svc_handle,
1585                                                 cluster_id,
1586                                                 store_filter,
1587                                                 filter,
1588                                                 min_longitude,
1589                                                 max_longitude,
1590                                                 min_latitude,
1591                                                 max_latitude,
1592                                                 mitem_ite_cb,
1593                                                 &p_list);
1594                 if( ret < 0) {
1595                         printf("minfo_get_geo_item_list failed\n");
1596                         return;
1597                 }
1598     }
1599   * @endcode
1600  */
1601
1602 int
1603 minfo_get_geo_item_list(MediaSvcHandle *mb_svc_handle,
1604                                                 const char *cluster_id, 
1605                                                 minfo_folder_type store_filter,
1606                                                 minfo_item_filter filter, 
1607                                                 double min_longitude, 
1608                                                 double max_longitude, 
1609                                                 double min_latitude, 
1610                                                 double max_latitude,
1611                                                 minfo_item_ite_cb func,
1612                         void *user_data);
1613
1614
1615
1616 /**
1617  * minfo_get_thumb_path
1618  * This function gets thumbnail path of specified image file. When user could get the full pathname of a image content.
1619  * He/She wants to get the thumbnail file corresponding to the image content identified by the @p file_url.
1620  * User is responsible for allocating the memory for @p thumb_path so that this function could fill up the thumbnail pathname to it.
1621  * @param       mb_svc_handle   [in]    the handle of DB
1622  * @param       file_url                [in]    local file full path, identify a media record in 'media' table
1623  * @param       thumb_path              [out]   the returned thumbnail path of specified file, user is responsible for allocating memory for it first
1624  * @param       max_thumb_path  [in]    The max length of the returned thumbnail path
1625  *
1626  * @return      This function returns 0 on success, or negative value with error code.
1627  * @remarks     one file full path always matches one thumbnail path,
1628             here, it returns thumbnail path , but maybe thumbnail file doesn't exist, return NULL.
1629  * @see         minfo_get_thumb_path_for_video.
1630  * @pre         None
1631  * @post        None
1632  * @par example
1633  * @code
1634
1635         #include <media-svc.h>
1636
1637         void test_minfo_get_thumb_path(MediaSvcHandle *mb_svc_handle)
1638         {
1639                 int ret = -1;
1640                 char thumb_path[256] = {'\0'};
1641                 char *file_url = "/opt/media/Images/Wallpapers/Home_01.png";
1642
1643                 //get thumbnail pathname of an item.
1644                 ret = minfo_get_thumb_path(mb_svc_handle, file_url, thumb_path, sizeof(thumb_path));
1645                 if( ret < 0) {
1646                         printf("minfo_get_thumb_path failed\n");
1647                         return;
1648                 }
1649         }
1650 * @endcode
1651  */
1652
1653 int
1654 minfo_get_thumb_path(MediaSvcHandle *mb_svc_handle, const char* file_url, char* thumb_path, size_t max_thumb_path);
1655
1656 /**
1657  * minfo_get_thumb_path_for_video
1658  * This function gets thumbnail path of specified video file. When user could get the full pathname of a video content.
1659  * He/She wants to get the thumbnail file corresponding to the video content identified by the @p file_url.
1660  * User is responsible for allocating the memory for @p thumb_path so that this function could fill up the thumbnail pathname to it.
1661  * @param       mb_svc_handle   [in]    the handle of DB
1662  * @param       file_url                [in]    local file full path, identify a media record in 'media' table
1663  * @param       thumb_path              [out]   the returned thumbnail path of specified file, user is responsible for allocating memory for it first
1664  * @param       max_thumb_path  [in] The max length of the returned thumbnail path
1665  *
1666  * @return      This function returns 0 on success, or negative value with error code.
1667  * @remarks     one file full path always matches one thumbnail path,
1668             here, it returns thumbnail path , but maybe thumbnail file doesn't exist, return NULL.
1669  * @see         minfo_get_thumb_path.
1670  * @pre         None
1671  * @post        None
1672  * @par example
1673  * @code
1674
1675         #include <media-svc.h>
1676
1677         void test_minfo_get_thumb_path_for_video(MediaSvcHandle *mb_svc_handle)
1678         {
1679                 int ret = -1;
1680                 char thumb_path[256] = {'\0'};
1681                 char *file_url = "/opt/media/Images and videos/My video clip/Helicopter.mp4";
1682
1683                 //get thumbnail pathname of an item.
1684                 ret = minfo_get_thumb_path_for_video(mb_svc_handle, file_url,thumb_path, sizeof(thumb_path));
1685                 if( ret < 0) {
1686                         printf("minfo_get_thumb_path_for_video failed\n");
1687                         return;
1688                 }
1689         }
1690 * @endcode
1691  */
1692
1693 int
1694 minfo_get_thumb_path_for_video(MediaSvcHandle *mb_svc_handle, const char* file_url, char* thumb_path, size_t max_thumb_path);
1695
1696 /**
1697  * minfo_delete_media_id
1698  * This function deletes matched record identified by the @p media_id from 'media' table , 'video_meta'/'image_meta' record. 
1699  * After that, if the folder which this deleted file is in becomes empty, then delete the folder record from 'folder' table, too. 
1700  * In order that user could successfully delete the corresponding record from 'media' table, he/she should be able to the correct _id 
1701  * of media content before it.
1702  *
1703  * @param       mb_svc_handle   [in]    the handle of DB
1704  * @param       media_id                [in]    represent the value, media '_id' in 'media' table record
1705  * @return      This function returns 0 on success, or negative value with error code.
1706  * @remarks     None.
1707  * @see     minfo_delete_media.
1708  * @pre         None
1709  * @post        None
1710  * @par example
1711  * @code
1712
1713         #include <media-svc.h>
1714
1715         void test_minfo_delete_media_id(MediaSvcHandle *mb_svc_handle)
1716         {
1717                 int ret = -1;
1718                 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
1719
1720                 //delete an item according to its ID.
1721                 ret = minfo_delete_media_id(mb_svc_handle, media_id);
1722                 if( ret < 0) {
1723                         printf("test_minfo_delete_media_id failed\n");
1724                         return;
1725                 }
1726         }
1727 * @endcode
1728  */
1729
1730 int
1731 minfo_delete_media_id(MediaSvcHandle *mb_svc_handle, const char *media_id);
1732
1733 /**
1734  *      minfo_delete_all_media_records:\n
1735  *      This function delete all media records in a type of storage like phone or MMC.
1736  *      This function is always used for MMC card insert/inject operation, in file manager service library.
1737  *
1738  * @param       mb_svc_handle   [in]    the handle of DB
1739  * @param       storage_type    [in]    information for storage type
1740  * @return      This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
1741  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
1742  *      @see    None
1743  *      @pre    None
1744  *      @post   None
1745  *      @remark None
1746  *      @par example
1747  *      @code
1748
1749         #include <media-svc.h>
1750
1751         void test_minfo_delete_all_media_records(MediaSvcHandle *mb_svc_handle)
1752         {
1753                 int ret = MB_SVC_ERROR_NONE;
1754
1755                 //delete all media records in MMC storage in db.
1756                 ret = minfo_delete_all_media_records(mb_svc_handle, MINFO_MMC);
1757                 if (ret < 0) {
1758                         printf( "failed to delete items. error code->%d", ret);
1759                         return;
1760                 }
1761         }
1762
1763  *      @endcode
1764  */
1765
1766 int
1767 minfo_delete_all_media_records(MediaSvcHandle *mb_svc_handle, const minfo_store_type storage_type);
1768
1769 /**
1770  * minfo_cp_media
1771  * 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
1772  * 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,
1773  * 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
1774  * according to the media file's full pathname and folder's full name.
1775  * @param       mb_svc_handle   [in]    the handle of DB
1776  * @param       src_media_id    [in]    id of the source media file, it's value is from '_id' field of the 'media' table
1777  * @param       dst_cluster_id  [in]    id of the destination folder, it's value is from '_id' field of the 'folder' table
1778  * @return      This function returns 0 on success, or negative value with error code.
1779  * @remarks     This function will implement the same functionality as minfo_copy_media.
1780  * @see  minfo_copy_media
1781  * @pre         None
1782  * @post        None
1783  * @par example
1784  * @code
1785
1786         #include <media-svc.h>
1787
1788         void test_minfo_cp_media(MediaSvcHandle *mb_svc_handle)
1789         {
1790                 int ret = -1;
1791                 const char *src_media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
1792                 const char *dst_cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
1793
1794                 //copy the a media file whose ID is specified by, 'src_media_id', to a cluster.
1795                 ret = minfo_cp_media(mb_svc_handle, src_media_id, dst_cluster_id);
1796                 if( ret < 0) {
1797                         printf("minfo_cp_media failed\n");
1798                         return;
1799                 }
1800         }
1801 * @endcode
1802  */
1803
1804 int
1805 minfo_cp_media(MediaSvcHandle *mb_svc_handle, const char *src_media_id, const char *dst_cluster_id);
1806
1807
1808
1809 /**
1810  * minfo_mv_media
1811  * 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
1812  * 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,
1813  * 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
1814  * according to the media file's full pathname and folder's full name.
1815  * @param       mb_svc_handle   [in]    the handle of DB
1816  * @param       src_media_id    [in]    id of the source media file, it's value is from '_id' field of the 'media' table
1817  * @param       dst_cluster_id  [in]    id of the destination folder, it's value is from '_id' field of the 'folder'
1818  * @return      This function returns 0 on success, or negative value with error code.
1819  * @remarks     None.
1820  * @see   minfo_move_media.
1821  * @pre         None
1822  * @post        None
1823  * @par example
1824  * @code
1825
1826         #include <media-svc.h>
1827
1828         void test_minfo_mv_media(MediaSvcHandle *mb_svc_handle)
1829         {
1830                 int ret = -1;
1831                 const char *src_media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
1832                 const char *dst_cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
1833
1834         //move an item to specified cluster.
1835                 ret = minfo_mv_media(mb_svc_handle, src_media_id, dst_cluster_id);
1836                 if( ret < 0) {
1837                         printf("minfo_mv_media failed\n");
1838                         return;
1839                 }
1840         }
1841 * @endcode
1842  */
1843
1844
1845 int
1846 minfo_mv_media(MediaSvcHandle *mb_svc_handle, const char *src_media_id, const char *dst_cluster_id);
1847
1848
1849
1850 /**
1851  * minfo_delete_cluster
1852  * 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
1853  * 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,
1854  * but delete all of records in 'media' table which are located in this folder, meanwhile delete the corresponding records in 'video_bookmark' table, etc.
1855  * @param       mb_svc_handle   [in]    the handle of DB
1856  * @param       cluster_id              [in]    cluster id, to indicate the deleted folder/cluster
1857  * @return      This function returns 0 on success, or negative value with error code.
1858  * @remarks delete all releated contents in cluster together with cluster
1859  *          like all media files, image/video meta,bookmark information.
1860  * @see   minfo_add_cluster
1861  * @pre         None
1862  * @post        None
1863  * @par example
1864  * @code
1865
1866
1867         #include <media-svc.h>
1868
1869         void test_minfo_delete_cluster(MediaSvcHandle *mb_svc_handle)
1870         {
1871         int ret = -1;
1872                 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
1873
1874                 //delete a cluster record, meanwhile this function will delete all of items owned by this cluster.
1875                 ret = minfo_delete_cluster(mb_svc_handle, cluster_id);
1876                 if( ret < 0) {
1877                         printf("minfo_delete_cluster failed\n");
1878                         return;
1879                 }
1880         }
1881 * @endcode
1882  */
1883
1884 int
1885 minfo_delete_cluster(MediaSvcHandle *mb_svc_handle, const char *cluster_id);
1886
1887
1888
1889 /**
1890  * minfo_update_cluster_name
1891  * This function updates the specified cluster name using @p new_name, which just indicate the new folder name. User could 
1892  * call this function, when he/she wants to change some folder/cluster name. This really update the corresponding record in 
1893  * 'folder' table.
1894  * @param       mb_svc_handle   [in]    the handle of DB
1895  * @param       cluster_id              [in]    cluster id, this value is from the '_id' field of 'folder' table
1896  * @param       new_name                [in]    new cluster name
1897  * @return      This function returns 0 on success, or negative value with error code.
1898  * @remarks     None.
1899  * @see   None.
1900  * @pre         None
1901  * @post        None
1902  * @par example
1903  * @code
1904
1905         #include <media-svc.h>
1906
1907         void test_minfo_update_cluster_name(MediaSvcHandle *mb_svc_handle)
1908         {
1909                 int ret = -1;
1910                 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
1911                 char *new_name = "newfolder";
1912
1913                 //update a cluster's name
1914                 ret = minfo_update_cluster_name(mb_svc_handle, cluster_id,new_name);
1915                 if( ret < 0) {
1916                         printf("minfo_update_cluster_name failed\n");
1917                         return;
1918                 }
1919         }
1920 * @endcode
1921  */
1922
1923 int
1924 minfo_update_cluster_name(MediaSvcHandle *mb_svc_handle, const char *cluster_id, const char* new_name);
1925
1926 /**
1927  * minfo_update_cluster_date
1928  * This function updates the specified cluster modified date using @p modified_date, which just indicate the new modified date. User could 
1929  * call this function, when he/she wants to change some clsuter's modified date. This really update the corresponding record in the DB
1930  * @param       mb_svc_handle   [in]    the handle of DB
1931  * @param       cluster_id              [in]    cluster id, this value is the identifier of the cluster
1932  * @param       modified_date   [in]    date to modify, which is a type of time_t
1933  * @return      This function returns zero(MB_SVC_ERROR_BASE) on success, or negative value with error code.
1934  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
1935  * @remarks     None.
1936  * @see   None.
1937  * @pre         None
1938  * @post        None
1939  * @par example
1940  * @code
1941
1942         #include <media-svc.h>
1943         #include <time.h>
1944
1945         void test_minfo_update_cluster_date(void)
1946         {
1947                 int ret = -1;
1948                 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
1949                 time_t today;
1950                 time(&today);
1951
1952                 //update a cluster's name
1953                 ret = minfo_update_cluster_date(cluster_id, today);
1954
1955                 if( ret < 0) {
1956                         printf("minfo_update_cluster_date failed\n");
1957                         return;
1958                 }
1959      }
1960 * @endcode
1961  */
1962
1963 int
1964 minfo_update_cluster_date(MediaSvcHandle *mb_svc_handle, const char *cluster_id,  time_t modified_date);
1965
1966
1967
1968 /**
1969  * minfo_add_bookmark
1970  * This function inserts new bookmark record into 'video_bookmark' table. The inserted data should include marked time of video content, @p position 
1971  * and @p thumb_path, current extracted thumbnail file in marked time, etc. User should use @p media_id to identify the 
1972  * video content, so that add bookmark to it.
1973  * @param       mb_svc_handle   [in]    the handle of DB
1974  * @param       media_id                [in]    media file id, uniquely identify the media content
1975  * @param       position                [in]    marked time of the media file
1976  * @param       thumb_path              [in]    the extracted thumbnail path for this marked time
1977  * @return      This function returns 0 on success, or negative value with error code.
1978  * @remarks                         if add same input parameters twice, it fails
1979  * @see    minfo_delete_bookmark
1980  * @pre         None
1981  * @post        None
1982  * @par example
1983  * @code
1984
1985
1986         #include <media-svc.h>
1987
1988         void test_minfo_add_bookmark(MediaSvcHandle *mb_svc_handle)
1989         {
1990                 int ret = -1;
1991                 int position = 2346;
1992                 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
1993                 char *thumb_path = "tmp1";
1994
1995                 //add a bookmark which include position, thumbnail, etc. to an item.
1996                 ret = minfo_add_bookmark(mb_svc_handle, media_id,position,thumb_path);
1997                 if( ret < 0) {
1998                         printf("minfo_add_bookmark failed\n");
1999                         return;
2000                 }
2001      }
2002 * @endcode
2003  */
2004
2005
2006 int
2007 minfo_add_bookmark(MediaSvcHandle *mb_svc_handle, const char *media_id, const int position, const char* thumb_path);
2008
2009
2010 /**
2011  * minfo_delete_bookmark
2012  * This function deletes specified bookmark record from 'video_bookmark' table, the deleted bookmark should be identified by @p bookmark_id.
2013  * This function actually call the sqlite3 statement, 
2014  * "DELETE FROM video_bookmark WHERE _id = bookmark_id; "
2015  * 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.
2016  *
2017  * @param       mb_svc_handle   [in]    the handle of DB
2018  * @param       bookmark_id             [in]    _id field in video_bookmark table.
2019  * @return      This function returns 0 on success, or negative value with error code.
2020  * @remarks     user should give a correct bookmark ID to successfully delete it.
2021  * @see  minfo_add_bookmark
2022  * @pre         None
2023  * @post        None
2024  * @par example
2025  * @code
2026
2027
2028         #include <media-svc.h>
2029
2030         void test_minfo_delete_bookmark(MediaSvcHandle *mb_svc_handle)
2031         {
2032                 int ret = -1;
2033                 int bookmark_id = 1;
2034
2035                 //delete a bookmark record in 'video_bookmark' table.
2036                 ret = minfo_delete_bookmark(mb_svc_handle, bookmark_id);
2037
2038                 if( ret < 0) {
2039                         printf("minfo_delete_bookmark failed\n");
2040                         return;
2041                 }
2042      }
2043 * @endcode
2044  */
2045
2046 int
2047 minfo_delete_bookmark(MediaSvcHandle *mb_svc_handle, const int bookmark_id);
2048
2049
2050
2051
2052 /**
2053 * minfo_get_cluster_id_by_url
2054 * This function gets some folder's full path. This will be called when user want to know what one folder's unique
2055 * ID is.
2056 *
2057 * @return                                       This function returns 0 on success, and -1 on failure.
2058 * @param        mb_svc_handle   [in]    the handle of DB
2059 * @param        url                             [in]    folder  path
2060 * @param        cluster_id              [out]   folder ID
2061 * @exception    None.
2062 * @remarks              None.
2063 * @see  None.
2064 * @pre  None
2065 * @post None
2066 * @par example
2067 * @code
2068
2069         #include <media-svc.h>
2070
2071         void test_minfo_get_cluster_id_by_url(MediaSvcHandle *mb_svc_handle)
2072         {
2073                 int ret = -1;
2074                 char cluster_id[256] = {0,};
2075                 char *url = "/opt/media/Images/Wallpapers";
2076
2077                 //get cluster's ID using cluster's url.
2078                 ret = minfo_get_cluster_id_by_url(url, cluster_id, sizeof(mb_svc_handle, cluster_id));
2079                 if( ret < 0) {
2080                         printf("test_minfo_get_cluster_id_by_url failed\n");
2081                         return;
2082                 }
2083      }
2084 * @endcode
2085 */
2086 int 
2087 minfo_get_cluster_id_by_url(MediaSvcHandle *mb_svc_handle, const char* url, char* cluster_id, int max_length);
2088
2089
2090 /**
2091 * minfo_get_cluster_name_by_id
2092 * This function gets folder's name. This will be called when user want to know what one folder's name
2093 *
2094 * @return       This function returns 0 on success, and -1 on failure.
2095 * @param[in]    mb_svc_handle   the handle of DB
2096 * @param[in]    cluster_id              folder ID
2097 * @param[out]   cluster_name    folder name
2098 * @param[in]    max_length              The max length of the returned folder name.
2099 * @exception    None.
2100 * @remarks      None.
2101 * @see  None.
2102 * @pre  None
2103 * @post None
2104 * @par example
2105 * @code
2106
2107         #include <media-svc.h>
2108
2109         void test_minfo_get_cluster_name_by_id(MediaSvcHandle *mb_svc_handle)
2110         {
2111                 int ret = -1;
2112                 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
2113                 char *cluster_name[1024];
2114
2115                 //get cluster's name using cluster's id.
2116                 ret = minfo_get_cluster_name_by_id(mb_svc_handle, cluster_id, cluster_name, sizeof(cluster_name));
2117
2118                 if( ret < 0) {
2119                         printf("test_minfo_get_cluster_name_by_id failed\n");
2120                         return;
2121                 } else {
2122                         printf("cluster name is %s\n", cluster_name);
2123                         return;
2124                 }
2125         }
2126 * @endcode
2127 */
2128 int 
2129 minfo_get_cluster_name_by_id(MediaSvcHandle *mb_svc_handle, const char *cluster_id, char *cluster_name, int max_length );
2130
2131 /**
2132 * minfo_get_cluster_fullpath_by_id
2133 * This function gets folder's full path. This will be called when user want to know what one folder's full path.
2134 * User should specify the maximum length of the @p folder_path, so as to avoid over flow of the string.
2135 *
2136 * @return       This function returns 0 on success, and -1 on failure.
2137 * @param[in]    mb_svc_handle   the handle of DB
2138 * @param[in]    cluster_id              folder ID
2139 * @param[out]   folder_path             folder path name
2140 * @param[in]    max_length              specify the maximum length of @p folder_path.
2141 * @exception    None.
2142 * @remarks      None.
2143 * @see  None.
2144 * @pre  None
2145 * @post None
2146 * @par example
2147 * @code
2148
2149         #include <media-svc.h>
2150
2151         void test_minfo_get_cluster_fullpath_by_id(MediaSvcHandle *mb_svc_handle)
2152         {
2153                 int ret = -1;
2154                 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
2155                 char *folder_path[1024];
2156
2157                 //get cluster's path name using cluster's id.
2158                 ret = minfo_get_cluster_fullpath_by_id(mb_svc_handle, cluster_id, folder_path, sizeof(folder_path));
2159
2160                 if( ret < 0) {
2161                         printf("test_minfo_get_cluster_fullpath_by_id failed\n");
2162                         return;
2163                 } else {
2164                         printf("path name is %s\n", cluster_name);
2165                         return;
2166                 }
2167      }
2168 * @endcode
2169 */
2170
2171 int
2172 minfo_get_cluster_fullpath_by_id(MediaSvcHandle *mb_svc_handle, const char *cluster_id, char *folder_path, int max_length);
2173
2174
2175
2176 /**
2177 * minfo_set_cluster_lock_status
2178 * @fn     int  minfo_set_cluster_lock_status( int cluster_id, int lock_status );
2179 * This function set status for lock to DB. This will be called when user want to set to lock an album.
2180 *
2181 * @return       This function returns 0 on success, and -1 on failure.
2182 * @param[in]    mb_svc_handle   the handle of DB
2183 * @param[in]    cluster_id              folder ID
2184 * @param[in]    lock_status             status for lock to be saved ( 0 : unlock, 1 : lock )
2185 * @exception    None.
2186 * @remarks      None.
2187 * @see  minfo_get_cluster_lock_status.
2188 * @pre  None
2189 * @post None
2190 * @par example
2191 * @code
2192
2193         #include <media-svc.h>
2194
2195         void test_minfo_set_cluster_lock_status(MediaSvcHandle *mb_svc_handle)
2196         {
2197                 int ret = -1;
2198                 int status = 1;
2199                 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
2200
2201                 //set s cluster lock status.
2202                 ret = minfo_set_cluster_lock_status(mb_svc_handle, cluster_id, status);
2203
2204                 if( ret < 0) {
2205                         printf("test_minfo_set_cluster_lock_status failed\n");
2206                         return;
2207                 }
2208         }
2209 * @endcode
2210 */
2211
2212 int
2213 minfo_set_cluster_lock_status(MediaSvcHandle *mb_svc_handle, const char *cluster_id, int lock_status);
2214
2215 /**
2216 * minfo_get_cluster_lock_status
2217 * @fn     int  minfo_get_cluster_lock_status( int cluster_id, int *lock_status );
2218 * This function gets status for lock from DB.  This will be called when user want to get lock status for an album.
2219 *
2220 * @return       This function returns 0 on success, and -1 on failure.
2221 * @param[in]    mb_svc_handle   the handle of DB
2222 * @param[in]    cluster_id              folder ID
2223 * @param[out]   lock_status             status for cuurent lock status
2224 * @exception    None.
2225 * @remarks      None.
2226 * @see  minfo_set_cluster_lock_status.
2227 * @pre  None
2228 * @post None
2229 * @par example
2230 * @code
2231
2232         #include <media-svc.h>
2233
2234         void test_minfo_get_cluster_lock_status(MediaSvcHandle *mb_svc_handle)
2235         {
2236                 int ret = -1;
2237                 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
2238                 int status = -1;
2239
2240                 //get a cluster's status.
2241                 ret = minfo_get_cluster_lock_status(mb_svc_handle, cluster_id, &status);
2242
2243                 if( ret < 0) {
2244                         printf("test_minfo_get_cluster_lock_status failed\n");
2245                         return;
2246                 } else {
2247                         print("Current status : %d\n", status);
2248                         return;
2249                 }
2250         }
2251 * @endcode
2252 */
2253
2254 int
2255 minfo_get_cluster_lock_status(MediaSvcHandle *mb_svc_handle, const char *cluster_id, int *lock_status );
2256
2257 /**
2258 * @fn     int  minfo_get_media_path( minfo_store_type storage_type, char* media_path, size_t max_media_path);
2259 * This function gets the path of media.  This will be called when user want to get path of direcotry containing media in device.
2260 *
2261 * @return       This function returns 0 on success, and -1 on failure.
2262 * @param[in]    storage_type    store type, which means type of device containg media.
2263 * @param[out]   media_path              path of media
2264 * @param[in]    max_media_path  The max length of the returned media_path.
2265 * @exception    None.
2266 * @remarks      None.
2267 * @see  None.
2268 * @pre  None
2269 * @post None
2270 * @par example
2271 * @code
2272
2273         #include <media-svc.h>
2274
2275         void test_minfo_get_media_path(void)
2276         {
2277                 int ret = -1;
2278                 char media_path[256] = {'\0'};
2279
2280                 //get media's fullpath.
2281                 ret = minfo_get_media_path(MINFO_PHONE, media_path, sizeof(media_path));
2282
2283                 if( ret < 0) {
2284                         printf("minfo_get_media_path failed\n");
2285                         return;
2286                 } else {
2287                         print("The returned path : %s\n", media_path);
2288                         return;
2289                 }
2290         }
2291 * @endcode
2292 */
2293
2294 int
2295 minfo_get_media_path(minfo_store_type storage_type, char* media_path, size_t max_media_path );
2296
2297
2298 /**
2299  *      minfo_set_db_valid
2300  *      This function set whether all the media contents in a type of storage are valid, like phone or MMC.
2301  *      Actually media service will filter all the media contents query from database by the media validation.
2302  *      This function is always used for MMC card insert/inject operation, in file manager service library.
2303  *      When inject a MMC card, the media records for MMC are not deleted really, but are set to be invalid.
2304  *
2305  *      @param[in]      mb_svc_handle   the handle of DB
2306  *      @param[in]      storage_type    information for storage type
2307  *      @param[in]      valid                   whether the track item is valid.
2308  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2309  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2310  *      @see    minfo_delete_invalid_media_records.
2311  *      @pre    None
2312  *      @post   None
2313  *      @remarks        None
2314  *      @par example
2315  *      @code
2316
2317 #include <media-svc.h>
2318
2319 void set_db_valid(MediaSvcHandle *mb_svc_handle)
2320 {
2321         int ret = MB_SVC_ERROR_NONE;
2322         bool valid = TRUE;
2323
2324         //set the validation of medias in MMC storage in db.
2325         ret = minfo_set_db_valid(mb_svc_handle, MINFO_MMC, valid);
2326         if (ret < 0) {
2327                 printf( "failed to set db invalid. error code->%d", ret);
2328                 return;
2329         }
2330 }
2331
2332  *      @endcode
2333  */
2334
2335 int minfo_set_db_valid(MediaSvcHandle *mb_svc_handle, const minfo_store_type storage_type, int valid);
2336
2337 /**
2338  *      minfo_set_item_valid_start
2339  *      This function set whether the media content in a type of storage is valid, like phone or MMC.
2340  *      Actually media service will filter all the media contents query from database by the media validation.
2341  *
2342  *      @param[in]      mb_svc_handle   the handle of DB
2343  *      @param[in]      trans_count             count of trasaction user wants
2344  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2345  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2346  *      @see    minfo_set_item_valid, minfo_set_item_valid_end
2347  *      @pre    None
2348  *      @post   None
2349  *      @remarks        None
2350  *      @par example
2351  *      @code
2352
2353 #include <media-svc.h>
2354
2355 void set_item_valid_batch(MediaSvcHandle *mb_svc_handle)
2356 {
2357         int i;
2358         int ret = MB_SVC_ERROR_NONE;
2359         bool valid = TRUE;
2360
2361         ret = minfo_set_item_valid_start(mb_svc_handle, 100);
2362         if (ret < 0) {
2363                 printf( "minfo_set_item_valid_start failed. error code->%d", ret);
2364                 return;
2365         }
2366
2367         for (i = 0; i < 200; i++) {
2368                 //set the validation of a media in MMC storage in db.
2369                 ret = minfo_set_item_valid(mb_svc_handle, MINFO_MMC, image_files[i], valid);
2370                 if (ret < 0) {
2371                         printf( "failed to set item valid. error code->%d", ret);
2372                         return;
2373                 }
2374         }
2375
2376         ret = minfo_set_item_valid_end(mb_svc_handle);
2377         if (ret < 0) {
2378                 printf( "minfo_set_item_valid_end failed. error code->%d", ret);
2379                 return;
2380         }
2381
2382         return;
2383 }
2384
2385  *      @endcode
2386  */
2387
2388 int minfo_set_item_valid_start(MediaSvcHandle *mb_svc_handle, int trans_count);
2389
2390
2391 /**
2392  *      minfo_set_item_valid_end
2393  *      This function set whether the media content in a type of storage is valid, like phone or MMC.
2394  *      Actually media service will filter all the media contents query from database by the media validation.
2395  *
2396  *      @param[in]      mb_svc_handle   the handle of DB
2397  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2398  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2399  *      @see    minfo_set_item_valid_start, minfo_set_item_valid
2400  *      @pre    None
2401  *      @post   None
2402  *      @remarks        None
2403  *      @par example
2404  *      @code
2405
2406 #include <media-svc.h>
2407
2408 void set_item_valid_batch(MediaSvcHandle *mb_svc_handle)
2409 {
2410         int i;
2411         int ret = MB_SVC_ERROR_NONE;
2412         bool valid = TRUE;
2413
2414         ret = minfo_set_item_valid_start(mb_svc_handle, 100);
2415         if (ret < 0) {
2416                 printf( "minfo_set_item_valid_start failed. error code->%d", ret);
2417                 return;
2418         }
2419
2420         for (i = 0; i < 200; i++) {
2421                 //set the validation of a media in MMC storage in db.
2422                 ret = minfo_set_item_valid(mb_svc_handle, MINFO_MMC, image_files[i], valid);
2423                 if (ret < 0) {
2424                         printf( "failed to set item valid. error code->%d", ret);
2425                         return;
2426                 }
2427         }
2428
2429         ret = minfo_set_item_valid_end(mb_svc_handle);
2430         if (ret < 0) {
2431                 printf( "minfo_set_item_valid_end failed. error code->%d", ret);
2432                 return;
2433         }
2434
2435         return;
2436 }
2437
2438  *      @endcode
2439  */
2440 int minfo_set_item_valid_end(MediaSvcHandle *mb_svc_handle);
2441
2442
2443 /**
2444  *      minfo_set_item_valid
2445  *      This function set whether the media content in a type of storage is valid, like phone or MMC.
2446  *      Actually media service will filter all the media contents query from database by the media validation.
2447  *
2448  *      @param[in]      mb_svc_handle   the handle of DB
2449  *      @param[in]      storage_type    information for storage type
2450  *      @param[in]      full_path               The path of the media
2451  *      @param[in]      valid                   whether the track item is valid.
2452  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2453  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2454  *      @see    minfo_set_item_valid_start, minfo_set_item_valid_end
2455  *      @pre    None
2456  *      @post   None
2457  *      @remarks        None
2458  *      @par example
2459  *      @code
2460
2461 #include <media-svc.h>
2462
2463 void set_item_valid_batch(MediaSvcHandle *mb_svc_handle)
2464 {
2465         int i;
2466         int ret = MB_SVC_ERROR_NONE;
2467         bool valid = TRUE;
2468
2469         ret = minfo_set_item_valid_start(mb_svc_handle, 100);
2470         if (ret < 0) {
2471                 printf( "minfo_set_item_valid_start failed. error code->%d", ret);
2472                 return;
2473         }
2474
2475         for (i = 0; i < 200; i++) {
2476                 //set the validation of a media in MMC storage in db.
2477                 ret = minfo_set_item_valid(mb_svc_handle, MINFO_MMC, image_files[i], valid);
2478                 if (ret < 0) {
2479                         printf( "failed to set item valid. error code->%d", ret);
2480                         return;
2481                 }
2482         }
2483
2484         ret = minfo_set_item_valid_end(mb_svc_handle);
2485         if (ret < 0) {
2486                 printf( "minfo_set_item_valid_end failed. error code->%d", ret);
2487                 return;
2488         }
2489
2490         return;
2491 }
2492
2493  *      @endcode
2494  */
2495
2496
2497 int minfo_set_item_valid(MediaSvcHandle *mb_svc_handle,
2498                                 const minfo_store_type storage_type,
2499                                 const char *full_path,
2500                                 int valid);
2501
2502
2503 /**
2504  *      minfo_delete_invalid_media_records
2505  *      This function delete all of invalid media records in a type of storage are valid, like phone or MMC.
2506  *      Actually media service will filter all the media contents query from database by the media validation.
2507  *      This function is always used for MMC card insert/inject operation, in file manager service library.
2508  *      When inject a MMC card, the media records for MMC are not deleted really, but are set to be invalid.
2509  *
2510  *      @param[in]      mb_svc_handle   the handle of DB
2511  *      @param[in]   storage_type       information for storage type
2512  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2513  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2514  *      @see    minfo_set_db_valid.
2515  *      @pre    None
2516  *      @post   None
2517  *      @remarks        None
2518  *      @par example
2519  *      @code
2520
2521 #include <media-svc.h>
2522
2523 void test_minfo_delete_invalid_media_records(MediaSvcHandle *mb_svc_handle)
2524 {
2525         int ret = MB_SVC_ERROR_NONE;
2526
2527         //delete the invalid media records in MMC storage in db.
2528         ret = minfo_delete_invalid_media_records(mb_svc_handle, MINFO_MMC);
2529         if (ret < 0) {
2530                 printf( "failed to delete invalid items. error code->%d", ret);
2531                 return;
2532         }
2533 }
2534
2535  *      @endcode
2536  */
2537
2538 int
2539 minfo_delete_invalid_media_records(MediaSvcHandle *mb_svc_handle, const minfo_store_type storage_type);
2540
2541 /**
2542  *      minfo_delete_tag
2543  *      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
2544  *    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
2545  *    @p tag_name to successfully delete.
2546  *
2547  *      @param[in]      mb_svc_handle   the handle of DB
2548  *      @param[in]      media_id        identify a media item with this ID
2549  *      @param[in]      tag_name        name of deleted tag
2550  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2551  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2552  *      @see    None.
2553  *      @pre    None
2554  *      @post   None
2555  *      @remarks        None
2556  *      @par example
2557  *      @code
2558
2559 #include <media-svc.h>
2560
2561 void delete_a_tag(MediaSvcHandle *mb_svc_handle)
2562 {
2563         int ret = MB_SVC_ERROR_NONE;
2564
2565         //delete all tag records in 'media_tag' in db, whose tag name is 'test_tag'.
2566         ret = minfo_delete_tag(mb_svc_handle, -1, "test tag");
2567         if (ret < 0) {
2568                 printf( "failed to delete a tag record. error code->%d", ret);
2569                 return;
2570         }
2571 }
2572
2573  *      @endcode
2574  */
2575
2576 int
2577 minfo_delete_tag(MediaSvcHandle *mb_svc_handle, const char *media_id, const char* tag_name);
2578
2579
2580 /**
2581  *      minfo_rename_tag:
2582  *      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 
2583  *    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
2584  *    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.
2585  *
2586  *      @param[in]      mb_svc_handle   the handle of DB
2587  *      @param[in]      src_tagname             identify original tag name
2588  *      @param[in]      dst_tag_name    new tag name.
2589  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2590  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2591  *      @see    None.
2592  *      @pre    None
2593  *      @post   None
2594  *      @remarks        None
2595  *      @par example
2596  *      @code
2597
2598 #include <media-svc.h>
2599
2600 void test_minfo_rename_tag(MediaSvcHandle *mb_svc_handle)
2601 {
2602         int ret = MB_SVC_ERROR_NONE;
2603
2604         //rename all tag records with new tag name 'test_tag2'.
2605         ret = minfo_rename_tag(mb_svc_handle, "test tag1", "test tag2");
2606         if (ret < 0) {
2607                 printf( "failed to rename tag records. error code->%d", ret);
2608                 return;
2609         }
2610 }
2611
2612  *      @endcode
2613  */
2614
2615 int
2616 minfo_rename_tag(MediaSvcHandle *mb_svc_handle, const char* src_tagname, const char* dst_tag_name);
2617
2618 /**
2619  *      minfo_rename_tag_by_id:
2620  *      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 
2621  *    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. 
2622  *    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 
2623  *    update old tag record  to new tag record.
2624  *
2625  *      @param[in]      mb_svc_handle   the handle of DB
2626  *      @param[in]      media_id                identify original tag record with @p src_tagname
2627  *      @param[in]      src_tagname             identify original tag record with @p media_id
2628  *      @param[in]      dst_tag_name    new tag name.
2629  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2630  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2631  *      @see    None.
2632  *      @pre    None
2633  *      @post   None
2634  *      @remarks        None
2635  *      @par example
2636  *      @code
2637
2638 #include <media-svc.h>
2639
2640 void test_minfo_rename_tag_by_id(MediaSvcHandle *mb_svc_handle)
2641 {
2642         int ret = MB_SVC_ERROR_NONE;
2643         const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
2644
2645         //rename some tag record with new tag name 'test_tag2'.
2646         ret = minfo_rename_tag_by_id(mb_svc_handle, media_id, "test tag1", "test tag2");
2647         if (ret < 0) {
2648                 printf( "failed to rename tag records. error code->%d", ret);
2649                 return;
2650         }
2651 }
2652
2653  *      @endcode
2654  */
2655
2656 int
2657 minfo_rename_tag_by_id(MediaSvcHandle *mb_svc_handle, const char *media_id, const char* src_tagname, const char* dst_tag_name);
2658
2659
2660
2661
2662 /**
2663  *      minfo_add_tag:
2664  *      This function could add a new tag into 'media_tag' table in database. When user create a new tag and will
2665  *    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 
2666  *    some media items to it, he/she should do a loop to insert them into 'media_tag' table in database, meanwhile
2667  *    should fill up @p media_id and @p tag_name with appropriate values.
2668  *
2669  *      @param[in]      mb_svc_handle   the handle of DB
2670  *      @param[in]      media_id                identify a media item with this ID
2671  *      @param[in]      tag_name                name of new added tag
2672  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2673  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2674  *      @see    None.
2675  *      @pre    None
2676  *      @post   None
2677  *      @remarks        None
2678  *      @par example
2679  *      @code
2680
2681 #include <media-svc.h>
2682
2683 void add_a_tag(MediaSvcHandle *mb_svc_handle)
2684 {
2685         int ret = MB_SVC_ERROR_NONE;
2686
2687         //add a tag record in 'media_tag' in db, and not add any media item to it.
2688         ret = minfo_add_tag(mb_svc_handle, NULL, "test tag");
2689         if (ret < 0)
2690         {
2691                 printf( "failed to add a tag record. error code->%d", ret);
2692                 return;
2693         }
2694
2695         return;
2696 }
2697
2698  *      @endcode
2699  */
2700
2701 int
2702 minfo_add_tag(MediaSvcHandle *mb_svc_handle, const char *media_id, const char* tag_name);
2703
2704 /**
2705  *      minfo_get_media_list_by_tagname:
2706  *      This function could get a media items' list who are included to the same tag according to tag name .
2707  *      User could dictate whether he/she hope to get meta data of media item with @p with_meta. Yes if TRUE,
2708  *    no if FALSE.
2709  *
2710  *      @param[in]      mb_svc_handle   the handle of DB
2711  *      @param[in]      tag_name        tag name
2712  *      @param[in]      with_meta       indicate whether want to get meta data of media item
2713  *      @param[in]      func            Iterative callback implemented by a user. This callback is called when an item has to be inserted to user's list.
2714  *      @param[out]     user_data       user's data structure to contain items of the type Mitem. It is passed to the iterative callback.
2715  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2716  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2717  *      @see    None.
2718  *      @pre    None
2719  *      @post   None
2720  *      @remarks        None
2721  *      @par example
2722  *      @code
2723
2724 #include <media-svc.h>
2725
2726 int mitem_ite_cb(Mitem *item, void *user_data)
2727 {
2728         GList** list = (GList**)user_data;
2729         *list = g_list_append(*list, item);
2730 }
2731
2732
2733 void get_media_list_tag_name(MediaSvcHandle *mb_svc_handle)
2734 {
2735         int ret = MB_SVC_ERROR_NONE;
2736         GList *p_list = NULL;
2737
2738         //get a media items' list who are included to the same tag with 'test tag'.
2739         ret = minfo_get_media_list_by_tagname(mb_svc_handle, "test tag", FALSE, mitem_ite_cb, &p_list);
2740         if (ret < 0) {
2741                 printf( "failed to get a media items' list. error code->%d", ret);
2742                 return;
2743         }
2744 }
2745
2746  *      @endcode
2747  */
2748
2749 int
2750 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 );
2751
2752 /**
2753  *      minfo_get_media_list_by_tagname_with_filter:
2754  *      This function could get a media items' list who are included to the same tag according to tag name and filter.
2755  *      User could dictate whether he/she hope to get meta data of media item with @p with_meta. Yes if TRUE,
2756  *  no if FALSE.
2757  *
2758  *      @param[in]      mb_svc_handle   the handle of DB
2759  *      @param[in]      tag_name                tag name
2760  *  @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.
2761  *      @param[in]      func                    Iterative callback implemented by a user. This callback is called when an item has to be inserted to user's list.
2762  *      @param[out]     user_data               user's data structure to contain items of the type Mitem. It is passed to the iterative callback.
2763  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2764  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2765  *      @see    None.
2766  *      @pre    None
2767  *      @post   None
2768  *      @remarks        None
2769  *      @par example
2770  *      @code
2771
2772 #include <media-svc.h>
2773
2774 int mitem_ite_cb(Mitem *item, void *user_data)
2775 {
2776         GList** list = (GList**)user_data;
2777         *list = g_list_append(*list, item);
2778 }
2779
2780
2781 void get_media_list_by_tagname_with_filter(MediaSvcHandle *mb_svc_handle)
2782 {
2783         int ret = MB_SVC_ERROR_NONE;
2784         GList *p_list = NULL;
2785         minfo_tag_filter filter;
2786
2787         filter.start_pos = 0;
2788         filter.end_pos = 3;
2789         filter.file_type = MINFO_ITEM_ALL;
2790         filter.with_meta = FALSE;
2791
2792         //get a media items' list who are included to the same tag with 'test tag'.
2793         ret = minfo_get_media_list_by_tagname_with_filter(mb_svc_handle, "test tag", filter, mitem_ite_cb, &p_list);
2794         if (ret < 0) {
2795                 printf( "failed to get a media items' list. error code->%d", ret);
2796                 return;
2797         }
2798 }
2799
2800  *      @endcode
2801  */
2802
2803 int
2804 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 );
2805
2806 /**
2807  *      minfo_get_media_count_by_tagname:
2808  *      This function could get count of media items, which are included to the same tag according to tag name .
2809  *      User could dictate whether he/she hope to get count of media items.
2810  *
2811  *      @param[in]      mb_svc_handle   the handle of DB
2812  *      @param[in]      tag_name                tag name
2813  *      @param[out]     count                   count of media items
2814  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2815  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2816  *      @see    None.
2817  *      @pre    None
2818  *      @post   None
2819  *      @remarks        None
2820  *      @par example
2821  *      @code
2822
2823 #include <media-svc.h>
2824
2825 void test_minfo_get_media_count_by_tagname(MediaSvcHandle *mb_svc_handle)
2826 {
2827         int ret = MB_SVC_ERROR_NONE;
2828         int count = 0;
2829
2830         //get count of media items, which are included to the same tag with 'test tag'.
2831         ret = minfo_get_media_count_by_tagname(mb_svc_handle, "test tag", &count);
2832         if (ret < 0) {
2833                 printf( "failed to get a media items' list. error code->%d", ret);
2834         } else {
2835                 printf( "Count is %d\n", count );       
2836         }
2837
2838         return;
2839 }
2840
2841  *      @endcode
2842  */
2843
2844 int
2845 minfo_get_media_count_by_tagname(MediaSvcHandle *mb_svc_handle, const char* tag_name, int* count );
2846
2847 /**
2848  *      minfo_get_tag_list_by_media_id:
2849  *      This function could get a tags' list whose memeber is Mtag type. User should pass @p media_id to indicate which
2850  *    media item will be searched. Also he/she should define a callback function to be called by this function.
2851  *
2852  *      @param[in]      mb_svc_handle   the handle of DB
2853  *      @param[in]      media_id                identify a media item with ID
2854  *      @param[in]      func                    Iterative callback implemented by a user. This callback is called when an item has to be inserted to user's list.
2855  *      @param[out]     user_data               user's data structure to contain items of the type Mtag. It is passed to the iterative callback.
2856  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2857  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2858  *      @see    minfo_set_db_valid.
2859  *      @pre    None
2860  *      @post   None
2861  *      @remark None
2862  *      @par example
2863  *      @code
2864
2865 #include <media-svc.h>
2866
2867 int mtag_ite_cb(Mtag *i_tag, void *user_data)
2868 {
2869         GList** list = (GList**)user_data;
2870         *list = g_list_append(*list, item);
2871 }
2872
2873
2874 void get_tag_list_media_id(MediaSvcHandle *mb_svc_handle)
2875 {
2876         int ret = MB_SVC_ERROR_NONE;
2877         const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
2878         GList *p_list = NULL;
2879
2880         //get a tags' list which include the same media item and it's media_id is b6a4f4ac-26ea-458c-a228-9aef7f70349d.
2881         ret = minfo_get_tag_list_by_media_id(mb_svc_handle, media_id, mtag_ite_cb, &p_list);
2882         if (ret < 0) {
2883                 printf( "failed to get a tags' list. error code->%d", ret);
2884                 return;
2885         }
2886 }
2887
2888  *      @endcode
2889  */
2890
2891 int
2892 minfo_get_tag_list_by_media_id(MediaSvcHandle *mb_svc_handle, const char *media_id, minfo_tag_ite_cb func, void* user_data);
2893
2894 /**
2895  *      minfo_add_web_cluster
2896  *      This function could add a web album through specifying it's @p name, @p account_id. After adding a web
2897  *    album, this function will return @p id.
2898  *
2899  *      @param[in]      mb_svc_handle   the handle of DB
2900  *      @param[in]      sns_type                sns type, like, facebook, flickr, etc.
2901  *      @param[in]      name            new added web album's name.
2902  *      @param[in]      account_id      account ID.
2903  *      @param[out]     id                      return album's id.
2904  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2905  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2906  *      @see    minfo_add_web_cluster_album_id.
2907  *      @pre    None
2908  *      @post   None
2909  *      @remarks        None
2910  *      @par example
2911  *      @code
2912
2913 #include <media-svc.h>
2914
2915
2916 void add_web_cluster(MediaSvcHandle *mb_svc_handle)
2917 {
2918         int ret = MB_SVC_ERROR_NONE;
2919         char cluster_id[256] = {0,};
2920         
2921         //add a web album.
2922         ret = minfo_add_web_cluster(mb_svc_handle, 1, "web_album",  "1", cluster_id, sizeof(cluster_id));
2923         if (ret < 0) {
2924                 printf( "failed to add a web album. error code->%d", ret);
2925         }
2926
2927         return;
2928 }
2929
2930  *      @endcode
2931  */
2932
2933 int
2934 minfo_add_web_cluster(MediaSvcHandle *mb_svc_handle, int sns_type, const char* name,const char *account_id, char* id, int max_length);
2935
2936
2937 /**
2938  *      minfo_add_web_cluster_album_id
2939  *      This function could add a web album through specifying it's @p name, @p account_id, @p album_id. After adding a web
2940  *    album, this function will return @p id.
2941  *
2942  *      @param[in]      mb_svc_handle   the handle of DB
2943  *      @param[in]      sns_type        sns type, like, facebook, flickr, etc.
2944  *      @param[in]      name            new added web album's name.
2945  *      @param[in]      account_id      account ID.
2946  *      @param[in]      album_id        web album id
2947  *      @param[out]     id                      return album's id.
2948  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2949  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2950  *      @see    minfo_add_web_cluster.
2951  *      @pre    None
2952  *      @post   None
2953  *      @remarks        None
2954  *      @par example
2955  *      @code
2956
2957 #include <media-svc.h>
2958
2959
2960 void add_web_cluster_album_id(MediaSvcHandle *mb_svc_handle)
2961 {
2962         int ret = MB_SVC_ERROR_NONE;
2963         char cluster_id[256] = {0,};
2964
2965         //add a web album.
2966         ret = minfo_add_web_cluster_album_id(mb_svc_handle, 1, "web_album",  "1", "1", cluster_id, sizeof(cluster_id));
2967         if (ret < 0) {
2968                 printf( "failed to add a web album. error code->%d", ret);
2969                 return;
2970         }
2971
2972         return;
2973 }
2974
2975  *      @endcode
2976  */
2977
2978 int
2979 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);
2980
2981 /**
2982  *      minfo_delete_web_cluster
2983  *      This function could delete a web album through specifying @p cluster_id. After deleteing a web
2984  *    album, the application will not be able to get this web album displaying.
2985  *
2986  *      @param[in]      mb_svc_handle   the handle of DB
2987  *      @param[in]      cluster_id              cluster ID identifying a web album.
2988  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
2989  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
2990  *      @see    None.
2991  *      @pre    None
2992  *      @post   None
2993  *      @remarks        None
2994  *      @par example
2995  *      @code
2996
2997 #include <media-svc.h>
2998
2999 void delete_web_cluster(MediaSvcHandle *mb_svc_handle)
3000 {
3001         int ret = MB_SVC_ERROR_NONE;
3002         const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
3003         
3004         //delete a web album.
3005         ret = minfo_delete_web_cluster(mb_svc_handle, cluster_id);
3006         if (ret < 0) {
3007                 printf( "failed to delete a web album. error code->%d", ret);
3008                 return;
3009         }
3010
3011         return;
3012 }
3013
3014  *      @endcode
3015  */
3016
3017 int
3018 minfo_delete_web_cluster(MediaSvcHandle *mb_svc_handle, const char *cluster_id);
3019
3020 /**
3021 * minfo_get_web_cluster_by_web_account_id
3022 * This function gets list of mcluster by web account id. User could get the detail information with
3023 * the type 'Mcluster' about this cluster, the type 'Mcluster' mainly include folder/cluster ID, display name, 
3024 * count of included media content, etc. The detail defination of this type could refer to the herder file, minfo_item/minfo-cluster.h.
3025 *
3026 * @return This function returns 0 on success, or negative value with error code.
3027 *         Please refer 'media-svc-error.h' to know the exact meaning of the error.
3028 * @param        mb_svc_handle   [in]    the handle of DB
3029 * @param        web_account_id  [in]    the web account ID which indentify a cluster
3030 * @param        func                    [in]    Iterative callback implemented by a user. This callback is called when an item has to be inserted to user's list.
3031 * @param        user_data               [out]   user's data structure to contain items of the type Mcluster. It is passed to the iterative callback.
3032 * @exception None.
3033 * @remarks User could pass web account id to this function, so that
3034 *          this function still could get the wanted list of clusters
3035 *          when invoking this function.
3036 * @see  None.
3037 * @pre  None
3038 * @post None
3039 * @par example
3040 * @code
3041
3042
3043         #include <media-svc.h>
3044         int mcluster_ite_cb(Mcluster *cluster, void *user_data)
3045         {
3046                 GList** list = (GList**)user_data;
3047                 *list = g_list_append(*list, cluster);
3048         }
3049
3050         void test_minfo_get_web_cluster_by_web_account_id(MediaSvcHandle *mb_svc_handle)
3051         {
3052                 int ret = -1;
3053                 const char* account_id = "user";
3054                 GList *p_list = NULL;
3055                 
3056                 //get a web cluster using account id.
3057                 ret = minfo_get_web_cluster_by_web_account_id(mb_svc_handle, account_id, mcluster_ite_cb, &p_list);
3058                 if(ret < 0) {
3059                         printf("minfo_get_web_cluster_by_web_account_id fail: %d \n", ret);
3060                         return;
3061                 }
3062          }
3063 * @endcode
3064 */
3065
3066 int
3067 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);
3068
3069 /**
3070 * minfo_get_web_cluster_web_album_id
3071 * This function gets mcluster information by web cluster id. User could get the detail information with
3072 * the type 'Mcluster' about this cluster, the type 'Mcluster' mainly include folder/cluster ID, display name,
3073 * count of included media content, etc. The detail defination of this type could refer to the herder file, minfo-cluster.h.
3074 *
3075 * @return       This function returns 0 on success, or negative value with error code.
3076 * @param        mb_svc_handle   [in]    the handle of DB
3077 * @param        cluster_id              [in]    the cluster ID which indentify a cluster
3078 * @param        mcluster                [out]   mcluster to be returned, which is a 'Mcluster' type
3079 * @exception None.
3080 * @remarks User could pass cluster id to this function, so that
3081 *          this function still could get the wanted cluster.
3082 *          when invoking this function, *mcluster must equals NULL, and
3083 *          after using mitem, it must be freed with minfo_destroy_mtype_item.
3084 * @see  None.
3085 * @pre  None
3086 * @post None
3087 * @par example
3088 * @code
3089
3090         #include <media-svc.h>
3091
3092         void test_minfo_get_web_cluster_web_album_id(MediaSvcHandle *mb_svc_handle)
3093         {
3094                 int ret = -1;
3095                 Mcluster *mc = NULL;
3096                 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
3097
3098                 //get a cluster using cluster's id.
3099                 ret = minfo_get_web_cluster_web_album_id(mb_svc_handle, cluster_id, &mc);
3100                 if(ret < 0) {
3101                         printf("minfo_get_web_cluster_web_album_id fail: %d \n", ret);
3102                         return;
3103                 }
3104
3105                 minfo_destroy_mtype_item(mc);
3106          }
3107 * @endcode
3108 */
3109
3110 int
3111 minfo_get_web_cluster_web_album_id(MediaSvcHandle *mb_svc_handle, const char *web_album_id, Mcluster **mcluster);
3112
3113 /**
3114  *      minfo_add_web_media
3115  *      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
3116  *    @p thumb_path. If failed to add it to web album, this function will return an error code.
3117  *
3118  *      @param[in]      mb_svc_handle   the handle of DB
3119  *      @param[in]      cluster_id              specify cluster id to indentify a web album.
3120  *      @param[in]      http_url                web media's url.
3121  *      @param[in]      file_name               file name.
3122  *      @param[in]      thumb_path              thumbnail full path of this web media
3123  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
3124  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
3125  *      @see    None.
3126  *      @pre    None
3127  *      @post   None
3128  *      @remarks        None
3129  *      @par example
3130  *      @code
3131
3132 #include <media-svc.h>
3133
3134 void test_minfo_add_web_media(MediaSvcHandle *mb_svc_handle)
3135 {
3136         int ret = MB_SVC_ERROR_NONE;
3137         const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
3138         
3139         //add a web media to a web album.
3140         ret = minfo_add_web_media(mb_svc_handle, cluster_id, "http://user/specifying/address",  "web_media", "thumbnail path");
3141         if (ret < 0) {
3142                 printf( "failed to add to a web album. error code->%d", ret);
3143                 return;
3144         }
3145
3146         return;
3147 }
3148
3149  *      @endcode
3150  */
3151
3152 DEPRECATED_API int
3153 minfo_add_web_media(MediaSvcHandle *mb_svc_handle, const char *cluster_id, const char* http_url, const char* file_name, const char* thumb_path);
3154
3155 /**
3156  *      minfo_add_web_media_with_type
3157  *      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, 
3158  *    @p thumb_path. If failed to add it to web album, this function will return an error code.
3159  *
3160  *      @param[in]      mb_svc_handle   the handle of DB
3161  *      @param[in]      cluster_id              specify cluster id to indentify a web album.
3162  *      @param[in]      http_url                web media's url.
3163  *      @param[in]      file_name               file name.
3164  *      @param[in]      content_type    type of the media.
3165  *      @param[in]      thumb_path              thumbnail full path of this web media
3166  *      @return This function returns zero(MB_SVC_ERROR_NONE) on success, or negative value with error code.
3167  *                      Please refer 'media-svc-error.h' to know the exact meaning of the error.
3168  *      @see    None.
3169  *      @pre    None
3170  *      @post   None
3171  *      @remark None
3172  *      @par example
3173  *      @code
3174
3175 #include <media-svc.h>
3176
3177
3178 void test_minfo_add_web_media_with_type(MediaSvcHandle *mb_svc_handle)
3179 {
3180         int ret = MB_SVC_ERROR_NONE;
3181         const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
3182         
3183         //add a web media to a web album.
3184         ret = minfo_add_web_media_with_type(mb_svc_handle, cluster_id, "http://user/specifying/address",  "web_media", MINFO_ITEM_IMAGE, "thumbnail name");
3185         if (ret < 0) {
3186                 printf( "failed to add to a web album. error code->%d", ret);
3187                 return;
3188         }
3189
3190         return;
3191 }
3192
3193  *      @endcode
3194  */
3195
3196 int
3197 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);
3198
3199 /**
3200         @}
3201  */
3202
3203
3204 #ifdef __cplusplus
3205 }
3206 #endif /* __cplusplus */
3207
3208
3209
3210
3211
3212 #endif /*_VISUAL_SVC_H_*/
3213
3214