* Copyright (c) 2008 Vladimir Voroshilov
* Copyright (c) 2009 Vitor Sessak
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "sipr.h"
#include "siprdata.h"
-typedef struct {
+typedef struct SiprModeParam {
const char *mode_name;
uint16_t bits_per_frame;
uint8_t subframe_count;
1.0/(1 << 13), 1.0/(1 << 14), 1.0/(1 << 15), 1.0/(1 << 16)
};
-static void dequant(float *out, const int *idx, const float *cbs[])
+static void dequant(float *out, const int *idx, const float * const cbs[])
{
int i;
int stride = 2;
float tmp1[SUBFR_SIZE+1], tmp2[LP_FILTER_ORDER+1];
int i;
- tmp1[0] = 1.;
+ tmp1[0] = 1.0;
for (i = 0; i < LP_FILTER_ORDER; i++) {
tmp1[i+1] = Az[i] * ff_pow_0_55[i];
tmp2[i ] = Az[i] * ff_pow_0_7 [i];
else if (avctx->bit_rate > 5750 ) ctx->mode = MODE_6k5;
else ctx->mode = MODE_5k0;
av_log(avctx, AV_LOG_WARNING,
- "Invalid block_align: %d. Mode %s guessed based on bitrate: %d\n",
- avctx->block_align, modes[ctx->mode].mode_name, avctx->bit_rate);
+ "Invalid block_align: %d. Mode %s guessed based on bitrate: %"PRId64"\n",
+ avctx->block_align, modes[ctx->mode].mode_name, (int64_t)avctx->bit_rate);
}
av_log(avctx, AV_LOG_DEBUG, "Mode: %s\n", modes[ctx->mode].mode_name);
avctx->channel_layout = AV_CH_LAYOUT_MONO;
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
- avcodec_get_frame_defaults(&ctx->frame);
- avctx->coded_frame = &ctx->frame;
-
return 0;
}
int *got_frame_ptr, AVPacket *avpkt)
{
SiprContext *ctx = avctx->priv_data;
+ AVFrame *frame = data;
const uint8_t *buf=avpkt->data;
SiprParameters parm;
const SiprModeParam *mode_par = &modes[ctx->mode];
av_log(avctx, AV_LOG_ERROR,
"Error processing packet: packet size (%d) too small\n",
avpkt->size);
- return -1;
+ return AVERROR_INVALIDDATA;
}
/* get output buffer */
- ctx->frame.nb_samples = mode_par->frames_per_packet * subframe_size *
- mode_par->subframe_count;
- if ((ret = ff_get_buffer(avctx, &ctx->frame)) < 0) {
- av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ frame->nb_samples = mode_par->frames_per_packet * subframe_size *
+ mode_par->subframe_count;
+ if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
- }
- samples = (float *)ctx->frame.data[0];
+ samples = (float *)frame->data[0];
init_get_bits(&gb, buf, mode_par->bits_per_frame);
samples += subframe_size * mode_par->subframe_count;
}
- *got_frame_ptr = 1;
- *(AVFrame *)data = ctx->frame;
+ *got_frame_ptr = 1;
return mode_par->bits_per_frame >> 3;
}
AVCodec ff_sipr_decoder = {
.name = "sipr",
+ .long_name = NULL_IF_CONFIG_SMALL("RealAudio SIPR / ACELP.NET"),
.type = AVMEDIA_TYPE_AUDIO,
.id = AV_CODEC_ID_SIPR,
.priv_data_size = sizeof(SiprContext),
.init = sipr_decoder_init,
.decode = sipr_decode_frame,
- .capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("RealAudio SIPR / ACELP.NET"),
+ .capabilities = AV_CODEC_CAP_DR1,
};