Improve readability of media_audio
[platform/core/api/media-content.git] / src / media_image.c
index 3a7512d..16ad32a 100755 (executable)
@@ -33,7 +33,6 @@ int image_meta_destroy(image_meta_h image)
 
        SAFE_FREE(_image->media_id);
        SAFE_FREE(_image->date_taken);
-       SAFE_FREE(_image->title);
        SAFE_FREE(_image->exposure_time);
        SAFE_FREE(_image->model);
        SAFE_FREE(_image);
@@ -59,11 +58,6 @@ int image_meta_clone(image_meta_h *dst, image_meta_h src)
                media_content_retv_free_image_if(_dst->date_taken == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (image_meta_h)_dst);
        }
 
-       if (STRING_VALID(_src->title)) {
-               _dst->title = strdup(_src->title);
-               media_content_retv_free_image_if(_dst->title == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (image_meta_h)_dst);
-       }
-
        if (STRING_VALID(_src->exposure_time)) {
                _dst->exposure_time = strdup(_src->exposure_time);
                media_content_retv_free_image_if(_dst->exposure_time == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, (image_meta_h)_dst);
@@ -257,10 +251,48 @@ int image_meta_get_model(image_meta_h image, char **model)
 
 int image_meta_set_orientation(image_meta_h image, media_content_orientation_e orientation)
 {
-       return 0;
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       media_content_warn("DEPRECATION WARNING: image_meta_set_orientation() is deprecated and will be removed from next release.");
+       image_meta_s *_image = (image_meta_s*)image;
+
+       if (_image == NULL) {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       if ((orientation < MEDIA_CONTENT_ORIENTATION_NOT_AVAILABLE) || (orientation > MEDIA_CONTENT_ORIENTATION_ROT_270)) {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       _image->orientation = orientation;
+
+       return ret;
 }
 
 int image_meta_update_to_db(image_meta_h image)
 {
-       return 0;
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       media_content_warn("DEPRECATION WARNING: image_meta_update_to_db() is deprecated and will be removed from next release.");
+       image_meta_s *_image = (image_meta_s*)image;
+       char *sql = NULL;
+
+       if (_image != NULL && STRING_VALID(_image->media_id)) {
+#ifdef _USE_TVPD_MODE
+               char *storage_id = NULL;
+               ret = _media_db_get_storage_id_by_media_id(_image->media_id, &storage_id);
+               media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+               sql = sqlite3_mprintf(UPDATE_IMAGE_META_FROM_MEDIA, storage_id, _image->orientation, _image->media_id);
+               SAFE_FREE(storage_id);
+#else
+               sql = sqlite3_mprintf(UPDATE_IMAGE_META_FROM_MEDIA, _image->orientation, _image->media_id);
+#endif
+               ret = _content_query_sql(sql);
+               SQLITE3_SAFE_FREE(sql);
+       } else {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       return ret;
 }