#include <tzplatform_config.h>
filter_h g_filter = NULL;
-filter_h g_filter_g = NULL; //filter for group like folder, tag, playlist, album, year ...
+filter_h g_filter_g = NULL; /*filter for group like folder, tag, playlist, album, year ... */
GMainLoop *g_loop = NULL;
static int g_cnt = 0;
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);
+ 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");
SAFE_FREE(c_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);
+ /*ret = media_info_set_location_tag(media, "Test location tag");*/
+ /*media_info_update_to_db(media);*/
SAFE_FREE(media_id);
#endif
SAFE_FREE(media_id);
*list = g_list_append(*list, (gpointer)playlist_member_id);
#endif
- //media_item_cb(media, user_data);
+ /*media_item_cb(media, user_data);*/
return true;
}
/* Filter for media */
const char *condition = "MEDIA_TYPE=3"; /*MEDIA_TYPE 0-image, 1-video, 2-sound, 3-music, 4-other*/
- //const char *condition = "MEDIA_TYPE IS NOT 0 AND MEDIA_DESCRIPTION IS NOT NULL"; /*MEDIA_TYPE 0-image, 1-video, 2-sound, 3-music, 4-other*/
+ /*const char *condition = "MEDIA_TYPE IS NOT 0 AND MEDIA_DESCRIPTION IS NOT NULL"; */ /*MEDIA_TYPE 0-image, 1-video, 2-sound, 3-music, 4-other*/
ret = media_filter_create(&g_filter);
* call media_filter_set_order(g_filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_ARTIST, MEDIA_CONTENT_COLLATE_DEFAULT);
*/
/* Able to set multi column to set order */
- //ret = media_filter_set_order(g_filter, MEDIA_CONTENT_ORDER_ASC, "MEDIA_MODIFIED_TIME, MEDIA_DISPLAY_NAME", MEDIA_CONTENT_COLLATE_DEFAULT);
- //ret = media_filter_set_order(g_filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_ARTIST, MEDIA_CONTENT_COLLATE_DEFAULT);
- //ret = media_filter_set_order(g_filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_TRACK_NUM_INT, MEDIA_CONTENT_COLLATE_DEFAULT);
- //ret = media_filter_set_storage(g_filter, "cfbf3d2c-71c5-4611-bccc-7cbac890146e");
+#if 0
+ ret = media_filter_set_order(g_filter, MEDIA_CONTENT_ORDER_ASC, "MEDIA_MODIFIED_TIME, MEDIA_DISPLAY_NAME", MEDIA_CONTENT_COLLATE_DEFAULT);
+ ret = media_filter_set_order(g_filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_ARTIST, MEDIA_CONTENT_COLLATE_DEFAULT);
+ ret = media_filter_set_order(g_filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_TRACK_NUM_INT, MEDIA_CONTENT_COLLATE_DEFAULT);
+ ret = media_filter_set_storage(g_filter, "cfbf3d2c-71c5-4611-bccc-7cbac890146e");
/* Filter for group */
- //const char *g_condition = "TAG_NAME like \"\%my\%\"";
- //const char *g_condition = "BOOKMARK_MARKED_TIME > 300";
-
+ const char *g_condition = "TAG_NAME like \"\%my\%\"";
+ const char *g_condition = "BOOKMARK_MARKED_TIME > 300";
+#endif
ret = media_filter_create(&g_filter_g);
- //ret = media_filter_set_condition(g_filter_g, g_condition, MEDIA_CONTENT_COLLATE_DEFAULT);
ret = media_filter_set_order(g_filter_g, MEDIA_CONTENT_ORDER_DESC, TAG_NAME, MEDIA_CONTENT_COLLATE_DEFAULT);
return ret;
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("error video_meta_destroy : [%d]", ret);
}
- //media_content_debug("media_id [%d] : %s", i, media_id);
- //media_content_debug("media_name [%d] : %s", i, media_name);
- //media_content_debug("media_path [%d] : %s", i, media_path);
SAFE_FREE(media_id);
SAFE_FREE(media_name);
ret = media_folder_foreach_folder_from_db(filter, folder_list_cb, &folder);
- //test.3 get the media list in first folder
filter_h m_filter = NULL;
ret = media_filter_create(&m_filter);
media_playlist_foreach_playlist_from_db(filter, playlist_list_cb, NULL);
/* deletes the playlist */
- //media_playlist_delete_from_db(playlist_id_1);
- //media_playlist_delete_from_db(playlist_id_2);
+#if 0
+ media_playlist_delete_from_db(playlist_id_1);
+ media_playlist_delete_from_db(playlist_id_2);
+#endif
if (playlist_1 != NULL)
media_playlist_destroy(playlist_1);
int test_bookmark_operation(void)
{
- //bookmark is only supported for video information.
+ /* bookmark is only supported for video information. */
int ret = MEDIA_CONTENT_ERROR_NONE;
int bookmark_count = 0;
filter_h filter;
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("error media_filter_set_order : [%d]", ret);
- //insert bookmark to video
+ /* insert bookmark to video */
const char *thumbnail_path1 = tzplatform_mkpath(TZ_USER_CONTENT, "Images and videos/My video clips/teat11.jpg");
ret = media_bookmark_insert_to_db(test_video_id, 400, thumbnail_path1);
if (ret != MEDIA_CONTENT_ERROR_NONE)
} else {
media_content_debug("media_info_get_image success");
- //update image meta
+ /* update image meta */
orientation = MEDIA_CONTENT_ORIENTATION_ROT_180;
image_meta_set_orientation(image_handle, orientation);
ret = image_meta_update_to_db(image_handle);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("image_meta_update_to_db failed: %d", ret);
- } else {
+ else
media_content_debug("image_meta_update_to_db success");
- }
}
} else if (media_type == MEDIA_CONTENT_TYPE_VIDEO) {
} else {
media_content_debug("media_info_get_video success");
- //update video meta
+ /* 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);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("video_meta_update_to_db failed: %d", ret);
- } else {
+ else
media_content_debug("video_meta_update_to_db success");
- }
}
- } else if (media_type == MEDIA_CONTENT_TYPE_MUSIC) {//update audio meta
+ } else if (media_type == MEDIA_CONTENT_TYPE_MUSIC) {
audio_meta_h audio_handle = NULL;
ret = media_info_get_audio(media_handle, &audio_handle);
if (ret != MEDIA_CONTENT_ERROR_NONE) {
audio_meta_set_played_position(audio_handle, 180);
ret = audio_meta_update_to_db(audio_handle);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("audio_meta_update_to_db failed: %d", ret);
- } else {
+ else
media_content_debug("audio_meta_update_to_db success");
- }
}
}
{
int ret = MEDIA_CONTENT_ERROR_NONE;
const char *path = "/opt/usr/media/Images/Default.jpg";
- //const char *path = "/opt/usr/media/Others/other.txt";
- //char *path = NULL;
+#if 0
+ const char *path = "/opt/usr/media/Others/other.txt";
+ char *path = NULL;
+#endif
media_info_h media_item = NULL;
media_content_debug("\n============DB Insert Test============\n\n");
return ret;
}
+bool face_cb(media_face_h face, void *user_data)
+{
+ if (user_data != NULL) {
+ unsigned x, y, rect_w, rect_h;
+ media_face_get_face_rect(face, &x, &y, &rect_w, &rect_h);
+ media_content_debug("face(%p) x = %d, y = %d [%d, %d]", face, x, y, rect_w, rect_h);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+void face_detection_complete_cb(media_content_error_e error, int count, void *user_data)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ g_cnt++;
+
+ media_content_debug("=================[%d][%d]", g_media_cnt, g_cnt);
+ media_content_debug("error_code [%d]", error);
+ media_content_debug("face_count [%d]", count);
+ if (count == 0) {
+ media_content_debug("No faces are detected!");
+ } else if (user_data != NULL) {
+ media_info_h media = (media_info_h)user_data;
+ char *media_id = NULL;
+ ret = media_info_get_media_id(media, &media_id);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ 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);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("media_info_foreach_face_from_db failed: %d", ret);
+ }
+ ret = media_info_destroy(media);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("media_info_destroy failed: %d", ret);
+ }
+
+ if (g_cnt == g_media_cnt)
+ g_main_loop_quit(g_loop);
+
+ return;
+}
+
+bool start_face_detection_cb(media_info_h media, void *user_data)
+{
+ char *media_id = NULL;
+ media_info_h dst = NULL;
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+
+ if (media == NULL) {
+ media_content_debug("NO Item");
+ return true;
+ }
+
+ ret = media_info_get_media_id(media, &media_id);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("media_info_get_media_id failed: %d", ret);
+ else
+ media_content_debug("media_id : [%s]", media_id);
+
+ 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);
+ }
+
+ /* fix prevent: Resource leak */
+ SAFE_FREE(media_id);
+
+ return true;
+}
+
+bool cancel_face_detection_cb(media_info_h media, void *user_data)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+
+ char *media_id = NULL;
+ media_info_h dst = NULL;
+
+ g_cnt++;
+
+ if (media == NULL) {
+ media_content_debug("NO Item");
+ return true;
+ }
+
+ ret = media_info_get_media_id(media, &media_id);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("media_info_get_media_id failed: %d", ret);
+ else
+ media_content_debug("media_id : [%s]", media_id);
+
+ ret = media_info_clone(&dst, media);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("media_info_clone failed: %d", ret);
+
+ ret = media_info_cancel_face_detection(dst);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("media_info_cancel_face_detection failed: %d", ret);
+
+ ret = media_info_destroy(dst);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("media_info_destroy failed: %d", ret);
+
+ if (g_cnt == g_media_cnt)
+ g_main_loop_quit(g_loop);
+
+ /* fix prevent: Resource leak */
+ SAFE_FREE(media_id);
+
+ return true;
+}
+
+gboolean face_detection_start(gpointer data)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+
+ ret = media_info_foreach_media_from_db(g_filter, start_face_detection_cb, NULL);
+
+ 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");
+
+ return false;
+}
+
+gboolean face_detection_cancel(gpointer data)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+
+ ret = media_info_foreach_media_from_db(g_filter, cancel_face_detection_cb, NULL);
+
+ 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");
+
+ return false;
+}
+
+int test_start_face_detection(int cancel)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ GSource *source = NULL;
+ GMainContext *context = NULL;
+
+ test_filter_create();
+
+ ret = media_info_get_media_count_from_db(g_filter, &g_media_cnt);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("media_info_get_media_count_from_db failed: %d", ret);
+ else
+ media_content_debug("media_count : [%d]", g_media_cnt);
+
+ 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();
+ g_source_set_callback(source, face_detection_start, NULL, NULL);
+ g_source_attach(source, context);
+
+ /* Logic to cancel */
+ if (cancel) {
+ GSource *cancel_src = NULL;
+ cancel_src = g_idle_source_new();
+ g_source_set_callback(cancel_src, face_detection_cancel, NULL, NULL);
+ g_source_attach(cancel_src, context);
+ }
+
+ g_main_loop_run(g_loop);
+ g_main_loop_unref(g_loop);
+
+END:
+ test_filter_destroy();
+
+ return ret;
+}
+
int test_disconnect_database(void)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
char *content_name = NULL;
bool favorite = FALSE;
- //get the content of Over the horizon
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_insert_batch_to_db((const char **)file_list, 10, insert_batch_cb, NULL);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ 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 \'";
}
ret = media_info_insert_burst_shot_to_db((const char **)file_list, 10, insert_burst_shot_cb, NULL);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("media_info_insert_burst_shot_to_db failed : %d\n", ret);
- }
return ret;
}
char *mime_type,
void *user_data)
{
- if (error == 0) {
+ if (error == 0)
media_content_debug("noti success! : %d\n", error);
- } else {
+ else
media_content_debug("error occured! : %d\n", error);
- }
media_content_debug("Noti from PID(%d)\n", pid);
- if (update_item == MEDIA_ITEM_FILE) {
+ if (update_item == MEDIA_ITEM_FILE)
media_content_debug("Noti item : MEDIA_ITEM_FILE\n");
- } else if (update_item == MEDIA_ITEM_DIRECTORY) {
+ else if (update_item == MEDIA_ITEM_DIRECTORY)
media_content_debug("Noti item : MEDIA_ITEM_DIRECTORY\n");
- }
- if (update_type == MEDIA_CONTENT_INSERT) {
+ if (update_type == MEDIA_CONTENT_INSERT)
media_content_debug("Noti type : MEDIA_CONTENT_INSERT\n");
- } else if (update_type == MEDIA_CONTENT_DELETE) {
+ else if (update_type == MEDIA_CONTENT_DELETE)
media_content_debug("Noti type : MEDIA_CONTENT_DELETE\n");
- } else if (update_type == MEDIA_CONTENT_UPDATE) {
+ else if (update_type == MEDIA_CONTENT_UPDATE)
media_content_debug("Noti type : MEDIA_CONTENT_UPDATE\n");
- }
media_content_debug("content type : %d\n", media_type);
if (user_data) media_content_debug("String : %s\n", (char *)user_data);
-// g_main_loop_quit(g_loop);
return;
}
char *mime_type,
void *user_data)
{
- if (error == 0) {
+ if (error == 0)
media_content_debug("noti_2 success! : %d\n", error);
- } else {
+ else
media_content_debug("error occured! : %d\n", error);
- }
media_content_debug("Noti_2 from PID(%d)\n", pid);
/* media_info_delete_batch_from_db */
filter_h filter;
char condition[2048] = {0,};
- const char *temp= NULL;
+ const char *temp = NULL;
temp = tzplatform_mkpath(TZ_USER_CONTENT, "test/image%%\'");
snprintf(condition, sizeof(condition), "MEDIA_PATH LIKE \'%s", temp);
-// strncat(condition, temp, strlen(temp));
ret = media_filter_create(&filter);
if (ret != MEDIA_CONTENT_ERROR_NONE) {
return ret;
}
+#ifdef _USE_TV_PROFILE
+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 [%ld]", 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);
+
+ 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_TV_PROFILE
+ test_pvr();
+
+ test_pvr_update_db();
+
+ test_pvr();
+#endif
#if 0
+ ret = test_start_face_detection(FALSE);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ return ret;
+
ret = test_move();
if (ret != MEDIA_CONTENT_ERROR_NONE)
return ret;
if (ret != MEDIA_CONTENT_ERROR_NONE)
return ret;
+ ret = test_extrace_face(TRUE);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ return ret;
+
ret = test_request_update_db();
if (ret != MEDIA_CONTENT_ERROR_NONE)
return ret;