• Home
  • Raw
  • Download

Lines Matching refs:a2dp

15 int init_a2dp(struct a2dp_info *a2dp, a2dp_sbc_t *sbc)  in init_a2dp()  argument
69 a2dp->codec = cras_sbc_codec_create(frequency, mode, subbands, in init_a2dp()
71 if (!a2dp->codec) in init_a2dp()
75 a2dp->codesize = cras_sbc_get_codesize(a2dp->codec); in init_a2dp()
76 a2dp->frame_length = cras_sbc_get_frame_length(a2dp->codec); in init_a2dp()
78 a2dp->a2dp_buf_used = in init_a2dp()
80 a2dp->frame_count = 0; in init_a2dp()
81 a2dp->seq_num = 0; in init_a2dp()
82 a2dp->samples = 0; in init_a2dp()
87 void destroy_a2dp(struct a2dp_info *a2dp) in destroy_a2dp() argument
89 cras_sbc_codec_destroy(a2dp->codec); in destroy_a2dp()
92 int a2dp_codesize(struct a2dp_info *a2dp) in a2dp_codesize() argument
94 return a2dp->codesize; in a2dp_codesize()
97 int a2dp_block_size(struct a2dp_info *a2dp, int a2dp_bytes) in a2dp_block_size() argument
99 return a2dp_bytes / a2dp->frame_length * a2dp->codesize; in a2dp_block_size()
102 int a2dp_queued_frames(const struct a2dp_info *a2dp) in a2dp_queued_frames() argument
104 return a2dp->samples; in a2dp_queued_frames()
107 void a2dp_reset(struct a2dp_info *a2dp) in a2dp_reset() argument
109 a2dp->a2dp_buf_used = in a2dp_reset()
111 a2dp->samples = 0; in a2dp_reset()
112 a2dp->seq_num = 0; in a2dp_reset()
113 a2dp->frame_count = 0; in a2dp_reset()
116 static int avdtp_write(int stream_fd, struct a2dp_info *a2dp) in avdtp_write() argument
122 header = (struct rtp_header *)a2dp->a2dp_buf; in avdtp_write()
123 payload = (struct rtp_payload *)(a2dp->a2dp_buf + sizeof(*header)); in avdtp_write()
124 memset(a2dp->a2dp_buf, 0, sizeof(*header) + sizeof(*payload)); in avdtp_write()
126 payload->frame_count = a2dp->frame_count; in avdtp_write()
129 header->sequence_number = htons(a2dp->seq_num); in avdtp_write()
130 header->timestamp = htonl(a2dp->nsamples); in avdtp_write()
133 err = send(stream_fd, a2dp->a2dp_buf, a2dp->a2dp_buf_used, in avdtp_write()
139 samples = a2dp->samples; in avdtp_write()
142 a2dp->a2dp_buf_used = sizeof(*header) + sizeof(*payload); in avdtp_write()
143 a2dp->frame_count = 0; in avdtp_write()
144 a2dp->samples = 0; in avdtp_write()
145 a2dp->seq_num++; in avdtp_write()
150 int a2dp_encode(struct a2dp_info *a2dp, const void *pcm_buf, int pcm_buf_size, in a2dp_encode() argument
158 if (link_mtu == a2dp->a2dp_buf_used) in a2dp_encode()
161 processed = a2dp->codec->encode(a2dp->codec, pcm_buf, pcm_buf_size, in a2dp_encode()
162 a2dp->a2dp_buf + a2dp->a2dp_buf_used, in a2dp_encode()
163 link_mtu - a2dp->a2dp_buf_used, in a2dp_encode()
170 if (a2dp->codesize > 0) in a2dp_encode()
171 a2dp->frame_count += processed / a2dp->codesize; in a2dp_encode()
172 a2dp->a2dp_buf_used += out_encoded; in a2dp_encode()
174 a2dp->samples += processed / format_bytes; in a2dp_encode()
175 a2dp->nsamples += processed / format_bytes; in a2dp_encode()
180 int a2dp_write(struct a2dp_info *a2dp, int stream_fd, size_t link_mtu) in a2dp_write() argument
183 if (a2dp->a2dp_buf_used + a2dp->frame_length > link_mtu) in a2dp_write()
184 return avdtp_write(stream_fd, a2dp); in a2dp_write()