From 02215bc8535910ac14c791b360fa8c43697f813b Mon Sep 17 00:00:00 2001 From: Eunhye Choi Date: Thu, 18 Jul 2019 14:28:22 +0900 Subject: [PATCH] [0.3.119] check validity of enum parameter - add macro to check parameter range - relocate some macro to avoid mixed declarations and code Change-Id: If9ee349706cbbc9e38839eb4fb67bcc3962a2c33 --- include/player_private.h | 6 + packaging/capi-media-player.spec | 4 +- src/player.c | 569 ++++++++++++++++++++++----------------- 3 files changed, 331 insertions(+), 248 deletions(-) diff --git a/include/player_private.h b/include/player_private.h index 06c35cc..44ae873 100644 --- a/include/player_private.h +++ b/include/player_private.h @@ -53,6 +53,12 @@ do { \ #define PLAYER_NULL_ARG_CHECK(arg) \ PLAYER_CHECK_CONDITION((arg), PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER") +#define PLAYER_RANGE_ARG_CHECK(arg, min, max) \ + do { \ + PLAYER_CHECK_CONDITION(arg >= min, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); \ + PLAYER_CHECK_CONDITION(arg <= max, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); \ + } while (0) + #define PLAYER_VIDEO_SUPPORTABLE_CHECK(p) \ do { \ if (p && !p->support_video) { \ diff --git a/packaging/capi-media-player.spec b/packaging/capi-media-player.spec index 565ed16..f0d92d6 100644 --- a/packaging/capi-media-player.spec +++ b/packaging/capi-media-player.spec @@ -1,6 +1,6 @@ Name: capi-media-player Summary: A Media Player API -Version: 0.3.118 +Version: 0.3.119 Release: 0 Group: Multimedia/API License: Apache-2.0 @@ -153,4 +153,4 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj %if 0%{?gcov:1} %files gcov %{_datadir}/gcov/obj/* -%endif \ No newline at end of file +%endif diff --git a/src/player.c b/src/player.c index f7119a1..c5c5801 100644 --- a/src/player.c +++ b/src/player.c @@ -500,14 +500,15 @@ static void set_null_user_cb_lock(callback_cb_info_s *cb_info, muse_player_event static int __set_callback(muse_player_event_e type, player_h player, void *callback, void *user_data) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(callback); int ret = PLAYER_ERROR_NONE; player_cli_s *pc = (player_cli_s *)player; muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK; char *ret_buf = NULL; int set = 1; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(callback); + if (MUSE_PLAYER_EVENT_TYPE_BUFFERING == type) { if (!_player_check_network_availability()) return PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE; @@ -532,13 +533,14 @@ static int __set_callback(muse_player_event_e type, player_h player, void *callb static int __unset_callback(muse_player_event_e type, player_h player) { - PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; player_cli_s *pc = (player_cli_s *)player; muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK; char *ret_buf = NULL; int set = 0; + PLAYER_INSTANCE_CHECK(player); + LOGI("Event type : %d ", type); PLAYER_NULL_ARG_CHECK(CALLBACK_INFO(pc)); @@ -1992,8 +1994,6 @@ int client_wait_for_server_ack(muse_player_api_e api, callback_cb_info_s *cb_inf int player_create(player_h *player) { - PLAYER_INSTANCE_CHECK(player); - int ret = PLAYER_ERROR_NONE; int sock_fd = INVALID_DEFAULT_VALUE; int pid = getpid(); @@ -2005,6 +2005,8 @@ int player_create(player_h *player) int retry_count = CONNECTION_RETRY; bool retry = false; + PLAYER_INSTANCE_CHECK(player); + LOGD("ENTER"); pc = g_new0(player_cli_s, 1); @@ -2128,8 +2130,6 @@ ERROR: int player_destroy(player_h player) { - PLAYER_INSTANCE_CHECK(player); - int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_DESTROY; player_cli_s *pc = (player_cli_s *)player; @@ -2138,6 +2138,9 @@ int player_destroy(player_h player) #ifdef TIZEN_FEATURE_EVAS_RENDERER int (*p_disp_destroy_evas_display)(void **) = NULL; #endif + + PLAYER_INSTANCE_CHECK(player); + LOGD("ENTER %p", pc); /* clear cb and release mem */ @@ -2183,12 +2186,13 @@ int player_destroy(player_h player) int player_prepare_async(player_h player, player_prepared_cb callback, void *user_data) { - PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_PREPARE_ASYNC; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + LOGD("ENTER"); if (pc->cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE]) { @@ -2217,12 +2221,13 @@ int player_prepare_async(player_h player, player_prepared_cb callback, void *use int player_prepare(player_h player) { - PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_PREPARE; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + LOGD("ENTER %p", pc); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -2242,7 +2247,6 @@ int player_prepare(player_h player) int player_unprepare(player_h player) { - PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_UNPREPARE; player_cli_s *pc = (player_cli_s *)player; @@ -2250,6 +2254,8 @@ int player_unprepare(player_h player) int (*p_disp_evas_display_retrieve_all_packets)(void *, bool) = NULL; player_state_e state = PLAYER_STATE_NONE; + PLAYER_INSTANCE_CHECK(player); + LOGD("ENTER %p", pc); if (_get_current_state(pc, &state) != PLAYER_ERROR_NONE) { @@ -2353,14 +2359,15 @@ int _player_get_valid_path(const char *uri, char *valid_path) int player_set_uri(player_h player, const char *uri) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(uri); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_URI; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; char path[MAX_URL_LEN] = {0, }; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(uri); + LOGD("ENTER"); if (_player_get_valid_path(uri, path) != PLAYER_ERROR_NONE) @@ -2377,8 +2384,6 @@ int player_set_uri(player_h player, const char *uri) int player_set_memory_buffer(player_h player, const void *data, int size) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(data); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_MEMORY_BUFFER; player_cli_s *pc = (player_cli_s *)player; @@ -2387,6 +2392,9 @@ int player_set_memory_buffer(player_h player, const void *data, int size) tbm_bo_handle thandle; tbm_fd tfd = INVALID_DEFAULT_VALUE; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(data); + LOGD("ENTER"); /* before setting mem buffer, player state have to be checked. */ @@ -2466,11 +2474,12 @@ static int _player_deinit_memory_buffer(player_cli_s *pc) int player_get_state(player_h player, player_state_e *pstate) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(pstate); int ret = PLAYER_ERROR_NONE; player_cli_s *pc = (player_cli_s *)player; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(pstate); + LOGD("ENTER"); ret = _get_current_state(pc, pstate); @@ -2479,18 +2488,18 @@ int player_get_state(player_h player, player_state_e *pstate) int player_set_volume(player_h player, float left, float right) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_CHECK_CONDITION(left >= 0 && left <= 1.0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); - PLAYER_CHECK_CONDITION(right >= 0 && right <= 1.0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); - - /* not support to set different value into each channel */ - PLAYER_CHECK_CONDITION(left == right, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); - int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_VOLUME; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + PLAYER_RANGE_ARG_CHECK(left, 0, 1.0); + PLAYER_RANGE_ARG_CHECK(right, 0, 1.0); + + /* not support to set different value into each channel */ + PLAYER_CHECK_CONDITION(left == right, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); + LOGD("ENTER %f", left); PLAYER_SEND_MSG(api, pc, ret_buf, ret, @@ -2502,14 +2511,15 @@ int player_set_volume(player_h player, float left, float right) int player_get_volume(player_h player, float *left, float *right) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(left && right); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_GET_VOLUME; player_cli_s *pc = (player_cli_s *)player; double volume = 0.0; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(left && right); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -2534,14 +2544,15 @@ int player_get_volume(player_h player, float *left, float *right) int player_set_sound_stream_info(player_h player, sound_stream_info_h stream_info) { - PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SOUND_STREAM); - PLAYER_INSTANCE_CHECK(player); - muse_player_api_e api = MUSE_PLAYER_API_SET_SOUND_STREAM_INFO; player_cli_s *pc = (player_cli_s *)player; bool is_available = false; char *ret_buf = NULL; + PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SOUND_STREAM); + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(stream_info); + LOGD("ENTER"); /* check if stream_info is valid */ @@ -2575,12 +2586,14 @@ int player_set_sound_stream_info(player_h player, sound_stream_info_h stream_inf int player_set_audio_latency_mode(player_h player, audio_latency_mode_e latency_mode) { - PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_AUDIO_LATENCY_MODE; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + PLAYER_RANGE_ARG_CHECK(latency_mode, AUDIO_LATENCY_MODE_LOW, AUDIO_LATENCY_MODE_HIGH); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "latency_mode", (int)latency_mode); @@ -2590,14 +2603,15 @@ int player_set_audio_latency_mode(player_h player, audio_latency_mode_e latency_ int player_get_audio_latency_mode(player_h player, audio_latency_mode_e *platency_mode) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(platency_mode); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_GET_AUDIO_LATENCY_MODE; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; int latency_mode = -1; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(platency_mode); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -2614,12 +2628,13 @@ int player_get_audio_latency_mode(player_h player, audio_latency_mode_e *platenc int player_start(player_h player) { - PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_START; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + LOGD("ENTER %p", pc); #ifdef TIZEN_FEATURE_EVAS_RENDERER int (*p_disp_set_evas_display_visible)(void *, bool) = NULL; @@ -2649,7 +2664,6 @@ int player_start(player_h player) int player_stop(player_h player) { - PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_STOP; player_cli_s *pc = (player_cli_s *)player; @@ -2658,6 +2672,9 @@ int player_stop(player_h player) #ifdef TIZEN_FEATURE_EVAS_RENDERER int (*p_disp_set_evas_display_visible)(void *, bool) = NULL; #endif + + PLAYER_INSTANCE_CHECK(player); + LOGD("ENTER %p", pc); /* check player state */ @@ -2697,12 +2714,13 @@ int player_stop(player_h player) int player_pause(player_h player) { - PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_PAUSE; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + LOGD("ENTER %p", pc); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -2714,14 +2732,14 @@ int player_pause(player_h player) static int _set_play_position(player_h player, int64_t pos, bool accurate, player_seek_completed_cb callback, void *user_data) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_CHECK_CONDITION(pos >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); - int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_PLAY_POSITION; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + PLAYER_CHECK_CONDITION(pos >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); + LOGD("ENTER %p", pc); if (!pc->cb_info) { @@ -2772,12 +2790,12 @@ static int _set_play_position(player_h player, int64_t pos, bool accurate, playe int player_set_play_position(player_h player, int milliseconds, bool accurate, player_seek_completed_cb callback, void *user_data) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_CHECK_CONDITION(milliseconds >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); - int ret = PLAYER_ERROR_NONE; int64_t pos = (int64_t)(milliseconds * G_GINT64_CONSTANT(1000000)); + PLAYER_INSTANCE_CHECK(player); + PLAYER_CHECK_CONDITION(milliseconds >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); + LOGD("ENTER"); ret = _set_play_position(player, pos, accurate, callback, user_data); @@ -2788,12 +2806,12 @@ int player_set_play_position(player_h player, int milliseconds, bool accurate, p int player_set_play_position_nsec(player_h player, int64_t nanoseconds, bool accurate, player_seek_completed_cb callback, void *user_data) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_CHECK_CONDITION(nanoseconds >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); - int ret = PLAYER_ERROR_NONE; int64_t pos = nanoseconds; + PLAYER_INSTANCE_CHECK(player); + PLAYER_CHECK_CONDITION(nanoseconds >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); + LOGD("ENTER"); ret = _set_play_position(player, pos, accurate, callback, user_data); @@ -2804,14 +2822,14 @@ int player_set_play_position_nsec(player_h player, int64_t nanoseconds, bool acc static int _get_play_position(player_h player, int64_t *pos) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(pos); - int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_GET_PLAY_POSITION; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(pos); + PLAYER_SEND_MSG(api, pc, ret_buf, ret); if (ret == PLAYER_ERROR_NONE) { @@ -2830,12 +2848,12 @@ static int _get_play_position(player_h player, int64_t *pos) int player_get_play_position(player_h player, int *milliseconds) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(milliseconds); - int ret = PLAYER_ERROR_NONE; int64_t pos = 0; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(milliseconds); + /* LOGD("ENTER"); */ ret = _get_play_position(player, &pos); @@ -2847,12 +2865,12 @@ int player_get_play_position(player_h player, int *milliseconds) int player_get_play_position_nsec(player_h player, int64_t *nanoseconds) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(nanoseconds); - int ret = PLAYER_ERROR_NONE; int64_t pos = 0; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(nanoseconds); + /* LOGD("ENTER"); */ ret = _get_play_position(player, &pos); @@ -2864,13 +2882,14 @@ int player_get_play_position_nsec(player_h player, int64_t *nanoseconds) int player_set_mute(player_h player, bool muted) { - PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_MUTE; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; int mute = (int)muted; + PLAYER_INSTANCE_CHECK(player); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "mute", mute); @@ -2880,14 +2899,15 @@ int player_set_mute(player_h player, bool muted) int player_is_muted(player_h player, bool *muted) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(muted); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_IS_MUTED; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; int mute = -1; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(muted); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -2902,12 +2922,13 @@ int player_is_muted(player_h player, bool *muted) int player_set_looping(player_h player, bool looping) { - PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_LOOPING; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "looping", (int)looping); @@ -2917,14 +2938,15 @@ int player_set_looping(player_h player, bool looping) int player_is_looping(player_h player, bool *plooping) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(plooping); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_IS_LOOPING; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; int looping = 0; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(plooping); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -2938,14 +2960,14 @@ int player_is_looping(player_h player, bool *plooping) static int _get_duration(player_h player, int64_t *duration) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(duration); - int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_GET_DURATION; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(duration); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -2965,12 +2987,12 @@ static int _get_duration(player_h player, int64_t *duration) int player_get_duration(player_h player, int *milliseconds) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(milliseconds); - int ret = PLAYER_ERROR_NONE; int64_t duration = 0; /* nsec */ + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(milliseconds); + LOGD("ENTER"); ret = _get_duration(player, &duration); @@ -2985,12 +3007,12 @@ int player_get_duration(player_h player, int *milliseconds) int player_get_duration_nsec(player_h player, int64_t *nanoseconds) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(nanoseconds); - int ret = PLAYER_ERROR_NONE; int64_t duration = 0; /* nsec */ + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(nanoseconds); + LOGD("ENTER"); ret = _get_duration(player, &duration); @@ -3005,6 +3027,7 @@ int player_get_duration_nsec(player_h player, int64_t *nanoseconds) int _player_convert_display_type(player_display_type_e type, player_private_display_type_e *out_type) { int ret = PLAYER_ERROR_NONE; + PLAYER_NULL_ARG_CHECK(out_type); switch (type) { @@ -3028,7 +3051,6 @@ int _player_convert_display_type(player_display_type_e type, player_private_disp int player_set_display(player_h player, player_display_type_e type, player_display_h display) { - PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_DISPLAY; player_cli_s *pc = (player_cli_s *)player; @@ -3049,6 +3071,8 @@ int player_set_display(player_h player, player_display_type_e type, player_displ pid_t pid = getpid(); pid_t tid = syscall(SYS_gettid); + PLAYER_INSTANCE_CHECK(player); + LOGD("ENTER"); LOGD("Check if API is called in main thread. pid [%d], tid [%d]", pid, tid); @@ -3145,8 +3169,6 @@ int player_set_display(player_h player, player_display_type_e type, player_displ int player_set_display_mode(player_h player, player_display_mode_e mode) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_CHECK_CONDITION(PLAYER_DISPLAY_MODE_LETTER_BOX <= mode && mode < PLAYER_DISPLAY_MODE_NUM, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_DISPLAY_MODE; player_cli_s *pc = (player_cli_s *)player; @@ -3154,9 +3176,13 @@ int player_set_display_mode(player_h player, player_display_mode_e mode) #ifdef TIZEN_FEATURE_EVAS_RENDERER int (*p_disp_set_evas_display_disp_mode)(void *, int) = NULL; #endif - LOGD("ENTER"); + + PLAYER_INSTANCE_CHECK(player); + PLAYER_RANGE_ARG_CHECK(mode, PLAYER_DISPLAY_MODE_LETTER_BOX, PLAYER_DISPLAY_MODE_DST_ROI); PLAYER_VIDEO_SUPPORTABLE_CHECK(pc); + LOGD("ENTER"); + #ifdef TIZEN_FEATURE_EVAS_RENDERER if (EVAS_HANDLE(pc)) { PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_evas_display_disp_mode, "disp_set_evas_display_disp_mode"); @@ -3177,8 +3203,6 @@ int player_set_display_mode(player_h player, player_display_mode_e mode) int player_get_display_mode(player_h player, player_display_mode_e *pmode) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(pmode); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_GET_DISPLAY_MODE; player_cli_s *pc = (player_cli_s *)player; @@ -3188,7 +3212,11 @@ int player_get_display_mode(player_h player, player_display_mode_e *pmode) int (*p_disp_get_evas_display_disp_mode)(void *, int *) = NULL; #endif + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(pmode); + LOGD("ENTER"); + PLAYER_VIDEO_SUPPORTABLE_CHECK(pc); #ifdef TIZEN_FEATURE_EVAS_RENDERER @@ -3215,13 +3243,15 @@ int player_get_display_mode(player_h player, player_display_mode_e *pmode) int player_set_video_roi_area(player_h player, double x_scale, double y_scale, double w_scale, double h_scale) { - PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_VIDEO_ROI_AREA; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + LOGD("ENTER"); + PLAYER_VIDEO_SUPPORTABLE_CHECK(pc); PLAYER_CHECK_CONDITION(CALLBACK_INFO(pc) != NULL && EVAS_HANDLE(pc) == NULL, PLAYER_ERROR_INVALID_OPERATION, "Display type is EVAS, video display interface is not supported"); @@ -3244,15 +3274,15 @@ int player_set_video_roi_area(player_h player, double x_scale, double y_scale, int player_get_video_roi_area(player_h player, double *x_scale, double *y_scale, double *w_scale, double *h_scale) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(x_scale && y_scale && w_scale && h_scale); - int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_GET_VIDEO_ROI_AREA; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; double scale_x = 0, scale_y = 0, scale_w = 0, scale_h = 0; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(x_scale && y_scale && w_scale && h_scale); + PLAYER_SEND_MSG(api, pc, ret_buf, ret); if (ret == PLAYER_ERROR_NONE) { @@ -3282,9 +3312,6 @@ int player_get_video_roi_area(player_h player, double *x_scale, double *y_scale, int player_set_display_roi_area(player_h player, int x, int y, int width, int height) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_CHECK_CONDITION(width > 0 && height > 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); - int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_DISPLAY_ROI_AREA; player_cli_s *pc = (player_cli_s *)player; @@ -3296,6 +3323,9 @@ int player_set_display_roi_area(player_h player, int x, int y, int width, int he int (*p_disp_set_evas_display_roi_area)(void *, int, int, int, int) = NULL; #endif + PLAYER_INSTANCE_CHECK(player); + PLAYER_CHECK_CONDITION(width > 0 && height > 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); + LOGD("ENTER"); PLAYER_VIDEO_SUPPORTABLE_CHECK(pc); @@ -3332,13 +3362,14 @@ int player_set_display_roi_area(player_h player, int x, int y, int width, int he int player_set_playback_rate(player_h player, float rate) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_CHECK_CONDITION(rate >= -5.0 && rate <= 5.0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_PLAYBACK_RATE; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + PLAYER_RANGE_ARG_CHECK(rate, -5.0, 5.0); + LOGD("ENTER"); if (rate != 0) { PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_DOUBLE, "rate", (double)rate); @@ -3350,9 +3381,6 @@ int player_set_playback_rate(player_h player, float rate) int player_set_display_rotation(player_h player, player_display_rotation_e rotation) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_CHECK_CONDITION(PLAYER_DISPLAY_ROTATION_NONE <= rotation && rotation <= PLAYER_DISPLAY_ROTATION_270, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); - int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_DISPLAY_ROTATION; player_cli_s *pc = (player_cli_s *)player; @@ -3361,6 +3389,9 @@ int player_set_display_rotation(player_h player, player_display_rotation_e rotat int (*p_disp_set_evas_display_rotation)(void *, int) = NULL; #endif + PLAYER_INSTANCE_CHECK(player); + PLAYER_RANGE_ARG_CHECK(rotation, PLAYER_DISPLAY_ROTATION_NONE, PLAYER_DISPLAY_ROTATION_270); + LOGD("ENTER"); PLAYER_VIDEO_SUPPORTABLE_CHECK(pc); @@ -3384,8 +3415,6 @@ int player_set_display_rotation(player_h player, player_display_rotation_e rotat int player_get_display_rotation(player_h player, player_display_rotation_e *protation) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(protation); int ret = PLAYER_ERROR_NONE; player_cli_s *pc = (player_cli_s *)player; muse_player_api_e api = MUSE_PLAYER_API_GET_DISPLAY_ROTATION; @@ -3395,6 +3424,9 @@ int player_get_display_rotation(player_h player, player_display_rotation_e *prot int (*p_disp_get_evas_display_rotation)(void *, int *) = NULL; #endif + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(protation); + LOGD("ENTER"); PLAYER_VIDEO_SUPPORTABLE_CHECK(pc); @@ -3421,7 +3453,6 @@ int player_get_display_rotation(player_h player, player_display_rotation_e *prot int player_set_display_visible(player_h player, bool visible) { - PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; player_cli_s *pc = (player_cli_s *)player; muse_player_api_e api = MUSE_PLAYER_API_SET_DISPLAY_VISIBLE; @@ -3430,6 +3461,8 @@ int player_set_display_visible(player_h player, bool visible) int (*p_disp_set_evas_display_visible)(void *, bool) = NULL; #endif + PLAYER_INSTANCE_CHECK(player); + LOGD("ENTER"); PLAYER_VIDEO_SUPPORTABLE_CHECK(pc); @@ -3455,8 +3488,6 @@ int player_set_display_visible(player_h player, bool visible) int player_is_display_visible(player_h player, bool *pvisible) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(pvisible); int ret = PLAYER_ERROR_NONE; player_cli_s *pc = (player_cli_s *)player; muse_player_api_e api = MUSE_PLAYER_API_IS_DISPLAY_VISIBLE; @@ -3467,6 +3498,9 @@ int player_is_display_visible(player_h player, bool *pvisible) int (*p_disp_get_evas_display_visible)(void *, bool *) = NULL; #endif + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(pvisible); + LOGD("ENTER"); PLAYER_VIDEO_SUPPORTABLE_CHECK(pc); @@ -3501,14 +3535,15 @@ int player_is_display_visible(player_h player, bool *pvisible) int player_get_content_info(player_h player, player_content_info_e key, char **pvalue) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(pvalue); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_GET_CONTENT_INFO; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; char value[MUSE_MSG_MAX_LENGTH] = { 0, }; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(pvalue); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "key", (int)key); @@ -3522,8 +3557,6 @@ int player_get_content_info(player_h player, player_content_info_e key, char **p int player_get_codec_info(player_h player, char **paudio_codec, char **pvideo_codec) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(paudio_codec || pvideo_codec); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_GET_CODEC_INFO; player_cli_s *pc = (player_cli_s *)player; @@ -3532,6 +3565,9 @@ int player_get_codec_info(player_h player, char **paudio_codec, char **pvideo_co char audio_codec[MUSE_MSG_MAX_LENGTH] = { 0, }; bool ret_val = TRUE; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(paudio_codec || pvideo_codec); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -3555,8 +3591,6 @@ int player_get_codec_info(player_h player, char **paudio_codec, char **pvideo_co int player_get_audio_stream_info(player_h player, int *psample_rate, int *pchannel, int *pbit_rate) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(psample_rate || pchannel || pbit_rate); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_GET_AUDIO_STREAM_INFO; player_cli_s *pc = (player_cli_s *)player; @@ -3565,6 +3599,9 @@ int player_get_audio_stream_info(player_h player, int *psample_rate, int *pchann int channel = 0; int bit_rate = 0; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(psample_rate || pchannel || pbit_rate); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -3592,8 +3629,6 @@ int player_get_audio_stream_info(player_h player, int *psample_rate, int *pchann int player_get_video_stream_info(player_h player, int *pfps, int *pbit_rate) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(pfps || pbit_rate); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_GET_VIDEO_STREAM_INFO; player_cli_s *pc = (player_cli_s *)player; @@ -3601,6 +3636,9 @@ int player_get_video_stream_info(player_h player, int *pfps, int *pbit_rate) int fps = 0; int bit_rate = 0; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(pfps || pbit_rate); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -3625,8 +3663,6 @@ int player_get_video_stream_info(player_h player, int *pfps, int *pbit_rate) int player_get_video_size(player_h player, int *pwidth, int *pheight) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(pwidth && pheight); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_GET_VIDEO_SIZE; player_cli_s *pc = (player_cli_s *)player; @@ -3634,6 +3670,9 @@ int player_get_video_size(player_h player, int *pwidth, int *pheight) int width = 0; int height = 0; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(pwidth && pheight); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -3656,8 +3695,6 @@ int player_get_video_size(player_h player, int *pwidth, int *pheight) int player_get_album_art(player_h player, void **palbum_art, int *psize) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(palbum_art && psize); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_GET_ALBUM_ART; player_cli_s *pc = (player_cli_s *)player; @@ -3670,6 +3707,9 @@ int player_get_album_art(player_h player, void **palbum_art, int *psize) int key = INVALID_DEFAULT_VALUE; void *jobj = NULL; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(palbum_art && psize); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -3751,14 +3791,15 @@ EXIT: int player_audio_effect_get_equalizer_bands_count(player_h player, int *pcount) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(pcount); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_AUDIO_EFFECT_GET_EQUALIZER_BANDS_COUNT; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; int count; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(pcount); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -3772,13 +3813,14 @@ int player_audio_effect_get_equalizer_bands_count(player_h player, int *pcount) int player_audio_effect_set_equalizer_all_bands(player_h player, int *band_levels, int length) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(band_levels); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_AUDIO_EFFECT_SET_EQUALIZER_ALL_BANDS; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(band_levels); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret, @@ -3792,12 +3834,13 @@ int player_audio_effect_set_equalizer_all_bands(player_h player, int *band_level int player_audio_effect_set_equalizer_band_level(player_h player, int index, int level) { - PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_AUDIO_EFFECT_SET_EQUALIZER_BAND_LEVEL; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret, @@ -3810,14 +3853,15 @@ int player_audio_effect_set_equalizer_band_level(player_h player, int index, int int player_audio_effect_get_equalizer_band_level(player_h player, int index, int *plevel) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(plevel); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_AUDIO_EFFECT_GET_EQUALIZER_BAND_LEVEL; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; int level; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(plevel); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "index", index); @@ -3831,14 +3875,15 @@ int player_audio_effect_get_equalizer_band_level(player_h player, int index, int int player_audio_effect_get_equalizer_level_range(player_h player, int *pmin, int *pmax) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(pmin && pmax); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_AUDIO_EFFECT_GET_EQUALIZER_LEVEL_RANGE; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; int min = 0, max = 0; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(pmin && pmax); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -3861,14 +3906,15 @@ int player_audio_effect_get_equalizer_level_range(player_h player, int *pmin, in int player_audio_effect_get_equalizer_band_frequency(player_h player, int index, int *pfrequency) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(pfrequency); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_AUDIO_EFFECT_GET_EQUALIZER_BAND_FREQUENCY; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; int frequency; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(pfrequency); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "index", index); @@ -3882,14 +3928,15 @@ int player_audio_effect_get_equalizer_band_frequency(player_h player, int index, int player_audio_effect_get_equalizer_band_frequency_range(player_h player, int index, int *prange) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(prange); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_AUDIO_EFFECT_GET_EQUALIZER_BAND_FREQUENCY_RANGE; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; int range; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(prange); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "index", index); @@ -3903,12 +3950,13 @@ int player_audio_effect_get_equalizer_band_frequency_range(player_h player, int int player_audio_effect_equalizer_clear(player_h player) { - PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_AUDIO_EFFECT_EQUALIZER_CLEAR; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -3918,14 +3966,15 @@ int player_audio_effect_equalizer_clear(player_h player) int player_audio_effect_equalizer_is_available(player_h player, bool *pavailable) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(pavailable); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_AUDIO_EFFECT_EQUALIZER_IS_AVAILABLE; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; int available; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(pavailable); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -3939,13 +3988,14 @@ int player_audio_effect_equalizer_is_available(player_h player, bool *pavailable int player_set_subtitle_path(player_h player, const char *path) { - PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_SUBTITLE_PATH; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; char subtitle_path[MAX_URL_LEN] = {0, }; + PLAYER_INSTANCE_CHECK(player); + LOGD("ENTER"); if (path && _player_get_valid_path(path, subtitle_path) != PLAYER_ERROR_NONE) @@ -3958,12 +4008,13 @@ int player_set_subtitle_path(player_h player, const char *path) int player_set_subtitle_position_offset(player_h player, int milliseconds) { - PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_SUBTITLE_POSITION_OFFSET; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "milliseconds", milliseconds); @@ -3974,13 +4025,14 @@ int player_set_subtitle_position_offset(player_h player, int milliseconds) int player_capture_video(player_h player, player_video_captured_cb callback, void *user_data) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(callback); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_CAPTURE_VIDEO; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(callback); + LOGD("ENTER"); if (pc->cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE]) { LOGE("PLAYER_ERROR_VIDEO_CAPTURE_FAILED (0x%08x) : capturing...", PLAYER_ERROR_VIDEO_CAPTURE_FAILED); @@ -4002,14 +4054,15 @@ int player_capture_video(player_h player, player_video_captured_cb callback, voi int player_set_streaming_cookie(player_h player, const char *cookie, int size) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(cookie); - PLAYER_CHECK_CONDITION(size >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_STREAMING_COOKIE; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(cookie); + PLAYER_CHECK_CONDITION(size >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret, @@ -4021,14 +4074,15 @@ int player_set_streaming_cookie(player_h player, const char *cookie, int size) int player_set_streaming_user_agent(player_h player, const char *user_agent, int size) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(user_agent); - PLAYER_CHECK_CONDITION(size >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_STREAMING_USER_AGENT; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(user_agent); + PLAYER_CHECK_CONDITION(size >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret, @@ -4040,14 +4094,15 @@ int player_set_streaming_user_agent(player_h player, const char *user_agent, int int player_get_streaming_download_progress(player_h player, int *start, int *end) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(start && end); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_GET_STREAMING_DOWNLOAD_PROGRESS; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; int start_pos = 0, end_pos = 0; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(start && end); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -4162,8 +4217,6 @@ int player_unset_media_packet_video_frame_decoded_cb(player_h player) int player_set_media_packet_audio_frame_decoded_cb(player_h player, media_format_h format, player_audio_extract_option_e opt, player_media_packet_audio_decoded_cb callback, void *user_data) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(callback); int ret = PLAYER_ERROR_NONE; player_cli_s *pc = (player_cli_s *)player; muse_player_api_e api = MUSE_PLAYER_API_SET_MEDIA_PACKET_AUDIO_FRAME_DECODED_CB; @@ -4172,6 +4225,10 @@ int player_set_media_packet_audio_frame_decoded_cb(player_h player, media_format int channel = 0; int samplerate = 0; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(callback); + PLAYER_RANGE_ARG_CHECK(opt, PLAYER_AUDIO_EXTRACT_DEFAULT, PLAYER_AUDIO_EXTRACT_NO_SYNC_AND_DEINTERLEAVE); + LOGD("ENTER"); if (format) { @@ -4222,11 +4279,13 @@ int player_unset_video_stream_changed_cb(player_h player) return __unset_callback(MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED, player); } -int player_set_media_stream_buffer_status_cb(player_h player, player_stream_type_e stream_type, player_media_stream_buffer_status_cb callback, void *user_data) +int player_set_media_stream_buffer_status_cb(player_h player, + player_stream_type_e stream_type, player_media_stream_buffer_status_cb callback, void *user_data) { + muse_player_event_e type; + PLAYER_INSTANCE_CHECK(player); PLAYER_NULL_ARG_CHECK(callback); - muse_player_event_e type; LOGD("ENTER"); @@ -4244,9 +4303,10 @@ int player_set_media_stream_buffer_status_cb(player_h player, player_stream_type int player_unset_media_stream_buffer_status_cb(player_h player, player_stream_type_e stream_type) { - PLAYER_INSTANCE_CHECK(player); muse_player_event_e type; + PLAYER_INSTANCE_CHECK(player); + LOGD("ENTER"); if (stream_type == PLAYER_STREAM_TYPE_VIDEO) { @@ -4261,11 +4321,13 @@ int player_unset_media_stream_buffer_status_cb(player_h player, player_stream_ty return __unset_callback(type, player); } -int player_set_media_stream_seek_cb(player_h player, player_stream_type_e stream_type, player_media_stream_seek_cb callback, void *user_data) +int player_set_media_stream_seek_cb(player_h player, + player_stream_type_e stream_type, player_media_stream_seek_cb callback, void *user_data) { + muse_player_event_e type; + PLAYER_INSTANCE_CHECK(player); PLAYER_NULL_ARG_CHECK(callback); - muse_player_event_e type; LOGD("ENTER"); @@ -4283,9 +4345,10 @@ int player_set_media_stream_seek_cb(player_h player, player_stream_type_e stream int player_unset_media_stream_seek_cb(player_h player, player_stream_type_e stream_type) { - PLAYER_INSTANCE_CHECK(player); muse_player_event_e type; + PLAYER_INSTANCE_CHECK(player); + LOGD("ENTER"); if (stream_type == PLAYER_STREAM_TYPE_VIDEO) { @@ -4303,8 +4366,6 @@ int player_unset_media_stream_seek_cb(player_h player, player_stream_type_e stre /* TODO Implement raw data socket channel */ int player_push_media_stream(player_h player, media_packet_h packet) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(packet); int ret = PLAYER_ERROR_NONE; int packet_ret = MEDIA_PACKET_ERROR_NONE; player_cli_s *pc = (player_cli_s *)player; @@ -4328,6 +4389,9 @@ int player_push_media_stream(player_h player, media_packet_h packet) char *codec_data = NULL; unsigned int codec_data_size = 0; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(packet); + LOGD("ENTER"); if(media_packet_get_buffer_data_ptr(packet, (void **)&buf) != MEDIA_PACKET_ERROR_NONE) { @@ -4443,7 +4507,6 @@ ERROR: int player_set_media_stream_info(player_h player, player_stream_type_e type, media_format_h format) { - PLAYER_INSTANCE_CHECK(player); g_return_val_if_fail(format, PLAYER_ERROR_INVALID_OPERATION); int ret = PLAYER_ERROR_NONE; player_cli_s *pc = (player_cli_s *)player; @@ -4459,6 +4522,8 @@ int player_set_media_stream_info(player_h player, player_stream_type_e type, med int bit = 0; int frame_rate = 0; + PLAYER_INSTANCE_CHECK(player); + LOGD("ENTER"); media_format_ref(format); @@ -4502,15 +4567,15 @@ int player_set_media_stream_info(player_h player, player_stream_type_e type, med int player_set_media_stream_buffer_max_size(player_h player, player_stream_type_e type, unsigned long long max_size) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_CHECK_CONDITION(PLAYER_STREAM_TYPE_DEFAULT <= type && type <= PLAYER_STREAM_TYPE_TEXT, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); - PLAYER_CHECK_CONDITION(max_size > 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); - int ret = PLAYER_ERROR_NONE; player_cli_s *pc = (player_cli_s *)player; muse_player_api_e api = MUSE_PLAYER_API_SET_MEDIA_STREAM_BUFFER_MAX_SIZE; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + PLAYER_RANGE_ARG_CHECK(type, PLAYER_STREAM_TYPE_AUDIO, PLAYER_STREAM_TYPE_VIDEO); + PLAYER_CHECK_CONDITION(max_size > 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret, @@ -4524,13 +4589,15 @@ int player_set_media_stream_buffer_max_size(player_h player, player_stream_type_ int player_get_media_stream_buffer_max_size(player_h player, player_stream_type_e type, unsigned long long *pmax_size) { int ret = PLAYER_ERROR_NONE; - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(pmax_size); player_cli_s *pc = (player_cli_s *)player; muse_player_api_e api = MUSE_PLAYER_API_GET_MEDIA_STREAM_BUFFER_MAX_SIZE; char *ret_buf = NULL; unsigned long long max_size; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(pmax_size); + PLAYER_RANGE_ARG_CHECK(type, PLAYER_STREAM_TYPE_AUDIO, PLAYER_STREAM_TYPE_VIDEO); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "type", type); @@ -4544,14 +4611,14 @@ int player_get_media_stream_buffer_max_size(player_h player, player_stream_type_ int player_set_media_stream_buffer_min_threshold(player_h player, player_stream_type_e type, unsigned int percent) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_CHECK_CONDITION(PLAYER_STREAM_TYPE_DEFAULT <= type && type <= PLAYER_STREAM_TYPE_TEXT, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); - int ret = PLAYER_ERROR_NONE; player_cli_s *pc = (player_cli_s *)player; muse_player_api_e api = MUSE_PLAYER_API_SET_MEDIA_STREAM_BUFFER_MIN_THRESHOLD; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + PLAYER_RANGE_ARG_CHECK(type, PLAYER_STREAM_TYPE_DEFAULT, PLAYER_STREAM_TYPE_TEXT); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret, @@ -4565,12 +4632,13 @@ int player_set_media_stream_buffer_min_threshold(player_h player, player_stream_ int player_get_media_stream_buffer_min_threshold(player_h player, player_stream_type_e type, unsigned int *ppercent) { int ret = PLAYER_ERROR_NONE; - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(ppercent); player_cli_s *pc = (player_cli_s *)player; muse_player_api_e api = MUSE_PLAYER_API_GET_MEDIA_STREAM_BUFFER_MIN_THRESHOLD; char *ret_buf = NULL; - uint percent; + unsigned int percent; + + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(ppercent); LOGD("ENTER"); @@ -4586,14 +4654,15 @@ int player_get_media_stream_buffer_min_threshold(player_h player, player_stream_ int player_get_track_count(player_h player, player_stream_type_e type, int *pcount) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(pcount); int ret = PLAYER_ERROR_NONE; player_cli_s *pc = (player_cli_s *)player; muse_player_api_e api = MUSE_PLAYER_API_GET_TRACK_COUNT; char *ret_buf = NULL; int count; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(pcount); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "type", type); @@ -4608,14 +4677,15 @@ int player_get_track_count(player_h player, player_stream_type_e type, int *pcou int player_get_current_track(player_h player, player_stream_type_e type, int *pindex) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(pindex); int ret = PLAYER_ERROR_NONE; player_cli_s *pc = (player_cli_s *)player; muse_player_api_e api = MUSE_PLAYER_API_GET_CURRENT_TRACK; char *ret_buf = NULL; int index; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(pindex); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "type", type); @@ -4630,12 +4700,13 @@ int player_get_current_track(player_h player, player_stream_type_e type, int *pi int player_select_track(player_h player, player_stream_type_e type, int index) { - PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; player_cli_s *pc = (player_cli_s *)player; muse_player_api_e api = MUSE_PLAYER_API_SELECT_TRACK; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "type", type, MUSE_TYPE_INT, "index", index); @@ -4646,8 +4717,6 @@ int player_select_track(player_h player, player_stream_type_e type, int index) int player_get_track_language_code(player_h player, player_stream_type_e type, int index, char **pcode) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(pcode); int ret = PLAYER_ERROR_NONE; player_cli_s *pc = (player_cli_s *)player; muse_player_api_e api = MUSE_PLAYER_API_GET_TRACK_LANGUAGE_CODE; @@ -4655,6 +4724,9 @@ int player_get_track_language_code(player_h player, player_stream_type_e type, i char code[MUSE_MSG_MAX_LENGTH] = { 0, }; int code_len = 0; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(pcode); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "type", type, MUSE_TYPE_INT, "index", index); @@ -4675,8 +4747,6 @@ int player_get_track_language_code(player_h player, player_stream_type_e type, i int player_foreach_adaptive_variant(player_h player, player_adaptive_variant_cb callback, void *user_data) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(callback); int ret = PLAYER_ERROR_NONE; player_cli_s *pc = (player_cli_s *)player; muse_player_api_e api = MUSE_PLAYER_API_GET_ADAPTIVE_VARIANT_INFO; @@ -4687,6 +4757,9 @@ int player_foreach_adaptive_variant(player_h player, player_adaptive_variant_cb char *token = NULL; char *ptr = NULL; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(callback); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -4724,13 +4797,14 @@ int player_foreach_adaptive_variant(player_h player, player_adaptive_variant_cb int player_set_max_adaptive_variant_limit(player_h player, int bandwidth, int width, int height) { int ret = PLAYER_ERROR_NONE; - PLAYER_INSTANCE_CHECK(player); - PLAYER_CHECK_CONDITION(bandwidth >= -1 && width >= -1 && height >= -1, - PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); player_cli_s *pc = (player_cli_s *)player; muse_player_api_e api = MUSE_PLAYER_API_SET_MAX_ADAPTIVE_VARIANT_LIMIT; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + PLAYER_CHECK_CONDITION(bandwidth >= -1 && width >= -1 && height >= -1, + PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret, @@ -4747,14 +4821,14 @@ int player_set_max_adaptive_variant_limit(player_h player, int bandwidth, int wi int player_get_max_adaptive_variant_limit(player_h player, int *pbandwidth, int *pwidth, int *pheight) { int ret = PLAYER_ERROR_NONE; - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(pbandwidth || pwidth || pheight); - player_cli_s *pc = (player_cli_s *)player; muse_player_api_e api = MUSE_PLAYER_API_GET_MAX_ADAPTIVE_VARIANT_LIMIT; char *ret_buf = NULL; int bandwidth = -1, width = -1, height = -1; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(pbandwidth || pwidth || pheight); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -4782,12 +4856,13 @@ int player_get_max_adaptive_variant_limit(player_h player, int *pbandwidth, int int player_set_audio_only(player_h player, bool audio_only) { int ret = PLAYER_ERROR_NONE; - PLAYER_INSTANCE_CHECK(player); player_cli_s *pc = (player_cli_s *)player; muse_player_api_e api = MUSE_PLAYER_API_SET_AUDIO_ONLY; char *ret_buf = NULL; player_state_e state = PLAYER_STATE_NONE; + PLAYER_INSTANCE_CHECK(player); + LOGD("ENTER audio_only: %d", audio_only); /* check player state */ @@ -4817,14 +4892,15 @@ int player_set_audio_only(player_h player, bool audio_only) int player_is_audio_only(player_h player, bool *paudio_only) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(paudio_only); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_IS_AUDIO_ONLY; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; int audio_only = 0; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(paudio_only); + LOGD("ENTER"); #ifdef TIZEN_FEATURE_EVAS_RENDERER if (EVAS_HANDLE(pc)) { @@ -4848,13 +4924,14 @@ int player_set_streaming_buffering_time(player_h player, int prebuffer_ms, int r { #define MIN_BUFFER_TIME -1 int ret = PLAYER_ERROR_NONE; - PLAYER_INSTANCE_CHECK(player); - PLAYER_CHECK_CONDITION(prebuffer_ms >= MIN_BUFFER_TIME && rebuffer_ms >= MIN_BUFFER_TIME, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); - player_cli_s *pc = (player_cli_s *)player; muse_player_api_e api = MUSE_PLAYER_API_SET_STREAMING_BUFFERING_TIME; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + PLAYER_CHECK_CONDITION(prebuffer_ms >= MIN_BUFFER_TIME && rebuffer_ms >= MIN_BUFFER_TIME, + PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret, @@ -4868,15 +4945,15 @@ int player_set_streaming_buffering_time(player_h player, int prebuffer_ms, int r int player_get_streaming_buffering_time(player_h player, int *prebuffer_ms, int *rebuffer_ms) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(prebuffer_ms || rebuffer_ms); - int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_GET_STREAMING_BUFFERING_TIME; player_cli_s *pc = (player_cli_s *)player; int prebuffering_time = 0, rebuffering_time = 0; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(prebuffer_ms || rebuffer_ms); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -4903,18 +4980,17 @@ int player_get_streaming_buffering_time(player_h player, int *prebuffer_ms, int int player_360_is_content_spherical(player_h player, bool *is_spherical) { - PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL); - PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO); - - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(is_spherical); - int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_360_IS_CONTENT_SPHERICAL; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; int val = 0; + PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL); + PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO); + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(is_spherical); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -4930,16 +5006,16 @@ int player_360_is_content_spherical(player_h player, bool *is_spherical) int player_360_set_enabled(player_h player, bool enabled) { - PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL); - PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO); - - PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_360_SET_ENABLED; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; int val = (int)enabled; + PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL); + PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO); + PLAYER_INSTANCE_CHECK(player); + LOGD("ENTER %d", enabled); PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "val", val); @@ -4951,17 +5027,17 @@ int player_360_set_enabled(player_h player, bool enabled) int player_360_is_enabled(player_h player, bool *enabled) { - PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL); - PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO); - - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(enabled); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_360_IS_ENABLED; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; int val = 0; + PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL); + PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO); + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(enabled); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -4977,18 +5053,17 @@ int player_360_is_enabled(player_h player, bool *enabled) int player_360_set_direction_of_view(player_h player, float yaw, float pitch) { - PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL); - PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO); - - PLAYER_INSTANCE_CHECK(player); - PLAYER_CHECK_CONDITION(yaw >= (float)-M_PI && yaw <= (float)M_PI, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); - PLAYER_CHECK_CONDITION(pitch >= (float)-M_PI / 2 && pitch <= (float)M_PI / 2, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); - int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_360_SET_DIRECTION_OF_VIEW; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL); + PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO); + PLAYER_INSTANCE_CHECK(player); + PLAYER_RANGE_ARG_CHECK(yaw, (float)-M_PI, (float)M_PI); + PLAYER_RANGE_ARG_CHECK(pitch, ((float)-M_PI / 2), ((float)M_PI / 2)); + LOGD("ENTER %f %f", yaw, pitch); PLAYER_SEND_MSG(api, pc, ret_buf, ret, @@ -5003,11 +5078,6 @@ int player_360_set_direction_of_view(player_h player, float yaw, float pitch) int player_360_get_direction_of_view(player_h player, float *yaw, float *pitch) { - PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL); - PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO); - - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(yaw && pitch); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_360_GET_DIRECTION_OF_VIEW; player_cli_s *pc = (player_cli_s *)player; @@ -5015,6 +5085,11 @@ int player_360_get_direction_of_view(player_h player, float *yaw, float *pitch) double pitch_val = -1; char *ret_buf = NULL; + PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL); + PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO); + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(yaw && pitch); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -5042,17 +5117,16 @@ int player_360_get_direction_of_view(player_h player, float *yaw, float *pitch) int player_360_set_zoom(player_h player, float level) { - PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL); - PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO); - - PLAYER_INSTANCE_CHECK(player); - PLAYER_CHECK_CONDITION(level >= 1.0 && level <= 10.0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); - int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_360_SET_ZOOM; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL); + PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO); + PLAYER_INSTANCE_CHECK(player); + PLAYER_RANGE_ARG_CHECK(level, 1.0, 10.0); + LOGD("ENTER %f", level); PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_DOUBLE, "level", (double)level); @@ -5064,17 +5138,17 @@ int player_360_set_zoom(player_h player, float level) int player_360_get_zoom(player_h player, float *level) { - PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL); - PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO); - - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(level); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_360_GET_ZOOM; player_cli_s *pc = (player_cli_s *)player; double zoom = -1; char *ret_buf = NULL; + PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL); + PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO); + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(level); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -5096,18 +5170,17 @@ int player_360_get_zoom(player_h player, float *level) int player_360_set_field_of_view(player_h player, int horizontal_degrees, int vertical_degrees) { - PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL); - PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO); - - PLAYER_INSTANCE_CHECK(player); - PLAYER_CHECK_CONDITION(horizontal_degrees >= 1 && horizontal_degrees <= 360, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); - PLAYER_CHECK_CONDITION(vertical_degrees >= 1 && vertical_degrees <= 180, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); - int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_360_SET_FIELD_OF_VIEW; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL); + PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO); + PLAYER_INSTANCE_CHECK(player); + PLAYER_RANGE_ARG_CHECK(horizontal_degrees, 1, 360); + PLAYER_RANGE_ARG_CHECK(vertical_degrees, 1, 180); + LOGD("ENTER %d %d", horizontal_degrees, vertical_degrees); PLAYER_SEND_MSG(api, pc, ret_buf, ret, @@ -5121,11 +5194,6 @@ int player_360_set_field_of_view(player_h player, int horizontal_degrees, int ve int player_360_get_field_of_view(player_h player, int *horizontal_degrees, int *vertical_degrees) { - PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL); - PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO); - - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(horizontal_degrees && vertical_degrees); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_360_GET_FIELD_OF_VIEW; player_cli_s *pc = (player_cli_s *)player; @@ -5133,6 +5201,11 @@ int player_360_get_field_of_view(player_h player, int *horizontal_degrees, int * int v_val = -1; char *ret_buf = NULL; + PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL); + PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO); + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(horizontal_degrees && vertical_degrees); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -5160,19 +5233,18 @@ int player_360_get_field_of_view(player_h player, int *horizontal_degrees, int * int player_360_set_zoom_with_field_of_view(player_h player, float level, int horizontal_degrees, int vertical_degrees) { - PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL); - PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO); - - PLAYER_INSTANCE_CHECK(player); - PLAYER_CHECK_CONDITION(horizontal_degrees >= 1 && horizontal_degrees <= 360, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); - PLAYER_CHECK_CONDITION(vertical_degrees >= 1 && vertical_degrees <= 180, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); - PLAYER_CHECK_CONDITION(level >= 1.0 && level <= 10.0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); - int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_360_SET_ZOOM_WITH_FIELD_OF_VIEW; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL); + PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO); + PLAYER_INSTANCE_CHECK(player); + PLAYER_RANGE_ARG_CHECK(horizontal_degrees, 1, 360); + PLAYER_RANGE_ARG_CHECK(vertical_degrees, 1, 180); + PLAYER_RANGE_ARG_CHECK(level, 1.0, 10.0); + LOGD("ENTER %f %d %d", level, horizontal_degrees, vertical_degrees); PLAYER_SEND_MSG(api, pc, ret_buf, ret, @@ -5187,13 +5259,14 @@ int player_360_set_zoom_with_field_of_view(player_h player, float level, int hor int player_set_replaygain_enabled(player_h player, bool enabled) { - PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_REPLAYGAIN_ENABLED; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; int val = (int)enabled; + PLAYER_INSTANCE_CHECK(player); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "val", val); @@ -5203,14 +5276,15 @@ int player_set_replaygain_enabled(player_h player, bool enabled) int player_is_replaygain_enabled(player_h player, bool *enabled) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(enabled); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_IS_REPLAYGAIN_ENABLED; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; int val = -1; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(enabled); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -5225,13 +5299,14 @@ int player_is_replaygain_enabled(player_h player, bool *enabled) int player_audio_pitch_set_enabled(player_h player, bool enabled) { - PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_PITCH_SET_ENABLED; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; int val = (int)enabled; + PLAYER_INSTANCE_CHECK(player); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "val", val); @@ -5241,14 +5316,15 @@ int player_audio_pitch_set_enabled(player_h player, bool enabled) int player_audio_pitch_is_enabled(player_h player, bool *enabled) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(enabled); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_PITCH_IS_ENABLED; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; int val = -1; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(enabled); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -5263,14 +5339,14 @@ int player_audio_pitch_is_enabled(player_h player, bool *enabled) int player_audio_pitch_set_value(player_h player, float value) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_CHECK_CONDITION(value >= 0.5 && value <= 2.0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); - int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_PITCH_SET_VALUE; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + PLAYER_RANGE_ARG_CHECK(value, 0.5, 2.0); + LOGD("ENTER %1.3f", value); PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_DOUBLE, "pitch", (double)value); @@ -5282,14 +5358,15 @@ int player_audio_pitch_set_value(player_h player, float value) int player_audio_pitch_get_value(player_h player, float *value) { - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(value); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_PITCH_GET_VALUE; player_cli_s *pc = (player_cli_s *)player; double pitch = 0.0; char *ret_buf = NULL; + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(value); + LOGD("ENTER"); PLAYER_SEND_MSG(api, pc, ret_buf, ret); -- 2.7.4