diff options
author | Jaekyu Park <jk7744.park@samsung.com> | 2016-05-27 17:06:08 +0900 |
---|---|---|
committer | Jaekyu Park <jk7744.park@samsung.com> | 2016-05-27 17:06:08 +0900 |
commit | adffba47cd84dd78eea46d218b4a6ed96aeba133 (patch) | |
tree | 504adc7712f9ca8b12cc5fbc62494beb498a23b5 | |
parent | d9aecd3988a9180d0911c0052a1d18e25c4345ef (diff) | |
download | media-controller-tizen_2.4.tar.gz media-controller-tizen_2.4.tar.bz2 media-controller-tizen_2.4.zip |
Tizen 2.4 SDK Rev6 Releasesubmit/tizen_2.4/20160530.023130accepted/tizen/2.4/mobile/20160530.220252tizen_2.4accepted/tizen_2.4_mobile
-rwxr-xr-x | doc/media_controller_doc.h | 8 | ||||
-rwxr-xr-x | include/media_controller_client.h | 4 | ||||
-rwxr-xr-x | include/media_controller_server.h | 10 | ||||
-rwxr-xr-x | packaging/capi-media-controller.spec | 2 | ||||
-rwxr-xr-x | src/media_controller_client.c | 2 | ||||
-rwxr-xr-x | src/media_controller_ipc.c | 26 | ||||
-rwxr-xr-x | src/media_controller_util.c | 22 | ||||
-rwxr-xr-x | svc/media_controller_db_util.c | 2 | ||||
-rwxr-xr-x | svc/media_controller_svc.c | 10 |
9 files changed, 59 insertions, 27 deletions
diff --git a/doc/media_controller_doc.h b/doc/media_controller_doc.h index c1cbdbf..c66a94f 100755 --- a/doc/media_controller_doc.h +++ b/doc/media_controller_doc.h @@ -39,7 +39,7 @@ * * @section CAPI_MEDIA_CONTROLLER_OVERVIEW Overview * The @ref CAPI_MEDIA_CONTROLLER_MODULE API provides a set of functions to an effective communication between the server and the client for delivering the latest server information. It helps to transfer the information like playback info, shuffle mode, or the metadata of the latest server. \n - * To programming the interface, first, create a handler via #mc_client_create() or #mc_server_create(). And then, the client request the necessary information to the server by using #mc_client_set_server_update_callback(), or #mc_client_set_playback_update_callback(). The server provides the requested information to the client by the callback. + * To programming the interface, first, create a handler via #mc_client_create() or #mc_server_create(). And then, the client request the necessary information to the server by using #mc_client_set_server_update_cb(), or #mc_client_set_playback_update_cb(). The server provides the requested information to the client by the callback. * */ @@ -51,7 +51,7 @@ * \#include <media_controller_server.h> * * @section CAPI_MEDIA_CONTROLLER_SERVER_MODULE_OVERVIEW Overview -* The @ref CAPI_MEDIA_CONTROLLER_SERVER_MODULE API allows you to send the playback info(#mc_server_set_playback_state(), #mc_server_set_playback_position), or the metadata(#mc_server_set_metadata()). and to receive the custom command(#mc_server_set_command_received_callback()), to update the status information on the latest server(#mc_server_update_playback_info, #mc_server_update_metadata), or to create/destroy the handle(#mc_server_create()/#mc_server_destroy()). \n +* The @ref CAPI_MEDIA_CONTROLLER_SERVER_MODULE API allows you to send the playback info(#mc_server_set_playback_state(), #mc_server_set_playback_position), or the metadata(#mc_server_set_metadata()). and to receive the custom command(#mc_server_set_custom_command_received_cb()), to update the status information on the latest server(#mc_server_update_playback_info, #mc_server_update_metadata), or to create/destroy the handle(#mc_server_create()/#mc_server_destroy()). \n * */ @@ -63,8 +63,8 @@ * \#include <media_controller_client.h> * * @section CAPI_MEDIA_CONTROLLER_CLIENT_MODULE_OVERVIEW Overview -* The @ref CAPI_MEDIA_CONTROLLER_CLIENT_MODULE API allows you to check the activated server status(#mc_client_set_server_update_callback()), the playback info(#mc_client_set_playback_update_callback()), or the metadata(#mc_client_set_metadata_update_callback()). to send the custom command(#mc_client_send_custom_command()), to create/destroy the handle(#mc_client_create()/#mc_client_destroy()). \n -* If there is no the activated server, you can get the latest server information by using #mc_client_get_latest_server_info(), #mc_client_get_latest_playback_info(), or etc. +* The @ref CAPI_MEDIA_CONTROLLER_CLIENT_MODULE API allows you to check the activated server status(#mc_client_set_server_update_cb()), the playback info(#mc_client_set_playback_update_cb()), or the metadata(#mc_client_set_metadata_update_cb()). to send the custom command(#mc_client_send_custom_command()), to create/destroy the handle(#mc_client_create()/#mc_client_destroy()). \n +* If there is no the activated server, you can get the latest server information by using #mc_client_get_latest_server_info(). * */ diff --git a/include/media_controller_client.h b/include/media_controller_client.h index 3ddaf87..202e3b4 100755 --- a/include/media_controller_client.h +++ b/include/media_controller_client.h @@ -611,7 +611,7 @@ int mc_client_get_server_metadata(mc_client_h client, const char *server_name, m * @privlevel public * @privilege %http://tizen.org/privilege/mediacontroller.client * - * @remarks If there is no shuffle mode info, return value is SHUFFLE_MODE_OFF. + * @remarks If there is no shuffle mode info, return value is MC_SHUFFLE_MODE_OFF. * * @param [in] client The handle to the media controller client * @param [in] server_name The app_id of the server to requesting @@ -632,7 +632,7 @@ int mc_client_get_server_shuffle_mode(mc_client_h client, const char *server_nam * @privlevel public * @privilege %http://tizen.org/privilege/mediacontroller.client * - * @remarks If there is no repeat mode info, return value is REPEAT_MODE_OFF. + * @remarks If there is no repeat mode info, return value is MC_REPEAT_MODE_OFF. * * @param [in] client The handle to the media controller client * @param [in] server_name The app_id of the server to requesting diff --git a/include/media_controller_server.h b/include/media_controller_server.h index e5cff43..c8f3375 100755 --- a/include/media_controller_server.h +++ b/include/media_controller_server.h @@ -44,9 +44,9 @@ extern "C" { * @param[in] state The received playback state * @param[in] user_data The user data passed from the mc_server_set_playback_state_command_received_cb() fuction * - * @pre mc_server_set_playback_state_received_cb() + * @pre mc_server_set_playback_state_command_received_cb() * - * @see mc_server_set_playback_state_received_cb() + * @see mc_server_set_playback_state_command_received_cb() */ typedef void (*mc_server_playback_state_command_received_cb)(const char* client_name, mc_playback_states_e state, void *user_data); @@ -62,9 +62,9 @@ typedef void (*mc_server_playback_state_command_received_cb)(const char* client_ * @param[in] data The extra data * @param[in] user_data The user data passed from the mc_server_set_custom_command_received_cb() fuction * - * @pre mc_server_set_command_received_cb() + * @pre mc_server_set_custom_command_received_cb() * - * @see mc_server_set_command_received_cb() + * @see mc_server_set_custom_command_received_cb() */ typedef void (*mc_server_custom_command_received_cb)(const char* client_name, const char *command, bundle *data, void *user_data); @@ -331,7 +331,7 @@ int mc_server_unset_custom_command_received_cb(mc_server_h server); * @retval #MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED Permission denied * @pre Create a media controller server handle by calling mc_server_create(). - * @pre mc_server_command_received_cb() + * @pre mc_server_set_custom_command_received_cb() * @see mc_server_create() * @see mc_server_destroy() */ diff --git a/packaging/capi-media-controller.spec b/packaging/capi-media-controller.spec index b0e6c9c..e50ab2d 100755 --- a/packaging/capi-media-controller.spec +++ b/packaging/capi-media-controller.spec @@ -1,6 +1,6 @@ Name: capi-media-controller Summary: Multimedia Controller for player application -Version: 0.0.16 +Version: 0.0.18 Release: 1 Group: System/Libraries License: Apache-2.0 diff --git a/src/media_controller_client.c b/src/media_controller_client.c index 5959506..4f9dced 100755 --- a/src/media_controller_client.c +++ b/src/media_controller_client.c @@ -59,7 +59,7 @@ static void __client_playback_cb(const char *interface_name, const char *signal_ mc_retm_if(params == NULL, "invalid playback data"); playback->state = atoi(params[1]); - playback->position = atol(params[2]); + playback->position = (unsigned long long)atol(params[2]); callback(params[0], (mc_playback_h) playback, reciever->user_data); diff --git a/src/media_controller_ipc.c b/src/media_controller_ipc.c index 9c8beb0..5138ebd 100755 --- a/src/media_controller_ipc.c +++ b/src/media_controller_ipc.c @@ -23,16 +23,12 @@ #define MC_SVC_NAME "mediacontroller" /* This checks if service daemon is running */ -static gboolean __is_service_activated() +static int __is_service_activated() { - gboolean ret = FALSE; + int ret = MEDIA_CONTROLLER_ERROR_NONE; ret = mc_ipc_send_message_to_server(MC_MSG_SERVER_CONNECTION, MC_SERVER_CONNECTION_MSG); - if (ret != MEDIA_CONTROLLER_ERROR_NONE) { - mc_error("Failed to mc_ipc_send_message_to_server [%d]", ret); - return FALSE; - } - return TRUE; + return ret; } static char *__make_key_for_map(const char *main_key, const char *sub_key) @@ -383,9 +379,14 @@ int mc_ipc_service_connect(void) struct sockaddr_un serv_addr; unsigned int retrycount = 0; - if (__is_service_activated() == TRUE) { + ret = __is_service_activated(); + + if (ret == MEDIA_CONTROLLER_ERROR_NONE) { mc_debug("service is already running!"); - return MEDIA_CONTROLLER_ERROR_NONE; + return ret; + } else if (ret == MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED) { + mc_debug("Permission deny!"); + return ret; } /*Create Socket*/ @@ -402,12 +403,15 @@ int mc_ipc_service_connect(void) if (connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) { mc_stderror("connect error"); mc_ipc_delete_client_socket(&sock_info); - return MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; + if (errno == EACCES) + return MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED; + else + return MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; } mc_ipc_delete_client_socket(&sock_info); - while((__is_service_activated() == FALSE) && (retrycount++ < MAX_WAIT_COUNT)) { + while((__is_service_activated() != MEDIA_CONTROLLER_ERROR_NONE) && (retrycount++ < MAX_WAIT_COUNT)) { MC_MILLISEC_SLEEP(200); mc_error("[No-Error] retry count [%d]", retrycount); } diff --git a/src/media_controller_util.c b/src/media_controller_util.c index f55f7bd..1c06132 100755 --- a/src/media_controller_util.c +++ b/src/media_controller_util.c @@ -86,7 +86,12 @@ char *mc_util_get_interface_name(const char *type, const char *name) temp = g_strdup_printf("%s.%s.%s", MC_DBUS_INTERFACE_PREFIX, type, name); _mc_util_check_valid_name(temp, &interface_name); - MC_SAFE_FREE(temp); + + if (temp) { + g_free(temp); + temp = NULL; + } + return interface_name; } @@ -106,7 +111,10 @@ int mc_util_make_filter_interface_name(const char *prefix, const char *filter, c _mc_util_check_valid_name(temp, interface_name); - MC_SAFE_FREE(temp); + if (temp) { + g_free(temp); + temp = NULL; + } return MEDIA_CONTROLLER_ERROR_NONE; } @@ -128,6 +136,11 @@ int mc_util_set_command_availabe(const char *name, const char *command_type, con ret = mc_ipc_send_message_to_server(MC_MSG_CLIENT_SET, message); + if (message) { + g_free(message); + message = NULL; + } + return ret; } @@ -148,5 +161,10 @@ int mc_util_get_command_availabe(const char *name, const char *command_type, con ret = mc_ipc_send_message_to_server(MC_MSG_CLIENT_GET, message); + if (message) { + g_free(message); + message = NULL; + } + return ret; } diff --git a/svc/media_controller_db_util.c b/svc/media_controller_db_util.c index b504309..9d67aa8 100755 --- a/svc/media_controller_db_util.c +++ b/svc/media_controller_db_util.c @@ -53,7 +53,7 @@ static int __mc_foreach_table_list(void *handle, GList **list) mc_debug("table_name: %s", table_name); if (MC_STRING_VALID(table_name)) { - (*list) = g_list_append((*list), strdup(table_name)); + (*list) = g_list_append((*list), table_name); } } diff --git a/svc/media_controller_svc.c b/svc/media_controller_svc.c index e943ccf..71b910b 100755 --- a/svc/media_controller_svc.c +++ b/svc/media_controller_svc.c @@ -139,6 +139,16 @@ gboolean _mc_read_service_request_tcp_socket(GIOChannel *src, GIOCondition condi } } } else if (recv_msg.msg_type == MC_MSG_SERVER_CONNECTION) { + ret = __mc_privilege_ask(client_sock, "mediacontroller::svc", "w"); + if (ret != MEDIA_CONTROLLER_ERROR_NONE) { + ret = __mc_privilege_ask(client_sock, "mediacontroller::svc", "r"); + if (ret != MEDIA_CONTROLLER_ERROR_NONE) { + mc_error("permission is denied!"); + + send_msg = MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED; + goto ERROR; + } + } if((recv_msg.msg_size > 0) && (recv_msg.msg != NULL)) { if (strncmp(recv_msg.msg, MC_SERVER_CONNECTION_MSG, recv_msg.msg_size) == 0) { if(g_connection_cnt == -1) |