blob: 79c0a3a207c43ef0f5def65d8d6417649525848c [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 Inwood4dc66d32018-08-01 15:07:20 +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 Inwood4dc66d32018-08-01 15:07:20 +010036 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070037 public static final int SOURCE_CODEC_TYPE_SBC = 0;
Mathew Inwood4dc66d32018-08-01 15:07:20 +010038 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070039 public static final int SOURCE_CODEC_TYPE_AAC = 1;
Mathew Inwood4dc66d32018-08-01 15:07:20 +010040 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070041 public static final int SOURCE_CODEC_TYPE_APTX = 2;
Mathew Inwood4dc66d32018-08-01 15:07:20 +010042 @UnsupportedAppUsage
Pavlin Radoslavovb33bd5b2017-01-14 00:41:05 -080043 public static final int SOURCE_CODEC_TYPE_APTX_HD = 3;
Mathew Inwood4dc66d32018-08-01 15:07:20 +010044 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070045 public static final int SOURCE_CODEC_TYPE_LDAC = 4;
Mathew Inwood4dc66d32018-08-01 15:07:20 +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 Inwood4dc66d32018-08-01 15:07:20 +010049 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -080050 public static final int SOURCE_CODEC_TYPE_INVALID = 1000 * 1000;
51
Mathew Inwood4dc66d32018-08-01 15:07:20 +010052 @UnsupportedAppUsage
Pavlin Radoslavov21993392017-02-05 15:45:06 -080053 public static final int CODEC_PRIORITY_DISABLED = -1;
Mathew Inwood4dc66d32018-08-01 15:07:20 +010054 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -080055 public static final int CODEC_PRIORITY_DEFAULT = 0;
Mathew Inwood4dc66d32018-08-01 15:07:20 +010056 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -080057 public static final int CODEC_PRIORITY_HIGHEST = 1000 * 1000;
58
Mathew Inwood4dc66d32018-08-01 15:07:20 +010059 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070060 public static final int SAMPLE_RATE_NONE = 0;
Mathew Inwood4dc66d32018-08-01 15:07:20 +010061 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070062 public static final int SAMPLE_RATE_44100 = 0x1 << 0;
Mathew Inwood4dc66d32018-08-01 15:07:20 +010063 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070064 public static final int SAMPLE_RATE_48000 = 0x1 << 1;
Mathew Inwood4dc66d32018-08-01 15:07:20 +010065 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070066 public static final int SAMPLE_RATE_88200 = 0x1 << 2;
Mathew Inwood4dc66d32018-08-01 15:07:20 +010067 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070068 public static final int SAMPLE_RATE_96000 = 0x1 << 3;
Mathew Inwood4dc66d32018-08-01 15:07:20 +010069 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -080070 public static final int SAMPLE_RATE_176400 = 0x1 << 4;
Mathew Inwood4dc66d32018-08-01 15:07:20 +010071 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -080072 public static final int SAMPLE_RATE_192000 = 0x1 << 5;
73
Mathew Inwood4dc66d32018-08-01 15:07:20 +010074 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -080075 public static final int BITS_PER_SAMPLE_NONE = 0;
Mathew Inwood4dc66d32018-08-01 15:07:20 +010076 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070077 public static final int BITS_PER_SAMPLE_16 = 0x1 << 0;
Mathew Inwood4dc66d32018-08-01 15:07:20 +010078 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070079 public static final int BITS_PER_SAMPLE_24 = 0x1 << 1;
Mathew Inwood4dc66d32018-08-01 15:07:20 +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 Inwood4dc66d32018-08-01 15:07:20 +010083 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070084 public static final int CHANNEL_MODE_NONE = 0;
Mathew Inwood4dc66d32018-08-01 15:07:20 +010085 @UnsupportedAppUsage
Jack Hea355e5e2017-08-22 16:06:54 -070086 public static final int CHANNEL_MODE_MONO = 0x1 << 0;
Mathew Inwood4dc66d32018-08-01 15:07:20 +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 Inwood4dc66d32018-08-01 15:07:20 +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
117 @Override
118 public boolean equals(Object o) {
119 if (o instanceof BluetoothCodecConfig) {
Jack Hea355e5e2017-08-22 16:06:54 -0700120 BluetoothCodecConfig other = (BluetoothCodecConfig) o;
Jack He2992cd02017-08-22 21:21:23 -0700121 return (other.mCodecType == mCodecType
122 && other.mCodecPriority == mCodecPriority
123 && other.mSampleRate == mSampleRate
124 && other.mBitsPerSample == mBitsPerSample
125 && other.mChannelMode == mChannelMode
126 && other.mCodecSpecific1 == mCodecSpecific1
127 && other.mCodecSpecific2 == mCodecSpecific2
128 && other.mCodecSpecific3 == mCodecSpecific3
129 && other.mCodecSpecific4 == mCodecSpecific4);
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800130 }
131 return false;
132 }
133
134 @Override
135 public int hashCode() {
136 return Objects.hash(mCodecType, mCodecPriority, mSampleRate,
Jack Hea355e5e2017-08-22 16:06:54 -0700137 mBitsPerSample, mChannelMode, mCodecSpecific1,
138 mCodecSpecific2, mCodecSpecific3, mCodecSpecific4);
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800139 }
140
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800141 /**
142 * Checks whether the object contains valid codec configuration.
143 *
Jack Hea355e5e2017-08-22 16:06:54 -0700144 * @return true if the object contains valid codec configuration, otherwise false.
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800145 */
146 public boolean isValid() {
Jack He2992cd02017-08-22 21:21:23 -0700147 return (mSampleRate != SAMPLE_RATE_NONE)
148 && (mBitsPerSample != BITS_PER_SAMPLE_NONE)
149 && (mChannelMode != CHANNEL_MODE_NONE);
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800150 }
151
152 /**
153 * Adds capability string to an existing string.
154 *
Jack Hea355e5e2017-08-22 16:06:54 -0700155 * @param prevStr the previous string with the capabilities. Can be a null pointer.
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800156 * @param capStr the capability string to append to prevStr argument.
157 * @return the result string in the form "prevStr|capStr".
158 */
159 private static String appendCapabilityToString(String prevStr,
Jack Hea355e5e2017-08-22 16:06:54 -0700160 String capStr) {
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800161 if (prevStr == null) {
162 return capStr;
163 }
164 return prevStr + "|" + capStr;
165 }
166
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800167 @Override
168 public String toString() {
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800169 String sampleRateStr = null;
170 if (mSampleRate == SAMPLE_RATE_NONE) {
171 sampleRateStr = appendCapabilityToString(sampleRateStr, "NONE");
172 }
173 if ((mSampleRate & SAMPLE_RATE_44100) != 0) {
174 sampleRateStr = appendCapabilityToString(sampleRateStr, "44100");
175 }
176 if ((mSampleRate & SAMPLE_RATE_48000) != 0) {
177 sampleRateStr = appendCapabilityToString(sampleRateStr, "48000");
178 }
179 if ((mSampleRate & SAMPLE_RATE_88200) != 0) {
180 sampleRateStr = appendCapabilityToString(sampleRateStr, "88200");
181 }
182 if ((mSampleRate & SAMPLE_RATE_96000) != 0) {
183 sampleRateStr = appendCapabilityToString(sampleRateStr, "96000");
184 }
185 if ((mSampleRate & SAMPLE_RATE_176400) != 0) {
186 sampleRateStr = appendCapabilityToString(sampleRateStr, "176400");
187 }
188 if ((mSampleRate & SAMPLE_RATE_192000) != 0) {
189 sampleRateStr = appendCapabilityToString(sampleRateStr, "192000");
190 }
191
192 String bitsPerSampleStr = null;
193 if (mBitsPerSample == BITS_PER_SAMPLE_NONE) {
194 bitsPerSampleStr = appendCapabilityToString(bitsPerSampleStr, "NONE");
195 }
196 if ((mBitsPerSample & BITS_PER_SAMPLE_16) != 0) {
197 bitsPerSampleStr = appendCapabilityToString(bitsPerSampleStr, "16");
198 }
199 if ((mBitsPerSample & BITS_PER_SAMPLE_24) != 0) {
200 bitsPerSampleStr = appendCapabilityToString(bitsPerSampleStr, "24");
201 }
202 if ((mBitsPerSample & BITS_PER_SAMPLE_32) != 0) {
203 bitsPerSampleStr = appendCapabilityToString(bitsPerSampleStr, "32");
204 }
205
206 String channelModeStr = null;
207 if (mChannelMode == CHANNEL_MODE_NONE) {
208 channelModeStr = appendCapabilityToString(channelModeStr, "NONE");
209 }
210 if ((mChannelMode & CHANNEL_MODE_MONO) != 0) {
211 channelModeStr = appendCapabilityToString(channelModeStr, "MONO");
212 }
213 if ((mChannelMode & CHANNEL_MODE_STEREO) != 0) {
214 channelModeStr = appendCapabilityToString(channelModeStr, "STEREO");
215 }
216
Jack He2992cd02017-08-22 21:21:23 -0700217 return "{codecName:" + getCodecName()
218 + ",mCodecType:" + mCodecType
219 + ",mCodecPriority:" + mCodecPriority
220 + ",mSampleRate:" + String.format("0x%x", mSampleRate)
221 + "(" + sampleRateStr + ")"
222 + ",mBitsPerSample:" + String.format("0x%x", mBitsPerSample)
223 + "(" + bitsPerSampleStr + ")"
224 + ",mChannelMode:" + String.format("0x%x", mChannelMode)
225 + "(" + channelModeStr + ")"
226 + ",mCodecSpecific1:" + mCodecSpecific1
227 + ",mCodecSpecific2:" + mCodecSpecific2
228 + ",mCodecSpecific3:" + mCodecSpecific3
229 + ",mCodecSpecific4:" + mCodecSpecific4 + "}";
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800230 }
231
Jack He2992cd02017-08-22 21:21:23 -0700232 @Override
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800233 public int describeContents() {
234 return 0;
235 }
236
237 public static final Parcelable.Creator<BluetoothCodecConfig> CREATOR =
238 new Parcelable.Creator<BluetoothCodecConfig>() {
Jack Hea355e5e2017-08-22 16:06:54 -0700239 public BluetoothCodecConfig createFromParcel(Parcel in) {
240 final int codecType = in.readInt();
241 final int codecPriority = in.readInt();
242 final int sampleRate = in.readInt();
243 final int bitsPerSample = in.readInt();
244 final int channelMode = in.readInt();
245 final long codecSpecific1 = in.readLong();
246 final long codecSpecific2 = in.readLong();
247 final long codecSpecific3 = in.readLong();
248 final long codecSpecific4 = in.readLong();
249 return new BluetoothCodecConfig(codecType, codecPriority,
250 sampleRate, bitsPerSample,
251 channelMode, codecSpecific1,
252 codecSpecific2, codecSpecific3,
253 codecSpecific4);
254 }
255
256 public BluetoothCodecConfig[] newArray(int size) {
257 return new BluetoothCodecConfig[size];
258 }
259 };
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800260
Jack He2992cd02017-08-22 21:21:23 -0700261 @Override
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800262 public void writeToParcel(Parcel out, int flags) {
263 out.writeInt(mCodecType);
264 out.writeInt(mCodecPriority);
265 out.writeInt(mSampleRate);
266 out.writeInt(mBitsPerSample);
267 out.writeInt(mChannelMode);
268 out.writeLong(mCodecSpecific1);
269 out.writeLong(mCodecSpecific2);
270 out.writeLong(mCodecSpecific3);
271 out.writeLong(mCodecSpecific4);
272 }
273
274 /**
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800275 * Gets the codec name.
276 *
277 * @return the codec name
278 */
279 public String getCodecName() {
280 switch (mCodecType) {
Jack Hea355e5e2017-08-22 16:06:54 -0700281 case SOURCE_CODEC_TYPE_SBC:
282 return "SBC";
283 case SOURCE_CODEC_TYPE_AAC:
284 return "AAC";
285 case SOURCE_CODEC_TYPE_APTX:
286 return "aptX";
287 case SOURCE_CODEC_TYPE_APTX_HD:
288 return "aptX HD";
289 case SOURCE_CODEC_TYPE_LDAC:
290 return "LDAC";
291 case SOURCE_CODEC_TYPE_INVALID:
292 return "INVALID CODEC";
293 default:
294 break;
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800295 }
296 return "UNKNOWN CODEC(" + mCodecType + ")";
297 }
298
299 /**
300 * Gets the codec type.
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800301 * See {@link android.bluetooth.BluetoothCodecConfig#SOURCE_CODEC_TYPE_SBC}.
302 *
303 * @return the codec type
304 */
Mathew Inwood4dc66d32018-08-01 15:07:20 +0100305 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800306 public int getCodecType() {
307 return mCodecType;
308 }
309
310 /**
Pavlin Radoslavov61075102017-02-24 10:19:14 -0800311 * Checks whether the codec is mandatory.
312 *
313 * @return true if the codec is mandatory, otherwise false.
314 */
315 public boolean isMandatoryCodec() {
316 return mCodecType == SOURCE_CODEC_TYPE_SBC;
317 }
318
319 /**
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800320 * Gets the codec selection priority.
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800321 * The codec selection priority is relative to other codecs: larger value
322 * means higher priority. If 0, reset to default.
323 *
324 * @return the codec priority
325 */
Mathew Inwood4dc66d32018-08-01 15:07:20 +0100326 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800327 public int getCodecPriority() {
328 return mCodecPriority;
329 }
330
331 /**
Pavlin Radoslavov61075102017-02-24 10:19:14 -0800332 * Sets the codec selection priority.
333 * The codec selection priority is relative to other codecs: larger value
334 * means higher priority. If 0, reset to default.
335 *
336 * @param codecPriority the codec priority
337 */
Mathew Inwood4dc66d32018-08-01 15:07:20 +0100338 @UnsupportedAppUsage
Pavlin Radoslavov61075102017-02-24 10:19:14 -0800339 public void setCodecPriority(int codecPriority) {
340 mCodecPriority = codecPriority;
341 }
342
343 /**
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800344 * Gets the codec sample rate. The value can be a bitmask with all
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800345 * supported sample rates:
346 * {@link android.bluetooth.BluetoothCodecConfig#SAMPLE_RATE_NONE} or
347 * {@link android.bluetooth.BluetoothCodecConfig#SAMPLE_RATE_44100} or
348 * {@link android.bluetooth.BluetoothCodecConfig#SAMPLE_RATE_48000} or
349 * {@link android.bluetooth.BluetoothCodecConfig#SAMPLE_RATE_88200} or
350 * {@link android.bluetooth.BluetoothCodecConfig#SAMPLE_RATE_96000} or
351 * {@link android.bluetooth.BluetoothCodecConfig#SAMPLE_RATE_176400} or
352 * {@link android.bluetooth.BluetoothCodecConfig#SAMPLE_RATE_192000}
353 *
354 * @return the codec sample rate
355 */
Mathew Inwood4dc66d32018-08-01 15:07:20 +0100356 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800357 public int getSampleRate() {
358 return mSampleRate;
359 }
360
361 /**
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800362 * Gets the codec bits per sample. The value can be a bitmask with all
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800363 * bits per sample supported:
364 * {@link android.bluetooth.BluetoothCodecConfig#BITS_PER_SAMPLE_NONE} or
365 * {@link android.bluetooth.BluetoothCodecConfig#BITS_PER_SAMPLE_16} or
366 * {@link android.bluetooth.BluetoothCodecConfig#BITS_PER_SAMPLE_24} or
367 * {@link android.bluetooth.BluetoothCodecConfig#BITS_PER_SAMPLE_32}
368 *
369 * @return the codec bits per sample
370 */
Mathew Inwood4dc66d32018-08-01 15:07:20 +0100371 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800372 public int getBitsPerSample() {
373 return mBitsPerSample;
374 }
375
376 /**
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800377 * Gets the codec channel mode. The value can be a bitmask with all
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800378 * supported channel modes:
379 * {@link android.bluetooth.BluetoothCodecConfig#CHANNEL_MODE_NONE} or
380 * {@link android.bluetooth.BluetoothCodecConfig#CHANNEL_MODE_MONO} or
381 * {@link android.bluetooth.BluetoothCodecConfig#CHANNEL_MODE_STEREO}
382 *
383 * @return the codec channel mode
384 */
Mathew Inwood4dc66d32018-08-01 15:07:20 +0100385 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800386 public int getChannelMode() {
387 return mChannelMode;
388 }
389
390 /**
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800391 * Gets a codec specific value1.
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800392 *
393 * @return a codec specific value1.
394 */
Mathew Inwood4dc66d32018-08-01 15:07:20 +0100395 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800396 public long getCodecSpecific1() {
397 return mCodecSpecific1;
398 }
399
400 /**
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800401 * Gets a codec specific value2.
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800402 *
403 * @return a codec specific value2
404 */
Mathew Inwood4dc66d32018-08-01 15:07:20 +0100405 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800406 public long getCodecSpecific2() {
407 return mCodecSpecific2;
408 }
409
410 /**
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800411 * Gets a codec specific value3.
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800412 *
413 * @return a codec specific value3
414 */
Mathew Inwood4dc66d32018-08-01 15:07:20 +0100415 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800416 public long getCodecSpecific3() {
417 return mCodecSpecific3;
418 }
419
420 /**
Pavlin Radoslavovb37f1812017-01-25 16:54:07 -0800421 * Gets a codec specific value4.
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800422 *
423 * @return a codec specific value4
424 */
Mathew Inwood4dc66d32018-08-01 15:07:20 +0100425 @UnsupportedAppUsage
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800426 public long getCodecSpecific4() {
427 return mCodecSpecific4;
428 }
429
430 /**
431 * Checks whether the audio feeding parameters are same.
432 *
433 * @param other the codec config to compare against
434 * @return true if the audio feeding parameters are same, otherwise false
435 */
436 public boolean sameAudioFeedingParameters(BluetoothCodecConfig other) {
Jack He2992cd02017-08-22 21:21:23 -0700437 return (other != null && other.mSampleRate == mSampleRate
438 && other.mBitsPerSample == mBitsPerSample
439 && other.mChannelMode == mChannelMode);
Pavlin Radoslavov44a4ef02016-12-21 12:05:51 -0800440 }
441}