summaryrefslogtreecommitdiff
path: root/libavformat/spdifenc.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2017-10-30 18:56:45 -0300
committerJames Almer <jamrial@gmail.com>2017-10-30 18:56:45 -0300
commitb9d3def9b2cb77eb83542086aa3ac883b4d7efa4 (patch)
treea35626011027d7ec2a3165dcc09ff912ed9c1821 /libavformat/spdifenc.c
parentff173ce8f1a8d043ce87c02a017ec55bb51b2297 (diff)
parentb5f19f7478492307e4b4763aeac3180faf50e17f (diff)
Merge commit 'b5f19f7478492307e4b4763aeac3180faf50e17f'
* commit 'b5f19f7478492307e4b4763aeac3180faf50e17f': aac: Split function to parse ADTS header data into public and private part Merged-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/spdifenc.c')
-rw-r--r--libavformat/spdifenc.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c
index b47ec123e8..3a50aebbef 100644
--- a/libavformat/spdifenc.c
+++ b/libavformat/spdifenc.c
@@ -50,9 +50,9 @@
#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 {
@@ -349,19 +349,18 @@ static int spdif_header_mpeg(AVFormatContext *s, AVPacket *pkt)
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;
@@ -373,7 +372,7 @@ static int spdif_header_aac(AVFormatContext *s, AVPacket *pkt)
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)