Tizen Native API
5.0
|
The Stream Policy API provides functions to control a sound stream.
#include <sound_manager.h>
The Sound Manager Stream API allows you to:
The Sound Manager has predefined sound stream types (media, system, alarm, notification, emergency, voip, etc)
Functions | |
int | sound_manager_create_stream_information (sound_stream_type_e stream_type, sound_stream_focus_state_changed_cb callback, void *user_data, sound_stream_info_h *stream_info) |
Creates a handle for stream information. | |
int | sound_manager_destroy_stream_information (sound_stream_info_h stream_info) |
Destroys the handle for stream information. | |
int | sound_manager_get_sound_type (sound_stream_info_h stream_info, sound_type_e *sound_type) |
Gets the sound type of the stream information. | |
int | sound_manager_add_device_for_stream_routing (sound_stream_info_h stream_info, sound_device_h device) |
Adds the device to the stream information for the stream routing. | |
int | sound_manager_remove_device_for_stream_routing (sound_stream_info_h stream_info, sound_device_h device) |
Removes the device from the stream information for the stream routing. | |
int | sound_manager_remove_all_devices_for_stream_routing (sound_stream_info_h stream_info) |
Removes all devices from the stream information for the stream routing. | |
int | sound_manager_apply_stream_routing (sound_stream_info_h stream_info) |
Applies the stream routing. | |
int | sound_manager_acquire_focus (sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, int sound_behavior, const char *extra_info) |
Acquires the stream focus. | |
int | sound_manager_release_focus (sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, int sound_behavior, const char *extra_info) |
Releases the acquired stream focus. | |
int | sound_manager_acquire_focus_all (sound_stream_info_h stream_info, int sound_behavior, const char *extra_info) |
Acquires all the stream focuses. | |
int | sound_manager_release_focus_all (sound_stream_info_h stream_info, int sound_behavior, const char *extra_info) |
Releases all the acquired stream focuses. | |
int | sound_manager_get_focus_state (sound_stream_info_h stream_info, sound_stream_focus_state_e *state_for_playback, sound_stream_focus_state_e *state_for_recording) |
Gets the state of focus. | |
int | sound_manager_set_focus_reacquisition (sound_stream_info_h stream_info, bool enable) |
Sets auto focus reacquisition property. | |
int | sound_manager_get_focus_reacquisition (sound_stream_info_h stream_info, bool *enabled) |
Gets auto focus reacquisition property. | |
int | sound_manager_deliver_focus (sound_stream_info_h source, sound_stream_info_h destination, sound_stream_focus_mask_e focus_mask) |
Delivers focuses to another stream information. | |
int | sound_manager_is_stream_on_device (sound_stream_info_h stream_info, sound_device_h device, bool *is_on) |
Checks if the stream information is using the device. | |
int | sound_manager_get_current_media_playback_device_type (sound_device_type_e *device_type) |
Gets the current device type for media playback stream. | |
int | sound_manager_get_current_playback_focus (sound_stream_focus_change_reason_e *acquired_by, int *sound_behavior, char **extra_info) |
Gets the reason for the current acquired playback focus. | |
int | sound_manager_get_current_recording_focus (sound_stream_focus_change_reason_e *acquired_by, int *sound_behavior, char **extra_info) |
Gets the reason for the current acquired recording focus. | |
int | sound_manager_add_focus_state_watch_cb (sound_stream_focus_mask_e focus_mask, sound_stream_focus_state_watch_cb callback, void *user_data, int *id) |
Registers the watch callback function to be invoked when the focus state for each sound stream type is changed regardless of the process. | |
int | sound_manager_remove_focus_state_watch_cb (int id) |
Unregisters the focus state change watch callback. | |
Typedefs | |
typedef struct sound_stream_info_s * | sound_stream_info_h |
Sound stream information handle. | |
typedef void(* | sound_stream_focus_state_changed_cb )(sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, sound_stream_focus_state_e focus_state, sound_stream_focus_change_reason_e reason, int sound_behavior, const char *extra_info, void *user_data) |
Called when the state of focus that belongs to the stream_info is changed. | |
typedef void(* | sound_stream_focus_state_watch_cb )(int id, sound_stream_focus_mask_e focus_mask, sound_stream_focus_state_e focus_state, sound_stream_focus_change_reason_e reason, const char *extra_info, void *user_data) |
Called when the focus state for each sound stream type is changed regardless of the process. |
typedef void(* sound_stream_focus_state_changed_cb)(sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, sound_stream_focus_state_e focus_state, sound_stream_focus_change_reason_e reason, int sound_behavior, const char *extra_info, void *user_data) |
Called when the state of focus that belongs to the stream_info is changed.
[in] | stream_info | The handle of stream information |
[in] | focus_mask | The changed focus mask |
[in] | focus_state | The changed focus state |
[in] | reason | The reason for state change of the focus |
[in] | sound_behavior | The requested sound behavior that should be followed, values of sound_behavior_e combined with bitwise 'or' |
[in] | extra_info | The extra information |
[in] | user_data | The user data passed from the callback registration function |
typedef void(* sound_stream_focus_state_watch_cb)(int id, sound_stream_focus_mask_e focus_mask, sound_stream_focus_state_e focus_state, sound_stream_focus_change_reason_e reason, const char *extra_info, void *user_data) |
Called when the focus state for each sound stream type is changed regardless of the process.
[in] | id | The focus state change watch cb id |
[in] | focus_mask | The changed focus mask |
[in] | focus_state | The changed focus state |
[in] | reason | The reason for state change of the focus |
[in] | extra_info | The extra information |
[in] | user_data | The user data passed from the callback registration function |
typedef struct sound_stream_info_s* sound_stream_info_h |
Sound stream information handle.
enum sound_behavior_e |
Enumeration for sound behavior.
Enumeration for change reason of sound stream focus state.
enum sound_stream_type_e |
Enumeration for sound stream type.
int sound_manager_acquire_focus | ( | sound_stream_info_h | stream_info, |
sound_stream_focus_mask_e | focus_mask, | ||
int | sound_behavior, | ||
const char * | extra_info | ||
) |
Acquires the stream focus.
[in] | stream_info | The handle of stream information |
[in] | focus_mask | The focus mask that user wants to acquire |
[in] | sound_behavior | The requesting sound behavior, values of sound_behavior_e combined with bitwise 'or' |
[in] | extra_info | The extra information for this request (optional, this can be NULL) |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INVALID_OPERATION | Invalid operation |
SOUND_MANAGER_ERROR_INVALID_STATE | Invalid state |
SOUND_MANAGER_ERROR_POLICY | Noncompliance with the sound system policy |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_acquire_focus_all | ( | sound_stream_info_h | stream_info, |
int | sound_behavior, | ||
const char * | extra_info | ||
) |
Acquires all the stream focuses.
[in] | stream_info | The handle of stream information |
[in] | sound_behavior | The requesting sound behavior, values of sound_behavior_e combined with bitwise 'or' |
[in] | extra_info | The extra information for this request (optional, this can be NULL) |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_POLICY | Noncompliance with the sound system policy |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_add_device_for_stream_routing | ( | sound_stream_info_h | stream_info, |
sound_device_h | device | ||
) |
Adds the device to the stream information for the stream routing.
[in] | stream_info | The handle of stream information |
[in] | device | The device item from sound_device_list_h |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_POLICY | Noncompliance with the sound system policy |
int sound_manager_add_focus_state_watch_cb | ( | sound_stream_focus_mask_e | focus_mask, |
sound_stream_focus_state_watch_cb | callback, | ||
void * | user_data, | ||
int * | id | ||
) |
Registers the watch callback function to be invoked when the focus state for each sound stream type is changed regardless of the process.
[in] | focus_mask | The focus mask that user wants to watch |
[in] | callback | The focus state change watch callback function |
[in] | user_data | The user data to be passed to the callback function |
[out] | id | The focus state change watch callback id |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INVALID_OPERATION | Invalid operation |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_apply_stream_routing | ( | sound_stream_info_h | stream_info | ) |
Applies the stream routing.
[in] | stream_info | The handle of stream information |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INVALID_STATE | Invalid state |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_create_stream_information | ( | sound_stream_type_e | stream_type, |
sound_stream_focus_state_changed_cb | callback, | ||
void * | user_data, | ||
sound_stream_info_h * | stream_info | ||
) |
Creates a handle for stream information.
[in] | stream_type | The type of stream |
[in] | callback | The focus state change callback function (optional, this can be NULL) |
[in] | user_data | The user data to be passed to the callback function (optional, this can be NULL) |
[out] | stream_info | The handle of stream information |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INVALID_OPERATION | Invalid operation |
SOUND_MANAGER_ERROR_NOT_SUPPORTED | Not supported |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_deliver_focus | ( | sound_stream_info_h | source, |
sound_stream_info_h | destination, | ||
sound_stream_focus_mask_e | focus_mask | ||
) |
Delivers focuses to another stream information.
[in] | source | The source handle of stream information which has focuses |
[in] | destination | The destination handle of stream information which will receive focuses |
[in] | focus_mask | The focus mask to deliver |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INVALID_OPERATION | Invalid operation |
SOUND_MANAGER_ERROR_INVALID_STATE | Invalid state |
SOUND_MANAGER_ERROR_POLICY | Noncompliance with the sound system policy |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_destroy_stream_information | ( | sound_stream_info_h | stream_info | ) |
Destroys the handle for stream information.
[in] | stream_info | The handle of stream information |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INVALID_OPERATION | Invalid operation |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_get_current_media_playback_device_type | ( | sound_device_type_e * | device_type | ) |
Gets the current device type for media playback stream.
[out] | device_type | The output device type that a media playback stream can go out |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_NO_DATA | No data |
int sound_manager_get_current_playback_focus | ( | sound_stream_focus_change_reason_e * | acquired_by, |
int * | sound_behavior, | ||
char ** | extra_info | ||
) |
Gets the reason for the current acquired playback focus.
[out] | acquired_by | The reason for the current acquired playback focus |
[out] | sound_behavior | The requested sound behavior that should be followed, values of sound_behavior_e combined with bitwise 'or' |
[out] | extra_info | The extra information of the acquired playback focus (optional, this can be NULL) |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INVALID_OPERATION | Invalid operation |
SOUND_MANAGER_ERROR_NO_DATA | No data |
int sound_manager_get_current_recording_focus | ( | sound_stream_focus_change_reason_e * | acquired_by, |
int * | sound_behavior, | ||
char ** | extra_info | ||
) |
Gets the reason for the current acquired recording focus.
[out] | acquired_by | The reason for the current acquired recording focus |
[out] | sound_behavior | The requested sound behavior that should be followed, values of sound_behavior_e combined with bitwise 'or' |
[out] | extra_info | The extra information of the acquired recording focus (optional, this can be NULL) |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INVALID_OPERATION | Invalid operation |
SOUND_MANAGER_ERROR_NO_DATA | No data |
int sound_manager_get_focus_reacquisition | ( | sound_stream_info_h | stream_info, |
bool * | enabled | ||
) |
Gets auto focus reacquisition property.
[in] | stream_info | The handle of stream information |
[out] | enabled | The value of focus auto reacquisition property: (true = enabled, false = disabled) |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
int sound_manager_get_focus_state | ( | sound_stream_info_h | stream_info, |
sound_stream_focus_state_e * | state_for_playback, | ||
sound_stream_focus_state_e * | state_for_recording | ||
) |
Gets the state of focus.
[in] | stream_info | The handle of stream information |
[out] | state_for_playback | The state of playback focus |
[out] | state_for_recording | The state of recording focus |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
int sound_manager_get_sound_type | ( | sound_stream_info_h | stream_info, |
sound_type_e * | sound_type | ||
) |
Gets the sound type of the stream information.
[in] | stream_info | The handle of stream information |
[out] | sound_type | The sound type |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_NO_DATA | No data |
int sound_manager_is_stream_on_device | ( | sound_stream_info_h | stream_info, |
sound_device_h | device, | ||
bool * | is_on | ||
) |
Checks if the stream information is using the device.
[in] | stream_info | The handle of stream information |
[in] | device | The device item |
[out] | is_on | Whether the stream info is using the device or not: (true = use, false = not use) |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_release_focus | ( | sound_stream_info_h | stream_info, |
sound_stream_focus_mask_e | focus_mask, | ||
int | sound_behavior, | ||
const char * | extra_info | ||
) |
Releases the acquired stream focus.
[in] | stream_info | The handle of stream information |
[in] | focus_mask | The focus mask that user wants to release |
[in] | sound_behavior | The requesting sound behavior, values of sound_behavior_e combined with bitwise 'or' |
[in] | extra_info | The extra information for this request (optional, this can be NULL) |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INVALID_OPERATION | Invalid operation |
SOUND_MANAGER_ERROR_INVALID_STATE | Invalid state |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_release_focus_all | ( | sound_stream_info_h | stream_info, |
int | sound_behavior, | ||
const char * | extra_info | ||
) |
Releases all the acquired stream focuses.
[in] | stream_info | The handle of stream information |
[in] | sound_behavior | The requesting sound behavior, values of sound_behavior_e combined with bitwise 'or' |
[in] | extra_info | The extra information for this request (optional, this can be NULL) |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_POLICY | Noncompliance with the sound system policy |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_remove_all_devices_for_stream_routing | ( | sound_stream_info_h | stream_info | ) |
Removes all devices from the stream information for the stream routing.
[in] | stream_info | The handle of stream information |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_POLICY | Noncompliance with the sound system policy |
int sound_manager_remove_device_for_stream_routing | ( | sound_stream_info_h | stream_info, |
sound_device_h | device | ||
) |
Removes the device from the stream information for the stream routing.
[in] | stream_info | The handle of stream information |
[in] | device | The device item from sound_device_list_h |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
int sound_manager_remove_focus_state_watch_cb | ( | int | id | ) |
Unregisters the focus state change watch callback.
[in] | id | The focus state change watch callback id |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INVALID_OPERATION | Invalid operation |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_set_focus_reacquisition | ( | sound_stream_info_h | stream_info, |
bool | enable | ||
) |
Sets auto focus reacquisition property.
[in] | stream_info | The handle of stream information |
[in] | enable | The auto focus reacquisition property value to set: (true = enable, false = disable) |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |