• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef I_MEDIA_MONITOR_INFO_H
17 #define I_MEDIA_MONITOR_INFO_H
18 
19 #include <string>
20 #include "parcel.h"
21 #include "system_ability_definition.h"
22 
23 namespace OHOS {
24 namespace Media {
25 namespace MediaMonitor {
26 
27 enum ModuleId {
28     UNKNOW_MODULEID = -1,
29     AUDIO = 0,
30     MEDIA = 1,
31 };
32 
33 enum EventId {
34     UNKNOW_EVENTID = -1,
35     // FAULT_EVENT
36     LOAD_CONFIG_ERROR = 0,
37     LOAD_EFFECT_ENGINE_ERROR = 1,
38     AUDIO_SERVICE_STARTUP_ERROR = 2,
39     AUDIO_STREAM_EXHAUSTED_STATS = 3,
40     AUDIO_STREAM_CREATE_ERROR_STATS = 4,
41     // AGGREGATION_EVENT
42     BACKGROUND_SILENT_PLAYBACK = 5,
43     STREAM_UTILIZATION_STATS = 6,
44     AUDIO_DEVICE_UTILIZATION_STATS = 7,
45     BT_UTILIZATION_STATS = 8,
46     PERFORMANCE_UNDER_OVERRUN_STATS = 9,
47     PLAYBACK_VOLUME_STATS = 10,
48     MUTED_CAPTURE_STATS = 11,
49     STREAM_PROPERTY_STATS = 12,
50     // BEHAVIOR_EVENT
51     DEVICE_CHANGE = 13,
52     HEADSET_CHANGE = 14,
53     VOLUME_CHANGE = 15,
54     STREAM_CHANGE = 16,
55     AUDIO_ROUTE_CHANGE = 17,
56     AUDIO_PIPE_CHANGE = 18,
57     AUDIO_FOCUS_MIGRATE = 19,
58     SET_FORCE_USE_AUDIO_DEVICE = 20,
59 
60     // just for capturer mute status change
61     CAPTURE_MUTE_STATUS_CHANGE = 21,
62 
63     STREAM_STANDBY = 22,
64     AI_VOICE_NOISE_SUPPRESSION = 23,
65     VOLUME_SUBSCRIBE = 24,
66     SMARTPA_STATUS = 25,
67     JANK_PLAYBACK = 26,
68 
69     EXCLUDE_OUTPUT_DEVICE = 27,
70     HAPTIC_PLAYER = 28,
71     SYSTEM_TONE_PLAYBACK = 29,
72     ADD_REMOVE_CUSTOMIZED_TONE = 30,
73     RECORD_ERROR = 31,
74     STREAM_OCCUPANCY = 32,
75     APP_WRITE_MUTE = 33,
76     HDI_EXCEPTION = 34,
77     DB_ACCESS_EXCEPTION = 35,
78     DEVICE_CHANGE_EXCEPTION = 36,
79 };
80 
81 enum EventType {
82     UNKNOW_EVENTTYPE = -1,
83     FAULT_EVENT = 0,
84     BEHAVIOR_EVENT = 1,
85     FREQUENCY_AGGREGATION_EVENT = 2,
86     DURATION_AGGREGATION_EVENT = 3,
87     HAPTIC_PLAYER_EVENT = 4,
88     MESSAGE_ZONE_EVENT = 5,
89 };
90 
91 struct MonitorDeviceInfo : public Parcelable {
92     int32_t deviceType_ = -1;
93     int32_t deviceCategory_ = -1;
94     int32_t usageOrSourceType_ = -1;
95     int32_t audioDeviceUsage_ = -1;
96     std::string deviceName_ = "";
97     std::string address_ = "";
98     std::string networkId_ = "";
99 
MarshallingMonitorDeviceInfo100     bool Marshalling(Parcel &parcel) const override
101     {
102         return parcel.WriteInt32(deviceType_) &&
103             parcel.WriteInt32(deviceCategory_) &&
104             parcel.WriteInt32(usageOrSourceType_) &&
105             parcel.WriteInt32(audioDeviceUsage_) &&
106             parcel.WriteString(deviceName_) &&
107             parcel.WriteString(address_) &&
108             parcel.WriteString(networkId_);
109     }
110 
UnmarshallingMonitorDeviceInfo111     static MonitorDeviceInfo *Unmarshalling(Parcel &data)
112     {
113         MonitorDeviceInfo *monitorDeviceInfo = new (std::nothrow) MonitorDeviceInfo();
114         if (monitorDeviceInfo == nullptr) {
115             return nullptr;
116         }
117         data.ReadInt32(monitorDeviceInfo->deviceType_);
118         data.ReadInt32(monitorDeviceInfo->deviceCategory_);
119         data.ReadInt32(monitorDeviceInfo->usageOrSourceType_);
120         data.ReadInt32(monitorDeviceInfo->audioDeviceUsage_);
121         data.ReadString(monitorDeviceInfo->deviceName_);
122         data.ReadString(monitorDeviceInfo->address_);
123         data.ReadString(monitorDeviceInfo->networkId_);
124         return monitorDeviceInfo;
125     }
126 };
127 
128 enum RendererState {
129     /** INVALID state */
130     RENDERER_INVALID = -1,
131     /** Create New Renderer instance */
132     RENDERER_NEW,
133     /** Reneder Prepared state */
134     RENDERER_PREPARED,
135     /** Rendere Running state */
136     RENDERER_RUNNING,
137     /** Renderer Stopped state */
138     RENDERER_STOPPED,
139     /** Renderer Released state */
140     RENDERER_RELEASED,
141     /** Renderer Paused state */
142     RENDERER_PAUSED
143 };
144 
145 enum CapturerState {
146     /** Capturer INVALID state */
147     CAPTURER_INVALID = -1,
148     /** Create new capturer instance */
149     CAPTURER_NEW,
150     /** Capturer Prepared state */
151     CAPTURER_PREPARED,
152     /** Capturer Running state */
153     CAPTURER_RUNNING,
154     /** Capturer Stopped state */
155     CAPTURER_STOPPED,
156     /** Capturer Released state */
157     CAPTURER_RELEASED,
158     /** Capturer Paused state */
159     CAPTURER_PAUSED
160 };
161 
162 enum AudioConfigType {
163     AUDIO_CONVERTER_CONFIG = 0,
164     AUDIO_DEVICE_PRIVACY = 1,
165     AUDIO_EFFECT_CONFIG = 2,
166     AUDIO_INTERRUPT_POLICY_CONFIG = 3,
167     AUDIO_STRATEGY_ROUTER = 4,
168     AUDIO_TONE_DTMF_CONFIG = 5,
169     AUDIO_USAGE_STRATEGY = 6,
170     AUDIO_VOLUME_CONFIG = 7,
171 };
172 
173 enum ServiceId {
174     AUDIO_SERVER_ID = OHOS::AUDIO_DISTRIBUTED_SERVICE_ID,
175     AUDIO_POLICY_SERVICE_ID = OHOS::AUDIO_POLICY_SERVICE_ID,
176 };
177 
178 enum ServiceType {
179     AUDIO_SERVER = 0,
180     AUDIO_POLICY_SERVER = 1,
181     AUDIO_INTERRUPT_SERVER = 2,
182     AUDIO_POLICY_SERVICE = 3,
183 };
184 
185 enum PreferredType {
186     MEDIA_RENDER = 0,
187     CALL_RENDER = 1,
188     CALL_CAPTURE = 2,
189     RING_RENDER = 3,
190     RECORD_CAPTURE = 4,
191     TONE_RENDER = 5,
192 };
193 
194 enum FocusDirection {
195     LOCAL = 0,
196     ROMOTE = 1,
197 };
198 
199 enum PipeChangeReason {
200     DEVICE_CHANGE_FROM_FAST = 0,
201 };
202 
203 enum EffectEngineType {
204     AUDIO_EFFECT_PROCESS_ENGINE = 0,
205     AUDIO_CONVERTER_ENGINE = 1,
206 };
207 
208 enum AudioDeviceUsage {
209     MEDIA_OUTPUT_DEVICES = 1,
210     MEDIA_INPUT_DEVICES = 2,
211     ALL_MEDIA_DEVICES = 3,
212     CALL_OUTPUT_DEVICES = 4,
213     CALL_INPUT_DEVICES = 8,
214     ALL_CALL_DEVICES = 12,
215     D_ALL_DEVICES = 15,
216 };
217 } // namespace MediaMonitor
218 } // namespace Media
219 } // namespace OHOS
220 
221 #endif // I_MEDIA_MONITOR_INFO_H