X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Finclude%2Fcommon%2Fmedia-svc-util.h;h=d6f15e27c6d2dd1fda373d141dc33a011c5de100;hb=refs%2Fchanges%2F82%2F308582%2F2;hp=6784ab349954feddd9deed04e29cd69eb9c7643b;hpb=4fcae405c8951e5ea0bd320c29a931ca02714174;p=platform%2Fcore%2Fmultimedia%2Flibmedia-service.git diff --git a/src/include/common/media-svc-util.h b/src/include/common/media-svc-util.h index 6784ab3..d6f15e2 100755 --- a/src/include/common/media-svc-util.h +++ b/src/include/common/media-svc-util.h @@ -3,8 +3,6 @@ * * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. * - * Contact: Hyunjun Ko , Haejeong Kim - * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -26,54 +24,85 @@ #include #include +#include #include -#include -#include "media-svc-types.h" -#include "media-svc-env.h" +#include +#include +#include #ifdef __cplusplus extern "C" { #endif -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE 1 -#endif +#define STRING_VALID(str) (str && strlen(str) > 0) + +/** + * Media meta data information + */ +typedef struct { + char *title; /**< track title*/ + char *album; /**< album name*/ + char *artist; /**< artist name*/ + char *album_artist; /**< artist name*/ + char *genre; /**< genre of track*/ + char *year; /**< year*/ + char *track_num; /**< track number*/ + unsigned int width; /**< width*/ + unsigned int height; /**< height*/ + char *datetaken; /**< datetaken*/ + unsigned short orientation; /**< orientation*/ +} media_svc_content_meta_s; -#define SAFE_FREE(src) { if (src) {free(src); src = NULL;}} -#define STRING_VALID(str) \ - ((str != NULL && strlen(str) > 0) ? TRUE : FALSE) +/** + * Media data information + */ +typedef struct { + char *media_uuid; /**< Unique ID of item */ + char *path; /**< Full path of media file */ + char *file_name; /**< File name of media file. Display name */ + int media_type; /**< Type of media file : internal/external */ + char *mime_type; /**< Full path and file name of media file */ + unsigned long long size; /**< size */ + time_t modified_time; /**< modified time, time_t */ + long long int folder_id; /**< Unique ID of folder */ + int album_id; /**< Unique ID of album */ + char *thumbnail_path; /**< Thumbnail image file path */ + char *storage_uuid; /**< Unique ID of storage */ + media_svc_content_meta_s media_meta; /**< meta data structure */ +} media_svc_content_info_s; + +/** + * Type definition for content type + */ +typedef enum { + MEDIA_SVC_MEDIA_TYPE_IMAGE = 0, /**< Image Content*/ + MEDIA_SVC_MEDIA_TYPE_VIDEO = 1, /**< Video Content*/ + MEDIA_SVC_MEDIA_TYPE_SOUND = 2, /**< Sound Content like Ringtone*/ + MEDIA_SVC_MEDIA_TYPE_MUSIC = 3, /**< Music Content like mp3*/ + MEDIA_SVC_MEDIA_TYPE_OTHER = 4, /**< Not media Content*/ + MEDIA_SVC_MEDIA_TYPE_BOOK = 5, /**< Book Content like epub*/ +} media_svc_media_type_e; -char *_media_info_generate_uuid(void); -void _strncpy_safe(char *x_dst, const char *x_src, int max_len); -int _media_svc_rename_file(const char *old_name, const char *new_name); -int _media_svc_remove_file(const char *path); -int _media_svc_remove_all_files_in_dir(const char *dir_path); -int _media_svc_get_thumbnail_path(media_svc_storage_type_e storage_type, char *thumb_path, const char *pathname, const char *img_format, uid_t uid); +typedef enum { + MEDIA_SVC_SEARCH_TYPE_DIRECT = 0, + MEDIA_SVC_SEARCH_TYPE_DB, +} media_svc_search_type_e; + +void _media_svc_remove_file(const char *path); int _media_svc_get_file_time(const char *full_path); -int _media_svc_set_default_value(media_svc_content_info_s *content_info, bool refresh); -int _media_svc_set_media_info(media_svc_content_info_s *content_info, const char *storage_id, media_svc_storage_type_e storage_type, - const char *path, media_svc_media_type_e *media_type, bool refresh); -int _media_svc_extract_image_metadata(sqlite3 *handle, media_svc_content_info_s *content_info); -int _media_svc_extract_media_metadata(sqlite3 *handle, media_svc_content_info_s *content_info, uid_t uid); -int __media_svc_malloc_and_strncpy(char **dst, const char *src); -time_t __media_svc_get_timeline_from_str(const char *timstr); +char * _media_svc_get_title_from_filename(const char *filename); +int _media_svc_set_media_info(media_svc_content_info_s *content_info, const char *storage_id, const char *path, bool refresh); +int _media_svc_extract_image_metadata(media_svc_content_info_s *content_info); +void _media_svc_extract_audio_metadata(sqlite3 *handle, bool is_direct, media_svc_content_info_s *content_info, uid_t uid); +void _media_svc_extract_video_metadata(media_svc_content_info_s *content_info); +int _media_svc_extract_book_metadata(media_svc_content_info_s *content_info); void _media_svc_destroy_content_info(media_svc_content_info_s *content_info); -int _media_svc_get_storage_type_by_path(const char *path, media_svc_storage_type_e *storage_type, uid_t uid); -char *_media_svc_replace_path(char *s, const char *olds, const char *news); -char *_media_svc_get_thumb_internal_path(uid_t uid); -char *_media_svc_get_thumb_external_path(uid_t uid); -bool _media_svc_is_drm_file(const char *path); -int _media_svc_request_thumbnail_with_origin_size(const char *path, char *thumb_path, int max_length, int *origin_width, int *origin_height, uid_t uid); -int _media_svc_get_pinyin_str(const char *src_str, char **pinyin_str); -bool _media_svc_check_pinyin_support(void); -int _media_svc_extract_music_metadata_for_update(sqlite3 *handle, media_svc_content_info_s *content_info, media_svc_media_type_e media_type); -int _media_svc_get_ini_value(); -char *_media_svc_get_title_from_path(const char *path); -void _media_svc_print_stderror(void); - +int _media_svc_create_thumbnail(const char *path, char *thumb_path, media_svc_media_type_e media_type, uid_t uid); +int _media_svc_get_media_type(const char *path, int *mediatype); +bool _media_svc_is_keyword_included(const char *path, const char *keyword); +void _media_svc_update_wordbook(const char *path, uid_t uid); +void _media_svc_clean_wordbook(uid_t uid); +bool _media_svc_get_matched_list(const char *keyword, uid_t uid, GList **list); #ifdef __cplusplus }