Lines Matching refs:avctx

41 static av_cold int libspeex_decode_init(AVCodecContext *avctx)
43 LibSpeexContext *s = avctx->priv_data;
46 int spx_mode, channels = avctx->ch_layout.nb_channels;
48 if (avctx->extradata && avctx->extradata_size >= 80) {
49 header = speex_packet_to_header(avctx->extradata,
50 avctx->extradata_size);
52 av_log(avctx, AV_LOG_WARNING, "Invalid Speex header\n");
54 if (avctx->codec_tag == MKTAG('S', 'P', 'X', 'N')) {
56 if (!avctx->extradata || avctx->extradata && avctx->extradata_size < 47) {
57 av_log(avctx, AV_LOG_ERROR, "Missing or invalid extradata.\n");
61 quality = avctx->extradata[37];
63 av_log(avctx, AV_LOG_ERROR, "Unsupported quality mode %d.\n", quality);
71 avctx->sample_rate = header->rate;
76 switch (avctx->sample_rate) {
82 av_log(avctx, AV_LOG_WARNING, "Invalid sample rate: %d\n"
84 avctx->sample_rate);
91 av_log(avctx, AV_LOG_ERROR, "Unknown Speex mode %d", spx_mode);
95 if (!avctx->sample_rate)
96 avctx->sample_rate = 8000 << spx_mode;
100 av_log(avctx, AV_LOG_ERROR, "Invalid channel count: %d.\n"
104 av_channel_layout_uninit(&avctx->ch_layout);
105 avctx->ch_layout = channels == 2 ? (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO :
111 av_log(avctx, AV_LOG_ERROR, "Error initializing libspeex decoder.\n");
127 static int libspeex_decode_frame(AVCodecContext *avctx, AVFrame *frame,
132 LibSpeexContext *s = avctx->priv_data;
135 avctx->sample_fmt = AV_SAMPLE_FMT_S16;
139 if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
164 av_log(avctx, AV_LOG_ERROR, "Error decoding Speex frame.\n");
167 if (avctx->ch_layout.nb_channels == 2)
172 if (!avctx->bit_rate)
173 speex_decoder_ctl(s->dec_state, SPEEX_GET_BITRATE, &avctx->bit_rate);
177 static av_cold int libspeex_decode_close(AVCodecContext *avctx)
179 LibSpeexContext *s = avctx->priv_data;
187 static av_cold void libspeex_decode_flush(AVCodecContext *avctx)
189 LibSpeexContext *s = avctx->priv_data;