diff options
-rwxr-xr-x | include/media_info.h | 15 | ||||
-rwxr-xr-x | include/media_info_private.h | 1 | ||||
-rwxr-xr-x | packaging/capi-content-media-content.spec | 2 | ||||
-rwxr-xr-x | src/media_info.c | 45 |
4 files changed, 62 insertions, 1 deletions
diff --git a/include/media_info.h b/include/media_info.h index b074100..2cfc92f 100755 --- a/include/media_info.h +++ b/include/media_info.h @@ -551,6 +551,21 @@ int media_info_get_provider(media_info_h media, char **provider); int media_info_get_content_name(media_info_h media, char **content_name); /** + * @brief Gets the title to media info. + * + * @remarks @a title must be released with free() by you. + * + * @param[in] media The handle to media info + * @param[out] title The title of media info + * @return 0 on success, otherwise a negative error value. + * @retval #MEDIA_CONTENT_ERROR_NONE Successful + * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory + * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter + * + */ +int media_info_get_title(media_info_h media, char **title); + +/** * @brief Gets the provider to media info. * * @remarks @a category must be released with free() by you. diff --git a/include/media_info_private.h b/include/media_info_private.h index 0b914fb..9a2e76d 100755 --- a/include/media_info_private.h +++ b/include/media_info_private.h @@ -224,6 +224,7 @@ typedef struct double altitude; int rating; int favourite; + char *title; char *author; char *provider; char *content_name; diff --git a/packaging/capi-content-media-content.spec b/packaging/capi-content-media-content.spec index 8ed0bce..d9b29bc 100755 --- a/packaging/capi-content-media-content.spec +++ b/packaging/capi-content-media-content.spec @@ -1,6 +1,6 @@ Name: capi-content-media-content Summary: A Media content library in SLP C API -Version: 0.2.57 +Version: 0.2.58 Release: 0 Group: System/Libraries License: Apache License, Version 2.0 diff --git a/src/media_info.c b/src/media_info.c index 4c35217..55feff3 100755 --- a/src/media_info.c +++ b/src/media_info.c @@ -247,6 +247,9 @@ void _media_info_item_get_detail(sqlite3_stmt* stmt, media_info_h media) _media->latitude = (double)sqlite3_column_double(stmt, 22); _media->altitude = (double)sqlite3_column_double(stmt, 23); + if(STRING_VALID((const char *)sqlite3_column_text(stmt, 28))) + _media->title = strdup((const char *)sqlite3_column_text(stmt, 28)); + if(_media->media_type == MEDIA_CONTENT_TYPE_IMAGE) { _media->image_meta = (image_meta_s *)calloc(1, sizeof(image_meta_s)); if(_media->image_meta) { @@ -672,6 +675,7 @@ int media_info_destroy(media_info_h media) SAFE_FREE(_media->location_tag); SAFE_FREE(_media->age_rating); SAFE_FREE(_media->keyword); + SAFE_FREE(_media->title); if(_media->image_meta) { SAFE_FREE(_media->image_meta->media_id); @@ -796,6 +800,16 @@ int media_info_clone(media_info_h *dst, media_info_h src) return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; } } + if(STRING_VALID(_src->title)) + { + _dst->title = strdup(_src->title); + if(_dst->title == NULL) + { + media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY); + media_info_destroy((media_info_h)_dst); + return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; + } + } if(STRING_VALID(_src->author)) { _dst->author = strdup(_src->author); @@ -1726,6 +1740,37 @@ int media_info_get_thumbnail_path(media_info_h media, char **path) return ret; } +int media_info_get_title(media_info_h media, char **title) +{ + int ret = MEDIA_CONTENT_ERROR_NONE; + media_info_s *_media = (media_info_s*)media; + + if(_media && title) + { + if(STRING_VALID(_media->title)) + { + *title = strdup(_media->title); + if(*title == NULL) + { + media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY); + return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY; + } + } + else + { + *title = NULL; + } + ret = MEDIA_CONTENT_ERROR_NONE; + } + else + { + media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER); + ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER; + } + + return ret; +} + int media_info_get_description(media_info_h media, char **description) { int ret = MEDIA_CONTENT_ERROR_NONE; |