return true;
}
-int ttsd_player_check_current_playback_focus(bool *is_current_interrupt)
+bool ttsd_player_does_interrupt_have_playback_focus()
{
- *is_current_interrupt = false;
-
sound_stream_focus_change_reason_e reason;
int sound_behavior = 0;
char *extra_info = NULL;
- if (SOUND_MANAGER_ERROR_NONE == sound_manager_get_current_playback_focus(&reason, &sound_behavior, &extra_info)) {
- *is_current_interrupt = __does_interrupt_have_focus(reason, sound_behavior, extra_info);
+ if (SOUND_MANAGER_ERROR_NONE != sound_manager_get_current_playback_focus(&reason, &sound_behavior, &extra_info)) {
+ SLOG(LOG_ERROR, tts_tag(), "[Player ERROR] Fail to get focus information");
+ return false;
}
+ bool result = __does_interrupt_have_focus(reason, sound_behavior, extra_info);
free(extra_info);
- return TTSD_ERROR_NONE;
+ return result;
}
static void __play_thread(void *data, Ecore_Thread *thread)
/*
-* Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
} ttsd_player_state_e;
/*
-* TTSD Player Interfaces
+* TTSD Player Interfaces
*/
int ttsd_player_init();
int ttsd_player_play_pcm(int uid);
-int ttsd_player_check_current_playback_focus(bool *is_current_interrupt);
+bool ttsd_player_does_interrupt_have_playback_focus();
int ttsd_player_set_background_volume_ratio(double ratio);
}
/* check the current playback focus */
- if (TTSD_MODE_INTERRUPT != ttsd_get_mode()) {
- bool is_current_interrupt = false;
- if (0 != ttsd_player_check_current_playback_focus(&is_current_interrupt)) {
- SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to check the current playback focus");
- } else {
- if (true == is_current_interrupt) {
- SLOG(LOG_WARN, tts_tag(), "[Server WARNING] Current playback focus is set on Interrupt mode. Cannot play default, screen reader, and noti modes.");
- ttsd_data_clear_data(uid);
- return TTSD_ERROR_AUDIO_POLICY_BLOCKED;
- }
- }
+ if (TTSD_MODE_INTERRUPT != ttsd_get_mode() && ttsd_player_does_interrupt_have_playback_focus()) {
+ SLOG(LOG_WARN, tts_tag(), "[Server WARNING] Current playback focus is set on Interrupt mode. Cannot play default, screen reader, and noti modes.");
+ ttsd_data_clear_data(uid);
+ return TTSD_ERROR_AUDIO_POLICY_BLOCKED;
}
int current_uid = ttsd_data_get_current_playing();