blob: c9d0ef247ca542e5e55ffbe6602436153bad7b74 [file] [log] [blame]
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -08001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.bluetooth;
18
Mathew Inwood7acad5e2018-08-01 15:00:35 +010019import android.annotation.UnsupportedAppUsage;
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -080020import android.os.Parcel;
21import android.os.Parcelable;
22
23import java.util.Objects;
24
25/**
26 * Represents the codec configuration for a Bluetooth A2DP source device.
27 *
28 * {@see BluetoothA2dp}
29 *
30 * {@hide}
31 */
32public final class BluetoothCodecConfig implements Parcelable {
Pavlin Radoslavovfeeb9b22017-01-04 16:10:09 -080033 // Add an entry for each source codec here.
34 // NOTE: The values should be same as those listed in the following file:
35 // hardware/libhardware/include/hardware/bt_av.h
Mathew Inwood7acad5e2018-08-01 15:00:35 +010036 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070037 public static final int SOURCE_CODEC_TYPE_SBC = 0;
Mathew Inwood7acad5e2018-08-01 15:00:35 +010038 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070039 public static final int SOURCE_CODEC_TYPE_AAC = 1;
Mathew Inwood7acad5e2018-08-01 15:00:35 +010040 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070041 public static final int SOURCE_CODEC_TYPE_APTX = 2;
Mathew Inwood7acad5e2018-08-01 15:00:35 +010042 @UnsupportedAppUsage
Pavlin Radoslavovb33bd5b2017-01-14 00:41:05 -080043 public static final int SOURCE_CODEC_TYPE_APTX_HD = 3;
Mathew Inwood7acad5e2018-08-01 15:00:35 +010044 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070045 public static final int SOURCE_CODEC_TYPE_LDAC = 4;
Mathew Inwood7acad5e2018-08-01 15:00:35 +010046 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070047 public static final int SOURCE_CODEC_TYPE_MAX = 5;
Pavlin Radoslavovfeeb9b22017-01-04 16:10:09 -080048
Mathew Inwood7acad5e2018-08-01 15:00:35 +010049 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -080050 public static final int SOURCE_CODEC_TYPE_INVALID = 1000 * 1000;
51
Mathew Inwood7acad5e2018-08-01 15:00:35 +010052 @UnsupportedAppUsage
Pavlin Radoslavov21993392017-02-05 15:45:06 -080053 public static final int CODEC_PRIORITY_DISABLED = -1;
Mathew Inwood7acad5e2018-08-01 15:00:35 +010054 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -080055 public static final int CODEC_PRIORITY_DEFAULT = 0;
Mathew Inwood7acad5e2018-08-01 15:00:35 +010056 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -080057 public static final int CODEC_PRIORITY_HIGHEST = 1000 * 1000;
58
Mathew Inwood7acad5e2018-08-01 15:00:35 +010059 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070060 public static final int SAMPLE_RATE_NONE = 0;
Mathew Inwood7acad5e2018-08-01 15:00:35 +010061 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070062 public static final int SAMPLE_RATE_44100 = 0x1 << 0;
Mathew Inwood7acad5e2018-08-01 15:00:35 +010063 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070064 public static final int SAMPLE_RATE_48000 = 0x1 << 1;
Mathew Inwood7acad5e2018-08-01 15:00:35 +010065 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070066 public static final int SAMPLE_RATE_88200 = 0x1 << 2;
Mathew Inwood7acad5e2018-08-01 15:00:35 +010067 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070068 public static final int SAMPLE_RATE_96000 = 0x1 << 3;
Mathew Inwood7acad5e2018-08-01 15:00:35 +010069 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -080070 public static final int SAMPLE_RATE_176400 = 0x1 << 4;
Mathew Inwood7acad5e2018-08-01 15:00:35 +010071 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -080072 public static final int SAMPLE_RATE_192000 = 0x1 << 5;
73
Mathew Inwood7acad5e2018-08-01 15:00:35 +010074 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -080075 public static final int BITS_PER_SAMPLE_NONE = 0;
Mathew Inwood7acad5e2018-08-01 15:00:35 +010076 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070077 public static final int BITS_PER_SAMPLE_16 = 0x1 << 0;
Mathew Inwood7acad5e2018-08-01 15:00:35 +010078 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070079 public static final int BITS_PER_SAMPLE_24 = 0x1 << 1;
Mathew Inwood7acad5e2018-08-01 15:00:35 +010080 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070081 public static final int BITS_PER_SAMPLE_32 = 0x1 << 2;
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -080082
Mathew Inwood7acad5e2018-08-01 15:00:35 +010083 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070084 public static final int CHANNEL_MODE_NONE = 0;
Mathew Inwood7acad5e2018-08-01 15:00:35 +010085 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070086 public static final int CHANNEL_MODE_MONO = 0x1 << 0;
Mathew Inwood7acad5e2018-08-01 15:00:35 +010087 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -080088 public static final int CHANNEL_MODE_STEREO = 0x1 << 1;
89
90 private final int mCodecType;
Pavlin Radoslavov61075102017-02-24 10:19:14 -080091 private int mCodecPriority;
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -080092 private final int mSampleRate;
93 private final int mBitsPerSample;
94 private final int mChannelMode;
95 private final long mCodecSpecific1;
96 private final long mCodecSpecific2;
97 private final long mCodecSpecific3;
98 private final long mCodecSpecific4;
99
Mathew Inwood7acad5e2018-08-01 15:00:35 +0100100 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800101 public BluetoothCodecConfig(int codecType, int codecPriority,
Jack Hea355e5e2017-08-22 16:06:54 -0700102 int sampleRate, int bitsPerSample,
103 int channelMode, long codecSpecific1,
104 long codecSpecific2, long codecSpecific3,
105 long codecSpecific4) {
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800106 mCodecType = codecType;
107 mCodecPriority = codecPriority;
108 mSampleRate = sampleRate;
109 mBitsPerSample = bitsPerSample;
110 mChannelMode = channelMode;
111 mCodecSpecific1 = codecSpecific1;
112 mCodecSpecific2 = codecSpecific2;
113 mCodecSpecific3 = codecSpecific3;
114 mCodecSpecific4 = codecSpecific4;
115 }
116
Arun Mirpuricb102fa2019-01-11 18:39:21 -0800117 @UnsupportedAppUsage
118 public BluetoothCodecConfig(int codecType) {
119 mCodecType = codecType;
120 mCodecPriority = BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT;
121 mSampleRate = BluetoothCodecConfig.SAMPLE_RATE_NONE;
122 mBitsPerSample = BluetoothCodecConfig.BITS_PER_SAMPLE_NONE;
123 mChannelMode = BluetoothCodecConfig.CHANNEL_MODE_NONE;
124 mCodecSpecific1 = 0;
125 mCodecSpecific2 = 0;
126 mCodecSpecific3 = 0;
127 mCodecSpecific4 = 0;
128 }
129
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800130 @Override
131 public boolean equals(Object o) {
132 if (o instanceof BluetoothCodecConfig) {
Jack Hea355e5e2017-08-22 16:06:54 -0700133 BluetoothCodecConfig other = (BluetoothCodecConfig) o;
Jack He2992cd02017-08-22 21:21:23 -0700134 return (other.mCodecType == mCodecType
135 && other.mCodecPriority == mCodecPriority
136 && other.mSampleRate == mSampleRate
137 && other.mBitsPerSample == mBitsPerSample
138 && other.mChannelMode == mChannelMode
139 && other.mCodecSpecific1 == mCodecSpecific1
140 && other.mCodecSpecific2 == mCodecSpecific2
141 && other.mCodecSpecific3 == mCodecSpecific3
142 && other.mCodecSpecific4 == mCodecSpecific4);
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800143 }
144 return false;
145 }
146
147 @Override
148 public int hashCode() {
149 return Objects.hash(mCodecType, mCodecPriority, mSampleRate,
Jack Hea355e5e2017-08-22 16:06:54 -0700150 mBitsPerSample, mChannelMode, mCodecSpecific1,
151 mCodecSpecific2, mCodecSpecific3, mCodecSpecific4);
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800152 }
153
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800154 /**
155 * Checks whether the object contains valid codec configuration.
156 *
Jack Hea355e5e2017-08-22 16:06:54 -0700157 * @return true if the object contains valid codec configuration, otherwise false.
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800158 */
159 public boolean isValid() {
Jack He2992cd02017-08-22 21:21:23 -0700160 return (mSampleRate != SAMPLE_RATE_NONE)
161 && (mBitsPerSample != BITS_PER_SAMPLE_NONE)
162 && (mChannelMode != CHANNEL_MODE_NONE);
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800163 }
164
165 /**
166 * Adds capability string to an existing string.
167 *
Jack Hea355e5e2017-08-22 16:06:54 -0700168 * @param prevStr the previous string with the capabilities. Can be a null pointer.
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800169 * @param capStr the capability string to append to prevStr argument.
170 * @return the result string in the form "prevStr|capStr".
171 */
172 private static String appendCapabilityToString(String prevStr,
Jack Hea355e5e2017-08-22 16:06:54 -0700173 String capStr) {
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800174 if (prevStr == null) {
175 return capStr;
176 }
177 return prevStr + "|" + capStr;
178 }
179
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800180 @Override
181 public String toString() {
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800182 String sampleRateStr = null;
183 if (mSampleRate == SAMPLE_RATE_NONE) {
184 sampleRateStr = appendCapabilityToString(sampleRateStr, "NONE");
185 }
186 if ((mSampleRate & SAMPLE_RATE_44100) != 0) {
187 sampleRateStr = appendCapabilityToString(sampleRateStr, "44100");
188 }
189 if ((mSampleRate & SAMPLE_RATE_48000) != 0) {
190 sampleRateStr = appendCapabilityToString(sampleRateStr, "48000");
191 }
192 if ((mSampleRate & SAMPLE_RATE_88200) != 0) {
193 sampleRateStr = appendCapabilityToString(sampleRateStr, "88200");
194 }
195 if ((mSampleRate & SAMPLE_RATE_96000) != 0) {
196 sampleRateStr = appendCapabilityToString(sampleRateStr, "96000");
197 }
198 if ((mSampleRate & SAMPLE_RATE_176400) != 0) {
199 sampleRateStr = appendCapabilityToString(sampleRateStr, "176400");
200 }
201 if ((mSampleRate & SAMPLE_RATE_192000) != 0) {
202 sampleRateStr = appendCapabilityToString(sampleRateStr, "192000");
203 }
204
205 String bitsPerSampleStr = null;
206 if (mBitsPerSample == BITS_PER_SAMPLE_NONE) {
207 bitsPerSampleStr = appendCapabilityToString(bitsPerSampleStr, "NONE");
208 }
209 if ((mBitsPerSample & BITS_PER_SAMPLE_16) != 0) {
210 bitsPerSampleStr = appendCapabilityToString(bitsPerSampleStr, "16");
211 }
212 if ((mBitsPerSample & BITS_PER_SAMPLE_24) != 0) {
213 bitsPerSampleStr = appendCapabilityToString(bitsPerSampleStr, "24");
214 }
215 if ((mBitsPerSample & BITS_PER_SAMPLE_32) != 0) {
216 bitsPerSampleStr = appendCapabilityToString(bitsPerSampleStr, "32");
217 }
218
219 String channelModeStr = null;
220 if (mChannelMode == CHANNEL_MODE_NONE) {
221 channelModeStr = appendCapabilityToString(channelModeStr, "NONE");
222 }
223 if ((mChannelMode & CHANNEL_MODE_MONO) != 0) {
224 channelModeStr = appendCapabilityToString(channelModeStr, "MONO");
225 }
226 if ((mChannelMode & CHANNEL_MODE_STEREO) != 0) {
227 channelModeStr = appendCapabilityToString(channelModeStr, "STEREO");
228 }
229
Jack He2992cd02017-08-22 21:21:23 -0700230 return "{codecName:" + getCodecName()
231 + ",mCodecType:" + mCodecType
232 + ",mCodecPriority:" + mCodecPriority
233 + ",mSampleRate:" + String.format("0x%x", mSampleRate)
234 + "(" + sampleRateStr + ")"
235 + ",mBitsPerSample:" + String.format("0x%x", mBitsPerSample)
236 + "(" + bitsPerSampleStr + ")"
237 + ",mChannelMode:" + String.format("0x%x", mChannelMode)
238 + "(" + channelModeStr + ")"
239 + ",mCodecSpecific1:" + mCodecSpecific1
240 + ",mCodecSpecific2:" + mCodecSpecific2
241 + ",mCodecSpecific3:" + mCodecSpecific3
242 + ",mCodecSpecific4:" + mCodecSpecific4 + "}";
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800243 }
244
Jack He2992cd02017-08-22 21:21:23 -0700245 @Override
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800246 public int describeContents() {
247 return 0;
248 }
249
250 public static final Parcelable.Creator<BluetoothCodecConfig> CREATOR =
251 new Parcelable.Creator<BluetoothCodecConfig>() {
Jack Hea355e5e2017-08-22 16:06:54 -0700252 public BluetoothCodecConfig createFromParcel(Parcel in) {
253 final int codecType = in.readInt();
254 final int codecPriority = in.readInt();
255 final int sampleRate = in.readInt();
256 final int bitsPerSample = in.readInt();
257 final int channelMode = in.readInt();
258 final long codecSpecific1 = in.readLong();
259 final long codecSpecific2 = in.readLong();
260 final long codecSpecific3 = in.readLong();
261 final long codecSpecific4 = in.readLong();
262 return new BluetoothCodecConfig(codecType, codecPriority,
263 sampleRate, bitsPerSample,
264 channelMode, codecSpecific1,
265 codecSpecific2, codecSpecific3,
266 codecSpecific4);
267 }
268
269 public BluetoothCodecConfig[] newArray(int size) {
270 return new BluetoothCodecConfig[size];
271 }
272 };
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800273
Jack He2992cd02017-08-22 21:21:23 -0700274 @Override
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800275 public void writeToParcel(Parcel out, int flags) {
276 out.writeInt(mCodecType);
277 out.writeInt(mCodecPriority);
278 out.writeInt(mSampleRate);
279 out.writeInt(mBitsPerSample);
280 out.writeInt(mChannelMode);
281 out.writeLong(mCodecSpecific1);
282 out.writeLong(mCodecSpecific2);
283 out.writeLong(mCodecSpecific3);
284 out.writeLong(mCodecSpecific4);
285 }
286
287 /**
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800288 * Gets the codec name.
289 *
290 * @return the codec name
291 */
292 public String getCodecName() {
293 switch (mCodecType) {
Jack Hea355e5e2017-08-22 16:06:54 -0700294 case SOURCE_CODEC_TYPE_SBC:
295 return "SBC";
296 case SOURCE_CODEC_TYPE_AAC:
297 return "AAC";
298 case SOURCE_CODEC_TYPE_APTX:
299 return "aptX";
300 case SOURCE_CODEC_TYPE_APTX_HD:
301 return "aptX HD";
302 case SOURCE_CODEC_TYPE_LDAC:
303 return "LDAC";
304 case SOURCE_CODEC_TYPE_INVALID:
305 return "INVALID CODEC";
306 default:
307 break;
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800308 }
309 return "UNKNOWN CODEC(" + mCodecType + ")";
310 }
311
312 /**
313 * Gets the codec type.
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800314 * See {@link android.bluetooth.BluetoothCodecConfig#SOURCE_CODEC_TYPE_SBC}.
315 *
316 * @return the codec type
317 */
Mathew Inwood7acad5e2018-08-01 15:00:35 +0100318 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800319 public int getCodecType() {
320 return mCodecType;
321 }
322
323 /**
Pavlin Radoslavov61075102017-02-24 10:19:14 -0800324 * Checks whether the codec is mandatory.
325 *
326 * @return true if the codec is mandatory, otherwise false.
327 */
328 public boolean isMandatoryCodec() {
329 return mCodecType == SOURCE_CODEC_TYPE_SBC;
330 }
331
332 /**
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800333 * Gets the codec selection priority.
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800334 * The codec selection priority is relative to other codecs: larger value
335 * means higher priority. If 0, reset to default.
336 *
337 * @return the codec priority
338 */
Mathew Inwood7acad5e2018-08-01 15:00:35 +0100339 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800340 public int getCodecPriority() {
341 return mCodecPriority;
342 }
343
344 /**
Pavlin Radoslavov61075102017-02-24 10:19:14 -0800345 * Sets the codec selection priority.
346 * The codec selection priority is relative to other codecs: larger value
347 * means higher priority. If 0, reset to default.
348 *
349 * @param codecPriority the codec priority
350 */
Mathew Inwood7acad5e2018-08-01 15:00:35 +0100351 @UnsupportedAppUsage
Pavlin Radoslavov61075102017-02-24 10:19:14 -0800352 public void setCodecPriority(int codecPriority) {
353 mCodecPriority = codecPriority;
354 }
355
356 /**
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800357 * Gets the codec sample rate. The value can be a bitmask with all
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800358 * supported sample rates:
359 * {@link android.bluetooth.BluetoothCodecConfig#SAMPLE_RATE_NONE} or
360 * {@link android.bluetooth.BluetoothCodecConfig#SAMPLE_RATE_44100} or
361 * {@link android.bluetooth.BluetoothCodecConfig#SAMPLE_RATE_48000} or
362 * {@link android.bluetooth.BluetoothCodecConfig#SAMPLE_RATE_88200} or
363 * {@link android.bluetooth.BluetoothCodecConfig#SAMPLE_RATE_96000} or
364 * {@link android.bluetooth.BluetoothCodecConfig#SAMPLE_RATE_176400} or
365 * {@link android.bluetooth.BluetoothCodecConfig#SAMPLE_RATE_192000}
366 *
367 * @return the codec sample rate
368 */
Mathew Inwood7acad5e2018-08-01 15:00:35 +0100369 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800370 public int getSampleRate() {
371 return mSampleRate;
372 }
373
374 /**
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800375 * Gets the codec bits per sample. The value can be a bitmask with all
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800376 * bits per sample supported:
377 * {@link android.bluetooth.BluetoothCodecConfig#BITS_PER_SAMPLE_NONE} or
378 * {@link android.bluetooth.BluetoothCodecConfig#BITS_PER_SAMPLE_16} or
379 * {@link android.bluetooth.BluetoothCodecConfig#BITS_PER_SAMPLE_24} or
380 * {@link android.bluetooth.BluetoothCodecConfig#BITS_PER_SAMPLE_32}
381 *
382 * @return the codec bits per sample
383 */
Mathew Inwood7acad5e2018-08-01 15:00:35 +0100384 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800385 public int getBitsPerSample() {
386 return mBitsPerSample;
387 }
388
389 /**
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800390 * Gets the codec channel mode. The value can be a bitmask with all
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800391 * supported channel modes:
392 * {@link android.bluetooth.BluetoothCodecConfig#CHANNEL_MODE_NONE} or
393 * {@link android.bluetooth.BluetoothCodecConfig#CHANNEL_MODE_MONO} or
394 * {@link android.bluetooth.BluetoothCodecConfig#CHANNEL_MODE_STEREO}
395 *
396 * @return the codec channel mode
397 */
Mathew Inwood7acad5e2018-08-01 15:00:35 +0100398 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800399 public int getChannelMode() {
400 return mChannelMode;
401 }
402
403 /**
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800404 * Gets a codec specific value1.
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800405 *
406 * @return a codec specific value1.
407 */
Mathew Inwood7acad5e2018-08-01 15:00:35 +0100408 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800409 public long getCodecSpecific1() {
410 return mCodecSpecific1;
411 }
412
413 /**
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800414 * Gets a codec specific value2.
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800415 *
416 * @return a codec specific value2
417 */
Mathew Inwood7acad5e2018-08-01 15:00:35 +0100418 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800419 public long getCodecSpecific2() {
420 return mCodecSpecific2;
421 }
422
423 /**
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800424 * Gets a codec specific value3.
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800425 *
426 * @return a codec specific value3
427 */
Mathew Inwood7acad5e2018-08-01 15:00:35 +0100428 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800429 public long getCodecSpecific3() {
430 return mCodecSpecific3;
431 }
432
433 /**
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800434 * Gets a codec specific value4.
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800435 *
436 * @return a codec specific value4
437 */
Mathew Inwood7acad5e2018-08-01 15:00:35 +0100438 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800439 public long getCodecSpecific4() {
440 return mCodecSpecific4;
441 }
442
443 /**
444 * Checks whether the audio feeding parameters are same.
445 *
446 * @param other the codec config to compare against
447 * @return true if the audio feeding parameters are same, otherwise false
448 */
449 public boolean sameAudioFeedingParameters(BluetoothCodecConfig other) {
Jack He2992cd02017-08-22 21:21:23 -0700450 return (other != null && other.mSampleRate == mSampleRate
451 && other.mBitsPerSample == mBitsPerSample
452 && other.mChannelMode == mChannelMode);
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800453 }
454}