Lines Matching defs:avctx
38 static av_cold int tta_encode_init(AVCodecContext *avctx)
40 TTAEncContext *s = avctx->priv_data;
44 switch (avctx->sample_fmt) {
46 avctx->bits_per_raw_sample = 8;
49 avctx->bits_per_raw_sample = 16;
52 if (avctx->bits_per_raw_sample > 24)
53 av_log(avctx, AV_LOG_WARNING, "encoding as 24 bits-per-sample\n");
54 avctx->bits_per_raw_sample = 24;
57 s->bps = avctx->bits_per_raw_sample >> 3;
58 avctx->frame_size = 256 * avctx->sample_rate / 245;
60 s->ch_ctx = av_malloc_array(avctx->ch_layout.nb_channels, sizeof(*s->ch_ctx));
87 static int tta_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
90 TTAEncContext *s = avctx->priv_data;
93 int64_t pkt_size = frame->nb_samples * 2LL * avctx->ch_layout.nb_channels * s->bps;
97 if ((ret = ff_alloc_packet(avctx, avpkt, pkt_size)) < 0)
102 for (i = 0; i < avctx->ch_layout.nb_channels; i++) {
108 for (i = 0; i < frame->nb_samples * avctx->ch_layout.nb_channels; i++) {
115 value = get_sample(frame, samples++, avctx->sample_fmt);
117 if (avctx->ch_layout.nb_channels > 1) {
118 if (cur_chan < avctx->ch_layout.nb_channels - 1)
119 value = res = get_sample(frame, samples, avctx->sample_fmt) - value;
180 if (cur_chan < avctx->ch_layout.nb_channels - 1)
193 avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples);
198 static av_cold int tta_encode_close(AVCodecContext *avctx)
200 TTAEncContext *s = avctx->priv_data;