diff options
author | Srikanth Uppala <suppala@broadcom.com> | 2012-06-17 21:44:48 -0700 |
---|---|---|
committer | Matthew Xie <mattx@google.com> | 2012-07-14 11:19:23 -0700 |
commit | 1144d2b375fc67c9b48298e0ffd774d969cfd2cc (patch) | |
tree | 4d36d4f8be4942d769300c242caeb9b9096c6a35 /stack/a2dp | |
parent | fed66f7b66d29da466e2e67befe3238e7ed8fc6a (diff) | |
download | external_bluetooth_bluedroid-1144d2b375fc67c9b48298e0ffd774d969cfd2cc.zip external_bluetooth_bluedroid-1144d2b375fc67c9b48298e0ffd774d969cfd2cc.tar.gz external_bluetooth_bluedroid-1144d2b375fc67c9b48298e0ffd774d969cfd2cc.tar.bz2 |
resubmit code-cleanup changes lost in gerrit merge
Change-Id: Iebc520d9b10ef220a83a16ff55efa46b4c5a0d27
Diffstat (limited to 'stack/a2dp')
-rw-r--r-- | stack/a2dp/a2d_m12.c | 141 | ||||
-rw-r--r-- | stack/a2dp/a2d_m24.c | 149 |
2 files changed, 0 insertions, 290 deletions
diff --git a/stack/a2dp/a2d_m12.c b/stack/a2dp/a2d_m12.c deleted file mode 100644 index 3c9fb98..0000000 --- a/stack/a2dp/a2d_m12.c +++ /dev/null @@ -1,141 +0,0 @@ -/***************************************************************************** -** -** Name: a2d_m12.c -** -** Description:utility functions to help build and parse MPEG-1, 2 Audio -** Codec Information Element and Media Payload. -** Copyright (c) 2002-2004, WIDCOMM Inc., All Rights Reserved. -** WIDCOMM Bluetooth Core. Proprietary and confidential. -** -*****************************************************************************/ -#include "bt_target.h" - -#if (A2D_M12_INCLUDED == TRUE) -#include "a2d_api.h" -#include "a2d_int.h" -#include "a2d_m12.h" - - -/****************************************************************************** -** -** Function A2D_BldM12Info -** -** Description This function is called by an application to build -** the MPEG-1, 2 Audio Media Codec Capabilities byte sequence -** beginning from the LOSC octet. -** media_type: Indicates Audio, or Multimedia. -** -** p_ie: The MPEG-1, 2 Audio Codec Information Element information. -** -** Output Parameters: -** p_result: the resulting codec info byte sequence. -** -** Returns A2D_SUCCESS if function execution succeeded. -** Error status code, otherwise. -******************************************************************************/ -tA2D_STATUS A2D_BldM12Info(UINT8 media_type, tA2D_M12_CIE *p_ie, UINT8 *p_result) -{ - tA2D_STATUS status; - UINT8 *p_vbr; - - if( p_ie == NULL || p_result == NULL || - (p_ie->layer & ~A2D_M12_IE_LAYER_MSK) || - (p_ie->ch_mode & ~A2D_M12_IE_CH_MD_MSK) || - (p_ie->samp_freq & ~A2D_M12_IE_SAMP_FREQ_MSK) || - (p_ie->bitrate & ~A2D_M12_IE_BITRATE_MSK)) - { - /* if any unused bit is set */ - status = A2D_INVALID_PARAMS; - } - else - { - status = A2D_SUCCESS; - *p_result++ = A2D_M12_INFO_LEN; - *p_result++ = media_type; - *p_result++ = A2D_MEDIA_CT_M12; - - /* Media Codec Specific Information Element */ - *p_result = p_ie->layer | p_ie->ch_mode; - if(p_ie->crc) - *p_result |= A2D_M12_IE_CRC_MSK; - p_result++; - - *p_result = p_ie->samp_freq; - if(p_ie->mpf) - *p_result |= A2D_M12_IE_MPF_MSK; - p_result++; - - p_vbr = p_result; - UINT16_TO_BE_STREAM(p_result, p_ie->bitrate); - if(p_ie->vbr) - *p_vbr |= A2D_M12_IE_VBR_MSK; - } - return status; -} - -/****************************************************************************** -** -** Function A2D_ParsM12Info -** -** Description This function is called by an application to parse -** the MPEG-1, 2 Audio Media Codec Capabilities byte sequence -** beginning from the LOSC octet. -** Input Parameters: -** p_info: the byte sequence to parse. -** -** for_caps: TRUE, if the byte sequence is for get capabilities response. -** -** Output Parameters: -** p_ie: The MPEG-1, 2 Audio Codec Information Element information. -** -** Returns A2D_SUCCESS if function execution succeeded. -** Error status code, otherwise. -******************************************************************************/ -tA2D_STATUS A2D_ParsM12Info(tA2D_M12_CIE *p_ie, UINT8 *p_info, BOOLEAN for_caps) -{ - tA2D_STATUS status; - UINT8 losc; - UINT8 mt; - - if( p_ie == NULL || p_info == NULL) - status = A2D_INVALID_PARAMS; - else - { - losc = *p_info++; - mt = *p_info++; - /* If the function is called for the wrong Media Type or Media Codec Type */ - if(losc != A2D_M12_INFO_LEN || *p_info != A2D_MEDIA_CT_M12) - status = A2D_WRONG_CODEC; - else - { - p_info++; - p_ie->layer = *p_info & A2D_M12_IE_LAYER_MSK; - p_ie->crc = (*p_info & A2D_M12_IE_CRC_MSK) >> 4; - p_ie->ch_mode = *p_info & A2D_M12_IE_CH_MD_MSK; - p_info++; - p_ie->mpf = (*p_info & A2D_M12_IE_MPF_MSK) >> 6; - p_ie->samp_freq = *p_info & A2D_M12_IE_SAMP_FREQ_MSK; - p_info++; - p_ie->vbr = (*p_info & A2D_M12_IE_VBR_MSK) >> 7; - BE_STREAM_TO_UINT16(p_ie->bitrate, p_info); - p_ie->bitrate &= A2D_M12_IE_BITRATE_MSK; - - status = A2D_SUCCESS; - if(for_caps == FALSE) - { - if(A2D_BitsSet(p_ie->layer) != A2D_SET_ONE_BIT) - status = A2D_BAD_LAYER; - if(A2D_BitsSet(p_ie->ch_mode) != A2D_SET_ONE_BIT) - status = A2D_BAD_CH_MODE; - if(A2D_BitsSet(p_ie->samp_freq) != A2D_SET_ONE_BIT) - status = A2D_BAD_SAMP_FREQ; - if((A2D_BitsSet((UINT8)(p_ie->bitrate&0xFF)) + - A2D_BitsSet((UINT8)((p_ie->bitrate&0xFF00)>>8)))!= A2D_SET_ONE_BIT) - status = A2D_BAD_BIT_RATE; - } - } - } - return status; -} - -#endif /* A2D_M12_INCLUDED == TRUE */ diff --git a/stack/a2dp/a2d_m24.c b/stack/a2dp/a2d_m24.c deleted file mode 100644 index d8df766..0000000 --- a/stack/a2dp/a2d_m24.c +++ /dev/null @@ -1,149 +0,0 @@ -/***************************************************************************** -** -** Name: a2d_m24.c -** -** Description:utility functions to help build and parse MPEG-2, 4 AAC -** Codec Information Element and Media Payload. -** Copyright (c) 2002-2004, WIDCOMM Inc., All Rights Reserved. -** WIDCOMM Bluetooth Core. Proprietary and confidential. -** -*****************************************************************************/ - -#include "bt_target.h" - -#if (A2D_M24_INCLUDED == TRUE) -#include "a2d_api.h" -#include "a2d_int.h" -#include "a2d_m24.h" - - -/****************************************************************************** -** -** Function A2D_BldM24Info -** -** Description This function is called by an application to build -** the MPEG-2, 4 AAC Media Codec Capabilities byte sequence -** beginning from the LOSC octet. -** Input Parameters: -** media_type: Indicates Audio, or Multimedia. -** -** p_ie: MPEG-2, 4 AAC Codec Information Element information. -** -** Output Parameters: -** p_result: the resulting codec info byte sequence. -** -** Returns A2D_SUCCESS if function execution succeeded. -** Error status code, otherwise. -******************************************************************************/ -tA2D_STATUS A2D_BldM24Info(UINT8 media_type, tA2D_M24_CIE *p_ie, UINT8 *p_result) -{ - tA2D_STATUS status; - UINT16 bitrate45; - - if( p_ie == NULL || p_result == NULL || - (p_ie->obj_type & ~A2D_M24_IE_OBJ_MSK) || - (p_ie->samp_freq & ~A2D_M24_IE_SAMP_FREQ_MSK) || - (p_ie->chnl & ~A2D_M24_IE_CHNL_MSK) || - (p_ie->bitrate & ~A2D_M24_IE_BITRATE_MSK)) - { - /* if any unused bit is set */ - status = A2D_INVALID_PARAMS; - } - else - { - status = A2D_SUCCESS; - *p_result++ = A2D_M24_INFO_LEN; - *p_result++ = media_type; - *p_result++ = A2D_MEDIA_CT_M24; - - /* Media Codec Specific Information Element */ - *p_result++ = p_ie->obj_type; - - UINT16_TO_BE_STREAM(p_result, p_ie->samp_freq); - p_result--; - *p_result++ |= p_ie->chnl; - - *p_result = (p_ie->bitrate & A2D_M24_IE_BITRATE3_MSK) >> 16; - if(p_ie->vbr) - *p_result |= A2D_M24_IE_VBR_MSK; - p_result++; - bitrate45 = (UINT16)(p_ie->bitrate & A2D_M24_IE_BITRATE45_MSK); - UINT16_TO_BE_STREAM(p_result, bitrate45); - } - return status; -} - -/****************************************************************************** -** -** Function A2D_ParsM24Info -** -** Description This function is called by an application to parse -** the MPEG-2, 4 AAC Media Codec Capabilities byte sequence -** beginning from the LOSC octet. -** Input Parameters: -** p_info: the byte sequence to parse. -** -** for_caps: TRUE, if the byte sequence is for get capabilities response. -** -** Output Parameters: -** p_ie: MPEG-2, 4 AAC Codec Information Element information. -** -** Returns A2D_SUCCESS if function execution succeeded. -** Error status code, otherwise. -******************************************************************************/ -tA2D_STATUS A2D_ParsM24Info(tA2D_M24_CIE *p_ie, UINT8 *p_info, BOOLEAN for_caps) -{ - tA2D_STATUS status; - UINT8 vbr; - UINT16 u16; - UINT8 losc; - UINT8 mt; - - if( p_ie == NULL || p_info == NULL) - status = A2D_INVALID_PARAMS; - else - { - losc = *p_info++; - mt = *p_info++; - /* If the function is called for the wrong Media Type or Media Codec Type */ - if(losc != A2D_M24_INFO_LEN || *p_info != A2D_MEDIA_CT_M24) - status = A2D_WRONG_CODEC; - else - { - p_info++; - p_ie->obj_type = *p_info++; - BE_STREAM_TO_UINT16(p_ie->samp_freq, p_info); - p_ie->chnl = p_ie->samp_freq & A2D_M24_IE_CHNL_MSK; - p_ie->samp_freq &= A2D_M24_IE_SAMP_FREQ_MSK; - vbr = *p_info++; - BE_STREAM_TO_UINT16(u16, p_info); /* u16 contains the octect4, 5 of bterate */ - - p_ie->vbr = (vbr & A2D_M24_IE_VBR_MSK) >> 7; - vbr &= ~A2D_M24_IE_VBR_MSK; /* vbr has become the octect3 of bitrate */ - p_ie->bitrate = vbr; - p_ie->bitrate <<= 16; - p_ie->bitrate += u16; - - status = A2D_SUCCESS; - if(for_caps == FALSE) - { - if(A2D_BitsSet(p_ie->obj_type) != A2D_SET_ONE_BIT) - status = A2D_BAD_OBJ_TYPE; - - if((A2D_BitsSet((UINT8)(p_ie->samp_freq&0xFF)) + - A2D_BitsSet((UINT8)((p_ie->samp_freq&0xFF00)>>8)))!= A2D_SET_ONE_BIT) - status = A2D_BAD_SAMP_FREQ; - - if(A2D_BitsSet(p_ie->chnl) != A2D_SET_ONE_BIT) - status = A2D_BAD_CHANNEL; - - /* BitRate must be greater than zero when specifying AAC configuration */ - if (p_ie->bitrate == 0) - status = A2D_BAD_BIT_RATE; - } - } - } - return status; -} -#endif /* (A2D_M24_INCLUDED == TRUE) */ - |