Merge "Use audio_format_t consistently"
diff --git a/include/hardware/audio.h b/include/hardware/audio.h
index ae82c3b..fa34467 100644
--- a/include/hardware/audio.h
+++ b/include/hardware/audio.h
@@ -215,9 +215,9 @@
/**
* return the frame size (number of bytes per sample).
*/
-static inline uint32_t audio_stream_frame_size(struct audio_stream *s)
+static inline size_t audio_stream_frame_size(struct audio_stream *s)
{
- int chan_samp_sz;
+ size_t chan_samp_sz;
switch (s->get_format(s)) {
case AUDIO_FORMAT_PCM_16_BIT:
@@ -272,12 +272,11 @@
int (*set_master_volume)(struct audio_hw_device *dev, float volume);
/**
- * setMode is called when the audio mode changes. AUDIO_MODE_NORMAL mode
+ * set_mode is called when the audio mode changes. AUDIO_MODE_NORMAL mode
* is for standard audio playback, AUDIO_MODE_RINGTONE when a ringtone is
* playing, and AUDIO_MODE_IN_CALL when a call is in progress.
- * Actual type of mode is enum audio_mode_t defined in <system/audio.h>.
*/
- int (*set_mode)(struct audio_hw_device *dev, int mode);
+ int (*set_mode)(struct audio_hw_device *dev, audio_mode_t mode);
/* mic mute */
int (*set_mic_mute)(struct audio_hw_device *dev, bool state);
diff --git a/include/hardware/audio_effect.h b/include/hardware/audio_effect.h
index 3dd75ab..201cefb 100644
--- a/include/hardware/audio_effect.h
+++ b/include/hardware/audio_effect.h
@@ -410,6 +410,9 @@
EFFECT_CMD_SET_INPUT_DEVICE, // set capture device (see audio.h, audio_devices_t)
EFFECT_CMD_GET_CONFIG, // read effect engine configuration
EFFECT_CMD_GET_CONFIG_REVERSE, // read configure effect engine reverse stream configuration
+ EFFECT_CMD_GET_FEATURE_SUPPORTED_CONFIGS,// get all supported configurations for a feature.
+ EFFECT_CMD_GET_FEATURE_CONFIG, // get current feature configuration
+ EFFECT_CMD_SET_FEATURE_CONFIG, // set current feature configuration
EFFECT_CMD_FIRST_PROPRIETARY = 0x10000 // first proprietary command code
};
@@ -581,7 +584,7 @@
//--------------------------------------------------------------------------------------------------
// command format:
// size: sizeof(uint32_t)
-// data: audio_mode_e
+// data: audio_mode_t
//--------------------------------------------------------------------------------------------------
// reply format:
// size: 0
@@ -643,6 +646,65 @@
// size: sizeof(effect_config_t)
// data: effect_config_t
//==================================================================================================
+// command: EFFECT_CMD_GET_FEATURE_SUPPORTED_CONFIGS
+//--------------------------------------------------------------------------------------------------
+// description:
+// Queries for supported configurations for a particular feature (e.g. get the supported
+// combinations of main and auxiliary channels for a noise suppressor).
+// The command parameter is the feature identifier (See effect_feature_e for a list of defined
+// features) followed by the maximum number of configuration descriptor to return.
+// The reply is composed of:
+// - status (uint32_t):
+// - 0 if feature is supported
+// - -ENOSYS if the feature is not supported,
+// - -ENOMEM if the feature is supported but the total number of supported configurations
+// exceeds the maximum number indicated by the caller.
+// - total number of supported configurations (uint32_t)
+// - an array of configuration descriptors.
+// The actual number of descriptors returned must not exceed the maximum number indicated by
+// the caller.
+//--------------------------------------------------------------------------------------------------
+// command format:
+// size: 2 x sizeof(uint32_t)
+// data: effect_feature_e + maximum number of configurations to return
+//--------------------------------------------------------------------------------------------------
+// reply format:
+// size: 2 x sizeof(uint32_t) + n x sizeof (<config descriptor>)
+// data: status + total number of configurations supported + array of n config descriptors
+//==================================================================================================
+// command: EFFECT_CMD_GET_FEATURE_CONFIG
+//--------------------------------------------------------------------------------------------------
+// description:
+// Retrieves current configuration for a given feature.
+// The reply status is:
+// - 0 if feature is supported
+// - -ENOSYS if the feature is not supported,
+//--------------------------------------------------------------------------------------------------
+// command format:
+// size: sizeof(uint32_t)
+// data: effect_feature_e
+//--------------------------------------------------------------------------------------------------
+// reply format:
+// size: sizeof(uint32_t) + sizeof (<config descriptor>)
+// data: status + config descriptor
+//==================================================================================================
+// command: EFFECT_CMD_SET_FEATURE_CONFIG
+//--------------------------------------------------------------------------------------------------
+// description:
+// Sets current configuration for a given feature.
+// The reply status is:
+// - 0 if feature is supported
+// - -ENOSYS if the feature is not supported,
+// - -EINVAL if the configuration is invalid
+//--------------------------------------------------------------------------------------------------
+// command format:
+// size: sizeof(uint32_t) + sizeof (<config descriptor>)
+// data: effect_feature_e + config descriptor
+//--------------------------------------------------------------------------------------------------
+// reply format:
+// size: sizeof(uint32_t)
+// data: status
+//==================================================================================================
// command: EFFECT_CMD_FIRST_PROPRIETARY
//--------------------------------------------------------------------------------------------------
// description:
@@ -713,6 +775,20 @@
};
+// feature identifiers for EFFECT_CMD_GET_FEATURE_SUPPORTED_CONFIGS command
+enum effect_feature_e {
+ EFFECT_FEATURE_AUX_CHANNELS, // supports auxiliary channels (e.g. dual mic noise suppressor)
+ EFFECT_FEATURE_CNT
+};
+
+// EFFECT_FEATURE_AUX_CHANNELS feature configuration descriptor. Describe a combination
+// of main and auxiliary channels supported
+typedef struct channel_config_s {
+ uint32_t main_channels; // channel mask for main channels
+ uint32_t aux_channels; // channel mask for auxiliary channels
+} channel_config_t;
+
+
// Values for bit field "mask" in buffer_config_t. If a bit is set, the corresponding field
// in buffer_config_t must be taken into account when executing the EFFECT_CMD_SET_CONFIG command
#define EFFECT_CONFIG_BUFFER 0x0001 // buffer field must be taken into account
diff --git a/include/hardware/audio_policy.h b/include/hardware/audio_policy.h
index 59ff865..edf6a68 100644
--- a/include/hardware/audio_policy.h
+++ b/include/hardware/audio_policy.h
@@ -91,7 +91,7 @@
audio_policy_dev_state_t state,
const char *device_address);
- /* retreive a device connection status */
+ /* retrieve a device connection status */
audio_policy_dev_state_t (*get_device_connection_state)(
const struct audio_policy *pol,
audio_devices_t device,
@@ -99,9 +99,9 @@
/* indicate a change in phone state. Valid phones states are defined
* by audio_mode_t */
- void (*set_phone_state)(struct audio_policy *pol, int state);
+ void (*set_phone_state)(struct audio_policy *pol, audio_mode_t state);
- /* indicate a change in ringer mode */
+ /* deprecated, never called (was "indicate a change in ringer mode") */
void (*set_ringer_mode)(struct audio_policy *pol, uint32_t mode,
uint32_t mask);
@@ -110,7 +110,7 @@
audio_policy_force_use_t usage,
audio_policy_forced_cfg_t config);
- /* retreive current device category forced for a given usage */
+ /* retrieve current device category forced for a given usage */
audio_policy_forced_cfg_t (*get_force_use)(const struct audio_policy *pol,
audio_policy_force_use_t usage);
@@ -174,23 +174,37 @@
*/
/* initialises stream volume conversion parameters by specifying volume
- * index range. */
+ * index range. The index range for each stream is defined by AudioService. */
void (*init_stream_volume)(struct audio_policy *pol,
audio_stream_type_t stream,
int index_min,
int index_max);
/* sets the new stream volume at a level corresponding to the supplied
- * index */
+ * index. The index is within the range specified by init_stream_volume() */
int (*set_stream_volume_index)(struct audio_policy *pol,
audio_stream_type_t stream,
int index);
- /* retreive current volume index for the specified stream */
+ /* retrieve current volume index for the specified stream */
int (*get_stream_volume_index)(const struct audio_policy *pol,
audio_stream_type_t stream,
int *index);
+ /* sets the new stream volume at a level corresponding to the supplied
+ * index for the specified device.
+ * The index is within the range specified by init_stream_volume() */
+ int (*set_stream_volume_index_for_device)(struct audio_policy *pol,
+ audio_stream_type_t stream,
+ int index,
+ audio_devices_t device);
+
+ /* retrieve current volume index for the specified stream for the specified device */
+ int (*get_stream_volume_index_for_device)(const struct audio_policy *pol,
+ audio_stream_type_t stream,
+ int *index,
+ audio_devices_t device);
+
/* return the strategy corresponding to a given stream type */
uint32_t (*get_strategy_for_stream)(const struct audio_policy *pol,
audio_stream_type_t stream);
@@ -215,7 +229,7 @@
int (*set_effect_enabled)(struct audio_policy *pol, int id, bool enabled);
bool (*is_stream_active)(const struct audio_policy *pol,
- int stream,
+ audio_stream_type_t stream,
uint32_t in_past_ms);
/* dump state */
diff --git a/include/hardware/camera.h b/include/hardware/camera.h
index 4d25023..4058c30 100644
--- a/include/hardware/camera.h
+++ b/include/hardware/camera.h
@@ -109,6 +109,11 @@
int *count);
int (*lock_buffer)(struct preview_stream_ops* w,
buffer_handle_t* buffer);
+ // Timestamps are measured in nanoseconds, and must be comparable
+ // and monotonically increasing between two frames in the same
+ // preview stream. They do not need to be comparable between
+ // consecutive or parallel preview streams, cameras, or app runs.
+ int (*set_timestamp)(struct preview_stream_ops *w, int64_t timestamp);
} preview_stream_ops_t;
struct camera_device;
diff --git a/include/hardware/gralloc.h b/include/hardware/gralloc.h
index f8beb5e..2dbd1fa 100644
--- a/include/hardware/gralloc.h
+++ b/include/hardware/gralloc.h
@@ -258,4 +258,4 @@
__END_DECLS
-#endif // ANDROID_ALLOC_INTERFACE_H
+#endif // ANDROID_GRALLOC_INTERFACE_H
diff --git a/modules/audio/audio_hw.c b/modules/audio/audio_hw.c
index c5b4651..a2d7861 100644
--- a/modules/audio/audio_hw.c
+++ b/modules/audio/audio_hw.c
@@ -278,7 +278,7 @@
return -ENOSYS;
}
-static int adev_set_mode(struct audio_hw_device *dev, int mode)
+static int adev_set_mode(struct audio_hw_device *dev, audio_mode_t mode)
{
return 0;
}
diff --git a/modules/audio/audio_policy.c b/modules/audio/audio_policy.c
index e7d986a..bfb4c39 100644
--- a/modules/audio/audio_policy.c
+++ b/modules/audio/audio_policy.c
@@ -58,10 +58,11 @@
return AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE;
}
-static void ap_set_phone_state(struct audio_policy *pol, int state)
+static void ap_set_phone_state(struct audio_policy *pol, audio_mode_t state)
{
}
+// deprecated, never called
static void ap_set_ringer_mode(struct audio_policy *pol, uint32_t mode,
uint32_t mask)
{
@@ -163,6 +164,22 @@
return -ENOSYS;
}
+static int ap_set_stream_volume_index_for_device(struct audio_policy *pol,
+ audio_stream_type_t stream,
+ int index,
+ audio_devices_t device)
+{
+ return -ENOSYS;
+}
+
+static int ap_get_stream_volume_index_for_device(const struct audio_policy *pol,
+ audio_stream_type_t stream,
+ int *index,
+ audio_devices_t device)
+{
+ return -ENOSYS;
+}
+
static uint32_t ap_get_strategy_for_stream(const struct audio_policy *pol,
audio_stream_type_t stream)
{
@@ -201,7 +218,7 @@
return -ENOSYS;
}
-static bool ap_is_stream_active(const struct audio_policy *pol, int stream,
+static bool ap_is_stream_active(const struct audio_policy *pol, audio_stream_type_t stream,
uint32_t in_past_ms)
{
return false;
@@ -250,6 +267,8 @@
dap->policy.init_stream_volume = ap_init_stream_volume;
dap->policy.set_stream_volume_index = ap_set_stream_volume_index;
dap->policy.get_stream_volume_index = ap_get_stream_volume_index;
+ dap->policy.set_stream_volume_index_for_device = ap_set_stream_volume_index_for_device;
+ dap->policy.get_stream_volume_index_for_device = ap_get_stream_volume_index_for_device;
dap->policy.get_strategy_for_stream = ap_get_strategy_for_stream;
dap->policy.get_devices_for_stream = ap_get_devices_for_stream;
dap->policy.get_output_for_effect = ap_get_output_for_effect;