Lines Matching defs:avctx
80 AVCodecContext *avctx;
128 static av_cold int wavpack_encode_init(AVCodecContext *avctx)
130 WavPackEncodeContext *s = avctx->priv_data;
132 s->avctx = avctx;
134 if (avctx->ch_layout.nb_channels > 255) {
135 av_log(avctx, AV_LOG_ERROR, "Invalid channel count: %d\n", avctx->ch_layout.nb_channels);
139 if (!avctx->frame_size) {
141 if (!(avctx->sample_rate & 1))
142 block_samples = avctx->sample_rate / 2;
144 block_samples = avctx->sample_rate;
146 while (block_samples * avctx->ch_layout.nb_channels > WV_MAX_SAMPLES)
149 while (block_samples * avctx->ch_layout.nb_channels < 40000)
151 avctx->frame_size = block_samples;
152 } else if (avctx->frame_size && (avctx->frame_size < 128 ||
153 avctx->frame_size > WV_MAX_SAMPLES)) {
154 av_log(avctx, AV_LOG_ERROR, "invalid block size: %d\n", avctx->frame_size);
158 if (avctx->compression_level != FF_COMPRESSION_DEFAULT) {
159 if (avctx->compression_level >= 3) {
162 if (avctx->compression_level >= 8) {
165 } else if (avctx->compression_level >= 7) {
168 } else if (avctx->compression_level >= 6) {
171 } else if (avctx->compression_level >= 5) {
174 } else if (avctx->compression_level >= 4) {
178 } else if (avctx->compression_level == 2) {
181 } else if (avctx->compression_level == 1) {
184 } else if (avctx->compression_level < 1) {
2576 if (s->ch_offset == s->avctx->ch_layout.nb_channels)
2591 s->avctx->ch_layout.order == AV_CHANNEL_ORDER_NATIVE &&
2592 s->avctx->ch_layout.u.mask != AV_CH_LAYOUT_MONO &&
2593 s->avctx->ch_layout.u.mask != AV_CH_LAYOUT_STEREO) {
2595 bytestream2_put_byte(&pb, s->avctx->ch_layout.nb_channels);
2596 bytestream2_put_le32(&pb, s->avctx->ch_layout.u.mask);
2602 bytestream2_put_le24(&pb, s->avctx->sample_rate);
2826 switch (s->avctx->sample_fmt) {
2834 if (s->avctx->bits_per_raw_sample <= 24) {
2848 if (wv_rates[i] == s->avctx->sample_rate)
2855 static int wavpack_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
2858 WavPackEncodeContext *s = avctx->priv_data;
2867 if (avctx->ch_layout.nb_channels > 1) {
2874 buf_size = s->block_samples * avctx->ch_layout.nb_channels * 8
2875 + 200 * avctx->ch_layout.nb_channels /* for headers */;
2876 if ((ret = ff_alloc_packet(avctx, avpkt, buf_size)) < 0)
2880 for (s->ch_offset = 0; s->ch_offset < avctx->ch_layout.nb_channels;) {
2883 switch (s->avctx->sample_fmt) {
2885 case AV_SAMPLE_FMT_S32P: s->flags |= 3 - (s->avctx->bits_per_raw_sample <= 24); break;
2890 if (avctx->ch_layout.nb_channels - s->ch_offset == 1) {
2910 avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples);
2915 static av_cold int wavpack_encode_close(AVCodecContext *avctx)
2917 WavPackEncodeContext *s = avctx->priv_data;