#include <pthread.h>
#include <glib.h>
#include <tzplatform_config.h>
+#include <media_content_internal.h>
+
filter_h g_filter = NULL;
filter_h g_filter_g = NULL; /*filter for group like folder, tag, playlist, album, year ... */
static int g_cnt = 0;
static int g_media_cnt = 0;
-#define test_audio_id "0f999626-6218-450c-a4ad-181a3bab6ebf"
-#define test_video_id "c1a92494-cc5b-4d74-aa7d-253199234548"
+#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"
media_folder_h g_folder = NULL;
-bool get_audio_meta(audio_meta_h audio)
+void get_audio_meta(audio_meta_h audio)
{
char *c_value = NULL;
int i_value = 0;
- time_t t_value = 0;
int ret = MEDIA_CONTENT_ERROR_NONE;
media_content_debug("=== audio meta ===");
media_content_error("error when get meta : [%d]", ret);
media_content_debug("duration : [%d]", i_value);
- ret = audio_meta_get_played_count(audio, &i_value);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error when get meta : [%d]", ret);
- media_content_debug("played_count : [%d]", i_value);
-
- ret = audio_meta_get_played_time(audio, &t_value);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error when get meta : [%d]", ret);
- media_content_debug("played_time : [%d]", t_value);
-
- ret = audio_meta_get_played_position(audio, &i_value);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error when get meta : [%d]", ret);
- media_content_debug("played_position : [%d]", i_value);
-
- return true;
}
-bool get_video_meta(video_meta_h video)
+void get_video_meta(video_meta_h video)
{
char *c_value = NULL;
int i_value = 0;
- time_t t_value = 0;
int ret = MEDIA_CONTENT_ERROR_NONE;
media_content_debug("=== video meta ===");
media_content_error("error when get meta : [%d]", ret);
media_content_debug("height : [%d]", i_value);
- ret = video_meta_get_played_count(video, &i_value);
+}
+
+void get_image_meta(image_meta_h image)
+{
+ char *c_value = NULL;
+ int i_value = 0;
+ media_content_orientation_e orientation;
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+
+ media_content_debug("=== image meta ===");
+
+ ret = image_meta_get_width(image, &i_value);
if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error when get meta : [%d]", ret);
- media_content_debug("played_count : [%d]", i_value);
+ media_content_error("error image_meta_get_width : [%d]", ret);
+ media_content_debug("width : [%d]", i_value);
- ret = video_meta_get_played_time(video, &t_value);
+ ret = image_meta_get_height(image, &i_value);
if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error when get meta : [%d]", ret);
- media_content_debug("played_time : [%d]", t_value);
+ media_content_error("error image_meta_get_height : [%d]", ret);
+ media_content_debug("height : [%d]", i_value);
- ret = video_meta_get_played_position(video, &i_value);
+ ret = image_meta_get_orientation(image, &orientation);
if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error when get meta : [%d]", ret);
- media_content_debug("played_position : [%d]", i_value);
+ media_content_error("error image_meta_get_orientation : [%d]", ret);
+ media_content_debug("orientation : [%d]", orientation);
+
+ ret = image_meta_get_date_taken(image, &c_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error image_meta_get_date_taken : [%d]", ret);
+ media_content_debug("date_taken : [%s]", c_value);
+ SAFE_FREE(c_value);
- return true;
}
bool gallery_folder_list_cb(media_folder_h folder, void *user_data)
bool gallery_media_item_cb(media_info_h media, void *user_data)
{
media_info_h new_media = NULL;
- media_info_clone(&new_media, media);
+ int ret = MEDIA_CONTENT_ERROR_NONE;
- GList **list = (GList**)user_data;
- *list = g_list_append(*list, new_media);
+ ret = media_info_clone(&new_media, media);
+
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ GList **list = (GList**)user_data;
+ *list = g_list_append(*list, new_media);
+ }
return true;
}
} else if (media_type == MEDIA_CONTENT_TYPE_IMAGE) {
image_meta_h image;
media_content_orientation_e orientation = 0;
- bool is_burst_shot = false;
- char *burst_id = NULL;
- char *weather = NULL;
if (media_info_get_image(media, &image) == MEDIA_CONTENT_ERROR_NONE) {
ret = image_meta_get_orientation(image, &orientation);
else
media_content_debug("[image] orientation : %d", orientation);
- ret = image_meta_is_burst_shot(image, &is_burst_shot);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error image_meta_is_burst_shot : [%d]", ret);
- if (is_burst_shot) {
- ret = image_meta_get_burst_id(image, &burst_id);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error image_meta_get_burst_id : [%d]", ret);
- else
- media_content_debug("[image] burst_id : [%s]", burst_id);
-
- SAFE_FREE(burst_id);
- }
-
ret = image_meta_destroy(image);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("error image_meta_destroy : [%d]", ret);
media_content_debug("description : [%s]", c_value);
SAFE_FREE(c_value);
- ret = media_info_get_author(media, &c_value);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error when get info : [%d]", ret);
- media_content_debug("author : [%s]", c_value);
- SAFE_FREE(c_value);
-
- ret = media_info_get_provider(media, &c_value);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error when get info : [%d]", ret);
- media_content_debug("provider : [%s]", c_value);
- SAFE_FREE(c_value);
-
- ret = media_info_get_content_name(media, &c_value);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error when get info : [%d]", ret);
- media_content_debug("content_name : [%s]", c_value);
- SAFE_FREE(c_value);
-
- ret = media_info_get_category(media, &c_value);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error when get info : [%d]", ret);
- media_content_debug("category : [%s]", c_value);
- SAFE_FREE(c_value);
-
- ret = media_info_get_location_tag(media, &c_value);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error when get info : [%d]", ret);
- media_content_debug("location_tag : [%s]", c_value);
- SAFE_FREE(c_value);
-
- ret = media_info_get_age_rating(media, &c_value);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error when get info : [%d]", ret);
- media_content_debug("age_rating : [%s]", c_value);
- SAFE_FREE(c_value);
-
- ret = media_info_get_keyword(media, &c_value);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error when get info : [%d]", ret);
- media_content_debug("keyword : [%s]", c_value);
- SAFE_FREE(c_value);
-
ret = media_info_get_size(media, &size);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("error when get info : [%d]", ret);
ret = media_info_get_added_time(media, &t_value);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("error when get info : [%d]", ret);
- media_content_debug("added_time : [%d]", t_value);
+ media_content_debug("added_time : [%ld]", t_value);
ret = media_info_get_modified_time(media, &t_value);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("error when get info : [%d]", ret);
- media_content_debug("modified_time : [%d]", t_value);
+ media_content_debug("modified_time : [%ld]", t_value);
ret = media_info_get_timeline(media, &t_value);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("error when get info : [%d]", ret);
- media_content_debug("timeline : [%d]", t_value);
+ media_content_debug("timeline : [%ld]", t_value);
ret = media_info_get_rating(media, &i_value);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("error when get info : [%d]", ret);
media_content_debug("is_drm : [%d]", b_value);
- ret = media_info_is_360(media, &b_value);
+ ret = media_info_is_360_content(media, &b_value);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("error when get info : [%d]", ret);
media_content_debug("is_360 : [%d]", b_value);
- ret = media_info_set_weather(media, "Sunny");
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_content_error("Fail to set weather");
- return ret;
+ ret = media_info_get_stitched_state(media, &i_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error when get info : [%d]", ret);
+ media_content_debug("360 stitched : [%d]", i_value);
- ret = media_info_get_weather(media, &c_value);
+ ret = media_info_get_stitched_engine(media, &i_value);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("error when get info : [%d]", ret);
- media_content_debug("weather : [%s]", c_value);
- SAFE_FREE(c_value);
+ media_content_debug("360 engine : [%d]", i_value);
- /* Media server can't update when another db handle holds DB connection by sqlite3_prepare */
- /*ret = media_info_set_location_tag(media, "Test location tag");*/
/*media_info_update_to_db(media);*/
SAFE_FREE(media_id);
#endif
int item_count = 0;
char *folder_id = NULL;
char *str_val = NULL;
- int int_val = -1;
media_content_storage_e storage_type;
bool ret;
media_folder_h *_folder = (media_folder_h*)user_data;
}
media_content_debug("folder_id = [%s]", folder_id);
- if (media_folder_get_parent_folder_id(folder, &str_val) != MEDIA_CONTENT_ERROR_NONE) {
- media_content_error("[ERROR] media_folder_get_parent_folder_id is failed");
- return false;
- }
- media_content_debug("parent_folder_id = [%s]", str_val);
-
if (media_folder_get_path(folder, &str_val) != MEDIA_CONTENT_ERROR_NONE) {
SAFE_FREE(folder_id);
media_content_error("[ERROR] media_folder_get_path is failed");
return false;
}
media_content_debug("storage_id = [%s]", str_val);
+ SAFE_FREE(str_val);
- if (media_folder_get_order(folder, &int_val) != MEDIA_CONTENT_ERROR_NONE) {
- media_content_error("[ERROR] media_folder_get_order is failed");
- return false;
- }
- media_content_debug("folder_order = [%d]", int_val);
#if 1
if (media_folder_get_media_count_from_db(folder_id, g_filter, &item_count) != MEDIA_CONTENT_ERROR_NONE) {
SAFE_FREE(folder_id);
bool playlist_list_cb(media_playlist_h playlist, void *user_data)
{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
int playlist_id = 0;
char *playlist_name = NULL;
media_playlist_h playlist_h;
return false;
}
- media_playlist_get_playlist_id(playlist, &playlist_id);
+ ret = media_playlist_get_playlist_id(playlist, &playlist_id);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_playlist_get_playlist_id : [%d]", ret);
+
media_content_debug("playlist_id : %d", playlist_id);
/* 64bit build issue */
#if 0
if (user_data != NULL)
*list = g_list_append(*list, (gpointer)playlist_id);
#endif
- media_playlist_get_name(playlist, &playlist_name);
+ ret = media_playlist_get_name(playlist, &playlist_name);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_playlist_get_name : [%d]", ret);
+
media_content_debug("playlist_name : %s", playlist_name);
SAFE_FREE(playlist_name);
- media_playlist_get_thumbnail_path(playlist, &playlist_thumbnail_path);
+ ret = media_playlist_get_thumbnail_path(playlist, &playlist_thumbnail_path);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_playlist_get_thumbnail_path : [%d]", ret);
+
media_content_debug("playlist_thumbnail_path : %s", playlist_thumbnail_path);
SAFE_FREE(playlist_thumbnail_path);
- media_playlist_get_playlist_from_db(playlist_id, &playlist_h);
+ ret = media_playlist_get_playlist_from_db(playlist_id, &playlist_h);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_playlist_get_playlist_from_db : [%d]", ret);
- media_playlist_destroy(playlist_h);
+ ret = media_playlist_destroy(playlist_h);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_playlist_destroy : [%d]", ret);
return true;
}
media_bookmark_h *_bookmark = (media_bookmark_h*)bookmark;
int ret = MEDIA_CONTENT_ERROR_NONE;
+ if (_bookmark != NULL && user_data != NULL) {
+ media_bookmark_h new_bookmark;
+
+ media_bookmark_clone(&new_bookmark, bookmark);
+ GList **list = (GList**)user_data;
+ *list = g_list_append(*list, new_bookmark);
+ }
+
if (_bookmark != NULL) {
char *name = NULL;
time_t time = 0;
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("error media_bookmark_get_marked_time : [%d]", ret);
else
- media_content_debug("bookmark marked_time : %d", time);
+ media_content_debug("bookmark marked_time : %ld", time);
+
+ ret = media_bookmark_get_name(bookmark, &name);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_bookmark_get_name : [%d]", ret);
+ else
+ media_content_debug("bookmark name : %s", name);
+
+ SAFE_FREE(name);
+
}
return true;
if (media_type == MEDIA_CONTENT_TYPE_IMAGE) {
image_meta_h image_handle;
- int width = 0, height = 0;
- media_content_orientation_e orientation = 0;
- char *datetaken = NULL;
- char *burst_id = NULL;
ret = media_info_get_image(media_handle, &image_handle);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("media_info_get_image failed: %d", ret);
- } else {
- ret = image_meta_get_width(image_handle, &width);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error image_meta_get_width : [%d]", ret);
- ret = image_meta_get_height(image_handle, &height);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error image_meta_get_height : [%d]", ret);
- ret = image_meta_get_orientation(image_handle, &orientation);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error image_meta_get_orientation : [%d]", ret);
- ret = image_meta_get_date_taken(image_handle, &datetaken);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error image_meta_get_date_taken : [%d]", ret);
- ret = image_meta_get_burst_id(image_handle, &burst_id);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error image_meta_get_burst_id : [%d]", ret);
-
- media_content_debug("This is Image");
- media_content_debug("Width : %d, Height : %d, Orientation : %d, Date taken : %s", width, height, orientation, datetaken);
- }
+ else
+ get_image_meta(image_handle);
- SAFE_FREE(datetaken);
- SAFE_FREE(burst_id);
ret = image_meta_destroy(image_handle);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("error image_meta_destroy : [%d]", ret);
} else if (media_type == MEDIA_CONTENT_TYPE_VIDEO) {
video_meta_h video_handle;
- char *title = NULL, *artist = NULL, *album = NULL, *album_artist = NULL;
- int duration = 0;
- time_t time_played = 0;
-
ret = media_info_get_video(media_handle, &video_handle);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("media_info_get_video failed: %d", ret);
- } else {
- ret = video_meta_get_artist(video_handle, &artist);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error video_meta_get_artist : [%d]", ret);
- ret = video_meta_get_album(video_handle, &album);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error video_meta_get_album : [%d]", ret);
- ret = video_meta_get_album_artist(video_handle, &album_artist);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error video_meta_get_album_artist : [%d]", ret);
- ret = video_meta_get_duration(video_handle, &duration);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error video_meta_get_duration : [%d]", ret);
- ret = video_meta_get_played_time(video_handle, &time_played);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error video_meta_get_played_time : [%d]", ret);
-
- media_content_debug("This is Video");
- media_content_debug("Title: %s, Album: %s, Artist: %s, Album_artist: %s \n Duration: %d, Played time: %d", title, album, artist, album_artist, duration, time_played);
- }
-
- SAFE_FREE(title);
- SAFE_FREE(artist);
- SAFE_FREE(album);
- SAFE_FREE(album_artist);
+ else
+ get_video_meta(video_handle);
ret = video_meta_destroy(video_handle);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("media_folder_foreach_media_from_db failed: %d", ret);
return -1;
} else {
- media_content_error("media_folder_foreach_media_from_db success!", ret);
+ media_content_error("media_folder_foreach_media_from_db success!");
char *media_id = NULL;
char *media_name = NULL;
char *media_path = NULL;
if (media_type == MEDIA_CONTENT_TYPE_IMAGE) {
image_meta_h image_handle;
- int width = 0, height = 0;
- media_content_orientation_e orientation = 0;
- char *datetaken = NULL;
ret = media_info_get_image(media_handle, &image_handle);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("media_info_get_image failed: %d", ret);
- } else {
- ret = image_meta_get_width(image_handle, &width);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error image_meta_get_width : [%d]", ret);
- ret = image_meta_get_height(image_handle, &height);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error image_meta_get_height : [%d]", ret);
- ret = image_meta_get_orientation(image_handle, &orientation);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error image_meta_get_orientation : [%d]", ret);
- ret = image_meta_get_date_taken(image_handle, &datetaken);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error image_meta_get_date_taken : [%d]", ret);
-
- media_content_debug("This is Image");
- media_content_debug("Width : %d, Height : %d, Orientation : %d, Date taken : %s", width, height, orientation, datetaken);
- }
+ else
+ get_image_meta(image_handle);
- SAFE_FREE(datetaken);
ret = image_meta_destroy(image_handle);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("error image_meta_destroy : [%d]", ret);
} else if (media_type == MEDIA_CONTENT_TYPE_VIDEO) {
video_meta_h video_handle;
- char *title = NULL, *artist = NULL, *album = NULL, *album_artist = NULL;;
- int duration = 0;
- time_t time_played;
ret = media_info_get_video(media_handle, &video_handle);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("media_info_get_video failed: %d", ret);
- } else {
- ret = video_meta_get_artist(video_handle, &artist);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error video_meta_get_artist : [%d]", ret);
- ret = video_meta_get_album(video_handle, &album);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error video_meta_get_album : [%d]", ret);
- ret = video_meta_get_album_artist(video_handle, &album_artist);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error video_meta_get_album_artist : [%d]", ret);
- ret = video_meta_get_duration(video_handle, &duration);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error video_meta_get_duration : [%d]", ret);
- ret = video_meta_get_played_time(video_handle, &time_played);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error video_meta_get_played_time : [%d]", ret);
-
- media_content_debug("This is Video");
- media_content_debug("Title: %s, Album: %s, Artist: %s, Album_artist: %s \n Duration: %d, Played time: %d\n", title, album, artist, album_artist, duration, time_played);
- }
-
- SAFE_FREE(title);
- SAFE_FREE(artist);
- SAFE_FREE(album);
- SAFE_FREE(album_artist);
+ else
+ get_video_meta(video_handle);
ret = video_meta_destroy(video_handle);
if (ret != MEDIA_CONTENT_ERROR_NONE)
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("error media_bookmark_get_thumbnail_path : [%d]", ret);
- media_content_debug("Bookmark time : %d\nBookmar thumb: %s", marked_time, thumb_path);
+ media_content_debug("Bookmark time : %ld\nBookmar thumb: %s", marked_time, thumb_path);
SAFE_FREE(thumb_path);
}
#if 0
/* Bookmark */
- char *thumbnail_path1 = tzplatform_mkpath(TZ_USER_CONTENT, "Images and videos/My video clips/teat11.jpg"));
+ char *thumbnail_path1 = tzplatform_mkpath(TZ_USER_VIDEOS, "teat11.jpg");
media_bookmark_insert_to_db(test_video_id, 100, thumbnail_path1);
media_bookmark_insert_to_db(test_video_id, 200, thumbnail_path1);
return ret;
}
-bool folder_update_cb(media_folder_h folder, void *user_data)
-{
- char *folder_id = NULL;
- char *folder_path = NULL;
- char *folder_name = NULL;
- int folder_order = -1;
- bool ret = true;
-
- if (folder != NULL) {
- ret = media_folder_get_folder_id(folder, &folder_id);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
- media_content_debug("folder_id = [%s]", folder_id);
- SAFE_FREE(folder_id);
-
- ret = media_folder_get_path(folder, &folder_path);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
- media_content_debug("folder_path = [%s]", folder_path);
- SAFE_FREE(folder_path);
-
- ret = media_folder_get_name(folder, &folder_name);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
- media_content_debug("folder_name = [%s]", folder_name);
- SAFE_FREE(folder_name);
-
- ret = media_folder_get_order(folder, &folder_order);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
- media_content_debug("folder_order = [%d]", folder_order);
-
- ret = media_folder_clone(&g_folder, folder);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = true;
- } else {
- ret = false;
- }
-
- return ret;
-}
-
-
-int test_folder_update(void)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- filter_h filter;
- int folder_count = 0;
-
- media_content_debug("\n============Folder Update Test============\n\n");
-
- ret = media_filter_create(&filter);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = media_filter_set_condition(filter, "MEDIA_TYPE=0 and MEDIA_STORAGE_TYPE=0", MEDIA_CONTENT_COLLATE_DEFAULT); /*MEDIA_TYPE 0-image, 1-video, 2-sound, 3-music, 4-other*/
- ret = media_filter_set_order(filter, MEDIA_CONTENT_ORDER_DESC, FOLDER_ORDER, MEDIA_CONTENT_COLLATE_NOCASE);
-
- ret = media_folder_get_folder_count_from_db(filter, &folder_count);
-
- media_content_debug("Folder count : %d", folder_count);
-
- ret = media_folder_foreach_folder_from_db(filter, folder_update_cb, NULL);
-
- media_filter_destroy(filter);
-
- ret = media_folder_set_name(g_folder, "test_folder");
-
- ret = media_folder_set_order(g_folder, 200);
-
- ret = media_folder_update_to_db(g_folder);
-
- ret = media_folder_destroy(g_folder);
-
- return ret;
-}
-
int test_playlist_operation(void)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
media_playlist_add_media(playlist_1, test_video_id);
#if 0
- char *playlist_thumb_path = tzplatform_mkpath(TZ_USER_CONTENT, "Images/Default.jpg"));
+ char *playlist_thumb_path = tzplatform_mkpath(TZ_USER_IMAGES, "Default.jpg"));
media_playlist_set_thumbnail_path(playlist_1, playlist_thumb_path);
#endif
media_content_debug("playlist_id_3 [%d]", playlist_id_3);
/* Export and import playlist */
- media_playlist_export_to_file(playlist_3, "/opt/usr/media/Music/playlist.m3u");
- media_playlist_import_from_file("/opt/usr/media/Music/playlist.m3u", "playlist_4", &playlist_4);
+ media_playlist_export_to_file(playlist_3, tzplatform_mkpath(TZ_USER_MUSIC, "playlist.m3u"));
+ media_playlist_import_from_file(tzplatform_mkpath(TZ_USER_MUSIC, "playlist.m3u"), "playlist_4", &playlist_4);
/* Filter for media*/
ret = media_filter_create(&m_filter);
return ret;
}
+int test_playlist_operation_v2(void)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ media_playlist_h playlist_1 = NULL;
+ const char *playlist_name_1 = "myPlaylist_1";
+ const char *playlist_thumb_path = tzplatform_mkpath(TZ_USER_IMAGES, "Default.jpg");
+ int playlist_id = 0;
+
+ media_content_debug("\n============Playlist Test V2============\n\n");
+
+ ret = media_playlist_create(&playlist_1);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_playlist_create : [%d]", ret);
+
+ ret = media_playlist_set_name(playlist_1, playlist_name_1);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_playlist_set_name : [%d]", ret);
+
+ ret = media_playlist_set_thumbnail_path(playlist_1, playlist_thumb_path);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_playlist_set_thumbnail_path : [%d]", ret);
+
+ ret = media_playlist_insert_to_db_v2(playlist_1);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_playlist_insert_to_db_v2 : [%d]", ret);
+
+ ret = media_playlist_set_name(playlist_1, "myPlaylist_3");
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_playlist_set_name : [%d]", ret);
+
+ ret = media_playlist_get_playlist_id(playlist_1, &playlist_id);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_playlist_get_playlist_id : [%d]", ret);
+
+ ret = media_playlist_update_to_db_v2(playlist_id, playlist_1);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_playlist_update_to_db_v2 : [%d]", ret);
+
+ ret = media_playlist_destroy(playlist_1);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_playlist_destroy : [%d]", ret);
+
+ return ret;
+}
+
int test_tag_operation(void)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
ret = media_tag_add_media(tag_2, test_video_id);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("error media_tag_add_media : [%d]", ret);
- ret = media_tag_set_name(tag_2, (char *)"test_tag");
+ ret = media_tag_set_name(tag_2, "test_tag");
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("error media_tag_set_name : [%d]", ret);
ret = media_tag_update_to_db(tag_2);
ret = media_tag_destroy(tag_2);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("error media_tag_destroy : [%d]", ret);
+ ret = media_tag_destroy(tag_3);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_tag_destroy : [%d]", ret);
ret = media_filter_destroy(filter);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("error media_filter_destroy : [%d]", ret);
return ret;
}
+int test_tag_operation_v2(void)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ media_tag_h tag_1;
+ const char *tag_name_1 = "myTag_1";
+ int tag_id = -1;
+
+ media_content_debug("\n============Tag Test V2============\n\n");
+
+ /* Create Tag */
+ ret = media_tag_create(&tag_1);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_tag_create : [%d]", ret);
+
+ ret = media_tag_set_name(tag_1, tag_name_1);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_tag_set_name : [%d]", ret);
+
+ /* Add media to Tag */
+ ret = media_tag_add_media(tag_1, test_audio_id);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_tag_add_media : [%d]", ret);
+
+ ret = media_tag_add_media(tag_1, test_video_id);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_tag_add_media : [%d]", ret);
+
+ ret = media_tag_insert_to_db_v2(tag_1);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_tag_insert_to_db_v2 : [%d]", ret);
+
+#if 1
+ ret = media_tag_get_tag_id(tag_1, &tag_id);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_tag_get_tag_id : [%d]", ret);
+
+ ret = media_tag_remove_media(tag_1, test_video_id);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_tag_add_media : [%d]", ret);
+
+ ret = media_tag_update_to_db_v2(tag_id, tag_1);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_tag_update_to_db_v2 : [%d]", ret);
+#endif
+
+ ret = media_tag_destroy(tag_1);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_tag_destroy : [%d]", ret);
+
+ return ret;
+}
int test_bookmark_operation(void)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
int bookmark_count = 0;
filter_h filter;
+ GList *all_item_list = NULL;
+ int idx = 0;
media_content_debug("\n============Bookmark Test============\n\n");
media_content_error("error media_filter_set_order : [%d]", ret);
/* insert bookmark to video */
- const char *thumbnail_path1 = tzplatform_mkpath(TZ_USER_CONTENT, "Images and videos/My video clips/teat11.jpg");
+ const char *thumbnail_path1 = tzplatform_mkpath(TZ_USER_VIDEOS, "teat11.jpg");
ret = media_bookmark_insert_to_db(test_video_id, 400, thumbnail_path1);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("error media_bookmark_insert_to_db : [%d]", ret);
else
media_content_debug("bookmark_count = [%d]", bookmark_count);
+ ret = media_info_foreach_bookmark_from_db(test_video_id, NULL, bookmarks_cb, &all_item_list);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_info_foreach_bookmark_from_db : [%d]", ret);
+
+ for (idx = 0; idx < g_list_length(all_item_list); idx++) {
+ media_bookmark_h bookmark_handle;
+ bookmark_handle = (media_bookmark_h)g_list_nth_data(all_item_list, idx);
+
+ ret = media_bookmark_set_name(bookmark_handle, "test 1");
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_bookmark_set_name : [%d]", ret);
+
+ ret = media_bookmark_update_to_db(bookmark_handle);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_bookmark_update_to_db : [%d]", ret);
+ }
+
+ ret = media_info_foreach_bookmark_from_db(test_video_id, NULL, bookmarks_cb, NULL);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_info_foreach_bookmark_from_db : [%d]", ret);
+
ret = media_filter_destroy(filter);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("error media_filter_destroy : [%d]", ret);
return ret;
}
-int test_album_list(void)
+int test_bookmark_operation_v2(void)
+{
+ media_content_debug("\n============Bookmark Test V2============\n\n");
+
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ media_bookmark_h bookmark = NULL;
+ const char *thumbnail_path1 = tzplatform_mkpath(TZ_USER_VIDEOS, "teat11.jpg");
+
+ ret = media_bookmark_create(test_video_id, 400, &bookmark);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_bookmark_create : [%d]", ret);
+
+ ret = media_bookmark_set_name(bookmark, "test bookmark");
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_bookmark_set_name : [%d]", ret);
+
+ ret = media_bookmark_set_thumbnail_path(bookmark, thumbnail_path1);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_bookmark_set_thumbnail_path : [%d]", ret);
+
+ ret = media_bookmark_insert_to_db_v2(bookmark);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_bookmark_insert_to_db_v2 : [%d]", ret);
+
+ ret = media_bookmark_set_name(bookmark, "test bookmark 2");
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_bookmark_set_name : [%d]", ret);
+
+ ret = media_bookmark_update_to_db(bookmark);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_bookmark_update_to_db : [%d]", ret);
+
+ ret = media_bookmark_destroy(bookmark);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_bookmark_destroy : [%d]", ret);
+
+ return ret;
+}
+
+int test_album_list(void)
{
media_content_debug("\n============Album Test============\n\n");
ret = media_group_get_group_count_from_db(g_filter, idx, &group_count);
if (ret != MEDIA_CONTENT_ERROR_NONE) {
test_filter_destroy();
- media_content_error("media_group_get_group_count_from_db fail. idx=[%d]", ret, idx);
+ media_content_error("media_group_get_group_count_from_db fail. ret=[%d] idx=[%d]", ret, idx);
return ret;
} else {
media_content_debug("[%2d]group_count [%d]", idx, group_count);
}
ret = media_group_foreach_group_from_db(g_filter, idx, group_list_cb, &idx);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("media_group_foreach_group_from_db failed: %d", ret);
}
ret = test_filter_destroy();
media_content_debug("media_info_get_video success");
/* update video meta */
- video_meta_set_played_count(video_handle, 5);
- video_meta_set_played_time(video_handle, 5);
- video_meta_set_played_position(video_handle, 5);
video_meta_update_to_db(video_handle);
ret = video_meta_update_to_db(video_handle);
} else {
media_content_debug("media_info_get_audio success");
- audio_meta_set_played_count(audio_handle, 5);
- audio_meta_set_played_time(audio_handle, 1000);
- audio_meta_set_played_position(audio_handle, 180);
-
ret = audio_meta_update_to_db(audio_handle);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("audio_meta_update_to_db failed: %d", ret);
int test_insert(void)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
- const char *path = "/opt/usr/media/Images/Default.jpg";
+ const char *path = tzplatform_mkpath(TZ_USER_IMAGES, "Default.jpg");
#if 0
- const char *path = "/opt/usr/media/Others/other.txt";
+ const char *path = tzplatform_mkpath(TZ_USER_DOCUMENTS, "other.txt"));
char *path = NULL;
#endif
media_info_h media_item = NULL;
{
int ret = MEDIA_CONTENT_ERROR_NONE;
const char *move_media_id = "60aea677-4742-408e-b5f7-f2628062d06d";
- const char *dst_path = tzplatform_mkpath(TZ_USER_CONTENT, "Images/XX/Default1.jpg");
+ const char *dst_path = tzplatform_mkpath(TZ_USER_IMAGES, "XX/Default1.jpg");
media_info_h move_media = NULL;
ret = media_info_get_media_from_db(move_media_id, &move_media);
media_content_error("media_info_get_media_id failed: %d", ret);
if (media_id != NULL) {
ret = media_info_foreach_face_from_db(media_id, NULL, face_cb, NULL);
+ SAFE_FREE(media_id);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("media_info_foreach_face_from_db failed: %d", ret);
}
ret = media_info_clone(&dst, media);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("media_info_clone failed: %d", ret);
- else {
- ret = media_info_start_face_detection(dst, face_detection_complete_cb, dst);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("media_info_start_face_detection failed: %d", ret);
- }
+
+ GList **list = (GList**)user_data;
+ *list = g_list_append(*list, dst);
/* fix prevent: Resource leak */
SAFE_FREE(media_id);
gboolean face_detection_start(gpointer data)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
+ GList *all_item_list = NULL;
+ int idx = 0;
- ret = media_info_foreach_media_from_db(g_filter, start_face_detection_cb, NULL);
+ ret = media_info_foreach_media_from_db(g_filter, start_face_detection_cb, &all_item_list);
if (ret == MEDIA_CONTENT_ERROR_NONE)
media_content_debug("media_info_foreach_media_from_db is success");
else
media_content_error("media_info_foreach_media_from_db is failed");
+ for (idx = 0; idx < g_list_length(all_item_list); idx++) {
+ media_info_h media_handle = NULL;
+
+ media_handle = (media_info_h)g_list_nth_data(all_item_list, idx);
+
+ ret = media_info_start_face_detection(media_handle, face_detection_complete_cb, NULL);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("media_info_start_face_detection failed: %d", ret);
+
+ }
+
return false;
}
else
media_content_debug("media_count : [%d]", g_media_cnt);
- if (g_media_cnt == 0) {
+ if (g_media_cnt == 0)
goto END;
- }
+
g_loop = g_main_loop_new(NULL, FALSE);
context = g_main_loop_get_context(g_loop);
source = g_idle_source_new();
{
int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_h media = NULL;
- char *content_name = NULL;
bool favorite = FALSE;
ret = media_info_get_media_from_db("71b19196-5b38-4ab1-ab34-bfe05c369614", &media);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("media_info_get_media_from_db failed: %d", ret);
- ret = media_info_set_content_name(media, "TEST_content_name");
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("media_info_set_content_name failed: %d", ret);
-
ret = media_info_set_favorite(media, TRUE);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("media_info_set_favorite failed: %d", ret);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("media_info_get_media_from_db failed: %d", ret);
- ret = media_info_get_content_name(media, &content_name);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("media_info_get_content_name failed: %d", ret);
- else
- media_content_debug("content name [%s]", content_name);
-
- SAFE_FREE(content_name);
-
ret = media_info_get_favorite(media, &favorite);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("media_info_get_favorite failed: %d", ret);
} else
media_content_debug("invalid media_type");
- if (mime_type != NULL)
- free(mime_type);
+ SAFE_FREE(mime_type);
return true;
int test_batch_operations()
{
int ret = -1;
- int i;
+ int i = 0;
char *file_list[10];
for (i = 0; i < 10; i++) {
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("media_info_insert_batch_to_db failed : %d\n", ret);
- filter_h filter;
- char *condition = "MEDIA_PATH LIKE \'";
- strncat(condition, tzplatform_mkpath(TZ_USER_CONTENT, "test/image%%jpg\'"), 17);
- ret = media_filter_create(&filter);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_content_error("Fail to create filter");
- return ret;
- }
-
- ret = media_filter_set_condition(filter, condition, MEDIA_CONTENT_COLLATE_DEFAULT);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_filter_destroy(filter);
- media_content_error("Fail to set condition");
- return ret;
- }
-
- ret = media_info_delete_batch_from_db(filter);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_filter_destroy(filter);
- media_content_error("media_info_delete_batch_from_db failed : %d\n", ret);
- return ret;
- }
-
- ret = media_filter_destroy(filter);
-
- return ret;
-}
-
-void insert_burst_shot_cb(media_content_error_e error, void * user_data)
-{
- media_content_debug("media_info_insert_burst_shot_to_db completed![%d]\n", error);
- g_main_loop_quit(g_loop);
-}
-
-gboolean test_insert_burst_shot_to_db_start(gpointer data)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- int i = 0;
- char *file_list[10];
-
- for (i = 0; i < 10; i++) {
- char filepath[255] = {0,};
- snprintf(filepath, sizeof(filepath), "%s%d.jpg", tzplatform_mkpath(TZ_USER_CONTENT, "test/image"), i+1);
- media_content_debug("File : %s\n", filepath);
- file_list[i] = strdup(filepath);
- }
-
- ret = media_info_insert_burst_shot_to_db((const char **)file_list, 10, insert_burst_shot_cb, NULL);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("media_info_insert_burst_shot_to_db failed : %d\n", ret);
-
return ret;
}
-int test_insert_burst_shot_to_db(void)
-{
- GSource *source = NULL;
- GMainContext *context = NULL;
-
- g_loop = g_main_loop_new(NULL, FALSE);
- context = g_main_loop_get_context(g_loop);
- source = g_idle_source_new();
- g_source_set_callback(source, test_insert_burst_shot_to_db_start, NULL, NULL);
- g_source_attach(source, context);
-
- g_main_loop_run(g_loop);
- g_main_loop_unref(g_loop);
-
- return 0;
-}
-
void _scan_cb(media_content_error_e err, void *user_data)
{
media_content_debug("scan callback is called : %d\n", err);
{
int ret = MEDIA_CONTENT_ERROR_NONE;
- const char *dir_path = "/opt/usr/media/Images";
+ const char *dir_path = tzplatform_getenv(TZ_USER_IMAGES);
ret = media_content_cancel_scan_folder(dir_path);
media_content_debug("media_info_insert_to_db success");
- /* media_info_delete_batch_from_db */
- filter_h filter;
- char condition[2048] = {0,};
- const char *temp = NULL;
- temp = tzplatform_mkpath(TZ_USER_CONTENT, "test/image%%\'");
- snprintf(condition, sizeof(condition), "MEDIA_PATH LIKE \'%s", temp);
-
- ret = media_filter_create(&filter);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_content_error("Fail to create filter");
- media_info_destroy(media_item);
- return ret;
- }
-
- ret = media_filter_set_condition(filter, condition, MEDIA_CONTENT_COLLATE_DEFAULT);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_filter_destroy(filter);
- media_info_destroy(media_item);
- media_content_error("Fail to set condition");
- return ret;
- }
- ret = media_info_delete_batch_from_db(filter);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_filter_destroy(filter);
- media_info_destroy(media_item);
- media_content_error("media_info_delete_batch_from_db failed : %d\n", ret);
- return ret;
- }
-
- media_filter_destroy(filter);
-
media_content_remove_db_updated_cb(noti_h);
/* media_info_update_to_db */
return ret;
}
-int test_create_handle(void)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_info_h media = NULL;
- const char *path = "/home/owner/content/test/test.txt";
- char *str_value = NULL;
- int int_value = -1;
- bool bool_value = FALSE;
- unsigned long long content_size = 0;
- time_t modified_time = 0;
- double double_value = 0.0;
-
- ret = media_info_create(path, &media);
-
- ret = media_info_set_title(media, "test_title");
- ret = media_info_set_album(media, "test_album");
- ret = media_info_set_artist(media, "test_artist");
- ret = media_info_set_genre(media, "test_genre");
- ret = media_info_set_recorded_date(media, "test_recorded_date");
- ret = media_info_set_age_rating(media, "test_age_rating");
- ret = media_info_set_author(media, "test_author");
- ret = media_info_set_category(media, "test_category");
- ret = media_info_set_content_name(media, "test_content_name");
- ret = media_info_set_description(media, "test_description");
- ret = media_info_set_display_name(media, "test_display_name");
- ret = media_info_set_keyword(media, "test_keyword");
- ret = media_info_set_location_tag(media, "test_location_tag");
- ret = media_info_set_weather(media, "test_weather");
- ret = media_info_set_provider(media, "test_provider");
-
- ret = media_info_set_altitude(media, 100.10);
- ret = media_info_set_latitude(media, 200.20);
- ret = media_info_set_longitude(media, 300.30);
- ret = media_info_set_rating(media, 10);
- ret = media_info_set_played_time(media);
- ret = media_info_set_favorite(media, TRUE);
- ret = media_info_increase_played_count(media);
- ret = media_info_set_added_time(media, 12345);
-
- ret = media_info_insert_to_db_with_data(media);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_content_error("media_info_insert_to_db_with_data failed : %d\n", ret);
- media_info_destroy(media);
- return ret;
- }
-
- ret = media_info_get_media_id(media, &str_value);
- media_content_debug("media_id = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_file_path(media, &str_value);
- media_content_debug("file_path = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_title(media, &str_value);
- media_content_debug("title = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_age_rating(media, &str_value);
- media_content_debug("age_rating = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_author(media, &str_value);
- media_content_debug("author = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_category(media, &str_value);
- media_content_debug("category = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_content_name(media, &str_value);
- media_content_debug("content_name = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_description(media, &str_value);
- media_content_debug("description = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_display_name(media, &str_value);
- media_content_debug("display_name = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_keyword(media, &str_value);
- media_content_debug("keyword = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_location_tag(media, &str_value);
- media_content_debug("location_tag = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_weather(media, &str_value);
- media_content_debug("weather = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_provider(media, &str_value);
- media_content_debug("provider = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_longitude(media, &double_value);
- media_content_debug("longitude = [%lf]", double_value);
-
- ret = media_info_get_latitude(media, &double_value);
- media_content_debug("latitude = [%lf]", double_value);
-
- ret = media_info_get_altitude(media, &double_value);
- media_content_debug("altitud = [%lf]", double_value);
-
- ret = media_info_get_rating(media, &int_value);
- media_content_debug("rating = [%d]", int_value);
-
- ret = media_info_get_favorite(media, &bool_value);
- media_content_debug("favorite = [%d]", bool_value);
-
- ret = media_info_get_played_time(media, &modified_time);
- media_content_debug("played_time = [%d]", modified_time);
-
- ret = media_info_get_played_count(media, &int_value);
- media_content_debug("played_count = [%d]", int_value);
-
- ret = media_info_get_added_time(media, &modified_time);
- media_content_debug("added_time = [%d]", modified_time);
-
- ret = media_info_get_size(media, &content_size);
- media_content_debug("size = [%d]", content_size);
-
- ret = media_info_get_modified_time(media, &modified_time);
- media_content_debug("modified_time = [%d]", modified_time);
-
- ret = media_info_get_media_type(media, (media_content_type_e *)&int_value);
- media_content_debug("media_type = [%d]", int_value);
-
- ret = media_info_get_storage_type(media, (media_content_storage_e *)&int_value);
- media_content_debug("storage_type = [%d]", int_value);
-
- media_info_destroy(media);
-
- return ret;
-
-}
-
bool media_face_test_cb(media_face_h face, void *user_data)
{
char *face_id = NULL;
media_content_retvm_if(ret != MEDIA_CONTENT_ERROR_NONE, ret, "fail media_face_create");
ret = media_face_set_face_rect(face, 10, 12, 50, 100);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("media_face_set_face_rect failed: %d", ret);
+
ret = media_face_set_orientation(face, 5);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("media_face_set_orientation failed: %d", ret);
+
ret = media_face_set_tag(face, face_tag);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("media_face_set_tag failed: %d", ret);
ret = media_face_insert_to_db(face);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("media_face_insert_to_db failed: %d", ret);
+
ret = media_face_destroy(face);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("media_face_destroy failed: %d", ret);
/* Update Test */
GList *all_item_list = NULL;
face_handle = (media_face_h)g_list_nth_data(all_item_list, 0);
ret = media_face_set_face_rect(face_handle, 20, 22, 70, 70);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("media_face_set_face_rect failed: %d", ret);
ret = media_face_set_orientation(face_handle, 3);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("media_face_set_orientation failed: %d", ret);
ret = media_face_set_tag(face_handle, NULL);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("media_face_set_tag failed: %d", ret);
ret = media_face_update_to_db(face_handle);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("media_face_update_to_db failed: %d", ret);
media_face_destroy(face_handle);
}
return ret;
}
+#ifdef _USE_TVPD_MODE
+filter_h g_tv_filter = NULL;
+
+int test_tv_filter_create(void)
+{
+ media_content_debug("\n============Filter Create============\n\n");
+
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+
+ ret = media_filter_create(&g_tv_filter);
+
+ ret = media_filter_set_storage(g_tv_filter, "0a22a163-e634-4a2e-ba14-0469a969eea0");
+
+ ret = media_filter_set_order(g_tv_filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_STORAGE_ID, MEDIA_CONTENT_COLLATE_DEFAULT);
+
+ return ret;
+}
+
+int test_tv_filter_destroy(void)
+{
+ media_content_debug("\n============Filter Destroy============\n\n");
+
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+
+ ret = media_filter_destroy(g_tv_filter);
+
+ return ret;
+}
+
+bool pvr_item_cb(media_pvr_h pvr, void *user_data)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ char *c_value = NULL;
+ int i_value = 0;
+ bool b_value = false;
+ unsigned long long l_value = 0;
+
+ if (pvr == NULL) {
+ media_content_debug("NO Item");
+ return true;
+ }
+
+ ret = media_pvr_get_media_id(pvr, &c_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_media_id");
+ media_content_debug("media_id [%s]", c_value);
+ SAFE_FREE(c_value);
+
+ ret = media_pvr_get_channel_name(pvr, &c_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_channel_name");
+ media_content_debug("channel_name [%s]", c_value);
+ SAFE_FREE(c_value);
+
+ ret = media_pvr_get_program_title(pvr, &c_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_program_title");
+ media_content_debug("program_title [%s]", c_value);
+ SAFE_FREE(c_value);
+
+ ret = media_pvr_get_program_crid(pvr, &c_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_program_crid");
+ media_content_debug("program_crid [%s]", c_value);
+ SAFE_FREE(c_value);
+
+ ret = media_pvr_get_guidance(pvr, &c_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_guidance");
+ media_content_debug("guidance [%s]", c_value);
+ SAFE_FREE(c_value);
+
+ ret = media_pvr_get_synopsis(pvr, &c_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_synopsis");
+ media_content_debug("synopsis [%s]", c_value);
+ SAFE_FREE(c_value);
+
+ ret = media_pvr_get_genre(pvr, &c_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_synopsis");
+ media_content_debug("genre [%s]", c_value);
+ SAFE_FREE(c_value);
+
+ ret = media_pvr_get_language(pvr, &c_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_language");
+ media_content_debug("language [%s]", c_value);
+ SAFE_FREE(c_value);
+
+ ret = media_pvr_get_path(pvr, &c_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_path");
+ media_content_debug("path [%s]", c_value);
+ SAFE_FREE(c_value);
+
+ ret = media_pvr_get_storage_id(pvr, &c_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_storage_id");
+ media_content_debug("storage_id [%s]", c_value);
+ SAFE_FREE(c_value);
+
+ ret = media_pvr_get_size(pvr, &l_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_size");
+ media_content_debug("size [%lld]", l_value);
+
+ ret = media_pvr_get_timezone(pvr, &i_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_timezone");
+ media_content_debug("timezone [%d]", i_value);
+
+ ret = media_pvr_get_ptc(pvr, &i_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_ptc");
+ media_content_debug("ptc [%d]", i_value);
+
+ ret = media_pvr_get_major(pvr, &i_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_major");
+ media_content_debug("[%d]", i_value);
+
+ ret = media_pvr_get_minor(pvr, &i_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_minor");
+ media_content_debug("minor [%d]", i_value);
+
+ ret = media_pvr_get_channel_type(pvr, &i_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_channel_type");
+ media_content_debug("channel_type [%d]", i_value);
+
+ ret = media_pvr_get_program_num(pvr, &i_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_program_num");
+ media_content_debug("program_num [%d]", i_value);
+
+ unsigned int ui_value = 0;
+ ret = media_pvr_get_service_profile(pvr, &ui_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_service_profile");
+ media_content_debug("service_profile [%u]", ui_value);
+
+ ret = media_pvr_get_duration(pvr, &i_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_duration");
+ media_content_debug("duration [%d]", i_value);
+
+ ret = media_pvr_get_embargo_time(pvr, &i_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_embargo_time");
+ media_content_debug("embargo_time [%d]", i_value);
+
+ ret = media_pvr_get_expiry_time(pvr, &i_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_expiry_time");
+ media_content_debug("expiry_time [%d]", i_value);
+
+ ret = media_pvr_get_parental_rating(pvr, &i_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_parental_rating");
+ media_content_debug("parental_rating [%d]", i_value);
+
+ ret = media_pvr_get_start_time(pvr, &i_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_start_time");
+ media_content_debug("start_time [%d]", i_value);
+
+ ret = media_pvr_get_program_start_time(pvr, &i_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_program_start_time");
+ media_content_debug("program_start_time [%d]", i_value);
+
+ ret = media_pvr_get_program_end_time(pvr, &i_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_program_end_time");
+ media_content_debug("program_end_time [%d]", i_value);
+
+ ret = media_pvr_get_program_date(pvr, &i_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_program_date");
+ media_content_debug("program_date [%d]", i_value);
+
+ ret = media_pvr_get_timer_record(pvr, &b_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_timer_record");
+ media_content_debug("timer_record [%d]", b_value);
+
+ ret = media_pvr_get_series_record(pvr, &b_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_series_record");
+ media_content_debug("series_record [%d]", b_value);
+
+ ret = media_pvr_get_hd(pvr, &i_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_hd");
+ media_content_debug("hd [%d]", i_value);
+
+ ret = media_pvr_get_subtitle(pvr, &b_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_subtitle");
+ media_content_debug("subtitle [%d]", b_value);
+
+ ret = media_pvr_get_ttx(pvr, &b_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_ttx");
+ media_content_debug("ttx [%d]", b_value);
+
+ ret = media_pvr_get_ad(pvr, &b_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_ad");
+ media_content_debug("ad [%d]", b_value);
+
+ ret = media_pvr_get_hard_of_hearing_radio(pvr, &b_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_hard_of_hearing_radio");
+ media_content_debug("hard_of_hearing_radio [%d]", b_value);
+
+ ret = media_pvr_get_data_service(pvr, &b_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_data_service");
+ media_content_debug("data_service [%d]", b_value);
+
+ ret = media_pvr_get_content_lock(pvr, &b_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_content_lock");
+ media_content_debug("content_lock [%d]", b_value);
+
+ ret = media_pvr_get_content_watch(pvr, &b_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_content_watch");
+ media_content_debug("content_watch [%d]", b_value);
+
+ ret = media_pvr_get_has_audio_only(pvr, &b_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_has_audio_only");
+ media_content_debug("has_audio_only [%d]", b_value);
+
+ ret = media_pvr_get_is_local_record(pvr, &b_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_is_local_record");
+ media_content_debug("is_local_record [%d]", b_value);
+
+ ret = media_pvr_get_resolution(pvr, (media_pvr_resolution_e*)&i_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_resolution");
+ media_content_debug("resolution [%d]", i_value);
+
+ ret = media_pvr_get_aspectratio(pvr, (media_pvr_aspectratio_e*)&i_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_aspectratio");
+ media_content_debug("aspectratio [%d]", i_value);
+
+ ret = media_pvr_get_highlight(pvr, &b_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_highlight");
+ media_content_debug("highlight [%d]", b_value);
+
+
+ return TRUE;
+}
+
+int test_pvr()
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ int media_count = 0;
+
+ media_content_debug("\n============PVR Test============\n\n");
+
+ test_tv_filter_create();
+
+ ret = media_pvr_get_media_count_from_db(g_tv_filter, &media_count);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("media_pvr_get_media_count_from_db failed: %d", ret);
+ else
+ media_content_debug("media_count : [%d]", media_count);
+
+ ret = media_pvr_foreach_media_from_db(g_tv_filter, pvr_item_cb, NULL);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("media_pvr_foreach_media_from_db is failed");
+
+ test_tv_filter_destroy();
+
+ return ret;
+}
+
+int test_pvr_update_db(void)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ media_pvr_h pvr = NULL;
+
+ ret = media_pvr_get_pvr_from_db("ff9b5a9a-a7b4-47f4-8255-84e007e25f13", &pvr);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("media_pvr_get_pvr_from_db failed: %d", ret);
+
+ ret = media_pvr_set_content_lock(pvr, TRUE);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_set_content_lock");
+
+ ret = media_pvr_set_content_watch(pvr, TRUE);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_set_content_watch");
+
+ ret = media_pvr_set_program_title(pvr, "TEST TITLE");
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_set_program_title");
+
+ ret = media_pvr_set_highlight(pvr, TRUE);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_set_highlight");
+
+ ret = media_pvr_update_to_db(pvr);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_update_to_db");
+
+ if (pvr != NULL)
+ media_pvr_destroy(pvr);
+
+ return ret;
+}
+#endif
+
int main(int argc, char *argv[])
{
int ret = MEDIA_CONTENT_ERROR_NONE;
ret = test_connect_database();
if (ret != MEDIA_CONTENT_ERROR_NONE)
return MEDIA_CONTENT_ERROR_NONE;
+#ifdef _USE_TVPD_MODE
+ test_pvr();
+
+ test_pvr_update_db();
+
+ test_pvr();
+#endif
+
#if 0
ret = test_start_face_detection(FALSE);
if (ret != MEDIA_CONTENT_ERROR_NONE)
if (ret != MEDIA_CONTENT_ERROR_NONE)
return ret;
- ret = test_folder_update();
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- return ret;
-
ret = test_playlist_operation();
if (ret != MEDIA_CONTENT_ERROR_NONE)
return ret;
if (ret != MEDIA_CONTENT_ERROR_NONE)
return MEDIA_CONTENT_ERROR_NONE;
- ret = test_insert_burst_shot_to_db();
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- return MEDIA_CONTENT_ERROR_NONE;
-
ret = test_scan_file();
if (ret != MEDIA_CONTENT_ERROR_NONE)
return MEDIA_CONTENT_ERROR_NONE;
if (ret != MEDIA_CONTENT_ERROR_NONE)
return MEDIA_CONTENT_ERROR_NONE;
- ret = test_create_handle();
+ ret = test_face();
if (ret != MEDIA_CONTENT_ERROR_NONE)
return MEDIA_CONTENT_ERROR_NONE;
- ret = test_face();
+ ret = test_face_add_del();
if (ret != MEDIA_CONTENT_ERROR_NONE)
return MEDIA_CONTENT_ERROR_NONE;
- ret = test_face_add_del();
+ ret = test_playlist_operation_v2();
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ return MEDIA_CONTENT_ERROR_NONE;
+
+ ret = test_bookmark_operation_v2();
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ return MEDIA_CONTENT_ERROR_NONE;
+
+ ret = test_tag_operation_v2();
if (ret != MEDIA_CONTENT_ERROR_NONE)
return MEDIA_CONTENT_ERROR_NONE;
#endif