Lines Matching defs:avctx

36 static av_cold int pcm_dvd_encode_init(AVCodecContext *avctx)
38 PCMDVDContext *s = avctx->priv_data;
41 switch (avctx->sample_rate) {
52 switch (avctx->sample_fmt) {
54 avctx->bits_per_coded_sample = 16;
58 avctx->bits_per_coded_sample = 24;
65 avctx->bits_per_coded_sample = 16 + quant * 4;
66 avctx->block_align = avctx->ch_layout.nb_channels * avctx->bits_per_coded_sample / 8;
67 avctx->bit_rate = avctx->block_align * 8LL * avctx->sample_rate;
68 if (avctx->bit_rate > 9800000) {
69 av_log(avctx, AV_LOG_ERROR, "Too big bitrate: reduce sample rate, bitdepth or channels.\n");
73 if (avctx->sample_fmt == AV_SAMPLE_FMT_S16) {
75 s->block_size = avctx->ch_layout.nb_channels * 2;
78 switch (avctx->ch_layout.nb_channels) {
83 s->block_size = 4 * avctx->bits_per_coded_sample / 8;
84 s->samples_per_block = 4 / avctx->ch_layout.nb_channels;
89 s->block_size = 8 * avctx->bits_per_coded_sample / 8;
94 /* need avctx->ch_layout.nb_channels groups */
95 s->block_size = 4 * avctx->ch_layout.nb_channels *
96 avctx->bits_per_coded_sample / 8;
98 s->groups_per_block = avctx->ch_layout.nb_channels;
106 s->header[1] = (quant << 6) | (freq << 4) | (avctx->ch_layout.nb_channels - 1);
109 if (!avctx->frame_size)
110 avctx->frame_size = frame_size;
115 static int pcm_dvd_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
118 PCMDVDContext *s = avctx->priv_data;
119 int samples = frame->nb_samples * avctx->ch_layout.nb_channels;
127 if ((ret = ff_get_encode_buffer(avctx, avpkt, pkt_size, 0)) < 0)
137 switch (avctx->sample_fmt) {
144 if (avctx->ch_layout.nb_channels == 1) {
171 avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples);