Lines Matching refs:avctx
37 static av_cold int libspeex_decode_init(AVCodecContext *avctx)
39 LibSpeexContext *s = avctx->priv_data;
43 if (avctx->sample_rate <= 8000)
45 else if (avctx->sample_rate <= 16000)
50 if (avctx->extradata_size >= 80)
51 s->header = speex_packet_to_header(avctx->extradata, avctx->extradata_size);
53 avctx->sample_fmt = AV_SAMPLE_FMT_S16;
55 avctx->sample_rate = s->header->rate;
56 avctx->channels = s->header->nb_channels;
57 avctx->frame_size = s->frame_size = s->header->frame_size;
59 avctx->frame_size *= s->header->frames_per_packet;
63 av_log(avctx, AV_LOG_ERROR, "Unknown Speex mode %d", s->header->mode);
67 av_log(avctx, AV_LOG_INFO, "Missing Speex header, assuming defaults.\n");
69 if (avctx->channels > 2) {
70 av_log(avctx, AV_LOG_ERROR, "Only stereo and mono are supported.\n");
77 av_log(avctx, AV_LOG_ERROR, "Error initializing libspeex decoder.\n");
85 if (avctx->channels == 2) {
95 avctx->coded_frame = &s->frame;
100 static int libspeex_decode_frame(AVCodecContext *avctx, void *data,
105 LibSpeexContext *s = avctx->priv_data;
111 if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
112 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
134 av_log(avctx, AV_LOG_ERROR, "Error decoding Speex frame.\n");
137 if (avctx->channels == 2)
146 static av_cold int libspeex_decode_close(AVCodecContext *avctx)
148 LibSpeexContext *s = avctx->priv_data;
157 static av_cold void libspeex_decode_flush(AVCodecContext *avctx)
159 LibSpeexContext *s = avctx->priv_data;