• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2016 The Chromium OS Authors. All rights reserved.
2  * Use of this source code is governed by a BSD-style license that can be
3  * found in the LICENSE file.
4  */
5 
6 #ifndef CRAS_OBSERVER_OPS_H
7 #define CRAS_OBSERVER_OPS_H
8 
9 #include "cras_types.h"
10 
11 /* Observation of CRAS state.
12  * Unless otherwise specified, all notifications only contain the data value
13  * reflecting the current state: it is possible that multiple notifications
14  * are queued within CRAS before being sent to the client.
15  */
16 struct cras_observer_ops {
17 	/* System output volume changed. */
18 	void (*output_volume_changed)(void *context, int32_t volume);
19 	/* System output mute changed. */
20 	void (*output_mute_changed)(void *context,
21 				    int muted, int user_muted, int mute_locked);
22 	/* System input/capture gain changed. */
23 	void (*capture_gain_changed)(void *context, int32_t gain);
24 	/* System input/capture mute changed. */
25 	void (*capture_mute_changed)(void *context, int muted, int mute_locked);
26 	/* Device or node topology changed. */
27 	void (*nodes_changed)(void *context);
28 	/* Active node changed. A notification is sent for every change.
29 	 * When there is no active node, node_id is 0. */
30 	void (*active_node_changed)(void *context,
31 				    enum CRAS_STREAM_DIRECTION dir,
32 				    cras_node_id_t node_id);
33 	/* Output node volume changed. */
34 	void (*output_node_volume_changed)(void *context,
35 					   cras_node_id_t node_id,
36 					   int32_t volume);
37 	/* Node left/right swapped state change. */
38 	void (*node_left_right_swapped_changed)(void *context,
39 						cras_node_id_t node_id,
40 						int swapped);
41 	/* Input gain changed. */
42 	void (*input_node_gain_changed)(void *context,
43 					cras_node_id_t node_id,
44 					int32_t gain);
45 	/* Suspend state changed. */
46 	void (*suspend_changed)(void *context,
47 				int suspended);
48 	/* Number of active streams changed. */
49 	void (*num_active_streams_changed)(void *context,
50 					   enum CRAS_STREAM_DIRECTION dir,
51 					   uint32_t num_active_streams);
52 	/* Hotword triggered. */
53 	void (*hotword_triggered)(void *context,
54 				  int64_t tv_sec, int64_t tv_nsec);
55 	/* State regarding whether non-empty audio is being played/captured has
56 	 * changed. */
57 	void (*non_empty_audio_state_changed)(void *context, int non_empty);
58 };
59 
60 #endif /* CRAS_OBSERVER_OPS_H */
61