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.
24 #include <media-thumbnail.h>
25 #include "media-svc.h"
27 #define MEDIA_SVC_PLUGIN_ERROR_NONE 0
28 #define MEDIA_SVC_PLUGIN_ERROR -1
30 #define STRING_VALID(str) \
31 ((str != NULL && strlen(str) > 0) ? TRUE : FALSE)
32 #define STORAGE_VALID(storage)\
33 (((storage == MEDIA_SVC_STORAGE_INTERNAL) || (storage == MEDIA_SVC_STORAGE_EXTERNAL)) ? TRUE : FALSE)
45 }media_svc_error_type_e;
47 #define MS_CATEGORY_UNKNOWN 0x00000000 /**< Default */
48 #define MS_CATEGORY_ETC 0x00000001 /**< ETC category */
49 #define MS_CATEGORY_IMAGE 0x00000002 /**< Image category */
50 #define MS_CATEGORY_VIDEO 0x00000004 /**< Video category */
51 #define MS_CATEGORY_MUSIC 0x00000008 /**< Music category */
52 #define MS_CATEGORY_SOUND 0x00000010 /**< Sound category */
54 #define CONTENT_TYPE_NUM 4
55 #define MUSIC_MIME_NUM 29
56 #define SOUND_MIME_NUM 1
57 #define MIME_TYPE_LENGTH 255
58 #define MIME_LENGTH 50
59 #define _3GP_FILE ".3gp"
60 #define _MP4_FILE ".mp4"
64 char content_type[15];
66 } fex_content_table_t;
68 static const fex_content_table_t content_category[CONTENT_TYPE_NUM] = {
69 {"audio", MS_CATEGORY_SOUND},
70 {"image", MS_CATEGORY_IMAGE},
71 {"video", MS_CATEGORY_VIDEO},
72 {"application", MS_CATEGORY_ETC},
75 static const char music_mime_table[MUSIC_MIME_NUM][MIME_LENGTH] = {
76 /*known mime types of normal files*/
82 /* known mime types of drm files*/
84 "x-mp3", /*alias of audio/mpeg*/
85 "x-mpeg", /*alias of audio/mpeg*/
87 "x-ogg", /*alias of audio/ogg*/
88 "vnd.ms-playready.media.pya:*.pya", /*playready*/
91 "x-m4a", /*alias of audio/mp4*/
92 /* below mimes are rare*/
102 "x-vorbis", /*alias of audio/x-vorbis+ogg*/
103 "vorbis", /*alias of audio/x-vorbis+ogg*/
105 "x-mp2", /*alias of audio/mp2*/
106 "x-pn-realaudio", /*alias of audio/vnd.rn-realaudio*/
107 "vnd.m-realaudio", /*alias of audio/vnd.rn-realaudio*/
111 static const char sound_mime_table[SOUND_MIME_NUM][MIME_LENGTH] = {
115 static int __get_content_type_from_mime(const char * path, const char * mimetype, int * category);
116 static int __get_content_type(const char * file_path, const char * mime_type);
117 static void __set_error_message(int err_type, char ** err_msg);
119 static int __get_content_type_from_mime(const char * path, const char * mimetype, int * category)
124 *category = MS_CATEGORY_UNKNOWN;
126 //MS_DBG("mime type : %s", mimetype);
128 /*categorize from mimetype */
129 for (i = 0; i < CONTENT_TYPE_NUM; i++) {
130 if (strstr(mimetype, content_category[i].content_type) != NULL) {
131 *category = (*category | content_category[i].category_by_mime);
136 /*in application type, exitst sound file ex) x-smafs */
137 if (*category & MS_CATEGORY_ETC) {
138 int prefix_len = strlen(content_category[0].content_type);
140 for (i = 0; i < SOUND_MIME_NUM; i++) {
141 if (strstr(mimetype + prefix_len, sound_mime_table[i]) != NULL) {
142 *category ^= MS_CATEGORY_ETC;
143 *category |= MS_CATEGORY_SOUND;
149 /*check music file in soun files. */
150 if (*category & MS_CATEGORY_SOUND) {
151 int prefix_len = strlen(content_category[0].content_type) + 1;
153 //MS_DBG("mime_type : %s", mimetype + prefix_len);
155 for (i = 0; i < MUSIC_MIME_NUM; i++) {
156 if (strcmp(mimetype + prefix_len, music_mime_table[i]) == 0) {
157 *category ^= MS_CATEGORY_SOUND;
158 *category |= MS_CATEGORY_MUSIC;
163 /*m3u file is playlist but mime type is "audio/x-mpegurl". but It has to be classified into MS_CATEGORY_ETC since playlist is not a sound track*/
164 if(strncasecmp(mimetype, "audio/x-mpegurl", strlen("audio/x-mpegurl")) == 0) {
165 *category ^= MS_CATEGORY_SOUND;
166 *category |= MS_CATEGORY_ETC;
168 } else if (*category & MS_CATEGORY_VIDEO) {
169 /*some video files don't have video stream. in this case it is categorize as music. */
170 /*"3gp" and "mp4" must check video stream and then categorize in directly. */
171 char file_ext[10] = {0};
172 memset(file_ext, 0, sizeof(file_ext));
173 if((_media_svc_get_file_ext(path, file_ext)) && strlen(file_ext) > 0) {
174 if ((strncasecmp(file_ext, _3GP_FILE, 4) == 0) || (strncasecmp(file_ext, _MP4_FILE, 5) == 0)) {
178 err = mm_file_get_stream_info(path, &audio, &video);
180 if (audio > 0 && video == 0) {
181 *category ^= MS_CATEGORY_VIDEO;
182 *category |= MS_CATEGORY_MUSIC;
189 //MS_DBG("category_from_ext : %d", *category);
194 static int __get_content_type(const char * file_path, const char * mime_type)
196 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
199 ret = __get_content_type_from_mime(file_path, mime_type, &category);
201 if (category & MS_CATEGORY_SOUND) return MEDIA_SVC_MEDIA_TYPE_SOUND;
202 else if (category & MS_CATEGORY_MUSIC) return MEDIA_SVC_MEDIA_TYPE_MUSIC;
203 else if (category & MS_CATEGORY_IMAGE) return MEDIA_SVC_MEDIA_TYPE_IMAGE;
204 else if (category & MS_CATEGORY_VIDEO) return MEDIA_SVC_MEDIA_TYPE_VIDEO;
205 else return MEDIA_SVC_MEDIA_TYPE_OTHER;
208 static void __set_error_message(int err_type, char ** err_msg)
215 if(err_type == ERR_HANDLE)
216 *err_msg = strdup("invalid handle");
217 else if(err_type == ERR_FILE_PATH)
218 *err_msg = strdup("invalid file path");
219 else if(err_type == ERR_FOLDER_PATH)
220 *err_msg = strdup("invalid folder path");
221 else if(err_type == ERR_MIME_TYPE)
222 *err_msg = strdup("invalid mime type");
223 else if(err_type == ERR_NOT_MEDIAFILE)
224 *err_msg = strdup("not media content");
225 else if(err_type == ERR_STORAGE_TYPE)
226 *err_msg = strdup("invalid storage type");
227 else if(err_type == ERR_CHECK_ITEM)
228 *err_msg = strdup("item does not exist");
229 else if(err_type == MEDIA_INFO_ERROR_DATABASE_CONNECT)
230 *err_msg = strdup("DB connect error");
231 else if(err_type == MEDIA_INFO_ERROR_DATABASE_DISCONNECT)
232 *err_msg = strdup("DB disconnect error");
233 else if(err_type == MEDIA_INFO_ERROR_INVALID_PARAMETER)
234 *err_msg = strdup("invalid parameter");
235 else if(err_type == MEDIA_INFO_ERROR_DATABASE_INTERNAL)
236 *err_msg = strdup("DB internal error");
237 else if(err_type == MEDIA_INFO_ERROR_DATABASE_NO_RECORD)
238 *err_msg = strdup("not found in DB");
239 else if(err_type == MEDIA_INFO_ERROR_INTERNAL)
240 *err_msg = strdup("media service internal error");
242 *err_msg = strdup("error unknown");
247 int check_item(const char *file_path, const char * mime_type, char ** err_msg)
249 if (!STRING_VALID(file_path)) {
250 __set_error_message(ERR_FILE_PATH, err_msg);
251 return MEDIA_SVC_PLUGIN_ERROR;
254 if (!STRING_VALID(mime_type)) {
255 __set_error_message(ERR_MIME_TYPE, err_msg);
256 return MEDIA_SVC_PLUGIN_ERROR;
259 return MEDIA_SVC_PLUGIN_ERROR_NONE;
262 int connect(void ** handle, char ** err_msg)
264 int ret = media_svc_connect(handle);
267 __set_error_message(ret, err_msg);
268 return MEDIA_SVC_PLUGIN_ERROR;
271 return MEDIA_SVC_PLUGIN_ERROR_NONE;
274 int disconnect(void * handle, char ** err_msg)
276 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
279 __set_error_message(ERR_HANDLE, err_msg);
280 return MEDIA_SVC_PLUGIN_ERROR;
283 ret = media_svc_disconnect(handle);
285 __set_error_message(ret, err_msg);
286 return MEDIA_SVC_PLUGIN_ERROR;
289 return MEDIA_SVC_PLUGIN_ERROR_NONE;
292 int check_item_exist(void* handle, const char *file_path, int storage_type, char ** err_msg)
294 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
297 __set_error_message(ERR_HANDLE, err_msg);
298 return MEDIA_SVC_PLUGIN_ERROR;
301 if (!STRING_VALID(file_path)) {
302 __set_error_message(ERR_FILE_PATH, err_msg);
303 return MEDIA_SVC_PLUGIN_ERROR;
306 if(!STORAGE_VALID(storage_type)) {
307 __set_error_message(ERR_STORAGE_TYPE, err_msg);
308 return MEDIA_SVC_PLUGIN_ERROR;
311 ret = media_svc_check_item_exist_by_path(handle, file_path);
312 if(ret == MEDIA_INFO_ERROR_NONE)
313 return MEDIA_SVC_PLUGIN_ERROR_NONE; //exist
315 __set_error_message(ERR_CHECK_ITEM, err_msg);
317 return MEDIA_SVC_PLUGIN_ERROR; //not exist
320 int insert_item_begin(void * handle, int item_cnt, char ** err_msg)
322 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
325 __set_error_message(ERR_HANDLE, err_msg);
326 return MEDIA_SVC_PLUGIN_ERROR;
329 ret = media_svc_insert_item_begin(handle, item_cnt);
331 __set_error_message(ret, err_msg);
332 return MEDIA_SVC_PLUGIN_ERROR;
335 return MEDIA_SVC_PLUGIN_ERROR_NONE;
338 int insert_item_end(void * handle, char ** err_msg)
340 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
343 __set_error_message(ERR_HANDLE, err_msg);
344 return MEDIA_SVC_PLUGIN_ERROR;
347 ret = media_svc_insert_item_end(handle);
349 __set_error_message(ret, err_msg);
350 return MEDIA_SVC_PLUGIN_ERROR;
353 return MEDIA_SVC_PLUGIN_ERROR_NONE;
356 int insert_item(void * handle, const char *file_path, int storage_type, const char * mime_type, char ** err_msg)
358 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
361 __set_error_message(ERR_HANDLE, err_msg);
362 return MEDIA_SVC_PLUGIN_ERROR;
365 if (!STRING_VALID(file_path)) {
366 __set_error_message(ERR_FILE_PATH, err_msg);
367 return MEDIA_SVC_PLUGIN_ERROR;
370 if (!STRING_VALID(mime_type)) {
371 __set_error_message(ERR_MIME_TYPE, err_msg);
372 return MEDIA_SVC_PLUGIN_ERROR;
375 if(!STORAGE_VALID(storage_type)) {
376 __set_error_message(ERR_STORAGE_TYPE, err_msg);
377 return MEDIA_SVC_PLUGIN_ERROR;
380 media_svc_media_type_e content_type = __get_content_type(file_path, mime_type);
382 ret = media_svc_insert_item_bulk(handle, storage_type, file_path, mime_type, content_type);
384 __set_error_message(ret, err_msg);
385 return MEDIA_SVC_PLUGIN_ERROR;
388 return MEDIA_SVC_PLUGIN_ERROR_NONE;
391 int insert_item_immediately(void * handle, const char *file_path, int storage_type, const char * mime_type, char ** err_msg)
393 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
396 __set_error_message(ERR_HANDLE, err_msg);
397 return MEDIA_SVC_PLUGIN_ERROR;
400 if (!STRING_VALID(file_path)) {
401 __set_error_message(ERR_FILE_PATH, err_msg);
402 return MEDIA_SVC_PLUGIN_ERROR;
405 if (!STRING_VALID(mime_type)) {
406 __set_error_message(ERR_MIME_TYPE, err_msg);
407 return MEDIA_SVC_PLUGIN_ERROR;
410 if(!STORAGE_VALID(storage_type)) {
411 __set_error_message(ERR_STORAGE_TYPE, err_msg);
412 return MEDIA_SVC_PLUGIN_ERROR;
415 media_svc_media_type_e content_type = __get_content_type(file_path, mime_type);
417 ret = media_svc_insert_item_immediately(handle, storage_type, file_path, mime_type, content_type);
420 __set_error_message(ret, err_msg);
421 return MEDIA_SVC_PLUGIN_ERROR;
424 return MEDIA_SVC_PLUGIN_ERROR_NONE;
427 int move_item_begin(void * handle, int item_cnt, char ** err_msg)
429 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
432 __set_error_message(ERR_HANDLE, err_msg);
433 return MEDIA_SVC_PLUGIN_ERROR;
436 ret = media_svc_move_item_begin(handle, item_cnt);
438 __set_error_message(ret, err_msg);
439 return MEDIA_SVC_PLUGIN_ERROR;
442 return MEDIA_SVC_PLUGIN_ERROR_NONE;
445 int move_item_end(void * handle, char ** err_msg)
447 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
450 __set_error_message(ERR_HANDLE, err_msg);
451 return MEDIA_SVC_PLUGIN_ERROR;
454 ret = media_svc_move_item_end(handle);
456 __set_error_message(ret, err_msg);
457 return MEDIA_SVC_PLUGIN_ERROR;
460 return MEDIA_SVC_PLUGIN_ERROR_NONE;
463 int move_item(void * handle, const char *src_path, int src_storage_type, const char *dest_path, int dest_storage_type, const char * mime_type, char ** err_msg)
465 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
468 __set_error_message(ERR_HANDLE, err_msg);
469 return MEDIA_SVC_PLUGIN_ERROR;
472 if ((!STRING_VALID(src_path)) || (!STRING_VALID(dest_path))) {
473 __set_error_message(ERR_FILE_PATH, err_msg);
474 return MEDIA_SVC_PLUGIN_ERROR;
477 if (!STRING_VALID(mime_type)) {
478 __set_error_message(ERR_MIME_TYPE, err_msg);
479 return MEDIA_SVC_PLUGIN_ERROR;
482 if((!STORAGE_VALID(src_storage_type)) || (!STORAGE_VALID(dest_storage_type))) {
483 __set_error_message(ERR_STORAGE_TYPE, err_msg);
484 return MEDIA_SVC_PLUGIN_ERROR;
487 ret = media_svc_move_item(handle, src_storage_type, src_path, dest_storage_type, dest_path);
489 __set_error_message(ret, err_msg);
490 return MEDIA_SVC_PLUGIN_ERROR;
493 return MEDIA_SVC_PLUGIN_ERROR_NONE;
496 int set_all_storage_items_validity(void * handle, int storage_type, int validity, char ** err_msg)
498 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
501 __set_error_message(ERR_HANDLE, err_msg);
502 return MEDIA_SVC_PLUGIN_ERROR;
505 if(!STORAGE_VALID(storage_type)) {
506 __set_error_message(ERR_STORAGE_TYPE, err_msg);
507 return MEDIA_SVC_PLUGIN_ERROR;
510 ret = media_svc_set_all_storage_items_validity(handle, storage_type, validity);
512 __set_error_message(ret, err_msg);
513 return MEDIA_SVC_PLUGIN_ERROR;
516 return MEDIA_SVC_PLUGIN_ERROR_NONE;
519 int set_folder_item_validity(void * handle, const char * folder_path, int validity, int recursive, char ** err_msg)
521 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
524 __set_error_message(ERR_HANDLE, err_msg);
525 return MEDIA_SVC_PLUGIN_ERROR;
528 if (!STRING_VALID(folder_path)) {
529 __set_error_message(ERR_FOLDER_PATH, err_msg);
530 return MEDIA_SVC_PLUGIN_ERROR;
533 ret = media_svc_set_folder_items_validity(handle, folder_path, validity, recursive);
535 __set_error_message(ret, err_msg);
536 return MEDIA_SVC_PLUGIN_ERROR;
539 return MEDIA_SVC_PLUGIN_ERROR_NONE;
542 int set_item_validity_begin(void * handle, int item_cnt, char ** err_msg)
544 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
547 __set_error_message(ERR_HANDLE, err_msg);
548 return MEDIA_SVC_PLUGIN_ERROR;
551 ret = media_svc_set_item_validity_begin(handle, item_cnt);
553 __set_error_message(ret, err_msg);
554 return MEDIA_SVC_PLUGIN_ERROR;
557 return MEDIA_SVC_PLUGIN_ERROR_NONE;
560 int set_item_validity_end(void * handle, char ** err_msg)
562 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
565 __set_error_message(ERR_HANDLE, err_msg);
566 return MEDIA_SVC_PLUGIN_ERROR;
569 ret = media_svc_set_item_validity_end(handle);
571 __set_error_message(ret, err_msg);
572 return MEDIA_SVC_PLUGIN_ERROR;
575 return MEDIA_SVC_PLUGIN_ERROR_NONE;
578 int set_item_validity(void * handle, const char *file_path, int storage_type, const char * mime_type, int validity, char ** err_msg)
580 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
583 __set_error_message(ERR_HANDLE, err_msg);
584 return MEDIA_SVC_PLUGIN_ERROR;
587 if (!STRING_VALID(file_path)) {
588 __set_error_message(ERR_FILE_PATH, err_msg);
589 return MEDIA_SVC_PLUGIN_ERROR;
592 if (!STRING_VALID(mime_type)) {
593 __set_error_message(ERR_MIME_TYPE, err_msg);
594 return MEDIA_SVC_PLUGIN_ERROR;
597 if(!STORAGE_VALID(storage_type)) {
598 __set_error_message(ERR_STORAGE_TYPE, err_msg);
599 return MEDIA_SVC_PLUGIN_ERROR;
602 ret = media_svc_set_item_validity(handle, file_path, validity);
605 __set_error_message(ret, err_msg);
606 return MEDIA_SVC_PLUGIN_ERROR;
609 return MEDIA_SVC_PLUGIN_ERROR_NONE;
612 int delete_item(void * handle, const char *file_path, int storage_type, char ** err_msg)
614 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
617 __set_error_message(ERR_HANDLE, err_msg);
618 return MEDIA_SVC_PLUGIN_ERROR;
621 if (!STRING_VALID(file_path)) {
622 __set_error_message(ERR_FILE_PATH, err_msg);
623 return MEDIA_SVC_PLUGIN_ERROR;
626 if(!STORAGE_VALID(storage_type)) {
627 __set_error_message(ERR_STORAGE_TYPE, err_msg);
628 return MEDIA_SVC_PLUGIN_ERROR;
631 ret = media_svc_check_item_exist_by_path(handle, file_path);
633 ret = media_svc_delete_item_by_path(handle, file_path);
636 __set_error_message(ret, err_msg);
637 return MEDIA_SVC_PLUGIN_ERROR;
640 return MEDIA_SVC_PLUGIN_ERROR_NONE;
643 __set_error_message(ERR_CHECK_ITEM, err_msg); //not exist in DB so can't delete item.
644 return MEDIA_SVC_PLUGIN_ERROR;
647 int delete_all_items_in_storage(void * handle, int storage_type, char ** err_msg)
649 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
652 __set_error_message(ERR_HANDLE, err_msg);
653 return MEDIA_SVC_PLUGIN_ERROR;
656 if(!STORAGE_VALID(storage_type)) {
657 __set_error_message(ERR_STORAGE_TYPE, err_msg);
658 return MEDIA_SVC_PLUGIN_ERROR;
661 ret = media_svc_delete_all_items_in_storage(handle, storage_type);
663 __set_error_message(ret, err_msg);
664 return MEDIA_SVC_PLUGIN_ERROR;
667 return MEDIA_SVC_PLUGIN_ERROR_NONE;
670 int delete_all_invalid_items_in_storage(void * handle, int storage_type, char ** err_msg)
672 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
675 __set_error_message(ERR_HANDLE, err_msg);
676 return MEDIA_SVC_PLUGIN_ERROR;
679 if(!STORAGE_VALID(storage_type)) {
680 __set_error_message(ERR_STORAGE_TYPE, err_msg);
681 return MEDIA_SVC_PLUGIN_ERROR;
684 ret = media_svc_delete_invalid_items_in_storage(handle, storage_type);
686 __set_error_message(ret, err_msg);
687 return MEDIA_SVC_PLUGIN_ERROR;
690 return MEDIA_SVC_PLUGIN_ERROR_NONE;
693 int delete_all_invalid_items_in_folder(void * handle, const char *folder_path, char ** err_msg)
695 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
698 __set_error_message(ERR_HANDLE, err_msg);
699 return MEDIA_SVC_PLUGIN_ERROR;
702 if (!STRING_VALID(folder_path)) {
703 __set_error_message(ERR_FOLDER_PATH, err_msg);
704 return MEDIA_SVC_PLUGIN_ERROR;
707 ret = media_svc_delete_invalid_items_in_folder(handle, folder_path);
709 __set_error_message(ret, err_msg);
710 return MEDIA_SVC_PLUGIN_ERROR;
713 return MEDIA_SVC_PLUGIN_ERROR_NONE;
716 int delete_all_items(void * handle, char ** err_msg)
718 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
721 __set_error_message(ERR_HANDLE, err_msg);
722 return MEDIA_SVC_PLUGIN_ERROR;
725 ret = delete_all_items_in_storage(handle, MEDIA_SVC_STORAGE_INTERNAL, err_msg);
727 return MEDIA_SVC_PLUGIN_ERROR;
729 ret = delete_all_items_in_storage(handle, MEDIA_SVC_STORAGE_EXTERNAL, err_msg);
731 return MEDIA_SVC_PLUGIN_ERROR;
733 return MEDIA_SVC_PLUGIN_ERROR_NONE;
736 int refresh_item(void * handle, const char *file_path, int storage_type, const char * mime_type, char ** err_msg)
738 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
741 __set_error_message(ERR_HANDLE, err_msg);
742 return MEDIA_SVC_PLUGIN_ERROR;
745 if (!STRING_VALID(file_path)) {
746 __set_error_message(ERR_FILE_PATH, err_msg);
747 return MEDIA_SVC_PLUGIN_ERROR;
750 if (!STRING_VALID(mime_type)) {
751 __set_error_message(ERR_MIME_TYPE, err_msg);
752 return MEDIA_SVC_PLUGIN_ERROR;
755 if(!STORAGE_VALID(storage_type)) {
756 __set_error_message(ERR_STORAGE_TYPE, err_msg);
757 return MEDIA_SVC_PLUGIN_ERROR;
760 media_svc_media_type_e content_type = __get_content_type(file_path, mime_type);
762 ret = media_svc_refresh_item(handle, storage_type, file_path, content_type);
765 __set_error_message(ret, err_msg);
766 return MEDIA_SVC_PLUGIN_ERROR;
769 return MEDIA_SVC_PLUGIN_ERROR_NONE;
772 int update_begin(void)
774 return MEDIA_SVC_PLUGIN_ERROR_NONE;
779 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
781 ret = thumbnail_request_extract_all_thumbs();
783 return MEDIA_SVC_PLUGIN_ERROR;
786 return MEDIA_SVC_PLUGIN_ERROR_NONE;