pa_hashmap *device_types;
};
-/* structure for represent device-types(ex. builtin-speaker) properties*/
-struct device_type_info {
- const char *type;
- /*
- For save supported roles and related device-file.
- { key:role -> value:device_string ]
- */
- pa_hashmap *playback_devices;
- pa_hashmap *capture_devices;
-};
-
struct device_status_info {
char *type;
char *name;
}
}
-static void type_info_free_func(struct device_type_info *type_info) {
+static void type_info_free_func(device_type_info *type_info) {
if (!type_info)
return;
}
}
-static struct device_type_info* _device_manager_get_type_info(pa_idxset *type_infos, const char *type, const char *role) {
- struct device_type_info *type_info;
+static device_type_info* _device_manager_get_type_info(pa_idxset *type_infos, const char *type, const char *role) {
+ device_type_info *type_info;
uint32_t type_idx;
const char *device_string;
const char *_role;
return pa_safe_streq(_device_string, device_string);
}
-static const char* device_type_info_get_device_string(struct device_type_info *type_info, bool is_playback, const char *role) {
+static const char* device_type_info_get_device_string(device_type_info *type_info, bool is_playback, const char *role) {
const char *_role, *device_string;
void *state;
pa_hashmap *pcm_devices;
pa_dynarray* pulse_device_get_belongs_type(pa_object *pdevice, pa_device_manager *dm) {
pa_dynarray *ctypes;
struct composite_type *ctype;
- struct device_type_info *type_info;
+ device_type_info *type_info;
const char *device_string, *role, *param;
uint32_t type_idx;
pa_device_type_t pdt;
pa_tz_device_new_data_set_use_internal_codec(data, use_internal_codec);
}
-static int _fill_new_data_sinks(pa_tz_device_new_data *data, struct device_type_info *type_info, pa_device_manager *dm) {
+static int _fill_new_data_sinks(pa_tz_device_new_data *data, device_type_info *type_info, pa_device_manager *dm) {
pa_sink *sink;
const char *device_string, *role, *param;
void *state;
return 0;
}
-static int _fill_new_data_sources(pa_tz_device_new_data *data, struct device_type_info *type_info, pa_device_manager *dm) {
+static int _fill_new_data_sources(pa_tz_device_new_data *data, device_type_info *type_info, pa_device_manager *dm) {
pa_source *source;
const char *device_string, *role, *param;
void *state;
}
}
-static int _load_type_devices(struct device_type_info *type_info, bool is_playback, pa_device_manager *dm) {
+static int _load_type_devices(device_type_info *type_info, bool is_playback, pa_device_manager *dm) {
pa_hashmap *pcm_devices;
pa_idxset *file_infos;
void *state;
And if correnspondent sink/sources for device_type exist, should make device and notify it.
Use [device_type->roles] mappings in sink/source for find proper sink/source.
*/
-void handle_device_connected(pa_device_manager *dm, const char *type,
- const char *name, const char *system_id, device_detected_type_t detected_type) {
- struct device_type_info *type_info;
+void handle_device_connected(pa_device_manager *dm, const char *type, const char *name,
+ const char *system_id, device_detected_type_t detected_type, device_type_info *type_info) {
pa_tz_device_new_data data;
pa_assert(dm);
pa_log_info("Device connected, type(%s) name(%s) system_id(%s) detected_type(%d)",
type, pa_strempty(name), pa_strempty(system_id), detected_type);
- type_info = _device_manager_get_type_info(dm->type_infos, type, NULL);
+ if (!type_info)
+ type_info = _device_manager_get_type_info(dm->type_infos, type, NULL);
if (device_type_is_equal(type, DEVICE_TYPE_BT_SCO)) {
pa_tz_device_new_data_init(&data, dm->device_list, dm->comm, dm->dbus_conn);
}
static int load_builtin_devices(pa_device_manager *dm) {
- struct device_type_info *type_info;
+ device_type_info *type_info;
uint32_t type_idx;
device_detected_type_t detected_type = DEVICE_CONNECTED;
const char *type;
} else {
_load_type_devices(type_info, true, dm);
}
- handle_device_connected(dm, type, NULL, NULL, detected_type);
+ handle_device_connected(dm, type, NULL, NULL, detected_type, type_info);
} else if (device_type_is_use_external_card(type) == false) {
dm_device_direction_t direction;
direction = device_type_get_static_direction(type);
_load_type_devices(type_info, true, dm);
if (direction & DM_DEVICE_DIRECTION_IN)
_load_type_devices(type_info, false, dm);
- handle_device_connected(dm, type, NULL, NULL, detected_type);
+ handle_device_connected(dm, type, NULL, NULL, detected_type, type_info);
} else {
pa_log_warn("Invalid case");
}
json_object *o, *device_array_o = NULL;
int device_type_num = 0;
int device_type_idx = 0;
- struct device_type_info *type_info = NULL;
+ device_type_info *type_info = NULL;
//pa_hashmap *type_infos = NULL;
pa_idxset *type_infos = NULL;
type = json_object_get_string(device_prop_o);
pa_log_info("[ Device - %s ]", type);
- type_info = pa_xmalloc0(sizeof(struct device_type_info));
+ type_info = pa_xmalloc0(sizeof(device_type_info));
type_info->type = type;
if (json_object_object_get_ex(device_o, DEVICE_TYPE_PROP_PLAYBACK_DEVICES, &device_prop_o) && json_object_is_type(device_prop_o, json_type_object)) {
If not, initialize to not detected.
*/
static void device_type_status_init(pa_device_manager *manager) {
- struct device_type_info *type_info;
+ device_type_info *type_info;
uint32_t type_idx;
const char *type;
static pa_sink* load_sink(pa_device_manager *dm, const char *type, const char *role) {
const char *device_string, *params;
- struct device_type_info *type_info;
+ device_type_info *type_info;
struct device_file_info *file_info;
pa_tz_device *device;
pa_sink *sink;
static void unload_sink(pa_device_manager *dm, const char *type, const char *role) {
const char *device_string;
- struct device_type_info *type_info;
+ device_type_info *type_info;
pa_assert(dm);
pa_assert(dm->device_list);
static pa_source* load_source(pa_device_manager *dm, const char *type, const char *role) {
const char *device_string, *params;
- struct device_type_info *type_info;
+ device_type_info *type_info;
struct device_file_info *file_info;
pa_tz_device *device;
pa_source *source;
static void unload_source(pa_device_manager *dm, const char *type, const char *role) {
const char *device_string;
- struct device_type_info *type_info;
+ device_type_info *type_info;
pa_assert(dm);
pa_assert(dm->device_list);
}
const char* pa_device_manager_get_device_string(pa_device_manager *dm, bool is_playback, const char *type, const char *role) {
- struct device_type_info *type_info;
+ device_type_info *type_info;
pa_assert(dm);
pa_assert(type);