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