# libavformat dependencies
OBJS-$(CONFIG_ADTS_MUXER) += mpeg4audio.o
-OBJS-$(CONFIG_ADX_DEMUXER) += adx.o
OBJS-$(CONFIG_CAF_DEMUXER) += mpeg4audio.o mpegaudiodata.o \
ac3tab.o
OBJS-$(CONFIG_FLAC_DEMUXER) += flac.o flacdata.o \
coeff[1] = lrintf(-(c * c) * (1 << bits));
}
-int avpriv_adx_decode_header(AVCodecContext *avctx, const uint8_t *buf,
- int bufsize, int *header_size, int *coeff)
+int ff_adx_decode_header(AVCodecContext *avctx, const uint8_t *buf,
+ int bufsize, int *header_size, int *coeff)
{
int offset, cutoff;
*header_size = offset;
return 0;
}
+
+#if LIBAVCODEC_VERSION_MAJOR < 56
+int avpriv_adx_decode_header(AVCodecContext *avctx, const uint8_t *buf,
+ int bufsize, int *header_size, int *coeff)
+{
+ return ff_adx_decode_header(avctx, buf, bufsize, header_size, coeff);
+}
+#endif
* @param[out] coeff 2 LPC coefficients, can be NULL
* @return data offset or negative error code if header is invalid
*/
+int ff_adx_decode_header(AVCodecContext *avctx, const uint8_t *buf,
+ int bufsize, int *header_size, int *coeff);
+
+#if LIBAVCODEC_VERSION_MAJOR < 56
int avpriv_adx_decode_header(AVCodecContext *avctx, const uint8_t *buf,
int bufsize, int *header_size, int *coeff);
+#endif
#endif /* AVCODEC_ADX_H */
int ret, header_size;
if (avctx->extradata_size >= 24) {
- if ((ret = avpriv_adx_decode_header(avctx, avctx->extradata,
- avctx->extradata_size, &header_size,
- c->coeff)) < 0) {
+ if ((ret = ff_adx_decode_header(avctx, avctx->extradata,
+ avctx->extradata_size, &header_size,
+ c->coeff)) < 0) {
av_log(avctx, AV_LOG_ERROR, "error parsing ADX header\n");
return AVERROR_INVALIDDATA;
}
if (!c->header_parsed && buf_size >= 2 && AV_RB16(buf) == 0x8000) {
int header_size;
- if ((ret = avpriv_adx_decode_header(avctx, buf, buf_size, &header_size,
- c->coeff)) < 0) {
+ if ((ret = ff_adx_decode_header(avctx, buf, buf_size, &header_size,
+ c->coeff)) < 0) {
av_log(avctx, AV_LOG_ERROR, "error parsing ADX header\n");
return AVERROR_INVALIDDATA;
}
*/
#include "libavutil/intreadwrite.h"
-#include "libavcodec/adx.h"
#include "avformat.h"
#include "internal.h"
{
ADXDemuxerContext *c = s->priv_data;
AVCodecContext *avctx;
- int ret;
AVStream *st = avformat_new_stream(s, NULL);
if (!st)
}
avctx->extradata_size = c->header_size;
- ret = avpriv_adx_decode_header(avctx, avctx->extradata,
- avctx->extradata_size, &c->header_size,
- NULL);
- if (ret)
- return ret;
+ if (avctx->extradata_size < 12) {
+ av_log(s, AV_LOG_ERROR, "Invalid extradata size.\n");
+ return AVERROR_INVALIDDATA;
+ }
+ avctx->sample_rate = AV_RB32(avctx->extradata + 8);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = s->iformat->raw_codec_id;