#include "avio_internal.h"
#include "spdif.h"
#include "libavcodec/ac3.h"
+#include "libavcodec/adts_parser.h"
#include "libavcodec/dca.h"
#include "libavcodec/dca_syncwords.h"
-#include "libavcodec/aacadtsdec.h"
#include "libavutil/opt.h"
typedef struct IEC61937Context {
static int spdif_header_aac(AVFormatContext *s, AVPacket *pkt)
{
IEC61937Context *ctx = s->priv_data;
- AACADTSHeaderInfo hdr;
- GetBitContext gbc;
+ uint32_t samples;
+ uint8_t frames;
int ret;
- init_get_bits(&gbc, pkt->data, AAC_ADTS_HEADER_SIZE * 8);
- ret = avpriv_aac_parse_header(&gbc, &hdr);
+ ret = av_adts_header_parse(pkt->data, &samples, &frames);
if (ret < 0) {
av_log(s, AV_LOG_ERROR, "Wrong AAC file format\n");
- return AVERROR_INVALIDDATA;
+ return ret;
}
- ctx->pkt_offset = hdr.samples << 2;
- switch (hdr.num_aac_frames) {
+ ctx->pkt_offset = samples << 2;
+ switch (frames) {
case 1:
ctx->data_type = IEC61937_MPEG2_AAC;
break;
break;
default:
av_log(s, AV_LOG_ERROR,
- "%"PRIu32" samples in AAC frame not supported\n", hdr.samples);
+ "%"PRIu32" samples in AAC frame not supported\n", samples);
return AVERROR(EINVAL);
}
//TODO Data type dependent info (LC profile/SBR)