void __mmplayer_gst_set_audiosink_property(mm_player_t* player, MMHandleType attrs)
{
- #define MAX_PROPS_LEN 64
+ #define MAX_PROPS_LEN 128
gint latency_mode = 0;
gchar *stream_type = NULL;
gchar *latency = NULL;
gint stream_id = 0;
gchar stream_props[MAX_PROPS_LEN] = {0,};
GstStructure *props = NULL;
+ gint stream_focus_status = 0;
/* set volume table
* It should be set after player creation through attribute.
if (!stream_type) {
LOGE("stream_type is null.\n");
} else {
- snprintf(stream_props, sizeof(stream_props)-1, "props,media.role=%s, media.parent_id=%d", stream_type, stream_id);
+ if (_mmplayer_is_using_internal_sound_focus(&player->sound_focus))
+ stream_focus_status = 1;
+
+ snprintf(stream_props, sizeof(stream_props)-1, "props,media.role=%s, media.parent_id=%d, media.focus_status=%d",
+ stream_type, stream_id, stream_focus_status);
props = gst_structure_from_string(stream_props, NULL);
g_object_set(player->pipeline->audiobin[MMPLAYER_A_SINK].gst, "stream-properties", props, NULL);
- LOGD("stream_id[%d], stream_type[%s], result[%s].\n", stream_id, stream_type, stream_props);
+ LOGI("stream_id[%d], stream_type[%s], stream_focus[%d], result[%s].\n", stream_id, stream_type, stream_focus_status, stream_props);
}
mm_attrs_get_int_by_name(attrs, "sound_latency_mode", &latency_mode);
gint pid = -1;
gint ret = MM_ERROR_NONE;
const gchar *stream_type = NULL;
+ mm_player_t* player = MM_PLAYER_CAST(param);
MMPLAYER_FENTER();
MMPLAYER_CHECK_SOUND_FOCUS_INSTANCE(sound_focus);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_INVALID_ARGUMENT);
/* check if it's running on the media_server */
if (sound_focus->pid > 0)
}
LOGD("register device connected callback for the value is 0, sub_cb id %d\n", sound_focus->connected_id);
}
+
+ ret = mm_player_set_attribute(player, NULL, "sound_stream_type", stream_type, strlen(stream_type), (char *)NULL);
+ if (ret != MM_ERROR_NONE) {
+ LOGE("mm_player_set_attribute for sound_stream_type is failed\n");
+ return ret;
+ }
}
ret = MM_ERROR_NONE;
} else {
return MM_ERROR_NONE;
}
+bool _mmplayer_is_using_internal_sound_focus(MMPlayerSoundFocus* sound_focus)
+{
+ MMPLAYER_RETURN_VAL_IF_FAIL(sound_focus, false);
+
+ /* Perhaps, already got release signal or application may use stream focus directly */
+ if (sound_focus->focus_id == 0)
+ return false;
+
+ if ((sound_focus->session_type == MM_SESSION_TYPE_MEDIA && sound_focus->session_flags & MM_SESSION_OPTION_PAUSE_OTHERS) ||
+ (sound_focus->session_type == MM_SESSION_TYPE_CALL) ||
+ (sound_focus->session_type == MM_SESSION_TYPE_VIDEOCALL) ||
+ (sound_focus->session_type == MM_SESSION_TYPE_VOIP) ||
+ (sound_focus->session_type == MM_SESSION_TYPE_NOTIFY) ||
+ (sound_focus->session_type == MM_SESSION_TYPE_ALARM) ||
+ (sound_focus->session_type == MM_SESSION_TYPE_EMERGENCY))
+ return true;
+ else
+ return false;
+}
\ No newline at end of file