int mm_sound_get_device_vendor_id(MMSoundDevice_t device_h, int *vendor_id);
int mm_sound_get_device_product_id(MMSoundDevice_t device_h, int *product_id);
+int mm_sound_get_device_sample_format(MMSoundDevice_t device_h, int *format);
+int mm_sound_get_device_sample_rate(MMSoundDevice_t device_h, int *samplerate);
+int mm_sound_get_device_channels(MMSoundDevice_t device_h, int *channels);
+
/* Ducking */
typedef void (*mm_sound_ducking_state_changed_cb) (int idx, bool is_ducked, void *user_data);
int mm_sound_add_ducking_state_changed_callback(mm_sound_ducking_state_changed_cb func, void *user_data, unsigned int *subs_id);
}
EXPORT_API
+int mm_sound_get_device_sample_format(MMSoundDevice_t device_h, int *format)
+{
+ mm_sound_device_t *device = (mm_sound_device_t*)device_h;
+ if (!device) {
+ debug_error("invalid handle");
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
+ *format = device->format;
+ debug_log("device_handle:%p, format:%d", device, *format);
+
+ return MM_ERROR_NONE;
+}
+
+EXPORT_API
+int mm_sound_get_device_sample_rate(MMSoundDevice_t device_h, int *samplerate)
+{
+ mm_sound_device_t *device = (mm_sound_device_t*)device_h;
+ if (!device) {
+ debug_error("invalid handle");
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
+ *samplerate = device->samplerate;
+ debug_log("device_handle:%p, samplerate:%d", device, *samplerate);
+
+ return MM_ERROR_NONE;
+}
+
+EXPORT_API
+int mm_sound_get_device_channels(MMSoundDevice_t device_h, int *channels)
+{
+ mm_sound_device_t *device = (mm_sound_device_t*)device_h;
+ if (!device) {
+ debug_error("invalid handle");
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
+ *channels = device->channels;
+ debug_log("device_handle:%p, channels:%d", device, *channels);
+
+ return MM_ERROR_NONE;
+}
+
+EXPORT_API
int mm_sound_is_stream_on_device(int stream_id, MMSoundDevice_t device_h, bool *is_on)
{
int ret = MM_ERROR_NONE;
g_variant_iter_init(&iter, child);
while (1) {
device_item = g_malloc0(sizeof(mm_sound_device_t));
- if (device_item && g_variant_iter_loop(&iter, "(i&sii&siib)",
+ if (device_item && g_variant_iter_loop(&iter, "(i&sii&siibiii)",
&device_item->id, &device_type_tmp, &device_item->io_direction, &device_item->state,
- &device_name_tmp, &device_item->vendor_id, &device_item->product_id, &device_item->is_running)) {
+ &device_name_tmp, &device_item->vendor_id, &device_item->product_id, &device_item->is_running,
+ &device_item->format, &device_item->samplerate, &device_item->channels)) {
MMSOUND_STRNCPY(device_item->name, device_name_tmp, MAX_DEVICE_NAME_NUM);
MMSOUND_STRNCPY(device_item->type, device_type_tmp, MAX_DEVICE_TYPE_STR_LEN);
*device_list = g_list_append(*device_list, device_item);
- debug_log("Added device id(%d) type(%17s) direction(%d) state(%d) name(%s) vendor-id(%04x) product-id(%04x) is_running(%d)",
+ debug_log("Added device id(%d) type(%17s) direction(%d) state(%d) name(%s) vendor-id(%04x) "\
+ "product-id(%04x) is_running(%d) format(%d), samplerate(%d), channels(%d)",
device_item->id, device_item->type, device_item->io_direction, device_item->state,
- device_item->name, device_item->vendor_id, device_item->product_id, device_item->is_running);
+ device_item->name, device_item->vendor_id, device_item->product_id, device_item->is_running,
+ device_item->format, device_item->samplerate, device_item->channels);
device_item->stream_num = -1;
} else {
g_free(device_item);