mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
component/bt: modify the SBC decoder to support mSBC mode
This commit is contained in:
parent
7c28611a3d
commit
e10d5aaddc
@ -76,6 +76,7 @@ Declarations of codec functions, data types, and macros.
|
|||||||
|
|
||||||
#define OI_SBC_SYNCWORD 0x9c
|
#define OI_SBC_SYNCWORD 0x9c
|
||||||
#define OI_SBC_ENHANCED_SYNCWORD 0x9d
|
#define OI_SBC_ENHANCED_SYNCWORD 0x9d
|
||||||
|
#define OI_mSBC_SYNCWORD 0xad
|
||||||
|
|
||||||
/**@name Sampling frequencies */
|
/**@name Sampling frequencies */
|
||||||
/**@{*/
|
/**@{*/
|
||||||
|
@ -81,9 +81,6 @@ INLINE OI_STATUS internal_DecoderReset(OI_CODEC_SBC_DECODER_CONTEXT *context,
|
|||||||
return OI_OK;
|
return OI_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the SBC header up to but not including the joint stereo mask. The syncword has already been
|
* Read the SBC header up to but not including the joint stereo mask. The syncword has already been
|
||||||
* examined, and the enhanced mode flag set, by FindSyncword.
|
* examined, and the enhanced mode flag set, by FindSyncword.
|
||||||
@ -94,7 +91,33 @@ INLINE void OI_SBC_ReadHeader(OI_CODEC_SBC_COMMON_CONTEXT *common, const OI_BYTE
|
|||||||
OI_UINT8 d1;
|
OI_UINT8 d1;
|
||||||
|
|
||||||
|
|
||||||
OI_ASSERT(data[0] == OI_SBC_SYNCWORD || data[0] == OI_SBC_ENHANCED_SYNCWORD);
|
OI_ASSERT(data[0] == OI_SBC_SYNCWORD || data[0] == OI_SBC_ENHANCED_SYNCWORD
|
||||||
|
|| data[0] == OI_mSBC_SYNCWORD);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For mSBC, just set those parameters
|
||||||
|
*/
|
||||||
|
if (data[0] == OI_mSBC_SYNCWORD){
|
||||||
|
frame->freqIndex = 0;
|
||||||
|
frame->frequency = 16000;
|
||||||
|
|
||||||
|
frame->blocks = 4;
|
||||||
|
frame->nrof_blocks = 15;
|
||||||
|
|
||||||
|
frame->mode = 0;
|
||||||
|
frame->nrof_channels = 1;
|
||||||
|
|
||||||
|
frame->alloc = SBC_LOUDNESS;
|
||||||
|
|
||||||
|
frame->subbands = 1;
|
||||||
|
frame->nrof_subbands = 8;
|
||||||
|
|
||||||
|
frame->cachedInfo = 0;
|
||||||
|
|
||||||
|
frame->bitpool = 26;
|
||||||
|
frame->crc = data[3];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Avoid filling out all these strucutures if we already remember the values
|
/* Avoid filling out all these strucutures if we already remember the values
|
||||||
* from last time. Just in case we get a stream corresponding to data[1] ==
|
* from last time. Just in case we get a stream corresponding to data[1] ==
|
||||||
|
@ -79,7 +79,9 @@ PRIVATE OI_STATUS FindSyncword(OI_CODEC_SBC_DECODER_CONTEXT *context,
|
|||||||
return OI_CODEC_SBC_NO_SYNCWORD;
|
return OI_CODEC_SBC_NO_SYNCWORD;
|
||||||
}
|
}
|
||||||
#else // SBC_ENHANCED
|
#else // SBC_ENHANCED
|
||||||
while (*frameBytes && (**frameData != OI_SBC_SYNCWORD)) {
|
|
||||||
|
while (*frameBytes && (**frameData != OI_SBC_SYNCWORD)
|
||||||
|
&& (**frameData != OI_mSBC_SYNCWORD)) {
|
||||||
(*frameBytes)--;
|
(*frameBytes)--;
|
||||||
(*frameData)++;
|
(*frameData)++;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user