History

Merge commit 'b5f19f7478492307e4b4763aeac3180faf50e17f'

* commit 'b5f19f7478492307e4b4763aeac3180faf50e17f': aac: Split function to parse ADTS header data into public and private part

James Almer committed 9 years ago

Commit b9d3def2 parents ff173ce b5f19f714 files · +141 −52Browse files

Unified · Split

14 files
  1. configure +6 −2
  2. doc/developer.texi +1 −1
  3. libavcodec/Makefile +7 −6
  4. libavcodec/aac_adtstoasc_bsf.c +7 −6
  5. libavcodec/aac_parser.c +6 −4
  6. libavcodec/aacdec.c +1 −1
  7. libavcodec/aacdec_fixed.c +1 −1
  8. libavcodec/aacdec_template.c +1 −1
  9. libavcodec/adts_header.c +4 −3
  10. libavcodec/adts_header.h +4 −8
  11. libavcodec/adts_parser.c +44 −0
  12. libavcodec/adts_parser.h +37 −0
  13. libavformat/spdifdec.c +14 −10
  14. libavformat/spdifenc.c +8 −9
configure+6−2
@@ -2135,6 +2135,7 @@ HAVE_LIST=" · 2134 unmodified lines
21352135 CONFIG_EXTRA="
21362136 aandcttables
21372137 ac3dsp
2138+ adts_header
21382139 audio_frame_queue
21392140 audiodsp
21402141 blockdsp
@@ -2421,7 +2422,7 @@ vc1dsp_select="h264chroma qpeldsp startcode" · 280 unmodified lines
24212422 rdft_select="fft"
24222423
24232424 # decoders / encoders
2424−aac_decoder_select="mdct15 mdct sinewin"
2425+aac_decoder_select="adts_header mdct15 mdct sinewin"
24252426 aac_fixed_decoder_select="mdct sinewin"
24262427 aac_encoder_select="audio_frame_queue iirfilter lpc mdct sinewin"
24272428 aac_latm_decoder_select="aac_decoder aac_latm_parser"
@@ -2873,6 +2874,7 @@ vp9_v4l2m2m_decoder_deps="v4l2_m2m vp9_v4l2_m2m" · 445 unmodified lines
28732874 wmv3_crystalhd_decoder_select="crystalhd"
28742875
28752876 # parsers
2877+aac_parser_select="adts_header"
28762878 h264_parser_select="golomb h264dsp h264parse"
28772879 hevc_parser_select="hevcparse"
28782880 mpegaudio_parser_select="mpegaudioheader"
@@ -2881,6 +2883,7 @@ mpeg4video_parser_select="h263dsp mpegvideo qpeldsp" · 2 unmodified lines
28812883 vc1_parser_select="vc1dsp"
28822884
28832885 # bitstream_filters
2886+aac_adtstoasc_bsf_select="adts_header"
28842887 h264_metadata_bsf_select="cbs_h264"
28852888 h264_redundant_pps_bsf_select="cbs_h264"
28862889 hevc_metadata_bsf_select="cbs_h265"
@@ -3047,7 +3050,8 @@ sap_demuxer_select="sdp_demuxer" · 160 unmodified lines
30473050 sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
30483051 sdp_demuxer_select="rtpdec"
30493052 smoothstreaming_muxer_select="ismv_muxer"
3050−spdif_muxer_select="aac_parser"
3053+spdif_demuxer_select="adts_header"
3054+spdif_muxer_select="adts_header"
30513055 spx_muxer_select="ogg_muxer"
30523056 swf_demuxer_suggest="zlib"
30533057 tak_demuxer_select="tak_parser"
doc/developer.texi+1−1
@@ -184,7 +184,7 @@ e.g. @samp{ff_w64_demuxer}. · 183 unmodified lines
184184 @item
185185 For variables and functions visible outside of file scope, used internally
186186 across multiple libraries, use @code{avpriv_} as prefix, for example,
187−@samp{avpriv_aac_parse_header}.
187+@samp{avpriv_report_missing_feature}.
188188
189189 @item
190190 Each library has its own prefix for public symbols, in addition to the
libavcodec/Makefile+7−6
@@ -2,6 +2,7 @@ NAME = avcodec · 1 unmodified line
22 DESC = FFmpeg codec library
33
44 HEADERS = ac3_parser.h \
5+ adts_parser.h \
56 avcodec.h \
67 avdct.h \
78 avfft.h \
@@ -20,6 +21,7 @@ HEADERS = ac3_parser.h \ · 12 unmodified lines
2021 xvmc.h \
2122
2223 OBJS = ac3_parser.o \
24+ adts_parser.o \
2325 allcodecs.o \
2426 avdct.o \
2527 avpacket.o \
@@ -52,6 +54,7 @@ OBJS = ac3_parser.o \ · 26 unmodified lines
5254 # subsystems
5355 OBJS-$(CONFIG_AANDCTTABLES) += aandcttab.o
5456 OBJS-$(CONFIG_AC3DSP) += ac3dsp.o ac3.o ac3tab.o
57+OBJS-$(CONFIG_ADTS_HEADER) += adts_header.o mpeg4audio.o
5558 OBJS-$(CONFIG_AUDIO_FRAME_QUEUE) += audio_frame_queue.o
5659 OBJS-$(CONFIG_AUDIODSP) += audiodsp.o
5760 OBJS-$(CONFIG_BLOCKDSP) += blockdsp.o
@@ -148,10 +151,10 @@ OBJS-$(CONFIG_ZERO12V_DECODER) += 012v.o · 90 unmodified lines
148151 OBJS-$(CONFIG_A64MULTI_ENCODER) += a64multienc.o elbg.o
149152 OBJS-$(CONFIG_A64MULTI5_ENCODER) += a64multienc.o elbg.o
150153 OBJS-$(CONFIG_AAC_DECODER) += aacdec.o aactab.o aacsbr.o aacps_float.o \
151− aacadtsdec.o mpeg4audio.o kbdwin.o \
154+ mpeg4audio.o kbdwin.o \
152155 sbrdsp.o aacpsdsp_float.o cbrt_data.o
153156 OBJS-$(CONFIG_AAC_FIXED_DECODER) += aacdec_fixed.o aactab.o aacsbr_fixed.o aacps_fixed.o \
154− aacadtsdec.o mpeg4audio.o kbdwin.o \
157+ mpeg4audio.o kbdwin.o \
155158 sbrdsp_fixed.o aacpsdsp_fixed.o cbrt_data_fixed.o
156159 OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o aacenctab.o \
157160 aacpsy.o aactab.o \
@@ -880,7 +883,6 @@ OBJS-$(CONFIG_MXF_MUXER) += dnxhddata.o · 722 unmodified lines
880883 OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o
881884 OBJS-$(CONFIG_NUT_DEMUXER) += mpegaudiodata.o mpeg4audio.o
882885 OBJS-$(CONFIG_RTP_MUXER) += mpeg4audio.o
883−OBJS-$(CONFIG_SPDIF_DEMUXER) += aacadtsdec.o mpeg4audio.o
884886 OBJS-$(CONFIG_SPDIF_MUXER) += dca.o
885887 OBJS-$(CONFIG_TAK_DEMUXER) += tak.o
886888 OBJS-$(CONFIG_WEBM_MUXER) += mpeg4audio.o
@@ -957,7 +959,7 @@ OBJS-$(CONFIG_LIBZVBI_TELETEXT_DECODER) += libzvbi-teletextdec.o ass.o · 70 unmodified lines
957959 # parsers
958960 OBJS-$(CONFIG_AAC_LATM_PARSER) += latm_parser.o
959961 OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o \
960− aacadtsdec.o mpeg4audio.o
962+ mpeg4audio.o
961963 OBJS-$(CONFIG_AC3_PARSER) += ac3tab.o aac_ac3_parser.o
962964 OBJS-$(CONFIG_ADX_PARSER) += adx_parser.o adx.o
963965 OBJS-$(CONFIG_BMP_PARSER) += bmp_parser.o
@@ -1003,8 +1005,7 @@ OBJS-$(CONFIG_VP9_PARSER) += vp9_parser.o · 39 unmodified lines
10031005 OBJS-$(CONFIG_XMA_PARSER) += xma_parser.o
10041006
10051007 # bitstream filters
1006−OBJS-$(CONFIG_AAC_ADTSTOASC_BSF) += aac_adtstoasc_bsf.o aacadtsdec.o \
1007− mpeg4audio.o
1008+OBJS-$(CONFIG_AAC_ADTSTOASC_BSF) += aac_adtstoasc_bsf.o mpeg4audio.o
10081009 OBJS-$(CONFIG_CHOMP_BSF) += chomp_bsf.o
10091010 OBJS-$(CONFIG_DUMP_EXTRADATA_BSF) += dump_extradata_bsf.o
10101011 OBJS-$(CONFIG_DCA_CORE_BSF) += dca_core_bsf.o
libavcodec/aac_adtstoasc_bsf.c+7−6
@@ -19,8 +19,9 @@ · 18 unmodified lines
1919 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2020 */
2121
22+#include "adts_header.h"
23+#include "adts_parser.h"
2224 #include "avcodec.h"
23−#include "aacadtsdec.h"
2425 #include "bsf.h"
2526 #include "put_bits.h"
2627 #include "get_bits.h"
@@ -52,12 +53,12 @@ static int aac_adtstoasc_filter(AVBSFContext *bsfc, AVPacket *out) · 25 unmodified lines
5253 if (bsfc->par_in->extradata && in->size >= 2 && (AV_RB16(in->data) >> 4) != 0xfff)
5354 goto finish;
5455
55− if (in->size < AAC_ADTS_HEADER_SIZE)
56+ if (in->size < AV_AAC_ADTS_HEADER_SIZE)
5657 goto packet_too_small;
5758
58− init_get_bits(&gb, in->data, AAC_ADTS_HEADER_SIZE * 8);
59+ init_get_bits(&gb, in->data, AV_AAC_ADTS_HEADER_SIZE * 8);
5960
60− if (avpriv_aac_parse_header(&gb, &hdr) < 0) {
61+ if (ff_adts_header_parse(&gb, &hdr) < 0) {
6162 av_log(bsfc, AV_LOG_ERROR, "Error parsing ADTS frame header!\n");
6263 ret = AVERROR_INVALIDDATA;
6364 goto fail;
@@ -70,10 +71,10 @@ static int aac_adtstoasc_filter(AVBSFContext *bsfc, AVPacket *out) · 6 unmodified lines
7071 goto fail;
7172 }
7273
73− in->size -= AAC_ADTS_HEADER_SIZE + 2 * !hdr.crc_absent;
74+ in->size -= AV_AAC_ADTS_HEADER_SIZE + 2 * !hdr.crc_absent;
7475 if (in->size <= 0)
7576 goto packet_too_small;
76− in->data += AAC_ADTS_HEADER_SIZE + 2 * !hdr.crc_absent;
77+ in->data += AV_AAC_ADTS_HEADER_SIZE + 2 * !hdr.crc_absent;
7778
7879 if (!ctx->first_frame_done) {
7980 int pce_size = 0;
libavcodec/aac_parser.c+6−4
@@ -22,7 +22,8 @@ · 21 unmodified lines
2222
2323 #include "parser.h"
2424 #include "aac_ac3_parser.h"
25−#include "aacadtsdec.h"
25+#include "adts_header.h"
26+#include "adts_parser.h"
2627 #include "get_bits.h"
2728 #include "mpeg4audio.h"
2829
@@ -38,9 +39,10 @@ static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info, · 9 unmodified lines
3839 } tmp;
3940
4041 tmp.u64 = av_be2ne64(state);
41− init_get_bits(&bits, tmp.u8+8-AAC_ADTS_HEADER_SIZE, AAC_ADTS_HEADER_SIZE * 8);
42+ init_get_bits(&bits, tmp.u8 + 8 - AV_AAC_ADTS_HEADER_SIZE,
43+ AV_AAC_ADTS_HEADER_SIZE * 8);
4244
43− if ((size = avpriv_aac_parse_header(&bits, &hdr)) < 0)
45+ if ((size = ff_adts_header_parse(&bits, &hdr)) < 0)
4446 return 0;
4547 *need_next_header = 0;
4648 *new_frame_start = 1;
@@ -54,7 +56,7 @@ static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info, · 7 unmodified lines
5456 static av_cold int aac_parse_init(AVCodecParserContext *s1)
5557 {
5658 AACAC3ParseContext *s = s1->priv_data;
57− s->header_size = AAC_ADTS_HEADER_SIZE;
59+ s->header_size = AV_AAC_ADTS_HEADER_SIZE;
5860 s->sync = aac_sync;
5961 return 0;
6062 }
libavcodec/aacdec.c+1−1
@@ -50,11 +50,11 @@ · 49 unmodified lines
5050 #include "aac.h"
5151 #include "aactab.h"
5252 #include "aacdectab.h"
53+#include "adts_header.h"
5354 #include "cbrt_data.h"
5455 #include "sbr.h"
5556 #include "aacsbr.h"
5657 #include "mpeg4audio.h"
57−#include "aacadtsdec.h"
5858 #include "profiles.h"
5959 #include "libavutil/intfloat.h"
6060
libavcodec/aacdec_fixed.c+1−1
@@ -75,11 +75,11 @@ · 74 unmodified lines
7575 #include "aac.h"
7676 #include "aactab.h"
7777 #include "aacdectab.h"
78+#include "adts_header.h"
7879 #include "cbrt_data.h"
7980 #include "sbr.h"
8081 #include "aacsbr.h"
8182 #include "mpeg4audio.h"
82−#include "aacadtsdec.h"
8383 #include "profiles.h"
8484 #include "libavutil/intfloat.h"
8585
libavcodec/aacdec_template.c+1−1
@@ -2955,7 +2955,7 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb) · 2954 unmodified lines
29552955 uint8_t layout_map[MAX_ELEM_ID*4][3];
29562956 int layout_map_tags, ret;
29572957
2958− size = avpriv_aac_parse_header(gb, &hdr_info);
2958+ size = ff_adts_header_parse(gb, &hdr_info);
29592959 if (size > 0) {
29602960 if (!ac->warned_num_aac_frames && hdr_info.num_aac_frames != 1) {
29612961 // This is 2 for "VLB " audio in NSV files.
libavcodec/adts_header.crenamed from libavcodec/aacadtsdec.c+4−3
@@ -22,11 +22,12 @@ · 21 unmodified lines
2222 */
2323
2424 #include "aac_ac3_parser.h"
25−#include "aacadtsdec.h"
25+#include "adts_header.h"
26+#include "adts_parser.h"
2627 #include "get_bits.h"
2728 #include "mpeg4audio.h"
2829
29−int avpriv_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr)
30+int ff_adts_header_parse(GetBitContext *gbc, AACADTSHeaderInfo *hdr)
3031 {
3132 int size, rdb, ch, sr;
3233 int aot, crc_abs;
@@ -51,7 +52,7 @@ int avpriv_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr) · 18 unmodified lines
5152 skip_bits1(gbc); /* copyright_identification_bit */
5253 skip_bits1(gbc); /* copyright_identification_start */
5354 size = get_bits(gbc, 13); /* aac_frame_length */
54− if (size < AAC_ADTS_HEADER_SIZE)
55+ if (size < AV_AAC_ADTS_HEADER_SIZE)
5556 return AAC_AC3_PARSE_ERROR_FRAME_SIZE;
5657
5758 skip_bits(gbc, 11); /* adts_buffer_fullness */
libavcodec/adts_header.hrenamed from libavcodec/aacadtsdec.h+4−8
@@ -20,14 +20,11 @@ · 19 unmodified lines
2020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2121 */
2222
23−#ifndef AVCODEC_AACADTSDEC_H
24−#define AVCODEC_AACADTSDEC_H
23+#ifndef AVCODEC_ADTS_HEADER_H
24+#define AVCODEC_ADTS_HEADER_H
2525
26−#include <stdint.h>
2726 #include "get_bits.h"
2827
29−#define AAC_ADTS_HEADER_SIZE 7
30−
3128 typedef struct AACADTSHeaderInfo {
3229 uint32_t sample_rate;
3330 uint32_t samples;
@@ -40,7 +37,6 @@ typedef struct AACADTSHeaderInfo { · 6 unmodified lines
4037 } AACADTSHeaderInfo;
4138
4239 /**
43− * Parse AAC frame header.
4440 * Parse the ADTS frame header to the end of the variable header, which is
4541 * the first 54 bits.
4642 * @param[in] gbc BitContext containing the first 54 bits of the frame.
@@ -49,6 +45,6 @@ typedef struct AACADTSHeaderInfo { · 2 unmodified lines
4945 * -2 if the version element is invalid, -3 if the sample rate
5046 * element is invalid, or -4 if the bit rate element is invalid.
5147 */
52−int avpriv_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr);
48+int ff_adts_header_parse(GetBitContext *gbc, AACADTSHeaderInfo *hdr);
5349
54−#endif /* AVCODEC_AACADTSDEC_H */
50+#endif /* AVCODEC_ADTS_HEADER_H */
libavcodec/adts_parser.c+44−0
@@ -0,0 +1,44 @@
1+/*
2+ * This file is part of FFmpeg.
3+ *
4+ * FFmpeg is free software; you can redistribute it and/or
5+ * modify it under the terms of the GNU Lesser General Public
6+ * License as published by the Free Software Foundation; either
7+ * version 2.1 of the License, or (at your option) any later version.
8+ *
9+ * FFmpeg is distributed in the hope that it will be useful,
10+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+ * Lesser General Public License for more details.
13+ *
14+ * You should have received a copy of the GNU Lesser General Public
15+ * License along with FFmpeg; if not, write to the Free Software
16+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17+ */
18+
19+#include "config.h"
20+
21+#include <stddef.h>
22+#include <stdint.h>
23+
24+#include "adts_header.h"
25+#include "adts_parser.h"
26+
27+int av_adts_header_parse(const uint8_t *buf, uint32_t *samples, uint8_t *frames)
28+{
29+#if CONFIG_ADTS_HEADER
30+ GetBitContext gb;
31+ AACADTSHeaderInfo hdr;
32+ int err = init_get_bits8(&gb, buf, AV_AAC_ADTS_HEADER_SIZE);
33+ if (err < 0)
34+ return err;
35+ err = ff_adts_header_parse(&gb, &hdr);
36+ if (err < 0)
37+ return err;
38+ *samples = hdr.samples;
39+ *frames = hdr.num_aac_frames;
40+ return 0;
41+#else
42+ return AVERROR(ENOSYS);
43+#endif
44+}
libavcodec/adts_parser.h+37−0
@@ -0,0 +1,37 @@
1+/*
2+ * This file is part of FFmpeg.
3+ *
4+ * FFmpeg is free software; you can redistribute it and/or
5+ * modify it under the terms of the GNU Lesser General Public
6+ * License as published by the Free Software Foundation; either
7+ * version 2.1 of the License, or (at your option) any later version.
8+ *
9+ * FFmpeg is distributed in the hope that it will be useful,
10+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+ * Lesser General Public License for more details.
13+ *
14+ * You should have received a copy of the GNU Lesser General Public
15+ * License along with FFmpeg; if not, write to the Free Software
16+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17+ */
18+
19+#ifndef AVCODEC_ADTS_PARSER_H
20+#define AVCODEC_ADTS_PARSER_H
21+
22+#include <stddef.h>
23+#include <stdint.h>
24+
25+#define AV_AAC_ADTS_HEADER_SIZE 7
26+
27+/**
28+ * Extract the number of samples and frames from AAC data.
29+ * @param[in] buf pointer to AAC data buffer
30+ * @param[out] samples Pointer to where number of samples is written
31+ * @param[out] frames Pointer to where number of frames is written
32+ * @return Returns 0 on success, error code on failure.
33+ */
34+int av_adts_header_parse(const uint8_t *buf, uint32_t *samples,
35+ uint8_t *frames);
36+
37+#endif /* AVCODEC_ADTS_PARSER_H */
libavformat/spdifdec.c+14−10
@@ -25,18 +25,22 @@ · 24 unmodified lines
2525 * @author Anssi Hannula
2626 */
2727
28+#include "libavutil/bswap.h"
29+
30+#include "libavcodec/ac3.h"
31+#include "libavcodec/adts_parser.h"
32+
2833 #include "avformat.h"
2934 #include "spdif.h"
30−#include "libavcodec/ac3.h"
31−#include "libavcodec/aacadtsdec.h"
3235
3336 static int spdif_get_offset_and_codec(AVFormatContext *s,
3437 enum IEC61937DataType data_type,
3538 const char *buf, int *offset,
3639 enum AVCodecID *codec)
3740 {
38− AACADTSHeaderInfo aac_hdr;
39− GetBitContext gbc;
41+ uint32_t samples;
42+ uint8_t frames;
43+ int ret;
4044
4145 switch (data_type & 0xff) {
4246 case IEC61937_AC3:
@@ -56,13 +60,13 @@ static int spdif_get_offset_and_codec(AVFormatContext *s, · 13 unmodified lines
5660 *codec = AV_CODEC_ID_MP3;
5761 break;
5862 case IEC61937_MPEG2_AAC:
59− init_get_bits(&gbc, buf, AAC_ADTS_HEADER_SIZE * 8);
60− if (avpriv_aac_parse_header(&gbc, &aac_hdr) < 0) {
63+ ret = av_adts_header_parse(buf, &samples, &frames);
64+ if (ret < 0) {
6165 if (s) /* be silent during a probe */
6266 av_log(s, AV_LOG_ERROR, "Invalid AAC packet in IEC 61937\n");
63− return AVERROR_INVALIDDATA;
67+ return ret;
6468 }
65− *offset = aac_hdr.samples << 2;
69+ *offset = samples << 2;
6670 *codec = AV_CODEC_ID_AAC;
6771 break;
6872 case IEC61937_MPEG2_LAYER1_LSF:
@@ -100,7 +104,7 @@ static int spdif_get_offset_and_codec(AVFormatContext *s, · 31 unmodified lines
100104 }
101105
102106 /* Largest offset between bursts we currently handle, i.e. AAC with
103− aac_hdr.samples = 4096 */
107+ samples = 4096 */
104108 #define SPDIF_MAX_OFFSET 16384
105109
106110 static int spdif_probe(AVProbeData *p)
@@ -132,7 +136,7 @@ int ff_spdif_probe(const uint8_t *p_buf, int buf_size, enum AVCodecID *codec) · 25 unmodified lines
132136 } else
133137 consecutive_codes = 0;
134138
135− if (buf + 4 + AAC_ADTS_HEADER_SIZE > p_buf + buf_size)
139+ if (buf + 4 + AV_AAC_ADTS_HEADER_SIZE > p_buf + buf_size)
136140 break;
137141
138142 /* continue probing to find more sync codes */
libavformat/spdifenc.c+8−9
@@ -50,9 +50,9 @@ · 49 unmodified lines
5050 #include "avio_internal.h"
5151 #include "spdif.h"
5252 #include "libavcodec/ac3.h"
53+#include "libavcodec/adts_parser.h"
5354 #include "libavcodec/dca.h"
5455 #include "libavcodec/dca_syncwords.h"
55−#include "libavcodec/aacadtsdec.h"
5656 #include "libavutil/opt.h"
5757
5858 typedef struct IEC61937Context {
@@ -349,19 +349,18 @@ static int spdif_header_mpeg(AVFormatContext *s, AVPacket *pkt) · 290 unmodified lines
349349 static int spdif_header_aac(AVFormatContext *s, AVPacket *pkt)
350350 {
351351 IEC61937Context *ctx = s->priv_data;
352− AACADTSHeaderInfo hdr;
353− GetBitContext gbc;
352+ uint32_t samples;
353+ uint8_t frames;
354354 int ret;
355355
356− init_get_bits(&gbc, pkt->data, AAC_ADTS_HEADER_SIZE * 8);
357− ret = avpriv_aac_parse_header(&gbc, &hdr);
356+ ret = av_adts_header_parse(pkt->data, &samples, &frames);
358357 if (ret < 0) {
359358 av_log(s, AV_LOG_ERROR, "Wrong AAC file format\n");
360− return AVERROR_INVALIDDATA;
359+ return ret;
361360 }
362361
363− ctx->pkt_offset = hdr.samples << 2;
364− switch (hdr.num_aac_frames) {
362+ ctx->pkt_offset = samples << 2;
363+ switch (frames) {
365364 case 1:
366365 ctx->data_type = IEC61937_MPEG2_AAC;
367366 break;
@@ -373,7 +372,7 @@ static int spdif_header_aac(AVFormatContext *s, AVPacket *pkt) · 5 unmodified lines
373372 break;
374373 default:
375374 av_log(s, AV_LOG_ERROR,
376− "%"PRIu32" samples in AAC frame not supported\n", hdr.samples);
375+ "%"PRIu32" samples in AAC frame not supported\n", samples);
377376 return AVERROR(EINVAL);
378377 }
379378 //TODO Data type dependent info (LC profile/SBR)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t