* @privlevel public
* @privilege %http://tizen.org/privilege/mediacontroller.client
*
- * @remarks The @a ability should be released using @c mc_playback_ability_destroy().
+ * @remarks The @a ability should be released using @c mc_playback_ability_destroy().\n
+ * If the media controller server is deactivated, this function will return #MC_ABILITY_SUPPORTED_UNDECIDED.\n
*
* @param[in] client The handle of the media controller client
* @param[in] server_name The app_id of the media controller server
* @privilege %http://tizen.org/privilege/mediacontroller.client
*
* @remarks If the server's ability support is not set, the result value is #MC_ABILITY_SUPPORTED_UNDECIDED. \n
- * It means you can send the corresponding command to the server, but it's not guaranteed that the server can handle it.
+ * It means you can send the corresponding command to the server, but it's not guaranteed that the server can handle it. \n
+ * If the media controller server is deactivated, this function will return #MC_ABILITY_SUPPORTED_UNDECIDED.
*
* @param[in] client The handle of the media controller client
* @param[in] server_name The app_id of the media controller server
* @privilege %http://tizen.org/privilege/mediacontroller.client
*
* @remarks If a display mode is not present in the @a supported_modes, then the server's support for this mode is #MC_ABILITY_SUPPORTED_NO and you can't send the corresponding command to the server. \n
+ * If the media controller server is deactivated, this function will return #MC_ABILITY_SUPPORTED_NO.
*
* @param[in] client The handle of the media controller client
* @param[in] server_name The app_id of the media controller server
* @privilege %http://tizen.org/privilege/mediacontroller.client
*
* @remarks If a display rotation is not present in the @a supported_rotations, then the server's support for this mode is #MC_ABILITY_SUPPORTED_NO and you can't send the corresponding command to the server. \n
+ * If the media controller server is deactivated, this function will return #MC_ABILITY_SUPPORTED_NO.
*
* @param[in] client The handle of the media controller client
* @param[in] server_name The app_id of the media controller server
return MEDIA_CONTROLLER_ERROR_NONE;
}
-static void __set_default_ability_support(mc_server_h server)
-{
- int ret = MEDIA_CONTROLLER_ERROR_NONE;
-
- ret = __mc_server_update_ability(server, MC_ABILITY_SUBTITLES, MC_ABILITY_SUPPORTED_NO, TRUE);
- if (ret != MEDIA_CONTROLLER_ERROR_NONE)
- mc_error("fail to set subtitles ability [%d]", ret);
-
- ret = __mc_server_update_ability(server, MC_ABILITY_360_MODE, MC_ABILITY_SUPPORTED_NO, TRUE);
- if (ret != MEDIA_CONTROLLER_ERROR_NONE)
- mc_error("fail to set 360 mode ability [%d]", ret);
-
- ret = __mc_server_update_ability(server, (DISPLAY_MODE_ABILITY + MC_DISPLAY_MODE_LETTER_BOX), MC_ABILITY_SUPPORTED_NO, FALSE);
- ret = __mc_server_update_ability(server, (DISPLAY_MODE_ABILITY + MC_DISPLAY_MODE_ORIGIN_SIZE), MC_ABILITY_SUPPORTED_NO, FALSE);
- ret = __mc_server_update_ability(server, (DISPLAY_MODE_ABILITY + MC_DISPLAY_MODE_FULL_SCREEN), MC_ABILITY_SUPPORTED_NO, FALSE);
- ret = __mc_server_update_ability(server, (DISPLAY_MODE_ABILITY + MC_DISPLAY_MODE_CROPPED_FULL), MC_ABILITY_SUPPORTED_NO, TRUE);
- if (ret != MEDIA_CONTROLLER_ERROR_NONE)
- mc_error("fail to set display mode ability [%d]", ret);
-
- ret = __mc_server_update_ability(server, (DISPLAY_ROTATION_ABILITY + MC_DISPLAY_ROTATION_NONE), MC_ABILITY_SUPPORTED_NO, FALSE);
- ret = __mc_server_update_ability(server, (DISPLAY_ROTATION_ABILITY + MC_DISPLAY_ROTATION_90), MC_ABILITY_SUPPORTED_NO, FALSE);
- ret = __mc_server_update_ability(server, (DISPLAY_ROTATION_ABILITY + MC_DISPLAY_ROTATION_180), MC_ABILITY_SUPPORTED_NO, FALSE);
- ret = __mc_server_update_ability(server, (DISPLAY_ROTATION_ABILITY + MC_DISPLAY_ROTATION_270), MC_ABILITY_SUPPORTED_NO, TRUE);
- if (ret != MEDIA_CONTROLLER_ERROR_NONE)
- mc_error("fail to set display rotation ability [%d]", ret);
-}
-
int mc_server_create(mc_server_h *server)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
return ret;
}
- __set_default_ability_support(mc_server);
-
- /* Set default value of display*/
- ret = _mc_db_update_server_attribute(mc_server->server_name, MC_DB_CMD_UPDATE_DISPLAY_MODE, MC_DISPLAY_MODE_FULL_SCREEN);
- if (ret != MEDIA_CONTROLLER_ERROR_NONE)
- mc_error("fail to set display mode [%d]", ret);
-
- ret = _mc_db_update_server_attribute(mc_server->server_name, MC_DB_CMD_UPDATE_DISPLAY_ROTATION, MC_DISPLAY_ROTATION_NONE);
+ /* Get default abilities from database */
+ ret = _mc_db_get_ability(mc_server->db_handle, mc_server->server_name, &mc_server->basic_ability.decided, &mc_server->basic_ability.supported);
if (ret != MEDIA_CONTROLLER_ERROR_NONE)
- mc_error("fail to set display rotation [%d]", ret);
+ mc_error("fail to get ability [%d]", ret);
ret = __mc_server_send_message(mc_server, MC_DBUS_UPDATE_INTERFACE, MC_DBUS_SIGNAL_NAME_SERVER_STATE, MC_SERVER_STATE_ACTIVATE, 0, NULL);
if (ret != MEDIA_CONTROLLER_ERROR_NONE)
return is_latest;
}
+static void __mc_db_set_default_ability(unsigned long long *ability_decided, unsigned long long *ability_supported)
+{
+ unsigned long long val = 1;
+
+ /*
+ * Please set the default ability in this function.
+ *
+ * If 'ability_decieded' is set to 1, the default is #MC_ABILITY_SUPPORTED_NO.
+ * Ohterwise, the default is #MC_ABILITY_SUPPORTED_UNDECIDED.
+ * If both 'ability_decieded' and 'ability_supported' are set to 1,
+ * the default is #MC_ABILITY_SUPPORTED_YES.
+ */
+
+ /* Set default to MC_ABILITY_SUPPORTED_UNDECIDED for all abilities */
+ *ability_decided = 0;
+ *ability_supported = 0;
+
+ /* Change default to MC_ABILITY_SUPPORTED_NO */
+ *ability_decided |= (val << MC_ABILITY_SUBTITLES);
+ *ability_decided |= (val << MC_ABILITY_360_MODE);
+
+ *ability_decided |= (val << (DISPLAY_MODE_ABILITY + MC_DISPLAY_MODE_LETTER_BOX));
+ *ability_decided |= (val << (DISPLAY_MODE_ABILITY + MC_DISPLAY_MODE_ORIGIN_SIZE));
+ *ability_decided |= (val << (DISPLAY_MODE_ABILITY + MC_DISPLAY_MODE_FULL_SCREEN));
+ *ability_decided |= (val << (DISPLAY_MODE_ABILITY + MC_DISPLAY_MODE_CROPPED_FULL));
+
+ *ability_decided |= (val << (DISPLAY_ROTATION_ABILITY + MC_DISPLAY_ROTATION_NONE));
+ *ability_decided |= (val << (DISPLAY_ROTATION_ABILITY + MC_DISPLAY_ROTATION_90));
+ *ability_decided |= (val << (DISPLAY_ROTATION_ABILITY + MC_DISPLAY_ROTATION_180));
+ *ability_decided |= (val << (DISPLAY_ROTATION_ABILITY + MC_DISPLAY_ROTATION_270));
+
+ /* Change default to MC_ABILITY_SUPPORTED_YES */
+ /* ex) *ability_supported |= (val << MC_ABILITY_SUBTITLES); */
+}
+
static int __mc_update_latest_server_state_to_vconf(mc_server_state_e server_state, mc_playback_states_e playback_state)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
char *sql_str = NULL;
+ unsigned long long ability_decided = 0, ability_supported = 0;
mc_retvm_if(!handle, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "invalid handle");
/* Update DB */
- sql_str = sqlite3_mprintf("UPDATE %q SET server_state=%d, playback_state=%d WHERE name IN (SELECT name FROM %q)",
- MC_DB_TABLE_SERVER_INFO, server_state, playback_state, MC_DB_TABLE_LATEST_SERVER);
+ if (server_state == MC_SERVER_STATE_DEACTIVATE) {
+ __mc_db_set_default_ability(&ability_decided, &ability_supported);
+ sql_str = sqlite3_mprintf("UPDATE %q SET server_state=%d, playback_state=%d, \
+ display_mode=%d, display_rotation=%d, ability_decided=%llu, ability_supported=%llu \
+ WHERE name IN (SELECT name FROM %q)",
+ MC_DB_TABLE_SERVER_INFO, server_state, playback_state,
+ MC_DISPLAY_MODE_FULL_SCREEN, MC_DISPLAY_ROTATION_NONE, ability_decided, ability_supported,
+ MC_DB_TABLE_LATEST_SERVER);
+ } else {
+ sql_str = sqlite3_mprintf("UPDATE %q SET server_state=%d, playback_state=%d WHERE name IN (SELECT name FROM %q)",
+ MC_DB_TABLE_SERVER_INFO, server_state, playback_state, MC_DB_TABLE_LATEST_SERVER);
+ }
ret = mc_db_util_update_db(handle, sql_str);
SQLITE3_SAFE_FREE(sql_str);
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
char *sql_str = NULL;
+ unsigned long long ability_decided = 0, ability_supported = 0;
mc_retvm_if(handle == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Handle is NULL");
SQLITE3_SAFE_FREE(sql_str);
mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "create app_list table failed [%d]", ret);
+ __mc_db_set_default_ability(&ability_decided, &ability_supported);
+
sql_str = sqlite3_mprintf("CREATE TABLE IF NOT EXISTS %s( \
name TEXT PRIMARY KEY, \
- server_state INTEGER DEFAULT 1, \
- playback_state INTEGER DEFAULT 0, \
+ server_state INTEGER DEFAULT %d, \
+ playback_state INTEGER DEFAULT %d, \
playback_position INTEGER DEFAULT 0, \
playlist_name TEXT, playlist_index TEXT, \
- playback_content_type INTEGER DEFAULT 4, \
- age_rating INTEGER DEFAULT 0, \
- shuffle_mode INTEGER DEFAULT 1, \
- repeat_mode INTEGER DEFAULT 1, \
+ playback_content_type INTEGER DEFAULT %d, \
+ age_rating INTEGER DEFAULT %d, \
+ shuffle_mode INTEGER DEFAULT %d, \
+ repeat_mode INTEGER DEFAULT %d, \
icon_uri TEXT, \
subtitles_mode INTEGER DEFAULT 0, \
- display_mode INTEGER DEFAULT 0, \
- display_rotation INTEGER DEFAULT 0, \
+ display_mode INTEGER DEFAULT %d, \
+ display_rotation INTEGER DEFAULT %d, \
spherical_mode INTEGER DEFAULT 0, \
- ability_decided INTEGER DEFAULT 0, \
- ability_supported INTEGER DEFAULT 0)",
- MC_DB_TABLE_SERVER_INFO);
+ ability_decided INTEGER DEFAULT %llu, \
+ ability_supported INTEGER DEFAULT %llu)",
+ MC_DB_TABLE_SERVER_INFO,
+ MC_SERVER_STATE_ACTIVATE,
+ MC_PLAYBACK_STATE_NONE,
+ MC_CONTENT_TYPE_UNDECIDED,
+ MC_CONTENT_RATING_ALL,
+ MC_SHUFFLE_MODE_OFF,
+ MC_REPEAT_MODE_OFF,
+ MC_DISPLAY_MODE_FULL_SCREEN,
+ MC_DISPLAY_ROTATION_NONE,
+ ability_decided,
+ ability_supported);
ret = mc_db_util_update_db(handle, sql_str);
SQLITE3_SAFE_FREE(sql_str);
mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "mc_db_util_drop_table failed [%d]", ret);
return ret;
-}
\ No newline at end of file
+}