diff options
Diffstat (limited to 'audio/a2dp.c')
-rw-r--r-- | audio/a2dp.c | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/audio/a2dp.c b/audio/a2dp.c index 5302fb2d..ceb06164 100644 --- a/audio/a2dp.c +++ b/audio/a2dp.c @@ -713,93 +713,6 @@ gboolean a2dp_select_capabilities(struct avdtp_remote_sep *rsep, GSList **caps) return TRUE; } -gboolean a2dp_get_config(struct avdtp_stream *stream, - struct ipc_data_cfg **cfg, int *fd) -{ - struct avdtp_service_capability *cap; - struct avdtp_media_codec_capability *codec_cap = NULL; - struct sbc_codec_cap *sbc_cap; - struct ipc_data_cfg *rsp; - struct ipc_codec_sbc *sbc; - GSList *caps; - - rsp = g_malloc0(sizeof(struct ipc_data_cfg) + - sizeof(struct ipc_codec_sbc)); - *fd = -1; - sbc = (void *) rsp->data; - - if (!avdtp_stream_get_transport(stream, fd, &rsp->pkt_len, - &caps)) { - g_free(rsp); - return FALSE; - } - - for (; caps; caps = g_slist_next(caps)) { - cap = caps->data; - if (cap->category == AVDTP_MEDIA_CODEC) { - codec_cap = (void *) cap->data; - break; - } - } - - if (codec_cap == NULL) { - g_free(rsp); - return FALSE; - } - - rsp->fd_opt = CFG_FD_OPT_WRITE; - - *cfg = rsp; - - if (codec_cap->media_codec_type != A2DP_CODEC_SBC) - return TRUE; - - sbc_cap = (struct sbc_codec_cap *) codec_cap; - rsp->channels = sbc_cap->channel_mode == - A2DP_CHANNEL_MODE_MONO ? 1 : 2; - rsp->channel_mode = sbc_cap->channel_mode; - rsp->sample_size = 2; - - switch (sbc_cap->frequency) { - case A2DP_SAMPLING_FREQ_16000: - rsp->rate = 16000; - break; - case A2DP_SAMPLING_FREQ_32000: - rsp->rate = 32000; - break; - case A2DP_SAMPLING_FREQ_44100: - rsp->rate = 44100; - break; - case A2DP_SAMPLING_FREQ_48000: - rsp->rate = 48000; - break; - } - - rsp->codec = CFG_CODEC_SBC; - sbc->allocation = sbc_cap->allocation_method == A2DP_ALLOCATION_SNR ? - 0x01 : 0x00; - sbc->subbands = sbc_cap->subbands == A2DP_SUBBANDS_4 ? 4 : 8; - - switch (sbc_cap->block_length) { - case A2DP_BLOCK_LENGTH_4: - sbc->blocks = 4; - break; - case A2DP_BLOCK_LENGTH_8: - sbc->blocks = 8; - break; - case A2DP_BLOCK_LENGTH_12: - sbc->blocks = 12; - break; - case A2DP_BLOCK_LENGTH_16: - sbc->blocks = 16; - break; - } - - sbc->bitpool = sbc_cap->max_bitpool; - - return TRUE; -} - static void discovery_complete(struct avdtp *session, GSList *seps, int err, void *user_data) { |