From: minje.ahn Date: Wed, 20 Jul 2022 06:57:09 +0000 (+0900) Subject: Cleanup functions related to metadata X-Git-Tag: accepted/tizen/unified/20220808.135312^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=sidebyside;h=76b0ad67d8d0800708a71ba61e8d90e03e99d618;p=platform%2Fcore%2Fapi%2Fmedia-content.git Cleanup functions related to metadata Change-Id: I450ce50e0fd6c193a553fa0c036438ff3b72dd17 Signed-off-by: minje.ahn --- diff --git a/test/media-content_test.c b/test/media-content_test.c index 0d3ea75..4b003b3 100755 --- a/test/media-content_test.c +++ b/test/media-content_test.c @@ -34,305 +34,243 @@ static GMainLoop *g_loop = NULL; static int g_cnt = 0; static int g_media_cnt = 0; -#define test_audio_id "3304285f-1070-41af-8b4e-f0086cc768f3" -#define test_video_id "53c43e7e-53d2-4194-80a6-55d5dcde0def" +#define test_audio_id "3304285f-1070-41af-8b4e-f0086cc768f3" +#define test_video_id "53c43e7e-53d2-4194-80a6-55d5dcde0def" #define test_image_id "db1c184c-6f31-43b4-b924-8c00ac5b6197" -static void get_audio_meta(audio_meta_h audio) +static void get_audio_meta(media_info_h media) { + audio_meta_h audio = NULL; char *c_value = NULL; int i_value = 0; - int ret = MEDIA_CONTENT_ERROR_NONE; content_debug("=== audio meta ==="); + if (media_info_get_audio(media, &audio) != MEDIA_CONTENT_ERROR_NONE) + return; - ret = audio_meta_get_media_id(audio, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); - - if (c_value) + if (audio_meta_get_media_id(audio, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("audio_id : [%s]", c_value); - SAFE_FREE(c_value); - - ret = audio_meta_get_album(audio, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); + SAFE_FREE(c_value); + } - if (c_value) + if (audio_meta_get_album(audio, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("album : [%s]", c_value); - SAFE_FREE(c_value); - - ret = audio_meta_get_artist(audio, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); + SAFE_FREE(c_value); + } - if (c_value) + if (audio_meta_get_artist(audio, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("artist : [%s]", c_value); - SAFE_FREE(c_value); - - ret = audio_meta_get_album_artist(audio, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); - - if (c_value) - content_debug("album_artist : [%s]", c_value); - SAFE_FREE(c_value); + SAFE_FREE(c_value); + } - ret = audio_meta_get_genre(audio, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); + if (audio_meta_get_album_artist(audio, &c_value) == MEDIA_CONTENT_ERROR_NONE) { + content_debug("album artist : [%s]", c_value); + SAFE_FREE(c_value); + } - if (c_value) + if (audio_meta_get_genre(audio, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("genre : [%s]", c_value); - SAFE_FREE(c_value); - - ret = audio_meta_get_composer(audio, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); + SAFE_FREE(c_value); + } - if (c_value) + if (audio_meta_get_composer(audio, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("composer : [%s]", c_value); - SAFE_FREE(c_value); - - ret = audio_meta_get_year(audio, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); + SAFE_FREE(c_value); + } - if (c_value) + if (audio_meta_get_year(audio, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("year : [%s]", c_value); - SAFE_FREE(c_value); - - ret = audio_meta_get_recorded_date(audio, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); - - if (c_value) - content_debug("recorded_date : [%s]", c_value); - SAFE_FREE(c_value); + SAFE_FREE(c_value); + } - ret = audio_meta_get_copyright(audio, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); + if (audio_meta_get_recorded_date(audio, &c_value) == MEDIA_CONTENT_ERROR_NONE) { + content_debug("recorded date : [%s]", c_value); + SAFE_FREE(c_value); + } - if (c_value) + if (audio_meta_get_copyright(audio, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("copyright : [%s]", c_value); - SAFE_FREE(c_value); - - ret = audio_meta_get_track_num(audio, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); + SAFE_FREE(c_value); + } - if (c_value) - content_debug("track_num : [%s]", c_value); - SAFE_FREE(c_value); + if (audio_meta_get_track_num(audio, &c_value) == MEDIA_CONTENT_ERROR_NONE) { + content_debug("track number : [%s]", c_value); + SAFE_FREE(c_value); + } - ret = audio_meta_get_bit_rate(audio, &i_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); - else + if (audio_meta_get_bit_rate(audio, &i_value) == MEDIA_CONTENT_ERROR_NONE) content_debug("bitrate : [%d]", i_value); - ret = audio_meta_get_sample_rate(audio, &i_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); - else + if (audio_meta_get_sample_rate(audio, &i_value) == MEDIA_CONTENT_ERROR_NONE) content_debug("samplerate : [%d]", i_value); - ret = audio_meta_get_channel(audio, &i_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); - else + if (audio_meta_get_channel(audio, &i_value) == MEDIA_CONTENT_ERROR_NONE) content_debug("channel : [%d]", i_value); - ret = audio_meta_get_duration(audio, &i_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); - else + if (audio_meta_get_duration(audio, &i_value) == MEDIA_CONTENT_ERROR_NONE) content_debug("duration : [%d]", i_value); + audio_meta_destroy(audio); } -static void get_video_meta(video_meta_h video) +static void get_video_meta(media_info_h media) { + video_meta_h video = NULL; char *c_value = NULL; int i_value = 0; - int ret = MEDIA_CONTENT_ERROR_NONE; content_debug("=== video meta ==="); + if (media_info_get_video(media, &video) != MEDIA_CONTENT_ERROR_NONE) + return; - ret = video_meta_get_media_id(video, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); - - if (c_value) + if (video_meta_get_media_id(video, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("video_id : [%s]", c_value); - SAFE_FREE(c_value); - - ret = video_meta_get_album(video, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); + SAFE_FREE(c_value); + } - if (c_value) + if (video_meta_get_album(video, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("album : [%s]", c_value); - SAFE_FREE(c_value); - - ret = video_meta_get_artist(video, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); + SAFE_FREE(c_value); + } - if (c_value) + if (video_meta_get_artist(video, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("artist : [%s]", c_value); - SAFE_FREE(c_value); - - ret = video_meta_get_album_artist(video, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); - - if (c_value) - content_debug("album_artist : [%s]", c_value); - SAFE_FREE(c_value); + SAFE_FREE(c_value); + } - ret = video_meta_get_genre(video, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); + if (video_meta_get_album_artist(video, &c_value) == MEDIA_CONTENT_ERROR_NONE) { + content_debug("album artist : [%s]", c_value); + SAFE_FREE(c_value); + } - if (c_value) + if (video_meta_get_genre(video, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("genre : [%s]", c_value); - SAFE_FREE(c_value); - - ret = video_meta_get_composer(video, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); - - if (c_value) - content_debug("omposer : [%s]", c_value); - SAFE_FREE(c_value); + SAFE_FREE(c_value); + } - ret = video_meta_get_year(video, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); + if (video_meta_get_composer(video, &c_value) == MEDIA_CONTENT_ERROR_NONE) { + content_debug("composer : [%s]", c_value); + SAFE_FREE(c_value); + } - if (c_value) + if (video_meta_get_year(video, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("year : [%s]", c_value); - SAFE_FREE(c_value); - - ret = video_meta_get_recorded_date(video, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); - - if (c_value) - content_debug("recorded_date : [%s]", c_value); - SAFE_FREE(c_value); + SAFE_FREE(c_value); + } - ret = video_meta_get_copyright(video, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); + if (video_meta_get_recorded_date(video, &c_value) == MEDIA_CONTENT_ERROR_NONE) { + content_debug("recorded date : [%s]", c_value); + SAFE_FREE(c_value); + } - if (c_value) + if (video_meta_get_copyright(video, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("copyright : [%s]", c_value); - SAFE_FREE(c_value); - - ret = video_meta_get_track_num(video, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); + SAFE_FREE(c_value); + } - if (c_value) - content_debug("track_num : [%s]", c_value); - SAFE_FREE(c_value); + if (video_meta_get_track_num(video, &c_value) == MEDIA_CONTENT_ERROR_NONE) { + content_debug("track num : [%s]", c_value); + SAFE_FREE(c_value); + } - ret = video_meta_get_bit_rate(video, &i_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); - else + if (video_meta_get_bit_rate(video, &i_value) == MEDIA_CONTENT_ERROR_NONE) content_debug("bitrate : [%d]", i_value); - ret = video_meta_get_duration(video, &i_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); - else + if (video_meta_get_duration(video, &i_value) == MEDIA_CONTENT_ERROR_NONE) content_debug("duration : [%d]", i_value); - ret = video_meta_get_width(video, &i_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); - else + if (video_meta_get_width(video, &i_value) == MEDIA_CONTENT_ERROR_NONE) content_debug("width : [%d]", i_value); - ret = video_meta_get_height(video, &i_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error when get meta : [%d]", ret); - else + if (video_meta_get_height(video, &i_value) == MEDIA_CONTENT_ERROR_NONE) content_debug("height : [%d]", i_value); + video_meta_destroy(video); } -static void get_image_meta(image_meta_h image) +static void get_image_meta(media_info_h media) { + image_meta_h image = NULL; char *c_value = NULL; int i_value = 0; media_content_orientation_e orientation; - int ret = MEDIA_CONTENT_ERROR_NONE; content_debug("=== image meta ==="); + if (media_info_get_image(media, &image) != MEDIA_CONTENT_ERROR_NONE) + return; - ret = image_meta_get_width(image, &i_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error image_meta_get_width : [%d]", ret); - else + if (image_meta_get_width(image, &i_value) == MEDIA_CONTENT_ERROR_NONE) content_debug("width : [%d]", i_value); - ret = image_meta_get_height(image, &i_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error image_meta_get_height : [%d]", ret); - else + if (image_meta_get_height(image, &i_value) == MEDIA_CONTENT_ERROR_NONE) content_debug("height : [%d]", i_value); - ret = image_meta_get_orientation(image, &orientation); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error image_meta_get_orientation : [%d]", ret); - else + if (image_meta_get_orientation(image, &orientation) == MEDIA_CONTENT_ERROR_NONE) content_debug("orientation : [%d]", orientation); - ret = image_meta_get_date_taken(image, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error image_meta_get_date_taken : [%d]", ret); - - if (c_value) - content_debug("date_taken : [%s]", c_value); - SAFE_FREE(c_value); + if (image_meta_get_date_taken(image, &c_value) == MEDIA_CONTENT_ERROR_NONE) { + content_debug("datetaken : [%s]", c_value); + SAFE_FREE(c_value); + } + image_meta_destroy(image); } -static void get_album_meta(media_album_h album) +static void get_book_meta(media_info_h media) { + book_meta_h book = NULL; char *c_value = NULL; - int i_value = 0; - int ret = MEDIA_CONTENT_ERROR_NONE; - content_debug("=== album meta ==="); + content_debug("=== book meta ==="); + if (media_info_get_book(media, &book) != MEDIA_CONTENT_ERROR_NONE) + return; - ret = media_album_get_album_id(album, &i_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_album_get_album_id : [%d]", ret); - else - content_debug("album_id : [%d]", i_value); + if (book_meta_get_media_id(book, &c_value) == MEDIA_CONTENT_ERROR_NONE) { + content_debug("media_id : [%s]", c_value); + SAFE_FREE(c_value); + } - ret = media_album_get_name(album, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_album_get_name : [%d]", ret); + if (book_meta_get_author(book, &c_value) == MEDIA_CONTENT_ERROR_NONE) { + content_debug("author : [%s]", c_value); + SAFE_FREE(c_value); + } - if (c_value) - content_debug("album_name : [%s]", c_value); - SAFE_FREE(c_value); + if (book_meta_get_date(book, &c_value) == MEDIA_CONTENT_ERROR_NONE) { + content_debug("date : [%s]", c_value); + SAFE_FREE(c_value); + } - ret = media_album_get_artist(album, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_album_get_artist : [%d]", ret); + if (book_meta_get_publisher(book, &c_value) == MEDIA_CONTENT_ERROR_NONE) { + content_debug("publisher : [%s]", c_value); + SAFE_FREE(c_value); + } - if (c_value) - content_debug("album_artist : [%s]", c_value); - SAFE_FREE(c_value); + if (book_meta_get_subject(book, &c_value) == MEDIA_CONTENT_ERROR_NONE) { + content_debug("subject : [%s]", c_value); + SAFE_FREE(c_value); + } + book_meta_destroy(book); +} + +static void get_album_meta(media_album_h album) +{ + char *c_value = NULL; + int i_value = 0; + + content_debug("=== album meta ==="); + if (media_album_get_album_id(album, &i_value) == MEDIA_CONTENT_ERROR_NONE) + content_debug("album id : [%d]", i_value); + + if (media_album_get_name(album, &c_value) == MEDIA_CONTENT_ERROR_NONE) { + content_debug("album name : [%s]", c_value); + SAFE_FREE(c_value); + } + + if (media_album_get_artist(album, &c_value) == MEDIA_CONTENT_ERROR_NONE) { + content_debug("album artist : [%s]", c_value); + SAFE_FREE(c_value); + } } static void get_bookmark_meta(media_bookmark_h bookmark) @@ -340,62 +278,38 @@ static void get_bookmark_meta(media_bookmark_h bookmark) char *c_value = NULL; int i_value = 0; time_t time = 0; - int ret = MEDIA_CONTENT_ERROR_NONE; content_debug("=== bookmark meta ==="); - - ret = media_bookmark_get_bookmark_id(bookmark, &i_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_bookmark_get_bookmark_id : [%d]", ret); - else + if (media_bookmark_get_bookmark_id(bookmark, &i_value) == MEDIA_CONTENT_ERROR_NONE) content_debug("bookmark_id : %d", i_value); - ret = media_bookmark_get_thumbnail_path(bookmark, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_bookmark_get_thumbnail_path : [%d]", ret); - - if (c_value) + if (media_bookmark_get_thumbnail_path(bookmark, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("bookmark thumbnail_path : %s", c_value); - SAFE_FREE(c_value); + SAFE_FREE(c_value); + } - ret = media_bookmark_get_marked_time(bookmark, &time); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_bookmark_get_marked_time : [%d]", ret); - else + if (media_bookmark_get_marked_time(bookmark, &time) == MEDIA_CONTENT_ERROR_NONE) content_debug("bookmark marked_time : %ld", time); - ret = media_bookmark_get_name(bookmark, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_bookmark_get_name : [%d]", ret); - - if (c_value) + if (media_bookmark_get_name(bookmark, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("bookmark name : %s", c_value); - SAFE_FREE(c_value); - + SAFE_FREE(c_value); + } } static void get_tag_meta(media_tag_h tag) { char *c_value = NULL; int i_value = 0; - int ret = MEDIA_CONTENT_ERROR_NONE; content_debug("=== tag meta ==="); - - ret = media_tag_get_tag_id(tag, &i_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_tag_get_tag_id : [%d]", ret); - else + if (media_tag_get_tag_id(tag, &i_value) == MEDIA_CONTENT_ERROR_NONE) content_debug("tag_id : %d", i_value); - ret = media_tag_get_name(tag, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_tag_get_name : [%d]", ret); - - if (c_value) + if (media_tag_get_name(tag, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("tag_name : %s", c_value); - SAFE_FREE(c_value); - + SAFE_FREE(c_value); + } } static void get_face_meta(media_face_h face) @@ -406,95 +320,58 @@ static void get_face_meta(media_face_h face) unsigned int rect_w = 0; unsigned int rect_h = 0; media_content_orientation_e orientation = 0; - int ret = MEDIA_CONTENT_ERROR_NONE; content_debug("=== face meta ==="); - - ret = media_face_get_face_id(face, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_face_get_face_id : [%d]", ret); - - if (c_value) + if (media_face_get_face_id(face, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("face_id : %s", c_value); - SAFE_FREE(c_value); - - ret = media_face_get_media_id(face, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_face_get_media_id : [%d]", ret); + SAFE_FREE(c_value); + } - if (c_value) + if (media_face_get_media_id(face, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("media_id : %s", c_value); - SAFE_FREE(c_value); + SAFE_FREE(c_value); + } - ret = media_face_get_face_rect(face, &rect_x, &rect_y, &rect_w, &rect_h); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_face_get_face_rect : [%d]", ret); - else + if (media_face_get_face_rect(face, &rect_x, &rect_y, &rect_w, &rect_h) == MEDIA_CONTENT_ERROR_NONE) content_debug("face_rect x[%d] y[%d] w[%d] h[%d]", rect_x, rect_y, rect_w, rect_h); - ret = media_face_get_orientation(face, &orientation); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_face_get_orientation : [%d]", ret); - else + if (media_face_get_orientation(face, &orientation) == MEDIA_CONTENT_ERROR_NONE) content_debug("orientation : %d", orientation); - ret = media_face_get_tag(face, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_face_get_tag : [%d]", ret); - - if (c_value) + if (media_face_get_tag(face, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("tag : %s", c_value); - SAFE_FREE(c_value); - + SAFE_FREE(c_value); + } } static void get_folder_meta(media_folder_h folder, char **folder_id) { char *c_value = NULL; media_content_storage_e storage_type; - int ret = MEDIA_CONTENT_ERROR_NONE; content_debug("=== folder meta ==="); - - ret = media_folder_get_folder_id(folder, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_folder_get_folder_id : [%d]", ret); - - if (c_value) { + if (media_folder_get_folder_id(folder, &c_value) != MEDIA_CONTENT_ERROR_NONE) { content_debug("folder_id : %s", c_value); *folder_id = c_value; } - ret = media_folder_get_path(folder, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_folder_get_path : [%d]", ret); - - if (c_value) + if (media_folder_get_path(folder, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("folder_path : %s", c_value); - SAFE_FREE(c_value); - - ret = media_folder_get_name(folder, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_folder_get_name : [%d]", ret); + SAFE_FREE(c_value); + } - if (c_value) + if (media_folder_get_name(folder, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("folder_name : %s", c_value); - SAFE_FREE(c_value); + SAFE_FREE(c_value); + } - ret = media_folder_get_storage_type(folder, &storage_type); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_folder_get_storage_type : [%d]", ret); - else + if (media_folder_get_storage_type(folder, &storage_type) == MEDIA_CONTENT_ERROR_NONE) content_debug("storage_type : [%d]", storage_type); - ret = media_folder_get_storage_id(folder, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_folder_get_storage_id : [%d]", ret); - - if (c_value) + if (media_folder_get_storage_id(folder, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("storage_id : %s", c_value); - SAFE_FREE(c_value); - + SAFE_FREE(c_value); + } } static void get_media_meta(media_info_h media) @@ -505,169 +382,87 @@ static void get_media_meta(media_info_h media) bool b_value = false; unsigned long long size = 0; media_content_type_e media_type = 0; - int ret = MEDIA_CONTENT_ERROR_NONE; content_debug("=== media meta ==="); - - ret = media_info_get_media_type(media, &media_type); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_info_get_media_type : [%d]", ret); - else + if (media_info_get_media_type(media, &media_type) == MEDIA_CONTENT_ERROR_NONE) content_debug("media_type : [%d]", media_type); - ret = media_info_get_media_id(media, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_info_get_media_id : [%d]", ret); - - if (c_value) + if (media_info_get_media_id(media, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("media_id : [%s]", c_value); - SAFE_FREE(c_value); - - ret = media_info_get_file_path(media, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_info_get_file_path : [%d]", ret); + SAFE_FREE(c_value); + } - if (c_value) + if (media_info_get_file_path(media, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("file_path : [%s]", c_value); - SAFE_FREE(c_value); - - ret = media_info_get_display_name(media, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_info_get_display_name : [%d]", ret); + SAFE_FREE(c_value); + } - if (c_value) + if (media_info_get_display_name(media, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("display_name : [%s]", c_value); - SAFE_FREE(c_value); - - ret = media_info_get_mime_type(media, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_info_get_mime_type : [%d]", ret); + SAFE_FREE(c_value); + } - if (c_value) + if (media_info_get_mime_type(media, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("mime_type : [%s]", c_value); - SAFE_FREE(c_value); - - ret = media_info_get_thumbnail_path(media, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_info_get_thumbnail_path : [%d]", ret); + SAFE_FREE(c_value); + } - if (c_value) + if (media_info_get_thumbnail_path(media, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("thumbnail_path : [%s]", c_value); - SAFE_FREE(c_value); - - ret = media_info_get_description(media, &c_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_info_get_description : [%d]", ret); + SAFE_FREE(c_value); + } - if (c_value) + if (media_info_get_description(media, &c_value) == MEDIA_CONTENT_ERROR_NONE) { content_debug("description : [%s]", c_value); - SAFE_FREE(c_value); + SAFE_FREE(c_value); + } - ret = media_info_get_size(media, &size); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_info_get_size : [%d]", ret); - else + if (media_info_get_size(media, &size) == MEDIA_CONTENT_ERROR_NONE) content_debug("size : [%lld]", size); - ret = media_info_get_added_time(media, &t_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_info_get_added_time : [%d]", ret); - else + if (media_info_get_added_time(media, &t_value) == MEDIA_CONTENT_ERROR_NONE) content_debug("added_time : [%ld]", t_value); - ret = media_info_get_modified_time(media, &t_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_info_get_modified_time : [%d]", ret); - else + if (media_info_get_modified_time(media, &t_value) == MEDIA_CONTENT_ERROR_NONE) content_debug("modified_time : [%ld]", t_value); - ret = media_info_get_timeline(media, &t_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_info_get_timeline : [%d]", ret); - else + if (media_info_get_timeline(media, &t_value) == MEDIA_CONTENT_ERROR_NONE) content_debug("timeline : [%ld]", t_value); - ret = media_info_get_rating(media, &i_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_info_get_rating : [%d]", ret); - else + if (media_info_get_rating(media, &i_value) == MEDIA_CONTENT_ERROR_NONE) content_debug("rating : [%d]", i_value); - ret = media_info_get_favorite(media, &b_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_info_get_favorite : [%d]", ret); - else + if (media_info_get_favorite(media, &b_value) == MEDIA_CONTENT_ERROR_NONE) content_debug("favorite : [%d]", b_value); - ret = media_info_is_drm(media, &b_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_info_is_drm : [%d]", ret); - else + if (media_info_is_drm(media, &b_value) == MEDIA_CONTENT_ERROR_NONE) content_debug("is_drm : [%d]", b_value); - ret = media_info_is_360_content(media, &b_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_info_is_360_content : [%d]", ret); - else + if (media_info_is_360_content(media, &b_value) == MEDIA_CONTENT_ERROR_NONE) content_debug("is_360 : [%d]", b_value); #ifdef _USE_TVPD_MODE - ret = media_info_get_stitched_state(media, &i_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_info_get_stitched_state : [%d]", ret); - else + if (media_info_get_stitched_state(media, &i_value) == MEDIA_CONTENT_ERROR_NONE) content_debug("360 stitched : [%d]", i_value); - ret = media_info_get_stitched_engine(media, &i_value); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_info_get_stitched_engine : [%d]", ret); - else + if (media_info_get_stitched_engine(media, &i_value) == MEDIA_CONTENT_ERROR_NONE) content_debug("360 engine : [%d]", i_value); #endif - if (media_type == MEDIA_CONTENT_TYPE_MUSIC) { - audio_meta_h audio; + if (media_type == MEDIA_CONTENT_TYPE_MUSIC) + get_audio_meta(media); - ret = media_info_get_audio(media, &audio); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_info_get_audio : [%d]", ret); - else - get_audio_meta(audio); - - ret = audio_meta_destroy(audio); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error audio_meta_destroy : [%d]", ret); - - } else if (media_type == MEDIA_CONTENT_TYPE_IMAGE) { - image_meta_h image; - - ret = media_info_get_image(media, &image); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_info_get_image : [%d]", ret); - else - get_image_meta(image); - - ret = image_meta_destroy(image); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error image_meta_destroy : [%d]", ret); - - } else if (media_type == MEDIA_CONTENT_TYPE_VIDEO) { - video_meta_h video; - - ret = media_info_get_video(media, &video); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error media_info_get_video : [%d]", ret); - else - get_video_meta(video); + if (media_type == MEDIA_CONTENT_TYPE_IMAGE) + get_image_meta(media); - ret = video_meta_destroy(video); - if (ret != MEDIA_CONTENT_ERROR_NONE) - content_error("error video_meta_destroy : [%d]", ret); + if (media_type == MEDIA_CONTENT_TYPE_VIDEO) + get_video_meta(media); - } else { - content_debug("Other Content"); - } + if (media_type == MEDIA_CONTENT_TYPE_BOOK) + get_book_meta(media); + if (media_type == MEDIA_CONTENT_TYPE_OTHERS) + content_debug("Other type"); } bool media_item_cb(media_info_h media, void *user_data)