• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2023 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 OHOS_DAUDIO_CONSTANTS_H
17 #define OHOS_DAUDIO_CONSTANTS_H
18 
19 #include <cstdint>
20 #include <string>
21 #include <unistd.h>
22 
23 namespace OHOS {
24 namespace DistributedHardware {
25 /* Audio package name */
26 const std::string PKG_NAME = "ohos.dhardware.daudio";
27 /* Audio data session name */
28 const std::string DATA_SPEAKER_SESSION_NAME = "ohos.dhardware.daudio.speakerdata";
29 const std::string DATA_MIC_SESSION_NAME = "ohos.dhardware.daudio.micdata";
30 /* Audio ctrl session name */
31 const std::string CTRL_SESSION_NAME = "ohos.dhardware.daudio.ctrl";
32 
33 constexpr int32_t DEFAULT_AUDIO_DATA_SIZE = 4096;
34 
35 constexpr int32_t DELETE_POINT_POS = 4;
36 constexpr int32_t DELETE_CPP_LEN = 4;
37 constexpr int32_t CHANNEL_WAIT_SECONDS = 5;
38 constexpr int32_t LOG_MAX_LEN = 4096;
39 constexpr int32_t DISTRIBUTED_HARDWARE_AUDIO_SOURCE_SA_ID = 4805;
40 constexpr int32_t DISTRIBUTED_HARDWARE_AUDIO_SINK_SA_ID = 4806;
41 constexpr int32_t AUDIO_LOADSA_TIMEOUT_MS = 10000;
42 constexpr int32_t AUDIO_SET_HISTREAMER_BIT_RATE = 1536000;
43 
44 constexpr int32_t AUDIO_DEVICE_TYPE_UNKNOWN = 0;
45 constexpr int32_t AUDIO_DEVICE_TYPE_SPEAKER = 1;
46 constexpr int32_t AUDIO_DEVICE_TYPE_MIC = 2;
47 
48 constexpr int32_t PIN_OUT_SPEAKER = 1;
49 constexpr int32_t PIN_OUT_DAUDIO_DEFAULT = 1 << 7;
50 constexpr int32_t PIN_IN_DAUDIO_DEFAULT = 1 << 27 | 1 << 5;
51 constexpr int32_t PIN_IN_MIC = 1 << 27 | 1 << 0;
52 
53 constexpr int32_t NONE_ITEM = 0;
54 constexpr int32_t SINGLE_ITEM = 1;
55 constexpr int32_t MAX_EVENT_TYPE_NUM = 100;
56 
57 constexpr uint32_t SAMPLE_RATE_DEFAULT = 48000;
58 constexpr uint32_t CHANNEL_COUNT_DEFAULT = 2;
59 constexpr uint32_t SAMPLE_FORMAT_DEFAULT = 1;
60 
61 constexpr uint32_t STR_TERM_LEN = 1;
62 constexpr uint32_t DAUDIO_MAX_SESSION_NAME_LEN = 50;
63 constexpr uint32_t DAUDIO_MAX_DEVICE_ID_LEN = 100;
64 constexpr uint32_t DAUDIO_MAX_TASKQUEUE_LEN = 100;
65 constexpr uint32_t DAUDIO_MAX_RECV_DATA_LEN = 104857600;
66 constexpr uint32_t DAUDIO_MAX_JSON_LEN = 1024;
67 
68 static constexpr int64_t AUDIO_OFFSET_FRAME_NUM = 10;
69 static constexpr int64_t LOW_LATENCY_INTERVAL_NS = 5000000;
70 static constexpr int64_t LOW_LATENCY_CLIENT_INTERVAL_NS = 20000000;
71 
72 const std::string DAUDIO_LOG_TITLE_TAG = "DAUDIO";
73 const std::string DAUDIO_PREFIX = "DISTRIBUTED_AUDIO";
74 const std::string AUDIO_PREFIX = "AUDIO";
75 const std::string SEPERATOR = "#";
76 const std::string SUPPORTED_SAMPLE_RATE = "supportedSampleRate";
77 const std::string SUPPORTED_FORMATS = "supportedFormats";
78 const std::string SUPPORTED_CHANNEL_MAX = "supportedChannelMax";
79 const std::string SUPPORTED_CHANNEL_MIN = "supportedChannelMin";
80 const std::string SUPPORTED_BITRATE_MAX = "supportedBirteMax";
81 const std::string SUPPORTED_BITRATE_MIN = "supportedBirteMin";
82 const std::string MINE_TYPE = "mineType";
83 const std::string AVENC_AAC = "avenc_aac";
84 const std::string NAME = "name";
85 const std::string KEY_CODECTYPE = "codecType";
86 const std::string KEY_DEVICE_TYPE = "deviceType";
87 
88 const std::string KEY_HISTREAMER_AUDIO_ENCODER = "histmAudEnc";
89 const std::string KEY_HISTREAMER_AUDIO_DECODER = "histmAudDec";
90 
91 const std::string HDF_EVENT_RESULT_SUCCESS = "DH_SUCCESS";
92 const std::string HDF_EVENT_RESULT_FAILED = "DH_FAILED";
93 
94 const std::string STREAM_MUTE_STATUS = "STREAM_MUTE_STATUS";
95 const std::string AUDIO_VOLUME_TYPE = "AUDIO_VOLUME_TYPE";
96 const std::string VOLUME_LEVEL = "VOLUME_LEVEL";
97 
98 const std::string AUDIO_EVENT_RESTART = "restart";
99 const std::string AUDIO_EVENT_PAUSE = "pause";
100 
101 const std::string AUDIO_ENGINE_FLAG = "persist.distributedhardware.distributedaudio.engine.enable";
102 
103 constexpr const char *KEY_TYPE = "type";
104 constexpr const char *KEY_EVENT_CONTENT = "content";
105 constexpr const char *KEY_DH_ID = "dhId";
106 constexpr const char *KEY_DEV_ID = "devId";
107 constexpr const char *KEY_RESULT = "result";
108 constexpr const char *KEY_EVENT_TYPE = "eventType";
109 constexpr const char *KEY_AUDIO_PARAM = "audioParam";
110 constexpr const char *KEY_ATTRS = "attrs";
111 constexpr const char *KEY_RANDOM_TASK_CODE = "randomTaskCode";
112 
113 constexpr const char *KEY_SAMPLING_RATE = "samplingRate";
114 constexpr const char *KEY_CHANNELS = "channels";
115 constexpr const char *KEY_FORMAT = "format";
116 constexpr const char *KEY_FRAMESIZE = "frameSize";
117 constexpr const char *KEY_SOURCE_TYPE = "sourceType";
118 constexpr const char *KEY_CONTENT_TYPE = "contentType";
119 constexpr const char *KEY_STREAM_USAGE = "streamUsage";
120 constexpr const char *KEY_RENDER_FLAGS = "renderFlags";
121 constexpr const char *KEY_CAPTURE_FLAGS = "capturerFlags";
122 } // namespace DistributedHardware
123 } // namespace OHOS
124 #endif // OHOS_DAUDIO_CONSTANTS_H
125