Name: pulseaudio-modules-tizen
Summary: Pulseaudio modules for Tizen
-Version: 13.0.53
+Version: 13.0.54
Release: 0
Group: Multimedia/Audio
License: LGPL-2.1+
typedef enum pa_communicator_hook {
PA_COMMUNICATOR_HOOK_SELECT_INIT_SINK_OR_SOURCE, /* It is fired when a stream is created and needs to be set to sink or source */
PA_COMMUNICATOR_HOOK_CHANGE_ROUTE, /* It is fired when routing using internal codec should be processed */
+ PA_COMMUNICATOR_HOOK_STREAM_CONNECTION_CHANGED, /* It is fired when a stream is connected or disconnected */
PA_COMMUNICATOR_HOOK_DEVICE_CONNECTION_CHANGED, /* It is fired when a device is connected or disconnected */
PA_COMMUNICATOR_HOOK_DEVICE_STATE_CHANGED, /* It is fired when a device's state is changed, it will be replaced by RUNNING_CHANGED */
PA_COMMUNICATOR_HOOK_DEVICE_RUNNING_CHANGED, /* It is fired when a device's running state is changed */
pa_communicator *comm;
pa_hook_slot *comm_hook_select_proper_sink_or_source_slot;
pa_hook_slot *comm_hook_change_route_slot;
+ pa_hook_slot *comm_hook_stream_connection_changed_slot;
pa_hook_slot *comm_hook_device_connection_changed_slot;
pa_hook_slot *comm_hook_update_info_slot;
} communicator;
return PA_HOOK_OK;
}
+static pa_hook_result_t stream_connection_changed_hook_cb(pa_core *c, pa_stream_manager_hook_data_for_stream *data, struct userdata *u) {
+ pa_assert(c);
+ pa_assert(data);
+ pa_assert(u);
+
+ pa_log_info("[STREAM][%s] stream(%p, type:%d, role:%s, parent_id:%s)",
+ data->is_connected ? "connected" : "disconnected",
+ data->stream, data->stream_type, data->stream_role, data->parent_id);
+
+ return PA_HOOK_OK;
+}
+
static pa_hook_result_t update_info_hook_cb(pa_core *c, pa_stream_manager_hook_data_for_update_info *data, struct userdata *u) {
pa_assert(c);
pa_assert(data);
u->communicator.comm_hook_change_route_slot = pa_hook_connect(
pa_communicator_hook(u->communicator.comm, PA_COMMUNICATOR_HOOK_CHANGE_ROUTE),
PA_HOOK_EARLY, (pa_hook_cb_t)route_change_hook_cb, u);
+ u->communicator.comm_hook_stream_connection_changed_slot = pa_hook_connect(
+ pa_communicator_hook(u->communicator.comm, PA_COMMUNICATOR_HOOK_STREAM_CONNECTION_CHANGED),
+ PA_HOOK_EARLY, (pa_hook_cb_t)stream_connection_changed_hook_cb, u);
u->communicator.comm_hook_device_connection_changed_slot = pa_hook_connect(
pa_communicator_hook(u->communicator.comm, PA_COMMUNICATOR_HOOK_DEVICE_CONNECTION_CHANGED),
PA_HOOK_EARLY, (pa_hook_cb_t)device_connection_changed_hook_cb, u);
return ret;
}
+static ret_msg_t prepare_and_invoke_hook_to_inform_stream_connection(pa_stream_manager *m, bool is_connected,
+ stream_type_t type, void *s) {
+ pa_stream_manager_hook_data_for_stream hook_call_stream_data;
+
+ pa_assert(m);
+ pa_assert(s);
+
+ hook_call_stream_data.stream = s;
+ hook_call_stream_data.stream_type = type;
+ hook_call_stream_data.stream_role = pa_proplist_gets(GET_STREAM_PROPLIST(s, type), PA_PROP_MEDIA_ROLE);
+ hook_call_stream_data.parent_id = pa_proplist_gets(GET_STREAM_PROPLIST(s, type), PA_PROP_MEDIA_PARENT_ID);
+ hook_call_stream_data.is_connected = is_connected;
+
+ if (pa_hook_fire(pa_communicator_hook(m->comm.comm, PA_COMMUNICATOR_HOOK_STREAM_CONNECTION_CHANGED), &hook_call_stream_data))
+ return RET_MSG_ERROR_INTERNAL;
+
+ return RET_MSG_OK;
+}
+
ret_msg_t do_notify(pa_stream_manager *m, notify_command_type_t command, stream_type_t type, bool is_new_data, void *user_data) {
hal_stream_connection_info stream_conn_info;
hal_route_option route_option;
pa_assert(user_data);
memset(&stream_conn_info, 0, sizeof(hal_stream_connection_info));
s = user_data;
- if (s) {
- stream_conn_info.role = pa_proplist_gets(GET_STREAM_PROPLIST(s, type), PA_PROP_MEDIA_ROLE);
- stream_conn_info.direction = (type == STREAM_SINK_INPUT) ? DIRECTION_OUT : DIRECTION_IN;
- stream_conn_info.idx = GET_STREAM_INDEX(s, type);
- stream_conn_info.is_connected = (command == NOTIFY_COMMAND_INFORM_STREAM_CONNECTED) ? true : false;
- if (pa_hal_interface_notify_stream_connection_changed(m->hal, &stream_conn_info))
- ret = RET_MSG_ERROR_INTERNAL;
- }
+
+ ret = prepare_and_invoke_hook_to_inform_stream_connection(m, command == NOTIFY_COMMAND_INFORM_STREAM_CONNECTED, type, s);
+ if (ret != RET_MSG_OK)
+ pa_log_error("failed to prepare_and_invoke_hook_to_inform_stream_connection()");
+ stream_conn_info.role = pa_proplist_gets(GET_STREAM_PROPLIST(s, type), PA_PROP_MEDIA_ROLE);
+ stream_conn_info.direction = (type == STREAM_SINK_INPUT) ? DIRECTION_OUT : DIRECTION_IN;
+ stream_conn_info.idx = GET_STREAM_INDEX(s, type);
+ stream_conn_info.is_connected = (command == NOTIFY_COMMAND_INFORM_STREAM_CONNECTED);
+ if (pa_hal_interface_notify_stream_connection_changed(m->hal, &stream_conn_info))
+ ret = RET_MSG_ERROR_INTERNAL;
+
break;
}
}
bool origins_from_new_data;
} pa_stream_manager_hook_data_for_route;
+typedef struct _hook_call_data_for_stream {
+ void *stream;
+ const char *stream_role;
+ const char *parent_id;
+ stream_type_t stream_type;
+ bool is_connected;
+} pa_stream_manager_hook_data_for_stream;
+
typedef struct _hook_call_data_for_update_info {
const char *stream_role;
const char *name;