From: Eunhae Choi Date: Fri, 1 Apr 2016 05:45:43 +0000 (+0900) Subject: apply tizen coding convention X-Git-Tag: accepted/tizen/tv/20160406.014336 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Ftags%2Faccepted%2Ftizen%2Ftv%2F20160406.014336;p=platform%2Fcore%2Fapi%2Fplayer.git apply tizen coding convention Change-Id: Id16e1192729c0c33b21b4076a927f2e8f49c86b9 Signed-off-by: Eunhae Choi --- diff --git a/include/common/player.h b/include/common/player.h index e16024b..ec627c4 100644 --- a/include/common/player.h +++ b/include/common/player.h @@ -478,7 +478,7 @@ int player_prepare(player_h player); * @see player_unprepare() * @see player_set_uri() */ -int player_prepare_async (player_h player, player_prepared_cb callback, void* user_data); +int player_prepare_async(player_h player, player_prepared_cb callback, void* user_data); /** * @brief Resets the media player. @@ -561,9 +561,9 @@ int player_get_state(player_h player, player_state_e *state); * @brief Sets the player's volume. * @since_tizen 2.3 * @details Setting this volume adjusts the player's instance volume, not the system volume. - * The valid range is from 0 to 1.0, inclusive (1.0 = 100%). Default value is 1.0. - * To change system volume, use the @ref CAPI_MEDIA_SOUND_MANAGER_MODULE API. - * Finally, it does not support to set other value into each channel currently. + * The valid range is from 0 to 1.0, inclusive (1.0 = 100%). Default value is 1.0. + * To change system volume, use the @ref CAPI_MEDIA_SOUND_MANAGER_MODULE API. + * Finally, it does not support to set other value into each channel currently. * * @param[in] player The handle to the media player * @param[in] left The left volume scalar @@ -1194,7 +1194,7 @@ int player_set_display_rotation(player_h player, player_display_rotation_e rotat * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter * @see player_set_display_rotation() */ -int player_get_display_rotation( player_h player, player_display_rotation_e *rotation); +int player_get_display_rotation(player_h player, player_display_rotation_e *rotation); /** * @} @@ -1365,7 +1365,7 @@ int player_get_duration(player_h player, int *duration); * @see player_audio_effect_set_equalizer_band_level() * @see player_audio_effect_set_equalizer_all_bands() */ -int player_audio_effect_get_equalizer_bands_count (player_h player, int *count); +int player_audio_effect_get_equalizer_bands_count(player_h player, int *count); /** * @brief Sets the gain set for the given equalizer band. @@ -1810,7 +1810,7 @@ int player_set_playback_rate(player_h player, float rate); * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. * @pre The path value can be @c NULL for reset when the player state is set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare(). */ -int player_set_subtitle_path(player_h player,const char *path); +int player_set_subtitle_path(player_h player, const char *path); /** * @brief Registers a callback function to be invoked when a subtitle updates. @@ -1878,7 +1878,7 @@ int player_set_subtitle_position_offset(player_h player, int millisecond); * @see player_unset_video_stream_changed_cb() * @see player_video_stream_changed_cb() */ -int player_set_video_stream_changed_cb (player_h player, player_video_stream_changed_cb callback, void *user_data); +int player_set_video_stream_changed_cb(player_h player, player_video_stream_changed_cb callback, void *user_data); /** * @brief Unregisters the video stream changed callback function. @@ -1891,7 +1891,7 @@ int player_set_video_stream_changed_cb (player_h player, player_video_stream_cha * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter * @see player_set_video_stream_changed_cb() */ -int player_unset_video_stream_changed_cb (player_h player); +int player_unset_video_stream_changed_cb(player_h player); /** * @brief Gets current track index. diff --git a/include/common/player_internal.h b/include/common/player_internal.h index 691233a..06ce912 100644 --- a/include/common/player_internal.h +++ b/include/common/player_internal.h @@ -166,4 +166,3 @@ int player_unset_media_stream_buffer_status_cb_ex(player_h player, player_stream #endif //__TIZEN_MEDIA_PLAYER_INTERNAL_H__ - diff --git a/include/player_private.h b/include/player_private.h index fa75b96..3a66782 100644 --- a/include/player_private.h +++ b/include/player_private.h @@ -32,23 +32,23 @@ extern "C" { #endif #define LOG_TAG "TIZEN_N_PLAYER" -#define PLAYER_CHECK_CONDITION(condition,error,msg) \ - if(condition) {} else \ - { LOGE("[%s] %s(0x%08x)",__FUNCTION__, msg,error); return error;}; \ +#define PLAYER_CHECK_CONDITION(condition, error, msg) \ + if (condition) {} else \ + { LOGE("[%s] %s(0x%08x)", __FUNCTION__, msg, error); return error; }; \ #define PLAYER_INSTANCE_CHECK(player) \ - PLAYER_CHECK_CONDITION(player != NULL, PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER") + PLAYER_CHECK_CONDITION(player != NULL, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER") -#define PLAYER_STATE_CHECK(player,expected_state) \ - PLAYER_CHECK_CONDITION(player->state == expected_state,PLAYER_ERROR_INVALID_STATE,"PLAYER_ERROR_INVALID_STATE") +#define PLAYER_STATE_CHECK(player, expected_state) \ + PLAYER_CHECK_CONDITION(player->state == expected_state, PLAYER_ERROR_INVALID_STATE, "PLAYER_ERROR_INVALID_STATE") #define PLAYER_NULL_ARG_CHECK(arg) \ - PLAYER_CHECK_CONDITION(arg != NULL,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER") + PLAYER_CHECK_CONDITION(arg != NULL, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER") #define CALLBACK_TIME_OUT 5 #define MAX_SERVER_TIME_OUT 35 -typedef struct _ret_msg_s{ +typedef struct _ret_msg_s { gint api; gchar *msg; struct _ret_msg_s *next; @@ -61,7 +61,7 @@ typedef struct { ret_msg_s *retMsgHead; } msg_buff_s; -typedef struct _player_data{ +typedef struct _player_data { void *data; struct _player_data *next; } player_data_s; @@ -94,14 +94,14 @@ typedef struct _callback_cb_info { typedef struct { intptr_t bo; gint timeout; -} server_info_s; // to check +} server_info_s; // to check -typedef struct _player_cli_s{ +typedef struct _player_cli_s { callback_cb_info_s *cb_info; player_data_s *head; server_info_s server; wl_client *wlclient; - Evas_Object * eo; + Evas_Object *eo; gboolean have_evas_callback; } player_cli_s; @@ -124,14 +124,10 @@ typedef struct _player_cli_s{ int player_set_evas_object_cb(player_h player, Evas_Object * eo); int player_unset_evas_object_cb(player_h player); -int client_get_api_timeout(player_cli_s *pc, muse_player_api_e api); -int client_wait_for_cb_return(muse_player_api_e api, callback_cb_info_s *cb_info, char **ret_buf, int time_out); +int client_get_api_timeout(player_cli_s * pc, muse_player_api_e api); +int client_wait_for_cb_return(muse_player_api_e api, callback_cb_info_s * cb_info, char **ret_buf, int time_out); #ifdef __cplusplus } #endif - -#endif //__TIZEN_MEDIA_PLAYER_PRIVATE_H__ - - - +#endif //__TIZEN_MEDIA_PLAYER_PRIVATE_H__ diff --git a/include/player_wayland.h b/include/player_wayland.h index db2b348..860bf34 100644 --- a/include/player_wayland.h +++ b/include/player_wayland.h @@ -14,7 +14,6 @@ * limitations under the License. */ - #ifndef __TIZEN_MEDIA_PLAYER_WLCLIENT_H__ #define __TIZEN_MEDIA_PLAYER_WLCLIENT_H__ #include @@ -25,23 +24,21 @@ #include #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif -typedef struct -{ +typedef struct { struct wl_display *display; struct wl_registry *registry; struct tizen_surface *tz_surface; struct tizen_resource *tz_resource; } wl_client; -int _wlclient_create (wl_client ** wlclient); -int _wlclient_get_wl_window_wl_surface_id (wl_client * wlclient, struct wl_surface *surface, struct wl_display *display); -void _wlclient_finalize (wl_client * wlclient); + +int _wlclient_create(wl_client ** wlclient); +int _wlclient_get_wl_window_wl_surface_id(wl_client * wlclient, struct wl_surface *surface, struct wl_display *display); +void _wlclient_finalize(wl_client * wlclient); #ifdef __cplusplus } #endif - -#endif /* __TIZEN_MEDIA_PLAYER_WLCLIENT_H__ */ +#endif /* __TIZEN_MEDIA_PLAYER_WLCLIENT_H__ */ diff --git a/include/wearable/player.h b/include/wearable/player.h index 970498b..70be15e 100644 --- a/include/wearable/player.h +++ b/include/wearable/player.h @@ -477,7 +477,7 @@ int player_prepare(player_h player); * @see player_unprepare() * @see player_set_uri() */ -int player_prepare_async (player_h player, player_prepared_cb callback, void* user_data); +int player_prepare_async(player_h player, player_prepared_cb callback, void* user_data); /** * @brief Resets the media player. @@ -560,9 +560,9 @@ int player_get_state(player_h player, player_state_e *state); * @brief Sets the player's volume. * @since_tizen 2.3.1 * @details Setting this volume adjusts the player's instance volume, not the system volume. - * The valid range is from 0 to 1.0, inclusive (1.0 = 100%). Default value is 1.0. - * To change system volume, use the @ref CAPI_MEDIA_SOUND_MANAGER_MODULE API. - * Finally, it does not support to set other value into each channel currently. + * The valid range is from 0 to 1.0, inclusive (1.0 = 100%). Default value is 1.0. + * To change system volume, use the @ref CAPI_MEDIA_SOUND_MANAGER_MODULE API. + * Finally, it does not support to set other value into each channel currently. * * @param[in] player The handle to the media player * @param[in] left The left volume scalar @@ -1193,7 +1193,7 @@ int player_set_display_rotation(player_h player, player_display_rotation_e rotat * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter * @see player_set_display_rotation() */ -int player_get_display_rotation( player_h player, player_display_rotation_e *rotation); +int player_get_display_rotation(player_h player, player_display_rotation_e *rotation); /** * @} @@ -1364,7 +1364,7 @@ int player_get_duration(player_h player, int *duration); * @see player_audio_effect_set_equalizer_band_level() * @see player_audio_effect_set_equalizer_all_bands() */ -int player_audio_effect_get_equalizer_bands_count (player_h player, int *count); +int player_audio_effect_get_equalizer_bands_count(player_h player, int *count); /** * @brief Sets the gain set for the given equalizer band. @@ -1809,7 +1809,7 @@ int player_set_playback_rate(player_h player, float rate); * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. * @pre The path value can be @c NULL for reset when the player state is set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare(). */ -int player_set_subtitle_path(player_h player,const char *path); +int player_set_subtitle_path(player_h player, const char *path); /** * @brief Registers a callback function to be invoked when a subtitle updates. @@ -1877,7 +1877,7 @@ int player_set_subtitle_position_offset(player_h player, int millisecond); * @see player_unset_video_stream_changed_cb() * @see player_video_stream_changed_cb() */ -int player_set_video_stream_changed_cb (player_h player, player_video_stream_changed_cb callback, void *user_data); +int player_set_video_stream_changed_cb(player_h player, player_video_stream_changed_cb callback, void *user_data); /** * @brief Unregisters the video stream changed callback function. @@ -1890,7 +1890,7 @@ int player_set_video_stream_changed_cb (player_h player, player_video_stream_cha * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter * @see player_set_video_stream_changed_cb() */ -int player_unset_video_stream_changed_cb (player_h player); +int player_unset_video_stream_changed_cb(player_h player); /** * @brief Gets current track index. diff --git a/packaging/capi-media-player.spec b/packaging/capi-media-player.spec index f8c34d6..c2bb29a 100644 --- a/packaging/capi-media-player.spec +++ b/packaging/capi-media-player.spec @@ -3,7 +3,7 @@ Name: capi-media-player Summary: A Media Player API -Version: 0.3.4 +Version: 0.3.5 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/player.c b/src/player.c index 172d103..21a655a 100644 --- a/src/player.c +++ b/src/player.c @@ -60,14 +60,14 @@ typedef struct { /* * Internal Implementation */ -static int _player_deinit_memory_buffer(player_cli_s *pc); +static int _player_deinit_memory_buffer(player_cli_s * pc); int _player_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data) { int ret = 0; tbm_surface_h tsurf = NULL; muse_player_api_e api = MUSE_PLAYER_API_MEDIA_PACKET_FINALIZE_CB; - _media_pkt_fin_data *fin_data = (_media_pkt_fin_data *)user_data; + _media_pkt_fin_data *fin_data = (_media_pkt_fin_data *) user_data; intptr_t packet; char *sndMsg; @@ -233,7 +233,7 @@ static int __player_convert_error_code(int code, char *func_name) return ret; } -static void *_get_mem(player_cli_s *player, int size) +static void *_get_mem(player_cli_s * player, int size) { player_data_s *mem = g_new(player_data_s, sizeof(player_data_s)); if (mem) { @@ -245,7 +245,7 @@ static void *_get_mem(player_cli_s *player, int size) return NULL; } -static void _del_mem(player_cli_s *player) +static void _del_mem(player_cli_s * player) { player_data_s *mem; while (player->head) { @@ -256,7 +256,7 @@ static void _del_mem(player_cli_s *player) } } -static int player_recv_msg(callback_cb_info_s *cb_info, int len) +static int player_recv_msg(callback_cb_info_s * cb_info, int len) { int recvLen; msg_buff_s *buff = &cb_info->buff; @@ -276,7 +276,7 @@ static int player_recv_msg(callback_cb_info_s *cb_info, int len) return len; } -static void set_null_user_cb(callback_cb_info_s *cb_info, muse_player_event_e event) +static void set_null_user_cb(callback_cb_info_s * cb_info, muse_player_event_e event) { if (cb_info && event < MUSE_PLAYER_EVENT_TYPE_NUM) { cb_info->user_cb[event] = NULL; @@ -284,7 +284,7 @@ static void set_null_user_cb(callback_cb_info_s *cb_info, muse_player_event_e ev } } -static void set_null_user_cb_lock(callback_cb_info_s *cb_info, muse_player_event_e event) +static void set_null_user_cb_lock(callback_cb_info_s * cb_info, muse_player_event_e event) { bool lock = g_thread_self() != cb_info->event_queue.thread; @@ -302,7 +302,7 @@ static int __set_callback(muse_player_event_e type, player_h player, void *callb PLAYER_INSTANCE_CHECK(player); PLAYER_NULL_ARG_CHECK(callback); int ret = PLAYER_ERROR_NONE; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK; int set = 1; @@ -320,7 +320,7 @@ 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; + player_cli_s *pc = (player_cli_s *) player; muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK; int set = 0; @@ -335,49 +335,49 @@ static int __unset_callback(muse_player_event_e type, player_h player) return ret; } -static void __prepare_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) +static void __prepare_cb_handler(callback_cb_info_s * cb_info, char *recvMsg) { muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_PREPARE; - ((player_prepared_cb)cb_info->user_cb[ev])(cb_info->user_data[ev]); + ((player_prepared_cb) cb_info->user_cb[ev]) (cb_info->user_data[ev]); set_null_user_cb(cb_info, ev); } -static void __complete_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) +static void __complete_cb_handler(callback_cb_info_s * cb_info, char *recvMsg) { muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_COMPLETE; - ((player_completed_cb)cb_info->user_cb[ev])(cb_info->user_data[ev]); + ((player_completed_cb) cb_info->user_cb[ev]) (cb_info->user_data[ev]); } -static void __interrupt_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) +static void __interrupt_cb_handler(callback_cb_info_s * cb_info, char *recvMsg) { int code; muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_INTERRUPT; if (player_msg_get(code, recvMsg)) - ((player_interrupted_cb)cb_info->user_cb[ev])(code, cb_info->user_data[ev]); + ((player_interrupted_cb) cb_info->user_cb[ev]) (code, cb_info->user_data[ev]); } -static void __error_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) +static void __error_cb_handler(callback_cb_info_s * cb_info, char *recvMsg) { int code; muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_ERROR; if (player_msg_get(code, recvMsg)) - ((player_error_cb)cb_info->user_cb[ev])(code, cb_info->user_data[ev]); + ((player_error_cb) cb_info->user_cb[ev]) (code, cb_info->user_data[ev]); } -static void __buffering_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) +static void __buffering_cb_handler(callback_cb_info_s * cb_info, char *recvMsg) { int percent; muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_BUFFERING; if (player_msg_get(percent, recvMsg)) - ((player_buffering_cb)cb_info->user_cb[ev])(percent, cb_info->user_data[ev]); + ((player_buffering_cb) cb_info->user_cb[ev]) (percent, cb_info->user_data[ev]); } -static void __subtitle_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) +static void __subtitle_cb_handler(callback_cb_info_s * cb_info, char *recvMsg) { int duration = 0; char text[MUSE_URI_MAX_LENGTH] = { 0, }; @@ -385,11 +385,11 @@ static void __subtitle_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) if (player_msg_get(duration, recvMsg) && player_msg_get_string(text, recvMsg)) { - ((player_subtitle_updated_cb)cb_info->user_cb[ev])(duration, text, cb_info->user_data[ev]); + ((player_subtitle_updated_cb) cb_info->user_cb[ev]) (duration, text, cb_info->user_data[ev]); } } -static void __capture_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) +static void __capture_cb_handler(callback_cb_info_s * cb_info, char *recvMsg) { unsigned char *data = NULL; int width = 0; @@ -417,7 +417,7 @@ static void __capture_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) data = g_new(unsigned char, size); if (data) { memcpy(data, thandle.ptr, size); - ((player_video_captured_cb)cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE])(data, width, height, size, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_CAPTURE]); + ((player_video_captured_cb) cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE]) (data, width, height, size, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_CAPTURE]); g_free(data); } else LOGE("g_new failure"); @@ -426,23 +426,23 @@ static void __capture_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) *((char *)thandle.ptr + size) = 0; tbm_bo_unmap(bo); -capture_event_exit2: + capture_event_exit2: tbm_bo_unref(bo); } -capture_event_exit1: + capture_event_exit1: set_null_user_cb(cb_info, MUSE_PLAYER_EVENT_TYPE_CAPTURE); } -static void __seek_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) +static void __seek_cb_handler(callback_cb_info_s * cb_info, char *recvMsg) { muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_SEEK; - ((player_seek_completed_cb)cb_info->user_cb[ev])(cb_info->user_data[ev]); + ((player_seek_completed_cb) cb_info->user_cb[ev]) (cb_info->user_data[ev]); set_null_user_cb(cb_info, ev); } -static void __media_packet_video_frame_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) +static void __media_packet_video_frame_cb_handler(callback_cb_info_s * cb_info, char *recvMsg) { tbm_bo bo[4] = { NULL, }; tbm_key key[4] = { 0, }; @@ -512,7 +512,7 @@ static void __media_packet_video_frame_cb_handler(callback_cb_info_s *cb_info, c fin_data = g_new(_media_pkt_fin_data, 1); fin_data->remote_pkt = packet; fin_data->cb_info = cb_info; - ret = media_packet_create_from_tbm_surface(cb_info->pkt_fmt, tsurf, (media_packet_finalize_cb)_player_media_packet_finalize, (void *)fin_data, &pkt); + ret = media_packet_create_from_tbm_surface(cb_info->pkt_fmt, tsurf, (media_packet_finalize_cb) _player_media_packet_finalize, (void *)fin_data, &pkt); if (ret != MEDIA_PACKET_ERROR_NONE) { LOGE("media_packet_create_from_tbm_surface failed"); tbm_surface_destroy(tsurf); @@ -521,12 +521,12 @@ static void __media_packet_video_frame_cb_handler(callback_cb_info_s *cb_info, c } if (pkt) { if (pts != 0) { - ret = media_packet_set_pts(pkt, (uint64_t)pts); + ret = media_packet_set_pts(pkt, (uint64_t) pts); if (ret != MEDIA_PACKET_ERROR_NONE) LOGE("media_packet_set_pts failed"); } /* call media packet callback */ - ((player_media_packet_video_decoded_cb)cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME])(pkt, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME]); + ((player_media_packet_video_decoded_cb) cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME]) (pkt, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME]); } for (i = 0; i < bo_num; i++) { if (bo[i]) @@ -534,7 +534,7 @@ static void __media_packet_video_frame_cb_handler(callback_cb_info_s *cb_info, c } } -static void __audio_frame_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) +static void __audio_frame_cb_handler(callback_cb_info_s * cb_info, char *recvMsg) { unsigned char *data = NULL; unsigned int size = 0; @@ -565,7 +565,7 @@ static void __audio_frame_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) audio.data = data; audio.size = size; LOGD("user callback data %p, size %d", audio.data, audio.size); - ((player_audio_pcm_extraction_cb)cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME])(&audio, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME]); + ((player_audio_pcm_extraction_cb) cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME]) (&audio, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME]); g_free(data); } else LOGE("g_new failure"); @@ -579,43 +579,43 @@ static void __audio_frame_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) } } -static void __video_frame_render_error_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) +static void __video_frame_render_error_cb_handler(callback_cb_info_s * cb_info, char *recvMsg) { } -static void __pd_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) +static void __pd_cb_handler(callback_cb_info_s * cb_info, char *recvMsg) { int type; muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_PD; if (player_msg_get(type, recvMsg)) - ((player_pd_message_cb)cb_info->user_cb[ev])(type, cb_info->user_data[ev]); + ((player_pd_message_cb) cb_info->user_cb[ev]) (type, cb_info->user_data[ev]); } -static void __supported_audio_effect_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) +static void __supported_audio_effect_cb_handler(callback_cb_info_s * cb_info, char *recvMsg) { } -static void __supported_audio_effect_freset_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) +static void __supported_audio_effect_freset_cb_handler(callback_cb_info_s * cb_info, char *recvMsg) { } -static void __missed_plugin_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) +static void __missed_plugin_cb_handler(callback_cb_info_s * cb_info, char *recvMsg) { } -static void __media_stream_video_buffer_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) +static void __media_stream_video_buffer_cb_handler(callback_cb_info_s * cb_info, char *recvMsg) { /* player_media_stream_buffer_status_e status; */ int status; if (player_msg_get(status, recvMsg)) { ((player_media_stream_buffer_status_cb) - cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS])((player_media_stream_buffer_status_e)status, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS]); + cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS]) ((player_media_stream_buffer_status_e) status, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS]); } } -static void __media_stream_audio_buffer_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) +static void __media_stream_audio_buffer_cb_handler(callback_cb_info_s * cb_info, char *recvMsg) { /* player_media_stream_buffer_status_e status; */ int status; @@ -623,12 +623,12 @@ static void __media_stream_audio_buffer_cb_handler(callback_cb_info_s *cb_info, if (player_msg_get(status, recvMsg)) { ((player_media_stream_buffer_status_cb) cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS]) - ((player_media_stream_buffer_status_e)status, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS]); + ((player_media_stream_buffer_status_e) status, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS]); } } -static void __media_stream_video_buffer_cb_handler_ex(callback_cb_info_s *cb_info, char *recvMsg) +static void __media_stream_video_buffer_cb_handler_ex(callback_cb_info_s * cb_info, char *recvMsg) { /* player_media_stream_buffer_status_e status; */ int status; @@ -637,11 +637,11 @@ static void __media_stream_video_buffer_cb_handler_ex(callback_cb_info_s *cb_inf if (player_msg_get(status, recvMsg) && player_msg_get_type(bytes, recvMsg, INT64)) { ((player_media_stream_buffer_status_cb_ex) cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO]) - ((player_media_stream_buffer_status_e)status, bytes, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO]); + ((player_media_stream_buffer_status_e) status, bytes, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO]); } } -static void __media_stream_audio_buffer_cb_handler_ex(callback_cb_info_s *cb_info, char *recvMsg) +static void __media_stream_audio_buffer_cb_handler_ex(callback_cb_info_s * cb_info, char *recvMsg) { /* player_media_stream_buffer_status_e status; */ int status; @@ -650,12 +650,12 @@ static void __media_stream_audio_buffer_cb_handler_ex(callback_cb_info_s *cb_inf if (player_msg_get(status, recvMsg) && player_msg_get_type(bytes, recvMsg, INT64)) { ((player_media_stream_buffer_status_cb_ex) cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO]) - ((player_media_stream_buffer_status_e)status, bytes, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO]); + ((player_media_stream_buffer_status_e) status, bytes, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO]); } } -static void __media_stream_video_seek_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) +static void __media_stream_video_seek_cb_handler(callback_cb_info_s * cb_info, char *recvMsg) { unsigned long long offset; @@ -666,7 +666,7 @@ static void __media_stream_video_seek_cb_handler(callback_cb_info_s *cb_info, ch } } -static void __media_stream_audio_seek_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) +static void __media_stream_audio_seek_cb_handler(callback_cb_info_s * cb_info, char *recvMsg) { unsigned long long offset; @@ -677,7 +677,7 @@ static void __media_stream_audio_seek_cb_handler(callback_cb_info_s *cb_info, ch } } -static void __video_stream_changed_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) +static void __video_stream_changed_cb_handler(callback_cb_info_s * cb_info, char *recvMsg) { int width; int height; @@ -687,24 +687,24 @@ static void __video_stream_changed_cb_handler(callback_cb_info_s *cb_info, char && player_msg_get(height, recvMsg) && player_msg_get(fps, recvMsg) && player_msg_get(bit_rate, recvMsg)) { - ((player_video_stream_changed_cb)cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED]) + ((player_video_stream_changed_cb) cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED]) (width, height, fps, bit_rate, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED]); } } -static void (*_user_callbacks[MUSE_PLAYER_EVENT_TYPE_NUM])(callback_cb_info_s *cb_info, char *recvMsg) = { - __prepare_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_PREPARE */ +static void (*_user_callbacks[MUSE_PLAYER_EVENT_TYPE_NUM]) (callback_cb_info_s * cb_info, char *recvMsg) = { + __prepare_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_PREPARE */ __complete_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_COMPLETE */ __interrupt_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_INTERRUPT */ - __error_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_ERROR */ + __error_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_ERROR */ __buffering_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_BUFFERING */ __subtitle_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_SUBTITLE */ __capture_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_CAPTURE */ - __seek_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_SEEK*/ + __seek_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_SEEK */ __media_packet_video_frame_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME */ __audio_frame_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME */ __video_frame_render_error_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR */ - __pd_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_PD */ + __pd_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_PD */ __supported_audio_effect_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT */ __supported_audio_effect_freset_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT_PRESET */ __missed_plugin_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_MISSED_PLUGIN */ @@ -719,10 +719,10 @@ static void (*_user_callbacks[MUSE_PLAYER_EVENT_TYPE_NUM])(callback_cb_info_s *c __media_stream_video_seek_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_SEEK */ __media_stream_audio_seek_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_SEEK */ NULL, /* MUSE_PLAYER_EVENT_TYPE_AUDIO_STREAM_CHANGED */ - __video_stream_changed_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED */ + __video_stream_changed_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED */ }; -static void _player_event_job_function(_player_cb_data *data) +static void _player_event_job_function(_player_cb_data * data) { muse_player_event_e ev = data->int_data; if (data->cb_info->user_cb[ev]) @@ -757,7 +757,7 @@ static void *_player_event_queue_loop(void *param) while (1) { g_mutex_lock(&ev->qlock); - event_data = (_player_cb_data *)g_queue_pop_head(ev->queue); + event_data = (_player_cb_data *) g_queue_pop_head(ev->queue); g_mutex_unlock(&ev->qlock); if (event_data) _player_event_job_function(event_data); @@ -770,7 +770,7 @@ static void *_player_event_queue_loop(void *param) return NULL; } -static gboolean _player_event_queue_new(callback_cb_info_s *cb_info) +static gboolean _player_event_queue_new(callback_cb_info_s * cb_info) { g_return_val_if_fail(cb_info, FALSE); player_event_queue *ev = &cb_info->event_queue; @@ -782,7 +782,7 @@ static gboolean _player_event_queue_new(callback_cb_info_s *cb_info) g_mutex_init(&ev->mutex); g_cond_init(&ev->cond); ev->running = TRUE; - ev->thread = g_thread_new("cb_event_thread", _player_event_queue_loop, (gpointer)cb_info); + ev->thread = g_thread_new("cb_event_thread", _player_event_queue_loop, (gpointer) cb_info); g_return_val_if_fail(ev->thread, FALSE); LOGI("event queue thread %p", ev->thread); @@ -790,7 +790,7 @@ static gboolean _player_event_queue_new(callback_cb_info_s *cb_info) } -static void _player_event_queue_destroy(callback_cb_info_s *cb_info) +static void _player_event_queue_destroy(callback_cb_info_s * cb_info) { g_return_if_fail(cb_info); player_event_queue *ev = &cb_info->event_queue; @@ -807,7 +807,7 @@ static void _player_event_queue_destroy(callback_cb_info_s *cb_info) g_thread_unref(ev->thread); while (!g_queue_is_empty(ev->queue)) { - event_data = (_player_cb_data *)g_queue_pop_head(ev->queue); + event_data = (_player_cb_data *) g_queue_pop_head(ev->queue); if (event_data) { g_free(event_data->buf); g_free(event_data); @@ -820,17 +820,17 @@ static void _player_event_queue_destroy(callback_cb_info_s *cb_info) } -static void _player_event_queue_add(player_event_queue *ev, _player_cb_data *data) +static void _player_event_queue_add(player_event_queue * ev, _player_cb_data * data) { if (ev->running) { g_mutex_lock(&ev->qlock); - g_queue_push_tail(ev->queue, (gpointer)data); + g_queue_push_tail(ev->queue, (gpointer) data); g_mutex_unlock(&ev->qlock); g_cond_signal(&ev->cond); } } -static void _user_callback_handler(callback_cb_info_s *cb_info, muse_player_event_e event, char *buffer) +static void _user_callback_handler(callback_cb_info_s * cb_info, muse_player_event_e event, char *buffer) { LOGD("get event %d", event); @@ -850,7 +850,7 @@ static void _user_callback_handler(callback_cb_info_s *cb_info, muse_player_even } } -static void _add_ret_msg(muse_player_api_e api, callback_cb_info_s *cb_info, int offset, int parse_len) +static void _add_ret_msg(muse_player_api_e api, callback_cb_info_s * cb_info, int offset, int parse_len) { ret_msg_s *msg = NULL; ret_msg_s *last = cb_info->buff.retMsgHead; @@ -871,7 +871,7 @@ static void _add_ret_msg(muse_player_api_e api, callback_cb_info_s *cb_info, int LOGE("g_new failure"); } -static ret_msg_s *_get_ret_msg(muse_player_api_e api, callback_cb_info_s *cb_info) +static ret_msg_s *_get_ret_msg(muse_player_api_e api, callback_cb_info_s * cb_info) { ret_msg_s *msg = cb_info->buff.retMsgHead; ret_msg_s *prev = NULL; @@ -889,7 +889,7 @@ static ret_msg_s *_get_ret_msg(muse_player_api_e api, callback_cb_info_s *cb_inf return NULL; } -static void _notify_disconnected(callback_cb_info_s *cb_info) +static void _notify_disconnected(callback_cb_info_s * cb_info) { int code = PLAYER_ERROR_SERVICE_DISCONNECTED; muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_ERROR; @@ -978,12 +978,12 @@ static callback_cb_info_s *callback_new(gint sockfd) g_atomic_int_set(&cb_info->running, 1); cb_info->fd = sockfd; - cb_info->thread = g_thread_new("callback_thread", client_cb_handler, (gpointer)cb_info); + cb_info->thread = g_thread_new("callback_thread", client_cb_handler, (gpointer) cb_info); return cb_info; } -static void callback_destroy(callback_cb_info_s *cb_info) +static void callback_destroy(callback_cb_info_s * cb_info) { int i; g_return_if_fail(cb_info); @@ -1004,7 +1004,7 @@ static void callback_destroy(callback_cb_info_s *cb_info) g_free(cb_info); } -int client_get_api_timeout(player_cli_s *pc, muse_player_api_e api) +int client_get_api_timeout(player_cli_s * pc, muse_player_api_e api) { int timeout = 0; @@ -1027,7 +1027,7 @@ int client_get_api_timeout(player_cli_s *pc, muse_player_api_e api) return timeout; } -int client_wait_for_cb_return(muse_player_api_e api, callback_cb_info_s *cb_info, char **ret_buf, int time_out) +int client_wait_for_cb_return(muse_player_api_e api, callback_cb_info_s * cb_info, char **ret_buf, int time_out) { int ret = PLAYER_ERROR_NONE; gint64 end_time = g_get_monotonic_time() + time_out * G_TIME_SPAN_SECOND; @@ -1066,7 +1066,7 @@ int client_wait_for_cb_return(muse_player_api_e api, callback_cb_info_s *cb_info * Public Implementation */ -int player_create(player_h *player) +int player_create(player_h * player) { PLAYER_INSTANCE_CHECK(player); @@ -1110,13 +1110,13 @@ int player_create(player_h *player) ret = client_wait_for_cb_return(api, pc->cb_info, &ret_buf, CALLBACK_TIME_OUT); if (ret == PLAYER_ERROR_NONE) { intptr_t module_addr; - *player = (player_h)pc; + *player = (player_h) pc; if (player_msg_get_type(module_addr, ret_buf, POINTER)) { pc->cb_info->data_fd = muse_core_client_new_data_ch(); muse_core_send_client_addr(module_addr, pc->cb_info->data_fd); LOGD("Data channel fd %d, muse module addr %p", pc->cb_info->data_fd, module_addr); } - SERVER_TIMEOUT(pc) = MAX_SERVER_TIME_OUT; /* will be update after prepare phase. */ + SERVER_TIMEOUT(pc) = MAX_SERVER_TIME_OUT; /* will be update after prepare phase. */ } else goto ErrorExit; @@ -1125,7 +1125,7 @@ int player_create(player_h *player) g_free(ret_buf); return ret; -ErrorExit: + ErrorExit: if (pc && pc->cb_info) { if (pc->cb_info->event_queue.running) _player_event_queue_destroy(pc->cb_info); @@ -1144,14 +1144,14 @@ int player_destroy(player_h player) int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_DESTROY; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); player_msg_send(api, pc, ret_buf, ret); - if(player_unset_evas_object_cb(player) != MM_ERROR_NONE) + if (player_unset_evas_object_cb(player) != MM_ERROR_NONE) LOGW("fail to unset evas object callback"); if (CALLBACK_INFO(pc)) { @@ -1173,7 +1173,7 @@ int player_prepare_async(player_h player, player_prepared_cb callback, void *use 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); @@ -1203,7 +1203,7 @@ 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); @@ -1226,7 +1226,7 @@ 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); @@ -1255,7 +1255,7 @@ int player_set_uri(player_h player, const char *uri) 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); @@ -1272,7 +1272,7 @@ int player_set_memory_buffer(player_h player, const void *data, int size) 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; tbm_bo bo; tbm_bo_handle thandle; @@ -1312,14 +1312,14 @@ int player_set_memory_buffer(player_h player, const void *data, int size) if (ret == PLAYER_ERROR_NONE) { intptr_t bo_addr = 0; if (player_msg_get_type(bo_addr, ret_buf, POINTER)) - SERVER_TBM_BO(pc) = (intptr_t)bo_addr; + SERVER_TBM_BO(pc) = (intptr_t) bo_addr; } g_free(ret_buf); return ret; } -static int _player_deinit_memory_buffer(player_cli_s *pc) +static int _player_deinit_memory_buffer(player_cli_s * pc) { PLAYER_INSTANCE_CHECK(pc); int ret = PLAYER_ERROR_NONE; @@ -1335,13 +1335,13 @@ static int _player_deinit_memory_buffer(player_cli_s *pc) return ret; } -int player_get_state(player_h player, player_state_e *pstate) +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; muse_player_api_e api = MUSE_PLAYER_API_GET_STATE; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; int state; char *ret_buf = NULL; @@ -1365,7 +1365,7 @@ int player_set_volume(player_h player, float left, float right) PLAYER_CHECK_CONDITION(right >= 0 && right <= 1.0, 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); @@ -1382,7 +1382,7 @@ int player_get_volume(player_h player, float *pleft, float *pright) PLAYER_NULL_ARG_CHECK(pright); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_GET_VOLUME; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; double left = -1; double right = -1; char *ret_buf = NULL; @@ -1407,7 +1407,7 @@ int player_set_sound_type(player_h player, sound_type_e type) PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_SOUND_TYPE; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); @@ -1422,7 +1422,7 @@ int player_set_audio_policy_info(player_h player, sound_stream_info_h stream_inf PLAYER_INSTANCE_CHECK(player); muse_player_api_e api = MUSE_PLAYER_API_SET_AUDIO_POLICY_INFO; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); @@ -1431,8 +1431,8 @@ int player_set_audio_policy_info(player_h player, sound_stream_info_h stream_inf /* check if stream_info is valid */ int ret = __player_convert_error_code( - sound_manager_is_available_stream_information( - stream_info, NATIVE_API_PLAYER, &is_available), (char *)__FUNCTION__); + sound_manager_is_available_stream_information( + stream_info, NATIVE_API_PLAYER, &is_available), (char *)__FUNCTION__); if (ret == PLAYER_ERROR_NONE) { if (is_available == false) @@ -1459,7 +1459,7 @@ int player_set_audio_latency_mode(player_h player, audio_latency_mode_e latency_ 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); @@ -1469,13 +1469,13 @@ int player_set_audio_latency_mode(player_h player, audio_latency_mode_e latency_ return ret; } -int player_get_audio_latency_mode(player_h player, audio_latency_mode_e *platency_mode) +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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; int latency_mode = -1; @@ -1498,13 +1498,12 @@ 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); - if (INT_HANDLE(pc)) - { + if (INT_HANDLE(pc)) { ret = player_update_video_param(INT_HANDLE(pc)); if (ret != PLAYER_ERROR_NONE) return ret; @@ -1521,7 +1520,7 @@ 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); @@ -1539,7 +1538,7 @@ 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); @@ -1556,7 +1555,7 @@ int player_set_play_position(player_h player, int millisecond, bool accurate, pl int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_PLAY_POSITION; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; int pos = millisecond; @@ -1588,7 +1587,7 @@ int player_get_play_position(player_h player, int *millisecond) int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_GET_PLAY_POSITION; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; int pos; char *ret_buf = NULL; @@ -1610,7 +1609,7 @@ 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; int mute = (int)muted; @@ -1627,7 +1626,7 @@ int player_is_muted(player_h player, bool * muted) 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; int mute = -1; @@ -1648,7 +1647,7 @@ 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); @@ -1658,13 +1657,13 @@ int player_set_looping(player_h player, bool looping) return ret; } -int player_is_looping(player_h player, bool *plooping) +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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; int looping = 0; @@ -1685,7 +1684,7 @@ int player_get_duration(player_h player, int *pduration) PLAYER_NULL_ARG_CHECK(pduration); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_GET_DURATION; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; int duration = 0; @@ -1706,7 +1705,7 @@ int player_set_display(player_h player, player_display_type_e type, player_displ 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; Evas_Object *obj = NULL; const char *object_type = NULL; @@ -1724,7 +1723,7 @@ int player_set_display(player_h player, player_display_type_e type, player_displ LOGD("ENTER"); if (type != PLAYER_DISPLAY_TYPE_NONE) { - obj = (Evas_Object *)display; + obj = (Evas_Object *) display; if (!obj) return PLAYER_ERROR_INVALID_PARAMETER; @@ -1738,29 +1737,29 @@ int player_set_display(player_h player, player_display_type_e type, player_displ evas_object_geometry_get(obj, &wl_win.wl_window_x, &wl_win.wl_window_y, &wl_win.wl_window_width, &wl_win.wl_window_height); - if(player_set_evas_object_cb(player, obj) != MM_ERROR_NONE){ + if (player_set_evas_object_cb(player, obj) != MM_ERROR_NONE) { LOGW("fail to set evas object callback"); } wl_window = elm_win_wl_window_get(obj); - wl_surface = (struct wl_surface *) ecore_wl_window_surface_get(wl_window); + wl_surface = (struct wl_surface *)ecore_wl_window_surface_get(wl_window); /* get wl_display */ - wl_display = (struct wl_display *) ecore_wl_display_get(); + wl_display = (struct wl_display *)ecore_wl_display_get(); if (!pc->wlclient) { ret = _wlclient_create(&pc->wlclient); - if ( ret != MM_ERROR_NONE) { + if (ret != MM_ERROR_NONE) { LOGE("Wayland client create failure"); return ret; } } - if (wl_surface && wl_display){ - LOGD ("surface = %p, wl_display = %p", wl_surface, wl_display); - wl_surface_id = _wlclient_get_wl_window_wl_surface_id (pc->wlclient, wl_surface, wl_display); - LOGD ("wl_surface_id = %d", wl_surface_id); + if (wl_surface && wl_display) { + LOGD("surface = %p, wl_display = %p", wl_surface, wl_display); + wl_surface_id = _wlclient_get_wl_window_wl_surface_id(pc->wlclient, wl_surface, wl_display); + LOGD("wl_surface_id = %d", wl_surface_id); wl_win.wl_surface_id = wl_surface_id; - LOGD ("wl_win.wl_surface_id = %d", wl_win.wl_surface_id); + LOGD("wl_win.wl_surface_id = %d", wl_win.wl_surface_id); } if (pc->wlclient) { g_free(pc->wlclient); @@ -1781,15 +1780,15 @@ int player_set_display(player_h player, player_display_type_e type, player_displ evas_object_geometry_get(obj, &wl_win.wl_window_x, &wl_win.wl_window_y, &wl_win.wl_window_width, &wl_win.wl_window_height); - if(INT_HANDLE(pc)) { + if (INT_HANDLE(pc)) { LOGW("evas client already exists"); if (player_unset_evas_info(INT_HANDLE(pc)) != MM_ERROR_NONE) LOGW("fail to unset evas client"); } - if(player_set_evas_info(&INT_HANDLE(pc), obj) != MM_ERROR_NONE) { + if (player_set_evas_info(&INT_HANDLE(pc), obj) != MM_ERROR_NONE) { LOGW("fail to set evas client"); } - if(player_set_media_packet_video_frame_decoded_cb(player, decoded_callback_for_evas , (void*) INT_HANDLE(pc)) != PLAYER_ERROR_NONE) { + if (player_set_media_packet_video_frame_decoded_cb(player, decoded_callback_for_evas, (void *)INT_HANDLE(pc)) != PLAYER_ERROR_NONE) { LOGW("fail to set decoded callback"); } } @@ -1800,7 +1799,7 @@ int player_set_display(player_h player, player_display_type_e type, player_displ return PLAYER_ERROR_INVALID_PARAMETER; } #ifdef HAVE_WAYLAND - else { /* PLAYER_DISPLAY_TYPE_NONE */ + else { /* PLAYER_DISPLAY_TYPE_NONE */ LOGI("Wayland surface type is NONE"); wl_win.type = type; wl_win.wl_window_x = 0; @@ -1822,34 +1821,35 @@ int player_set_display_mode(player_h player, player_display_mode_e mode) PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_DISPLAY_MODE; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); - ret = player_set_geometry_evas_info (INT_HANDLE(pc), mode); + ret = player_set_geometry_evas_info(INT_HANDLE(pc), mode); + /* FIXME : devide server and client and consider which error code will be returned */ if (ret == PLAYER_ERROR_NONE) { return ret; - }/* FIXME : devide server and client and consider which error code will be returned */ + } player_msg_send1(api, pc, ret_buf, ret, INT, mode); g_free(ret_buf); return ret; } -int player_get_display_mode(player_h player, player_display_mode_e *pmode) +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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; int mode = -1; LOGD("ENTER"); - ret = player_get_geometry_evas_info (INT_HANDLE(pc), &mode); + ret = player_get_geometry_evas_info(INT_HANDLE(pc), &mode); if (ret == PLAYER_ERROR_NONE && mode != -1) { *pmode = (player_display_mode_e) mode; return ret; @@ -1871,7 +1871,7 @@ int player_set_playback_rate(player_h player, float rate) 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); @@ -1886,12 +1886,12 @@ int player_set_display_rotation(player_h player, player_display_rotation_e rotat PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_DISPLAY_ROTATION; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); - ret = player_set_rotation_evas_info (INT_HANDLE(pc), rotation); + ret = player_set_rotation_evas_info(INT_HANDLE(pc), rotation); if (ret == PLAYER_ERROR_NONE) { return ret; } @@ -1901,19 +1901,19 @@ int player_set_display_rotation(player_h player, player_display_rotation_e rotat return ret; } -int player_get_display_rotation(player_h player, player_display_rotation_e *protation) +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; + player_cli_s *pc = (player_cli_s *) player; muse_player_api_e api = MUSE_PLAYER_API_GET_DISPLAY_ROTATION; char *ret_buf = NULL; int rotation = -1; LOGD("ENTER"); - ret = player_get_rotation_evas_info (INT_HANDLE(pc), &rotation); + ret = player_get_rotation_evas_info(INT_HANDLE(pc), &rotation); if (ret == PLAYER_ERROR_NONE && rotation != -1) { *protation = (player_display_rotation_e) rotation; return ret; @@ -1933,7 +1933,7 @@ 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; + player_cli_s *pc = (player_cli_s *) player; muse_player_api_e api = MUSE_PLAYER_API_SET_DISPLAY_VISIBLE; char *ret_buf = NULL; @@ -1949,12 +1949,12 @@ int player_set_display_visible(player_h player, bool visible) return ret; } -int player_is_display_visible(player_h player, bool *pvisible) +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; + player_cli_s *pc = (player_cli_s *) player; muse_player_api_e api = MUSE_PLAYER_API_IS_DISPLAY_VISIBLE; char *ret_buf = NULL; int value = -1; @@ -1962,7 +1962,7 @@ int player_is_display_visible(player_h player, bool *pvisible) LOGD("ENTER"); - ret = player_get_visible_evas_info (INT_HANDLE(pc), &visible); + ret = player_get_visible_evas_info(INT_HANDLE(pc), &visible); if (ret == PLAYER_ERROR_NONE) { if (visible) *pvisible = TRUE; @@ -1991,9 +1991,9 @@ int player_get_content_info(player_h player, player_content_info_e key, char **p 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; - char value[MUSE_MSG_MAX_LENGTH] = {0, }; + char value[MUSE_MSG_MAX_LENGTH] = { 0, }; LOGD("ENTER"); @@ -2013,10 +2013,10 @@ int player_get_codec_info(player_h player, char **paudio_codec, char **pvideo_co PLAYER_NULL_ARG_CHECK(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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; - char video_codec[MUSE_MSG_MAX_LENGTH] = {0, }; - char audio_codec[MUSE_MSG_MAX_LENGTH] = {0, }; + char video_codec[MUSE_MSG_MAX_LENGTH] = { 0, }; + char audio_codec[MUSE_MSG_MAX_LENGTH] = { 0, }; LOGD("ENTER"); @@ -2039,7 +2039,7 @@ int player_get_audio_stream_info(player_h player, int *psample_rate, int *pchann PLAYER_NULL_ARG_CHECK(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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; int sample_rate = 0; int channel = 0; @@ -2067,7 +2067,7 @@ int player_get_video_stream_info(player_h player, int *pfps, int *pbit_rate) PLAYER_NULL_ARG_CHECK(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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; int fps = 0; int bit_rate = 0; @@ -2092,7 +2092,7 @@ int player_get_video_size(player_h player, int *pwidth, int *pheight) PLAYER_NULL_ARG_CHECK(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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; int width = 0; int height = 0; @@ -2117,7 +2117,7 @@ int player_get_album_art(player_h player, void **palbum_art, int *psize) PLAYER_NULL_ARG_CHECK(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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; char *album_art; int size = 0; @@ -2169,7 +2169,7 @@ int player_get_album_art(player_h player, void **palbum_art, int *psize) *psize = size; } -exit: + exit: g_free(ret_buf); return ret; @@ -2181,7 +2181,7 @@ int player_audio_effect_get_equalizer_bands_count(player_h player, int *pcount) 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; int count; @@ -2202,7 +2202,7 @@ int player_audio_effect_set_equalizer_all_bands(player_h player, int *band_level 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); @@ -2219,7 +2219,7 @@ int player_audio_effect_set_equalizer_band_level(player_h player, int index, int 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); @@ -2236,7 +2236,7 @@ int player_audio_effect_get_equalizer_band_level(player_h player, int index, int 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; int level; @@ -2258,7 +2258,7 @@ int player_audio_effect_get_equalizer_level_range(player_h player, int *pmin, in PLAYER_NULL_ARG_CHECK(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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; int min, max; @@ -2281,7 +2281,7 @@ int player_audio_effect_get_equalizer_band_frequency(player_h player, int index, 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; int frequency; @@ -2302,7 +2302,7 @@ int player_audio_effect_get_equalizer_band_frequency_range(player_h player, int 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; int range; @@ -2322,7 +2322,7 @@ 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); @@ -2338,7 +2338,7 @@ int player_audio_effect_equalizer_is_available(player_h player, bool * pavailabl 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; int available; @@ -2358,7 +2358,7 @@ 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); @@ -2373,7 +2373,7 @@ int player_set_subtitle_position_offset(player_h player, int millisecond) 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); @@ -2390,7 +2390,7 @@ int player_set_progressive_download_path(player_h player, const char *path) PLAYER_NULL_ARG_CHECK(path); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_PROGRESSIVE_DOWNLOAD_PATH; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); @@ -2407,7 +2407,7 @@ int player_get_progressive_download_status(player_h player, unsigned long *pcurr PLAYER_NULL_ARG_CHECK(ptotal_size); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_GET_PROGRESSIVE_DOWNLOAD_STATUS; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; unsigned long current, total_size; @@ -2431,7 +2431,7 @@ int player_capture_video(player_h player, player_video_captured_cb callback, voi 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); @@ -2460,7 +2460,7 @@ int player_set_streaming_cookie(player_h player, const char *cookie, int size) 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); @@ -2477,7 +2477,7 @@ int player_set_streaming_user_agent(player_h player, const char *user_agent, int 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); @@ -2494,7 +2494,7 @@ int player_get_streaming_download_progress(player_h player, int *pstart, int *pc PLAYER_NULL_ARG_CHECK(pcurrent); 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; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; int start, current; @@ -2567,7 +2567,7 @@ int player_set_progressive_download_message_cb(player_h player, player_pd_messag PLAYER_INSTANCE_CHECK(player); PLAYER_NULL_ARG_CHECK(callback); int ret = PLAYER_ERROR_NONE; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK; char *ret_buf = NULL; muse_player_event_e type = MUSE_PLAYER_EVENT_TYPE_PD; @@ -2591,7 +2591,7 @@ int player_unset_progressive_download_message_cb(player_h player) { PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK; char *ret_buf = NULL; muse_player_event_e type = MUSE_PLAYER_EVENT_TYPE_PD; @@ -2613,7 +2613,7 @@ int player_set_media_packet_video_frame_decoded_cb(player_h player, player_media PLAYER_INSTANCE_CHECK(player); PLAYER_NULL_ARG_CHECK(callback); int ret = PLAYER_ERROR_NONE; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK; char *ret_buf = NULL; muse_player_event_e type = MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME; @@ -2637,7 +2637,7 @@ int player_unset_media_packet_video_frame_decoded_cb(player_h player) { PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK; char *ret_buf = NULL; muse_player_event_e type = MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME; @@ -2658,7 +2658,7 @@ int player_set_video_stream_changed_cb(player_h player, player_video_stream_chan PLAYER_INSTANCE_CHECK(player); PLAYER_NULL_ARG_CHECK(callback); int ret = PLAYER_ERROR_NONE; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK; char *ret_buf = NULL; muse_player_event_e type = MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED; @@ -2682,7 +2682,7 @@ int player_unset_video_stream_changed_cb(player_h player) { PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK; char *ret_buf = NULL; muse_player_event_e type = MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED; @@ -2703,7 +2703,7 @@ int player_set_media_stream_buffer_status_cb(player_h player, player_stream_type PLAYER_INSTANCE_CHECK(player); PLAYER_NULL_ARG_CHECK(callback); int ret = PLAYER_ERROR_NONE; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK; char *ret_buf = NULL; muse_player_event_e type; @@ -2736,7 +2736,7 @@ int player_unset_media_stream_buffer_status_cb(player_h player, player_stream_ty { PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK; char *ret_buf = NULL; muse_player_event_e type; @@ -2766,7 +2766,7 @@ int player_set_media_stream_seek_cb(player_h player, player_stream_type_e stream PLAYER_INSTANCE_CHECK(player); PLAYER_NULL_ARG_CHECK(callback); int ret = PLAYER_ERROR_NONE; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK; char *ret_buf = NULL; muse_player_event_e type; @@ -2799,7 +2799,7 @@ int player_unset_media_stream_seek_cb(player_h player, player_stream_type_e stre { PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK; char *ret_buf = NULL; muse_player_event_e type; @@ -2830,7 +2830,7 @@ 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; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; muse_player_api_e api = MUSE_PLAYER_API_PUSH_MEDIA_STREAM; char *ret_buf = NULL; player_push_media_msg_type push_media; @@ -2900,7 +2900,7 @@ int player_push_media_stream(player_h player, media_packet_h packet) LOGD("ret_buf %s", ret_buf); #ifdef __UN_USED -push_media_error: + push_media_error: if (push_media.buf_type == PUSH_MEDIA_BUF_TYPE_TBM) tbm_bo_unref(bo); #endif @@ -2914,7 +2914,7 @@ int player_set_media_stream_info(player_h player, player_stream_type_e type, med 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; + player_cli_s *pc = (player_cli_s *) player; muse_player_api_e api = MUSE_PLAYER_API_SET_MEDIA_STREAM_INFO; char *ret_buf = NULL; media_format_mimetype_e mimetype; @@ -2946,7 +2946,7 @@ int player_set_media_stream_buffer_max_size(player_h player, player_stream_type_ { int ret = PLAYER_ERROR_NONE; PLAYER_INSTANCE_CHECK(player); - player_cli_s *pc = (player_cli_s *)player; + 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; @@ -2963,7 +2963,7 @@ int player_get_media_stream_buffer_max_size(player_h player, player_stream_type_ int ret = PLAYER_ERROR_NONE; PLAYER_INSTANCE_CHECK(player); PLAYER_NULL_ARG_CHECK(pmax_size); - player_cli_s *pc = (player_cli_s *)player; + 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; @@ -2983,7 +2983,7 @@ int player_set_media_stream_buffer_min_threshold(player_h player, player_stream_ { int ret = PLAYER_ERROR_NONE; PLAYER_INSTANCE_CHECK(player); - player_cli_s *pc = (player_cli_s *)player; + 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; @@ -3000,7 +3000,7 @@ int player_get_media_stream_buffer_min_threshold(player_h player, player_stream_ int ret = PLAYER_ERROR_NONE; PLAYER_INSTANCE_CHECK(player); PLAYER_NULL_ARG_CHECK(ppercent); - player_cli_s *pc = (player_cli_s *)player; + 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; @@ -3022,7 +3022,7 @@ int player_get_track_count(player_h player, player_stream_type_e type, int *pcou PLAYER_INSTANCE_CHECK(player); PLAYER_NULL_ARG_CHECK(pcount); int ret = PLAYER_ERROR_NONE; - player_cli_s *pc = (player_cli_s *)player; + 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; @@ -3044,7 +3044,7 @@ int player_get_current_track(player_h player, player_stream_type_e type, int *pi PLAYER_INSTANCE_CHECK(player); PLAYER_NULL_ARG_CHECK(pindex); int ret = PLAYER_ERROR_NONE; - player_cli_s *pc = (player_cli_s *)player; + 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; @@ -3065,7 +3065,7 @@ 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; + player_cli_s *pc = (player_cli_s *) player; muse_player_api_e api = MUSE_PLAYER_API_SELECT_TRACK; char *ret_buf = NULL; @@ -3082,10 +3082,10 @@ int player_get_track_language_code(player_h player, player_stream_type_e type, i PLAYER_INSTANCE_CHECK(player); PLAYER_NULL_ARG_CHECK(pcode); int ret = PLAYER_ERROR_NONE; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; muse_player_api_e api = MUSE_PLAYER_API_GET_TRACK_LANGUAGE_CODE; char *ret_buf = NULL; - char code[MUSE_MSG_MAX_LENGTH] = {0, }; + char code[MUSE_MSG_MAX_LENGTH] = { 0, }; const int code_len = 2; LOGD("ENTER"); diff --git a/src/player_internal.c b/src/player_internal.c index c255ca8..dec427c 100644 --- a/src/player_internal.c +++ b/src/player_internal.c @@ -35,7 +35,7 @@ int player_set_pcm_extraction_mode(player_h player, bool sync, player_audio_pcm_ PLAYER_NULL_ARG_CHECK(callback); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_PCM_EXTRACTION_MODE; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; muse_player_event_e event = MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME; @@ -58,7 +58,7 @@ int player_set_pcm_spec(player_h player, const char *format, int samplerate, int PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_PCM_SPEC; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); @@ -74,7 +74,7 @@ int player_set_streaming_playback_rate(player_h player, float rate) PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_STREAMING_PLAYBACK_RATE; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; LOGD("ENTER"); @@ -89,7 +89,7 @@ int player_set_media_stream_buffer_status_cb_ex(player_h player, player_stream_t PLAYER_INSTANCE_CHECK(player); PLAYER_NULL_ARG_CHECK(callback); int ret = PLAYER_ERROR_NONE; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK; char *ret_buf = NULL; muse_player_event_e type; @@ -118,7 +118,7 @@ int player_set_media_stream_buffer_status_cb_ex(player_h player, player_stream_t return ret; } -static void set_null_user_cb(callback_cb_info_s *cb_info, muse_player_event_e event) +static void set_null_user_cb(callback_cb_info_s * cb_info, muse_player_event_e event) { if (cb_info && event < MUSE_PLAYER_EVENT_TYPE_NUM) { cb_info->user_cb[event] = NULL; @@ -126,7 +126,7 @@ static void set_null_user_cb(callback_cb_info_s *cb_info, muse_player_event_e ev } } -static void set_null_user_cb_lock(callback_cb_info_s *cb_info, muse_player_event_e event) +static void set_null_user_cb_lock(callback_cb_info_s * cb_info, muse_player_event_e event) { bool lock = g_thread_self() != cb_info->event_queue.thread; @@ -143,7 +143,7 @@ int player_unset_media_stream_buffer_status_cb_ex(player_h player, player_stream { PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK; char *ret_buf = NULL; muse_player_event_e type; @@ -168,10 +168,9 @@ int player_unset_media_stream_buffer_status_cb_ex(player_h player, player_stream return ret; } -static void __evas_resize_cb (void *data, Evas *e, Evas_Object *eo, void *event_info) +static void __evas_resize_cb(void *data, Evas * e, Evas_Object * eo, void *event_info) { - - player_cli_s *pc = (player_cli_s *)data; + player_cli_s *pc = (player_cli_s *) data; wl_win_msg_type wl_win; char *wl_win_msg = (char *)&wl_win; char *ret_buf = NULL; @@ -179,15 +178,15 @@ static void __evas_resize_cb (void *data, Evas *e, Evas_Object *eo, void *event_ Ecore_Evas *ecore_evas; muse_player_api_e api = MUSE_PLAYER_API_RESIZE_VIDEO_RENDER_RECT; int ret = PLAYER_ERROR_NONE; - LOGD("ret =%d",ret); + LOGD("ret =%d", ret); evas_object_geometry_get(eo, &wl_win.wl_window_x, &wl_win.wl_window_y, &wl_win.wl_window_width, &wl_win.wl_window_height); - ecore_evas = ecore_evas_ecore_evas_get(e); + ecore_evas = ecore_evas_ecore_evas_get(e); rotation = ecore_evas_rotation_get(ecore_evas); - LOGD("rotation(%d)",rotation); + LOGD("rotation(%d)", rotation); LOGD("get window rectangle: x(%d) y(%d) width(%d) height(%d)", wl_win.wl_window_x, wl_win.wl_window_y, wl_win.wl_window_width, wl_win.wl_window_height); - if (rotation == 270 || rotation == 90){ + if (rotation == 270 || rotation == 90) { LOGD("swap w and h"); int temp; temp = wl_win.wl_window_width; @@ -196,8 +195,8 @@ static void __evas_resize_cb (void *data, Evas *e, Evas_Object *eo, void *event_ } LOGD("get window rectangle: x(%d) y(%d) width(%d) height(%d)", wl_win.wl_window_x, wl_win.wl_window_y, wl_win.wl_window_width, wl_win.wl_window_height); - wl_win.type = 0; /*init but not use */ - wl_win.wl_surface_id = 0; /*init but not use */ + wl_win.type = 0; /*init but not use */ + wl_win.wl_surface_id = 0; /*init but not use */ player_msg_send_array(api, pc, ret_buf, ret, wl_win_msg, sizeof(wl_win_msg_type), sizeof(char)); @@ -206,13 +205,13 @@ static void __evas_resize_cb (void *data, Evas *e, Evas_Object *eo, void *event_ } -static void __evas_del_cb (void *data, Evas *e, Evas_Object *eo, void *event_info) +static void __evas_del_cb(void *data, Evas * e, Evas_Object * eo, void *event_info) { - player_cli_s *pc = (player_cli_s *)data; + player_cli_s *pc = (player_cli_s *) data; - evas_object_event_callback_del (eo, EVAS_CALLBACK_RESIZE, __evas_resize_cb); - evas_object_event_callback_del (eo, EVAS_CALLBACK_DEL, __evas_del_cb); + evas_object_event_callback_del(eo, EVAS_CALLBACK_RESIZE, __evas_resize_cb); + evas_object_event_callback_del(eo, EVAS_CALLBACK_DEL, __evas_del_cb); LOGD("evas callback del %p", eo); pc->have_evas_callback = FALSE; @@ -226,15 +225,15 @@ int player_set_evas_object_cb(player_h player, Evas_Object * eo) PLAYER_INSTANCE_CHECK(player); return_val_if_fail(eo != NULL, MM_ERROR_INVALID_ARGUMENT); - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; - if(pc->have_evas_callback && pc->eo == eo) { + if (pc->have_evas_callback && pc->eo == eo) { LOGW("evas object had callback already %p", pc->eo); return MM_ERROR_UNKNOWN; } pc->eo = eo; - evas_object_event_callback_add (eo, EVAS_CALLBACK_RESIZE, __evas_resize_cb, player); - evas_object_event_callback_add (eo, EVAS_CALLBACK_DEL, __evas_del_cb, player); + evas_object_event_callback_add(eo, EVAS_CALLBACK_RESIZE, __evas_resize_cb, player); + evas_object_event_callback_add(eo, EVAS_CALLBACK_DEL, __evas_del_cb, player); LOGD("evas callback add %p", pc->eo); pc->have_evas_callback = TRUE; @@ -244,11 +243,11 @@ int player_set_evas_object_cb(player_h player, Evas_Object * eo) int player_unset_evas_object_cb(player_h player) { PLAYER_INSTANCE_CHECK(player); - player_cli_s *pc = (player_cli_s *)player; + player_cli_s *pc = (player_cli_s *) player; return_val_if_fail(pc->eo != NULL, MM_ERROR_INVALID_ARGUMENT); - evas_object_event_callback_del (pc->eo, EVAS_CALLBACK_RESIZE, __evas_resize_cb); - evas_object_event_callback_del (pc->eo, EVAS_CALLBACK_DEL, __evas_del_cb); + evas_object_event_callback_del(pc->eo, EVAS_CALLBACK_RESIZE, __evas_resize_cb); + evas_object_event_callback_del(pc->eo, EVAS_CALLBACK_DEL, __evas_del_cb); LOGD("evas callback del %p", pc->eo); pc->eo = NULL; pc->have_evas_callback = FALSE; diff --git a/src/player_wayland.c b/src/player_wayland.c index 0acb78f..6e009eb 100644 --- a/src/player_wayland.c +++ b/src/player_wayland.c @@ -28,9 +28,7 @@ #endif #define LOG_TAG "TIZEN_N_PLAYER" - - -#define goto_if_fail(expr,label) \ +#define goto_if_fail(expr, label) \ { \ if (!(expr)) { \ debug_error(" failed [%s]\n", #expr); \ @@ -40,111 +38,104 @@ void handle_resource_id(void *data, struct tizen_resource *tizen_resource, uint32_t id) { - unsigned int *wl_surface_id = data; + unsigned int *wl_surface_id = data; - *wl_surface_id = id; + *wl_surface_id = id; - LOGD("[CLIENT] got wl_surface_id(%d) from server\n", id); + LOGD("[CLIENT] got wl_surface_id(%d) from server\n", id); } -static const struct tizen_resource_listener tz_resource_listener = -{ - handle_resource_id, +static const struct tizen_resource_listener tz_resource_listener = { + handle_resource_id, }; -static void -handle_global(void *data, struct wl_registry *registry, - uint32_t name, const char *interface, uint32_t version) +static void handle_global(void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version) { - return_if_fail (data != NULL); + return_if_fail(data != NULL); wl_client *wlclient = data; - if (strcmp(interface, "tizen_surface") == 0) - { + if (strcmp(interface, "tizen_surface") == 0) { LOGD("binding tizen_surface"); - wlclient->tz_surface = wl_registry_bind(registry, name, &tizen_surface_interface, version); - return_if_fail (wlclient->tz_surface != NULL); - } + wlclient->tz_surface = wl_registry_bind(registry, name, &tizen_surface_interface, version); + return_if_fail(wlclient->tz_surface != NULL); + } } -static const struct wl_registry_listener registry_listener = -{ - handle_global, +static const struct wl_registry_listener registry_listener = { + handle_global, }; -int _wlclient_create (wl_client ** wlclient) +int _wlclient_create(wl_client ** wlclient) { - wl_client *ptr = NULL; - - ptr = g_malloc0 (sizeof (wl_client)); - if (!ptr) { - LOGE ("Cannot allocate memory for wlclient\n"); - goto ERROR; - } else { - *wlclient = ptr; - LOGD ("Success create wlclient(%p)", *wlclient); - } - return MM_ERROR_NONE; - -ERROR: - *wlclient = NULL; - return MM_ERROR_PLAYER_NO_FREE_SPACE; + wl_client *ptr = NULL; + + ptr = g_malloc0(sizeof(wl_client)); + if (!ptr) { + LOGE("Cannot allocate memory for wlclient\n"); + goto ERROR; + } else { + *wlclient = ptr; + LOGD("Success create wlclient(%p)", *wlclient); + } + return MM_ERROR_NONE; + + ERROR: + *wlclient = NULL; + return MM_ERROR_PLAYER_NO_FREE_SPACE; } - -int _wlclient_get_wl_window_wl_surface_id (wl_client * wlclient, struct wl_surface *surface, struct wl_display *display) +int _wlclient_get_wl_window_wl_surface_id(wl_client * wlclient, struct wl_surface *surface, struct wl_display *display) { - goto_if_fail (wlclient != NULL, failed); - goto_if_fail (surface != NULL, failed); - goto_if_fail (display != NULL, failed); + goto_if_fail(wlclient != NULL, failed); + goto_if_fail(surface != NULL, failed); + goto_if_fail(display != NULL, failed); unsigned int wl_surface_id = 0; wlclient->display = display; - goto_if_fail (wlclient->display != NULL, failed); + goto_if_fail(wlclient->display != NULL, failed); - wlclient->registry = wl_display_get_registry(wlclient->display); - goto_if_fail (wlclient->registry != NULL, failed); + wlclient->registry = wl_display_get_registry(wlclient->display); + goto_if_fail(wlclient->registry != NULL, failed); - wl_registry_add_listener(wlclient->registry, ®istry_listener, wlclient); - wl_display_dispatch(wlclient->display); - wl_display_roundtrip(wlclient->display); + wl_registry_add_listener(wlclient->registry, ®istry_listener, wlclient); + wl_display_dispatch(wlclient->display); + wl_display_roundtrip(wlclient->display); /* check global objects */ - goto_if_fail (wlclient->tz_surface != NULL, failed); + goto_if_fail(wlclient->tz_surface != NULL, failed); /* Get wl_surface_id which is unique in a entire systemw. */ wlclient->tz_resource = tizen_surface_get_tizen_resource(wlclient->tz_surface, surface); - goto_if_fail (wlclient->tz_resource != NULL, failed); + goto_if_fail(wlclient->tz_resource != NULL, failed); - tizen_resource_add_listener(wlclient->tz_resource, &tz_resource_listener, &wl_surface_id); + tizen_resource_add_listener(wlclient->tz_resource, &tz_resource_listener, &wl_surface_id); wl_display_roundtrip(wlclient->display); - goto_if_fail (wl_surface_id > 0, failed); + goto_if_fail(wl_surface_id > 0, failed); _wlclient_finalize(wlclient); return wl_surface_id; -failed: - LOGE ("Failed to get wl_surface_id"); + failed: + LOGE("Failed to get wl_surface_id"); - return 0; + return 0; } -void _wlclient_finalize (wl_client * wlclient) +void _wlclient_finalize(wl_client * wlclient) { - LOGD ("start finalize wlclient"); - return_if_fail (wlclient != NULL) + LOGD("start finalize wlclient"); + return_if_fail(wlclient != NULL) - if (wlclient->tz_surface) + if (wlclient->tz_surface) tizen_surface_destroy(wlclient->tz_surface); if (wlclient->tz_resource) tizen_resource_destroy(wlclient->tz_resource); - /* destroy registry */ - if (wlclient->registry) - wl_registry_destroy(wlclient->registry); - return; + /* destroy registry */ + if (wlclient->registry) + wl_registry_destroy(wlclient->registry); + return; } - diff --git a/test/player_es_push_test.c b/test/player_es_push_test.c index 037d32d..9185d85 100644 --- a/test/player_es_push_test.c +++ b/test/player_es_push_test.c @@ -52,7 +52,7 @@ static int sps_len, pps_len; #define LOG_TAG "PLAYER_TEST" static int app_create(void *data); -static int app_reset(bundle *b, void *data); +static int app_reset(bundle * b, void *data); static int app_resume(void *data); static int app_pause(void *data); static int app_terminate(void *data); @@ -75,7 +75,7 @@ typedef struct appdata { pthread_t feeding_thread_id; } appdata_s; -static void win_delete_request_cb(void *data, Evas_Object *obj, void *event_info) +static void win_delete_request_cb(void *data, Evas_Object * obj, void *event_info) { elm_exit(); } @@ -101,7 +101,7 @@ static Eina_Bool keydown_cb(void *data, int type, void *event) return ECORE_CALLBACK_PASS_ON; } -static void win_del(void *data, Evas_Object *obj, void *event) +static void win_del(void *data, Evas_Object * obj, void *event) { elm_exit(); } @@ -128,7 +128,7 @@ static Evas_Object *create_win(const char *name) return eo; } -static Evas_Object *create_render_rect(Evas_Object *pParent) +static Evas_Object *create_render_rect(Evas_Object * pParent) { if (!pParent) return NULL; @@ -147,7 +147,7 @@ static Evas_Object *create_render_rect(Evas_Object *pParent) return pObj; } -static void create_base_gui(appdata_s *ad) +static void create_base_gui(appdata_s * ad) { /* Enable GLES Backened */ elm_config_accel_preference_set("opengl"); @@ -190,7 +190,7 @@ static int app_create(void *data) static int app_pause(void *data) { /* Take necessary actions when application becomes invisible. */ - appdata_s *ad = (appdata_s *)data; + appdata_s *ad = (appdata_s *) data; int ret = PLAYER_ERROR_NONE; LOGD("start"); @@ -253,7 +253,7 @@ static int app_resume(void *data) static void _player_prepared_cb(void *user_data) { int ret = PLAYER_ERROR_NONE; - appdata_s *ad = (appdata_s *)user_data; + appdata_s *ad = (appdata_s *) user_data; LOGD("prepared"); @@ -281,7 +281,7 @@ int bytestream2nalunit(FILE * fd, unsigned char *nal) result = fread(buffer, 1, read_size, fd); if (result != read_size) - return -1; + return -1; val = buffer[0]; while (!val) { @@ -351,7 +351,7 @@ int bytestream2nalunit(FILE * fd, unsigned char *nal) return nal_length; } -static void feed_eos_data(appdata_s *appdata) +static void feed_eos_data(appdata_s * appdata) { appdata_s *ad = appdata; @@ -372,7 +372,7 @@ static void feed_eos_data(appdata_s *appdata) return; } -static bool feed_video_data(appdata_s *appdata) +static bool feed_video_data(appdata_s * appdata) { bool ret = FALSE; int read = 0; @@ -390,7 +390,7 @@ static bool feed_video_data(appdata_s *appdata) goto ERROR; } - if (media_packet_set_pts(ad->video_pkt, (uint64_t)pts) != MEDIA_PACKET_ERROR_NONE) { + if (media_packet_set_pts(ad->video_pkt, (uint64_t) pts) != MEDIA_PACKET_ERROR_NONE) { LOGE("media_packet_set_pts failed\n"); goto ERROR; } @@ -419,7 +419,7 @@ static bool feed_video_data(appdata_s *appdata) goto ERROR; } - if (media_packet_set_buffer_size(ad->video_pkt, (uint64_t)read) != MEDIA_PACKET_ERROR_NONE) { + if (media_packet_set_buffer_size(ad->video_pkt, (uint64_t) read) != MEDIA_PACKET_ERROR_NONE) { LOGE("media_packet_set_buffer_size failed\n"); goto ERROR; } @@ -429,7 +429,7 @@ static bool feed_video_data(appdata_s *appdata) pts += ES_DEFAULT_VIDEO_PTS_OFFSET; ret = TRUE; -ERROR: + ERROR: /* destroy media packet after use */ media_packet_destroy(ad->video_pkt); ad->video_pkt = NULL; @@ -438,7 +438,7 @@ ERROR: static void feed_video_data_thread_func(void *data) { - appdata_s *ad = (appdata_s *)data; + appdata_s *ad = (appdata_s *) data; while (TRUE) { static int frame_count = 0; @@ -457,8 +457,7 @@ void _video_buffer_status_cb_ex(player_media_stream_buffer_status_e status, unsi { if (status == PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN) { LOGE("video buffer is underrun state, current level byte = %llu", bytes); - } - else if (status == PLAYER_MEDIA_STREAM_BUFFER_OVERFLOW) { + } else if (status == PLAYER_MEDIA_STREAM_BUFFER_OVERFLOW) { LOGE("video buffer is overrun state, current level byte = %llu", bytes); } } @@ -467,8 +466,7 @@ void _audio_buffer_status_cb_ex(player_media_stream_buffer_status_e status, unsi { if (status == PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN) { LOGE("audio buffer is underrun state, current level byte = %llu", bytes); - } - else if (status == PLAYER_MEDIA_STREAM_BUFFER_OVERFLOW) { + } else if (status == PLAYER_MEDIA_STREAM_BUFFER_OVERFLOW) { LOGE("audio buffer is overrun state, current level byte = %llu", bytes); } } @@ -483,10 +481,10 @@ void _audio_seek_data_cb(unsigned long long offset, void *user_data) LOGE("seek offset of audio is %llu", offset); } -static int app_reset(bundle *b, void *data) +static int app_reset(bundle * b, void *data) { /* Take necessary actions when application becomes visible. */ - appdata_s *ad = (appdata_s *)data; + appdata_s *ad = (appdata_s *) data; int ret = PLAYER_ERROR_NONE; LOGD("start"); @@ -520,7 +518,7 @@ static int app_reset(bundle *b, void *data) media_format_set_video_width(ad->video_fmt, ES_DEFAULT_VIDEO_FORMAT_WIDTH); media_format_set_video_height(ad->video_fmt, ES_DEFAULT_VIDEO_FORMAT_HEIGHT); - player_set_media_stream_buffer_max_size(ad->player_handle, PLAYER_STREAM_TYPE_VIDEO, (unsigned long long)3*1024*1024); + player_set_media_stream_buffer_max_size(ad->player_handle, PLAYER_STREAM_TYPE_VIDEO, (unsigned long long)3 * 1024 * 1024); player_set_media_stream_buffer_min_threshold(ad->player_handle, PLAYER_STREAM_TYPE_VIDEO, 50); ret = player_set_media_stream_buffer_status_cb_ex(ad->player_handle, PLAYER_STREAM_TYPE_VIDEO, _video_buffer_status_cb_ex, (void *)ad); @@ -560,7 +558,7 @@ static int app_reset(bundle *b, void *data) return 0; -FAILED: + FAILED: if (ad->player_handle) { player_destroy(ad->player_handle); ad->player_handle = NULL; @@ -572,7 +570,7 @@ FAILED: static int app_terminate(void *data) { /* Release all resources. */ - appdata_s *ad = (appdata_s *)data; + appdata_s *ad = (appdata_s *) data; LOGD("start"); @@ -591,7 +589,7 @@ static int app_terminate(void *data) int main(int argc, char *argv[]) { int ret = 0; - static appdata_s ad = {0, }; + static appdata_s ad = { 0, }; LOGD("start"); diff --git a/test/player_test.c b/test/player_test.c index 63c1f6d..35fcc62 100644 --- a/test/player_test.c +++ b/test/player_test.c @@ -102,7 +102,7 @@ static Evas_Object *g_xid; static Evas_Object *g_external_xid; #endif static Evas_Object *selected_xid; -static Evas_Object *g_eo[MAX_HANDLE] = {0, }; +static Evas_Object *g_eo[MAX_HANDLE] = { 0, }; static int g_current_surface_type = PLAYER_DISPLAY_TYPE_OVERLAY; @@ -121,7 +121,7 @@ typedef struct { } appdata; static appdata ad; -static player_h g_player[MAX_HANDLE] = {0, }; +static player_h g_player[MAX_HANDLE] = { 0, }; int g_handle_num = 1; int g_menu_state = CURRENT_STATUS_MAINMENU; @@ -129,7 +129,7 @@ char g_file_list[9][256]; gboolean quit_pushing; sound_stream_info_h g_stream_info_h = NULL; -static void win_del(void *data, Evas_Object *obj, void *event) +static void win_del(void *data, Evas_Object * obj, void *event) { elm_exit(); } @@ -158,7 +158,7 @@ static Evas_Object *create_win(const char *name) return eo; } -static Evas_Object *create_image_object(Evas_Object *eo_parent) +static Evas_Object *create_image_object(Evas_Object * eo_parent) { if (!eo_parent) return NULL; @@ -171,7 +171,7 @@ static Evas_Object *create_image_object(Evas_Object *eo_parent) return eo; } -void create_render_rect_and_bg(Evas_Object *win) +void create_render_rect_and_bg(Evas_Object * win) { if (!win) { g_print("no win"); @@ -197,6 +197,7 @@ void create_render_rect_and_bg(Evas_Object *win) evas_object_show(rect); evas_object_show(win); } + #ifdef _ACTIVATE_EOM_ int eom_get_output_id(const char *output_name) { @@ -237,7 +238,7 @@ int eom_get_output_id(const char *output_name) static void eom_notify_cb_output_add(eom_output_id output_id, void *user_data) { - appdata *info = (appdata *)user_data; + appdata *info = (appdata *) user_data; if (info->hdmi_output_id != output_id) { g_print("[eom] OUTPUT ADDED. SKIP. my output ID is %d\n", info->hdmi_output_id); @@ -260,7 +261,7 @@ static void eom_notify_cb_output_add(eom_output_id output_id, void *user_data) static void eom_notify_cb_output_remove(eom_output_id output_id, void *user_data) { - appdata *info = (appdata *)user_data; + appdata *info = (appdata *) user_data; player_state_e state; if (info->hdmi_output_id != output_id) { @@ -295,7 +296,7 @@ static void eom_notify_cb_output_remove(eom_output_id output_id, void *user_data static void eom_notify_cb_mode_changed(eom_output_id output_id, void *user_data) { - appdata *info = (appdata *)user_data; + appdata *info = (appdata *) user_data; eom_output_mode_e mode = EOM_OUTPUT_MODE_NONE; if (info->hdmi_output_id != output_id) { @@ -309,7 +310,7 @@ static void eom_notify_cb_mode_changed(eom_output_id output_id, void *user_data) static void eom_notify_cb_attribute_changed(eom_output_id output_id, void *user_data) { - appdata *info = (appdata *)user_data; + appdata *info = (appdata *) user_data; eom_output_attribute_e attribute = EOM_OUTPUT_ATTRIBUTE_NONE; eom_output_attribute_state_e state = EOM_OUTPUT_ATTRIBUTE_STATE_NONE; @@ -497,7 +498,7 @@ static void prepared_cb(void *user_data) g_print("[Player_Test] prepared_cb!!!!\n"); } -static void _audio_frame_decoded_cb_ex(player_audio_raw_data_s *audio_raw_frame, void *user_data) +static void _audio_frame_decoded_cb_ex(player_audio_raw_data_s * audio_raw_frame, void *user_data) { player_audio_raw_data_s *audio_raw = audio_raw_frame; @@ -508,9 +509,9 @@ static void _audio_frame_decoded_cb_ex(player_audio_raw_data_s *audio_raw_frame, #ifdef DUMP_OUTBUF if (audio_raw->channel_mask == 1 && fp_out1) - fwrite((guint8 *)audio_raw->data, 1, audio_raw->size, fp_out1); + fwrite((guint8 *) audio_raw->data, 1, audio_raw->size, fp_out1); else if (audio_raw->channel_mask == 2 && fp_out2) - fwrite((guint8 *)audio_raw->data, 1, audio_raw->size, fp_out2); + fwrite((guint8 *) audio_raw->data, 1, audio_raw->size, fp_out2); #endif } @@ -571,7 +572,7 @@ static int _save(unsigned char *src, int length) { /* unlink(CAPTUERD_IMAGE_SAVE_PATH); */ FILE *fp; - char filename[256] = {0, }; + char filename[256] = { 0, }; static int WRITE_COUNT = 0; /* gchar *filename = CAPTUERD_IMAGE_SAVE_PATH; */ snprintf(filename, 256, "/tmp/IMAGE_client%d", WRITE_COUNT); @@ -671,7 +672,7 @@ static void player_set_memory_buffer_test() file = g_mapped_file_new(g_uri, FALSE, NULL); file_size = g_mapped_file_get_length(file); - g_media_mem = (guint8 *)g_mapped_file_get_contents(file); + g_media_mem = (guint8 *) g_mapped_file_get_contents(file); int ret = player_set_memory_buffer(g_player[0], (void *)g_media_mem, file_size); g_print("player_set_memory_buffer ret : %d\n", ret); @@ -720,7 +721,7 @@ static void buffer_need_video_data_cb(unsigned int size, void *user_data) fp = fopen(fname, "rb"); if (fp) { - buff_ptr = (guint8 *)g_malloc0(1048576); + buff_ptr = (guint8 *) g_malloc0(1048576); if (!buff_ptr) { g_print("no free space\n"); fclose(fp); @@ -748,10 +749,10 @@ static void buffer_need_video_data_cb(unsigned int size, void *user_data) if (media_packet_get_buffer_data_ptr(g_video_pkt, &src) != MEDIA_PACKET_ERROR_NONE) goto EXIT; - if (media_packet_set_pts(g_video_pkt, (uint64_t)pts) != MEDIA_PACKET_ERROR_NONE) + if (media_packet_set_pts(g_video_pkt, (uint64_t) pts) != MEDIA_PACKET_ERROR_NONE) goto EXIT; - if (media_packet_set_buffer_size(g_video_pkt, (uint64_t)real_read_len) != MEDIA_PACKET_ERROR_NONE) + if (media_packet_set_buffer_size(g_video_pkt, (uint64_t) real_read_len) != MEDIA_PACKET_ERROR_NONE) goto EXIT; memcpy(src, buff_ptr, real_read_len); @@ -760,7 +761,7 @@ static void buffer_need_video_data_cb(unsigned int size, void *user_data) player_push_media_stream(g_player[0], g_video_pkt); #endif -EXIT: + EXIT: if (buff_ptr) { g_free(buff_ptr); buff_ptr = NULL; @@ -794,7 +795,7 @@ static void buffer_need_audio_data_cb(unsigned int size, void *user_data) fp = fopen(fname, "rb"); if (fp) { - buff_ptr = (guint8 *)g_malloc0(1048576); + buff_ptr = (guint8 *) g_malloc0(1048576); if (!buff_ptr) { g_print("no free space\n"); fclose(fp); @@ -822,10 +823,10 @@ static void buffer_need_audio_data_cb(unsigned int size, void *user_data) if (media_packet_get_buffer_data_ptr(g_audio_pkt, &src) != MEDIA_PACKET_ERROR_NONE) goto EXIT; - if (media_packet_set_pts(g_audio_pkt, (uint64_t)audio_pts) != MEDIA_PACKET_ERROR_NONE) + if (media_packet_set_pts(g_audio_pkt, (uint64_t) audio_pts) != MEDIA_PACKET_ERROR_NONE) goto EXIT; - if (media_packet_set_buffer_size(g_audio_pkt, (uint64_t)real_read_len) != MEDIA_PACKET_ERROR_NONE) + if (media_packet_set_buffer_size(g_audio_pkt, (uint64_t) real_read_len) != MEDIA_PACKET_ERROR_NONE) goto EXIT; memcpy(src, buff_ptr, real_read_len); @@ -835,7 +836,7 @@ static void buffer_need_audio_data_cb(unsigned int size, void *user_data) #endif audio_pts += audio_dur; -EXIT: + EXIT: if (buff_ptr) { g_free(buff_ptr); buff_ptr = NULL; @@ -864,7 +865,7 @@ static void set_content_info(bool is_push_mode) media_format_set_audio_samplerate(g_audio_fmt, 48000); /* player_set_media_stream_info(g_player[0], PLAYER_STREAM_TYPE_AUDIO, g_audio_fmt); */ #if 0 - /* video_info->mime = g_strdup("video/mpeg"); */ /* CODEC_ID_MPEG4VIDEO */ + /* video_info->mime = g_strdup("video/mpeg"); *//* CODEC_ID_MPEG4VIDEO */ video_info->width = 640; video_info->height = 272; video_info->version = 4; @@ -878,7 +879,7 @@ static void set_content_info(bool is_push_mode) /* audio--aac--StarWars.mp4 */ /* audio_info->mime = g_strdup("audio/mpeg"); */ /* audio_info->version = 2; */ - /* audio_info->user_info = 0; */ /* raw */ + /* audio_info->user_info = 0; *//* raw */ #endif #ifdef _ES_PULL_ @@ -1242,16 +1243,16 @@ static void set_sound_stream_info(int type) return; } while (!(ret = sound_manager_get_next_device(device_list, &device))) { - if ((ret = sound_manager_get_device_type (device, &device_type))) { + if ((ret = sound_manager_get_device_type(device, &device_type))) { g_print("failed to sound_manager_get_device_type(), ret(0x%x)\n", ret); goto END; } if (device_type == SOUND_DEVICE_BLUETOOTH || device_type == SOUND_DEVICE_USB_AUDIO) { - if ((ret = sound_manager_add_device_for_stream_routing (g_stream_info_h, device))) { + if ((ret = sound_manager_add_device_for_stream_routing(g_stream_info_h, device))) { g_print("failed to sound_manager_add_device_for_stream_routing(), ret(0x%x)\n", ret); goto END; } - if ((ret = sound_manager_apply_stream_routing (g_stream_info_h))) { + if ((ret = sound_manager_apply_stream_routing(g_stream_info_h))) { g_print("failed to sound_manager_apply_stream_routing(), ret(0x%x)\n", ret); goto END; } @@ -1269,7 +1270,7 @@ static void set_sound_stream_info(int type) else g_print("set stream information(%p) success", g_stream_info_h); -END: + END: if (device_list) sound_manager_free_device_list(device_list); return; @@ -1401,7 +1402,7 @@ static void set_looping(bool looping) } } -static void get_looping(bool *looping) +static void get_looping(bool * looping) { player_is_looping(g_player[0], looping); g_print(" ==> [Player_Test] looping = %d\n", *looping); @@ -1539,7 +1540,7 @@ static void set_display_visible(bool visible) g_print("failed to player_set_x11_display_visible\n"); } -static void get_display_visible(bool *visible) +static void get_display_visible(bool * visible) { player_is_display_visible(g_player[0], visible); g_print(" ==> [Player_Test] X11 Display Visible = %d\n", *visible); @@ -2221,7 +2222,7 @@ static void interpret(char *cmd) g_timeout_add(100, timeout_menu_display, 0); } -gboolean input(GIOChannel *channel) +gboolean input(GIOChannel * channel) { gchar buf[MAX_STRING_LEN]; gsize read; @@ -2240,7 +2241,7 @@ int main(int argc, char *argv[]) GIOChannel *stdin_channel; stdin_channel = g_io_channel_unix_new(0); g_io_channel_set_flags(stdin_channel, G_IO_FLAG_NONBLOCK, NULL); - g_io_add_watch(stdin_channel, G_IO_IN, (GIOFunc)input, NULL); + g_io_add_watch(stdin_channel, G_IO_IN, (GIOFunc) input, NULL); displaymenu(); memset(&ad, 0x0, sizeof(appdata));