4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Hyunjun Ko <zzoon.ko@samsung.com>, Haejeong Kim <backto.kim@samsung.com>
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #ifndef _MINFO_INFO_H_
23 #define _MINFO_INFO_H_
26 * This file defines minfo apis for media service..
29 * @author Hyunjun Ko <zzoon.ko@samsung.com>
31 * @brief This file defines minfo apis for media service.
34 #include "minfo-types.h"
39 #endif /* __cplusplus */
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.
52 @defgroup MINFO_SVC_API Media Service
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
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()
74 * @post Call minfo_finalize() to finalize minfo api
79 #include <media-svc.h>
80 void test_minfo_init(void)
83 //open a databse file.
87 printf("minfo_init error\n");
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.
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.
109 * @pre minfo_init is already called.
115 #include <media-svc.h>
116 void test_minfo_finalize(void)
121 //close database file.
122 ret = minfo_finalize();
125 printf("minfo_finalize error\n");
133 minfo_finalize(void);
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.
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.
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.
158 #include <media-svc.h>
160 int mitem_ite_cb(Mitem *item, void *user_data)
162 GList** list = (GList**)user_data;
163 //append an item to linked list.
164 *list = g_list_append(*list, item);
167 void test_minfo_get_item_list(void)
171 GList *p_list = NULL;
172 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
174 minfo_item_filter item_filter = {MINFO_ITEM_VIDEO,MINFO_MEDIA_SORT_BY_DATE_ASC,3,10,true,true};
176 ret = minfo_get_item_list(cluster_id, item_filter, mitem_ite_cb, &p_list);
179 printf("minfo_get_item_list error\n");
188 minfo_get_item_list(const char *cluster_id, const minfo_item_filter filter, minfo_item_ite_cb func, void *user_data);
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.
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.
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.
212 #include <media-svc.h>
214 int mitem_ite_cb(Mitem *item, void *user_data)
216 GList** list = (GList**)user_data;
217 //append an item to linked list.
218 *list = g_list_append(*list, item);
221 void test_minfo_get_item_list(void)
225 GList *p_list = NULL;
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);
232 printf("minfo_get_item_list error\n");
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);
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.
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.
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.
266 #include <media-svc.h>
268 int mitem_ite_cb(Mitem *item, void *user_data)
270 GList **list = (GList **)user_data;
271 //append an item to linked list.
272 *list = g_list_append(*list, item);
275 void test_minfo_get_item_list_search(void)
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;
283 minfo_item_filter item_filter = {MINFO_ITEM_VIDEO, MINFO_MEDIA_SORT_BY_NAME_ASC, 0, 9, false, MINFO_MEDIA_FAV_ALL};
285 ret = minfo_get_item_list_search(search_field, search_str, folder_type, item_filter, mitem_ite_cb, &p_list);
288 printf("minfo_get_item_list_search error\n");
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);
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.
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.
313 #include <media-svc.h>
315 void test_minfo_get_all_item_cnt(void)
320 ret = minfo_get_all_item_cnt(&cnt);
322 printf("minfo_get_all_item_cnt error\n");
330 minfo_get_all_item_cnt(int *cnt);
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.
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
344 * @return This function returns 0 on success, or negative value with error code.
346 * @remarks list contains a set of full path string of cover file.
347 * @see minfo_get_item_list.
354 #include <media-svc.h>
356 void test_minfo_get_item_cnt(void)
359 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
361 minfo_item_filter item_filter = {MINFO_ITEM_VIDEO,MINFO_MEDIA_SORT_BY_DATE_ASC,-1,10,true,true};
363 //get count of a set of items.
364 ret = minfo_get_item_cnt(cluster_id, item_filter, &cnt);
366 printf("test_minfo_get_item_cnt error\n");
374 minfo_get_item_cnt(const char *cluster_id, const minfo_item_filter filter, int *cnt);
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.
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.
391 * @see minfo_get_cluster_list.
398 #include <media-svc.h>
400 void test_minfo_get_cluster_cnt(void)
403 minfo_cluster_filter cluster_filter ={MINFO_CLUSTER_TYPE_ALL,MINFO_CLUSTER_SORT_BY_NONE,-1,10};
405 //get the count of items which is owned by a cluster.
406 ret = minfo_get_cluster_cnt(cluster_filter, &cnt);
408 printf("test_minfo_get_cluster_cnt error\n");
416 minfo_get_cluster_cnt(const minfo_cluster_filter filter, int *cnt);
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.
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.
437 #include <media-svc.h>
439 int mcluster_ite_cb(Mcluster *cluster, void *user_data)
441 GList** list = (GList**)user_data;
442 *list = g_list_append(*list, cluster);
445 void test_minfo_get_cluster_list(void)
450 GList *p_list = NULL;
451 Mcluster* cluster = NULL;
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};
456 ret = minfo_get_cluster_list(cluster_filter, mcluster_ite_cb, &p_list);
466 minfo_get_cluster_list(const minfo_cluster_filter filter, minfo_cluster_ite_cb func, void *user_data);
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.
474 * @param media_id [in] specified _id field in media table record
475 * @param meta [out] pointer to pointer of matched Mmeta instance
477 * @return This function returns 0 on success, or negative value with error code.
478 * @remarks after using meta, it must be freed. .
486 #include <media-svc.h>
488 void test_minfo_get_meta_info(void)
492 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
494 //get a matched meta data.
495 ret = minfo_get_meta_info(media_id, &mt);
497 printf("minfo_get_meta_info failed\n");
500 minfo_mmeta_destroy(mt);
507 minfo_get_meta_info(const char *media_id, Mmeta** meta);
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.
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
518 * @return This function returns 0 on success, or negative value with error code.
519 * @remarks after using meta, it must be freed.
527 #include <media-svc.h>
529 void test_minfo_update_image_meta_info_int(void)
534 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
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);
539 printf("minfo_update_image_meta_info_int failed\n");
548 minfo_update_image_meta_info_int(const char *media_id,
549 minfo_image_meta_field_t meta_field,
550 const int updated_value,
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.
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
562 * @return This function returns 0 on success, or negative value with error code.
563 * @remarks after using meta, it must be freed.
571 #include <media-svc.h>
573 void test_minfo_update_video_meta_info_int(void)
577 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
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);
583 printf("minfo_update_video_meta_info_int failed\n");
592 minfo_update_video_meta_info_int(const char *media_id, minfo_video_meta_field_t meta_field, const int updated_value);
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.
601 * @return This function returns 0 on success, and negativa value on failure.
602 * @param item [in] the input parameter, inlcuding the instanciated object.
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.
614 #include <media-svc.h>
616 void test_minfo_destroy_mtype_item(void)
621 char* file_url = "/opt/media/Images/Wallpapers/Home_01.png";
622 ret = minfo_get_item(file_url, &mi);
624 //destroy an item whose type is 'Mitem'.
625 ret = minfo_destroy_mtype_item(mi);
636 minfo_destroy_mtype_item(void* item);
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
643 * @param trans_count [in] count of trasaction user wants
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
653 #include <media-svc.h>
655 void test_minfo_add_media_batch(void)
659 err = minfo_add_media_start(100);
661 printf("minfo_add_media_start failed\n");
665 for (i = 0; i < 200; i++) {
666 err = minfo_add_media_batch(image_files[i], MINFO_ITEM_IMAGE);
669 printf("minfo_add_media_start failed\n");
674 err = minfo_add_media_end();
676 printf("minfo_add_media_end failed\n");
684 minfo_add_media_start(int trans_count);
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
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
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
702 #include <media-svc.h>
704 void test_minfo_add_media_batch(void)
708 err = minfo_add_media_start(100);
710 printf("minfo_add_media_start failed\n");
714 for (i = 0; i < 100; i++) {
715 err = minfo_add_media_batch(image_files[i], MINFO_ITEM_IMAGE);
718 printf("minfo_add_media_start failed\n");
723 err = minfo_add_media_end();
725 printf("minfo_add_media_end failed\n");
733 minfo_add_media_batch(const char* file_url, minfo_file_type content_type);
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
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
748 #include <media-svc.h>
750 void test_minfo_add_media_batch(void)
754 err = minfo_add_media_start(100);
756 printf("minfo_add_media_start failed\n");
760 for (i = 0; i < 200; i++) {
761 err = minfo_add_media_batch(image_files[i], MINFO_ITEM_IMAGE);
764 printf("minfo_add_media_start failed\n");
769 err = minfo_add_media_end();
771 printf("minfo_add_media_end failed\n");
779 minfo_add_media_end();
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
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
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
797 #include <media-svc.h>
799 void test_minfo_add_media(void)
802 char *file_url = "/opt/media/Images/Wallpapers/Home_01.png";
804 //add a new media content whose url is 'file_url'.
805 err = minfo_add_media(file_url, MINFO_ITEM_IMAGE);
808 printf("minfo_add_media failed\n");
817 minfo_add_media(const char* file_url, minfo_file_type content_type);
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.
826 * @param file_url [in] matched local file full path
828 * @return This function returns 0 on success, or negative value with error code.
830 * @see minfo_add_media
836 #include <media-svc.h>
838 void test_minfo_delete_media(void)
841 char *file_url = "/opt/media/Images/Wallpapers/Home_01.png";
843 //delete a media reord from 'media' table.
844 ret= minfo_delete_media(file_url);
847 printf("minfo_delete_media failed\n");
855 minfo_delete_media(const char* file_url);
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
867 * @return This function returns 0 on success, or negative value with error code.
869 * @see minfo_mv_media, minfo_copy_media, minfo_update_media_name.
876 #include <media-svc.h>
878 void test_minfo_move_media(void)
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";
884 //move an item to a specified location.
885 ret = minfo_move_media(old_file_url, new_file_url, MINFO_ITEM_IMAGE);
888 printf("minfo_move_media failed\n");
896 minfo_move_media(const char* old_file_url, const char *new_file_url, minfo_file_type content_type);
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
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
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
916 #include <media-svc.h>
918 void test_minfo_copy_media(void)
922 char *file_url = "/opt/media/Images/Wallpapers/Home_01.png";
923 char *new_file_url = "/opt/media/Images/Wallpapers/Home_01_1.png";
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);
928 printf("minfo_copy_media failed\n");
937 minfo_copy_media(const char* old_file_url, const char *new_file_url, minfo_file_type content_type);
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
948 * @return This function returns 0 on success, or negative value with error code.
950 * @see minfo_move_media, minfo_copy_media.
956 #include <media-svc.h>
958 void test_minfo_update_media_name(void)
961 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
964 ret = minfo_update_media_name(media_id, new_name);
966 printf("test_minfo_update_media_name failed\n");
974 minfo_update_media_name(const char *media_id, const char* new_name);
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
981 * @return This function returns 0 on success, or negative value with error code.
989 #include <media-svc.h>
991 void test_minfo_update_media_thumb(void)
994 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
995 const char *thumb_path = "/opt/media/test.jpg";
997 //update thumbnail path
998 ret = minfo_update_media_thumb(media_id, thumb_path);
1000 printf("minfo_update_media_thumb failed\n");
1008 minfo_update_media_thumb(const char *media_id, const char* thumb_path);
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.
1017 * @return This function returns 0 on success, or negative value with error code.
1025 #include <media-svc.h>
1027 void test_minfo_update_media_favorite(void)
1030 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
1032 //update an item's favorite record
1033 ret = minfo_update_media_favorite(media_id, favorite_level);
1036 printf("minfo_update_media_favorite failed\n");
1044 minfo_update_media_favorite(const char *media_id, const int favorite_level);
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.
1061 #include <media-svc.h>
1063 void test_minfo_update_media_date(void)
1066 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
1071 //update an item's date record
1072 ret = minfo_update_media_date(media_id, today);
1074 printf("minfo_update_media_date failed\n");
1082 minfo_update_media_date(const char *media_id, time_t modified_date);
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
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
1101 #include <media-svc.h>
1103 void test_minfo_add_cluster(void)
1106 char *cluster_url = "/opt/media/Images/Wallpapers";
1107 char cluster_id[256];
1109 //add a new cluster whose url is 'cluster_url'.
1110 ret = minfo_add_cluster(cluster_url, cluster_id, sizeof(cluster_id));
1112 printf("minfo_add_cluster failed\n");
1120 minfo_add_cluster(const char* cluster_url, char *id, int max_length);
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.
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.
1140 #include <media-svc.h>
1142 void test_minfo_get_item_by_id(void)
1145 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
1148 //get an item based on its media ID.
1149 ret = minfo_get_item_by_id(media_id, &mi);
1154 minfo_destroy_mtype_item(mi);
1160 minfo_get_item_by_id(const char *media_id, Mitem **mitem);
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.
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.
1180 #include <media-svc.h>
1182 void test_minfo_get_item(void)
1186 char* file_url = "/opt/media/Images/Wallpapers/Home_01.png";
1188 //get an item based on its url.
1189 ret = minfo_get_item(file_url, &mi);
1194 minfo_destroy_mtype_item(mi);
1200 minfo_get_item(const char* file_url, Mitem **mitem);
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.
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
1220 #include <media-svc.h>
1222 void test_minfo_get_item_by_http_url(void)
1226 char* http_url = "http://picasa.com/myaccount/Home_01.png";
1228 //get an item based on its http url.
1229 ret = minfo_get_item_by_http_url(http_url, &mi);
1234 minfo_destroy_mtype_item(mi);
1240 minfo_get_item_by_http_url(const char* http_url, Mitem **mitem);
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.
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
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
1266 #include <media-svc.h>
1268 void test_minfo_get_cluster(void)
1271 Mcluster *mc = NULL;
1272 char *cluster_url = "/opt/media/Images/Wallpapers";
1273 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
1275 //get a cluster using cluster's url.
1276 ret = minfo_get_cluster(cluster_url, cluster_id, &mc);
1278 printf("minfo_get_cluster fail: %d \n", ret);
1282 printf("minfo_get_cluster: %s \n", mc->display_name);
1283 minfo_mcluster_destroy(mc);
1289 minfo_get_cluster(const char* cluster_url, const char *cluster_id, Mcluster **mcluster);
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
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.
1302 * @return This function returns 0 on success, or negative value with error code.
1304 * @remarks type of item is pointer to char*,
1305 * when free list, needn't free every string.
1314 #include <media-svc.h>
1316 int cover_ite_cb(char *thumb_path, void *user_data)
1318 GList** list = (GList**)user_data;
1319 *list = g_list_append(*list, thumb_path);
1322 void test_minfo_get_cluster_cover(void)
1325 GList *p_list = NULL;
1327 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
1329 //get the cover of a cluster.
1330 ret = minfo_get_cluster_cover(cluster_id, img_cnt, cover_ite_cb, &p_list);
1332 printf("test_minfo_get_cluster_cover error\n");
1341 minfo_get_cluster_cover(const char *cluster_id, const int img_cnt, minfo_cover_ite_cb func, void *user_data);
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.
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.
1363 #include <media-svc.h>
1365 int mbookmark_ite_cb(Mbookmark *bm, void *user_data)
1367 GList** list = (GList**)user_data;
1368 *list = g_list_append(*list, bm);
1371 void test_minfo_get_bookmark_list(void)
1374 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
1375 GList *p_list = NULL;
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);
1387 minfo_get_bookmark_list(const char *media_id, minfo_bm_ite_cb func, void *user_data);
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.
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.
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.
1416 #include <media-svc.h>
1418 int mitem_ite_cb(Mitem *item, void *user_data)
1420 GList** list = (GList**)user_data;
1421 *list = g_list_append(*list, item);
1424 void test_minfo_get_geo_item_list(void)
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;
1435 //get a linked list which include a set of items based on their location.
1436 ret = minfo_get_geo_item_list(cluster_id,
1446 printf("minfo_get_geo_item_list failed\n");
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,
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
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.
1486 #include <media-svc.h>
1488 void test_minfo_get_thumb_path(void)
1491 char thumb_path[256] = {'\0'};
1492 char *file_url = "/opt/media/Images/Wallpapers/Home_01.png";
1494 //get thumbnail pathname of an item.
1495 ret = minfo_get_thumb_path(file_url, thumb_path, sizeof(thumb_path));
1497 printf("minfo_get_thumb_path failed\n");
1505 minfo_get_thumb_path(const char* file_url, char* thumb_path, size_t max_thumb_path);
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
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.
1525 #include <media-svc.h>
1527 void test_minfo_get_thumb_path_for_video(void)
1530 char thumb_path[256] = {'\0'};
1531 char *file_url = "/opt/media/Images and videos/My video clip/Helicopter.mp4";
1533 //get thumbnail pathname of an item.
1534 ret = minfo_get_thumb_path_for_video(file_url,thumb_path, sizeof(thumb_path));
1536 printf("minfo_get_thumb_path_for_video failed\n");
1544 minfo_get_thumb_path_for_video(const char* file_url, char* thumb_path, size_t max_thumb_path);
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.
1552 * @param media_id [in] represent the value, media '_id' in 'media' table record
1554 * @return This function returns 0 on success, or negative value with error code.
1556 * @see minfo_delete_media.
1563 #include <media-svc.h>
1565 void test_minfo_delete_media_id(void)
1568 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
1570 //delete an item according to its ID.
1571 ret = minfo_delete_media_id(media_id);
1573 printf("test_minfo_delete_media_id failed\n");
1581 minfo_delete_media_id(const char *media_id);
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
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
1602 #include <media-svc.h>
1604 void test_minfo_cp_media(void)
1607 const char *src_media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
1608 const char *dst_cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
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);
1613 printf("minfo_cp_media failed\n");
1621 minfo_cp_media(const char *src_media_id, const char *dst_cluster_id);
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
1633 * @return This function returns 0 on success, or negative value with error code.
1635 * @see minfo_move_media.
1642 #include <media-svc.h>
1644 void test_minfo_mv_media(void)
1647 const char *src_media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
1648 const char *dst_cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
1650 //move an item to specified cluster.
1651 ret = minfo_mv_media(src_media_id, dst_cluster_id);
1653 printf("minfo_mv_media failed\n");
1662 minfo_mv_media(const char *src_media_id, const char *dst_cluster_id);
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
1681 #include <media-svc.h>
1683 void test_minfo_delete_cluster(void)
1686 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
1688 //delete a cluster record, meanwhile this function will delete all of items owned by this cluster.
1689 ret = minfo_delete_cluster(cluster_id);
1691 printf("minfo_delete_cluster failed\n");
1699 minfo_delete_cluster(const char *cluster_id);
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
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.
1718 #include <media-svc.h>
1720 void test_minfo_update_cluster_name(void)
1723 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
1724 char *new_name = "newfolder";
1726 //update a cluster's name
1727 ret = minfo_update_cluster_name(cluster_id,new_name);
1729 printf("minfo_update_cluster_name failed\n");
1737 minfo_update_cluster_name(const char *cluster_id, const char* new_name);
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.
1754 #include <media-svc.h>
1757 void test_minfo_update_cluster_date(void)
1760 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
1764 //update a cluster's name
1765 ret = minfo_update_cluster_date(cluster_id, today);
1768 printf("minfo_update_cluster_date failed\n");
1776 minfo_update_cluster_date(const char *cluster_id, time_t modified_date);
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
1796 #include <media-svc.h>
1798 void test_minfo_add_bookmark(void)
1801 int position = 2346;
1802 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
1803 char *thumb_path = "tmp1";
1805 //add a bookmark which include position, thumbnail, etc. to an item.
1806 ret = minfo_add_bookmark(media_id,position,thumb_path);
1808 printf("minfo_add_bookmark failed\n");
1817 minfo_add_bookmark(const char *media_id, const int position, const char* thumb_path);
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.
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
1836 #include <media-svc.h>
1838 void test_minfo_delete_bookmark(void)
1841 int bookmark_id = 1;
1843 //delete a bookmark record in 'video_bookmark' table.
1844 ret = minfo_delete_bookmark(bookmark_id);
1847 printf("minfo_delete_bookmark failed\n");
1855 minfo_delete_bookmark(const int bookmark_id);
1862 * This function gets some folder's full path. This will be called when user want to know what one folder's unique
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
1876 #include <media-svc.h>
1878 void test_minfo_get_cluster_id_by_url(void)
1881 char cluster_id[256] = {0,};
1882 char *url = "/opt/media/Images/Wallpapers";
1884 //get cluster's ID using cluster's url.
1885 ret = minfo_get_cluster_id_by_url(url, cluster_id, sizeof(cluster_id));
1887 printf("test_minfo_get_cluster_id_by_url failed\n");
1894 minfo_get_cluster_id_by_url(const char* url, char* cluster_id, int max_length);
1899 * This function gets folder's name. This will be called when user want to know what one folder's name
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.
1913 #include <media-svc.h>
1915 void test_minfo_get_cluster_name_by_id(void)
1918 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
1919 char *cluster_name[1024];
1921 //get cluster's name using cluster's id.
1922 ret = minfo_get_cluster_name_by_id(cluster_id, cluster_name, sizeof(cluster_name));
1925 printf("test_minfo_get_cluster_name_by_id failed\n");
1928 printf("cluster name is %s\n", cluster_name);
1935 minfo_get_cluster_name_by_id(const char *cluster_id, char *cluster_name, int max_length );
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.
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.
1955 #include <media-svc.h>
1957 void test_minfo_get_cluster_fullpath_by_id(void)
1960 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
1961 char *folder_path[1024];
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));
1967 printf("test_minfo_get_cluster_fullpath_by_id failed\n");
1970 printf("path name is %s\n", cluster_name);
1978 minfo_get_cluster_fullpath_by_id(const char *cluster_id, char *folder_path, int max_length);
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.
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 )
1991 * @see minfo_get_cluster_lock_status.
1997 #include <media-svc.h>
1999 void test_minfo_set_cluster_lock_status(void)
2003 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
2005 //set s cluster lock status.
2006 ret = minfo_set_cluster_lock_status(cluster_id, status);
2009 printf("test_minfo_set_cluster_lock_status failed\n");
2017 minfo_set_cluster_lock_status(const char *cluster_id, int lock_status);
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.
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
2028 * @see minfo_set_cluster_lock_status.
2034 #include <media-svc.h>
2036 void test_minfo_get_cluster_lock_status(void)
2039 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
2042 //get a cluster's status.
2043 ret = minfo_get_cluster_lock_status(cluster_id, &status);
2046 printf("test_minfo_get_cluster_lock_status failed\n");
2049 print("Current status : %d\n", status);
2057 minfo_get_cluster_lock_status(const char *cluster_id, int *lock_status );
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.
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.
2076 #include <media-svc.h>
2078 void test_minfo_get_media_path(void)
2081 char media_path[256] = {'\0'};
2083 //get media's fullpath.
2084 ret = minfo_get_media_path(MINFO_PHONE, media_path, sizeof(media_path));
2087 printf("minfo_get_media_path failed\n");
2090 print("The returned path : %s\n", media_path);
2098 minfo_get_media_path( minfo_store_type storage_type, char* media_path, size_t max_media_path );
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.
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.
2119 #include <media-svc.h>
2123 int ret = MB_SVC_ERROR_NONE;
2126 //set the validation of medias in MMC storage in db.
2127 ret = minfo_set_db_valid(MINFO_MMC, valid);
2129 printf( "failed to set db invalid. error code->%d", ret);
2137 int minfo_set_db_valid(const minfo_store_type storage_type, int valid);
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.
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.
2157 #include <media-svc.h>
2161 int ret = MB_SVC_ERROR_NONE;
2163 //delete the invalid media records in MMC storage in db.
2164 ret = minfo_delete_invalid_media_records(MINFO_MMC);
2166 printf( "failed to delete invalid items. error code->%d", ret);
2175 minfo_delete_invalid_media_records(const minfo_store_type storage_type);
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.
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.
2194 #include <media-svc.h>
2198 int ret = MB_SVC_ERROR_NONE;
2200 //delete all tag records in 'media_tag' in db, whose tag name is 'test_tag'.
2201 ret = minfo_delete_tag(-1, "test tag");
2203 printf( "failed to delete a tag record. error code->%d", ret);
2212 minfo_delete_tag(const char *media_id, const char* tag_name);
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.
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.
2233 #include <media-svc.h>
2235 void test_minfo_rename_tag()
2237 int ret = MB_SVC_ERROR_NONE;
2239 //rename all tag records with new tag name 'test_tag2'.
2240 ret = minfo_rename_tag("test tag1", "test tag2");
2242 printf( "failed to rename tag records. error code->%d", ret);
2251 minfo_rename_tag(const char* src_tagname, const char* dst_tag_name);
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.
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.
2273 #include <media-svc.h>
2275 void test_minfo_rename_tag_by_id()
2277 int ret = MB_SVC_ERROR_NONE;
2278 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
2280 //rename some tag record with new tag name 'test_tag2'.
2281 ret = minfo_rename_tag_by_id(media_id, "test tag1", "test tag2");
2283 printf( "failed to rename tag records. error code->%d", ret);
2292 minfo_rename_tag_by_id(const char *media_id, const char* src_tagname, const char* dst_tag_name);
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.
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.
2315 #include <media-svc.h>
2319 int ret = MB_SVC_ERROR_NONE;
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");
2325 printf( "failed to add a tag record. error code->%d", ret);
2336 minfo_add_tag(const char *media_id, const char* tag_name);
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,
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.
2357 #include <media-svc.h>
2359 int mitem_ite_cb(Mitem *item, void *user_data)
2361 GList** list = (GList**)user_data;
2362 *list = g_list_append(*list, item);
2366 void get_media_list_tag_name()
2368 int ret = MB_SVC_ERROR_NONE;
2369 GList *p_list = NULL;
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);
2374 printf( "failed to get a media items' list. error code->%d", ret);
2383 minfo_get_media_list_by_tagname(const char* tag_name, bool with_meta, minfo_item_ite_cb func, void* user_data );
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,
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.
2404 #include <media-svc.h>
2406 int mitem_ite_cb(Mitem *item, void *user_data)
2408 GList** list = (GList**)user_data;
2409 *list = g_list_append(*list, item);
2413 void get_media_list_by_tagname_with_filter()
2415 int ret = MB_SVC_ERROR_NONE;
2416 GList *p_list = NULL;
2417 minfo_tag_filter filter;
2419 filter.start_pos = 0;
2421 filter.file_type = MINFO_ITEM_ALL;
2422 filter.with_meta = FALSE;
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);
2427 printf( "failed to get a media items' list. error code->%d", ret);
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 );
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.
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.
2454 #include <media-svc.h>
2456 void test_minfo_get_media_count_by_tagname()
2458 int ret = MB_SVC_ERROR_NONE;
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);
2464 printf( "failed to get a media items' list. error code->%d", ret);
2466 printf( "Count is %d\n", count );
2476 minfo_get_media_count_by_tagname(const char* tag_name, int* count );
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.
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.
2495 #include <media-svc.h>
2497 int mtag_ite_cb(Mtag *i_tag, void *user_data)
2499 GList** list = (GList**)user_data;
2500 *list = g_list_append(*list, item);
2504 void get_tag_list_media_id()
2506 int ret = MB_SVC_ERROR_NONE;
2507 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
2508 GList *p_list = NULL;
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);
2513 printf( "failed to get a tags' list. error code->%d", ret);
2522 minfo_get_tag_list_by_media_id(const char *media_id, minfo_tag_ite_cb func, void* user_data);
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.
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.
2542 #include <media-svc.h>
2545 void add_web_cluster()
2547 int ret = MB_SVC_ERROR_NONE;
2548 char cluster_id[256] = {0,};
2551 ret = minfo_add_web_cluster(1, "web_album", "1", cluster_id, sizeof(cluster_id));
2553 printf( "failed to add a web album. error code->%d", ret);
2563 minfo_add_web_cluster(int sns_type, const char* name,const char *account_id, char* id, int max_length);
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.
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.
2585 #include <media-svc.h>
2588 void add_web_cluster_album_id()
2590 int ret = MB_SVC_ERROR_NONE;
2591 char cluster_id[256] = {0,};
2594 ret = minfo_add_web_cluster_album_id(1, "web_album", "1", "1", cluster_id, sizeof(cluster_id));
2596 printf( "failed to add a web album. error code->%d", ret);
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);
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.
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.
2624 #include <media-svc.h>
2627 void delete_web_cluster()
2629 int ret = MB_SVC_ERROR_NONE;
2630 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
2632 //delete a web album.
2633 ret = minfo_delete_web_cluster(cluster_id);
2635 printf( "failed to delete a web album. error code->%d", ret);
2646 minfo_delete_web_cluster(const char *cluster_id);
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.
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.
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.
2670 #include <media-svc.h>
2671 int mcluster_ite_cb(Mcluster *cluster, void *user_data)
2673 GList** list = (GList**)user_data;
2674 *list = g_list_append(*list, cluster);
2677 void test_minfo_get_web_cluster_by_web_account_id(void)
2680 const char* account_id = "user";
2681 GList *p_list = NULL;
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);
2686 printf("minfo_get_web_cluster_by_web_account_id fail: %d \n", ret);
2694 minfo_get_web_cluster_by_web_account_id(const char* web_account_id, minfo_cluster_ite_cb func, void *user_data);
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.
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
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.
2717 #include <media-svc.h>
2719 void test_minfo_get_web_cluster_web_album_id(void)
2722 Mcluster *mc = NULL;
2723 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
2725 //get a cluster using cluster's id.
2726 ret = minfo_get_web_cluster_web_album_id(cluster_id, &mc);
2728 printf("minfo_get_web_cluster_web_album_id fail: %d \n", ret);
2732 minfo_destroy_mtype_item(mc);
2738 minfo_get_web_cluster_web_album_id(const char *web_album_id, Mcluster **mcluster);
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.
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.
2758 #include <media-svc.h>
2761 void test_minfo_add_web_media()
2763 int ret = MB_SVC_ERROR_NONE;
2764 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
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");
2769 printf( "failed to add to a web album. error code->%d", ret);
2780 minfo_add_web_media(const char *cluster_id, const char* http_url, const char* file_name, const char* thumb_path);
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.
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.
2801 #include <media-svc.h>
2804 void test_minfo_add_web_media_with_type()
2806 int ret = MB_SVC_ERROR_NONE;
2807 const char *cluster_id = "51298053-feb7-4261-a1c8-26b05a6e0ae0";
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");
2812 printf( "failed to add to a web album. error code->%d", ret);
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);
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.
2831 * @see minfo_get_thumb_path_for_video.
2838 #include <media-svc.h>
2840 void test_minfo_extract_thumbnail(void)
2843 const char *media_id = "b6a4f4ac-26ea-458c-a228-9aef7f70349d";
2845 ret = minfo_extract_thumbnail(media_id, MINFO_ITEM_IMAGE);
2847 printf("minfo_extract_thumbnail failed\n");
2855 minfo_extract_thumbnail(const char *media_id, minfo_file_type content_type);
2864 #endif /* __cplusplus */
2870 #endif /*_MINFO_API_H_*/