*detected = DEVICE_CONNECTED_AUDIO_JACK_4P;
else
return -1;
- } else if (device_type_is_equal(DEVICE_TYPE_HDMI, type)) {
- if (value == HDMI_AUDIO_DISCONNECTED)
- *detected = DEVICE_DISCONNECTED;
- else if (value == HDMI_AUDIO_AVAILABLE)
- *detected = DEVICE_CONNECTED;
- else
- return -1;
} else if (device_type_is_equal(DEVICE_TYPE_FORWARDING, type)) {
if (value == FORWARDING_DISCONNECTED)
*detected = DEVICE_DISCONNECTED;
}
handle_device_status_changed(dm, DEVICE_TYPE_AUDIO_JACK, NULL, NULL, detected);
- } else if (dbus_message_is_signal(s, DBUS_INTERFACE_DEVICED_SYSNOTI, "ChangedHDMIAudio")) {
- if (!dbus_message_get_args(s, NULL, DBUS_TYPE_INT32, &status, DBUS_TYPE_INVALID))
- goto fail;
-
- if (_translate_external_value(DEVICE_TYPE_HDMI, status, &detected) < 0) {
- pa_log_warn("failed to translate HDMI detected value");
- goto fail;
- }
- handle_device_status_changed(dm, DEVICE_TYPE_HDMI, NULL, NULL, detected);
-
} else if (dbus_message_is_signal(s, DBUS_INTERFACE_MIRRORING_SERVER, "miracast_wfd_source_status_changed")) {
if (!dbus_message_get_args(s, NULL, DBUS_TYPE_INT32, &status, DBUS_TYPE_INVALID))
goto fail;
#define DEVICE_API_BTSCO "btsco"
#endif
#define DEVICE_BUS_USB "usb"
+#define DEVICE_BUS_PATH_HDMI "hdmi"
#define DEVICE_CLASS_SOUND "sound"
#define DEVICE_CLASS_MONITOR "monitor"
}
#endif
+static bool pulse_device_is_hdmi(pa_object *pdevice) {
+ const char *bus_path_name = NULL;
+ pa_proplist *prop = pulse_device_get_proplist(pdevice);
+
+ if (!prop)
+ return false;
+
+ if ((bus_path_name = pa_proplist_gets(prop, PA_PROP_DEVICE_BUS_PATH)))
+ return (bool)strstr(bus_path_name, DEVICE_BUS_PATH_HDMI);
+
+ pa_log_debug("This device doesn't have property '%s'", PA_PROP_DEVICE_BUS_PATH);
+ return false;
+}
+
static const char* pulse_device_get_device_string_removed_argument(pa_object *pdevice) {
static char removed_param[DEVICE_PARAM_STRING_MAX] = {0,};
char *device_string_p = NULL;
return NULL;
if (pulse_device_is_usb(pdevice))
return NULL;
+ if (pulse_device_is_hdmi(pdevice))
+ return NULL;
if (pulse_device_is_bluez(pdevice))
return NULL;
prop = pulse_device_get_proplist(pdevice);
- if (pulse_device_is_usb(pdevice))
+ if (pulse_device_is_usb(pdevice) || pulse_device_is_hdmi(pdevice))
return pa_proplist_gets(prop, "sysfs.path");
else if (pulse_device_is_bluez(pdevice))
return pa_proplist_gets(prop, "bluez.path");
pa_tz_device_new_data data;
int product_id, vendor_id;
pa_proplist *prop;
-
prop = pulse_device_get_proplist(pdevice);
name = pa_proplist_gets(prop, "udev.id");
}
}
+static void handle_hdmi_pulse_device(pa_object *pdevice, bool is_loaded, pa_device_manager *dm) {
+ const char *name, *system_id;
+ dm_device_direction_t direction;
+ pa_tz_device *device;
+
+ pa_assert(pdevice);
+ pa_assert(dm);
+
+ pa_log_info("Handle hdmi pulse device");
+
+ system_id = pulse_device_get_system_id(pdevice);
+ direction = pulse_device_get_direction(pdevice);
+
+ if (is_loaded) {
+ pa_tz_device_new_data data;
+ pa_proplist *prop;
+
+ prop = pulse_device_get_proplist(pdevice);
+ name = pa_proplist_gets(prop, "alsa.card_name");
+
+ pa_tz_device_new_data_init(&data, dm->device_list, dm->comm, NULL);
+ pa_tz_device_new_data_set_type(&data, DEVICE_TYPE_HDMI);
+ pa_tz_device_new_data_set_name(&data, name);
+ pa_tz_device_new_data_set_direction(&data, direction);
+ pa_tz_device_new_data_set_system_id(&data, system_id);
+ pa_tz_device_new_data_set_use_internal_codec(&data, false);
+ if (direction == DM_DEVICE_DIRECTION_OUT) {
+ apply_preference(dm, PA_SINK(pdevice));
+ pa_tz_device_new_data_add_sink(&data, DEVICE_ROLE_NORMAL, PA_SINK(pdevice));
+ } else {
+ pa_tz_device_new_data_add_source(&data, DEVICE_ROLE_NORMAL, PA_SOURCE(pdevice));
+ }
+
+ pa_tz_device_new(&data);
+ pa_tz_device_new_data_done(&data);
+ } else {
+ if (!(device = device_list_get_device(dm, DEVICE_TYPE_HDMI, NULL, system_id)))
+ pa_log_warn("Can't get hdmi device for %s", system_id);
+ else
+ pa_tz_device_free(device);
+ }
+}
+
static void handle_bt_pulse_device(pa_object *pdevice, bool is_loaded, pa_device_manager *dm) {
dm_device_direction_t direction;
pa_tz_device *device;
pulse_device_set_use_internal_codec(PA_OBJECT(sink), false);
handle_usb_pulse_device(PA_OBJECT(sink), true, dm);
return PA_HOOK_OK;
+ } else if (pulse_device_is_hdmi(PA_OBJECT(sink))) {
+ pulse_device_set_use_internal_codec(PA_OBJECT(sink), false);
+ handle_hdmi_pulse_device(PA_OBJECT(sink), true, dm);
+ return PA_HOOK_OK;
} else if (pulse_device_is_bluez(PA_OBJECT(sink))) {
pulse_device_set_use_internal_codec(PA_OBJECT(sink), false);
handle_bt_pulse_device(PA_OBJECT(sink), true, dm);
if (pulse_device_is_usb(PA_OBJECT(sink))) {
handle_usb_pulse_device(PA_OBJECT(sink), false, dm);
return PA_HOOK_OK;
+ } else if (pulse_device_is_hdmi(PA_OBJECT(sink))) {
+ handle_hdmi_pulse_device(PA_OBJECT(sink), false, dm);
+ return PA_HOOK_OK;
} else if (pulse_device_is_bluez(PA_OBJECT(sink))) {
handle_bt_pulse_device(PA_OBJECT(sink), false, dm);
return PA_HOOK_OK;