#include "amrwbdata.h"
-typedef struct {
- AVFrame avframe; ///< AVFrame for decoded samples
+typedef struct AMRWBContext {
AMRWBFrame frame; ///< AMRWB parameters decoded from bitstream
enum Mode fr_cur_mode; ///< mode index of current frame
uint8_t fr_quality; ///< frame quality index (FQI)
int i;
if (avctx->channels > 1) {
- av_log_missing_feature(avctx, "multi-channel AMR", 0);
+ avpriv_report_missing_feature(avctx, "multi-channel AMR");
return AVERROR_PATCHWELCOME;
}
for (i = 0; i < 4; i++)
ctx->prediction_error[i] = MIN_ENERGY;
- avcodec_get_frame_defaults(&ctx->avframe);
- avctx->coded_frame = &ctx->avframe;
-
return 0;
}
*
* @param[in] ind Array of 5 indexes
* @param[out] isf_q Buffer for isf_q[LP_ORDER]
- *
*/
static void decode_isf_indices_36b(uint16_t *ind, float *isf_q)
{
*
* @param[in] ind Array of 7 indexes
* @param[out] isf_q Buffer for isf_q[LP_ORDER]
- *
*/
static void decode_isf_indices_46b(uint16_t *ind, float *isf_q)
{
*
* @param[in,out] isf_q Current quantized ISF
* @param[in,out] isf_past Past quantized ISF
- *
*/
static void isf_add_mean_and_past(float *isf_q, float *isf_past)
{
int *got_frame_ptr, AVPacket *avpkt)
{
AMRWBContext *ctx = avctx->priv_data;
+ AVFrame *frame = data;
AMRWBFrame *cf = &ctx->frame;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
int sub, i, ret;
/* get output buffer */
- ctx->avframe.nb_samples = 4 * AMRWB_SFR_SIZE_16k;
- if ((ret = ff_get_buffer(avctx, &ctx->avframe)) < 0) {
+ frame->nb_samples = 4 * AMRWB_SFR_SIZE_16k;
+ if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- buf_out = (float *)ctx->avframe.data[0];
+ buf_out = (float *)frame->data[0];
header_size = decode_mime_header(ctx, buf);
if (ctx->fr_cur_mode > MODE_SID) {
av_log(avctx, AV_LOG_ERROR, "Encountered a bad or corrupted frame\n");
if (ctx->fr_cur_mode == MODE_SID) { /* Comfort noise frame */
- av_log_missing_feature(avctx, "SID mode", 1);
+ avpriv_request_sample(avctx, "SID mode");
return AVERROR_PATCHWELCOME;
}
memcpy(ctx->isp_sub4_past, ctx->isp[3], LP_ORDER * sizeof(ctx->isp[3][0]));
memcpy(ctx->isf_past_final, ctx->isf_cur, LP_ORDER * sizeof(float));
- *got_frame_ptr = 1;
- *(AVFrame *)data = ctx->avframe;
+ *got_frame_ptr = 1;
return expected_fr_size;
}
AVCodec ff_amrwb_decoder = {
.name = "amrwb",
+ .long_name = NULL_IF_CONFIG_SMALL("AMR-WB (Adaptive Multi-Rate WideBand)"),
.type = AVMEDIA_TYPE_AUDIO,
.id = AV_CODEC_ID_AMR_WB,
.priv_data_size = sizeof(AMRWBContext),
.init = amrwb_decode_init,
.decode = amrwb_decode_frame,
- .capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("AMR-WB (Adaptive Multi-Rate WideBand)"),
+ .capabilities = AV_CODEC_CAP_DR1,
.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLT,
AV_SAMPLE_FMT_NONE },
};