Lines Matching defs:avctx
37 static av_cold int s302m_encode_init(AVCodecContext *avctx)
39 S302MEncContext *s = avctx->priv_data;
41 if (avctx->ch_layout.nb_channels & 1 || avctx->ch_layout.nb_channels > 8) {
42 av_log(avctx, AV_LOG_ERROR,
44 avctx->ch_layout.nb_channels);
48 switch (avctx->sample_fmt) {
50 avctx->bits_per_raw_sample = 16;
53 if (avctx->bits_per_raw_sample > 20) {
54 if (avctx->bits_per_raw_sample > 24)
55 av_log(avctx, AV_LOG_WARNING, "encoding as 24 bits-per-sample\n");
56 avctx->bits_per_raw_sample = 24;
57 } else if (!avctx->bits_per_raw_sample) {
58 avctx->bits_per_raw_sample = 24;
59 } else if (avctx->bits_per_raw_sample <= 20) {
60 avctx->bits_per_raw_sample = 20;
64 avctx->frame_size = 0;
65 avctx->bit_rate = 48000 * avctx->ch_layout.nb_channels *
66 (avctx->bits_per_raw_sample + 4);
72 static int s302m_encode2_frame(AVCodecContext *avctx, AVPacket *avpkt,
75 S302MEncContext *s = avctx->priv_data;
76 const int nb_channels = avctx->ch_layout.nb_channels;
79 (avctx->bits_per_raw_sample + 4)) / 8;
85 av_log(avctx, AV_LOG_ERROR, "number of samples in frame too big\n");
89 if ((ret = ff_get_encode_buffer(avctx, avpkt, buf_size, 0)) < 0)
97 put_bits(&pb, 2, (avctx->bits_per_raw_sample - 16) / 4); // bits per samples (0 = 16bit, 1 = 20bit, 2 = 24bit)
102 if (avctx->bits_per_raw_sample == 24) {
124 } else if (avctx->bits_per_raw_sample == 20) {
145 } else if (avctx->bits_per_raw_sample == 16) {