Lines Matching defs:avctx

182     AVCodecContext*  avctx;                         ///< codec context for av_log
265 #define PRINT(a, b) av_log(s->avctx, AV_LOG_DEBUG, " %s = %d\n", a, b);
266 #define PRINT_HEX(a, b) av_log(s->avctx, AV_LOG_DEBUG, " %s = %"PRIx32"\n", a, b);
279 *@param avctx codec context
294 static av_cold int wmapro_decode_end(AVCodecContext *avctx)
296 WMAProDecodeCtx *s = avctx->priv_data;
303 static av_cold int get_rate(AVCodecContext *avctx)
305 if (avctx->codec_id != AV_CODEC_ID_WMAPRO) { // XXX: is this really only for XMA?
306 if (avctx->sample_rate > 44100)
308 else if (avctx->sample_rate > 32000)
310 else if (avctx->sample_rate > 24000)
315 return avctx->sample_rate;
352 *@param avctx codec context
355 static av_cold int decode_init(WMAProDecodeCtx *s, AVCodecContext *avctx, int num_stream)
358 uint8_t *edata_ptr = avctx->extradata;
364 if (avctx->codec_id == AV_CODEC_ID_XMA1 || avctx->codec_id == AV_CODEC_ID_XMA2)
365 avctx->block_align = 2048;
367 if (!avctx->block_align) {
368 av_log(avctx, AV_LOG_ERROR, "block_align is not set\n");
372 s->avctx = avctx;
376 avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
379 av_log(avctx, AV_LOG_DEBUG, "extradata:\n");
380 for (i = 0; i < avctx->extradata_size; i++)
381 av_log(avctx, AV_LOG_DEBUG, "[%x] ", avctx->extradata[i]);
382 av_log(avctx, AV_LOG_DEBUG, "\n");
384 if (avctx->codec_id == AV_CODEC_ID_XMA2 && avctx->extradata_size == 34) { /* XMA2WAVEFORMATEX */
388 if ((num_stream+1) * XMA_MAX_CHANNELS_STREAM > avctx->ch_layout.nb_channels) /* stream config is 2ch + 2ch + ... + 1/2ch */
392 } else if (avctx->codec_id == AV_CODEC_ID_XMA2) { /* XMA2WAVEFORMAT */
397 } else if (avctx->codec_id == AV_CODEC_ID_XMA1) { /* XMAWAVEFORMAT */
402 } else if (avctx->codec_id == AV_CODEC_ID_WMAPRO && avctx->extradata_size >= 18) {
406 s->nb_channels = channel_mask ? av_popcount(channel_mask) : avctx->ch_layout.nb_channels;
409 avpriv_request_sample(avctx, "bits per sample is %d", s->bits_per_sample);
413 avpriv_request_sample(avctx, "Unknown extradata size");
418 s->log2_frame_size = av_log2(avctx->block_align) + 4;
420 avpriv_request_sample(avctx, "Large block align");
431 if (avctx->codec_id == AV_CODEC_ID_WMAPRO) {
432 bits = ff_wma_get_frame_len_bits(avctx->sample_rate, 3, s->decode_flags);
434 avpriv_request_sample(avctx, "14-bit block sizes");
454 av_log(avctx, AV_LOG_ERROR, "invalid number of subframes %"PRId8"\n",
460 av_log(avctx, AV_LOG_ERROR, "min_samples_per_subframe of %d too small\n",
465 if (s->avctx->sample_rate <= 0) {
466 av_log(avctx, AV_LOG_ERROR, "invalid sample rate\n");
471 av_log(avctx, AV_LOG_ERROR, "invalid number of channels %d\n",
474 } else if (avctx->codec_id != AV_CODEC_ID_WMAPRO && s->nb_channels > XMA_MAX_CHANNELS_STREAM) {
475 av_log(avctx, AV_LOG_ERROR, "invalid number of channels per XMA stream %d\n",
478 } else if (s->nb_channels > WMAPRO_MAX_CHANNELS || s->nb_channels > avctx->ch_layout.nb_channels) {
479 avpriv_request_sample(avctx,
505 int rate = get_rate(avctx);
521 av_log(avctx, AV_LOG_ERROR, "num_sfb invalid\n");
549 s->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
571 int cutoff = (440*block_size + 3LL * (s->avctx->sample_rate >> 1) - 1)
572 / s->avctx->sample_rate;
576 if (avctx->debug & FF_DEBUG_BITSTREAM)
579 if (avctx->codec_id == AV_CODEC_ID_WMAPRO) {
581 av_channel_layout_uninit(&avctx->ch_layout);
582 av_channel_layout_from_mask(&avctx->ch_layout, channel_mask);
584 avctx->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
594 *@param avctx codec context
597 static av_cold int wmapro_decode_init(AVCodecContext *avctx)
599 WMAProDecodeCtx *s = avctx->priv_data;
601 return decode_init(s, avctx, 0);
634 av_log(s->avctx, AV_LOG_ERROR, "broken frame: subframe_len %i\n",
710 av_log(s->avctx, AV_LOG_ERROR,
718 av_log(s->avctx, AV_LOG_ERROR, "broken frame: "
736 ff_dlog(s->avctx, "frame[%"PRIu32"] channel[%i] subframe[%i]"
816 avpriv_request_sample(s->avctx,
853 avpriv_request_sample(s->avctx,
880 avpriv_request_sample(s->avctx,
936 ff_dlog(s->avctx, "decode coefficients for channel %i\n", c);
1006 ret = ff_wma_run_level_decode(s->avctx, &s->gb, vlc,
1087 av_log(s->avctx, AV_LOG_ERROR,
1224 ff_dlog(s->avctx,
1251 ff_dlog(s->avctx, "subframe is part of %i channels\n",
1282 av_log(s->avctx, AV_LOG_ERROR, "invalid number of fill bits\n");
1292 avpriv_request_sample(s->avctx, "Reserved bit");
1319 av_log(s->avctx, AV_LOG_ERROR, "num_vec_coeffs %d is too large\n", num_vec_coeffs);
1344 av_log(s->avctx, AV_LOG_DEBUG, "negative quant step\n");
1370 ff_dlog(s->avctx, "BITSTREAM: subframe header length was %i\n",
1384 ff_dlog(s->avctx, "BITSTREAM: subframe length was %i\n",
1425 av_log(s->avctx, AV_LOG_ERROR, "broken subframe\n");
1451 ff_dlog(s->avctx, "decoding frame with length %x\n", len);
1470 ff_dlog(s->avctx, "drc_gain %i\n", s->drc_gain);
1483 ff_dlog(s->avctx, "BITSTREAM: frame header length was %i\n",
1525 av_log(s->avctx, AV_LOG_ERROR,
1583 avpriv_request_sample(s->avctx, "Too small input buffer");
1612 static int decode_packet(AVCodecContext *avctx, WMAProDecodeCtx *s,
1651 if (avctx->codec_id == AV_CODEC_ID_WMAPRO && buf_size < avctx->block_align) {
1652 av_log(avctx, AV_LOG_ERROR, "Input packet too small (%d < %d)\n",
1653 buf_size, avctx->block_align);
1658 if (avctx->codec_id == AV_CODEC_ID_WMAPRO) {
1659 s->next_packet_start = buf_size - avctx->block_align;
1660 buf_size = avctx->block_align;
1662 s->next_packet_start = buf_size - FFMIN(buf_size, avctx->block_align);
1663 buf_size = FFMIN(buf_size, avctx->block_align);
1671 if (avctx->codec_id != AV_CODEC_ID_XMA2) {
1676 ff_dlog(avctx, "packet[%d]: number of frames %d\n", avctx->frame_number, num_frames);
1682 if (avctx->codec_id != AV_CODEC_ID_WMAPRO) {
1685 ff_dlog(avctx, "packet[%d]: skip packets %d\n", avctx->frame_number, s->skip_packets);
1688 ff_dlog(avctx, "packet[%d]: nbpf %x\n", avctx->frame_number,
1692 if (avctx->codec_id == AV_CODEC_ID_WMAPRO && !s->packet_loss &&
1695 av_log(avctx, AV_LOG_ERROR,
1711 ff_dlog(avctx, "accumulated %x bits of frame data\n",
1718 ff_dlog(avctx, "ignoring %x previously saved bits\n",
1764 av_log(avctx, AV_LOG_ERROR, "Overread %d\n", -remaining_bits(s, gb));
1779 if (s->trim_start && avctx->codec_id == AV_CODEC_ID_WMAPRO) {
1792 if (s->trim_end && avctx->codec_id == AV_CODEC_ID_WMAPRO) {
1807 *@param avctx codec context
1812 static int wmapro_decode_packet(AVCodecContext *avctx, AVFrame *frame,
1815 WMAProDecodeCtx *s = avctx->priv_data;
1820 if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {
1825 return decode_packet(avctx, s, frame, got_frame_ptr, avpkt);
1828 static int xma_decode_packet(AVCodecContext *avctx, AVFrame *frame,
1831 XMADecodeCtx *s = avctx->priv_data;
1836 avctx->internal->skip_samples = 64;
1838 if ((ret = ff_get_buffer(avctx, s->frames[s->current_stream], 0)) < 0)
1841 avctx->internal->skip_samples = 64;
1844 if ((ret = ff_get_buffer(avctx, s->frames[s->current_stream], 0)) < 0)
1849 ret = decode_packet(avctx, &s->xma[s->current_stream], s->frames[s->current_stream],
1858 ret = decode_packet(avctx, &s->xma[i], s->frames[i],
1928 if ((bret = ff_get_buffer(avctx, frame, 0)) < 0)
1949 static av_cold int xma_decode_init(AVCodecContext *avctx)
1951 XMADecodeCtx *s = avctx->priv_data;
1954 if (avctx->ch_layout.nb_channels <= 0 || avctx->extradata_size == 0)
1958 if (avctx->codec_id == AV_CODEC_ID_XMA2 && avctx->extradata_size == 34) { /* XMA2WAVEFORMATEX */
1959 unsigned int channel_mask = AV_RL32(avctx->extradata + 2);
1961 av_channel_layout_uninit(&avctx->ch_layout);
1962 av_channel_layout_from_mask(&avctx->ch_layout, channel_mask);
1964 avctx->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
1965 s->num_streams = AV_RL16(avctx->extradata);
1966 } else if (avctx->codec_id == AV_CODEC_ID_XMA2 && avctx->extradata_size >= 2) { /* XMA2WAVEFORMAT */
1967 s->num_streams = avctx->extradata[1];
1968 if (avctx->extradata_size != (32 + ((avctx->extradata[0]==3)?0:8) + 4*s->num_streams)) {
1969 av_log(avctx, AV_LOG_ERROR, "Incorrect XMA2 extradata size\n");
1973 } else if (avctx->codec_id == AV_CODEC_ID_XMA1 && avctx->extradata_size >= 4) { /* XMAWAVEFORMAT */
1974 s->num_streams = avctx->extradata[4];
1975 if (avctx->extradata_size != (8 + 20*s->num_streams)) {
1976 av_log(avctx, AV_LOG_ERROR, "Incorrect XMA1 extradata size\n");
1981 av_log(avctx, AV_LOG_ERROR, "Incorrect XMA config\n");
1986 if (avctx->ch_layout.nb_channels > XMA_MAX_CHANNELS || s->num_streams > XMA_MAX_STREAMS ||
1989 avpriv_request_sample(avctx, "More than %d channels in %d streams", XMA_MAX_CHANNELS, s->num_streams);
1996 ret = decode_init(&s->xma[i], avctx, i);
2006 if (start_channels != avctx->ch_layout.nb_channels)
2010 s->samples[0][i] = av_audio_fifo_alloc(avctx->sample_fmt, 1, 64 * 512);
2011 s->samples[1][i] = av_audio_fifo_alloc(avctx->sample_fmt, 1, 64 * 512);
2019 static av_cold int xma_decode_end(AVCodecContext *avctx)
2021 XMADecodeCtx *s = avctx->priv_data;
2054 *@param avctx codec context
2056 static void wmapro_flush(AVCodecContext *avctx)
2058 WMAProDecodeCtx *s = avctx->priv_data;
2063 static void xma_flush(AVCodecContext *avctx)
2065 XMADecodeCtx *s = avctx->priv_data;