| 217 | } |
| 218 | |
| 219 | static int aptx_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
| 220 | const AVFrame *frame, int *got_packet_ptr) |
| 221 | { |
| 222 | AptXEncContext *const s0 = avctx->priv_data; |
| 223 | AptXContext *const s = &s0->common; |
| 224 | int pos, ipos, channel, sample, output_size, ret; |
| 225 | |
| 226 | if ((ret = ff_af_queue_add(&s0->afq, frame)) < 0) |
| 227 | return ret; |
| 228 | |
| 229 | output_size = s->block_size * frame->nb_samples/4; |
| 230 | if ((ret = ff_get_encode_buffer(avctx, avpkt, output_size, 0)) < 0) |
| 231 | return ret; |
| 232 | |
| 233 | for (pos = 0, ipos = 0; pos < output_size; pos += s->block_size, ipos += 4) { |
| 234 | int32_t samples[NB_CHANNELS][4]; |
| 235 | |
| 236 | for (channel = 0; channel < NB_CHANNELS; channel++) |
| 237 | for (sample = 0; sample < 4; sample++) |
| 238 | samples[channel][sample] = (int32_t)AV_RN32A(&frame->data[channel][4*(ipos+sample)]) >> 8; |
| 239 | |
| 240 | aptx_encode_samples(s, samples, avpkt->data + pos); |
| 241 | } |
| 242 | |
| 243 | ff_af_queue_remove(&s0->afq, frame->nb_samples, &avpkt->pts, &avpkt->duration); |
| 244 | *got_packet_ptr = 1; |
| 245 | return 0; |
| 246 | } |
| 247 | |
| 248 | static av_cold int aptx_close(AVCodecContext *avctx) |
| 249 | { |
nothing calls this directly
no test coverage detected