#include "libavutil/float_dsp.h"
#include "libavutil/intfloat.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
+
#include "avcodec.h"
#include "internal.h"
#include "get_bits.h"
for (i = 0; i < WMAPRO_BLOCK_SIZES; i++)
ff_mdct_init(&s->mdct_ctx[i], WMAPRO_BLOCK_MIN_BITS+1+i, 1,
1.0 / (1 << (WMAPRO_BLOCK_MIN_BITS + i - 1))
- / (1 << (s->bits_per_sample - 1)));
+ / (1ll << (s->bits_per_sample - 1)));
/** init MDCT windows: simple sine window */
for (i = 0; i < WMAPRO_BLOCK_SIZES; i++) {
s->num_saved_bits += len;
if (!append) {
- avpriv_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3),
+ ff_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3),
s->num_saved_bits);
} else {
int align = 8 - (get_bits_count(gb) & 7);
align = FFMIN(align, len);
put_bits(&s->pb, align, get_bits(gb, align));
len -= align;
- avpriv_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3), len);
+ ff_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3), len);
}
skip_bits_long(gb, len);
if (avctx->codec_id == AV_CODEC_ID_WMAPRO && buf_size < avctx->block_align) {
av_log(avctx, AV_LOG_ERROR, "Input packet too small (%d < %d)\n",
buf_size, avctx->block_align);
+ s->packet_loss = 1;
return AVERROR_INVALIDDATA;
}
}
} else {
int frame_size;
+
+ if (avpkt->size < s->next_packet_start) {
+ s->packet_loss = 1;
+ return AVERROR_INVALIDDATA;
+ }
+
s->buf_bit_size = (avpkt->size - s->next_packet_start) << 3;
init_get_bits(gb, avpkt->data, s->buf_bit_size);
skip_bits(gb, s->packet_offset);
/**
*@brief wmapro decoder
*/
-AVCodec ff_wmapro_decoder = {
+const AVCodec ff_wmapro_decoder = {
.name = "wmapro",
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 9 Professional"),
.type = AVMEDIA_TYPE_AUDIO,
AV_SAMPLE_FMT_NONE },
};
-AVCodec ff_xma1_decoder = {
+const AVCodec ff_xma1_decoder = {
.name = "xma1",
.long_name = NULL_IF_CONFIG_SMALL("Xbox Media Audio 1"),
.type = AVMEDIA_TYPE_AUDIO,
AV_SAMPLE_FMT_NONE },
};
-AVCodec ff_xma2_decoder = {
+const AVCodec ff_xma2_decoder = {
.name = "xma2",
.long_name = NULL_IF_CONFIG_SMALL("Xbox Media Audio 2"),
.type = AVMEDIA_TYPE_AUDIO,