diff options
author | Pali Rohár <pali.rohar@gmail.com> | 2019-01-26 11:46:06 +0100 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2019-01-31 12:37:09 +0200 |
commit | e655b64f7514cb78109806b5591d38e9ef637b99 (patch) | |
tree | 7ed80490e463b31e980a96d1d63341f3be667f0d /tools/avinfo.c | |
parent | 06a3310bc5d74e2934dcd1e92765ed85679f3876 (diff) | |
download | bluez-e655b64f7514cb78109806b5591d38e9ef637b99.tar.gz |
a2dp-codecs & avinfo: Simplify defintions and parsing of aptX family
Reuse whole a2dp_aptx_t structure and defines as they are same for aptX Low
Latency and aptX HD.
Diffstat (limited to 'tools/avinfo.c')
-rw-r--r-- | tools/avinfo.c | 53 |
1 files changed, 15 insertions, 38 deletions
diff --git a/tools/avinfo.c b/tools/avinfo.c index 02fc1f233..ea7a93ed2 100644 --- a/tools/avinfo.c +++ b/tools/avinfo.c @@ -168,15 +168,8 @@ struct avdtp_content_protection_capability { uint8_t data[0]; } __attribute__ ((packed)); -static void print_aptx(a2dp_aptx_t *aptx, uint8_t size) +static void print_aptx_common(a2dp_aptx_t *aptx) { - printf("\t\tVendor Specific Value (aptX)"); - - if (size < sizeof(*aptx)) { - printf(" (broken)\n"); - return; - } - printf("\n\t\t\tFrequencies: "); if (aptx->frequency & APTX_SAMPLING_FREQ_16000) printf("16kHz "); @@ -192,6 +185,18 @@ static void print_aptx(a2dp_aptx_t *aptx, uint8_t size) printf("Mono "); if (aptx->channel_mode & APTX_CHANNEL_MODE_STEREO) printf("Stereo "); +} + +static void print_aptx(a2dp_aptx_t *aptx, uint8_t size) +{ + printf("\t\tVendor Specific Value (aptX)"); + + if (size < sizeof(*aptx)) { + printf(" (broken)\n"); + return; + } + + print_aptx_common(aptx); printf("\n"); } @@ -242,21 +247,7 @@ static void print_aptx_ll(a2dp_aptx_ll_t *aptx_ll, uint8_t size) return; } - printf("\n\t\t\tFrequencies: "); - if (aptx_ll->frequency & APTX_LL_SAMPLING_FREQ_16000) - printf("16kHz "); - if (aptx_ll->frequency & APTX_LL_SAMPLING_FREQ_32000) - printf("32kHz "); - if (aptx_ll->frequency & APTX_LL_SAMPLING_FREQ_44100) - printf("44.1kHz "); - if (aptx_ll->frequency & APTX_LL_SAMPLING_FREQ_48000) - printf("48kHz "); - - printf("\n\t\t\tChannel modes: "); - if (aptx_ll->channel_mode & APTX_LL_CHANNEL_MODE_MONO) - printf("Mono "); - if (aptx_ll->channel_mode & APTX_LL_CHANNEL_MODE_STEREO) - printf("Stereo "); + print_aptx_common(&aptx_ll->aptx); printf("\n\t\tBidirectional link: %s", aptx_ll->bidirect_link ? "Yes" : "No"); @@ -292,21 +283,7 @@ static void print_aptx_hd(a2dp_aptx_hd_t *aptx_hd, uint8_t size) return; } - printf("\n\t\t\tFrequencies: "); - if (aptx_hd->frequency & APTX_HD_SAMPLING_FREQ_16000) - printf("16kHz "); - if (aptx_hd->frequency & APTX_HD_SAMPLING_FREQ_32000) - printf("32kHz "); - if (aptx_hd->frequency & APTX_HD_SAMPLING_FREQ_44100) - printf("44.1kHz "); - if (aptx_hd->frequency & APTX_HD_SAMPLING_FREQ_48000) - printf("48kHz "); - - printf("\n\t\t\tChannel modes: "); - if (aptx_hd->channel_mode & APTX_HD_CHANNEL_MODE_MONO) - printf("Mono "); - if (aptx_hd->channel_mode & APTX_HD_CHANNEL_MODE_STEREO) - printf("Stereo "); + print_aptx_common(&aptx_hd->aptx); printf("\n"); } |