#include "libavutil/channel_layout.h"
#include "libavutil/float_dsp.h"
+#include "libavutil/internal.h"
#include "avcodec.h"
#include "get_bits.h"
#include "dsputil.h"
} IMCChannel;
typedef struct {
- AVFrame frame;
-
IMCChannel chctx[2];
/** MDCT tables */
avctx->channels = 1;
if (avctx->channels > 2) {
- av_log_ask_for_sample(avctx, "Number of channels is not supported\n");
+ avpriv_request_sample(avctx, "Number of channels > 2");
return AVERROR_PATCHWELCOME;
}
avctx->channel_layout = avctx->channels == 1 ? AV_CH_LAYOUT_MONO
: AV_CH_LAYOUT_STEREO;
- avcodec_get_frame_defaults(&q->frame);
- avctx->coded_frame = &q->frame;
-
return 0;
}
stream_format_code = get_bits(&q->gb, 3);
if (stream_format_code & 1) {
- av_log_ask_for_sample(avctx, "Stream format %X is not supported\n",
- stream_format_code);
+ avpriv_request_sample(avctx, "Stream format %X", stream_format_code);
return AVERROR_PATCHWELCOME;
}
static int imc_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
+ AVFrame *frame = data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
int ret, i;
}
/* get output buffer */
- q->frame.nb_samples = COEFFS;
- if ((ret = ff_get_buffer(avctx, &q->frame)) < 0) {
+ frame->nb_samples = COEFFS;
+ if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
for (i = 0; i < avctx->channels; i++) {
- q->out_samples = (float *)q->frame.extended_data[i];
+ q->out_samples = (float *)frame->extended_data[i];
q->dsp.bswap16_buf(buf16, (const uint16_t*)buf, IMC_BLOCK_SIZE / 2);
}
if (avctx->channels == 2) {
- q->fdsp.butterflies_float((float *)q->frame.extended_data[0],
- (float *)q->frame.extended_data[1], COEFFS);
+ q->fdsp.butterflies_float((float *)frame->extended_data[0],
+ (float *)frame->extended_data[1], COEFFS);
}
- *got_frame_ptr = 1;
- *(AVFrame *)data = q->frame;
+ *got_frame_ptr = 1;
return IMC_BLOCK_SIZE * avctx->channels;
}