#include "mm_player_capture.h"
#include "mm_player_tracks.h"
#include "mm_player_es.h"
+#include "mm_player_sound_focus.h"
int mm_player_create(MMHandleType *player)
{
return result;
}
+
+int mm_player_set_sound_stream_info(MMHandleType player, char *stream_type, int stream_index)
+{
+ int result = MM_ERROR_NONE;
+
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL((stream_type && (stream_index >= 0)), MM_ERROR_INVALID_ARGUMENT);
+
+ MMPLAYER_CMD_LOCK( player );
+
+ _mmplayer_sound_unregister(&((mm_player_t*)player)->sound_focus);
+ result = mm_player_set_attribute(player, NULL, "sound_stream_type", stream_type, strlen(stream_type), "sound_stream_index", stream_index, NULL);
+
+ MMPLAYER_CMD_UNLOCK( player );
+
+ return result;
+}
void __mmplayer_sound_signal_callback(mm_sound_signal_name_t signal, int value, void *user_data)
{
MMPlayerSoundFocus *sound_focus = (MMPlayerSoundFocus*)user_data;
- int ret = MM_ERROR_NONE;
+ MMPLAYER_RETURN_IF_FAIL(sound_focus);
LOGD("sound signal callback %d / %d", signal, value);
- if (signal == MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS) {
- if (value == 1) {
- /* unregister watch callback */
- if (sound_focus->watch_id > 0) {
- LOGD("unset the focus watch cb %d", sound_focus->watch_id);
-
- ret = mm_sound_unset_focus_watch_callback(sound_focus->watch_id);
- sound_focus->watch_id = 0;
- if (ret != MM_ERROR_NONE)
- LOGE("failed to mm_sound_unset_focus_watch_callback()");
- /*
- if (sound_focus->subscribe_id > 0)
- mm_sound_unsubscribe_signal(sound_focus->subscribe_id);
- */
- }
- /* unregister focus callback */
- if (sound_focus->focus_id > 0) {
- ret = mm_sound_unregister_focus(sound_focus->focus_id);
- sound_focus->focus_id = 0;
- if (ret != MM_ERROR_NONE)
- LOGE("failed to mm_sound_unregister_focus() %d", sound_focus->focus_id);
- }
- /* unregister device connected callback */
- if (sound_focus->connected_id > 0) {
- LOGD("unset the device connected cb %d", sound_focus->connected_id);
- ret = mm_sound_remove_device_connected_callback(sound_focus->connected_id);
- sound_focus->connected_id = 0;
- if (ret != MM_ERROR_NONE)
- LOGE("failed to mm_sound_remove_device_connected_callback()");
- }
- }
- }
+ if (signal == MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS && value == 1)
+ _mmplayer_sound_unregister(sound_focus);
}
static void