*/
void utc_media_player_callback_startup(void)
{
- char pszValue[CONFIG_VALUE_LEN_MAX] = {0,};
- if ( true == GetValueForTCTSetting("DEVICE_SUITE_TARGET_30", pszValue, API_NAMESPACE ))
- {
+ char pszValue[CONFIG_VALUE_LEN_MAX] = {0,};
+ unsigned int size_of_path = 0;
+ int ret = PLAYER_ERROR_NONE;
+
+ if (true == GetValueForTCTSetting("DEVICE_SUITE_TARGET_30", pszValue, API_NAMESPACE)) {
PRINT_UTC_LOG("[Line : %d][%s] 'DEVICE_SUITE_TARGET_30' Values Received = %s\\n", __LINE__, API_NAMESPACE, pszValue);
- unsigned int size_of_path = strlen(pszValue) + strlen(media) + 6;
+
+ size_of_path = strlen(pszValue) + strlen(media) + 6;
media_path = (char*)malloc(size_of_path);
- snprintf(media_path, size_of_path, "%s/res/%s", pszValue, media);
+ if (media_path)
+ snprintf(media_path, size_of_path, "%s/res/%s", pszValue, media);
size_of_path = strlen(pszValue) + strlen(subtitle) + 6;
subtitle_path = (char*)malloc(size_of_path);
- snprintf(subtitle_path, size_of_path, "%s/res/%s", pszValue, subtitle);
- }
- else
- {
+ if (subtitle_path)
+ snprintf(subtitle_path, size_of_path, "%s/res/%s", pszValue, subtitle);
+
+ if (!media_path || !subtitle_path) {
+ PRINT_UTC_LOG("[Line : %d][%s] failed to alloc mem for test content path.\\n", __LINE__, API_NAMESPACE);
+ goto ERROR;
+ }
+ } else {
PRINT_UTC_LOG("[Line : %d][%s] GetValueForTCTSetting returned error for 'DEVICE_SUITE_TARGET_30'\\n", __LINE__, API_NAMESPACE);
+ goto ERROR;
}
- _is_broken = false;
- _is_pass = false;
+ _is_broken = false;
+ _is_pass = false;
- int ret = player_create(&player);
- if (PLAYER_ERROR_NONE != ret) {
- _is_broken = true;
- }
+ ret = player_create(&player);
+ if (PLAYER_ERROR_NONE != ret)
+ goto ERROR;
- ret = player_set_uri(player, media_path);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player didn't set uri\\n", __LINE__, API_NAMESPACE);
- _is_broken = true;
- }
+ ret = player_set_uri(player, media_path);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player didn't set uri\\n", __LINE__, API_NAMESPACE);
+ goto ERROR;
+ }
+
+ return;
+
+ERROR:
+ _is_broken = true;
+
+ if(media_path) free(media_path);
+ if(subtitle_path) free(subtitle_path);
+ media_path = subtitle_path = NULL;
+
+ return;
}
/**
*/
void utc_media_player_callback_cleanup(void)
{
- player_state_e state;
- int ret;
-
- if(player){
- ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
- player_destroy(player);
- player = NULL;
- }
- if(media_path)
- free(media_path);
- if(subtitle_path)
- free(subtitle_path);
+ player_state_e state = PLAYER_STATE_NONE;
+ int ret = PLAYER_ERROR_NONE;
+
+ if (player) {
+ ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret)
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+
+ if (state > PLAYER_STATE_IDLE)
+ player_unprepare(player);
+
+ player_destroy(player);
+ player = NULL;
+ }
+
+ if(media_path)
+ free(media_path);
+ if(subtitle_path)
+ free(subtitle_path);
+
+ media_path = subtitle_path = NULL;
}
static void player_complete_cb(void *data)
assert_eq(ret, PLAYER_ERROR_NONE);
ret = player_set_uri(player, INVALID_PATH);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_uri is failed\\n", __LINE__, API_NAMESPACE);
- }
- player_prepare_async(player, player_complete_cb, NULL);
+ assert_eq(ret, PLAYER_ERROR_NONE);
- for(repeat=0; repeat<5; repeat++) {
+ ret = player_prepare_async(player, player_complete_cb, NULL);
+ assert_eq(ret, PLAYER_ERROR_NONE);
+
+ for (repeat = 0; repeat < 5; repeat++) {
wait_for_async();
- if(_is_pass)
+ if (_is_pass)
break;
}
assert(_is_pass);
*/
void utc_media_player_display_startup(void)
{
- elm_init(0, NULL);
- char pszValue[CONFIG_VALUE_LEN_MAX] = {0,};
- if ( true == GetValueForTCTSetting("DEVICE_SUITE_TARGET_30", pszValue, API_NAMESPACE ))
- {
- PRINT_UTC_LOG("[Line : %d][%s] 'DEVICE_SUITE_TARGET_30' Values Received = %s\\n", __LINE__, API_NAMESPACE, pszValue);
- unsigned int size_of_path = strlen(pszValue) + strlen(media) + 6;
- media_path = (char*)malloc(size_of_path);
- snprintf(media_path, size_of_path, "%s/res/%s", pszValue, media);
- }
- else
- {
- PRINT_UTC_LOG("[Line : %d][%s] GetValueForTCTSetting returned error for 'DEVICE_SUITE_TARGET_30'\\n", __LINE__, API_NAMESPACE);
- }
-
- _is_broken = false;
- _is_pass = false;
-
- int ret = player_create(&player);
- if (PLAYER_ERROR_NONE != ret) {
- _is_broken = true;
- return;
- }
-
- ret = player_set_uri(player, media_path);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player didn't set uri\\n", __LINE__, API_NAMESPACE);
- _is_broken = true;
- }
+ char pszValue[CONFIG_VALUE_LEN_MAX] = {0,};
+ unsigned int size_of_path = 0;
+ int ret = PLAYER_ERROR_NONE;
+
+ elm_init(0, NULL);
+
+ if (true == GetValueForTCTSetting("DEVICE_SUITE_TARGET_30", pszValue, API_NAMESPACE)) {
+ PRINT_UTC_LOG("[Line : %d][%s] 'DEVICE_SUITE_TARGET_30' Values Received = %s\\n", __LINE__, API_NAMESPACE, pszValue);
+ size_of_path = strlen(pszValue) + strlen(media) + 6;
+ media_path = (char*)malloc(size_of_path);
+ if (media_path) {
+ snprintf(media_path, size_of_path, "%s/res/%s", pszValue, media);
+ } else {
+ PRINT_UTC_LOG("[Line : %d][%s] failed to alloc mem for test content path.\\n", __LINE__, API_NAMESPACE);
+ goto ERROR;
+ }
+ } else {
+ PRINT_UTC_LOG("[Line : %d][%s] GetValueForTCTSetting returned error for 'DEVICE_SUITE_TARGET_30'\\n", __LINE__, API_NAMESPACE);
+ goto ERROR;
+ }
+
+ _is_broken = false;
+ _is_pass = false;
+
+ ret = player_create(&player);
+ if (PLAYER_ERROR_NONE != ret)
+ goto ERROR;
+
+ ret = player_set_uri(player, media_path);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player didn't set uri\\n", __LINE__, API_NAMESPACE);
+ goto ERROR;
+ }
+
+ return;
+
+ERROR:
+ _is_broken = true;
+
+ if(media_path)
+ free(media_path);
+ media_path = NULL;
+
+ return;
}
/**
*/
void utc_media_player_display_cleanup(void)
{
- elm_shutdown();
- player_state_e state;
+ player_state_e state = PLAYER_STATE_NONE;
+ int ret = PLAYER_ERROR_NONE;
- player_get_state (player, &state);
- if (state == PLAYER_STATE_READY)
- player_unprepare(player);
+ elm_shutdown();
- if(player){
- player_destroy(player);
- player = NULL;
- }
- if(media_path)
- free(media_path);
+ ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret)
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+
+ if (state > PLAYER_STATE_IDLE)
+ player_unprepare(player);
- destroy_window();
+ if (player) {
+ player_destroy(player);
+ player = NULL;
+ }
+
+ if (media_path)
+ free(media_path);
+ media_path = NULL;
+
+ destroy_window();
}
static void player_video_capture_cb(unsigned char *data, int width, int height, unsigned int size, void *user_data)
*/
int utc_media_player_get_video_size_p(void)
{
- assert(!_is_broken);
- player_state_e state;
- int width, height;
- create_window();
+ player_state_e state = PLAYER_STATE_NONE;
+ player_state_e cur_state = PLAYER_STATE_NONE;
+ int ret = PLAYER_ERROR_NONE;
+ int width = 0, height = 0;
- player_get_state (player, &state);
- if (state == PLAYER_STATE_READY)
- player_unprepare(player);
+ assert(!_is_broken);
+ create_window();
- int ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
- assert_eq(ret, PLAYER_ERROR_NONE);
+ ret = player_get_state(player, &state);
+ if (PLAYER_ERROR_NONE != ret)
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- ret = player_prepare(player);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player isn't prepared\\n", __LINE__, API_NAMESPACE);
- }
+ if (state > PLAYER_STATE_IDLE)
+ player_unprepare(player);
- int ret1 = player_start(player);
- assert_eq(ret1, PLAYER_ERROR_NONE);
- player_state_e cur_state;
- int ret2 = player_get_state(player, &cur_state);
- assert_eq(ret2, PLAYER_ERROR_NONE);
- assert_eq(cur_state, PLAYER_STATE_PLAYING);
+ ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
+ assert_eq(ret, PLAYER_ERROR_NONE);
- int ret3 = player_get_video_size(player, &width, &height);
- assert_eq(ret3, PLAYER_ERROR_NONE);
- int ret4 = player_stop(player);
- assert_eq(ret4, PLAYER_ERROR_NONE);
+ ret = player_prepare(player);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player isn't prepared\\n", __LINE__, API_NAMESPACE);
+ }
- return 0;
+ int ret1 = player_start(player);
+ assert_eq(ret1, PLAYER_ERROR_NONE);
+
+ int ret2 = player_get_state(player, &cur_state);
+ assert_eq(ret2, PLAYER_ERROR_NONE);
+ assert_eq(cur_state, PLAYER_STATE_PLAYING);
+
+ int ret3 = player_get_video_size(player, &width, &height);
+ assert_eq(ret3, PLAYER_ERROR_NONE);
+ int ret4 = player_stop(player);
+ assert_eq(ret4, PLAYER_ERROR_NONE);
+
+ return 0;
}
/**
*/
int utc_media_player_get_video_size_n(void)
{
- int width, height;
- player_state_e cur_state;
+ int width = 0, height = 0;
+ player_state_e cur_state = PLAYER_STATE_NONE;
int ret2 = player_get_state(player, &cur_state);
assert_eq(ret2, PLAYER_ERROR_NONE);
*/
int utc_media_player_set_display_p(void)
{
- assert(!_is_broken);
+ player_state_e state = PLAYER_STATE_NONE;
+ int ret = PLAYER_ERROR_NONE;
- player_state_e state;
+ assert(!_is_broken);
- player_get_state (player, &state);
- if (state == PLAYER_STATE_READY)
- player_unprepare(player);
+ ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret)
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- create_window();
- int ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
- assert_eq(ret, PLAYER_ERROR_NONE);
+ if (state > PLAYER_STATE_IDLE)
+ player_unprepare(player);
- ret = player_prepare(player);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player isn't prepared\\n", __LINE__, API_NAMESPACE);
- }
+ create_window();
+ ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
+ assert_eq(ret, PLAYER_ERROR_NONE);
- return 0;
+ ret = player_prepare(player);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player isn't prepared\\n", __LINE__, API_NAMESPACE);
+ }
+
+ return 0;
}
/**
*/
int utc_media_player_set_display_p2(void)
{
- assert(!_is_broken);
+ player_state_e state = PLAYER_STATE_NONE;
+ int ret = PLAYER_ERROR_NONE;
- player_state_e state;
+ assert(!_is_broken);
- player_get_state (player, &state);
- if (state == PLAYER_STATE_READY)
- player_unprepare(player);
+ ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret)
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- create_evas_window();
- int ret = player_set_display(player, PLAYER_DISPLAY_TYPE_EVAS, g_eo);
- assert_eq(ret, PLAYER_ERROR_NONE);
+ if (state > PLAYER_STATE_IDLE)
+ player_unprepare(player);
- ret = player_prepare(player);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player isn't prepared\\n", __LINE__, API_NAMESPACE);
- }
+ create_evas_window();
+ ret = player_set_display(player, PLAYER_DISPLAY_TYPE_EVAS, g_eo);
+ assert_eq(ret, PLAYER_ERROR_NONE);
- return 0;
+ ret = player_prepare(player);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player isn't prepared\\n", __LINE__, API_NAMESPACE);
+ }
+
+ return 0;
}
/**
*/
int utc_media_player_capture_video_p(void)
{
- assert(!_is_broken);
- player_state_e state;
+ player_state_e state = PLAYER_STATE_NONE;
+ player_state_e cur_state = PLAYER_STATE_NONE;
+ int ret = PLAYER_ERROR_NONE;
- player_get_state (player, &state);
- if (state == PLAYER_STATE_READY)
- player_unprepare(player);
+ assert(!_is_broken);
- create_window();
+ ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret)
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- int ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
- assert_eq(ret, PLAYER_ERROR_NONE);
+ if (state > PLAYER_STATE_IDLE)
+ player_unprepare(player);
- int ret0 = player_prepare(player);
- assert_eq(ret0, PLAYER_ERROR_NONE);
+ create_window();
- int ret1 = player_start(player);
- assert_eq(ret1, PLAYER_ERROR_NONE);
- player_state_e cur_state;
- int ret2 = player_get_state(player, &cur_state);
- assert_eq(ret2, PLAYER_ERROR_NONE);
- assert_eq(cur_state, PLAYER_STATE_PLAYING);
+ ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
+ assert_eq(ret, PLAYER_ERROR_NONE);
- int ret3 = player_capture_video(player, player_video_capture_cb, NULL);
- assert_eq(ret3, PLAYER_ERROR_NONE);
- wait_for_async();
- assert(_is_pass);
- _is_pass = false;
+ ret = player_prepare(player);
+ assert_eq(ret, PLAYER_ERROR_NONE);
- int ret4 = player_stop(player);
- assert_eq(ret4, PLAYER_ERROR_NONE);
+ ret = player_start(player);
+ assert_eq(ret, PLAYER_ERROR_NONE);
- return 0;
+ ret = player_get_state(player, &cur_state);
+ assert_eq(ret, PLAYER_ERROR_NONE);
+ assert_eq(cur_state, PLAYER_STATE_PLAYING);
+
+ ret = player_capture_video(player, player_video_capture_cb, NULL);
+ assert_eq(ret, PLAYER_ERROR_NONE);
+ wait_for_async();
+ assert(_is_pass);
+ _is_pass = false;
+
+ ret = player_stop(player);
+ assert_eq(ret, PLAYER_ERROR_NONE);
+
+ return 0;
}
/**
*/
int utc_media_player_capture_video_n2(void)
{
- player_state_e state;
+ player_state_e state = PLAYER_STATE_NONE;
+ int ret = PLAYER_ERROR_NONE;
- player_get_state (player, &state);
- if (state == PLAYER_STATE_READY)
- player_unprepare(player);
+ ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret)
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- create_window();
+ if (state > PLAYER_STATE_IDLE)
+ player_unprepare(player);
- int ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
- assert_eq(ret, PLAYER_ERROR_NONE);
+ create_window();
- int ret2 = player_capture_video(player, player_video_capture_cb, NULL);
- assert_eq(ret2, PLAYER_ERROR_INVALID_STATE);
+ ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
+ assert_eq(ret, PLAYER_ERROR_NONE);
- return 0;
+ int ret2 = player_capture_video(player, player_video_capture_cb, NULL);
+ assert_eq(ret2, PLAYER_ERROR_INVALID_STATE);
+
+ return 0;
}
/**
*/
int utc_media_player_get_video_stream_info_p(void)
{
- assert(!_is_broken);
+ player_state_e state = PLAYER_STATE_NONE;
+ int ret = PLAYER_ERROR_NONE;
- player_state_e state;
+ assert(!_is_broken);
- player_get_state (player, &state);
- if (state == PLAYER_STATE_READY)
- player_unprepare(player);
+ ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret)
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- create_window();
+ if (state > PLAYER_STATE_IDLE)
+ player_unprepare(player);
- int ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
- assert_eq(ret, PLAYER_ERROR_NONE);
+ create_window();
- ret = player_prepare(player);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player isn't prepared\\n", __LINE__, API_NAMESPACE);
- }
+ ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
+ assert_eq(ret, PLAYER_ERROR_NONE);
- int ret1 = player_start(player);
- assert_eq(ret1, PLAYER_ERROR_NONE);
+ ret = player_prepare(player);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player isn't prepared\\n", __LINE__, API_NAMESPACE);
+ }
- int fps = 0, bit_rate = 0;
- int ret2 = player_get_video_stream_info(player, &fps, &bit_rate);
- assert_eq(ret2, PLAYER_ERROR_NONE);
+ int ret1 = player_start(player);
+ assert_eq(ret1, PLAYER_ERROR_NONE);
- int ret3 = player_stop(player);
- assert_eq(ret3, PLAYER_ERROR_NONE);
+ int fps = 0, bit_rate = 0;
+ int ret2 = player_get_video_stream_info(player, &fps, &bit_rate);
+ assert_eq(ret2, PLAYER_ERROR_NONE);
- return 0;
+ int ret3 = player_stop(player);
+ assert_eq(ret3, PLAYER_ERROR_NONE);
+
+ return 0;
}
/**
*/
int utc_media_player_get_video_stream_info_n2(void)
{
- int fps = 0, bit_rate = 0;
- player_state_e state;
+ int fps = 0, bit_rate = 0;
+ player_state_e state = PLAYER_STATE_NONE;
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE)
- player_unprepare(player);
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret)
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- ret = player_get_video_stream_info(player, &fps, &bit_rate);
- assert_eq(ret, PLAYER_ERROR_INVALID_STATE);
+ if (state > PLAYER_STATE_IDLE)
+ player_unprepare(player);
- return 0;
+ ret = player_get_video_stream_info(player, &fps, &bit_rate);
+ assert_eq(ret, PLAYER_ERROR_INVALID_STATE);
+
+ return 0;
}
/**
*/
int utc_media_player_set_audio_only_p(void)
{
- assert(!_is_broken);
-
- bool is = false;
- bool audio_only = false;
- player_state_e state;
-
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
-
- if (state == PLAYER_STATE_READY)
- player_unprepare(player);
-
- create_window();
- ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
- assert_eq(ret, PLAYER_ERROR_NONE);
-
- ret = player_prepare(player);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player isn't prepared\\n", __LINE__, API_NAMESPACE);
- }
-
- ret = player_is_audio_only(player, &is);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_is_audio_only is failed\\n", __LINE__, API_NAMESPACE);
- }
- if(!is)
- audio_only = true;
- else
- audio_only = false;
- ret = player_set_audio_only(player, audio_only);
- assert_eq(ret, PLAYER_ERROR_NONE);
-
- ret = player_is_audio_only(player, &is);
- assert_eq(ret, PLAYER_ERROR_NONE);
- assert_eq(is, audio_only);
-
- return 0;
+ assert(!_is_broken);
+
+ bool is = false;
+ bool audio_only = false;
+ player_state_e state = PLAYER_STATE_NONE;
+
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+
+ if (state > PLAYER_STATE_IDLE)
+ player_unprepare(player);
+
+ create_window();
+ ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
+ assert_eq(ret, PLAYER_ERROR_NONE);
+
+ ret = player_prepare(player);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player isn't prepared\\n", __LINE__, API_NAMESPACE);
+ }
+
+ ret = player_is_audio_only(player, &is);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_is_audio_only is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if(!is)
+ audio_only = true;
+ else
+ audio_only = false;
+ ret = player_set_audio_only(player, audio_only);
+ assert_eq(ret, PLAYER_ERROR_NONE);
+
+ ret = player_is_audio_only(player, &is);
+ assert_eq(ret, PLAYER_ERROR_NONE);
+ assert_eq(is, audio_only);
+
+ return 0;
}
/**
*/
int utc_media_player_set_audio_only_n(void)
{
- bool audio_only = false;
+ bool audio_only = false;
- int ret = player_set_audio_only(NULL, audio_only);
- assert_eq(ret, PLAYER_ERROR_INVALID_PARAMETER);
+ int ret = player_set_audio_only(NULL, audio_only);
+ assert_eq(ret, PLAYER_ERROR_INVALID_PARAMETER);
- return 0;
+ return 0;
}
/**
*/
int utc_media_player_is_audio_only_p(void)
{
- assert(!_is_broken);
- bool audio_only = false;
- bool is = true;
- player_state_e state;
-
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
+ assert(!_is_broken);
+ bool audio_only = false;
+ bool is = true;
+ player_state_e state = PLAYER_STATE_NONE;
- if (state == PLAYER_STATE_READY)
- player_unprepare(player);
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret)
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- create_window();
- ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
- assert_eq(ret, PLAYER_ERROR_NONE);
+ if (state > PLAYER_STATE_IDLE)
+ player_unprepare(player);
- ret = player_prepare(player);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player isn't prepared\\n", __LINE__, API_NAMESPACE);
- }
+ create_window();
+ ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
+ assert_eq(ret, PLAYER_ERROR_NONE);
- ret = player_set_audio_only(player, audio_only);
- assert_eq(ret, PLAYER_ERROR_NONE);
+ ret = player_prepare(player);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player isn't prepared\\n", __LINE__, API_NAMESPACE);
+ }
- ret = player_is_audio_only(player, &is);
- assert_eq(ret, PLAYER_ERROR_NONE);
- assert(!is);
+ ret = player_set_audio_only(player, audio_only);
+ assert_eq(ret, PLAYER_ERROR_NONE);
- return 0;
+ ret = player_is_audio_only(player, &is);
+ assert_eq(ret, PLAYER_ERROR_NONE);
+ assert(!is);
+
+ return 0;
}
/**
static gboolean timeout_func(gpointer data)
{
- PRINT_UTC_LOG("[Line : %d][%s] waited 10 seconds\\n", __LINE__, API_NAMESPACE);
- g_main_loop_quit((GMainLoop *) data);
- return FALSE;
+ PRINT_UTC_LOG("[Line : %d][%s] waited 10 seconds\\n", __LINE__, API_NAMESPACE);
+ g_main_loop_quit((GMainLoop *) data);
+ return FALSE;
}
static void wait_for_async()
static void seek_start_cb(void *user_data)
{
- PRINT_UTC_LOG("[Line : %d][%s] seek start callback\\n", __LINE__, API_NAMESPACE);
- int ret = player_set_play_position(player, 2, TRUE, seek_completed_cb, NULL);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] fail to set position\\n", __LINE__, API_NAMESPACE);
- }
+ PRINT_UTC_LOG("[Line : %d][%s] seek start callback\\n", __LINE__, API_NAMESPACE);
+ int ret = player_set_play_position(player, 2, TRUE, seek_completed_cb, NULL);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] fail to set position\\n", __LINE__, API_NAMESPACE);
+ }
}
static void _player_prepared_cb(void *user_data)
{
- PRINT_UTC_LOG("[Line : %d][%s] prepare callback\\n", __LINE__, API_NAMESPACE);
- int ret = player_start(player);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] fail to start\\n", __LINE__, API_NAMESPACE);
- }
-
+ PRINT_UTC_LOG("[Line : %d][%s] prepare callback\\n", __LINE__, API_NAMESPACE);
+ int ret = player_start(player);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] fail to start\\n", __LINE__, API_NAMESPACE);
+ }
}
static void win_del(void *data, Evas_Object *obj, void *event)
{
- elm_exit();
+ elm_exit();
}
static void create_window()
{
- int w = 0;
- int h = 0;
-
- g_win = elm_win_util_standard_add("player_tc", "player_tc");
- if (g_win) {
- elm_win_borderless_set(g_win, EINA_TRUE);
- evas_object_smart_callback_add(g_win, "delete,request",win_del, NULL);
- elm_win_screen_size_get(g_win, NULL, NULL, &w, &h);
- evas_object_resize(g_win, w, h);
- elm_win_autodel_set(g_win, EINA_TRUE);
- }
+ int w = 0;
+ int h = 0;
+
+ g_win = elm_win_util_standard_add("player_tc", "player_tc");
+ if (g_win) {
+ elm_win_borderless_set(g_win, EINA_TRUE);
+ evas_object_smart_callback_add(g_win, "delete,request",win_del, NULL);
+ elm_win_screen_size_get(g_win, NULL, NULL, &w, &h);
+ evas_object_resize(g_win, w, h);
+ elm_win_autodel_set(g_win, EINA_TRUE);
+ }
}
static void destroy_window()
{
- if (g_win) {
- evas_object_del(g_win);
- g_win = NULL;
- }
+ if (g_win) {
+ evas_object_del(g_win);
+ g_win = NULL;
+ }
}
*/
void utc_media_player_es_startup(void)
{
- elm_init(0, NULL);
+ unsigned int size_of_path = 0;
+ int ret = PLAYER_ERROR_NONE;
+
+ elm_init(0, NULL);
- char pszValue[CONFIG_VALUE_LEN_MAX] = {0,};
- if ( true == GetValueForTCTSetting("DEVICE_SUITE_TARGET_30", pszValue, API_NAMESPACE ))
- {
+ char pszValue[CONFIG_VALUE_LEN_MAX] = {0,};
+ if (true == GetValueForTCTSetting("DEVICE_SUITE_TARGET_30", pszValue, API_NAMESPACE)) {
PRINT_UTC_LOG("[Line : %d][%s] 'DEVICE_SUITE_TARGET_30' Values Received = %s\\n", __LINE__, API_NAMESPACE, pszValue);
- unsigned int size_of_path = strlen(pszValue) + strlen(media) + 6;
+ size_of_path = strlen(pszValue) + strlen(media) + 6;
media_path = (char*)malloc(size_of_path);
- snprintf(media_path, size_of_path, "%s/res/%s", pszValue, media);
+ if (media_path)
+ snprintf(media_path, size_of_path, "%s/res/%s", pszValue, media);
size_of_path = strlen(pszValue) + strlen(media2) + 6;
media_path2 = (char*)malloc(size_of_path);
- snprintf(media_path2, size_of_path, "%s/res/%s", pszValue, media2);
+ if (media_path2)
+ snprintf(media_path2, size_of_path, "%s/res/%s", pszValue, media2);
size_of_path = strlen(pszValue) + strlen(media_drc) + 6;
media_drc_path = (char*)malloc(size_of_path);
- snprintf(media_drc_path, size_of_path, "%s/res/%s", pszValue, media_drc);
- }
- else
- {
+ if (media_drc_path)
+ snprintf(media_drc_path, size_of_path, "%s/res/%s", pszValue, media_drc);
+
+ if (!media_path || !media_path2 || !media_drc_path) {
+ PRINT_UTC_LOG("[Line : %d][%s] failed to alloc mem for test content path.\\n", __LINE__, API_NAMESPACE);
+ goto ERROR;
+ }
+ } else {
PRINT_UTC_LOG("[Line : %d][%s] GetValueForTCTSetting returned error for 'DEVICE_SUITE_TARGET_30'\\n", __LINE__, API_NAMESPACE);
+ goto ERROR;
}
- file_src = fopen(media_path, "r");
+ file_src = fopen(media_path, "r");
- _is_broken = false;
- _is_pass = false;
+ _is_broken = false;
+ _is_pass = false;
- int ret = player_create(&player);
- if (PLAYER_ERROR_NONE != ret) {
- _is_broken = true;
- return;
- }
+ ret = player_create(&player);
+ if (PLAYER_ERROR_NONE != ret)
+ goto ERROR;
- ret = player_set_uri(player, ES_FEEDING_PATH);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player didn't set uri\\n", __LINE__, API_NAMESPACE);
- _is_broken = true;
- }
+ ret = player_set_uri(player, ES_FEEDING_PATH);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player didn't set uri\\n", __LINE__, API_NAMESPACE);
+ goto ERROR;
+ }
- /* get media format format */
- ret = media_format_create(&video_fmt);
- if (ret != MEDIA_FORMAT_ERROR_NONE) {
- PRINT_UTC_LOG("[Line : %d][%s] media_format_create(v) is failed\\n", __LINE__, API_NAMESPACE);
- }
- ret = media_format_create(&audio_fmt);
- if (ret != MEDIA_FORMAT_ERROR_NONE) {
- PRINT_UTC_LOG("[Line : %d][%s] media_format_create(a) is failed\\n", __LINE__, API_NAMESPACE);
- }
+ /* get media format format */
+ ret = media_format_create(&video_fmt);
+ if (ret != MEDIA_FORMAT_ERROR_NONE) {
+ PRINT_UTC_LOG("[Line : %d][%s] media_format_create(v) is failed\\n", __LINE__, API_NAMESPACE);
+ goto ERROR;
+ }
+ ret = media_format_create(&audio_fmt);
+ if (ret != MEDIA_FORMAT_ERROR_NONE) {
+ PRINT_UTC_LOG("[Line : %d][%s] media_format_create(a) is failed\\n", __LINE__, API_NAMESPACE);
+ goto ERROR;
+ }
+
+ /* set format */
+ media_format_set_video_mime(video_fmt, MEDIA_FORMAT_H264_SP);
+ media_format_set_video_width(video_fmt, 1280);
+ media_format_set_video_height(video_fmt, 544);
+
+ media_format_set_audio_mime(audio_fmt, MEDIA_FORMAT_AAC);
+ media_format_set_audio_channel(audio_fmt, 2);
+ media_format_set_audio_samplerate(audio_fmt, 48000);
- /* set format */
- media_format_set_video_mime(video_fmt, MEDIA_FORMAT_H264_SP);
- media_format_set_video_width(video_fmt, 1280);
- media_format_set_video_height(video_fmt, 544);
+ return;
- media_format_set_audio_mime(audio_fmt, MEDIA_FORMAT_AAC);
- media_format_set_audio_channel(audio_fmt, 2);
- media_format_set_audio_samplerate(audio_fmt, 48000);
+ERROR:
+ _is_broken = true;
+
+ if(media_path) free(media_path);
+ if(media_path2) free(media_path2);
+ if(media_drc_path) free(media_drc_path);
+ media_path = media_path2 = media_drc_path = NULL;
+
+ return;
}
/**
*/
void utc_media_player_es_cleanup(void)
{
- player_state_e state;
- int ret = 0;
+ player_state_e state = PLAYER_STATE_NONE;
+ int ret = PLAYER_ERROR_NONE;
- if (video_fmt)
- media_format_unref(video_fmt);
- if (audio_fmt)
- media_format_unref(audio_fmt);
+ if (video_fmt)
+ media_format_unref(video_fmt);
+ if (audio_fmt)
+ media_format_unref(audio_fmt);
if (file_src) {
fclose(file_src);
file_src = NULL;
}
- if(player){
- ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE)
- player_unprepare(player);
+ if (player) {
+ ret = player_get_state(player, &state);
+ if (PLAYER_ERROR_NONE != ret)
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- player_destroy(player);
- player = NULL;
- }
- if(media_path)
- free(media_path);
- if(media_path2)
- free(media_path2);
- if(media_drc_path)
- free(media_drc_path);
+ if (state > PLAYER_STATE_IDLE)
+ player_unprepare(player);
+
+ player_destroy(player);
+ player = NULL;
+ }
+
+ if(media_path)
+ free(media_path);
+ if(media_path2)
+ free(media_path2);
+ if(media_drc_path)
+ free(media_drc_path);
+
+ media_path = media_path2 = media_drc_path = NULL;
destroy_window();
elm_shutdown();
*/
int utc_media_player_set_media_stream_info_p(void)
{
- assert(!_is_broken);
- player_state_e state;
+ assert(!_is_broken);
+ player_state_e state = PLAYER_STATE_NONE;
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
- create_window();
- ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_display is failed\\n", __LINE__, API_NAMESPACE);
- }
- ret = player_set_media_stream_info(player, PLAYER_STREAM_TYPE_VIDEO, video_fmt);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_info is failed\\n", __LINE__, API_NAMESPACE);
- }
- assert_eq(ret, PLAYER_ERROR_NONE);
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
+ create_window();
+ ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
+ assert_eq(ret, PLAYER_ERROR_NONE);
- return 0;
+ ret = player_set_media_stream_info(player, PLAYER_STREAM_TYPE_VIDEO, video_fmt);
+ assert_eq(ret, PLAYER_ERROR_NONE);
+
+ return 0;
}
/**
*/
int utc_media_player_set_media_stream_info_n(void)
{
- player_state_e state;
+ player_state_e state = PLAYER_STATE_NONE;
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
- create_window();
- ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_display is failed\\n", __LINE__, API_NAMESPACE);
- }
- ret = player_set_media_stream_info(player, PLAYER_STREAM_TYPE_VIDEO, NULL);
- assert_eq(ret, PLAYER_ERROR_INVALID_OPERATION);
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
+ create_window();
+ ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_display is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ ret = player_set_media_stream_info(player, PLAYER_STREAM_TYPE_VIDEO, NULL);
+ assert_eq(ret, PLAYER_ERROR_INVALID_OPERATION);
- return 0;
+ return 0;
}
/**
*/
int utc_media_player_push_media_stream_p(void)
{
- assert(!_is_broken);
- int ret = 0;
- player_state_e state;
+ int ret = 0;
+ player_state_e state = PLAYER_STATE_NONE;
- ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
+ assert(!_is_broken);
- ret = player_set_media_stream_buffer_status_cb(player, PLAYER_STREAM_TYPE_VIDEO, player_media_stream_buffer_status_callback, NULL);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_buffer_status_cb is failed\\n", __LINE__, API_NAMESPACE);
- }
+ ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
- ret = player_set_media_stream_buffer_max_size(player, PLAYER_STREAM_TYPE_VIDEO, ES_BUFFER_MAX_SIZE);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_buffer_status_cb is failed\\n", __LINE__, API_NAMESPACE);
- }
- ret = player_set_media_stream_seek_cb(player, PLAYER_STREAM_TYPE_VIDEO, player_media_stream_seek_callback, NULL);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_buffer_status_cb is failed\\n", __LINE__, API_NAMESPACE);
- }
- create_window();
- ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_display is failed\\n", __LINE__, API_NAMESPACE);
- }
- ret = player_set_media_stream_info(player, PLAYER_STREAM_TYPE_VIDEO, video_fmt);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_info is failed\\n", __LINE__, API_NAMESPACE);
- }
- ret = player_prepare_async(player, _player_prepared_cb, (void*)player);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player isn't prepared\\n", __LINE__, API_NAMESPACE);
- }
- if(pthread_create(&feeding_thread_id, NULL, (void*)feed_video_data_thread_func, NULL)<0) {
- PRINT_UTC_LOG("[Line : %d][%s] pthread_create is failed\\n", __LINE__, API_NAMESPACE);
- return 0;
- }
+ ret = player_set_media_stream_buffer_status_cb(player, PLAYER_STREAM_TYPE_VIDEO, player_media_stream_buffer_status_callback, NULL);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_buffer_status_cb is failed\\n", __LINE__, API_NAMESPACE);
+ }
- usleep(500 * 1000);
- pthread_join(feeding_thread_id, NULL);
- assert_eq(g_ret, PLAYER_ERROR_NONE);
- usleep(1000);
+ ret = player_set_media_stream_buffer_max_size(player, PLAYER_STREAM_TYPE_VIDEO, ES_BUFFER_MAX_SIZE);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_buffer_status_cb is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ ret = player_set_media_stream_seek_cb(player, PLAYER_STREAM_TYPE_VIDEO, player_media_stream_seek_callback, NULL);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_buffer_status_cb is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ create_window();
+ ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_display is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ ret = player_set_media_stream_info(player, PLAYER_STREAM_TYPE_VIDEO, video_fmt);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_info is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ ret = player_prepare_async(player, _player_prepared_cb, (void*)player);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player isn't prepared\\n", __LINE__, API_NAMESPACE);
+ }
+ if (pthread_create(&feeding_thread_id, NULL, (void*)feed_video_data_thread_func, NULL) < 0) {
+ PRINT_UTC_LOG("[Line : %d][%s] pthread_create is failed\\n", __LINE__, API_NAMESPACE);
+ return 0;
+ }
- player_stop(player);
- player_unprepare(player);
- feeding_thread_id = 0;
+ usleep(500 * 1000);
+ pthread_join(feeding_thread_id, NULL);
+ assert_eq(g_ret, PLAYER_ERROR_NONE);
+ usleep(1000);
- return 0;
+ ret = player_unprepare(player);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player isn't unprepared\\n", __LINE__, API_NAMESPACE);
+ }
+
+ feeding_thread_id = 0;
+
+ return 0;
}
/**
ret = player_push_media_stream(player, NULL);
assert_eq(ret, PLAYER_ERROR_INVALID_PARAMETER);
- player_stop(player);
- player_unprepare(player);
+ ret = player_unprepare(player);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player isn't unprepared\\n", __LINE__, API_NAMESPACE);
+ }
return 0;
}
*/
int utc_player_set_media_stream_buffer_max_size_p(void)
{
- assert(!_is_broken);
- player_state_e state;
+ assert(!_is_broken);
+ player_state_e state = PLAYER_STATE_NONE;
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
- create_window();
- ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_display is failed\\n", __LINE__, API_NAMESPACE);
- }
- ret = player_set_media_stream_buffer_max_size(player, PLAYER_STREAM_TYPE_VIDEO, 10);
- assert_eq(ret, PLAYER_ERROR_NONE);
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
+ create_window();
+ ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_display is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ ret = player_set_media_stream_buffer_max_size(player, PLAYER_STREAM_TYPE_VIDEO, 10);
+ assert_eq(ret, PLAYER_ERROR_NONE);
- return 0;
+ return 0;
}
/**
*/
int utc_player_set_media_stream_buffer_max_size_n(void)
{
- player_state_e state;
+ player_state_e state = PLAYER_STATE_NONE;
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
- create_window();
- ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_display is failed\\n", __LINE__, API_NAMESPACE);
- }
- ret = player_set_media_stream_buffer_max_size(NULL, PLAYER_STREAM_TYPE_VIDEO, 10);
- assert_eq(ret, PLAYER_ERROR_INVALID_PARAMETER);
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
+ create_window();
+ ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_display is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ ret = player_set_media_stream_buffer_max_size(NULL, PLAYER_STREAM_TYPE_VIDEO, 10);
+ assert_eq(ret, PLAYER_ERROR_INVALID_PARAMETER);
- return 0;
+ return 0;
}
/**
int utc_player_get_media_stream_buffer_max_size_p(void)
{
assert(!_is_broken);
- player_state_e state;
+ player_state_e state = PLAYER_STATE_NONE;
unsigned long long max_size;
int ret = player_get_state (player, &state);
if (PLAYER_ERROR_NONE != ret) {
PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
}
- if (state != PLAYER_STATE_IDLE){
+ if (state > PLAYER_STATE_IDLE) {
player_unprepare(player);
}
create_window();
*/
int utc_player_get_media_stream_buffer_max_size_n(void)
{
- player_state_e state;
+ player_state_e state = PLAYER_STATE_NONE;
+
unsigned long long max_size;
int ret = player_get_state (player, &state);
if (PLAYER_ERROR_NONE != ret) {
PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
}
- if (state != PLAYER_STATE_IDLE){
+ if (state > PLAYER_STATE_IDLE) {
player_unprepare(player);
}
create_window();
*/
int utc_player_set_media_stream_buffer_min_threshold_p(void)
{
- assert(!_is_broken);
- player_state_e state;
+ assert(!_is_broken);
+ player_state_e state = PLAYER_STATE_NONE;
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
- create_window();
- ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_display is failed\\n", __LINE__, API_NAMESPACE);
- }
- ret = player_set_media_stream_buffer_min_threshold(player, PLAYER_STREAM_TYPE_VIDEO, 10);
- assert_eq(ret, PLAYER_ERROR_NONE);
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
+ create_window();
+ ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_display is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ ret = player_set_media_stream_buffer_min_threshold(player, PLAYER_STREAM_TYPE_VIDEO, 10);
+ assert_eq(ret, PLAYER_ERROR_NONE);
- return 0;
+ return 0;
}
*/
int utc_player_set_media_stream_buffer_min_threshold_n(void)
{
- player_state_e state;
+ player_state_e state = PLAYER_STATE_NONE;
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
- create_window();
- ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_display is failed\\n", __LINE__, API_NAMESPACE);
- }
- ret = player_set_media_stream_buffer_min_threshold(NULL, PLAYER_STREAM_TYPE_VIDEO, 10);
- assert_eq(ret, PLAYER_ERROR_INVALID_PARAMETER);
- return 0;
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
+ create_window();
+ ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_display is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ ret = player_set_media_stream_buffer_min_threshold(NULL, PLAYER_STREAM_TYPE_VIDEO, 10);
+ assert_eq(ret, PLAYER_ERROR_INVALID_PARAMETER);
+
+ return 0;
}
*/
int utc_player_get_media_stream_buffer_min_threshold_p(void)
{
- assert(!_is_broken);
- player_state_e state;
- unsigned int percent;
+ assert(!_is_broken);
+ player_state_e state = PLAYER_STATE_NONE;
+ unsigned int percent;
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
- create_window();
- ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_display is failed\\n", __LINE__, API_NAMESPACE);
- }
- ret = player_set_media_stream_buffer_min_threshold(player, PLAYER_STREAM_TYPE_VIDEO, 10);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_buffer_min_threshold is failed\\n", __LINE__, API_NAMESPACE);
- }
- ret = player_get_media_stream_buffer_min_threshold(player, PLAYER_STREAM_TYPE_VIDEO, &percent);
- assert_eq(ret, PLAYER_ERROR_NONE);
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
+ create_window();
+ ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_display is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ ret = player_set_media_stream_buffer_min_threshold(player, PLAYER_STREAM_TYPE_VIDEO, 10);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_buffer_min_threshold is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ ret = player_get_media_stream_buffer_min_threshold(player, PLAYER_STREAM_TYPE_VIDEO, &percent);
+ assert_eq(ret, PLAYER_ERROR_NONE);
return 0;
*/
int utc_player_get_media_stream_buffer_min_threshold_n(void)
{
- player_state_e state;
+ player_state_e state = PLAYER_STATE_NONE;
unsigned int percent;
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
- create_window();
- ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_display is failed\\n", __LINE__, API_NAMESPACE);
- }
- ret = player_set_media_stream_buffer_min_threshold(player, PLAYER_STREAM_TYPE_VIDEO, 10);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_buffer_min_threshold is failed\\n", __LINE__, API_NAMESPACE);
- }
- ret = player_get_media_stream_buffer_min_threshold(NULL, PLAYER_STREAM_TYPE_VIDEO, &percent);
- assert_eq(ret, PLAYER_ERROR_INVALID_PARAMETER);
-
- return 0;
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
+ create_window();
+ ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_display is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ ret = player_set_media_stream_buffer_min_threshold(player, PLAYER_STREAM_TYPE_VIDEO, 10);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_buffer_min_threshold is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ ret = player_get_media_stream_buffer_min_threshold(NULL, PLAYER_STREAM_TYPE_VIDEO, &percent);
+ assert_eq(ret, PLAYER_ERROR_INVALID_PARAMETER);
+ return 0;
}
/**
*/
int utc_player_set_media_stream_buffer_status_cb_p(void)
{
- assert(!_is_broken);
- int ret = 0;
- player_state_e state;
+ int ret = 0;
+ player_state_e state = PLAYER_STATE_NONE;
- ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
+ assert(!_is_broken);
- ret = player_set_media_stream_buffer_status_cb(player, PLAYER_STREAM_TYPE_VIDEO, player_media_stream_buffer_status_callback, NULL);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_buffer_status_cb is failed\\n", __LINE__, API_NAMESPACE);
- }
+ ret = player_get_state(player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
- ret = player_set_media_stream_buffer_max_size(player, PLAYER_STREAM_TYPE_VIDEO, ES_BUFFER_MAX_SIZE);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_buffer_status_cb is failed\\n", __LINE__, API_NAMESPACE);
- }
+ ret = player_set_media_stream_buffer_status_cb(player, PLAYER_STREAM_TYPE_VIDEO, player_media_stream_buffer_status_callback, NULL);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_buffer_status_cb is failed\\n", __LINE__, API_NAMESPACE);
+ }
- ret = player_set_media_stream_buffer_min_threshold(player, PLAYER_STREAM_TYPE_VIDEO, 5);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_buffer_min_threshold is failed\\n", __LINE__, API_NAMESPACE);
- }
+ ret = player_set_media_stream_buffer_max_size(player, PLAYER_STREAM_TYPE_VIDEO, ES_BUFFER_MAX_SIZE);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_buffer_status_cb is failed\\n", __LINE__, API_NAMESPACE);
+ }
- create_window();
- ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_display is failed\\n", __LINE__, API_NAMESPACE);
- }
- ret = player_set_media_stream_info(player, PLAYER_STREAM_TYPE_VIDEO, video_fmt);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_info is failed\\n", __LINE__, API_NAMESPACE);
- }
- ret = player_prepare_async(player, _player_prepared_cb, (void*)player);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player isn't prepared\\n", __LINE__, API_NAMESPACE);
- }
- if(pthread_create(&feeding_thread_id, NULL, (void*)feed_video_data_thread_func, NULL)<0) {
- PRINT_UTC_LOG("[Line : %d][%s] pthread_create is failed\\n", __LINE__, API_NAMESPACE);
- return 0;
- }
+ ret = player_set_media_stream_buffer_min_threshold(player, PLAYER_STREAM_TYPE_VIDEO, 5);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_buffer_min_threshold is failed\\n", __LINE__, API_NAMESPACE);
+ }
+
+ create_window();
+ ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_display is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ ret = player_set_media_stream_info(player, PLAYER_STREAM_TYPE_VIDEO, video_fmt);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_info is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ ret = player_prepare_async(player, _player_prepared_cb, (void*)player);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player isn't prepared\\n", __LINE__, API_NAMESPACE);
+ }
- usleep(500 * 1000);
- pthread_join(feeding_thread_id, NULL);
- assert_eq(g_ret, PLAYER_ERROR_NONE);
- usleep(1000);
+ if (pthread_create(&feeding_thread_id, NULL, (void*)feed_video_data_thread_func, NULL) < 0) {
+ PRINT_UTC_LOG("[Line : %d][%s] pthread_create is failed\\n", __LINE__, API_NAMESPACE);
+ return 0;
+ }
- player_stop(player);
- player_unprepare(player);
- feeding_thread_id = 0;
+ usleep(500 * 1000);
+ pthread_join(feeding_thread_id, NULL);
+ assert_eq(g_ret, PLAYER_ERROR_NONE);
+ usleep(1000);
- assert(_is_pass);
- _is_pass = false;
+ ret = player_stop(player);
+ if (PLAYER_ERROR_NONE != ret)
+ PRINT_UTC_LOG("[Line : %d][%s] player isn't stopped\\n", __LINE__, API_NAMESPACE);
- return 0;
+ ret = player_unprepare(player);
+ if (PLAYER_ERROR_NONE != ret)
+ PRINT_UTC_LOG("[Line : %d][%s] player isn't unprepared\\n", __LINE__, API_NAMESPACE);
+
+ feeding_thread_id = 0;
+
+ assert(_is_pass);
+ _is_pass = false;
+
+ return 0;
}
/**
*/
int utc_player_set_media_stream_buffer_status_cb_n(void)
{
- player_state_e state;
+ player_state_e state = PLAYER_STATE_NONE;
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
- ret = player_set_media_stream_buffer_status_cb(NULL, PLAYER_STREAM_TYPE_VIDEO, player_media_stream_buffer_status_callback, NULL);
- assert_eq(ret, PLAYER_ERROR_INVALID_PARAMETER);
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
+ ret = player_set_media_stream_buffer_status_cb(NULL, PLAYER_STREAM_TYPE_VIDEO, player_media_stream_buffer_status_callback, NULL);
+ assert_eq(ret, PLAYER_ERROR_INVALID_PARAMETER);
- return 0;
+ return 0;
}
/**
*/
int utc_player_unset_media_stream_buffer_status_cb_p(void)
{
- assert(!_is_broken);
- player_state_e state;
+ player_state_e state = PLAYER_STATE_NONE;
+ assert(!_is_broken);
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
- ret = player_unset_media_stream_buffer_status_cb(player, PLAYER_STREAM_TYPE_VIDEO);
- assert_eq(ret, PLAYER_ERROR_NONE);
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
+ ret = player_unset_media_stream_buffer_status_cb(player, PLAYER_STREAM_TYPE_VIDEO);
+ assert_eq(ret, PLAYER_ERROR_NONE);
- return 0;
+ return 0;
}
/**
*/
int utc_player_unset_media_stream_buffer_status_cb_p2(void)
{
- assert(!_is_broken);
- player_state_e state;
+ player_state_e state = PLAYER_STATE_NONE;
+ assert(!_is_broken);
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
- ret = player_unset_media_stream_buffer_status_cb(player, PLAYER_STREAM_TYPE_AUDIO);
- assert_eq(ret, PLAYER_ERROR_NONE);
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
+ ret = player_unset_media_stream_buffer_status_cb(player, PLAYER_STREAM_TYPE_AUDIO);
+ assert_eq(ret, PLAYER_ERROR_NONE);
- return 0;
+ return 0;
}
/**
*/
int utc_player_unset_media_stream_buffer_status_cb_n(void)
{
- player_state_e state;
+ player_state_e state = PLAYER_STATE_NONE;
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
- ret = player_unset_media_stream_buffer_status_cb(NULL, PLAYER_STREAM_TYPE_VIDEO);
- assert_eq(ret, PLAYER_ERROR_INVALID_PARAMETER);
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
+ ret = player_unset_media_stream_buffer_status_cb(NULL, PLAYER_STREAM_TYPE_VIDEO);
+ assert_eq(ret, PLAYER_ERROR_INVALID_PARAMETER);
- return 0;
+ return 0;
}
/**
{
#define PREPARE_MAX_TIMEOUT 5
- assert(!_is_broken);
- int ret = 0;
- int repeat = 0;
- player_state_e state;
+ assert(!_is_broken);
+ int ret = 0;
+ int repeat = 0;
+ player_state_e state = PLAYER_STATE_NONE;
- ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
+ ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
- ret = player_set_media_stream_seek_cb(player, PLAYER_STREAM_TYPE_VIDEO, player_media_stream_seek_callback, NULL);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_seek_cb is failed\\n", __LINE__, API_NAMESPACE);
- }
- create_window();
- ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_display is failed\\n", __LINE__, API_NAMESPACE);
- }
- ret = player_set_media_stream_info(player, PLAYER_STREAM_TYPE_VIDEO, video_fmt);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_info is failed\\n", __LINE__, API_NAMESPACE);
- }
- ret = player_set_media_stream_buffer_max_size(player, PLAYER_STREAM_TYPE_VIDEO, ES_BUFFER_MAX_SIZE);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_buffer_max_size is failed\\n", __LINE__, API_NAMESPACE);
- }
- ret = player_prepare_async(player, seek_start_cb, (void*)player);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player isn't prepared\\n", __LINE__, API_NAMESPACE);
- }
+ ret = player_set_media_stream_seek_cb(player, PLAYER_STREAM_TYPE_VIDEO, player_media_stream_seek_callback, NULL);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_seek_cb is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ create_window();
+ ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_display is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ ret = player_set_media_stream_info(player, PLAYER_STREAM_TYPE_VIDEO, video_fmt);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_info is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ ret = player_set_media_stream_buffer_max_size(player, PLAYER_STREAM_TYPE_VIDEO, ES_BUFFER_MAX_SIZE);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_media_stream_buffer_max_size is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ ret = player_prepare_async(player, seek_start_cb, (void*)player);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player isn't prepared\\n", __LINE__, API_NAMESPACE);
+ }
- if(pthread_create(&feeding_thread_id, NULL, (void*)feed_video_data_thread_func, NULL)<0) {
- PRINT_UTC_LOG("[Line : %d][%s] pthread_create is failed\\n", __LINE__, API_NAMESPACE);
- return 0;
- }
+ if(pthread_create(&feeding_thread_id, NULL, (void*)feed_video_data_thread_func, NULL)<0) {
+ PRINT_UTC_LOG("[Line : %d][%s] pthread_create is failed\\n", __LINE__, API_NAMESPACE);
+ return 0;
+ }
- for (repeat = 0; repeat < PREPARE_MAX_TIMEOUT; repeat++) {
- wait_for_async();
- }
+ for (repeat = 0; repeat < PREPARE_MAX_TIMEOUT; repeat++) {
+ wait_for_async();
+ }
- pthread_join(feeding_thread_id, NULL);
- assert_eq(g_ret, PLAYER_ERROR_NONE);
- usleep(1000);
+ pthread_join(feeding_thread_id, NULL);
+ assert_eq(g_ret, PLAYER_ERROR_NONE);
+ usleep(1000);
- player_unprepare(player);
- feeding_thread_id = 0;
+ player_unprepare(player);
+ feeding_thread_id = 0;
- assert(_is_pass);
- _is_pass = false;
+ assert(_is_pass);
+ _is_pass = false;
- return 0;
+ return 0;
}
/**
*/
int utc_player_set_media_stream_seek_cb_n(void)
{
- player_state_e state;
+ player_state_e state = PLAYER_STATE_NONE;
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
- ret = player_set_media_stream_seek_cb(player, 5, player_media_stream_seek_callback, NULL);
- assert_eq(ret, PLAYER_ERROR_INVALID_PARAMETER);
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
+ ret = player_set_media_stream_seek_cb(player, 5, player_media_stream_seek_callback, NULL);
+ assert_eq(ret, PLAYER_ERROR_INVALID_PARAMETER);
- return 0;
+ return 0;
}
/**
*/
int utc_player_set_video_stream_changed_cb_p(void)
{
- player_state_e state;
- int repeat = 0;
-
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
- ret = player_set_uri(player, media_drc_path);
- if (PLAYER_ERROR_NONE != ret)
- PRINT_UTC_LOG("[Line : %d][%s] player_set_uri is failed\\n", __LINE__, API_NAMESPACE);
-
- create_window();
- ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_display is failed\\n", __LINE__, API_NAMESPACE);
- }
-
- ret = player_set_video_stream_changed_cb (player, player_video_stream_changed_callback, NULL);
- assert_eq(ret, PLAYER_ERROR_NONE);
-
- ret = player_prepare(player);
- if (PLAYER_ERROR_NONE != ret)
- PRINT_UTC_LOG("[Line : %d][%s] player isn't prepared\\n", __LINE__, API_NAMESPACE);
-
- ret = player_start(player);
- if (PLAYER_ERROR_NONE != ret)
- PRINT_UTC_LOG("[Line : %d][%s] player isn't started\\n", __LINE__, API_NAMESPACE);
-
- for(repeat=0; repeat<11; repeat++) {
- wait_for_async();
- if(_is_pass)
- break;
- }
-
- ret = player_stop(player);
- if (PLAYER_ERROR_NONE != ret)
- PRINT_UTC_LOG("[Line : %d][%s] player isn't stopped\\n", __LINE__, API_NAMESPACE);
-
- assert(_is_pass);
- _is_pass = false;
-
- return 0;
+ player_state_e state = PLAYER_STATE_NONE;
+ int repeat = 0;
+
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
+ ret = player_set_uri(player, media_drc_path);
+ if (PLAYER_ERROR_NONE != ret)
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_uri is failed\\n", __LINE__, API_NAMESPACE);
+
+ create_window();
+ ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_display is failed\\n", __LINE__, API_NAMESPACE);
+ }
+
+ ret = player_set_video_stream_changed_cb(player, player_video_stream_changed_callback, NULL);
+ assert_eq(ret, PLAYER_ERROR_NONE);
+
+ ret = player_prepare(player);
+ if (PLAYER_ERROR_NONE != ret)
+ PRINT_UTC_LOG("[Line : %d][%s] player isn't prepared\\n", __LINE__, API_NAMESPACE);
+
+ ret = player_start(player);
+ if (PLAYER_ERROR_NONE != ret)
+ PRINT_UTC_LOG("[Line : %d][%s] player isn't started\\n", __LINE__, API_NAMESPACE);
+
+ for (repeat = 0; repeat < 11; repeat++) {
+ wait_for_async();
+ if (_is_pass)
+ break;
+ }
+
+ ret = player_stop(player);
+ if (PLAYER_ERROR_NONE != ret)
+ PRINT_UTC_LOG("[Line : %d][%s] player isn't stopped\\n", __LINE__, API_NAMESPACE);
+
+ assert(_is_pass);
+ _is_pass = false;
+
+ return 0;
}
/**
*/
int utc_player_set_video_stream_changed_cb_n(void)
{
- player_state_e state;
-
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
- ret = player_set_video_stream_changed_cb (NULL, player_video_stream_changed_callback, NULL);
- assert_eq(ret, PLAYER_ERROR_INVALID_PARAMETER);
-
- return 0;
+ player_state_e state = PLAYER_STATE_NONE;
+
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
+ ret = player_set_video_stream_changed_cb (NULL, player_video_stream_changed_callback, NULL);
+ assert_eq(ret, PLAYER_ERROR_INVALID_PARAMETER);
+
+ return 0;
}
/**
*/
int utc_player_set_video_stream_changed_cb_n2(void)
{
- player_state_e state;
-
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
- ret = player_set_uri(player, media_drc_path);
- if (PLAYER_ERROR_NONE != ret)
- PRINT_UTC_LOG("[Line : %d][%s] player_set_uri is failed\\n", __LINE__, API_NAMESPACE);
-
- create_window();
- ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_display is failed\\n", __LINE__, API_NAMESPACE);
- }
-
- ret = player_prepare(player);
- if (PLAYER_ERROR_NONE != ret)
- PRINT_UTC_LOG("[Line : %d][%s] player isn't prepared\\n", __LINE__, API_NAMESPACE);
-
- ret = player_set_video_stream_changed_cb (player, player_video_stream_changed_callback, NULL);
- assert_eq(ret, PLAYER_ERROR_INVALID_STATE);
-
- return 0;
+ player_state_e state = PLAYER_STATE_NONE;
+
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
+ ret = player_set_uri(player, media_drc_path);
+ if (PLAYER_ERROR_NONE != ret)
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_uri is failed\\n", __LINE__, API_NAMESPACE);
+
+ create_window();
+ ret = player_set_display(player, PLAYER_DISPLAY_TYPE_OVERLAY, g_win);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_display is failed\\n", __LINE__, API_NAMESPACE);
+ }
+
+ ret = player_prepare(player);
+ if (PLAYER_ERROR_NONE != ret)
+ PRINT_UTC_LOG("[Line : %d][%s] player isn't prepared\\n", __LINE__, API_NAMESPACE);
+
+ ret = player_set_video_stream_changed_cb (player, player_video_stream_changed_callback, NULL);
+ assert_eq(ret, PLAYER_ERROR_INVALID_STATE);
+
+ return 0;
}
/**
*/
int utc_player_unset_video_stream_changed_cb_p(void)
{
- int ret = player_unset_video_stream_changed_cb (player);
- assert_eq(ret, PLAYER_ERROR_NONE);
+ int ret = player_unset_video_stream_changed_cb (player);
+ assert_eq(ret, PLAYER_ERROR_NONE);
- return 0;
+ return 0;
}
/**
*/
int utc_player_unset_video_stream_changed_cb_n(void)
{
- int ret = player_unset_video_stream_changed_cb (NULL);
- assert_eq(ret, PLAYER_ERROR_INVALID_PARAMETER);
+ int ret = player_unset_video_stream_changed_cb (NULL);
+ assert_eq(ret, PLAYER_ERROR_INVALID_PARAMETER);
- return 0;
+ return 0;
}
/**
if (PLAYER_ERROR_NONE != ret)
PRINT_UTC_LOG("[Line : %d][%s] player_set_uri failed\\n", __LINE__, API_NAMESPACE);
- player_set_display(player, PLAYER_DISPLAY_TYPE_NONE, NULL);
+ ret = player_set_display(player, PLAYER_DISPLAY_TYPE_NONE, NULL);
if (PLAYER_ERROR_NONE != ret)
PRINT_UTC_LOG("[Line : %d][%s] player_set_display failed\\n", __LINE__, API_NAMESPACE);
if (PLAYER_ERROR_NONE != ret)
PRINT_UTC_LOG("[Line : %d][%s] player_set_uri failed\\n", __LINE__, API_NAMESPACE);
- player_set_display(player, PLAYER_DISPLAY_TYPE_NONE, NULL);
+ ret = player_set_display(player, PLAYER_DISPLAY_TYPE_NONE, NULL);
if (PLAYER_ERROR_NONE != ret)
PRINT_UTC_LOG("[Line : %d][%s] player_set_display failed\\n", __LINE__, API_NAMESPACE);
*/
void utc_media_player_lifecycle_startup(void)
{
- _is_broken = false;
-
- char pszValue[CONFIG_VALUE_LEN_MAX] = {0,};
- if ( true == GetValueForTCTSetting("DEVICE_SUITE_TARGET_30", pszValue, API_NAMESPACE ))
- {
- PRINT_UTC_LOG("[Line : %d][%s] 'DEVICE_SUITE_TARGET_30' Values Received = %s\\n", __LINE__, API_NAMESPACE, pszValue);
- unsigned int size_of_path = strlen(pszValue) + strlen(media) + 6;
- media_path = (char *)malloc(size_of_path);
- snprintf(media_path, size_of_path, "%s/res/%s", pszValue, media);
- }
- else
- {
+ unsigned int size_of_path = 0;
+ int ret = PLAYER_ERROR_NONE;
+
+ _is_broken = false;
+
+ char pszValue[CONFIG_VALUE_LEN_MAX] = {0,};
+ if (true == GetValueForTCTSetting("DEVICE_SUITE_TARGET_30", pszValue, API_NAMESPACE)) {
+ PRINT_UTC_LOG("[Line : %d][%s] 'DEVICE_SUITE_TARGET_30' Values Received = %s\\n", __LINE__, API_NAMESPACE, pszValue);
+
+ size_of_path = strlen(pszValue) + strlen(media) + 6;
+ media_path = (char *)malloc(size_of_path);
+ if (media_path) {
+ snprintf(media_path, size_of_path, "%s/res/%s", pszValue, media);
+ } else {
+ PRINT_UTC_LOG("[Line : %d][%s] failed to alloc mem for test content path\\n", __LINE__, API_NAMESPACE);
+ goto ERROR;
+ }
+ } else {
PRINT_UTC_LOG("[Line : %d][%s] GetValueForTCTSetting returned error for 'DEVICE_SUITE_TARGET_30'\\n", __LINE__, API_NAMESPACE);
+ goto ERROR;
}
- int ret = player_create(&g_player);
- if (ret == PLAYER_ERROR_NONE) {
- _is_broken = true;
- }
+ ret = player_create(&g_player);
+ if (ret != PLAYER_ERROR_NONE)
+ goto ERROR;
+
+ ret = player_set_uri(g_player, media_path);
+ if (ret != PLAYER_ERROR_NONE)
+ goto ERROR;
+
+ return;
- ret = player_set_uri(g_player, media_path);
- if (ret == PLAYER_ERROR_NONE) {
- _is_broken = true;
- }
+ERROR:
+ _is_broken = true;
+
+ if(media_path)
+ free(media_path);
+ media_path = NULL;
+
+ return;
}
/**
*/
void utc_media_player_lifecycle_cleanup(void)
{
- player_state_e state;
- int ret;
- if(g_player){
- ret = player_get_state (g_player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(g_player);
- }
- player_destroy(g_player);
- g_player = NULL;
- }
-
- if(media_path)
- free(media_path);
+ player_state_e state = PLAYER_STATE_NONE;
+ int ret = PLAYER_ERROR_NONE;
+
+ if (g_player) {
+ ret = player_get_state(g_player, &state);
+ if (PLAYER_ERROR_NONE != ret)
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+
+ if (state > PLAYER_STATE_IDLE)
+ player_unprepare(g_player);
+
+ player_destroy(g_player);
+ g_player = NULL;
+ }
+
+ if (media_path)
+ free(media_path);
+ media_path = NULL;
}
/**
*/
int utc_media_player_create_p(void)
{
- assert(_is_broken);
- player_state_e cur_state;
+ player_state_e cur_state = PLAYER_STATE_NONE;
+ assert(!_is_broken);
int ret2 = player_get_state(g_player, &cur_state);
assert_eq(ret2, PLAYER_ERROR_NONE);
*/
int utc_media_player_pause_p(void)
{
- assert(_is_broken);
- player_state_e cur_state;
+ player_state_e cur_state = PLAYER_STATE_NONE;
+ assert(!_is_broken);
int ret2 = player_prepare(g_player);
assert_eq(ret2, PLAYER_ERROR_NONE);
*/
int utc_media_player_prepare_p(void)
{
- assert(_is_broken);
- player_state_e cur_state;
+ player_state_e cur_state = PLAYER_STATE_NONE;
+ assert(!_is_broken);
int ret = player_prepare(g_player);
assert_eq(ret, PLAYER_ERROR_NONE);
*/
int utc_media_player_unprepare_p(void)
{
- assert(_is_broken);
- player_state_e cur_state;
+ player_state_e cur_state = PLAYER_STATE_NONE;
+ assert(!_is_broken);
int ret = player_prepare(g_player);
assert_eq(ret, PLAYER_ERROR_NONE);
*/
int utc_media_player_set_uri_p(void)
{
- assert(_is_broken);
+ assert(!_is_broken);
int ret = player_set_uri(g_player, media_path);
assert_eq(ret, PLAYER_ERROR_NONE);
*/
int utc_media_player_start_p(void)
{
- assert(_is_broken);
- player_state_e cur_state;
+ player_state_e cur_state = PLAYER_STATE_NONE;
+ assert(!_is_broken);
int ret = player_prepare(g_player);
assert_eq(ret, PLAYER_ERROR_NONE);
*/
int utc_media_player_stop_p(void)
{
- assert(_is_broken);
- player_state_e cur_state;
+ player_state_e cur_state = PLAYER_STATE_NONE;
+ assert(!_is_broken);
int ret = player_prepare(g_player);
assert_eq(ret, PLAYER_ERROR_NONE);
#define CONFIG_LINE_LEN_MAX 2048 //maximum key-value line length
#define CONFIG_VALUE_LEN_MAX 1024 //maximum length of value
-#define DEFAULT_PATH "http://content.bitsontherun.com/videos/ntPYsD4L-1ahmry41.mp4"
-#define DEFAULT_ADAPTIVE_PATH "http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"
#define COOKIE_EXAMPLE "cookie example"
static char* download="test.pd";
*/
void utc_media_player_streaming_startup(void)
{
- _is_broken = false;
- _is_pass = false;
-
- _is_network_supportable = _check_network_supportable();
-
- char pszValue[CONFIG_VALUE_LEN_MAX] = {0,};
- if ( true == GetValueForTCTSetting("DEVICE_SUITE_TARGET_30", pszValue, API_NAMESPACE ))
- {
- PRINT_UTC_LOG("[Line : %d][%s] 'DEVICE_SUITE_TARGET_30' Values Received = %s\\n", __LINE__, API_NAMESPACE, pszValue);
- unsigned int size_of_path = strlen(pszValue) + strlen(download) + 6;
- download_path = (char*)malloc(size_of_path);
- snprintf(download_path, size_of_path, "%s/res/%s", pszValue, download);
- }
- else
- {
- PRINT_UTC_LOG("[Line : %d][%s] GetValueForTCTSetting returned error for 'DEVICE_SUITE_TARGET_30'\\n", __LINE__, API_NAMESPACE);
- }
-
- if ( true != _get_value_from_config("PLAYER_DOWNLOAD_PROGRESS_URL", g_media_path) )
- {
- memset(g_media_path, 0x00, sizeof(g_media_path));
- if(strlen(DEFAULT_PATH)<CONFIG_VALUE_LEN_MAX) {
- strncpy(g_media_path, DEFAULT_PATH, strlen(DEFAULT_PATH)+1);
- g_media_path[strlen(DEFAULT_PATH)] = '\0';
- } else {
- _is_broken = true;
- }
- }
-
- if ( true != _get_value_from_config("PLAYER_ADAPTIVE_STREAMING_URL", g_media_adaptive_path) )
- {
- memset(g_media_adaptive_path, 0x00, sizeof(g_media_adaptive_path));
- if(strlen(DEFAULT_ADAPTIVE_PATH) < CONFIG_VALUE_LEN_MAX) {
- strncpy(g_media_adaptive_path, DEFAULT_ADAPTIVE_PATH, strlen(DEFAULT_ADAPTIVE_PATH)+1);
- g_media_adaptive_path[strlen(DEFAULT_ADAPTIVE_PATH)] = '\0';
- } else {
- _is_broken = true;
- }
- }
-
- int ret = player_create(&player);
- if (PLAYER_ERROR_NONE != ret) {
- _is_broken = true;
- return;
- }
+ char pszValue[CONFIG_VALUE_LEN_MAX] = {0,};
+ unsigned int size_of_path = 0;
+ int ret = PLAYER_ERROR_NONE;
+
+ _is_broken = false;
+ _is_pass = false;
+
+ _is_network_supportable = _check_network_supportable();
+
+ if (true == GetValueForTCTSetting("DEVICE_SUITE_TARGET_30", pszValue, API_NAMESPACE)) {
+ PRINT_UTC_LOG("[Line : %d][%s] 'DEVICE_SUITE_TARGET_30' Values Received = %s\\n", __LINE__, API_NAMESPACE, pszValue);
+ size_of_path = strlen(pszValue) + strlen(download) + 6;
+ download_path = (char*)malloc(size_of_path);
+ if (download_path) {
+ snprintf(download_path, size_of_path, "%s/res/%s", pszValue, download);
+ } else {
+ PRINT_UTC_LOG("[Line : %d][%s] failed to alloc mem for test content path.\\n", __LINE__, API_NAMESPACE);
+ goto ERROR;
+ }
+ } else {
+ PRINT_UTC_LOG("[Line : %d][%s] GetValueForTCTSetting returned error for 'DEVICE_SUITE_TARGET_30'\\n", __LINE__, API_NAMESPACE);
+ goto ERROR;
+ }
+
+ if (true != _get_value_from_config("PLAYER_DOWNLOAD_PROGRESS_URL", g_media_path)) {
+ PRINT_UTC_LOG("[Line : %d][%s] Failed to get value from config\\n", __LINE__, API_NAMESPACE);
+ goto ERROR;
+ }
+
+ if (true != _get_value_from_config("PLAYER_ADAPTIVE_STREAMING_URL", g_media_adaptive_path)) {
+ PRINT_UTC_LOG("[Line : %d][%s] Failed to get value from config\\n", __LINE__, API_NAMESPACE);
+ goto ERROR;
+ }
+
+ ret = player_create(&player);
+ if (PLAYER_ERROR_NONE != ret)
+ goto ERROR;
+
+ return;
+
+ERROR:
+ _is_broken = true;
+ if (download_path)
+ free(download_path);
+ download_path = NULL;
+
+ return;
}
/**
*/
void utc_media_player_streaming_cleanup(void)
{
- player_destroy(player);
- if(download_path)
- free(download_path);
+ player_destroy(player);
+
+ if(download_path)
+ free(download_path);
+ download_path = NULL;
}
static void _player_pd_message_cb(player_pd_message_type_e type, void *user_data)
{
- if(type==PLAYER_PD_STARTED || type==PLAYER_PD_COMPLETED)
- _is_pass = TRUE;
+ if (type == PLAYER_PD_STARTED || type == PLAYER_PD_COMPLETED)
+ _is_pass = TRUE;
}
/**
int ret3 = player_prepare(player);
// if wifi isn't connected or internet modules don't exist, this error will be returned.
// and it is wrongly detected as a fail. so we will skip the test on these cases.
- if(ret3==PLAYER_ERROR_CONNECTION_FAILED) {
+ if (ret3 == PLAYER_ERROR_CONNECTION_FAILED) {
PRINT_UTC_LOG("[Line : %d][%s] check network status\\n", __LINE__, API_NAMESPACE);
return 0;
}
static bool _check_sound_stream_feature(void)
{
#define _FEATURE_NAME_SOUND_STREAM "http://tizen.org/feature/multimedia.player.stream_info"
- bool supported = FALSE;
+ bool supported = FALSE;
- system_info_get_platform_bool(_FEATURE_NAME_SOUND_STREAM, &supported);
+ system_info_get_platform_bool(_FEATURE_NAME_SOUND_STREAM, &supported);
- if (supported)
- return true;
+ if (supported)
+ return true;
- PRINT_UTC_LOG("[Line : %d][%s] sound_stream is not supportable.\\n", __LINE__, API_NAMESPACE);
- return false;
+ PRINT_UTC_LOG("[Line : %d][%s] sound_stream is not supportable.\\n", __LINE__, API_NAMESPACE);
+ return false;
}
void focus_cb(sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, sound_stream_focus_state_e focus_state,
sound_stream_focus_change_reason_e reason, int sound_behavior, const char *extra_info, void *user_data)
{
- PRINT_UTC_LOG("[Line : %d][%s]FOCUS callback is called, reason(%d), extra_info(%s), userdata(%p)",
- __LINE__, API_NAMESPACE, reason, extra_info, user_data);
- return;
+ PRINT_UTC_LOG("[Line : %d][%s]FOCUS callback is called, reason(%d), extra_info(%s), userdata(%p)",
+ __LINE__, API_NAMESPACE, reason, extra_info, user_data);
+ return;
}
static void set_sound_stream_info()
{
- if (g_stream_info_h) {
- PRINT_UTC_LOG("[Line : %d][%s]stream information is already set, please destory handle and try again\\n", __LINE__, API_NAMESPACE);
- return;
- }
- if (sound_manager_create_stream_information(SOUND_STREAM_TYPE_MEDIA, focus_cb, player, &g_stream_info_h)) {
- PRINT_UTC_LOG("[Line : %d][%s]failed to create stream_information()\\n", __LINE__, API_NAMESPACE);
- return;
- }
- return;
+ if (g_stream_info_h) {
+ PRINT_UTC_LOG("[Line : %d][%s]stream information is already set, please destory handle and try again\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+ if (sound_manager_create_stream_information(SOUND_STREAM_TYPE_MEDIA, focus_cb, player, &g_stream_info_h)) {
+ PRINT_UTC_LOG("[Line : %d][%s]failed to create stream_information()\\n", __LINE__, API_NAMESPACE);
+ return;
+ }
+ return;
}
void utc_media_player_startup(void)
{
char pszValue[CONFIG_VALUE_LEN_MAX] = {0,};
- if ( true == GetValueForTCTSetting("DEVICE_SUITE_TARGET_30", pszValue, API_NAMESPACE ))
- {
- PRINT_UTC_LOG("[Line : %d][%s] 'DEVICE_SUITE_TARGET_30' Values Received = %s\\n", __LINE__, API_NAMESPACE, pszValue);
- unsigned int size_of_path = strlen(pszValue) + strlen(audio) + 6;
+ unsigned int size_of_path = 0;
+ int ret = PLAYER_ERROR_NONE;
+
+ if (true == GetValueForTCTSetting("DEVICE_SUITE_TARGET_30", pszValue, API_NAMESPACE)) {
+ PRINT_UTC_LOG("[Line : %d][%s] 'DEVICE_SUITE_TARGET_30' Values Received = %s\\n", __LINE__, API_NAMESPACE, pszValue);
+
+ size_of_path = strlen(pszValue) + strlen(audio) + 6;
audio_path = (char*)malloc(size_of_path);
- snprintf(audio_path, size_of_path, "%s/res/%s", pszValue, audio);
+ if (audio_path)
+ snprintf(audio_path, size_of_path, "%s/res/%s", pszValue, audio);
size_of_path = strlen(pszValue) + strlen(media) + 6;
media_path = (char*)malloc(size_of_path);
- snprintf(media_path, size_of_path, "%s/res/%s", pszValue, media);
+ if (media_path)
+ snprintf(media_path, size_of_path, "%s/res/%s", pszValue, media);
size_of_path = strlen(pszValue) + strlen(subtitle) + 6;
subtitle_path = (char*)malloc(size_of_path);
- snprintf(subtitle_path, size_of_path, "%s/res/%s", pszValue, subtitle);
- }
- else
- {
+ if (subtitle_path)
+ snprintf(subtitle_path, size_of_path, "%s/res/%s", pszValue, subtitle);
+
+ if (!audio_path || !media_path || !subtitle_path) {
+ PRINT_UTC_LOG("[Line : %d][%s] failed to alloc mem for test content path.\\n", __LINE__, API_NAMESPACE);
+ goto ERROR;
+ }
+ } else {
PRINT_UTC_LOG("[Line : %d][%s] GetValueForTCTSetting returned error for 'DEVICE_SUITE_TARGET_30'\\n", __LINE__, API_NAMESPACE);
+ goto ERROR;
}
+ _is_broken = false; /* If the tc meet timeout, cleanup is not called.*/
+ _is_pass = false;
- _is_broken = false; /* If the tc meet timeout, cleanup is not called.*/
- _is_pass = false;
+ ret = player_create(&player);
+ if (PLAYER_ERROR_NONE != ret)
+ goto ERROR;
- int ret = player_create(&player);
- if (PLAYER_ERROR_NONE != ret) {
- _is_broken = true;
- return;
- }
+ ret = player_set_uri(player, media_path);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player didn't set uri\\n", __LINE__, API_NAMESPACE);
+ goto ERROR;
+ }
- ret = player_set_uri(player, media_path);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player didn't set uri\\n", __LINE__, API_NAMESPACE);
- _is_broken = true;
- }
+ ret = player_prepare(player);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player isn't prepared\\n", __LINE__, API_NAMESPACE);
+ goto ERROR;
+ }
- ret = player_prepare(player);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player isn't prepared\\n", __LINE__, API_NAMESPACE);
- _is_broken = true;
- }
+ return;
+
+ERROR:
+ _is_broken = true;
+ if(audio_path) free(audio_path);
+ if(media_path) free(media_path);
+ if(subtitle_path) free(subtitle_path);
+ audio_path = media_path = subtitle_path = NULL;
+
+ return;
}
/**
*/
void utc_media_player_cleanup(void)
{
- player_state_e state;
- int ret = 0;
-
- if(player){
- ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE)
- player_unprepare(player);
- player_destroy(player);
- player = NULL;
- }
- if(audio_path)
- free(audio_path);
- if(media_path)
- free(media_path);
- if(subtitle_path)
- free(subtitle_path);
- audio_path = media_path = subtitle_path = NULL;
- if (g_stream_info_h) {
- sound_manager_destroy_stream_information(g_stream_info_h);
- g_stream_info_h = NULL;
- }
- if(band_levels) {
- free(band_levels);
- band_levels = NULL;
- }
- if (code) {
- free(code);
- code = NULL;
- }
- if(stream_info.album)
- free(stream_info.album);
- if(stream_info.artist)
- free(stream_info.artist);
- if(stream_info.author)
- free(stream_info.author);
- if(stream_info.genre)
- free(stream_info.genre);
- if(stream_info.title)
- free(stream_info.title);
- if(stream_info.year)
- free(stream_info.year);
- if(stream_info.audio_codec)
- free(stream_info.audio_codec);
- if(stream_info.video_codec)
- free(stream_info.video_codec);
-
- stream_info.album = stream_info.artist = stream_info.author = stream_info.genre = stream_info.title = stream_info.year
- = stream_info.audio_codec = stream_info.video_codec = NULL;
+ player_state_e state = PLAYER_STATE_NONE;
+ int ret = PLAYER_ERROR_NONE;
+
+ if (player) {
+ ret = player_get_state(player, &state);
+ if (PLAYER_ERROR_NONE != ret)
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+
+ if (state > PLAYER_STATE_IDLE)
+ player_unprepare(player);
+
+ player_destroy(player);
+ player = NULL;
+
+ if (audio_path)
+ free(audio_path);
+ if (media_path)
+ free(media_path);
+ if (subtitle_path)
+ free(subtitle_path);
+ audio_path = media_path = subtitle_path = NULL;
+
+ if (g_stream_info_h) {
+ sound_manager_destroy_stream_information(g_stream_info_h);
+ g_stream_info_h = NULL;
+ }
+ if (band_levels) {
+ free(band_levels);
+ band_levels = NULL;
+ }
+ if (code) {
+ free(code);
+ code = NULL;
+ }
+
+ if (stream_info.album)
+ free(stream_info.album);
+ if (stream_info.artist)
+ free(stream_info.artist);
+ if (stream_info.author)
+ free(stream_info.author);
+ if (stream_info.genre)
+ free(stream_info.genre);
+ if (stream_info.title)
+ free(stream_info.title);
+ if (stream_info.year)
+ free(stream_info.year);
+ if (stream_info.audio_codec)
+ free(stream_info.audio_codec);
+ if (stream_info.video_codec)
+ free(stream_info.video_codec);
+
+ stream_info.album = stream_info.artist = stream_info.author = stream_info.genre = stream_info.title = stream_info.year
+ = stream_info.audio_codec = stream_info.video_codec = NULL;
}
/**
*/
int utc_media_player_get_duration_n2(void)
{
- int duration;
- player_state_e state;
+ int duration;
+ player_state_e state = PLAYER_STATE_NONE;
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE)
- player_unprepare(player);
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE)
+ player_unprepare(player);
- ret = player_get_duration(player, &duration);
- assert_eq(ret, PLAYER_ERROR_INVALID_STATE);
+ ret = player_get_duration(player, &duration);
+ assert_eq(ret, PLAYER_ERROR_INVALID_STATE);
- return 0;
+ return 0;
}
static void player_seek_completed_cb_func(void *user_data) {
*/
int utc_media_player_set_play_position_n2(void)
{
- int position = 10;
- player_state_e state;
+ int position = 10;
+ player_state_e state = PLAYER_STATE_NONE;
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE)
- player_unprepare(player);
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE)
+ player_unprepare(player);
- ret = player_set_play_position(player, position, TRUE, player_seek_completed_cb_func, NULL);
- assert_eq(ret, PLAYER_ERROR_INVALID_STATE);
+ ret = player_set_play_position(player, position, TRUE, player_seek_completed_cb_func, NULL);
+ assert_eq(ret, PLAYER_ERROR_INVALID_STATE);
- return 0;
+ return 0;
}
*/
int utc_media_player_get_play_position_n2(void)
{
- int position;
- player_state_e state;
+ int position;
+ player_state_e state = PLAYER_STATE_NONE;
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE)
- player_unprepare(player);
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE)
+ player_unprepare(player);
- ret = player_get_play_position(player, &position);
- assert_eq(position, 0);
+ ret = player_get_play_position(player, &position);
+ assert_eq(position, 0);
- return 0;
+ return 0;
}
/**
*/
int utc_media_player_get_state_p(void)
{
+ player_state_e cur_state = PLAYER_STATE_NONE;
assert(!_is_broken);
- player_state_e cur_state;
int ret = player_get_state(player, &cur_state);
assert_eq(ret, PLAYER_ERROR_NONE);
*/
int utc_media_player_set_playback_rate_n2(void)
{
- float rate = 1.0f;
- player_state_e state;
+ float rate = 1.0f;
+ player_state_e state = PLAYER_STATE_NONE;
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE)
- player_unprepare(player);
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE)
+ player_unprepare(player);
- ret = player_set_playback_rate(player, rate);
- assert_eq(ret, PLAYER_ERROR_INVALID_STATE);
+ ret = player_set_playback_rate(player, rate);
+ assert_eq(ret, PLAYER_ERROR_INVALID_STATE);
- return 0;
+ return 0;
}
/**
*/
int utc_media_player_set_sound_type_p(void)
{
- assert(!_is_broken);
- sound_type_e type;
- player_state_e state;
-
- int ret = player_get_state (player, &state);
- assert_eq(ret, PLAYER_ERROR_NONE);
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
+ assert(!_is_broken);
+ sound_type_e type;
+ player_state_e state = PLAYER_STATE_NONE;
- ret = player_get_state (player, &state);
- assert_eq(ret, PLAYER_ERROR_NONE);
+ int ret = player_get_state (player, &state);
+ assert_eq(ret, PLAYER_ERROR_NONE);
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
- if (state == PLAYER_STATE_IDLE){
- ret = player_set_sound_type(player, SOUND_TYPE_MEDIA);
- assert_eq(ret, PLAYER_ERROR_NONE);
- player_prepare(player);
- assert_eq(ret, PLAYER_ERROR_NONE);
- player_start(player);
- assert_eq(ret, PLAYER_ERROR_NONE);
- wait_for_async(TRUE);
- ret = sound_manager_get_current_sound_type(&type);
- assert_eq(ret, SOUND_MANAGER_ERROR_NONE);
- assert_eq(SOUND_TYPE_MEDIA, type);
- }
- return 0;
+ ret = player_get_state (player, &state);
+ assert_eq(ret, PLAYER_ERROR_NONE);
+
+ if (state == PLAYER_STATE_IDLE){
+ ret = player_set_sound_type(player, SOUND_TYPE_MEDIA);
+ assert_eq(ret, PLAYER_ERROR_NONE);
+ player_prepare(player);
+ assert_eq(ret, PLAYER_ERROR_NONE);
+ player_start(player);
+ assert_eq(ret, PLAYER_ERROR_NONE);
+ wait_for_async(TRUE);
+ ret = sound_manager_get_current_sound_type(&type);
+ assert_eq(ret, SOUND_MANAGER_ERROR_NONE);
+ assert_eq(SOUND_TYPE_MEDIA, type);
+ }
+ return 0;
}
/**
*/
int utc_media_player_set_sound_type_n2(void)
{
- player_state_e state;
+ player_state_e state = PLAYER_STATE_NONE;
- int ret = player_get_state (player, &state);
- assert_eq(ret, PLAYER_ERROR_NONE);
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
+ int ret = player_get_state (player, &state);
+ assert_eq(ret, PLAYER_ERROR_NONE);
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
- ret = player_get_state (player, &state);
- assert_eq(ret, PLAYER_ERROR_NONE);
+ ret = player_get_state (player, &state);
+ assert_eq(ret, PLAYER_ERROR_NONE);
- if (state == PLAYER_STATE_IDLE){
- set_sound_stream_info();
- ret = player_set_sound_stream_info(player, g_stream_info_h);
- if (!_check_sound_stream_feature()) {
- assert_eq(ret, PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE);
- return 0;
- }
- assert_eq(ret, PLAYER_ERROR_NONE);
-
- ret = player_set_sound_type(player, SOUND_TYPE_MEDIA);
- assert_eq(ret, PLAYER_ERROR_SOUND_POLICY);
- }
- return 0;
+ if (state == PLAYER_STATE_IDLE){
+ set_sound_stream_info();
+ ret = player_set_sound_stream_info(player, g_stream_info_h);
+ if (!_check_sound_stream_feature()) {
+ assert_eq(ret, PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE);
+ return 0;
+ }
+ assert_eq(ret, PLAYER_ERROR_NONE);
+
+ ret = player_set_sound_type(player, SOUND_TYPE_MEDIA);
+ assert_eq(ret, PLAYER_ERROR_SOUND_POLICY);
+ }
+ return 0;
}
/**
*/
int utc_media_player_set_sound_stream_info_p(void)
{
- player_state_e state;
+ player_state_e state = PLAYER_STATE_NONE;
- int ret = player_get_state (player, &state);
- assert_eq(ret, PLAYER_ERROR_NONE);
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
+ int ret = player_get_state (player, &state);
+ assert_eq(ret, PLAYER_ERROR_NONE);
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
- ret = player_get_state (player, &state);
- assert_eq(ret, PLAYER_ERROR_NONE);
+ ret = player_get_state (player, &state);
+ assert_eq(ret, PLAYER_ERROR_NONE);
- if (state == PLAYER_STATE_IDLE){
- set_sound_stream_info();
- ret = player_set_sound_stream_info(player, g_stream_info_h);
- if (!_check_sound_stream_feature()) {
- assert_eq(ret, PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE);
- return 0;
- }
+ if (state == PLAYER_STATE_IDLE){
+ set_sound_stream_info();
+ ret = player_set_sound_stream_info(player, g_stream_info_h);
+ if (!_check_sound_stream_feature()) {
+ assert_eq(ret, PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE);
+ return 0;
+ }
- assert_eq(ret, PLAYER_ERROR_NONE);
- }
- return 0;
+ assert_eq(ret, PLAYER_ERROR_NONE);
+ }
+ return 0;
}
/**
*/
int utc_media_player_set_sound_stream_info_n(void)
{
- player_state_e state;
+ player_state_e state = PLAYER_STATE_NONE;
- int ret = player_get_state (player, &state);
- assert_eq(ret, PLAYER_ERROR_NONE);
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
+ int ret = player_get_state (player, &state);
+ assert_eq(ret, PLAYER_ERROR_NONE);
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
- ret = player_get_state (player, &state);
- assert_eq(ret, PLAYER_ERROR_NONE);
+ ret = player_get_state (player, &state);
+ assert_eq(ret, PLAYER_ERROR_NONE);
- if (state == PLAYER_STATE_IDLE){
- ret = player_set_sound_stream_info(NULL, NULL);
- if (!_check_sound_stream_feature()) {
- assert_eq(ret, PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE);
- return 0;
- }
- assert_eq(ret, PLAYER_ERROR_INVALID_PARAMETER);
- }
- return 0;
+ if (state == PLAYER_STATE_IDLE) {
+ ret = player_set_sound_stream_info(NULL, NULL);
+ if (!_check_sound_stream_feature()) {
+ assert_eq(ret, PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE);
+ return 0;
+ }
+ assert_eq(ret, PLAYER_ERROR_INVALID_PARAMETER);
+ }
+ return 0;
}
/**
*/
int utc_media_player_get_content_info_p(void)
{
- assert(!_is_broken);
+ player_state_e state = PLAYER_STATE_NONE;
+ assert(!_is_broken);
- player_state_e state;
-
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
- ret = player_set_uri(player, audio_path);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_uri is failed\\n", __LINE__, API_NAMESPACE);
- }
- ret = player_prepare(player);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_prepare is failed\\n", __LINE__, API_NAMESPACE);
- }
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
+ ret = player_set_uri(player, audio_path);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_uri is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ ret = player_prepare(player);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_prepare is failed\\n", __LINE__, API_NAMESPACE);
+ }
- int ret2 = player_get_content_info(player, PLAYER_CONTENT_INFO_ALBUM, &stream_info.album);
- assert_eq(ret2, PLAYER_ERROR_NONE);
+ int ret2 = player_get_content_info(player, PLAYER_CONTENT_INFO_ALBUM, &stream_info.album);
+ assert_eq(ret2, PLAYER_ERROR_NONE);
- int ret3 = player_get_content_info(player, PLAYER_CONTENT_INFO_ARTIST, &stream_info.artist);
- assert_eq(ret3, PLAYER_ERROR_NONE);
+ int ret3 = player_get_content_info(player, PLAYER_CONTENT_INFO_ARTIST, &stream_info.artist);
+ assert_eq(ret3, PLAYER_ERROR_NONE);
- int ret4 = player_get_content_info(player, PLAYER_CONTENT_INFO_AUTHOR, &stream_info.author);
- assert_eq(ret4, PLAYER_ERROR_NONE);
+ int ret4 = player_get_content_info(player, PLAYER_CONTENT_INFO_AUTHOR, &stream_info.author);
+ assert_eq(ret4, PLAYER_ERROR_NONE);
- int ret5 = player_get_content_info(player, PLAYER_CONTENT_INFO_GENRE, &stream_info.genre);
- assert_eq(ret5, PLAYER_ERROR_NONE);
+ int ret5 = player_get_content_info(player, PLAYER_CONTENT_INFO_GENRE, &stream_info.genre);
+ assert_eq(ret5, PLAYER_ERROR_NONE);
- int ret6 = player_get_content_info(player, PLAYER_CONTENT_INFO_TITLE, &stream_info.title);
- assert_eq(ret6, PLAYER_ERROR_NONE);
+ int ret6 = player_get_content_info(player, PLAYER_CONTENT_INFO_TITLE, &stream_info.title);
+ assert_eq(ret6, PLAYER_ERROR_NONE);
- int ret7 = player_get_content_info(player, PLAYER_CONTENT_INFO_YEAR, &stream_info.year);
- assert_eq(ret7, PLAYER_ERROR_NONE);
+ int ret7 = player_get_content_info(player, PLAYER_CONTENT_INFO_YEAR, &stream_info.year);
+ assert_eq(ret7, PLAYER_ERROR_NONE);
- if((strcmp(stream_info.album, "album")==0)
- && strcmp(stream_info.artist, "singer")==0
- && strcmp(stream_info.title, "title")==0)
- _is_pass = true;
+ if((strcmp(stream_info.album, "album")==0)
+ && strcmp(stream_info.artist, "singer")==0
+ && strcmp(stream_info.title, "title")==0)
+ _is_pass = true;
- assert(_is_pass);
- _is_pass = false;
+ assert(_is_pass);
+ _is_pass = false;
- return 0;
+ return 0;
}
/**
*/
int utc_media_player_get_content_info_n2(void)
{
- player_state_e state;
+ player_state_e state = PLAYER_STATE_NONE;
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
- ret = player_set_uri(player, audio_path);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_uri is failed\\n", __LINE__, API_NAMESPACE);
- }
- ret = player_get_content_info(player, PLAYER_CONTENT_INFO_ALBUM, &stream_info.album);
- assert_eq(ret, PLAYER_ERROR_INVALID_STATE);
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
+ ret = player_set_uri(player, audio_path);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_uri is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ ret = player_get_content_info(player, PLAYER_CONTENT_INFO_ALBUM, &stream_info.album);
+ assert_eq(ret, PLAYER_ERROR_INVALID_STATE);
- return 0;
+ return 0;
}
/**
*/
int utc_media_player_get_codec_info_n2(void)
{
- player_state_e state;
+ player_state_e state = PLAYER_STATE_NONE;
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE)
- player_unprepare(player);
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE)
+ player_unprepare(player);
- ret = player_get_codec_info(player, &stream_info.audio_codec, &stream_info.video_codec);
- assert_eq(ret, PLAYER_ERROR_INVALID_STATE);
+ ret = player_get_codec_info(player, &stream_info.audio_codec, &stream_info.video_codec);
+ assert_eq(ret, PLAYER_ERROR_INVALID_STATE);
- return 0;
+ return 0;
}
/**
*/
int utc_media_player_get_audio_stream_info_n2(void)
{
- player_state_e state;
+ player_state_e state = PLAYER_STATE_NONE;
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE)
- player_unprepare(player);
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE)
+ player_unprepare(player);
- ret = player_get_audio_stream_info(player, &stream_info.audio_sample_rate, &stream_info.audio_channel,
- &stream_info.audio_bit_rate);
- assert_eq(ret, PLAYER_ERROR_INVALID_STATE);
+ ret = player_get_audio_stream_info(player, &stream_info.audio_sample_rate, &stream_info.audio_channel,
+ &stream_info.audio_bit_rate);
+ assert_eq(ret, PLAYER_ERROR_INVALID_STATE);
- return 0;
+ return 0;
}
/**
*/
int utc_media_player_get_album_art_p(void)
{
- assert(!_is_broken);
- player_state_e state;
+ player_state_e state = PLAYER_STATE_NONE;
+ assert(!_is_broken);
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE){
- player_unprepare(player);
- }
- ret = player_set_uri(player, audio_path);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_set_uri is failed\\n", __LINE__, API_NAMESPACE);
- }
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
+ if (state > PLAYER_STATE_IDLE) {
+ player_unprepare(player);
+ }
+ ret = player_set_uri(player, audio_path);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_set_uri is failed\\n", __LINE__, API_NAMESPACE);
+ }
- ret = player_prepare(player);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_prepare is failed\\n", __LINE__, API_NAMESPACE);
- }
+ ret = player_prepare(player);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_prepare is failed\\n", __LINE__, API_NAMESPACE);
+ }
- ret = player_get_album_art(player, &stream_info.album_art, &stream_info.album_art_size);
- assert_eq(ret, PLAYER_ERROR_NONE);
+ ret = player_get_album_art(player, &stream_info.album_art, &stream_info.album_art_size);
+ assert_eq(ret, PLAYER_ERROR_NONE);
- if(stream_info.album_art_size == 2667)
- _is_pass = true;
+ if(stream_info.album_art_size == 2667)
+ _is_pass = true;
- assert(_is_pass);
- _is_pass = false;
+ assert(_is_pass);
+ _is_pass = false;
- return 0;
+ return 0;
}
/**
*/
int utc_media_player_get_album_art_n2(void)
{
- player_state_e state;
+ player_state_e state = PLAYER_STATE_NONE;
- int ret = player_get_state (player, &state);
- if (PLAYER_ERROR_NONE != ret) {
- PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
- }
- if (state != PLAYER_STATE_IDLE)
- player_unprepare(player);
+ int ret = player_get_state (player, &state);
+ if (PLAYER_ERROR_NONE != ret) {
+ PRINT_UTC_LOG("[Line : %d][%s] player_get_state is failed\\n", __LINE__, API_NAMESPACE);
+ }
- ret = player_get_album_art(player, &stream_info.album_art, &stream_info.album_art_size);
- assert_eq(ret, PLAYER_ERROR_INVALID_STATE);
+ if (state > PLAYER_STATE_IDLE)
+ player_unprepare(player);
- return 0;
+ ret = player_get_album_art(player, &stream_info.album_art, &stream_info.album_art_size);
+ assert_eq(ret, PLAYER_ERROR_INVALID_STATE);
+
+ return 0;
}
/**