BluetoothCodecConfig
public
final
class
BluetoothCodecConfig
extends Object
implements
Parcelable
java.lang.Object | |
↳ | android.bluetooth.BluetoothCodecConfig |
Represents the codec configuration for a Bluetooth A2DP source device.
Contains the source codec type, the codec priority, the codec sample rate, the codec bits per sample, and the codec channel mode.
The source codec type values are the same as those supported by the device hardware.
See also:
Summary
Nested classes | |
---|---|
class |
BluetoothCodecConfig.Builder
Builder for |
Constants | |
---|---|
int |
BITS_PER_SAMPLE_16
Codec bits per sample 16. |
int |
BITS_PER_SAMPLE_24
Codec bits per sample 24. |
int |
BITS_PER_SAMPLE_32
Codec bits per sample 32. |
int |
BITS_PER_SAMPLE_NONE
Codec bits per sample 0. |
int |
CHANNEL_MODE_MONO
Codec channel mode MONO. |
int |
CHANNEL_MODE_NONE
Codec channel mode NONE. |
int |
CHANNEL_MODE_STEREO
Codec channel mode STEREO. |
int |
CODEC_PRIORITY_DEFAULT
Codec priority default. |
int |
CODEC_PRIORITY_DISABLED
Codec priority disabled. |
int |
CODEC_PRIORITY_HIGHEST
Codec priority highest. |
int |
SAMPLE_RATE_176400
Codec sample rate 176400 Hz. |
int |
SAMPLE_RATE_192000
Codec sample rate 192000 Hz. |
int |
SAMPLE_RATE_44100
Codec sample rate 44100 Hz. |
int |
SAMPLE_RATE_48000
Codec sample rate 48000 Hz. |
int |
SAMPLE_RATE_88200
Codec sample rate 88200 Hz. |
int |
SAMPLE_RATE_96000
Codec sample rate 96000 Hz. |
int |
SAMPLE_RATE_NONE
Codec sample rate 0 Hz. |
int |
SOURCE_CODEC_TYPE_AAC
This constant was deprecated
in API level 35.
Use the |
int |
SOURCE_CODEC_TYPE_APTX
This constant was deprecated
in API level 35.
Use the |
int |
SOURCE_CODEC_TYPE_APTX_HD
This constant was deprecated
in API level 35.
Use the |
int |
SOURCE_CODEC_TYPE_INVALID
This constant was deprecated
in API level 35.
Use the |
int |
SOURCE_CODEC_TYPE_LC3
This constant was deprecated
in API level 35.
Use the |
int |
SOURCE_CODEC_TYPE_LDAC
This constant was deprecated
in API level 35.
Use the |
int |
SOURCE_CODEC_TYPE_OPUS
This constant was deprecated
in API level 35.
Use the |
int |
SOURCE_CODEC_TYPE_SBC
This constant was deprecated
in API level 35.
Use the |
Inherited constants |
---|
Fields | |
---|---|
public
static
final
Creator<BluetoothCodecConfig> |
CREATOR
|
Public methods | |
---|---|
boolean
|
equals(Object o)
Indicates whether some other object is "equal to" this one. |
int
|
getBitsPerSample()
Returns the codec bits per sample. |
int
|
getChannelMode()
Returns the codec channel mode. |
int
|
getCodecPriority()
Returns the codec selection priority. |
long
|
getCodecSpecific1()
Returns the codec specific value1. |
long
|
getCodecSpecific2()
Returns the codec specific value2. |
long
|
getCodecSpecific3()
Returns the codec specific value3. |
long
|
getCodecSpecific4()
Returns the codec specific value4. |
int
|
getCodecType()
This method was deprecated
in API level 35.
use |
BluetoothCodecType
|
getExtendedCodecType()
Returns the source codec type of this config. |
int
|
getSampleRate()
Returns the codec sample rate. |
int
|
hashCode()
Returns a hash representation of this BluetoothCodecConfig based on all the config values. |
boolean
|
isMandatoryCodec()
Checks whether the codec is mandatory. |
String
|
toString()
Returns a |
Inherited methods | |
---|---|
Constants
BITS_PER_SAMPLE_16
public static final int BITS_PER_SAMPLE_16
Codec bits per sample 16.
Constant Value: 1 (0x00000001)
BITS_PER_SAMPLE_24
public static final int BITS_PER_SAMPLE_24
Codec bits per sample 24.
Constant Value: 2 (0x00000002)
BITS_PER_SAMPLE_32
public static final int BITS_PER_SAMPLE_32
Codec bits per sample 32.
Constant Value: 4 (0x00000004)
BITS_PER_SAMPLE_NONE
public static final int BITS_PER_SAMPLE_NONE
Codec bits per sample 0. Default value of the codec bits per sample.
Constant Value: 0 (0x00000000)
CHANNEL_MODE_MONO
public static final int CHANNEL_MODE_MONO
Codec channel mode MONO.
Constant Value: 1 (0x00000001)
CHANNEL_MODE_NONE
public static final int CHANNEL_MODE_NONE
Codec channel mode NONE. Default value of the codec channel mode.
Constant Value: 0 (0x00000000)
CHANNEL_MODE_STEREO
public static final int CHANNEL_MODE_STEREO
Codec channel mode STEREO.
Constant Value: 2 (0x00000002)
CODEC_PRIORITY_DEFAULT
public static final int CODEC_PRIORITY_DEFAULT
Codec priority default. Default value used for codec priority.
Constant Value: 0 (0x00000000)
CODEC_PRIORITY_DISABLED
public static final int CODEC_PRIORITY_DISABLED
Codec priority disabled. Used to indicate that this codec is disabled and should not be used.
Constant Value: -1 (0xffffffff)
CODEC_PRIORITY_HIGHEST
public static final int CODEC_PRIORITY_HIGHEST
Codec priority highest. Used to indicate the highest priority a codec can have.
Constant Value: 1000000 (0x000f4240)
SAMPLE_RATE_176400
public static final int SAMPLE_RATE_176400
Codec sample rate 176400 Hz.
Constant Value: 16 (0x00000010)
SAMPLE_RATE_192000
public static final int SAMPLE_RATE_192000
Codec sample rate 192000 Hz.
Constant Value: 32 (0x00000020)
SAMPLE_RATE_44100
public static final int SAMPLE_RATE_44100
Codec sample rate 44100 Hz.
Constant Value: 1 (0x00000001)
SAMPLE_RATE_48000
public static final int SAMPLE_RATE_48000
Codec sample rate 48000 Hz.
Constant Value: 2 (0x00000002)
SAMPLE_RATE_88200
public static final int SAMPLE_RATE_88200
Codec sample rate 88200 Hz.
Constant Value: 4 (0x00000004)
SAMPLE_RATE_96000
public static final int SAMPLE_RATE_96000
Codec sample rate 96000 Hz.
Constant Value: 8 (0x00000008)
SAMPLE_RATE_NONE
public static final int SAMPLE_RATE_NONE
Codec sample rate 0 Hz. Default value used for codec sample rate.
Constant Value: 0 (0x00000000)
SOURCE_CODEC_TYPE_AAC
public static final int SOURCE_CODEC_TYPE_AAC
This constant was deprecated
in API level 35.
Use the BluetoothCodecType
values returned by BluetoothA2dp.getSupportedCodecTypes()
instead.
Source codec type AAC.
Constant Value: 1 (0x00000001)
SOURCE_CODEC_TYPE_APTX
public static final int SOURCE_CODEC_TYPE_APTX
This constant was deprecated
in API level 35.
Use the BluetoothCodecType
values returned by BluetoothA2dp.getSupportedCodecTypes()
instead.
Source codec type APTX.
Constant Value: 2 (0x00000002)
SOURCE_CODEC_TYPE_APTX_HD
public static final int SOURCE_CODEC_TYPE_APTX_HD
This constant was deprecated
in API level 35.
Use the BluetoothCodecType
values returned by BluetoothA2dp.getSupportedCodecTypes()
instead.
Source codec type APTX HD.
Constant Value: 3 (0x00000003)
SOURCE_CODEC_TYPE_INVALID
public static final int SOURCE_CODEC_TYPE_INVALID
This constant was deprecated
in API level 35.
Use the BluetoothCodecType
values returned by BluetoothA2dp.getSupportedCodecTypes()
instead.
Source codec type invalid. This is the default value used for codec type.
Constant Value: 1000000 (0x000f4240)
SOURCE_CODEC_TYPE_LC3
public static final int SOURCE_CODEC_TYPE_LC3
This constant was deprecated
in API level 35.
Use the BluetoothCodecType
values returned by BluetoothA2dp.getSupportedCodecTypes()
instead.
Source codec type LC3.
Constant Value: 5 (0x00000005)
SOURCE_CODEC_TYPE_LDAC
public static final int SOURCE_CODEC_TYPE_LDAC
This constant was deprecated
in API level 35.
Use the BluetoothCodecType
values returned by BluetoothA2dp.getSupportedCodecTypes()
instead.
Source codec type LDAC.
Constant Value: 4 (0x00000004)
SOURCE_CODEC_TYPE_OPUS
public static final int SOURCE_CODEC_TYPE_OPUS
This constant was deprecated
in API level 35.
Use the BluetoothCodecType
values returned by BluetoothA2dp.getSupportedCodecTypes()
instead.
Source codec type Opus.
Constant Value: 6 (0x00000006)
SOURCE_CODEC_TYPE_SBC
public static final int SOURCE_CODEC_TYPE_SBC
This constant was deprecated
in API level 35.
Use the BluetoothCodecType
values returned by BluetoothA2dp.getSupportedCodecTypes()
instead.
Source codec type SBC. This is the mandatory source codec type.
Constant Value: 0 (0x00000000)
Fields
Public methods
equals
public boolean equals (Object o)
Indicates whether some other object is "equal to" this one.
The equals
method implements an equivalence relation
on non-null object references:
- It is reflexive: for any non-null reference value
x
,x.equals(x)
should returntrue
. - It is symmetric: for any non-null reference values
x
andy
,x.equals(y)
should returntrue
if and only ify.equals(x)
returnstrue
. - It is transitive: for any non-null reference values
x
,y
, andz
, ifx.equals(y)
returnstrue
andy.equals(z)
returnstrue
, thenx.equals(z)
should returntrue
. - It is consistent: for any non-null reference values
x
andy
, multiple invocations ofx.equals(y)
consistently returntrue
or consistently returnfalse
, provided no information used inequals
comparisons on the objects is modified. - For any non-null reference value
x
,x.equals(null)
should returnfalse
.
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
Parameters | |
---|---|
o |
Object : This value may be null . |
Returns | |
---|---|
boolean |
true if this object is the same as the obj
argument; false otherwise. |
getBitsPerSample
public int getBitsPerSample ()
Returns the codec bits per sample. The value can be a bitmask with all bits per sample supported.
Returns | |
---|---|
int |
Value is BITS_PER_SAMPLE_NONE , BITS_PER_SAMPLE_16 , BITS_PER_SAMPLE_24 , or BITS_PER_SAMPLE_32 |
getChannelMode
public int getChannelMode ()
Returns the codec channel mode. The value can be a bitmask with all supported channel modes.
Returns | |
---|---|
int |
Value is CHANNEL_MODE_NONE , CHANNEL_MODE_MONO , or CHANNEL_MODE_STEREO |
getCodecPriority
public int getCodecPriority ()
Returns the codec selection priority.
The codec selection priority is relative to other codecs: larger value means higher priority.
Returns | |
---|---|
int |
Value is CODEC_PRIORITY_DISABLED , CODEC_PRIORITY_DEFAULT , or CODEC_PRIORITY_HIGHEST |
getCodecSpecific1
public long getCodecSpecific1 ()
Returns the codec specific value1. As the value and usage differ for each codec, please refer to the concerned codec specification to obtain the codec specific information.
See section 4.3.2 of the Bluetooth A2dp specification for SBC codec specific information elements.
See section 4.4.2 of the Bluetooth A2dp specification for MPEG-1,2 Audio codec specific information elements.
See section 4.5.2 of the Bluetooth A2dp specification for MPEG-2, 4 AAC codec specific information elements.
See section 4.6.2 of the Bluetooth A2dp specification for ATRAC family codec specific information elements.
See section 4.7.2 of the Bluetooth A2dp specification for Vendor Specific A2DP codec specific information elements.
Returns | |
---|---|
long |
getCodecSpecific2
public long getCodecSpecific2 ()
Returns the codec specific value2. As the value and usage differ for each codec, please refer to the concerned codec specification to obtain the codec specific information.
See section 4.3.2 of the Bluetooth A2dp specification for SBC codec specific information elements.
See section 4.4.2 of the Bluetooth A2dp specification for MPEG-1,2 Audio codec specific information elements.
See section 4.5.2 of the Bluetooth A2dp specification for MPEG-2, 4 AAC codec specific information elements.
See section 4.6.2 of the Bluetooth A2dp specification for ATRAC family codec specific information elements.
See section 4.7.2 of the Bluetooth A2dp specification for Vendor Specific A2DP codec specific information elements.
Returns | |
---|---|
long |
getCodecSpecific3
public long getCodecSpecific3 ()
Returns the codec specific value3. As the value and usage differ for each codec, please refer to the concerned codec specification to obtain the codec specific information.
See section 4.3.2 of the Bluetooth A2dp specification for SBC codec specific information elements.
See section 4.4.2 of the Bluetooth A2dp specification for MPEG-1,2 Audio codec specific information elements.
See section 4.5.2 of the Bluetooth A2dp specification for MPEG-2, 4 AAC codec specific information elements.
See section 4.6.2 of the Bluetooth A2dp specification for ATRAC family codec specific information elements.
See section 4.7.2 of the Bluetooth A2dp specification for Vendor Specific A2DP codec specific information elements.
Returns | |
---|---|
long |
getCodecSpecific4
public long getCodecSpecific4 ()
Returns the codec specific value4. As the value and usage differ for each codec, please refer to the concerned codec specification to obtain the codec specific information.
See section 4.3.2 of the Bluetooth A2dp specification for SBC codec specific information elements.
See section 4.4.2 of the Bluetooth A2dp specification for MPEG-1,2 Audio codec specific information elements.
See section 4.5.2 of the Bluetooth A2dp specification for MPEG-2, 4 AAC codec specific information elements.
See section 4.6.2 of the Bluetooth A2dp specification for ATRAC family codec specific information elements.
See section 4.7.2 of the Bluetooth A2dp specification for Vendor Specific A2DP codec specific information elements.
Returns | |
---|---|
long |
getCodecType
public int getCodecType ()
This method was deprecated
in API level 35.
use BluetoothCodecConfig#getExtendedCodecType
instead.
Returns the source codec type of this config.
getExtendedCodecType
public BluetoothCodecType getExtendedCodecType ()
Returns the source codec type of this config.
Returns | |
---|---|
BluetoothCodecType |
This value may be null . |
getSampleRate
public int getSampleRate ()
Returns the codec sample rate. The value can be a bitmask with all supported sample rates.
Returns | |
---|---|
int |
Value is SAMPLE_RATE_NONE , SAMPLE_RATE_44100 , SAMPLE_RATE_48000 , SAMPLE_RATE_88200 , SAMPLE_RATE_96000 , SAMPLE_RATE_176400 , or SAMPLE_RATE_192000 |
hashCode
public int hashCode ()
Returns a hash representation of this BluetoothCodecConfig based on all the config values.
Returns | |
---|---|
int |
a hash code value for this object. |
isMandatoryCodec
public boolean isMandatoryCodec ()
Checks whether the codec is mandatory.
The actual mandatory codec type for Android Bluetooth audio is SBC. See SOURCE_CODEC_TYPE_SBC
.
Returns | |
---|---|
boolean |
true if the codec is mandatory, false otherwise |
toString
public String toString ()
Returns a String
that describes each BluetoothCodecConfig parameter current value.
Returns | |
---|---|
String |
a string representation of the object. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-06-18 UTC.