Lines Matching defs:avctx
51 AVCodecContext *avctx;
83 av_log(s->avctx, AV_LOG_ERROR, "CRC error\n");
105 static int allocate_buffers(AVCodecContext *avctx)
107 TTAContext *s = avctx->priv_data;
116 s->ch_ctx = av_malloc_array(avctx->ch_layout.nb_channels, sizeof(*s->ch_ctx));
123 static av_cold int tta_decode_init(AVCodecContext * avctx)
125 TTAContext *s = avctx->priv_data;
130 s->avctx = avctx;
133 if (avctx->extradata_size < 22)
137 ret = init_get_bits8(&gb, avctx->extradata, avctx->extradata_size);
147 av_log(avctx, AV_LOG_ERROR, "Invalid format\n");
152 av_log(avctx, AV_LOG_ERROR, "Missing password for encrypted stream. Please use the -password option\n");
160 av_channel_layout_uninit(&avctx->ch_layout);
162 av_channel_layout_from_mask(&avctx->ch_layout, tta_channel_layouts[s->channels-2]);
164 avctx->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
165 avctx->ch_layout.nb_channels = s->channels;
168 avctx->bits_per_raw_sample = get_bits(&gb, 16);
169 s->bps = (avctx->bits_per_raw_sample + 7) / 8;
170 avctx->sample_rate = get_bits_long(&gb, 32);
175 av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n");
177 } else if (avctx->sample_rate == 0) {
178 av_log(avctx, AV_LOG_ERROR, "Invalid samplerate\n");
183 case 1: avctx->sample_fmt = AV_SAMPLE_FMT_U8; break;
185 avctx->sample_fmt = AV_SAMPLE_FMT_S16;
188 avctx->sample_fmt = AV_SAMPLE_FMT_S32;
190 //case 4: avctx->sample_fmt = AV_SAMPLE_FMT_S32; break;
192 av_log(avctx, AV_LOG_ERROR, "Invalid/unsupported sample format.\n");
197 if (avctx->sample_rate > 0x7FFFFFu) {
198 av_log(avctx, AV_LOG_ERROR, "sample_rate too large\n");
201 s->frame_length = 256 * avctx->sample_rate / 245;
207 av_log(avctx, AV_LOG_DEBUG, "format: %d chans: %d bps: %d rate: %d block: %d\n",
208 s->format, avctx->ch_layout.nb_channels, avctx->bits_per_coded_sample, avctx->sample_rate,
209 avctx->block_align);
210 av_log(avctx, AV_LOG_DEBUG, "data_length: %d frame_length: %d last: %d total: %d\n",
214 av_log(avctx, AV_LOG_ERROR, "frame_length too large\n");
218 av_log(avctx, AV_LOG_ERROR, "Wrong extradata present\n");
224 return allocate_buffers(avctx);
227 static int tta_decode_frame(AVCodecContext *avctx, AVFrame *frame,
232 TTAContext *s = avctx->priv_data;
238 if (avctx->err_recognition & AV_EF_CRCCHECK) {
240 (tta_check_crc(s, buf, buf_size - 4) && avctx->err_recognition & AV_EF_EXPLODE))
249 if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0)
388 av_log(avctx, AV_LOG_WARNING, "%d overflows occurred on 24bit upscale\n", overflow);
405 static av_cold int tta_decode_close(AVCodecContext *avctx) {
406 TTAContext *s = avctx->priv_data;