Commit e932ae59 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'd5cf5afa'

* commit 'd5cf5afa':
  adxdec: get rid of an avpriv function
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 1b58f137 d5cf5afa
...@@ -666,7 +666,6 @@ OBJS-$(CONFIG_VC1_VDPAU_HWACCEL) += vdpau_vc1.o ...@@ -666,7 +666,6 @@ OBJS-$(CONFIG_VC1_VDPAU_HWACCEL) += vdpau_vc1.o
# libavformat dependencies # libavformat dependencies
OBJS-$(CONFIG_ADTS_MUXER) += mpeg4audio.o OBJS-$(CONFIG_ADTS_MUXER) += mpeg4audio.o
OBJS-$(CONFIG_ADX_DEMUXER) += adx.o
OBJS-$(CONFIG_CAF_DEMUXER) += mpeg4audio.o mpegaudiodata.o \ OBJS-$(CONFIG_CAF_DEMUXER) += mpeg4audio.o mpegaudiodata.o \
ac3tab.o ac3tab.o
OBJS-$(CONFIG_FLAC_DEMUXER) += flac.o flacdata.o vorbis_data.o \ OBJS-$(CONFIG_FLAC_DEMUXER) += flac.o flacdata.o vorbis_data.o \
......
...@@ -35,8 +35,8 @@ void ff_adx_calculate_coeffs(int cutoff, int sample_rate, int bits, int *coeff) ...@@ -35,8 +35,8 @@ void ff_adx_calculate_coeffs(int cutoff, int sample_rate, int bits, int *coeff)
coeff[1] = lrintf(-(c * c) * (1 << bits)); coeff[1] = lrintf(-(c * c) * (1 << bits));
} }
int avpriv_adx_decode_header(AVCodecContext *avctx, const uint8_t *buf, int ff_adx_decode_header(AVCodecContext *avctx, const uint8_t *buf,
int bufsize, int *header_size, int *coeff) int bufsize, int *header_size, int *coeff)
{ {
int offset, cutoff; int offset, cutoff;
...@@ -80,3 +80,11 @@ int avpriv_adx_decode_header(AVCodecContext *avctx, const uint8_t *buf, ...@@ -80,3 +80,11 @@ int avpriv_adx_decode_header(AVCodecContext *avctx, const uint8_t *buf,
*header_size = offset; *header_size = offset;
return 0; 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
...@@ -74,7 +74,12 @@ void ff_adx_calculate_coeffs(int cutoff, int sample_rate, int bits, int *coeff); ...@@ -74,7 +74,12 @@ void ff_adx_calculate_coeffs(int cutoff, int sample_rate, int bits, int *coeff);
* @param[out] coeff 2 LPC coefficients, can be NULL * @param[out] coeff 2 LPC coefficients, can be NULL
* @return data offset or negative error code if header is invalid * @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 avpriv_adx_decode_header(AVCodecContext *avctx, const uint8_t *buf,
int bufsize, int *header_size, int *coeff); int bufsize, int *header_size, int *coeff);
#endif
#endif /* AVCODEC_ADX_H */ #endif /* AVCODEC_ADX_H */
...@@ -40,9 +40,9 @@ static av_cold int adx_decode_init(AVCodecContext *avctx) ...@@ -40,9 +40,9 @@ static av_cold int adx_decode_init(AVCodecContext *avctx)
int ret, header_size; int ret, header_size;
if (avctx->extradata_size >= 24) { if (avctx->extradata_size >= 24) {
if ((ret = avpriv_adx_decode_header(avctx, avctx->extradata, if ((ret = ff_adx_decode_header(avctx, avctx->extradata,
avctx->extradata_size, &header_size, avctx->extradata_size, &header_size,
c->coeff)) < 0) { c->coeff)) < 0) {
av_log(avctx, AV_LOG_ERROR, "error parsing ADX header\n"); av_log(avctx, AV_LOG_ERROR, "error parsing ADX header\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
...@@ -111,8 +111,8 @@ static int adx_decode_frame(AVCodecContext *avctx, void *data, ...@@ -111,8 +111,8 @@ static int adx_decode_frame(AVCodecContext *avctx, void *data,
if (!c->header_parsed && buf_size >= 2 && AV_RB16(buf) == 0x8000) { if (!c->header_parsed && buf_size >= 2 && AV_RB16(buf) == 0x8000) {
int header_size; int header_size;
if ((ret = avpriv_adx_decode_header(avctx, buf, buf_size, &header_size, if ((ret = ff_adx_decode_header(avctx, buf, buf_size, &header_size,
c->coeff)) < 0) { c->coeff)) < 0) {
av_log(avctx, AV_LOG_ERROR, "error parsing ADX header\n"); av_log(avctx, AV_LOG_ERROR, "error parsing ADX header\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
*/ */
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "libavcodec/adx.h"
#include "avformat.h" #include "avformat.h"
#include "internal.h" #include "internal.h"
...@@ -66,7 +65,6 @@ static int adx_read_header(AVFormatContext *s) ...@@ -66,7 +65,6 @@ static int adx_read_header(AVFormatContext *s)
{ {
ADXDemuxerContext *c = s->priv_data; ADXDemuxerContext *c = s->priv_data;
AVCodecContext *avctx; AVCodecContext *avctx;
int ret;
AVStream *st = avformat_new_stream(s, NULL); AVStream *st = avformat_new_stream(s, NULL);
if (!st) if (!st)
...@@ -81,11 +79,11 @@ static int adx_read_header(AVFormatContext *s) ...@@ -81,11 +79,11 @@ static int adx_read_header(AVFormatContext *s)
if (ff_get_extradata(avctx, s->pb, c->header_size) < 0) if (ff_get_extradata(avctx, s->pb, c->header_size) < 0)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
ret = avpriv_adx_decode_header(avctx, avctx->extradata, if (avctx->extradata_size < 12) {
avctx->extradata_size, &c->header_size, av_log(s, AV_LOG_ERROR, "Invalid extradata size.\n");
NULL); return AVERROR_INVALIDDATA;
if (ret) }
return ret; avctx->sample_rate = AV_RB32(avctx->extradata + 8);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = s->iformat->raw_codec_id; st->codec->codec_id = s->iformat->raw_codec_id;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment